diff --git a/.asf.yaml b/.asf.yaml index 43f0351bc7c9..3b2f7691d136 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -50,19 +50,18 @@ github: rebase: false collaborators: - - acs-robot - - gpordeus - - hsato03 - - bernardodemarco - - abh1sar - - FelipeM525 - - lucas-a-martins - - nicoschmdt + - ingox + - gp-santos + - erikbocks + - Imvedansh + - Damans227 + - jmsperu + - GaOrtiga protected_branches: ~ notifications: - commits: commits@cloudstack.apache.org - issues: commits@cloudstack.apache.org + commits: commits@cloudstack.apache.org + issues: commits@cloudstack.apache.org pullrequests: commits@cloudstack.apache.org - discussions: users@cloudstack.apache.org + discussions: users@cloudstack.apache.org diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000000..3c632f8ba534 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +[codespell] +ignore-words = .github/linters/codespell.txt +skip = systemvm/agent/noVNC/*,ui/package.json,ui/package-lock.json,ui/public/js/less.min.js,ui/public/locales/*.json,server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java,test/integration/smoke/test_ssl_offloading.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..1b06f3ebf53c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000000..689275cff115 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +/plugins/storage/volume/linstor @rp- +/plugins/storage/volume/storpool @slavkap +/plugins/storage/volume/ontap @rajiv1 @sandeeplocharla @piyush5 @suryag + +.pre-commit-config.yaml @jbampton +/.github/linters/ @jbampton + +/plugins/network-elements/nsx/ @Pearl1594 @nvazquez diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.yaml rename to .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/actions/install-nonoss/action.yml b/.github/actions/install-nonoss/action.yml new file mode 100644 index 000000000000..39a03213c29d --- /dev/null +++ b/.github/actions/install-nonoss/action.yml @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: 'Install CloudStack Non-OSS' +description: 'Clones and installs the shapeblue/cloudstack-nonoss repository.' + +runs: + using: "composite" + steps: + - name: Install cloudstack-nonoss + shell: bash + run: | + git clone --depth 1 https://github.com/shapeblue/cloudstack-nonoss.git nonoss + cd nonoss + bash -x install-non-oss.sh + cd .. + rm -fr nonoss diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml new file mode 100644 index 000000000000..0f8425229242 --- /dev/null +++ b/.github/actions/setup-env/action.yml @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: 'Setup CloudStack Environment' +description: 'Sets up JDK (with Maven cache), optionally Python, and optionally APT build dependencies for CloudStack.' + +inputs: + java-version: + description: 'The JDK version to use' + required: false + default: '17' + install-python: + description: 'Whether to install Python 3.10' + required: false + default: 'false' + install-apt-deps: + description: 'Whether to install CloudStack APT build dependencies' + required: false + default: 'false' + +runs: + using: "composite" + steps: + - name: Set up JDK ${{ inputs.java-version }} + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 + with: + java-version: ${{ inputs.java-version }} + distribution: 'adopt' + architecture: x64 + cache: 'maven' + + - name: Set up Python + if: ${{ inputs.install-python == 'true' }} + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.10' + architecture: x64 + + - name: Install Build Dependencies + if: ${{ inputs.install-apt-deps == 'true' }} + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y git uuid-runtime genisoimage netcat-openbsd ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json new file mode 100644 index 000000000000..ea25ffab6b9e --- /dev/null +++ b/.github/aw/actions-lock.json @@ -0,0 +1,56 @@ +{ + "entries": { + "actions/github-script@v9.0.0": { + "repo": "actions/github-script", + "version": "v9.0.0", + "sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3" + }, + "github/gh-aw-actions/setup@v0.76.1": { + "repo": "github/gh-aw-actions/setup", + "version": "v0.76.1", + "sha": "46d564922b082d0db93244972e8005ea6904ee5f" + } + }, + "containers": { + "ghcr.io/github/gh-aw-firewall/agent:0.18.0": { + "image": "ghcr.io/github/gh-aw-firewall/agent:0.18.0", + "digest": "sha256:ab84dfc7f5998cb8cd0c596526dd573b7e7d06c6a740266a1e6df879fa16c866", + "pinned_image": "ghcr.io/github/gh-aw-firewall/agent:0.18.0@sha256:ab84dfc7f5998cb8cd0c596526dd573b7e7d06c6a740266a1e6df879fa16c866" + }, + "ghcr.io/github/gh-aw-firewall/agent:0.25.55": { + "image": "ghcr.io/github/gh-aw-firewall/agent:0.25.55", + "digest": "sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731", + "pinned_image": "ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731" + }, + "ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55": { + "image": "ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55", + "digest": "sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3", + "pinned_image": "ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3" + }, + "ghcr.io/github/gh-aw-firewall/squid:0.18.0": { + "image": "ghcr.io/github/gh-aw-firewall/squid:0.18.0", + "digest": "sha256:82a5d062a5612a57a43a171a5b79ddbb690a86a8ddda02339cc1675131ae9f8b", + "pinned_image": "ghcr.io/github/gh-aw-firewall/squid:0.18.0@sha256:82a5d062a5612a57a43a171a5b79ddbb690a86a8ddda02339cc1675131ae9f8b" + }, + "ghcr.io/github/gh-aw-firewall/squid:0.25.55": { + "image": "ghcr.io/github/gh-aw-firewall/squid:0.25.55", + "digest": "sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca", + "pinned_image": "ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca" + }, + "ghcr.io/github/gh-aw-mcpg:v0.1.4": { + "image": "ghcr.io/github/gh-aw-mcpg:v0.1.4", + "digest": "sha256:0acf25aa1d409f9c73be9e39ac84f4bd4b90d8bfa1db4dc6d7f47d38ccd58914", + "pinned_image": "ghcr.io/github/gh-aw-mcpg:v0.1.4@sha256:0acf25aa1d409f9c73be9e39ac84f4bd4b90d8bfa1db4dc6d7f47d38ccd58914" + }, + "ghcr.io/github/gh-aw-mcpg:v0.3.19": { + "image": "ghcr.io/github/gh-aw-mcpg:v0.3.19", + "digest": "sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f", + "pinned_image": "ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f" + }, + "ghcr.io/github/github-mcp-server:v0.30.3": { + "image": "ghcr.io/github/github-mcp-server:v0.30.3", + "digest": "sha256:a2b5fb79b1cee851bfc3532dfe480c3dc5736974ca9d93a7a9f68e52ce4b62a0", + "pinned_image": "ghcr.io/github/github-mcp-server:v0.30.3@sha256:a2b5fb79b1cee851bfc3532dfe480c3dc5736974ca9d93a7a9f68e52ce4b62a0" + } + } +} diff --git a/.github/aw/imports/.gitattributes b/.github/aw/imports/.gitattributes new file mode 100644 index 000000000000..f0516fad90e4 --- /dev/null +++ b/.github/aw/imports/.gitattributes @@ -0,0 +1,5 @@ +# Mark all cached import files as generated +* linguist-generated=true + +# Use 'ours' merge strategy to keep local cached versions +* merge=ours diff --git a/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_noop-reminder.md b/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_noop-reminder.md new file mode 100644 index 000000000000..77cca08c1bec --- /dev/null +++ b/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_noop-reminder.md @@ -0,0 +1,5 @@ +**Important**: If no action is needed after completing your analysis, you **MUST** call the `noop` safe-output tool with a brief explanation. Failing to call any safe-output tool is the most common cause of safe-output workflow failures. + +```json +{"noop": {"message": "No action needed: [brief explanation of what was analyzed and why]"}} +``` diff --git a/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md b/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md new file mode 100644 index 000000000000..72d61b434efa --- /dev/null +++ b/.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md @@ -0,0 +1,73 @@ +--- +# Report formatting guidelines +--- + +## Report Structure Guidelines + +### 1. Header Levels +**Use h3 (###) or lower for all headers in your issue report to maintain proper document hierarchy.** + +When creating GitHub issues or discussions: +- Use `###` (h3) for main sections (e.g., "### Test Summary") +- Use `####` (h4) for subsections (e.g., "#### Device-Specific Results") +- Never use `##` (h2) or `#` (h1) in reports - these are reserved for titles + +### 2. Progressive Disclosure +**Wrap detailed test results in `
Section Name` tags to improve readability and reduce scrolling.** + +Use collapsible sections for: +- Verbose details (full test logs, raw data) +- Secondary information (minor warnings, extra context) +- Per-item breakdowns when there are many items + +Always keep critical information visible (summary, critical issues, key metrics). + +### 3. Report Structure Pattern + +1. **Overview**: 1-2 paragraphs summarizing key findings +2. **Critical Information**: Show immediately (summary stats, critical issues) +3. **Details**: Use `
Section Name` for expanded content +4. **Context**: Add helpful metadata (workflow run, date, trigger) + +### Design Principles (Airbnb-Inspired) + +Reports should: +- **Build trust through clarity**: Most important info immediately visible +- **Exceed expectations**: Add helpful context like trends, comparisons +- **Create delight**: Use progressive disclosure to reduce overwhelm +- **Maintain consistency**: Follow patterns across all reports + +### Example Report Structure + +```markdown +### Summary +- Key metric 1: value +- Key metric 2: value +- Status: ✅/⚠️/❌ + +### Critical Issues +[Always visible - these are important] + +
+View Detailed Results + +[Comprehensive details, logs, traces] + +
+ +
+View All Warnings + +[Minor issues and potential problems] + +
+ +### Recommendations +[Actionable next steps - keep visible] +``` + +## Workflow Run References + +- Format run IDs as links: `[§12345](https://github.com/owner/repo/actions/runs/12345)` +- Include up to 3 most relevant run URLs at end under `**References:**` +- Do NOT add footer attribution (system adds automatically) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000000..6ffb926f6fa0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,43 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + open-pull-requests-limit: 2 + schedule: + interval: "weekly" + groups: + github-actions-dependencies: + patterns: + - "*" + ignore: + - dependency-name: "github/gh-aw-actions/**" # Managed by gh aw compile. Version-locked to the gh-aw compiler; do not bump. + cooldown: + default-days: 7 + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + cooldown: + default-days: 7 diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml index 5e8d65905eb6..6a8a26f48497 100644 --- a/.github/linters/.markdown-lint.yml +++ b/.github/linters/.markdown-lint.yml @@ -18,9 +18,6 @@ # MD001/heading-increment Heading levels should only increment by one level at a time MD001: false -# MD003/heading-style Heading style -MD003: false - # MD004/ul-style Unordered list style MD004: false @@ -86,3 +83,6 @@ MD046: false # MD052/reference-links-images Reference links and images should use a label that is defined MD052: false + +# MD059/descriptive-link-text Link text should be descriptive +MD059: false diff --git a/.github/linters/.yamllint.yml b/.github/linters/.yamllint.yml new file mode 100644 index 000000000000..97b66848696a --- /dev/null +++ b/.github/linters/.yamllint.yml @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +--- +extends: default + +rules: + line-length: + max: 400 # Very forgiving for GitHub Actions and infrastructure files + indentation: disable # Disable indentation checking for existing files + comments: disable # Disable comment formatting checks + braces: disable + brackets: disable # Disable bracket spacing checks + colons: + max-spaces-after: -1 # Allow any number of spaces after colon + max-spaces-before: 0 + document-start: disable # Many files don't have --- + truthy: + allowed-values: ['true', 'false', 'on', 'off', 'yes', 'no'] diff --git a/.github/linters/codespell.txt b/.github/linters/codespell.txt index 37b3e6de1cbe..67cbeaa7cbb3 100644 --- a/.github/linters/codespell.txt +++ b/.github/linters/codespell.txt @@ -4,6 +4,7 @@ acount actuall acuiring acumulate +addin addreess addtion adminstrator @@ -12,10 +13,8 @@ afrer afterall againt ags -aktive algoritm allo -alloacate allocted alocation alogrithm @@ -65,6 +64,7 @@ bject boardcast bootstraper bu +callin cant capabilites capablity @@ -73,6 +73,7 @@ carrefully cavaet chaing checkd +checkin childs choosen chould @@ -93,7 +94,6 @@ confg configruation configuable conneciton -connexion constrait constraits containg @@ -101,9 +101,7 @@ contex continuesly contro controler -controles controll -convienient convinience coputer correcponding @@ -158,13 +156,13 @@ differnet differnt direcotry directroy -disale disbale discrepency disover dissapper dissassociated divice +dockin doesn' doesnot doesnt @@ -175,7 +173,6 @@ eanbled earch ect elemnt -eles elments emmited enble @@ -183,29 +180,23 @@ encryted enebled enmpty entires -enviornment environmnet equivalant erro erronous -everthing everytime -excetion -excption excute execept execption +exects execut executeable exeeded exisitng exisits -existin existsing -exitting expcted expection -explaination explicitely faield faild @@ -218,7 +209,6 @@ fillled findout fisrt fo -folowing fowarding frist fro @@ -237,6 +227,7 @@ hanling happend hasing hasnt +havin hda hostanme hould @@ -256,20 +247,14 @@ implmeneted implmentation incase includeing -incosistency indecates -indien infor informations informaton -infrastrcuture ingore -inital initalize initator -initilization inspite -instace instal instnace intefaces @@ -287,12 +272,8 @@ ist klunky lable leve -lief limite -linke listner -lokal -lokales maintainence maintenace maintenence @@ -301,7 +282,6 @@ mambers manaully manuel maxium -mehtod mergable mesage messge @@ -311,7 +291,6 @@ minumum mis modifers mor -mot mulitply multipl multple @@ -325,7 +304,7 @@ nin nodel nome noone -nowe +notin numbe numer occured @@ -378,6 +357,7 @@ propogate provison psudo pyhsical +re-use readabilty readd reccuring @@ -392,12 +372,9 @@ remaning remore remvoing renabling -repeatly reponse reqest reqiured -requieres -requried reserv reserverd reseted @@ -414,17 +391,15 @@ retriving retrun retuned returing -re-use rever rocessor +roperty runing runnign sate scalled -scipt scirpt scrip -seconadry seconday seesion sepcified @@ -437,12 +412,10 @@ settig sevices shoul shoule -sie signle simplier singature skiping -snaphsot snpashot specied specifed @@ -453,7 +426,6 @@ standy statics stickyness stil -stip storeage strat streched @@ -462,7 +434,6 @@ succesfull successfull suceessful suces -sucessfully suiteable suppots suppport @@ -495,7 +466,6 @@ uncompressible uneccessarily unexepected unexpect -unknow unkonw unkown unneccessary @@ -503,14 +473,12 @@ unparseable unrecoginized unsupport unxpected -updat uptodate usera usign usin utlization vaidate -valiate valule valus varibles @@ -519,8 +487,6 @@ verfying verifing virutal visable -wakup wil wit -wll wth diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd3c8f8ac67d..4eb508f5f6f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,41 +16,27 @@ # under the License. name: Build - -on: [push, pull_request] - +on: + - push + - pull_request concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} permissions: contents: read - jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 11 - uses: actions/setup-java@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - java-version: '11' - distribution: 'adopt' - architecture: x64 - cache: maven + persist-credentials: false - - name: Set up Python - uses: actions/setup-python@v5 + - name: Setup Environment + uses: ./.github/actions/setup-env with: - python-version: '3.10' - architecture: 'x64' - - - name: Install Build Dependencies - run: | - sudo apt-get update - sudo apt-get install -y git uuid-runtime genisoimage netcat ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools - + install-python: 'true' + install-apt-deps: 'true' - name: Env details run: | uname -a @@ -61,9 +47,8 @@ jobs: free -m nproc git status - + - name: Install Non-OSS + uses: ./.github/actions/install-nonoss - name: Noredist Build run: | - git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss && cd nonoss && bash -x install-non-oss.sh && cd .. - rm -fr nonoss mvn -B -P developer,systemvm -Dsimulator -Dnoredist clean install -T$(nproc) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ceffb42c79bb..0815b4558476 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,21 +16,56 @@ # under the License. name: Simulator CI - -on: [push, pull_request] - +on: + - push + - pull_request concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} permissions: contents: read - jobs: build: if: github.repository == 'apache/cloudstack' - runs-on: ubuntu-22.04 - + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Environment + uses: ./.github/actions/setup-env + with: + install-python: 'true' + install-apt-deps: 'true' + - name: Env details + run: | + uname -a + whoami + javac -version + mvn -v + python3 --version + free -m + nproc + git status + ipmitool -V + - name: Build with Maven + run: | + mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc) + - name: Archive artifacts + run: | + mkdir -p /tmp/artifacts + tar -czf /tmp/artifacts/targets.tar.gz $(find . -name "target" -type d) tools/marvin/dist engine/schema/dist utils/conf + tar -czf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository org/apache/cloudstack + - name: Upload artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: build-artifacts + path: /tmp/artifacts/ + test: + needs: build + if: github.repository == 'apache/cloudstack' + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: @@ -89,7 +124,10 @@ jobs: smoke/test_nested_virtualization smoke/test_set_sourcenat smoke/test_webhook_lifecycle - smoke/test_purge_expunged_vms", + smoke/test_purge_expunged_vms + smoke/test_extension_lifecycle + smoke/test_extension_custom_action_lifecycle + smoke/test_extension_custom", "smoke/test_network smoke/test_network_acl smoke/test_network_ipv6 @@ -137,11 +175,13 @@ jobs: smoke/test_vm_deployment_planner smoke/test_vm_strict_host_tags smoke/test_vm_schedule + smoke/test_deploy_vgpu_enabled_vm smoke/test_vm_life_cycle smoke/test_vm_lifecycle_unmanage_import smoke/test_vm_snapshot_kvm smoke/test_vm_snapshots smoke/test_volumes + smoke/test_vpc_conserve_mode smoke/test_vpc_ipv6 smoke/test_vpc_redundant smoke/test_vpc_router_nics @@ -164,7 +204,8 @@ jobs: component/test_cpu_limits component/test_cpu_max_limits component/test_cpu_project_limits - component/test_deploy_vm_userdata_multi_nic", + component/test_deploy_vm_userdata_multi_nic + component/test_deploy_vm_lease", "component/test_egress_fw_rules component/test_invalid_gw_nm component/test_ip_reservation", @@ -209,79 +250,70 @@ jobs: smoke/test_list_service_offerings smoke/test_list_storage_pools smoke/test_list_volumes"] - steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'adopt' - architecture: x64 - cache: maven - - - name: Set up Python - uses: actions/setup-python@v5 + persist-credentials: false + - name: Setup Environment + uses: ./.github/actions/setup-env with: - python-version: '3.10' - architecture: 'x64' - - - name: Install Build Dependencies + install-python: 'true' + install-apt-deps: 'true' + - name: Setup IPMI Tool for CloudStack run: | - sudo apt-get update - sudo apt-get install -y git uuid-runtime genisoimage netcat ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools + # Create cloudstack-common directory if it doesn't exist + sudo mkdir -p /usr/share/cloudstack-common + # Copy ipmitool to cloudstack-common directory if it doesn't exist + if [ ! -f /usr/share/cloudstack-common/ipmitool ]; then + sudo cp /usr/bin/ipmitool /usr/share/cloudstack-common/ipmitool + sudo chmod 755 /usr/share/cloudstack-common/ipmitool + fi + + # Create ipmitool-C3 wrapper script + sudo tee /usr/bin/ipmitool > /dev/null << 'EOF' + #!/bin/bash + /usr/share/cloudstack-common/ipmitool -C3 $@ + EOF + sudo chmod 755 /usr/bin/ipmitool - name: Install Python dependencies run: | - python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid - + python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose - name: Install jacoco dependencies run: | wget https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip unzip jacoco-0.8.10.zip -d jacoco - - - name: Env details - run: | - uname -a - whoami - javac -version - mvn -v - python3 --version - free -m - nproc - git status - ipmitool -V - - name: Setup MySQL Server run: | # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#mysql sudo apt-get install -y mysql-server sudo systemctl start mysql - sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES;" + sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY ''; FLUSH PRIVILEGES;" sudo systemctl restart mysql sudo mysql -uroot -e "SELECT VERSION();" - - - name: Build with Maven + - name: Download artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: build-artifacts + path: /tmp/artifacts/ + - name: Extract artifacts run: | - mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc) - + tar -xzf /tmp/artifacts/targets.tar.gz + mkdir -p ~/.m2/repository + tar -xzf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository - name: Setup Simulator Prerequisites run: | sudo python3 -m pip install --upgrade netaddr mysql-connector-python - python3 -m pip install --user --upgrade tools/marvin/dist/Marvin-*.tar.gz + python3 -m pip install --user --upgrade tools/marvin/dist/[mM]arvin-*.tar.gz mvn -q -Pdeveloper -pl developer -Ddeploydb mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator - - name: Generate jacoco-coverage.sh run: | echo "java -jar jacoco/lib/jacococli.jar report jacoco-it.exec \\" > jacoco-report.sh find . | grep "target/classes" | sed 's/\/classes\//\/classes /g' | awk '{print "--classfiles", $1, "\\"}' | sort |uniq >> jacoco-report.sh find . | grep "src/main/java" | sed 's/\/java\//\/java /g' | awk '{print "--sourcefiles", $1, "\\"}' | sort | uniq >> jacoco-report.sh echo "--xml jacoco-coverage.xml" >> jacoco-report.sh - - name: Start CloudStack Management Server with Simulator run: | export MAVEN_OPTS="-Xmx4096m -XX:MaxMetaspaceSize=800m -Djava.security.egd=file:/dev/urandom -javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED" @@ -292,7 +324,6 @@ jobs: set -e echo -e "\nStarting Advanced Zone DataCenter deployment" python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advdualzone.cfg 2>&1 || true - - name: Run Integration Tests with Simulator run: | mkdir -p integration-test-results/smoke/misc @@ -312,13 +343,12 @@ jobs: bash jacoco-report.sh mvn -Dsimulator -pl client jetty:stop 2>&1 find /tmp//MarvinLogs -type f -exec echo -e "Printing marvin logs {} :\n" \; -exec cat {} \; - - name: Integration Tests Result run: | echo -e "Simulator CI Test Results: (only failures listed)\n" python3 ./tools/marvin/xunit-reader.py integration-test-results/ - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: files: jacoco-coverage.xml fail_ci_if_error: true diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index c77783746ca1..000000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -name: Coverage Check - -on: [pull_request, push] - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build: - if: github.repository == 'apache/cloudstack' - name: codecov - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - - name: Build CloudStack with Quality Checks - run: | - git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss - cd nonoss && bash -x install-non-oss.sh && cd .. - mvn -P quality -Dsimulator -Dnoredist clean install -T$(nproc) - - - uses: codecov/codecov-action@v4 - with: - files: ./client/target/site/jacoco-aggregate/jacoco.xml - fail_ci_if_error: true - flags: unittests - verbose: true - name: codecov - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000000..a2d581dcac20 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: CodeQL Analysis +on: + push: + branches: [main] + pull_request: + branches: [main] +permissions: + actions: read + contents: read + security-events: write +jobs: + codeql: + name: CodeQL + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: ["actions"] + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Initialize CodeQL + uses: github/codeql-action/init@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5 + with: + category: "Security" diff --git a/.github/workflows/daily-repo-status.lock.yml b/.github/workflows/daily-repo-status.lock.yml new file mode 100644 index 000000000000..7c3d20a166ea --- /dev/null +++ b/.github/workflows/daily-repo-status.lock.yml @@ -0,0 +1,1394 @@ +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"ae44897dc32d20c421588b31a279653abf436964ad86c58885e0edbfbb2f0416","compiler_version":"v0.76.1","strict":true,"agent_id":"copilot"} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"46d564922b082d0db93244972e8005ea6904ee5f","version":"v0.76.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.55","digest":"sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55","digest":"sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.55","digest":"sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.19","digest":"sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f"},{"image":"ghcr.io/github/github-mcp-server:v1.0.4","digest":"sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} +# ___ _ _ +# / _ \ | | (_) +# | |_| | __ _ ___ _ __ | |_ _ ___ +# | _ |/ _` |/ _ \ '_ \| __| |/ __| +# | | | | (_| | __/ | | | |_| | (__ +# \_| |_/\__, |\___|_| |_|\__|_|\___| +# __/ | +# _ _ |___/ +# | | | | / _| | +# | | | | ___ _ __ _ __| |_| | _____ ____ +# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| +# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ +# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ +# +# This file was automatically generated by gh-aw (v0.76.1). DO NOT EDIT. +# +# To update this file, edit githubnext/agentics/workflows/repo-status.md@main and run: +# gh aw compile +# Not all edits will cause changes to this file. +# +# For more information: https://github.github.com/gh-aw/introduction/overview/ +# +# This workflow creates daily repo status reports. It gathers recent repository +# activity (issues, PRs, discussions, releases, code changes) and generates +# engaging GitHub issues with productivity insights, community highlights, +# and project recommendations. +# +# Source: githubnext/agentics/workflows/repo-status.md@main +# +# Secrets used: +# - COPILOT_GITHUB_TOKEN +# - GH_AW_GITHUB_MCP_SERVER_TOKEN +# - GH_AW_GITHUB_TOKEN +# - GITHUB_TOKEN +# +# Custom actions used: +# - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 +# - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 +# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 +# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 +# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 +# - github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 +# +# Container images used: +# - ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 +# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 +# - ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca +# - ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f +# - ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4 +# - node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 + +name: "Repo Status" +on: + schedule: + - cron: "11 19 * * *" + # Friendly format: daily (scattered) + workflow_dispatch: + inputs: + aw_context: + default: "" + description: "Agent caller context (used internally by Agentic Workflows)." + required: false + type: string + +permissions: {} + +concurrency: + group: "gh-aw-${{ github.workflow }}" + +run-name: "Repo Status" + +jobs: + activation: + runs-on: ubuntu-slim + permissions: + actions: read + contents: read + outputs: + comment_id: "" + comment_repo: "" + engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} + lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} + model: ${{ steps.generate_aw_info.outputs.model }} + secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Repo Status" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/daily-repo-status.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Generate agentic run info + id: generate_aw_info + env: + GH_AW_INFO_ENGINE_ID: "copilot" + GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" + GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AGENT_VERSION: "1.0.52" + GH_AW_INFO_CLI_VERSION: "v0.76.1" + GH_AW_INFO_WORKFLOW_NAME: "Repo Status" + GH_AW_INFO_EXPERIMENTAL: "false" + GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" + GH_AW_INFO_STAGED: "false" + GH_AW_INFO_ALLOWED_DOMAINS: '["defaults"]' + GH_AW_INFO_FIREWALL_ENABLED: "true" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_AWMG_VERSION: "" + GH_AW_INFO_FIREWALL_TYPE: "squid" + GH_AW_INFO_FRONTMATTER_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_COMPILED_STRICT: "true" + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs'); + await main(core, context); + - name: Validate COPILOT_GITHUB_TOKEN secret + id: validate-secret + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + - name: Checkout .github and .agents folders + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + sparse-checkout: | + .github + .agents + .antigravity + .claude + .codex + .crush + .gemini + .opencode + .pi + sparse-checkout-cone-mode: true + fetch-depth: 1 + - name: Save agent config folders for base branch restoration + env: + GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh" + - name: Check workflow lock file + id: check-lock-file + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_WORKFLOW_FILE: "daily-repo-status.lock.yml" + GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs'); + await main(); + - name: Check compile-agentic version + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_COMPILED_VERSION: "v0.76.1" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs'); + await main(); + - name: Create prompt with built-in context + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + # poutine:ignore untrusted_checkout_exec + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" + { + cat << 'GH_AW_PROMPT_603e0a48f86a9470_EOF' + + GH_AW_PROMPT_603e0a48f86a9470_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" + cat << 'GH_AW_PROMPT_603e0a48f86a9470_EOF' + + Tools: create_issue, missing_tool, missing_data, noop + + GH_AW_PROMPT_603e0a48f86a9470_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" + cat << 'GH_AW_PROMPT_603e0a48f86a9470_EOF' + + The following GitHub context information is available for this workflow: + {{#if github.actor}} + - **actor**: __GH_AW_GITHUB_ACTOR__ + {{/if}} + {{#if github.repository}} + - **repository**: __GH_AW_GITHUB_REPOSITORY__ + {{/if}} + {{#if github.workspace}} + - **workspace**: __GH_AW_GITHUB_WORKSPACE__ + {{/if}} + {{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}} + - **issue-number**: #__GH_AW_EXPR_802A9F6A__ + {{/if}} + {{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}} + - **discussion-number**: #__GH_AW_EXPR_1A3A194A__ + {{/if}} + {{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}} + - **pull-request-number**: #__GH_AW_EXPR_463A214A__ + {{/if}} + {{#if github.event.comment.id || github.aw.context.comment_id}} + - **comment-id**: __GH_AW_EXPR_FF1D34CE__ + {{/if}} + {{#if github.run_id}} + - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ + {{/if}} + + + GH_AW_PROMPT_603e0a48f86a9470_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" + cat << 'GH_AW_PROMPT_603e0a48f86a9470_EOF' + + {{#runtime-import .github/workflows/daily-repo-status.md}} + GH_AW_PROMPT_603e0a48f86a9470_EOF + } > "$GH_AW_PROMPT" + - name: Interpolate variables and render templates + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_ENGINE_ID: "copilot" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs'); + await main(); + - name: Substitute placeholders + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools' + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + + const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs'); + + // Call the substitution function + return await substitutePlaceholders({ + file: process.env.GH_AW_PROMPT, + substitutions: { + GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A, + GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A, + GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A, + GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE, + GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, + GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, + GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, + GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST + } + }); + - name: Validate prompt placeholders + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh" + - name: Print prompt + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh" + - name: Upload activation artifact + if: success() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: activation + include-hidden-files: true + path: | + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/aw-prompts/prompt-template.txt + /tmp/gh-aw/aw-prompts/prompt-import-tree.json + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/base + /tmp/gh-aw/.github/agents + /tmp/gh-aw/.github/skills + if-no-files-found: ignore + retention-days: 1 + + agent: + needs: activation + runs-on: ubuntu-latest + permissions: + contents: read + issues: read + pull-requests: read + concurrency: + group: "gh-aw-copilot-${{ github.workflow }}" + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + GH_AW_ASSETS_ALLOWED_EXTS: "" + GH_AW_ASSETS_BRANCH: "" + GH_AW_ASSETS_MAX_SIZE_KB: 0 + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + GH_AW_WORKFLOW_ID_SANITIZED: dailyrepostatus + outputs: + agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }} + checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }} + effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }} + effective_tokens_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.effective_tokens_rate_limit_error || 'false' }} + has_patch: ${{ steps.collect_output.outputs.has_patch }} + inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }} + mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }} + model: ${{ needs.activation.outputs.model }} + model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }} + output: ${{ steps.collect_output.outputs.output }} + output_types: ${{ steps.collect_output.outputs.output_types }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Repo Status" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/daily-repo-status.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Set runtime paths + id: set-runtime-paths + run: | + { + echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl" + echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" + echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json" + } >> "$GITHUB_OUTPUT" + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Create gh-aw temp directory + run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh" + - name: Configure gh CLI for GitHub Enterprise + run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh" + env: + GH_TOKEN: ${{ github.token }} + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Checkout PR branch + id: checkout-pr + if: | + github.event.pull_request || github.event.issue.pull_request + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/checkout_pr_branch.cjs'); + await main(); + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.52 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.55 + - name: Parse integrity filter lists + id: parse-guard-vars + env: + GH_AW_BLOCKED_USERS_VAR: ${{ vars.GH_AW_GITHUB_BLOCKED_USERS || '' }} + GH_AW_TRUSTED_USERS_VAR: ${{ vars.GH_AW_GITHUB_TRUSTED_USERS || '' }} + GH_AW_APPROVAL_LABELS_VAR: ${{ vars.GH_AW_GITHUB_APPROVAL_LABELS || '' }} + run: bash "${RUNNER_TEMP}/gh-aw/actions/parse_guard_list.sh" + - name: Download activation artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: activation + path: /tmp/gh-aw + - name: Restore agent config folders from base branch + if: steps.checkout-pr.outcome == 'success' + env: + GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh" + - name: Restore inline sub-agents from activation artifact + env: + GH_AW_SUB_AGENT_DIR: ".github/agents" + GH_AW_SUB_AGENT_EXT: ".agent.md" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh" + - name: Restore inline skills from activation artifact + env: + GH_AW_SKILL_DIR: ".github/skills" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh" + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4 node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 + - name: Generate Safe Outputs Config + run: | + mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" + mkdir -p /tmp/gh-aw/safeoutputs + mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_9b6646f0d620a78f_EOF' + {"create_issue":{"close_older_issues":true,"labels":["report","daily-status"],"max":1,"title_prefix":"[repo-status] "},"create_report_incomplete_issue":{},"mentions":{"enabled":false},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_9b6646f0d620a78f_EOF + - name: Generate Safe Outputs Tools + env: + GH_AW_TOOLS_META_JSON: | + { + "description_suffixes": { + "create_issue": " CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"[repo-status] \". Labels [\"report\" \"daily-status\"] will be automatically added." + }, + "repo_params": {}, + "dynamic_tools": [] + } + GH_AW_VALIDATION_JSON: | + { + "create_issue": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "fields": { + "type": "array" + }, + "labels": { + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 128 + }, + "parent": { + "issueOrPRNumber": true + }, + "repo": { + "type": "string", + "maxLength": 256 + }, + "temporary_id": { + "type": "string" + }, + "title": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, + "missing_data": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "context": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "data_type": { + "type": "string", + "sanitize": true, + "maxLength": 128 + }, + "reason": { + "type": "string", + "sanitize": true, + "maxLength": 256 + } + } + }, + "missing_tool": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 512 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "tool": { + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, + "noop": { + "defaultMax": 1, + "fields": { + "message": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + } + } + }, + "report_incomplete": { + "defaultMax": 5, + "fields": { + "details": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 1024 + } + } + } + } + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs'); + await main(); + - name: Generate Safe Outputs MCP Server Config + id: safe-outputs-config + run: | + # Generate a secure random API key (360 bits of entropy, 40+ chars) + # Mask immediately to prevent timing vulnerabilities + API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${API_KEY}" + + PORT=3001 + + # Set outputs for next steps + { + echo "safe_outputs_api_key=${API_KEY}" + echo "safe_outputs_port=${PORT}" + } >> "$GITHUB_OUTPUT" + + echo "Safe Outputs MCP server will run on port ${PORT}" + + - name: Start Safe Outputs MCP HTTP Server + id: safe-outputs-start + env: + DEBUG: '*' + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }} + GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json + GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + run: | + # Environment variables are set above to prevent template injection + export DEBUG + export GH_AW_SAFE_OUTPUTS + export GH_AW_SAFE_OUTPUTS_PORT + export GH_AW_SAFE_OUTPUTS_API_KEY + export GH_AW_SAFE_OUTPUTS_TOOLS_PATH + export GH_AW_SAFE_OUTPUTS_CONFIG_PATH + export GH_AW_MCP_LOG_DIR + + bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh" + + - name: Start MCP Gateway + id: start-mcp-gateway + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + set -eo pipefail + mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" + + # Export gateway environment variables for MCP config and gateway script + export MCP_GATEWAY_PORT="8080" + export MCP_GATEWAY_DOMAIN="host.docker.internal" + export MCP_GATEWAY_HOST_DOMAIN="localhost" + MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${MCP_GATEWAY_API_KEY}" + export MCP_GATEWAY_API_KEY + export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" + mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" + export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288" + export DEBUG="*" + + export GH_AW_ENGINE="copilot" + MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0') + MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0') + case "${DOCKER_HOST:-}" in + unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;; + /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;; + * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;; + esac + DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0') + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.19' + + mkdir -p /home/runner/.copilot + GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) + cat << GH_AW_MCP_CONFIG_d075a7f45ab51044_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + { + "mcpServers": { + "github": { + "type": "stdio", + "container": "ghcr.io/github/github-mcp-server:v1.0.4", + "env": { + "GITHUB_HOST": "\${GITHUB_SERVER_URL}", + "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", + "GITHUB_READ_ONLY": "1", + "GITHUB_TOOLSETS": "context,repos,issues,pull_requests" + }, + "guard-policies": { + "allow-only": { + "approval-labels": ${{ steps.parse-guard-vars.outputs.approval_labels }}, + "blocked-users": ${{ steps.parse-guard-vars.outputs.blocked_users }}, + "min-integrity": "none", + "repos": "all", + "trusted-users": ${{ steps.parse-guard-vars.outputs.trusted_users }} + } + } + }, + "safeoutputs": { + "type": "http", + "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", + "headers": { + "Authorization": "\${GH_AW_SAFE_OUTPUTS_API_KEY}" + }, + "guard-policies": { + "write-sink": { + "accept": [ + "*" + ] + } + } + } + }, + "gateway": { + "port": $MCP_GATEWAY_PORT, + "domain": "${MCP_GATEWAY_DOMAIN}", + "apiKey": "${MCP_GATEWAY_API_KEY}", + "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" + } + } + GH_AW_MCP_CONFIG_d075a7f45ab51044_EOF + - name: Mount MCP servers as CLIs + id: mount-mcp-clis + continue-on-error: true + env: + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }} + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs'); + await main(); + - name: Clean credentials + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" + - name: Audit pre-agent workspace + id: pre_agent_audit + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh" + - name: Execute GitHub Copilot CLI + id: agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 20 + run: | + set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" + (umask 177 && touch /tmp/gh-aw/agent-stdio.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","api.snapcraft.io","archive.ubuntu.com","azure.archive.ubuntu.com","crl.geotrust.com","crl.globalsign.com","crl.identrust.com","crl.sectigo.com","crl.thawte.com","crl.usertrust.com","crl.verisign.com","crl3.digicert.com","crl4.digicert.com","crls.ssl.com","github.com","host.docker.internal","json-schema.org","json.schemastore.org","keyserver.ubuntu.com","ocsp.digicert.com","ocsp.geotrust.com","ocsp.globalsign.com","ocsp.identrust.com","ocsp.sectigo.com","ocsp.ssl.com","ocsp.thawte.com","ocsp.usertrust.com","ocsp.verisign.com","packagecloud.io","packages.cloud.google.com","packages.microsoft.com","ppa.launchpad.net","raw.githubusercontent.com","registry.npmjs.org","s.symcb.com","s.symcd.com","security.ubuntu.com","telemetry.enterprise.githubcopilot.com","ts-crl.ws.symantec.com","ts-ocsp.ws.symantec.com","www.googleapis.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000,"models":{"agent":["sonnet-6x","gpt-5.4","gpt-5.3","gemini-pro","any"],"antigravity":["copilot/antigravity*","google/antigravity*","gemini/antigravity*"],"any":["copilot/*","anthropic/*","openai/*","google/*","gemini/*"],"claude":["agent"],"codex":["agent"],"coding":["copilot/gpt-5*codex*","openai/gpt-5*codex*","gpt-5-codex"],"computer-use":["copilot/*computer-use*","google/*computer-use*","gemini/*computer-use*","openai/*computer-use*"],"copilot":["agent"],"deep-research":["copilot/deep-research*","copilot/o3-deep-research*","copilot/o4-mini-deep-research*","google/deep-research*","gemini/deep-research*","openai/o3-deep-research*","openai/o4-mini-deep-research*"],"gemini":["agent"],"gemini-3-flash":["copilot/gemini-3*flash*","google/gemini-3*flash*","gemini/gemini-3*flash*"],"gemini-3-pro":["copilot/gemini-3*pro*","google/gemini-3*pro*","gemini/gemini-3*pro*"],"gemini-3.1-flash":["copilot/gemini-3.1*flash*","google/gemini-3.1*flash*","gemini/gemini-3.1*flash*"],"gemini-3.1-pro":["copilot/gemini-3.1*pro*","google/gemini-3.1*pro*","gemini/gemini-3.1*pro*"],"gemini-3.5-flash":["copilot/gemini-3.5*flash*","google/gemini-3.5*flash*","gemini/gemini-3.5*flash*"],"gemini-flash":["copilot/gemini-*flash*","google/gemini-*flash*","gemini/gemini-*flash*"],"gemini-flash-lite":["copilot/gemini-*flash*lite*","google/gemini-*flash*lite*","gemini/gemini-*flash*lite*"],"gemini-pro":["copilot/gemini-*pro*","google/gemini-*pro*","gemini/gemini-*pro*"],"gemma":["copilot/gemma*","google/gemma*","gemini/gemma*"],"gpt-4.1":["copilot/gpt-4.1*","openai/gpt-4.1*"],"gpt-5":["copilot/gpt-5*","openai/gpt-5*"],"gpt-5-codex":["copilot/gpt-5*codex*","openai/gpt-5*codex*"],"gpt-5-mini":["copilot/gpt-5*mini*","openai/gpt-5*mini*"],"gpt-5-nano":["copilot/gpt-5*nano*","openai/gpt-5*nano*"],"gpt-5-pro":["copilot/gpt-5*pro*","openai/gpt-5*pro*"],"gpt-5.2":["copilot/gpt-5.2*","openai/gpt-5.2*"],"gpt-5.3":["copilot/gpt-5.3*","openai/gpt-5.3*"],"gpt-5.4":["copilot/gpt-5.4*","openai/gpt-5.4*"],"gpt-5.5":["copilot/gpt-5.5*","openai/gpt-5.5*"],"haiku":["copilot/*haiku*","anthropic/*haiku*"],"large":["sonnet","gpt-5-pro","gpt-5","gemini-pro"],"mini":["haiku","gpt-5-mini","gpt-5-nano","gemini-flash-lite"],"opus":["copilot/*opus*","anthropic/*opus*"],"opusplan":["opus?effort=high"],"reasoning":["copilot/o1*","copilot/o3*","copilot/o4*","openai/o1*","openai/o3*","openai/o4*"],"robotics":["copilot/*robotics*","google/*robotics*","gemini/*robotics*"],"small":["mini"],"sonnet":["copilot/*sonnet*","anthropic/*sonnet*"],"sonnet-6x":["copilot/*sonnet-4-5-*","anthropic/*sonnet-4-5-*","copilot/*sonnet-4-6*","anthropic/*sonnet-4-6*"],"summarization":["haiku","gpt-5-mini","gemini-flash-lite","mini"],"vision":["copilot/gemini-*image*","gemini/gemini-*image*","copilot/gemini-*flash*","gemini/gemini-*flash*"]}},"container":{"imageTag":"0.25.55,squid=sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca,agent=sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731,api-proxy=sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" + cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + env: + AWF_REFLECT_ENABLED: 1 + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json + GH_AW_PHASE: agent + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_VERSION: v0.76.1 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Detect agent errors + if: always() + id: detect-agent-errors + continue-on-error: true + run: node "${RUNNER_TEMP}/gh-aw/actions/detect_agent_errors.cjs" + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Copy Copilot session state files to logs + if: always() + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/copy_copilot_session_state.sh" + - name: Stop MCP Gateway + if: always() + continue-on-error: true + env: + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }} + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID" + - name: Redact secrets in logs + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); + await main(); + env: + GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' + SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Append agent step summary + if: always() + run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh" + - name: Copy Safe Outputs + if: always() + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + run: | + mkdir -p /tmp/gh-aw + cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true + - name: Ingest agent output + id: collect_output + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GH_AW_ALLOWED_GITHUB_REFS: "" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs'); + await main(); + - name: Parse agent logs for step summary + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); + await main(); + - name: Parse MCP Gateway logs for step summary + if: always() + id: parse-mcp-gateway + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs'); + await main(); + - name: Print firewall logs + if: always() + continue-on-error: true + env: + AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs + run: | + # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts + # AWF runs with sudo, creating files owned by root + sudo chmod -R a+rX /tmp/gh-aw/sandbox/firewall 2>/dev/null || true + # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) + if command -v awf &> /dev/null; then + awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" + else + echo 'AWF binary not installed, skipping firewall log summary' + fi + - name: Parse token usage for step summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); + await main(); + - name: Print AWF reflect summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs'); + await main(); + - name: Write agent output placeholder if missing + if: always() + run: | + if [ ! -f /tmp/gh-aw/agent_output.json ]; then + echo '{"items":[]}' > /tmp/gh-aw/agent_output.json + fi + - name: Upload agent artifacts + if: always() + continue-on-error: true + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: agent + path: | + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/sandbox/agent/logs/ + /tmp/gh-aw/redacted-urls.log + /tmp/gh-aw/mcp-logs/ + /tmp/gh-aw/proxy-logs/ + !/tmp/gh-aw/proxy-logs/proxy-tls/ + /tmp/gh-aw/agent_usage.json + /tmp/gh-aw/agent-stdio.log + /tmp/gh-aw/pre-agent-audit.txt + /tmp/gh-aw/agent/ + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/safeoutputs.jsonl + /tmp/gh-aw/agent_output.json + /tmp/gh-aw/aw-*.patch + /tmp/gh-aw/aw-*.bundle + /tmp/gh-aw/awf-config.json + /tmp/gh-aw/sandbox/firewall/logs/ + /tmp/gh-aw/sandbox/firewall/audit/ + /tmp/gh-aw/sandbox/firewall/awf-reflect.json + if-no-files-found: ignore + + conclusion: + needs: + - activation + - agent + - detection + - safe_outputs + if: > + always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' || + needs.activation.outputs.stale_lock_file_failed == 'true') + runs-on: ubuntu-slim + permissions: + contents: read + issues: write + concurrency: + group: "gh-aw-conclusion-daily-repo-status" + cancel-in-progress: false + queue: max + outputs: + incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }} + noop_message: ${{ steps.noop.outputs.noop_message }} + tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} + total_count: ${{ steps.missing_tool.outputs.total_count }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Repo Status" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/daily-repo-status.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Process no-op messages + id: noop + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_NOOP_MAX: "1" + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_NOOP_REPORT_AS_ISSUE: "true" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs'); + await main(); + - name: Log detection run + id: detection_runs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs'); + await main(); + - name: Record missing tool + id: missing_tool + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_MISSING_TOOL_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs'); + await main(); + - name: Record incomplete + id: report_incomplete + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs'); + await main(); + - name: Handle agent failure + id: handle_agent_failure + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_WORKFLOW_ID: "daily-repo-status" + GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" + GH_AW_ENGINE_ID: "copilot" + GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} + GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} + GH_AW_EFFECTIVE_TOKENS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.effective_tokens_rate_limit_error || 'false' }} + GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} + GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }} + GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }} + GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }} + GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" + GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} + GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} + GH_AW_GROUP_REPORTS: "false" + GH_AW_FAILURE_REPORT_AS_ISSUE: "true" + GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true" + GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true" + GH_AW_TIMEOUT_MINUTES: "20" + GH_AW_MAX_EFFECTIVE_TOKENS: "25000000" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs'); + await main(); + + detection: + needs: + - activation + - agent + if: > + always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true') + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} + detection_reason: ${{ steps.detection_conclusion.outputs.reason }} + detection_success: ${{ steps.detection_conclusion.outputs.success }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Repo Status" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/daily-repo-status.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Checkout repository for patch context + if: needs.agent.outputs.has_patch == 'true' + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + # --- Threat Detection --- + - name: Clean stale firewall files from agent artifact + run: | + rm -rf /tmp/gh-aw/sandbox/firewall/logs + rm -rf /tmp/gh-aw/sandbox/firewall/audit + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca + - name: Check if detection needed + id: detection_guard + if: always() + env: + OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }} + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + run: | + if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then + echo "run_detection=true" >> "$GITHUB_OUTPUT" + echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH" + else + echo "run_detection=false" >> "$GITHUB_OUTPUT" + echo "Detection skipped: no agent outputs or patches to analyze" + fi + - name: Clear MCP Config for detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" + rm -f /home/runner/.copilot/mcp-config.json + rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" + - name: Prepare threat detection files + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection/aw-prompts + cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true + cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true + for f in /tmp/gh-aw/aw-*.patch; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + for f in /tmp/gh-aw/aw-*.bundle; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + echo "Prepared threat detection files:" + ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true + - name: Setup threat detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + WORKFLOW_NAME: "Repo Status" + WORKFLOW_DESCRIPTION: "This workflow creates daily repo status reports. It gathers recent repository\nactivity (issues, PRs, discussions, releases, code changes) and generates\nengaging GitHub issues with productivity insights, community highlights,\nand project recommendations." + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs'); + await main(); + - name: Ensure threat-detection directory and log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection + touch /tmp/gh-aw/threat-detection/detection.log + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24' + package-manager-cache: false + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.52 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.55 + - name: Execute GitHub Copilot CLI + if: always() && steps.detection_guard.outputs.run_detection == 'true' + continue-on-error: true + id: detection_agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 20 + run: | + set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" + (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000},"container":{"imageTag":"0.25.55"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" + cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + env: + AWF_REFLECT_ENABLED: 1 + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_PHASE: detection + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_VERSION: v0.76.1 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Upload threat detection log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: detection + path: /tmp/gh-aw/threat-detection/detection.log + if-no-files-found: ignore + - name: Parse and conclude threat detection + id: detection_conclusion + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }} + GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" + with: + script: | + try { + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); + await main(); + } catch (loadErr) { + const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false'; + const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure'; + const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr)); + core.error(msg); + core.setOutput('reason', 'parse_error'); + if (continueOnError && !detectionExecutionFailed) { + core.warning('\u26A0\uFE0F ' + msg); + core.setOutput('conclusion', 'warning'); + core.setOutput('success', 'false'); + } else { + core.setOutput('conclusion', 'failure'); + core.setOutput('success', 'false'); + core.setFailed(msg); + } + } + + safe_outputs: + needs: + - activation + - agent + - detection + if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success' + runs-on: ubuntu-slim + permissions: + contents: read + issues: write + timeout-minutes: 15 + env: + GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/daily-repo-status" + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }} + GH_AW_ENGINE_ID: "copilot" + GH_AW_ENGINE_MODEL: ${{ needs.agent.outputs.model }} + GH_AW_ENGINE_VERSION: "1.0.52" + GH_AW_WORKFLOW_ID: "daily-repo-status" + GH_AW_WORKFLOW_NAME: "Repo Status" + GH_AW_WORKFLOW_SOURCE: "githubnext/agentics/workflows/repo-status.md@main" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/githubnext/agentics/blob/main/workflows/repo-status.md" + outputs: + code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} + code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} + create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} + create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} + created_issue_number: ${{ steps.process_safe_outputs.outputs.created_issue_number }} + created_issue_url: ${{ steps.process_safe_outputs.outputs.created_issue_url }} + process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} + process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Repo Status" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/daily-repo-status.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Configure GH_HOST for enterprise compatibility + id: ghes-host-config + shell: bash + run: | + # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct + # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op. + GH_HOST="${GITHUB_SERVER_URL#https://}" + GH_HOST="${GH_HOST#http://}" + echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" + - name: Process Safe Outputs + id: process_safe_outputs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }} + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_issue\":{\"close_older_issues\":true,\"labels\":[\"report\",\"daily-status\"],\"max\":1,\"title_prefix\":\"[repo-status] \"},\"create_report_incomplete_issue\":{},\"mentions\":{\"enabled\":false},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs'); + await main(); + - name: Upload Safe Outputs Items + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: safe-outputs-items + path: | + /tmp/gh-aw/safe-output-items.jsonl + /tmp/gh-aw/temporary-id-map.json + if-no-files-found: ignore diff --git a/.github/workflows/daily-repo-status.md b/.github/workflows/daily-repo-status.md new file mode 100644 index 000000000000..8debf5708437 --- /dev/null +++ b/.github/workflows/daily-repo-status.md @@ -0,0 +1,58 @@ +--- +description: | + This workflow creates daily repo status reports. It gathers recent repository + activity (issues, PRs, discussions, releases, code changes) and generates + engaging GitHub issues with productivity insights, community highlights, + and project recommendations. + +on: + schedule: daily + workflow_dispatch: + +permissions: + contents: read + issues: read + pull-requests: read + +network: defaults + +tools: + github: + # If in a public repo, setting `lockdown: false` allows + # reading issues, pull requests and comments from 3rd-parties + # If in a private repo this has no particular effect. + lockdown: false + min-integrity: none # This workflow is allowed to examine and comment on any issues + +safe-outputs: + mentions: false + allowed-github-references: [] + create-issue: + title-prefix: "[repo-status] " + labels: [report, daily-status] + close-older-issues: true +source: githubnext/agentics/workflows/repo-status.md@main +--- + +# Repo Status + +Create an upbeat daily status report for the repo as a GitHub issue. + +## What to include + +- Recent repository activity (issues, PRs, discussions, releases, code changes) +- Progress tracking, goal reminders and highlights +- Project status and recommendations +- Actionable next steps for maintainers + +## Style + +- Be positive, encouraging, and helpful 🌟 +- Use emojis moderately for engagement +- Keep it concise - adjust length based on actual activity + +## Process + +1. Gather recent activity from the repository +2. Study the repository, its issues and its pull requests +3. Create a new GitHub issue with your findings and insights diff --git a/.github/workflows/docker-cloudstack-simulator.yml b/.github/workflows/docker-cloudstack-simulator.yml index 21a09d04e0b3..dc00968563d0 100644 --- a/.github/workflows/docker-cloudstack-simulator.yml +++ b/.github/workflows/docker-cloudstack-simulator.yml @@ -35,10 +35,10 @@ concurrency: jobs: build: if: github.repository == 'apache/cloudstack' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Login to Docker Registry - uses: docker/login-action@v2 + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 with: registry: ${{ secrets.DOCKER_REGISTRY }} username: ${{ secrets.DOCKERHUB_USER }} @@ -47,7 +47,9 @@ jobs: - name: Set Docker repository name run: echo "DOCKER_REPOSITORY=apache" >> $GITHUB_ENV - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Set ACS version run: echo "ACS_VERSION=$(grep '' pom.xml | head -2 | tail -1 | cut -d'>' -f2 |cut -d'<' -f1)" >> $GITHUB_ENV diff --git a/.github/workflows/issue-triage-agent.lock.yml b/.github/workflows/issue-triage-agent.lock.yml new file mode 100644 index 000000000000..94abbb0908cc --- /dev/null +++ b/.github/workflows/issue-triage-agent.lock.yml @@ -0,0 +1,1388 @@ +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"d4b8988df7c60cd416200769cc6bc7f1aab5bb3128df0b9a83a35e061b4da111","compiler_version":"v0.76.1","strict":true,"agent_id":"copilot"} +# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"46d564922b082d0db93244972e8005ea6904ee5f","version":"v0.76.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.55","digest":"sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55","digest":"sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.55","digest":"sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.19","digest":"sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f"},{"image":"ghcr.io/github/github-mcp-server:v1.0.4","digest":"sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4"},{"image":"node:lts-alpine","digest":"sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14","pinned_image":"node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14"}]} +# ___ _ _ +# / _ \ | | (_) +# | |_| | __ _ ___ _ __ | |_ _ ___ +# | _ |/ _` |/ _ \ '_ \| __| |/ __| +# | | | | (_| | __/ | | | |_| | (__ +# \_| |_/\__, |\___|_| |_|\__|_|\___| +# __/ | +# _ _ |___/ +# | | | | / _| | +# | | | | ___ _ __ _ __| |_| | _____ ____ +# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___| +# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ +# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ +# +# This file was automatically generated by gh-aw (v0.76.1). DO NOT EDIT. +# +# To update this file, edit github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115 and run: +# gh aw compile +# Not all edits will cause changes to this file. +# +# For more information: https://github.github.com/gh-aw/introduction/overview/ +# +# +# Source: github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115 +# +# Resolved workflow manifest: +# Imports: +# - github/gh-aw/.github/workflows/shared/noop-reminder.md@359795d49ada21681ab616bd4cbcb144a7387115 +# - github/gh-aw/.github/workflows/shared/reporting.md@359795d49ada21681ab616bd4cbcb144a7387115 +# +# Secrets used: +# - COPILOT_GITHUB_TOKEN +# - GH_AW_GITHUB_MCP_SERVER_TOKEN +# - GH_AW_GITHUB_TOKEN +# - GITHUB_TOKEN +# +# Custom actions used: +# - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 +# - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 +# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 +# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) +# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 +# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 +# - github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 +# +# Container images used: +# - ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 +# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 +# - ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca +# - ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f +# - ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4 +# - node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 + +name: "Issue Triage Agent" +on: + schedule: + - cron: "49 14 * * 1-5" + # Friendly format: daily around 14:00 on weekdays (scattered) + workflow_dispatch: + inputs: + aw_context: + default: "" + description: "Agent caller context (used internally by Agentic Workflows)." + required: false + type: string + +permissions: {} + +concurrency: + group: "gh-aw-${{ github.workflow }}" + +run-name: "Issue Triage Agent" + +jobs: + activation: + runs-on: ubuntu-slim + permissions: + actions: read + contents: read + outputs: + comment_id: "" + comment_repo: "" + engine_id: ${{ steps.generate_aw_info.outputs.engine_id }} + lockdown_check_failed: ${{ steps.generate_aw_info.outputs.lockdown_check_failed == 'true' }} + model: ${{ steps.generate_aw_info.outputs.model }} + secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + stale_lock_file_failed: ${{ steps.check-lock-file.outputs.stale_lock_file_failed == 'true' }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage-agent.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Generate agentic run info + id: generate_aw_info + env: + GH_AW_INFO_ENGINE_ID: "copilot" + GH_AW_INFO_ENGINE_NAME: "GitHub Copilot CLI" + GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AGENT_VERSION: "1.0.52" + GH_AW_INFO_CLI_VERSION: "v0.76.1" + GH_AW_INFO_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_INFO_EXPERIMENTAL: "false" + GH_AW_INFO_SUPPORTS_TOOLS_ALLOWLIST: "true" + GH_AW_INFO_STAGED: "false" + GH_AW_INFO_ALLOWED_DOMAINS: '["defaults"]' + GH_AW_INFO_FIREWALL_ENABLED: "true" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_AWMG_VERSION: "" + GH_AW_INFO_FIREWALL_TYPE: "squid" + GH_AW_INFO_FRONTMATTER_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_FRONTMATTER_EMOJI: "🔧" + GH_AW_COMPILED_STRICT: "true" + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs'); + await main(core, context); + - name: Validate COPILOT_GITHUB_TOKEN secret + id: validate-secret + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh" COPILOT_GITHUB_TOKEN 'GitHub Copilot CLI' https://github.github.com/gh-aw/reference/engines/#github-copilot-default + env: + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + - name: Checkout .github and .agents folders + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + sparse-checkout: | + .github + .agents + .antigravity + .claude + .codex + .crush + .gemini + .opencode + .pi + sparse-checkout-cone-mode: true + fetch-depth: 1 + - name: Save agent config folders for base branch restoration + env: + GH_AW_AGENT_FOLDERS: ".agents .antigravity .claude .codex .crush .gemini .github .opencode .pi" + GH_AW_AGENT_FILES: ".crush.json AGENTS.md ANTIGRAVITY.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/save_base_github_folders.sh" + - name: Check workflow lock file + id: check-lock-file + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_WORKFLOW_FILE: "issue-triage-agent.lock.yml" + GH_AW_CONTEXT_WORKFLOW_REF: "${{ github.workflow_ref }}" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_workflow_timestamp_api.cjs'); + await main(); + - name: Check compile-agentic version + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_COMPILED_VERSION: "v0.76.1" + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/check_version_updates.cjs'); + await main(); + - name: Create prompt with built-in context + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ runner.temp }}/gh-aw/safeoutputs/outputs.jsonl + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + # poutine:ignore untrusted_checkout_exec + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" + { + cat << 'GH_AW_PROMPT_e560c36b9148ef78_EOF' + + GH_AW_PROMPT_e560c36b9148ef78_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" + cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" + cat << 'GH_AW_PROMPT_e560c36b9148ef78_EOF' + + Tools: add_comment, add_labels, missing_tool, missing_data, noop + + GH_AW_PROMPT_e560c36b9148ef78_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" + cat << 'GH_AW_PROMPT_e560c36b9148ef78_EOF' + + The following GitHub context information is available for this workflow: + {{#if github.actor}} + - **actor**: __GH_AW_GITHUB_ACTOR__ + {{/if}} + {{#if github.repository}} + - **repository**: __GH_AW_GITHUB_REPOSITORY__ + {{/if}} + {{#if github.workspace}} + - **workspace**: __GH_AW_GITHUB_WORKSPACE__ + {{/if}} + {{#if github.event.issue.number || (github.aw.context.item_type == 'issue' && github.aw.context.item_number)}} + - **issue-number**: #__GH_AW_EXPR_802A9F6A__ + {{/if}} + {{#if github.event.discussion.number || (github.aw.context.item_type == 'discussion' && github.aw.context.item_number)}} + - **discussion-number**: #__GH_AW_EXPR_1A3A194A__ + {{/if}} + {{#if github.event.pull_request.number || (github.aw.context.item_type == 'pull_request' && github.aw.context.item_number)}} + - **pull-request-number**: #__GH_AW_EXPR_463A214A__ + {{/if}} + {{#if github.event.comment.id || github.aw.context.comment_id}} + - **comment-id**: __GH_AW_EXPR_FF1D34CE__ + {{/if}} + {{#if github.run_id}} + - **workflow-run-id**: __GH_AW_GITHUB_RUN_ID__ + {{/if}} + + + GH_AW_PROMPT_e560c36b9148ef78_EOF + cat "${RUNNER_TEMP}/gh-aw/prompts/github_mcp_tools_with_safeoutputs_prompt.md" + cat << 'GH_AW_PROMPT_e560c36b9148ef78_EOF' + + {{#runtime-import .github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md}} + {{#runtime-import .github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_noop-reminder.md}} + {{#runtime-import .github/workflows/issue-triage-agent.md}} + GH_AW_PROMPT_e560c36b9148ef78_EOF + } > "$GH_AW_PROMPT" + - name: Interpolate variables and render templates + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_ENGINE_ID: "copilot" + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/interpolate_prompt.cjs'); + await main(); + - name: Substitute placeholders + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_EXPR_1A3A194A: ${{ github.event.discussion.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'discussion' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_463A214A: ${{ github.event.pull_request.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'pull_request' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_802A9F6A: ${{ github.event.issue.number || (fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_type == 'issue' && fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').item_number) }} + GH_AW_EXPR_FF1D34CE: ${{ github.event.comment.id || fromJSON(github.event.inputs.aw_context || github.event.client_payload.aw_context || '{}').comment_id }} + GH_AW_GITHUB_ACTOR: ${{ github.actor }} + GH_AW_GITHUB_REPOSITORY: ${{ github.repository }} + GH_AW_GITHUB_RUN_ID: ${{ github.run_id }} + GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }} + GH_AW_MCP_CLI_SERVERS_LIST: '- `safeoutputs` — run `safeoutputs --help` to see available tools' + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + + const substitutePlaceholders = require('${{ runner.temp }}/gh-aw/actions/substitute_placeholders.cjs'); + + // Call the substitution function + return await substitutePlaceholders({ + file: process.env.GH_AW_PROMPT, + substitutions: { + GH_AW_EXPR_1A3A194A: process.env.GH_AW_EXPR_1A3A194A, + GH_AW_EXPR_463A214A: process.env.GH_AW_EXPR_463A214A, + GH_AW_EXPR_802A9F6A: process.env.GH_AW_EXPR_802A9F6A, + GH_AW_EXPR_FF1D34CE: process.env.GH_AW_EXPR_FF1D34CE, + GH_AW_GITHUB_ACTOR: process.env.GH_AW_GITHUB_ACTOR, + GH_AW_GITHUB_REPOSITORY: process.env.GH_AW_GITHUB_REPOSITORY, + GH_AW_GITHUB_RUN_ID: process.env.GH_AW_GITHUB_RUN_ID, + GH_AW_GITHUB_WORKSPACE: process.env.GH_AW_GITHUB_WORKSPACE, + GH_AW_MCP_CLI_SERVERS_LIST: process.env.GH_AW_MCP_CLI_SERVERS_LIST + } + }); + - name: Validate prompt placeholders + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/validate_prompt_placeholders.sh" + - name: Print prompt + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + # poutine:ignore untrusted_checkout_exec + run: bash "${RUNNER_TEMP}/gh-aw/actions/print_prompt_summary.sh" + - name: Upload activation artifact + if: success() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: activation + include-hidden-files: true + path: | + /tmp/gh-aw/aw_info.json + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/aw-prompts/prompt-template.txt + /tmp/gh-aw/aw-prompts/prompt-import-tree.json + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/base + /tmp/gh-aw/.github/agents + /tmp/gh-aw/.github/skills + if-no-files-found: ignore + retention-days: 1 + + agent: + needs: activation + runs-on: ubuntu-latest + permissions: + issues: read + concurrency: + group: "gh-aw-copilot-${{ github.workflow }}" + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + GH_AW_ASSETS_ALLOWED_EXTS: "" + GH_AW_ASSETS_BRANCH: "" + GH_AW_ASSETS_MAX_SIZE_KB: 0 + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + GH_AW_WORKFLOW_ID_SANITIZED: issuetriageagent + outputs: + agentic_engine_timeout: ${{ steps.detect-agent-errors.outputs.agentic_engine_timeout || 'false' }} + effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }} + effective_tokens_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.effective_tokens_rate_limit_error || 'false' }} + has_patch: ${{ steps.collect_output.outputs.has_patch }} + inference_access_error: ${{ steps.detect-agent-errors.outputs.inference_access_error || 'false' }} + mcp_policy_error: ${{ steps.detect-agent-errors.outputs.mcp_policy_error || 'false' }} + model: ${{ needs.activation.outputs.model }} + model_not_supported_error: ${{ steps.detect-agent-errors.outputs.model_not_supported_error || 'false' }} + output: ${{ steps.collect_output.outputs.output }} + output_types: ${{ steps.collect_output.outputs.output_types }} + setup-parent-span-id: ${{ steps.setup.outputs.parent-span-id || steps.setup.outputs.span-id }} + setup-span-id: ${{ steps.setup.outputs.span-id }} + setup-trace-id: ${{ steps.setup.outputs.trace-id }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage-agent.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Set runtime paths + id: set-runtime-paths + run: | + { + echo "GH_AW_SAFE_OUTPUTS=${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl" + echo "GH_AW_SAFE_OUTPUTS_CONFIG_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" + echo "GH_AW_SAFE_OUTPUTS_TOOLS_PATH=${RUNNER_TEMP}/gh-aw/safeoutputs/tools.json" + } >> "$GITHUB_OUTPUT" + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Create gh-aw temp directory + run: bash "${RUNNER_TEMP}/gh-aw/actions/create_gh_aw_tmp_dir.sh" + - name: Configure gh CLI for GitHub Enterprise + run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_gh_for_ghe.sh" + env: + GH_TOKEN: ${{ github.token }} + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.52 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.55 + - name: Determine automatic lockdown mode for GitHub MCP Server + id: determine-automatic-lockdown + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) + env: + GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + with: + script: | + const determineAutomaticLockdown = require('${{ runner.temp }}/gh-aw/actions/determine_automatic_lockdown.cjs'); + await determineAutomaticLockdown(github, context, core); + - name: Download activation artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: activation + path: /tmp/gh-aw + - name: Restore inline sub-agents from activation artifact + env: + GH_AW_SUB_AGENT_DIR: ".github/agents" + GH_AW_SUB_AGENT_EXT: ".agent.md" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh" + - name: Restore inline skills from activation artifact + env: + GH_AW_SKILL_DIR: ".github/skills" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh" + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca ghcr.io/github/gh-aw-mcpg:v0.3.19@sha256:a6c890d7c24d7190c9ef97b9c954cc4cffaae6b01c371ced1f959f1370b1f68f ghcr.io/github/github-mcp-server:v1.0.4@sha256:e3816a476a977cfb836e7d221510011436c654d11861db66ecfd826601aba6a4 node:lts-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 + - name: Generate Safe Outputs Config + run: | + mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" + mkdir -p /tmp/gh-aw/safeoutputs + mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_c8eaf0ada4607ff7_EOF' + {"add_comment":{"max":1},"add_labels":{"allowed":["bug","feature","enhancement","documentation","question","help-wanted","good-first-issue"]},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"report_incomplete":{}} + GH_AW_SAFE_OUTPUTS_CONFIG_c8eaf0ada4607ff7_EOF + - name: Generate Safe Outputs Tools + env: + GH_AW_TOOLS_META_JSON: | + { + "description_suffixes": { + "add_comment": " CONSTRAINTS: Maximum 1 comment(s) can be added. Supports reply_to_id for discussion threading.", + "add_labels": " CONSTRAINTS: Only these labels are allowed: [\"bug\" \"feature\" \"enhancement\" \"documentation\" \"question\" \"help-wanted\" \"good-first-issue\"]." + }, + "repo_params": {}, + "dynamic_tools": [] + } + GH_AW_VALIDATION_JSON: | + { + "add_comment": { + "defaultMax": 1, + "fields": { + "body": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "item_number": { + "issueOrPRNumber": true + }, + "reply_to_id": { + "type": "string", + "maxLength": 256 + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, + "add_labels": { + "defaultMax": 5, + "fields": { + "item_number": { + "issueNumberOrTemporaryId": true + }, + "labels": { + "required": true, + "type": "array", + "itemType": "string", + "itemSanitize": true, + "itemMaxLength": 128 + }, + "repo": { + "type": "string", + "maxLength": 256 + } + } + }, + "missing_data": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "context": { + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "data_type": { + "type": "string", + "sanitize": true, + "maxLength": 128 + }, + "reason": { + "type": "string", + "sanitize": true, + "maxLength": 256 + } + } + }, + "missing_tool": { + "defaultMax": 20, + "fields": { + "alternatives": { + "type": "string", + "sanitize": true, + "maxLength": 512 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 256 + }, + "tool": { + "type": "string", + "sanitize": true, + "maxLength": 128 + } + } + }, + "noop": { + "defaultMax": 1, + "fields": { + "message": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 65000 + } + } + }, + "report_incomplete": { + "defaultMax": 5, + "fields": { + "details": { + "type": "string", + "sanitize": true, + "maxLength": 65000 + }, + "reason": { + "required": true, + "type": "string", + "sanitize": true, + "maxLength": 1024 + } + } + } + } + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_safe_outputs_tools.cjs'); + await main(); + - name: Generate Safe Outputs MCP Server Config + id: safe-outputs-config + run: | + # Generate a secure random API key (360 bits of entropy, 40+ chars) + # Mask immediately to prevent timing vulnerabilities + API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${API_KEY}" + + PORT=3001 + + # Set outputs for next steps + { + echo "safe_outputs_api_key=${API_KEY}" + echo "safe_outputs_port=${PORT}" + } >> "$GITHUB_OUTPUT" + + echo "Safe Outputs MCP server will run on port ${PORT}" + + - name: Start Safe Outputs MCP HTTP Server + id: safe-outputs-start + env: + DEBUG: '*' + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-config.outputs.safe_outputs_port }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-config.outputs.safe_outputs_api_key }} + GH_AW_SAFE_OUTPUTS_TOOLS_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/tools.json + GH_AW_SAFE_OUTPUTS_CONFIG_PATH: ${{ runner.temp }}/gh-aw/safeoutputs/config.json + GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs + run: | + # Environment variables are set above to prevent template injection + export DEBUG + export GH_AW_SAFE_OUTPUTS + export GH_AW_SAFE_OUTPUTS_PORT + export GH_AW_SAFE_OUTPUTS_API_KEY + export GH_AW_SAFE_OUTPUTS_TOOLS_PATH + export GH_AW_SAFE_OUTPUTS_CONFIG_PATH + export GH_AW_MCP_LOG_DIR + + bash "${RUNNER_TEMP}/gh-aw/actions/start_safe_outputs_server.sh" + + - name: Start MCP Gateway + id: start-mcp-gateway + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_SAFE_OUTPUTS_API_KEY: ${{ steps.safe-outputs-start.outputs.api_key }} + GH_AW_SAFE_OUTPUTS_PORT: ${{ steps.safe-outputs-start.outputs.port }} + GITHUB_MCP_GUARD_MIN_INTEGRITY: ${{ steps.determine-automatic-lockdown.outputs.min_integrity }} + GITHUB_MCP_GUARD_REPOS: ${{ steps.determine-automatic-lockdown.outputs.repos }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + set -eo pipefail + mkdir -p "${RUNNER_TEMP}/gh-aw/mcp-config" + + # Export gateway environment variables for MCP config and gateway script + export MCP_GATEWAY_PORT="8080" + export MCP_GATEWAY_DOMAIN="host.docker.internal" + export MCP_GATEWAY_HOST_DOMAIN="localhost" + MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=') + echo "::add-mask::${MCP_GATEWAY_API_KEY}" + export MCP_GATEWAY_API_KEY + export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads" + mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}" + export MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD="524288" + export DEBUG="*" + + export GH_AW_ENGINE="copilot" + export GH_AW_MCP_CLI_SERVERS='["safeoutputs"]' + echo GH_AW_MCP_CLI_SERVERS='["safeoutputs"]' >> "$GITHUB_ENV" + MCP_GATEWAY_UID=$(id -u 2>/dev/null || echo '0') + MCP_GATEWAY_GID=$(id -g 2>/dev/null || echo '0') + case "${DOCKER_HOST:-}" in + unix://* ) DOCKER_SOCK_PATH="${DOCKER_HOST#unix://}" ;; + /* ) DOCKER_SOCK_PATH="$DOCKER_HOST" ;; + * ) DOCKER_SOCK_PATH=/var/run/docker.sock ;; + esac + DOCKER_SOCK_GID=$(stat -c '%g' "$DOCKER_SOCK_PATH" 2>/dev/null || echo '0') + export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host --add-host host.docker.internal:127.0.0.1 --user '"${MCP_GATEWAY_UID}"':'"${MCP_GATEWAY_GID}"' --group-add '"${DOCKER_SOCK_GID}"' -v '"${DOCKER_SOCK_PATH}"':/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e MCP_GATEWAY_PAYLOAD_SIZE_THRESHOLD -e DOCKER_HOST=unix:///var/run/docker.sock -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_GUARD_MIN_INTEGRITY -e GITHUB_MCP_GUARD_REPOS -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.3.19' + + mkdir -p /home/runner/.copilot + GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) + cat << GH_AW_MCP_CONFIG_88b8311e90d25032_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + { + "mcpServers": { + "github": { + "type": "stdio", + "container": "ghcr.io/github/github-mcp-server:v1.0.4", + "env": { + "GITHUB_HOST": "\${GITHUB_SERVER_URL}", + "GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}", + "GITHUB_READ_ONLY": "1", + "GITHUB_TOOLSETS": "issues,labels" + }, + "guard-policies": { + "allow-only": { + "min-integrity": "$GITHUB_MCP_GUARD_MIN_INTEGRITY", + "repos": "$GITHUB_MCP_GUARD_REPOS" + } + } + }, + "safeoutputs": { + "type": "http", + "url": "http://host.docker.internal:$GH_AW_SAFE_OUTPUTS_PORT", + "headers": { + "Authorization": "\${GH_AW_SAFE_OUTPUTS_API_KEY}" + }, + "guard-policies": { + "write-sink": { + "accept": [ + "*" + ] + } + } + } + }, + "gateway": { + "port": $MCP_GATEWAY_PORT, + "domain": "${MCP_GATEWAY_DOMAIN}", + "apiKey": "${MCP_GATEWAY_API_KEY}", + "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" + } + } + GH_AW_MCP_CONFIG_88b8311e90d25032_EOF + - name: Mount MCP servers as CLIs + id: mount-mcp-clis + continue-on-error: true + env: + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + MCP_GATEWAY_DOMAIN: ${{ steps.start-mcp-gateway.outputs.gateway-domain }} + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('${{ runner.temp }}/gh-aw/actions/mount_mcp_as_cli.cjs'); + await main(); + - name: Clean credentials + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/clean_git_credentials.sh" + - name: Audit pre-agent workspace + id: pre_agent_audit + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/audit_pre_agent_workspace.sh" + - name: Execute GitHub Copilot CLI + id: agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 5 + run: | + set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" + (umask 177 && touch /tmp/gh-aw/agent-stdio.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","api.snapcraft.io","archive.ubuntu.com","azure.archive.ubuntu.com","crl.geotrust.com","crl.globalsign.com","crl.identrust.com","crl.sectigo.com","crl.thawte.com","crl.usertrust.com","crl.verisign.com","crl3.digicert.com","crl4.digicert.com","crls.ssl.com","github.com","host.docker.internal","json-schema.org","json.schemastore.org","keyserver.ubuntu.com","ocsp.digicert.com","ocsp.geotrust.com","ocsp.globalsign.com","ocsp.identrust.com","ocsp.sectigo.com","ocsp.ssl.com","ocsp.thawte.com","ocsp.usertrust.com","ocsp.verisign.com","packagecloud.io","packages.cloud.google.com","packages.microsoft.com","ppa.launchpad.net","raw.githubusercontent.com","registry.npmjs.org","s.symcb.com","s.symcd.com","security.ubuntu.com","telemetry.enterprise.githubcopilot.com","ts-crl.ws.symantec.com","ts-ocsp.ws.symantec.com","www.googleapis.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000,"models":{"agent":["sonnet-6x","gpt-5.4","gpt-5.3","gemini-pro","any"],"antigravity":["copilot/antigravity*","google/antigravity*","gemini/antigravity*"],"any":["copilot/*","anthropic/*","openai/*","google/*","gemini/*"],"claude":["agent"],"codex":["agent"],"coding":["copilot/gpt-5*codex*","openai/gpt-5*codex*","gpt-5-codex"],"computer-use":["copilot/*computer-use*","google/*computer-use*","gemini/*computer-use*","openai/*computer-use*"],"copilot":["agent"],"deep-research":["copilot/deep-research*","copilot/o3-deep-research*","copilot/o4-mini-deep-research*","google/deep-research*","gemini/deep-research*","openai/o3-deep-research*","openai/o4-mini-deep-research*"],"gemini":["agent"],"gemini-3-flash":["copilot/gemini-3*flash*","google/gemini-3*flash*","gemini/gemini-3*flash*"],"gemini-3-pro":["copilot/gemini-3*pro*","google/gemini-3*pro*","gemini/gemini-3*pro*"],"gemini-3.1-flash":["copilot/gemini-3.1*flash*","google/gemini-3.1*flash*","gemini/gemini-3.1*flash*"],"gemini-3.1-pro":["copilot/gemini-3.1*pro*","google/gemini-3.1*pro*","gemini/gemini-3.1*pro*"],"gemini-3.5-flash":["copilot/gemini-3.5*flash*","google/gemini-3.5*flash*","gemini/gemini-3.5*flash*"],"gemini-flash":["copilot/gemini-*flash*","google/gemini-*flash*","gemini/gemini-*flash*"],"gemini-flash-lite":["copilot/gemini-*flash*lite*","google/gemini-*flash*lite*","gemini/gemini-*flash*lite*"],"gemini-pro":["copilot/gemini-*pro*","google/gemini-*pro*","gemini/gemini-*pro*"],"gemma":["copilot/gemma*","google/gemma*","gemini/gemma*"],"gpt-4.1":["copilot/gpt-4.1*","openai/gpt-4.1*"],"gpt-5":["copilot/gpt-5*","openai/gpt-5*"],"gpt-5-codex":["copilot/gpt-5*codex*","openai/gpt-5*codex*"],"gpt-5-mini":["copilot/gpt-5*mini*","openai/gpt-5*mini*"],"gpt-5-nano":["copilot/gpt-5*nano*","openai/gpt-5*nano*"],"gpt-5-pro":["copilot/gpt-5*pro*","openai/gpt-5*pro*"],"gpt-5.2":["copilot/gpt-5.2*","openai/gpt-5.2*"],"gpt-5.3":["copilot/gpt-5.3*","openai/gpt-5.3*"],"gpt-5.4":["copilot/gpt-5.4*","openai/gpt-5.4*"],"gpt-5.5":["copilot/gpt-5.5*","openai/gpt-5.5*"],"haiku":["copilot/*haiku*","anthropic/*haiku*"],"large":["sonnet","gpt-5-pro","gpt-5","gemini-pro"],"mini":["haiku","gpt-5-mini","gpt-5-nano","gemini-flash-lite"],"opus":["copilot/*opus*","anthropic/*opus*"],"opusplan":["opus?effort=high"],"reasoning":["copilot/o1*","copilot/o3*","copilot/o4*","openai/o1*","openai/o3*","openai/o4*"],"robotics":["copilot/*robotics*","google/*robotics*","gemini/*robotics*"],"small":["mini"],"sonnet":["copilot/*sonnet*","anthropic/*sonnet*"],"sonnet-6x":["copilot/*sonnet-4-5-*","anthropic/*sonnet-4-5-*","copilot/*sonnet-4-6*","anthropic/*sonnet-4-6*"],"summarization":["haiku","gpt-5-mini","gemini-flash-lite","mini"],"vision":["copilot/gemini-*image*","gemini/gemini-*image*","copilot/gemini-*flash*","gemini/gemini-*flash*"]}},"container":{"imageTag":"0.25.55,squid=sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca,agent=sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731,api-proxy=sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" + cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --exclude-env GITHUB_MCP_SERVER_TOKEN --exclude-env MCP_GATEWAY_API_KEY --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="${RUNNER_TEMP}/gh-aw/mcp-cli/bin:$PATH" && export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log + env: + AWF_REFLECT_ENABLED: 1 + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_MCP_CONFIG: /home/runner/.copilot/mcp-config.json + GH_AW_PHASE: agent + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_VERSION: v0.76.1 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Detect agent errors + if: always() + id: detect-agent-errors + continue-on-error: true + run: node "${RUNNER_TEMP}/gh-aw/actions/detect_agent_errors.cjs" + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + GITHUB_TOKEN: ${{ github.token }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global am.keepcr true + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Copy Copilot session state files to logs + if: always() + continue-on-error: true + run: bash "${RUNNER_TEMP}/gh-aw/actions/copy_copilot_session_state.sh" + - name: Stop MCP Gateway + if: always() + continue-on-error: true + env: + MCP_GATEWAY_PORT: ${{ steps.start-mcp-gateway.outputs.gateway-port }} + MCP_GATEWAY_API_KEY: ${{ steps.start-mcp-gateway.outputs.gateway-api-key }} + GATEWAY_PID: ${{ steps.start-mcp-gateway.outputs.gateway-pid }} + run: | + bash "${RUNNER_TEMP}/gh-aw/actions/stop_mcp_gateway.sh" "$GATEWAY_PID" + - name: Redact secrets in logs + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/redact_secrets.cjs'); + await main(); + env: + GH_AW_SECRET_NAMES: 'COPILOT_GITHUB_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKEN,GH_AW_GITHUB_TOKEN,GITHUB_TOKEN' + SECRET_COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + SECRET_GH_AW_GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }} + SECRET_GH_AW_GITHUB_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN }} + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Append agent step summary + if: always() + run: bash "${RUNNER_TEMP}/gh-aw/actions/append_agent_step_summary.sh" + - name: Copy Safe Outputs + if: always() + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + run: | + mkdir -p /tmp/gh-aw + cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true + - name: Ingest agent output + id: collect_output + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }} + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/collect_ndjson_output.cjs'); + await main(); + - name: Parse agent logs for step summary + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: /tmp/gh-aw/sandbox/agent/logs/ + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_copilot_log.cjs'); + await main(); + - name: Parse MCP Gateway logs for step summary + if: always() + id: parse-mcp-gateway + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_mcp_gateway_log.cjs'); + await main(); + - name: Print firewall logs + if: always() + continue-on-error: true + env: + AWF_LOGS_DIR: /tmp/gh-aw/sandbox/firewall/logs + run: | + # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts + # AWF runs with sudo, creating files owned by root + sudo chmod -R a+rX /tmp/gh-aw/sandbox/firewall 2>/dev/null || true + # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step) + if command -v awf &> /dev/null; then + awf logs summary | tee -a "$GITHUB_STEP_SUMMARY" + else + echo 'AWF binary not installed, skipping firewall log summary' + fi + - name: Parse token usage for step summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_token_usage.cjs'); + await main(); + - name: Print AWF reflect summary + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/awf_reflect_summary.cjs'); + await main(); + - name: Write agent output placeholder if missing + if: always() + run: | + if [ ! -f /tmp/gh-aw/agent_output.json ]; then + echo '{"items":[]}' > /tmp/gh-aw/agent_output.json + fi + - name: Upload agent artifacts + if: always() + continue-on-error: true + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: agent + path: | + /tmp/gh-aw/aw-prompts/prompt.txt + /tmp/gh-aw/sandbox/agent/logs/ + /tmp/gh-aw/redacted-urls.log + /tmp/gh-aw/mcp-logs/ + /tmp/gh-aw/agent_usage.json + /tmp/gh-aw/agent-stdio.log + /tmp/gh-aw/pre-agent-audit.txt + /tmp/gh-aw/agent/ + /tmp/gh-aw/github_rate_limits.jsonl + /tmp/gh-aw/safeoutputs.jsonl + /tmp/gh-aw/agent_output.json + /tmp/gh-aw/aw-*.patch + /tmp/gh-aw/aw-*.bundle + /tmp/gh-aw/awf-config.json + /tmp/gh-aw/sandbox/firewall/logs/ + /tmp/gh-aw/sandbox/firewall/audit/ + /tmp/gh-aw/sandbox/firewall/awf-reflect.json + if-no-files-found: ignore + + conclusion: + needs: + - activation + - agent + - detection + - safe_outputs + if: > + always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' || + needs.activation.outputs.stale_lock_file_failed == 'true') + runs-on: ubuntu-slim + permissions: + contents: read + discussions: write + issues: write + pull-requests: write + concurrency: + group: "gh-aw-conclusion-issue-triage-agent" + cancel-in-progress: false + queue: max + outputs: + incomplete_count: ${{ steps.report_incomplete.outputs.incomplete_count }} + noop_message: ${{ steps.noop.outputs.noop_message }} + tools_reported: ${{ steps.missing_tool.outputs.tools_reported }} + total_count: ${{ steps.missing_tool.outputs.total_count }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage-agent.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Process no-op messages + id: noop + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_NOOP_MAX: "1" + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_NOOP_REPORT_AS_ISSUE: "true" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_noop_message.cjs'); + await main(); + - name: Log detection run + id: detection_runs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_detection_runs.cjs'); + await main(); + - name: Record missing tool + id: missing_tool + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_MISSING_TOOL_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/missing_tool.cjs'); + await main(); + - name: Record incomplete + id: report_incomplete + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_REPORT_INCOMPLETE_CREATE_ISSUE: "true" + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/report_incomplete_handler.cjs'); + await main(); + - name: Handle agent failure + id: handle_agent_failure + if: always() + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }} + GH_AW_WORKFLOW_ID: "issue-triage-agent" + GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168" + GH_AW_ENGINE_ID: "copilot" + GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.activation.outputs.secret_verification_result }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens || '' }} + GH_AW_EFFECTIVE_TOKENS_RATE_LIMIT_ERROR: ${{ needs.agent.outputs.effective_tokens_rate_limit_error || 'false' }} + GH_AW_INFERENCE_ACCESS_ERROR: ${{ needs.agent.outputs.inference_access_error }} + GH_AW_MCP_POLICY_ERROR: ${{ needs.agent.outputs.mcp_policy_error }} + GH_AW_AGENTIC_ENGINE_TIMEOUT: ${{ needs.agent.outputs.agentic_engine_timeout }} + GH_AW_MODEL_NOT_SUPPORTED_ERROR: ${{ needs.agent.outputs.model_not_supported_error }} + GH_AW_ENGINE_API_HOSTS: "api.enterprise.githubcopilot.com,api.githubcopilot.com,api.business.githubcopilot.com,api.individual.githubcopilot.com" + GH_AW_LOCKDOWN_CHECK_FAILED: ${{ needs.activation.outputs.lockdown_check_failed }} + GH_AW_STALE_LOCK_FILE_FAILED: ${{ needs.activation.outputs.stale_lock_file_failed }} + GH_AW_GROUP_REPORTS: "false" + GH_AW_FAILURE_REPORT_AS_ISSUE: "true" + GH_AW_MISSING_TOOL_REPORT_AS_FAILURE: "true" + GH_AW_MISSING_DATA_REPORT_AS_FAILURE: "true" + GH_AW_TIMEOUT_MINUTES: "5" + GH_AW_MAX_EFFECTIVE_TOKENS: "25000000" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/handle_agent_failure.cjs'); + await main(); + + detection: + needs: + - activation + - agent + if: > + always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true') + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + detection_conclusion: ${{ steps.detection_conclusion.outputs.conclusion }} + detection_reason: ${{ steps.detection_conclusion.outputs.reason }} + detection_success: ${{ steps.detection_conclusion.outputs.success }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage-agent.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Checkout repository for patch context + if: needs.agent.outputs.has_patch == 'true' + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + # --- Threat Detection --- + - name: Clean stale firewall files from agent artifact + run: | + rm -rf /tmp/gh-aw/sandbox/firewall/logs + rm -rf /tmp/gh-aw/sandbox/firewall/audit + - name: Download container images + run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.55@sha256:138c363411decc9a61a5af9b95e8d64c76648b00add0ba06fc7ba786f0e72731 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.55@sha256:4142b873b678cd3279b98dcbe464857d56ea2f2348719b00379cdf35dd843ff3 ghcr.io/github/gh-aw-firewall/squid:0.25.55@sha256:74084b704d8d3664a363655986664d70bd9cdb4830532d0b35cd784d867aabca + - name: Check if detection needed + id: detection_guard + if: always() + env: + OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }} + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + run: | + if [[ -n "$OUTPUT_TYPES" || "$HAS_PATCH" == "true" ]]; then + echo "run_detection=true" >> "$GITHUB_OUTPUT" + echo "Detection will run: output_types=$OUTPUT_TYPES, has_patch=$HAS_PATCH" + else + echo "run_detection=false" >> "$GITHUB_OUTPUT" + echo "Detection skipped: no agent outputs or patches to analyze" + fi + - name: Clear MCP Config for detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + rm -f "${RUNNER_TEMP}/gh-aw/mcp-config/mcp-servers.json" + rm -f /home/runner/.copilot/mcp-config.json + rm -f "$GITHUB_WORKSPACE/.gemini/settings.json" + - name: Prepare threat detection files + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection/aw-prompts + cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true + cp /tmp/gh-aw/agent_output.json /tmp/gh-aw/threat-detection/agent_output.json 2>/dev/null || true + for f in /tmp/gh-aw/aw-*.patch; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + for f in /tmp/gh-aw/aw-*.bundle; do + [ -f "$f" ] && cp "$f" /tmp/gh-aw/threat-detection/ 2>/dev/null || true + done + echo "Prepared threat detection files:" + ls -la /tmp/gh-aw/threat-detection/ 2>/dev/null || true + - name: Setup threat detection + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + WORKFLOW_NAME: "Issue Triage Agent" + WORKFLOW_DESCRIPTION: "No description provided" + HAS_PATCH: ${{ needs.agent.outputs.has_patch }} + with: + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/setup_threat_detection.cjs'); + await main(); + - name: Ensure threat-detection directory and log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + run: | + mkdir -p /tmp/gh-aw/threat-detection + touch /tmp/gh-aw/threat-detection/detection.log + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: '24' + package-manager-cache: false + - name: Install GitHub Copilot CLI + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_copilot_cli.sh" 1.0.52 + env: + GH_HOST: github.com + - name: Install AWF binary + run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.25.55 + - name: Execute GitHub Copilot CLI + if: always() && steps.detection_guard.outputs.run_detection == 'true' + continue-on-error: true + id: detection_agentic_execution + # Copilot CLI tool arguments (sorted): + timeout-minutes: 20 + run: | + set -o pipefail + printf '%s' "$(date +%s%3N)" > /tmp/gh-aw/agent_cli_start_ms.txt + touch /tmp/gh-aw/agent-step-summary.md + GH_AW_NODE_BIN=$(command -v node 2>/dev/null || true) + export GH_AW_NODE_BIN + export COPILOT_API_KEY="$COPILOT_DUMMY_BYOK" + (umask 177 && touch /tmp/gh-aw/threat-detection/detection.log) + printf '%s\n' '{"$schema":"https://github.com/github/gh-aw-firewall/releases/download/v0.25.55/awf-config.schema.json","network":{"allowDomains":["api.business.githubcopilot.com","api.enterprise.githubcopilot.com","api.github.com","api.githubcopilot.com","api.individual.githubcopilot.com","github.com","host.docker.internal","telemetry.enterprise.githubcopilot.com"]},"apiProxy":{"enabled":true,"enableTokenSteering":true,"maxRuns":500,"maxEffectiveTokens":25000000},"container":{"imageTag":"0.25.55"}}' > "${RUNNER_TEMP}/gh-aw/awf-config.json" + cp "${RUNNER_TEMP}/gh-aw/awf-config.json" /tmp/gh-aw/awf-config.json + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" + if [[ "${DOCKER_HOST:-}" =~ ^tcp:// ]]; then + GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="--docker-host-path-prefix /tmp/gh-aw" + fi + # shellcheck disable=SC1003 + sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" --container-workdir "${GITHUB_WORKSPACE}" --mount "${RUNNER_TEMP}/gh-aw:${RUNNER_TEMP}/gh-aw:ro" --mount "${RUNNER_TEMP}/gh-aw:/host${RUNNER_TEMP}/gh-aw:ro" ${GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS} --env-all --exclude-env COPILOT_GITHUB_TOKEN --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --audit-dir /tmp/gh-aw/sandbox/firewall/audit --enable-host-access --allow-host-ports 80,443,8080 --skip-pull \ + -- /bin/bash -c 'export PATH="$(find /opt/hostedtoolcache /home/runner/work/_tool -maxdepth 5 -type d -name bin 2>/dev/null | tr '\''\n'\'' '\'':'\'')$PATH"; [ -n "$GOROOT" ] && export PATH="$GOROOT/bin:$PATH" || true && GH_AW_NODE_EXEC="${GH_AW_NODE_BIN:-}"; if [ -z "$GH_AW_NODE_EXEC" ] || [ ! -x "$GH_AW_NODE_EXEC" ]; then GH_AW_NODE_EXEC="$(command -v node 2>/dev/null || true)"; fi; if [ -z "$GH_AW_NODE_EXEC" ]; then echo "node runtime missing on this runner — check runtimes.node in workflow YAML" >&2; exit 127; fi; "$GH_AW_NODE_EXEC" ${RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --add-dir "${GITHUB_WORKSPACE}" --prompt-file /tmp/gh-aw/aw-prompts/prompt.txt' 2>&1 | tee -a /tmp/gh-aw/threat-detection/detection.log + env: + AWF_REFLECT_ENABLED: 1 + COPILOT_AGENT_RUNNER_TYPE: STANDALONE + COPILOT_DUMMY_BYOK: dummy-byok-key-for-offline-mode + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_MODEL: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || 'claude-sonnet-4.6' }} + GH_AW_PHASE: detection + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + GH_AW_VERSION: v0.76.1 + GITHUB_API_URL: ${{ github.api_url }} + GITHUB_AW: true + GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows + GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_STEP_SUMMARY: /tmp/gh-aw/agent-step-summary.md + GITHUB_WORKSPACE: ${{ github.workspace }} + GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: github-actions[bot] + GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_NAME: github-actions[bot] + XDG_CONFIG_HOME: /home/runner + - name: Upload threat detection log + if: always() && steps.detection_guard.outputs.run_detection == 'true' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: detection + path: /tmp/gh-aw/threat-detection/detection.log + if-no-files-found: ignore + - name: Parse and conclude threat detection + id: detection_conclusion + if: always() + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }} + DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }} + GH_AW_DETECTION_CONTINUE_ON_ERROR: "true" + with: + script: | + try { + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/parse_threat_detection_results.cjs'); + await main(); + } catch (loadErr) { + const continueOnError = process.env.GH_AW_DETECTION_CONTINUE_ON_ERROR !== 'false'; + const detectionExecutionFailed = process.env.DETECTION_AGENTIC_EXECUTION_OUTCOME === 'failure'; + const msg = 'ERR_SYSTEM: \u274C Unexpected error loading threat detection module: ' + (loadErr && loadErr.message ? loadErr.message : String(loadErr)); + core.error(msg); + core.setOutput('reason', 'parse_error'); + if (continueOnError && !detectionExecutionFailed) { + core.warning('\u26A0\uFE0F ' + msg); + core.setOutput('conclusion', 'warning'); + core.setOutput('success', 'false'); + } else { + core.setOutput('conclusion', 'failure'); + core.setOutput('success', 'false'); + core.setFailed(msg); + } + } + + safe_outputs: + needs: + - activation + - agent + - detection + if: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success' + runs-on: ubuntu-slim + permissions: + contents: read + discussions: write + issues: write + pull-requests: write + timeout-minutes: 15 + env: + GH_AW_CALLER_WORKFLOW_ID: "${{ github.repository }}/issue-triage-agent" + GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} + GH_AW_DETECTION_REASON: ${{ needs.detection.outputs.detection_reason }} + GH_AW_EFFECTIVE_TOKENS: ${{ needs.agent.outputs.effective_tokens }} + GH_AW_ENGINE_ID: "copilot" + GH_AW_ENGINE_MODEL: ${{ needs.agent.outputs.model }} + GH_AW_ENGINE_VERSION: "1.0.52" + GH_AW_WORKFLOW_EMOJI: "🔧" + GH_AW_WORKFLOW_ID: "issue-triage-agent" + GH_AW_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115" + GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/blob/359795d49ada21681ab616bd4cbcb144a7387115/.github/workflows/issue-triage-agent.md" + outputs: + code_push_failure_count: ${{ steps.process_safe_outputs.outputs.code_push_failure_count }} + code_push_failure_errors: ${{ steps.process_safe_outputs.outputs.code_push_failure_errors }} + comment_id: ${{ steps.process_safe_outputs.outputs.comment_id }} + comment_url: ${{ steps.process_safe_outputs.outputs.comment_url }} + create_discussion_error_count: ${{ steps.process_safe_outputs.outputs.create_discussion_error_count }} + create_discussion_errors: ${{ steps.process_safe_outputs.outputs.create_discussion_errors }} + process_safe_outputs_processed_count: ${{ steps.process_safe_outputs.outputs.processed_count }} + process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }} + steps: + - name: Setup Scripts + id: setup + uses: github/gh-aw-actions/setup@46d564922b082d0db93244972e8005ea6904ee5f # v0.76.1 + with: + destination: ${{ runner.temp }}/gh-aw/actions + job-name: ${{ github.job }} + trace-id: ${{ needs.activation.outputs.setup-trace-id }} + parent-span-id: ${{ needs.activation.outputs.setup-parent-span-id || needs.activation.outputs.setup-span-id }} + env: + GH_AW_SETUP_WORKFLOW_NAME: "Issue Triage Agent" + GH_AW_CURRENT_WORKFLOW_REF: ${{ github.repository }}/.github/workflows/issue-triage-agent.lock.yml@${{ github.ref }} + GH_AW_INFO_VERSION: "1.0.52" + GH_AW_INFO_AWF_VERSION: "v0.25.55" + GH_AW_INFO_BODY_MODIFIED: "false" + GH_AW_INFO_ENGINE_ID: "copilot" + - name: Download agent output artifact + id: download-agent-output + continue-on-error: true + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: agent + path: /tmp/gh-aw/ + - name: Setup agent output environment variable + id: setup-agent-output-env + if: steps.download-agent-output.outcome == 'success' + run: | + mkdir -p /tmp/gh-aw/ + find "/tmp/gh-aw/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/agent_output.json" >> "$GITHUB_OUTPUT" + - name: Configure GH_HOST for enterprise compatibility + id: ghes-host-config + shell: bash + run: | + # Derive GH_HOST from GITHUB_SERVER_URL so the gh CLI targets the correct + # GitHub instance (GHES/GHEC). On github.com this is a harmless no-op. + GH_HOST="${GITHUB_SERVER_URL#https://}" + GH_HOST="${GH_HOST#http://}" + echo "GH_HOST=${GH_HOST}" >> "$GITHUB_ENV" + - name: Process Safe Outputs + id: process_safe_outputs + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ steps.setup-agent-output-env.outputs.GH_AW_AGENT_OUTPUT }} + GH_AW_COMMENT_ID: ${{ needs.activation.outputs.comment_id }} + GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com,www.googleapis.com" + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_API_URL: ${{ github.api_url }} + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"add_labels\":{\"allowed\":[\"bug\",\"feature\",\"enhancement\",\"documentation\",\"question\",\"help-wanted\",\"good-first-issue\"]},\"create_report_incomplete_issue\":{},\"missing_data\":{},\"missing_tool\":{},\"noop\":{\"max\":1,\"report-as-issue\":\"true\"},\"report_incomplete\":{}}" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io, getOctokit); + const { main } = require('${{ runner.temp }}/gh-aw/actions/safe_output_handler_manager.cjs'); + await main(); + - name: Upload Safe Outputs Items + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: safe-outputs-items + path: | + /tmp/gh-aw/safe-output-items.jsonl + /tmp/gh-aw/temporary-id-map.json + if-no-files-found: ignore diff --git a/.github/workflows/issue-triage-agent.md b/.github/workflows/issue-triage-agent.md new file mode 100644 index 000000000000..2d382f9117c4 --- /dev/null +++ b/.github/workflows/issue-triage-agent.md @@ -0,0 +1,91 @@ +--- +on: + schedule: daily around 14:00 on weekdays + workflow_dispatch: null +permissions: + issues: read +imports: +- github/gh-aw/.github/workflows/shared/reporting.md@359795d49ada21681ab616bd4cbcb144a7387115 +- github/gh-aw/.github/workflows/shared/noop-reminder.md@359795d49ada21681ab616bd4cbcb144a7387115 +safe-outputs: + add-comment: {} + add-labels: + allowed: + - bug + - feature + - enhancement + - documentation + - question + - help-wanted + - good-first-issue +emoji: 🔧 +source: github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115 +strict: true +timeout-minutes: 5 +tools: + cli-proxy: true + github: + toolsets: + - issues + - labels +--- +# Issue Triage Agent + +List open issues in ${{ github.repository }} that have no labels. For each unlabeled issue, analyze the title and body, then add one of the allowed labels: `bug`, `feature`, `enhancement`, `documentation`, `question`, `help-wanted`, or `good-first-issue`. + +Skip issues that: +- Already have any of these labels +- Have been assigned to any user (especially non-bot users) + +After adding the label to an issue, mention the issue author in a comment using this format (follow shared/reporting.md guidelines): + +**Comment Template**: +```markdown +### 🏷️ Issue Triaged + +Hi @{author}! I've categorized this issue as **{label_name}** based on the following analysis: + +**Reasoning**: {brief_explanation_of_why_this_label} + +
+View Triage Details + +#### Analysis +- **Keywords detected**: {list_of_keywords_that_matched} +- **Issue type indicators**: {what_made_this_fit_the_category} +- **Confidence**: {High/Medium/Low} + +#### Recommended Next Steps +- {context_specific_suggestion_1} +- {context_specific_suggestion_2} + +
+ +**References**: [Triage run §{run_id}](https://github.com/github/gh-aw/actions/runs/{run_id}) +``` + +**Key formatting requirements**: +- Use h3 (###) for the main heading +- Keep reasoning visible for quick understanding +- Wrap detailed analysis in `
` tags +- Include workflow run reference +- Keep total comment concise (collapsed details prevent noise) + +## Batch Comment Optimization + +For efficiency, if multiple issues are triaged in a single run: +1. Add individual labels to each issue +2. Add a brief comment to each issue (using the template above) +3. Optionally: Create a discussion summarizing all triage actions for that run + +This provides both per-issue context and batch visibility. + +## Labels + +- `bug`: Indicates a problem or error in the code that needs fixing. +- `feature`: Represents a new feature request or enhancement to existing functionality. +- `enhancement`: Suggests improvements to existing features or code. +- `documentation`: Pertains to issues related to documentation, such as missing or unclear docs. +- `question`: Used for issues that are asking for clarification or have questions about the project. +- `help-wanted`: Indicates that the issue is a good candidate for external contributions and help +- `good-first-issue`: Marks issues that are suitable for newcomers to the project, often with simpler scope. diff --git a/.github/workflows/license-templates/LICENSE.txt b/.github/workflows/license-templates/LICENSE.txt new file mode 100644 index 000000000000..60b675e31016 --- /dev/null +++ b/.github/workflows/license-templates/LICENSE.txt @@ -0,0 +1,16 @@ +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. diff --git a/.github/workflows/main-sonar-check.yml b/.github/workflows/main-sonar-check.yml index 8248e48022a3..3d510fa5dc34 100644 --- a/.github/workflows/main-sonar-check.yml +++ b/.github/workflows/main-sonar-check.yml @@ -15,54 +15,51 @@ # specific language governing permissions and limitations # under the License. -name: Main Branch Sonar Quality Check - +name: Sonar Quality Check (Main) +permissions: + contents: read on: push: branches: - main - -permissions: - contents: read # to fetch code (actions/checkout) - pull-requests: write # for sonar to comment on pull-request - +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: build: if: github.repository == 'apache/cloudstack' - name: Main Sonar JaCoCo Build - runs-on: ubuntu-22.04 + name: Sonar JaCoCo Coverage + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up JDK17 - uses: actions/setup-java@v4 + persist-credentials: false + - name: Setup Environment + uses: ./.github/actions/setup-env with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - + install-python: 'true' + install-apt-deps: 'true' - name: Cache SonarCloud packages - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-m2 - - - name: Run Tests with Coverage + - name: Install Non-OSS + uses: ./.github/actions/install-nonoss + - name: Run Build and Tests with Coverage + run: mvn -B -T$(nproc) -P developer,systemvm,quality -Dsimulator -Dnoredist clean install + - name: Upload to SonarQube env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss - cd nonoss && bash -x install-non-oss.sh && cd .. - mvn -T$(nproc) -P quality -Dsimulator -Dnoredist clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack + run: mvn -B -P quality org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack -Dsonar.branch.name=${{ github.ref_name }} + - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + with: + files: ./client/target/site/jacoco-aggregate/jacoco.xml + fail_ci_if_error: true + flags: unittests + verbose: true + name: codecov + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/merge-conflict-checker.yml b/.github/workflows/merge-conflict-checker.yml index 860e1c1b5614..f23719f7183a 100644 --- a/.github/workflows/merge-conflict-checker.yml +++ b/.github/workflows/merge-conflict-checker.yml @@ -17,28 +17,26 @@ name: "PR Merge Conflict Check" on: - push: - pull_request_target: - types: [synchronize] + schedule: + - cron: '*/10 * * * *' + workflow_dispatch: -permissions: # added using https://github.com/step-security/secure-workflows - contents: read +permissions: {} concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + group: "gh-aw-${{ github.workflow }}" jobs: triage: permissions: - pull-requests: write # for eps1lon/actions-label-merge-conflict to label PRs - runs-on: ubuntu-22.04 + pull-requests: write # for eps1lon/actions-label-merge-conflict to label PRs + runs-on: ubuntu-24.04 steps: - - name: Conflict Check - uses: eps1lon/actions-label-merge-conflict@v2.0.0 - with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - dirtyLabel: "status:has-conflicts" - removeOnDirtyLabel: "status:ready-for-review" - continueOnMissingPermissions: true - commentOnDirty: "This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch." + - name: Conflict Check + uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3 + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + dirtyLabel: "status:has-conflicts" + removeOnDirtyLabel: "status:ready-for-review" + continueOnMissingPermissions: true + commentOnDirty: "This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch." diff --git a/.github/workflows/linter.yml b/.github/workflows/pre-commit.yml similarity index 65% rename from .github/workflows/linter.yml rename to .github/workflows/pre-commit.yml index b6c814a36f4c..1ea00be9112f 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/pre-commit.yml @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -name: Lint +name: pre-commit on: [pull_request] @@ -29,19 +29,27 @@ concurrency: jobs: pre-commit: name: Run pre-commit - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Check Out - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.11' + cache: 'pip' - name: Install - run: | - python -m pip install --upgrade pip - pip install pre-commit + run: pip install pre-commit - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - uses: actions/cache@v4 + - name: Cache pre-commit environments + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Run pre-commit - run: pre-commit run --all-files + run: pre-commit run --color=always --all-files + - name: Run manual pre-commit hooks + run: pre-commit run --color=always --all-files --hook-stage manual diff --git a/.github/workflows/rat.yml b/.github/workflows/rat.yml index 52ce343841ba..a36a956856e7 100644 --- a/.github/workflows/rat.yml +++ b/.github/workflows/rat.yml @@ -16,32 +16,27 @@ # under the License. name: License Check - -on: [push, pull_request] - +on: + - push + - pull_request concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} permissions: contents: read - jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - java-version: '17' - distribution: 'adopt' - architecture: x64 - cache: maven + persist-credentials: false + - name: Setup Environment + uses: ./.github/actions/setup-env + - name: Install Non-OSS + uses: ./.github/actions/install-nonoss - name: RAT licence checks run: | - git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss && cd nonoss && bash -x install-non-oss.sh && cd .. - rm -fr nonoss mvn -P developer,systemvm -Dsimulator -Dnoredist -pl . org.apache.rat:apache-rat-plugin:0.12:check - name: Rat Report if: always() diff --git a/.github/workflows/sonar-check.yml b/.github/workflows/sonar-check.yml index c36bceb2b901..e614d1864824 100644 --- a/.github/workflows/sonar-check.yml +++ b/.github/workflows/sonar-check.yml @@ -16,58 +16,52 @@ # under the License. name: Sonar Quality Check - -on: [pull_request] - permissions: - contents: read # to fetch code (actions/checkout) - pull-requests: write # for sonar to comment on pull-request - + contents: read + pull-requests: write +on: + pull_request: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: build: - if: github.repository == 'apache/cloudstack' && github.event.pull_request.head.repo.full_name == github.repository name: Sonar JaCoCo Coverage - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - ref: "refs/pull/${{ github.event.number }}/merge" fetch-depth: 0 - - - name: Set up JDK17 - uses: actions/setup-java@v4 + persist-credentials: false + - name: Setup Environment + uses: ./.github/actions/setup-env with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - + install-python: 'true' + install-apt-deps: 'true' - name: Cache SonarCloud packages - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-m2 - + - name: Install Non-OSS + uses: ./.github/actions/install-nonoss - name: Run Build and Tests with Coverage - id: coverage + run: mvn -B -T$(nproc) -P developer,systemvm,quality -Dsimulator -Dnoredist clean install + - name: Upload to SonarQube + if: github.repository == 'apache/cloudstack' && github.event.pull_request.head.repo.full_name == github.repository env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} PR_ID: ${{ github.event.pull_request.number }} HEADREF: ${{ github.event.pull_request.head.ref }} run: | - git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss - cd nonoss && bash -x install-non-oss.sh && cd .. - mvn -T$(nproc) -P quality -Dsimulator -Dnoredist clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack -Dsonar.pullrequest.key="$PR_ID" -Dsonar.pullrequest.branch="$HEADREF" -Dsonar.pullrequest.github.repository=apache/cloudstack -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.summary_comment=true + mvn -B -P quality org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack -Dsonar.pullrequest.key="$PR_ID" -Dsonar.pullrequest.branch="$HEADREF" -Dsonar.pullrequest.github.repository=apache/cloudstack -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.summary_comment=true + - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + with: + files: ./client/target/site/jacoco-aggregate/jacoco.xml + fail_ci_if_error: true + flags: unittests + verbose: true + name: codecov + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000000..c0da5f98cc8e --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + actions: write + issues: write + pull-requests: write + steps: + - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0 + with: + stale-issue-message: 'This issue is stale because it has been open for 120 days with no activity. It may be removed by administrators of this project at any time. Remove the stale label or comment to request for removal of it to prevent this.' + stale-pr-message: 'This PR is stale because it has been open for 120 days with no activity. It may be removed by administrators of this project at any time. Remove the stale label or comment to request for removal of it to prevent this.' + close-issue-message: 'This issue was closed because it has been stale for 120 days with no activity.' + close-pr-message: 'This PR was closed because it has been stale for 240 days with no activity.' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' + days-before-stale: 120 + days-before-close: -1 + days-before-pr-close: 240 + exempt-issue-labels: 'gsoc,good-first-issue,long-term-plan' + exempt-pr-labels: 'status:ready-for-merge,status:needs-testing,status:on-hold' + - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0 + with: + stale-issue-label: 'archive' + days-before-stale: 240 + exempt-issue-labels: 'gsoc,good-first-issue,long-term-plan' + days-before-close: -1 diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 56f757133b71..0a6cd5f3ea5f 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -28,15 +28,19 @@ permissions: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 16 + cache: 'npm' + cache-dependency-path: 'ui/package-lock.json' - name: Env details run: | @@ -55,7 +59,8 @@ jobs: npm run lint npm run test:unit - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + if: github.repository == 'apache/cloudstack' with: working-directory: ui files: ./coverage/lcov.info diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 000000000000..9fc9e21de772 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +CHANGES.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9bc87454f1c..91537e25267e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,23 +15,122 @@ # specific language governing permissions and limitations # under the License. --- -default_stages: [commit, push] +default_stages: [pre-commit, pre-push] default_language_version: # force all unspecified Python hooks to run python3 python: python3 -minimum_pre_commit_version: "2.17.0" +minimum_pre_commit_version: "3.2.0" repos: - repo: meta hooks: - id: identity - id: check-hooks-apply + - repo: https://github.com/thlorenz/doctoc.git + rev: v2.2.0 + hooks: + - id: doctoc + name: Add TOC for Markdown files + files: ^CONTRIBUTING\.md$|^INSTALL\.md$|^README\.md$ + - repo: https://github.com/oxipng/oxipng + rev: v9.1.5 + hooks: + - id: oxipng + name: run oxipng + description: optimize PNG images with lossless compression + args: ['-o', '4', '--strip', 'safe', '--alpha'] + - repo: https://github.com/gitleaks/gitleaks + rev: v8.27.2 + hooks: + - id: gitleaks + name: run gitleaks + description: detect hardcoded secrets + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.5 + hooks: + - id: chmod + name: set file permissions + args: ['644'] + files: \.md$ + stages: [manual] + - id: insert-license + name: add license for all cfg files + description: automatically adds a licence header to all cfg files that don't have a license header + files: \.cfg$ + args: + - --comment-style + - '|#|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - id: insert-license + name: add license for all Markdown files + files: \.md$ + args: + - --comment-style + - '' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + exclude: ^(CHANGES|ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE)\.md$|^ui/docs/(full|smoke)-test-plan\.template\.md$|^\.github/workflows/.*\.md$|^\.github/aw/.*\.md$ + - id: insert-license + name: add license for all properties files + description: automatically adds a licence header to all properties files that don't have a license header + files: \.properties$ + args: + - --comment-style + - '|#|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - id: insert-license + name: add license for all Shell files + description: automatically adds a licence header to all Shell files that don't have a license header + files: \.sh$ + args: + - --comment-style + - '|#|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - id: insert-license + name: add license for all SQL files + files: \.sql$ + args: + - --comment-style + - '|--|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - id: insert-license + name: add license for all Vue files + files: \.vue$ + args: + - --comment-style + - '|//|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - id: insert-license + name: add license for all YAML files + description: automatically adds a licence header to all YAML files that don't have a license header + files: \.ya?ml$ + args: + - --comment-style + - '|#|' + - --license-filepath + - .github/workflows/license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + exclude: ^\.github/workflows/.*\.lock\.yml$ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: #- id: check-added-large-files - id: check-case-conflict #- id: check-executables-have-shebangs + - id: check-illegal-windows-names - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + files: \.sh$ - id: check-symlinks - id: check-vcs-permalinks #- id: check-yaml @@ -42,6 +141,7 @@ repos: exclude: > (?x) ^scripts/vm/systemvm/id_rsa\.cloud$| + ^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest\.java$| ^server/src/test/java/com/cloud/keystore/KeystoreTest\.java$| ^server/src/test/resources/certs/dsa_self_signed\.key$| ^server/src/test/resources/certs/non_root\.key$| @@ -51,47 +151,47 @@ repos: ^server/src/test/resources/certs/rsa_self_signed\.key$| ^services/console-proxy/rdpconsole/src/test/doc/rdp-key\.pem$| ^systemvm/agent/certs/localhost\.key$| - ^systemvm/agent/certs/realhostip\.key$ + ^systemvm/agent/certs/systemvm\.key$| + ^test/integration/smoke/test_ssl_offloading\.py$ - id: end-of-file-fixer - exclude: \.vhd$ + exclude: \.vhd$|\.svg$ + - id: file-contents-sorter + args: [--unique] + files: ^\.github/linters/codespell\.txt$ - id: fix-byte-order-marker - id: forbid-submodules - id: mixed-line-ending - exclude: \.cs$ - id: trailing-whitespace - files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$ + files: ^(LICENSE|NOTICE)$|README$|\.(bat|cfg|config|cs|css|erb|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|svg|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$ args: [--markdown-linebreak-ext=md] exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.2 hooks: - id: codespell name: run codespell description: Check spelling with codespell - args: [--ignore-words=.github/linters/codespell.txt] - exclude: ^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$ - repo: https://github.com/pycqa/flake8 rev: 7.0.0 hooks: - id: flake8 args: [--config, .github/linters/.flake8] - exclude: > - (?x) - ^agent/bindir/cloud-setup-agent\.in$| - ^client/bindir/cloud-update-xenserver-licenses\.in$| - ^cloud-cli/bindir/cloud-tool$| - ^python/bindir/cloud-grab-dependent-library-versions$| - ^python/bindir/cloud-setup-baremetal$| - ^scripts/vm/hypervisor/xenserver/storagePlugin$| - ^scripts/vm/hypervisor/xenserver/vmopspremium$| - ^setup/bindir/cloud-setup-encryption\.in$| - ^venv/.*$ - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.43.0 + rev: v0.45.0 hooks: - id: markdownlint name: run markdownlint description: check Markdown files with markdownlint args: [--config=.github/linters/.markdown-lint.yml] types: [markdown] - files: \.(md|mdown|markdown)$ + files: \.md$ + - repo: https://github.com/adrienverge/yamllint + rev: v1.37.1 + hooks: + - id: yamllint + name: run yamllint + description: check YAML files with yamllint + args: [--config-file=.github/linters/.yamllint.yml] + types: [yaml] + files: \.ya?ml$ + exclude: ^.*k8s-.*\.ya?ml$|^.github/workflows/.*\.lock\.ya?ml$ diff --git a/CHANGES.md b/CHANGES.md index 8fea4f3a355b..7a670a55a61f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -644,12 +644,12 @@ Bug ID | Description Version 4.2.1 ------------- -Release notes contain the list of [bug fixes](http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.1/html/Release_Notes/version-4.2.html#issues-fixed-4.2.1) +Release notes contain the list of [bug fixes](https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.1/html/Release_Notes/version-4.2.html#issues-fixed-4.2.1) Version 4.2.0 ------------- Released on October 1 2013. -Release notes contain the list of [bug fixes](http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.0/html/Release_Notes/index.html) +Release notes contain the list of [bug fixes](https://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.2.0/html/Release_Notes/index.html) Version 4.1.0 ------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6d006938f3e..f0678ed76498 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,46 +1,79 @@ -Contributing to Apache CloudStack (ACS) -======================================= + + +# Contributing to Apache CloudStack (ACS) + +## Summary + + + + +- [Summary](#summary) +- [Bug fixes](#bug-fixes) +- [Developing new features](#developing-new-features) +- [PendingReleaseNotes file](#pendingreleasenotes-file) +- [Fork the code](#fork-the-code) +- [Making changes](#making-changes) +- [Rebase `feature_x` to include updates from `upstream/main`](#rebase-feature_x-to-include-updates-from-upstreammain) +- [Make a GitHub Pull Request to contribute your changes](#make-a-github-pull-request-to-contribute-your-changes) +- [Cleaning up after a successful pull request](#cleaning-up-after-a-successful-pull-request) +- [Release Principles](#release-principles) + + + +## Summary -Summary -------- This document covers how to contribute to the ACS project. ACS uses GitHub PRs to manage code contributions. -These instructions assume you have a GitHub.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to your own fork of the ACS project and you will submit a Pull Request for your changes to be added. +These instructions assume you have a GitHub.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to your own fork of the ACS project, and you will submit a Pull Request for your changes to be added. -_Lets get started!!!_ +_Let's get started!!!_ -Bug fixes ---------- +## Bug fixes It's very important that we can easily track bug fix commits, so their hashes should remain the same in all branches. Therefore, a pull request (PR) that fixes a bug, should be sent against a release branch. This can be either the "current release" or the "previous release", depending on which ones are maintained. Since the goal is a stable main, bug fixes should be "merged forward" to the next branch in order: "previous release" -> "current release" -> main (in other words: old to new) -Developing new features ------------------------ +## Developing new features Development should be done in a feature branch, branched off of main. Send a PR(steps below) to get it into main (2x LGTM applies). PR will only be merged when main is open, will be held otherwise until main is open again. No back porting / cherry-picking features to existing branches! -PendingReleaseNotes file ------------------------- -When developing a new feature or making a (major) change to a existing feature you are encouraged to append this to the PendingReleaseNotes file so that the Release Manager can +## PendingReleaseNotes file + +When developing a new feature or making a (major) change to an existing feature you are encouraged to append this to the PendingReleaseNotes file so that the Release Manager can use this file as a source of information when compiling the Release Notes for a new release. When adding information to the PendingReleaseNotes file make sure that you write a good and understandable description of the new feature or change which you have developed. Updating the PendingReleaseNotes file is preferably a part of the original Pull Request, but that is up to the developers' discretion. -Fork the code -------------- +## Fork the code In your browser, navigate to: [https://github.com/apache/cloudstack](https://github.com/apache/cloudstack) -Fork the repository by clicking on the 'Fork' button on the top right hand side. The fork will happen and you will be taken to your own fork of the repository. Copy the Git repository URL by clicking on the clipboard next to the URL on the right hand side of the page under '**HTTPS** clone URL'. You will paste this URL when doing the following `git clone` command. +Fork the repository by clicking on the 'Fork' button on the top right hand side. The fork will happen, and you will be taken to your own fork of the repository. Copy the Git repository URL by clicking on the clipboard next to the URL on the right hand side of the page under '**HTTPS** clone URL'. You will paste this URL when doing the following `git clone` command. -On your computer, follow these steps to setup a local repository for working on ACS: +On your computer, follow these steps to set up a local repository for working on ACS: ```bash $ git clone https://github.com/YOUR_ACCOUNT/cloudstack.git @@ -51,8 +84,7 @@ $ git fetch upstream $ git rebase upstream/main ``` -Making changes --------------- +## Making changes It is important that you create a new branch to make changes on and that you do not change the `main` branch (other than to rebase in changes from `upstream/main`). In this example I will assume you will be making your changes to a branch called `feature_x`. This `feature_x` branch will be created on your local repository and will be pushed to your forked repository on GitHub. Once this branch is on your fork you will create a Pull Request for the changes to be added to the ACS project. @@ -68,8 +100,7 @@ $ git commit -a -m "descriptive commit message for your changes" > The `-b` specifies that you want to create a new branch called `feature_x`. You only specify `-b` the first time you checkout because you are creating a new branch. Once the `feature_x` branch exists, you can later switch to it with only `git checkout feature_x`. -Rebase `feature_x` to include updates from `upstream/main` ------------------------------------------------------------- +## Rebase `feature_x` to include updates from `upstream/main` It is important that you maintain an up-to-date `main` branch in your local repository. This is done by rebasing in the code changes from `upstream/main` (the official ACS project repository) into your local repository. You will want to do this before you start working on a feature as well as right before you submit your changes as a pull request. I recommend you do this process periodically while you work to make sure you are working off the most recent project code. @@ -89,12 +120,11 @@ $ git rebase main > Now your `feature_x` branch is up-to-date with all the code in `upstream/main`. -Make a GitHub Pull Request to contribute your changes ------------------------------------------------------ +## Make a GitHub Pull Request to contribute your changes -When you are happy with your changes and you are ready to contribute them, you will create a Pull Request on GitHub to do so. This is done by pushing your local changes to your forked repository (default remote name is `origin`) and then initiating a pull request on GitHub. +When you are happy with your changes, and you are ready to contribute them, you will create a Pull Request on GitHub to do so. This is done by pushing your local changes to your forked repository (default remote name is `origin`) and then initiating a pull request on GitHub. -Please include JIRA id, detailed information about the bug/feature, what all tests are executed, how the reviewer can test this feature etc. Incase of UI PRs, a screenshot is preferred. +Please include JIRA id, detailed information about the bug/feature, what all tests are executed, how the reviewer can test this feature etc. In case of UI PRs, a screenshot is preferred. > **IMPORTANT:** Make sure you have rebased your `feature_x` branch to include the latest code from `upstream/main` _before_ you do this. @@ -114,8 +144,7 @@ To initiate the pull request, do the following: If you are requested to make modifications to your proposed changes, make the changes locally on your `feature_x` branch, re-push the `feature_x` branch to your fork. The existing pull request should automatically pick up the change and update accordingly. -Cleaning up after a successful pull request -------------------------------------------- +## Cleaning up after a successful pull request Once the `feature_x` branch has been committed into the `upstream/main` branch, your local `feature_x` branch and the `origin/feature_x` branch are no longer needed. If you want to make additional changes, restart the process with a new branch. @@ -129,6 +158,6 @@ $ git branch -D feature_x $ git push origin :feature_x ``` -Release Principles ------------------- +## Release Principles + Detailed information about ACS release principles is available at https://cwiki.apache.org/confluence/display/CLOUDSTACK/Release+principles+for+Apache+CloudStack+4.6+and+up diff --git a/INSTALL.md b/INSTALL.md index 3685037bfe21..52f109b0a411 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,15 +1,46 @@ + + # Apache CloudStack Installation basics This document describes how to develop, build, package and install Apache -CloudStack. For more information please refer to the official [documentation](http://docs.cloudstack.apache.org) +CloudStack. For more information please refer to the official [documentation](https://docs.cloudstack.apache.org) or the developer [wiki](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Home). Apache CloudStack developers use various platforms for development, this guide was tested against a CentOS 7 x86_64 setup. -* [Setting up development environment](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Setting+up+CloudStack+Development+Environment) for Apache CloudStack. -* [Building](https://cwiki.apache.org/confluence/display/CLOUDSTACK/How+to+build+CloudStack) Apache CloudStack. -* [Appliance based development](https://github.com/rhtyd/monkeybox) + + + +- [Setting up Development Environment](#setting-up-development-environment) + - [Using jenv and/or pyenv for Version Management](#using-jenv-andor-pyenv-for-version-management) +- [Getting the Source Code](#getting-the-source-code) +- [Building](#building) +- [To bring up CloudStack UI](#to-bring-up-cloudstack-ui) +- [Building with non-redistributable plugins](#building-with-non-redistributable-plugins) +- [Packaging and Installation](#packaging-and-installation) + - [Debian/Ubuntu](#debianubuntu) + - [RHEL/CentOS](#rhelcentos) +- [Notes](#notes) + + ## Setting up Development Environment @@ -18,19 +49,19 @@ Install tools and dependencies used for development: # yum -y install git java-17-openjdk java-17-openjdk-devel \ mysql mysql-server mkisofs git gcc python MySQL-python openssh-clients wget -Set up Maven (3.6.0): +Set up Maven (3.9.10): - # wget http://www.us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz - # tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /usr/local + # wget https://dlcdn.apache.org/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz + # sudo tar -zxvf apache-maven-3.9.10-bin.tar.gz -C /usr/local # cd /usr/local - # ln -s apache-maven-3.6.3 maven + # sudo ln -s apache-maven-3.9.10 maven # echo export M2_HOME=/usr/local/maven >> ~/.bashrc # or .zshrc or .profile # echo export PATH=/usr/local/maven/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile # source ~/.bashrc -Setup up NodeJS (LTS): +Setup up Node.js 16: - # curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash - + # curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash - # sudo yum install nodejs # sudo npm install -g @vue/cli npm-check-updates @@ -41,7 +72,7 @@ Start the MySQL service: ### Using jenv and/or pyenv for Version Management -CloudStack is built using Java and Python. To make selection of these tools versions more consistent and ease installation for developers, optional support for [jenv](http://www.jenv.be/) and [pyenv](https://github.com/yyuu/pyenv) with [virtualenv]|(https://github.com/yyuu/pyenv-virtualenv) is provided. jenv installation instructions are available here and pyenv installation instructions are available here. For users of [oh-my-zsh](http://ohmyz.sh/) there is a pyenv plugin available to trigger configuration of pyenv in a shell session. +CloudStack is built using Java and Python. To make selection of these tools versions more consistent and ease installation for developers, optional support for [jenv](http://www.jenv.be/) and [pyenv](https://github.com/yyuu/pyenv) with [virtualenv]|(https://github.com/yyuu/pyenv-virtualenv) is provided. jenv installation instructions are available here and pyenv installation instructions are available here. For users of [oh-my-zsh](https://ohmyz.sh/) there is a pyenv plugin available to trigger configuration of pyenv in a shell session. Following installation, execute the following commands to configure jenv and pyenv for use with CloudStack development: @@ -104,13 +135,13 @@ To install dependencies. To build the project. - $ npm build + $ npm run build For Development Mode. $ npm start -Make sure to set CS_URL=http://localhost:8080/client on .env.local file on ui. +Make sure to set `CS_URL=http://localhost:8080` on the `.env.local` file on UI. You should be able to run the management server on http://localhost:5050 @@ -171,7 +202,7 @@ All the rpm packages will be created in `dist/rpmbuild/RPMS/x86_64` directory. ## Notes -If you will be using Xen as your hypervisor, please download [vhd-util](http://download.cloudstack.org/tools/vhd-util) +If you will be using Xen as your hypervisor, please download [vhd-util](https://download.cloudstack.org/tools/vhd-util) If management server is installed on RHEL/CentOS, then copy vhd-util into: diff --git a/LICENSE b/LICENSE index 8be7d8083a5e..e61c431f5fad 100644 --- a/LICENSE +++ b/LICENSE @@ -177,14 +177,14 @@ Copyright (c) 2014 The Apache Software Foundation of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - + This distribution contains third party resources. Within the console-proxy/js directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Copyright (c) 2009, John Resig - + Copyright (c) 2009, John Resig + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -192,10 +192,10 @@ Within the console-proxy/js directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -203,43 +203,43 @@ Within the console-proxy/js directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from John Resig - jquery.js + + from John Resig + jquery.js Within the systemvm/debian/etc directory placed in the public domain - by Adiscon GmbH http://www.adiscon.com/ - rsyslog.conf - by Simon Kelley - dnsmasq.conf - vpcdnsmasq.conf + by Adiscon GmbH http://www.adiscon.com/ + rsyslog.conf + by Simon Kelley + dnsmasq.conf + vpcdnsmasq.conf Within the systemvm/debian/etc/apache2 directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2012 The Apache Software Foundation - from The Apache Software Foundation http://www.apache.org/ - httpd.conf + from The Apache Software Foundation http://www.apache.org/ + httpd.conf vhost.template Within the systemvm/debian/etc/ssh/ directory licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows) - - + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -250,55 +250,55 @@ Within the systemvm/debian/etc/ssh/ directory ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - from OpenSSH Project http://www.openssh.org/ - sshd_config + + from OpenSSH Project http://www.openssh.org/ + sshd_config Within the systemvm/debian/root/redundant_router directory placed in the public domain - by The netfilter.org project http://www.netfilter.org/ - conntrackd.conf.templ + by The netfilter.org project http://www.netfilter.org/ + conntrackd.conf.templ Within the scripts/storage/secondary directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2010-2011 OpenStack, LLC. - from OpenStack, LLC http://www.openstack.org - swift + from OpenStack, LLC http://www.openstack.org + swift Within the scripts/vm/hypervisor/xenserver directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2010-2011 OpenStack, LLC. - from OpenStack, LLC http://www.openstack.org - swift + from OpenStack, LLC http://www.openstack.org + swift Within the ui/lib directory placed in the public domain - by Eric Meyer http://meyerweb.com/eric/ + by Eric Meyer http://meyerweb.com/eric/ reset.css from http://meyerweb.com/eric/tools/css/reset/ licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2006 Google Inc. - from Google Inc. http://google.com + from Google Inc. http://google.com excanvas.js from http://code.google.com/p/explorercanvas/ licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows) Copyright (c) 2008 George McGinley Smith - All rights reserved. - + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -309,13 +309,13 @@ Within the ui/lib directory ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - from George McGinley Smith - jquery.easing.js + + from George McGinley Smith + jquery.easing.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - - + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -323,10 +323,10 @@ Within the ui/lib directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -334,14 +334,14 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from The Dojo Foundation http://dojofoundation.org/ + + from The Dojo Foundation http://dojofoundation.org/ require.js from http://github.com/jrburke/requirejs licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Copyright (c) 2011, John Resig - + Copyright (c) 2011, John Resig + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -349,10 +349,10 @@ Within the ui/lib directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -360,14 +360,14 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from John Resig - jquery.js + + from John Resig + jquery.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) Copyright (c) 2014 Jörn Zaefferer - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -375,10 +375,10 @@ Within the ui/lib directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -386,9 +386,9 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Jorn Zaefferer - jquery.validate.js + + from Jorn Zaefferer + jquery.validate.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -418,8 +418,8 @@ Within the ui/lib directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Copyright (c) 2010, Sebastian Tschan - + Copyright (c) 2010, Sebastian Tschan + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -427,10 +427,10 @@ Within the ui/lib directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -438,14 +438,14 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Sebastian Tschan https://blueimp.net - jquery.md5.js + + from Sebastian Tschan https://blueimp.net + jquery.md5.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Copyright (c) 2006 Klaus Hartl (stilbuero.de) - + Copyright (c) 2006 Klaus Hartl (stilbuero.de) + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -453,10 +453,10 @@ Within the ui/lib directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -464,15 +464,15 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Klaus Hartl http://stilbuero.de - jquery.cookies.js + + from Klaus Hartl http://stilbuero.de + jquery.cookies.js Within the ui/lib/flot directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Released under the MIT license by IOLA, December 2007. - + Released under the MIT license by IOLA, December 2007. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -480,10 +480,10 @@ Within the ui/lib/flot directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -491,24 +491,24 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from IOLA http://www.iola.dk/ - jquery.flot.crosshair.js - jquery.flot.fillbetween.js - jquery.flot.image.js - jquery.flot.js - jquery.flot.navigate.js - jquery.flot.resize.js - jquery.flot.selection.js - jquery.flot.stack.js - jquery.flot.symbol.js - jquery.flot.threshold.js + + from IOLA http://www.iola.dk/ + jquery.flot.crosshair.js + jquery.flot.fillbetween.js + jquery.flot.image.js + jquery.flot.js + jquery.flot.navigate.js + jquery.flot.resize.js + jquery.flot.selection.js + jquery.flot.stack.js + jquery.flot.symbol.js + jquery.flot.threshold.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) Created by Brian Medendorp, June 2009 - Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars - + Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -516,10 +516,10 @@ Within the ui/lib/flot directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -527,13 +527,13 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Brian Medendorp - jquery.pie.js + + from Brian Medendorp + jquery.pie.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - - + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -541,10 +541,10 @@ Within the ui/lib/flot directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -552,14 +552,14 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Ole Laursen - jquery.colorhelpers.js + + from Ole Laursen + jquery.colorhelpers.js Within the ui/lib/jquery-ui directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - - + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -567,10 +567,10 @@ Within the ui/lib/jquery-ui directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -578,17 +578,17 @@ Within the ui/lib/jquery-ui directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from jQuery UI Developers http://jqueryui.com/about - css/jquery-ui.css - index.html - js/jquery-ui.js + + from jQuery UI Developers http://jqueryui.com/about + css/jquery-ui.css + index.html + js/jquery-ui.js Within the ui/lib/qunit directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - Copyright (c) 2012 John Resig, Jörn Zaefferer - + Copyright (c) 2012 John Resig, Jörn Zaefferer + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -596,10 +596,10 @@ Within the ui/lib/qunit directory distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -607,20 +607,20 @@ Within the ui/lib/qunit directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from Jorn Zaefferer + + from Jorn Zaefferer qunit.css from http://docs.jquery.com/QUnit qunit.js from http://docs.jquery.com/QUnit Within the utils/src/main/java/com/cloud/utils/db directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2004 Clinton Begin - from Clinton Begin http://code.google.com/p/mybatis/ + from Clinton Begin http://code.google.com/p/mybatis/ ScriptRunner.java from http://code.google.com/p/mybatis/ Within the utils/src/main/java/org/apache/commons/httpclient/contrib/ssl directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2007 The Apache Software Foundation - from The Apache Software Foundation http://www.apache.org/ - EasySSLProtocolSocketFactory.java - EasyX509TrustManager.java + from The Apache Software Foundation http://www.apache.org/ + EasySSLProtocolSocketFactory.java + EasyX509TrustManager.java diff --git a/NOTICE b/NOTICE index b19e4a428530..8666be264b51 100644 --- a/NOTICE +++ b/NOTICE @@ -1,62 +1,62 @@ Apache CloudStack Copyright 2014 The Apache Software Foundation - + This product includes software developed at The Apache Software Foundation (http://www.apache.org/). - - + + This distribution contains third party resources requiring the following notices: - - For + + For jquery.js - + jQuery JavaScript Library v1.3.2 http://jquery.com/ - + Copyright (c) 2009 John Resig Dual licensed under the MIT and GPL licenses. http://docs.jquery.com/License - + Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) Revision: 6246 - - For + + For jquery.js - + jQuery JavaScript Library v1.6.4 http://jquery.com/ - + Copyright 2011, John Resig Dual licensed under the MIT or GPL Version 2 licenses. http://jquery.org/license - + Includes Sizzle.js http://sizzlejs.com/ Copyright 2011, The Dojo Foundation Released under the MIT, BSD, and GPL Licenses. - + Date: Mon Sep 12 18:54:48 2011 -0400 - - For + + For jquery.md5.js - + jQuery MD5 Plugin 1.2.1 https://github.com/blueimp/jQuery-MD5 - + Copyright 2010, Sebastian Tschan https://blueimp.net - + Licensed under the MIT license: http://creativecommons.org/licenses/MIT/ - + Based on A JavaScript implementation of the RSA Data Security, Inc. MD5 Message Digest Algorithm, as defined in RFC 1321. @@ -65,15 +65,15 @@ Copyright 2014 The Apache Software Foundation Distributed under the BSD License See http://pajhome.org.uk/crypt/md5 for more info. - - For + + For jquery.colorhelpers.js - + Plugin for jQuery for working with colors. - + Version 1.1. - + Inspiration from jQuery color animation plugin by John Resig. - + Released under the MIT license by Ole Laursen, October 2009. diff --git a/PRE_COMMIT.md b/PRE_COMMIT.md new file mode 100644 index 000000000000..62dc296c99e4 --- /dev/null +++ b/PRE_COMMIT.md @@ -0,0 +1,62 @@ + + +# pre-commit + +We run [pre-commit](https://pre-commit.com/) with +[GitHub Actions](https://github.com/apache/cloudstack/blob/main/.github/workflows/pre-commit.yml) so installation on your +local machine is currently optional. + +The `pre-commit` [configuration file](https://github.com/apache/cloudstack/blob/main/.pre-commit-config.yaml) +is in the repository root. Before you can run the hooks, you need to have `pre-commit` installed. `pre-commit` is a +[Python package](https://pypi.org/project/pre-commit/). + +From the repository root run: `pip install -r requirements-dev.txt` to install `pre-commit` and after you install +`pre-commit` you will then need to install the pre-commit hooks by running `pre-commit install`. + +The hooks run when running `git commit` and also from the command line with `pre-commit`. Some of the hooks will auto +fix the code after the hooks fail whilst most will print error messages from the linters. If a hook fails the overall +commit will fail, and you will need to fix the issues or problems and `git add` and `git commit` again. On `git commit` +the hooks will run mostly only against modified files so if you want to test all hooks against all files and when you +are adding a new hook you should always run: + +`pre-commit run --all-files` + +Sometimes you might need to skip a hook to commit because the hook is stopping you from committing or your computer +might not have all the installation requirements for all the hooks. The `SKIP` variable is comma separated for two or +more hooks: + +`SKIP=codespell git commit -m "foo"` + +The same applies when running pre-commit: + +`SKIP=codespell pre-commit run --all-files` + +Occasionally you can have more serious problems when using `pre-commit` with `git commit`. You can use `--no-verify` to +commit and stop `pre-commit` from checking the hooks. For example: + +`git commit --no-verify -m "foo"` + +If you are having major problems using `pre-commit` you can always uninstall it. + +To run a single hook use `pre-commit run --all-files ` + +For example just run the `codespell` hook: + +`pre-commit run --all-files codespell` diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 0bd7a7643ce1..be04436d3ff8 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -22,8 +22,8 @@ This PR... - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) -- [ ] build/CI -- [ ] test (unit or integration test code) +- [ ] Build/CI +- [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity diff --git a/README.md b/README.md index f66a4dc6f975..852674ab7b1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,54 @@ -# Apache CloudStack [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack) + + +# Apache CloudStack + +[![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) +[![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack) +[![Docker CloudStack Simulator Status](https://github.com/apache/cloudstack/actions/workflows/docker-cloudstack-simulator.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/docker-cloudstack-simulator.yml) +[![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) +[![Linter Status](https://github.com/apache/cloudstack/actions/workflows/linter.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/linter.yml) +[![Merge Conflict Checker Status](https://github.com/apache/cloudstack/actions/workflows/merge-conflict-checker.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/merge-conflict-checker.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) +[![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) +[![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![Apache CloudStack](tools/logo/apache_cloudstack.png)](https://cloudstack.apache.org/) + + + +- [Who Uses CloudStack?](#who-uses-cloudstack) +- [Demo](#demo) +- [Getting Started](#getting-started) +- [Getting Source Repository](#getting-source-repository) +- [Documentation](#documentation) +- [News and Events](#news-and-events) +- [Getting Involved and Contributing](#getting-involved-and-contributing) +- [Reporting Security Vulnerabilities](#reporting-security-vulnerabilities) +- [License](#license) +- [Notice of Cryptographic Software](#notice-of-cryptographic-software) +- [Star History](#star-history) +- [Contributors](#contributors) + + + Apache CloudStack is open source software designed to deploy and manage large networks of virtual machines, as a highly available, highly scalable Infrastructure as a Service (IaaS) cloud computing platform. CloudStack is used @@ -21,7 +68,7 @@ OVM and LXC containers. Users can manage their cloud with an easy to use Web interface, command line tools, and/or a full-featured query based API. -For more information on Apache CloudStack, please visit the [website](http://cloudstack.apache.org) +For more information on Apache CloudStack, please visit the [website](https://cloudstack.apache.org) ## Who Uses CloudStack? @@ -78,10 +125,10 @@ via GitHub pull requests. ## Getting Involved and Contributing Interested in helping out with Apache CloudStack? Great! We welcome -participation from anybody willing to work [The Apache Way](http://theapacheway.com) and make a +participation from anybody willing to work [The Apache Way](https://theapacheway.com) and make a contribution. Note that you do not have to be a developer in order to contribute to Apache CloudStack. We need folks to help with documentation, translation, -promotion etc. See our contribution [page](http://cloudstack.apache.org/contribute.html). +promotion etc. See our contribution [page](https://cloudstack.apache.org/contribute.html). If you are a frequent contributors, you can request to be added as collaborators (see https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features#Git.asf.yamlfeatures-AssigningexternalcollaboratorswiththetriageroleonGitHub) @@ -92,7 +139,7 @@ You may do so by sharing your GitHub users ID or raise a GitHub issue. If you're interested in learning more or participating in the Apache CloudStack project, the mailing lists are the best way to do that. While the project has -several communications channels, the [mailing lists](http://cloudstack.apache.org/mailing-lists.html) are the most active and the +several communications channels, the [mailing lists](https://cloudstack.apache.org/mailing-lists.html) are the most active and the official channels for making decisions about the project itself. Mailing lists: @@ -112,7 +159,7 @@ released version of CloudStack, please report it to `security@apache.org` with details about the vulnerability, how it might be exploited, and any additional information that might be useful. -For more details, please visit our security [page](http://cloudstack.apache.org/security.html). +For more details, please visit our security [page](https://cloudstack.apache.org/security.html). ## License @@ -156,7 +203,15 @@ Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Sec The following provides more details on the included cryptographic software: * CloudStack makes use of JaSypt cryptographic libraries. -* CloudStack has a system requirement of MySQL, and uses native database encryption functionality. +* CloudStack requires a MySQL-compatible database (MariaDB or MySQL), and uses native database encryption functionality. * CloudStack makes use of the Bouncy Castle general-purpose encryption library. * CloudStack can optionally interact with and control OpenSwan-based VPNs. * CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation. + +## Star History + +[![Apache CloudStack Star History](https://api.star-history.com/svg?repos=apache/cloudstack&type=Date)](https://www.star-history.com/#apache/cloudstack&Date) + +## Contributors + +[![Apache CloudStack Contributors](https://contrib.rocks/image?repo=apache/cloudstack&anon=0&max=500)](https://github.com/apache/cloudstack/graphs/contributors) diff --git a/agent/bindir/cloud-setup-agent.in b/agent/bindir/cloud-setup-agent.in index 18de64089ed0..dc4582540df9 100755 --- a/agent/bindir/cloud-setup-agent.in +++ b/agent/bindir/cloud-setup-agent.in @@ -20,9 +20,22 @@ import os import logging import sys import socket + +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from cloudutils.cloudException import CloudRuntimeException, CloudInternalException from cloudutils.utilities import initLoging, bash -from cloudutils.configFileOps import configFileOps +from cloudutils.configFileOps import configFileOps from cloudutils.globalEnv import globalEnv from cloudutils.networkConfig import networkConfig from cloudutils.syscfg import sysConfigFactory @@ -30,35 +43,41 @@ from cloudutils.serviceConfig import configureLibvirtConfig, configure_libvirt_t from optparse import OptionParser + def getUserInputs(): print("Welcome to the CloudStack Agent Setup:") cfo = configFileOps("@AGENTSYSCONFDIR@/agent.properties") oldMgt = cfo.getEntry("host") - mgtSvr = input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt) + mgtSvr = input( + "Please input the Management Server Hostname/IP-Address:[%s]" % oldMgt + ) if mgtSvr == "": mgtSvr = oldMgt try: socket.getaddrinfo(mgtSvr, 443) except: - print("Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr) + print( + "Failed to resolve %s. Please input a valid hostname or IP-Address." + % mgtSvr + ) exit(1) oldToken = cfo.getEntry("zone") - zoneToken = input("Please input the Zone Id:[%s]"%oldToken) + zoneToken = input("Please input the Zone Id:[%s]" % oldToken) if zoneToken == "": zoneToken = oldToken oldPod = cfo.getEntry("pod") - podId = input("Please input the Pod Id:[%s]"%oldPod) + podId = input("Please input the Pod Id:[%s]" % oldPod) if podId == "": - podId = oldToken + podId = oldToken oldCluster = cfo.getEntry("cluster") - clusterId = input("Please input the Cluster Id:[%s]"%oldCluster) + clusterId = input("Please input the Cluster Id:[%s]" % oldCluster) if clusterId == "": clusterId = oldCluster @@ -66,18 +85,20 @@ def getUserInputs(): if oldHypervisor == "": oldHypervisor = "kvm" - hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor) + hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]" % oldHypervisor) if hypervisor == "": hypervisor = oldHypervisor try: defaultNic = networkConfig.getDefaultNetwork() except: - print("Failed to get default route. Please configure your network to have a default route") + print( + "Failed to get default route. Please configure your network to have a default route" + ) exit(1) defNic = defaultNic.name - network = input("Please choose which network used to create VM:[%s]"%defNic) + network = input("Please choose which network used to create VM:[%s]" % defNic) if network == "": if defNic == "": print("You need to specify one of Nic or bridge on your system") @@ -87,7 +108,8 @@ def getUserInputs(): return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor] -if __name__ == '__main__': + +if __name__ == "__main__": initLoging("@AGENTLOGDIR@/setup.log") glbEnv = globalEnv() @@ -95,13 +117,23 @@ if __name__ == '__main__': glbEnv.agentMode = "Agent" parser = OptionParser() parser.add_option("-a", action="store_true", dest="auto", help="auto mode") - parser.add_option("-m", "--host", dest="mgt", help="Management server hostname or IP-Address") + parser.add_option( + "-m", "--host", dest="mgt", help="Management server hostname or IP-Address" + ) parser.add_option("-z", "--zone", dest="zone", help="zone id") parser.add_option("-p", "--pod", dest="pod", help="pod id") parser.add_option("-c", "--cluster", dest="cluster", help="cluster id") - parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type") + parser.add_option( + "-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type" + ) parser.add_option("-g", "--guid", dest="guid", help="guid") - parser.add_option("-s", action="store_true", default=False, dest="secure", help="Secure and enable TLS for libvirtd") + parser.add_option( + "-s", + action="store_true", + default=False, + dest="secure", + help="Secure and enable TLS for libvirtd", + ) parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface") parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface") parser.add_option("--guestNic", dest="guestNic", help="Guest traffic interface") @@ -127,15 +159,15 @@ if __name__ == '__main__': glbEnv.pod = userInputs[3] glbEnv.cluster = userInputs[4] glbEnv.hypervisor = userInputs[5] - #generate UUID + # generate UUID glbEnv.uuid = old_config.getEntry("guid") if glbEnv.uuid == "": glbEnv.uuid = bash("uuidgen").getStdout() else: for para, value in list(options.__dict__.items()): if value is None: - print("Missing operand:%s"%para) - print("Try %s --help for more information"%sys.argv[0]) + print("Missing operand:%s" % para) + print("Try %s --help for more information" % sys.argv[0]) sys.exit(1) glbEnv.uuid = options.guid @@ -155,7 +187,7 @@ if __name__ == '__main__': try: syscfg.config() print("CloudStack Agent setup is done!") - except (CloudRuntimeException,CloudInternalException) as e: + except (CloudRuntimeException, CloudInternalException) as e: print(e) print("Try to restore your system:") try: diff --git a/agent/bindir/libvirtqemuhook.in b/agent/bindir/libvirtqemuhook.in index e17944d83537..4cc6ed7a1d28 100755 --- a/agent/bindir/libvirtqemuhook.in +++ b/agent/bindir/libvirtqemuhook.in @@ -20,6 +20,19 @@ import sys import os import subprocess from threading import Timer + +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from xml.dom.minidom import parse from cloudutils.configFileOps import configFileOps from cloudutils.networkConfig import networkConfig diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index bff7078fd9f9..0a459d8d4fc5 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -78,6 +78,14 @@ zone=default # Generated with "uuidgen". local.storage.uuid= +# Enable TLS for image server transfers. The keys are read from: +# cert file = /etc/cloudstack/agent/cloud.crt +# key file = /etc/cloudstack/agent/cloud.key +image.server.tls.enabled=true + +# The Address for the network interface that the image server listens on. If not specified, it will listen on the Management network. +#image.server.listen.address= + # Location for KVM virtual router scripts. # The path defined in this property is relative to the directory "/usr/share/cloudstack-common/". domr.scripts.dir=scripts/network/domr/kvm @@ -213,8 +221,9 @@ hypervisor.type=kvm # If null (default), defaults to the VM's OS architecture #guest.cpu.arch= -# This param will require CPU features on the CPU section. -# The features listed in this property must be separated by a blank space (e.g.: vmx vme) +# Specifies required CPU features for end-user and system VMs. +# These features must be present on the host CPU for VM deployment. +# Multiple features should be separated by whitespace (e.g.: vmx vme). #guest.cpu.features= # Disables memory ballooning on VM guests for overcommit. @@ -441,3 +450,33 @@ iscsi.session.cleanup.enabled=false # Wait(in seconds) during agent reconnections. When no value is set then default value of 5s will be used #backoff.seconds= + +# Timeout (in seconds) to wait for the snapshot reversion to complete. +# revert.snapshot.timeout=10800 + +# Timeout (in seconds) to wait for the incremental snapshot to complete. +# incremental.snapshot.timeout=10800 + +# If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise. +# create.full.clone=false + +# Instance conversion TMPDIR env var +#convert.instance.env.tmpdir= + +# Instance conversion VIRT_V2V_TMPDIR env var +#convert.instance.env.virtv2v.tmpdir= + +# Time, in seconds, to wait before retrying to rebase during the incremental snapshot process. +# incremental.snapshot.retry.rebase.wait=60 + +# Path to the VDDK library directory for VMware to KVM conversion via VDDK, +# passed to virt-v2v as -io vddk-libdir= +#vddk.lib.dir= + +# Ordered VDDK transport preference for VMware to KVM conversion via VDDK, passed as +# -io vddk-transports= to virt-v2v. Example: nbd:nbdssl +#vddk.transports= + +# Optional vCenter SHA1 thumbprint for VMware to KVM conversion via VDDK, passed as +# -io vddk-thumbprint=. If unset, CloudStack computes it on the KVM host via openssl. +#vddk.thumbprint= diff --git a/agent/conf/developer.properties.template b/agent/conf/developer.properties.template index a70a136f38cd..02f51aa6bb85 100644 --- a/agent/conf/developer.properties.template +++ b/agent/conf/developer.properties.template @@ -5,9 +5,9 @@ # to you 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 diff --git a/plugins/host-allocators/random/src/main/resources/META-INF/cloudstack/host-allocator-random/module.properties b/agent/conf/uefi.properties.in similarity index 75% rename from plugins/host-allocators/random/src/main/resources/META-INF/cloudstack/host-allocator-random/module.properties rename to agent/conf/uefi.properties.in index dcfe8d3537ff..3c8866f634bc 100644 --- a/plugins/host-allocators/random/src/main/resources/META-INF/cloudstack/host-allocator-random/module.properties +++ b/agent/conf/uefi.properties.in @@ -14,5 +14,11 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -name=host-allocator-random -parent=allocator + +# Configuration file for UEFI + +guest.nvram.template.legacy=@GUESTNVRAMTEMPLATELEGACY@ +guest.loader.legacy=@GUESTLOADERLEGACY@ +guest.nvram.template.secure=@GUESTNVRAMTEMPLATESECURE@ +guest.loader.secure=@GUESTLOADERSECURE@ +guest.nvram.path=@GUESTNVRAMPATH@ diff --git a/agent/pom.xml b/agent/pom.xml index 76c37cd87be3..5ab6cfe17c13 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT diff --git a/agent/src/main/java/com/cloud/agent/Agent.java b/agent/src/main/java/com/cloud/agent/Agent.java index ad480fef4e51..275fd41edc34 100644 --- a/agent/src/main/java/com/cloud/agent/Agent.java +++ b/agent/src/main/java/com/cloud/agent/Agent.java @@ -97,7 +97,6 @@ import com.cloud.utils.nio.NioClient; import com.cloud.utils.nio.NioConnection; import com.cloud.utils.nio.Task; -import com.cloud.utils.script.OutputInterpreter; import com.cloud.utils.script.Script; /** @@ -453,22 +452,30 @@ private void scheduleCertificateRenewalTask() { certExecutor.schedule(new PostCertificateRenewalTask(this), 5, TimeUnit.SECONDS); } - private void scheduleHostLBCheckerTask(final long checkInterval) { + private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long checkInterval) { String name = "HostLBCheckerTask"; if (hostLbCheckExecutor != null && !hostLbCheckExecutor.isShutdown()) { + logger.info("Shutting down the preferred host checker task {}", name); hostLbCheckExecutor.shutdown(); try { if (!hostLbCheckExecutor.awaitTermination(1, TimeUnit.SECONDS)) { hostLbCheckExecutor.shutdownNow(); } } catch (InterruptedException e) { - logger.debug("Forcing {} shutdown as it did not shutdown in the desired time due to: {}", + logger.debug("Forcing the preferred host checker task {} shutdown as it did not shutdown in the desired time due to: {}", name, e.getMessage()); hostLbCheckExecutor.shutdownNow(); } } if (checkInterval > 0L) { - logger.info("Scheduling preferred host task with host.lb.interval={}ms", checkInterval); + if ("shuffle".equalsIgnoreCase(lbAlgorithm)) { + logger.info("Scheduling the preferred host checker task to trigger once (to apply lb algorithm '{}') after host.lb.interval={} ms", lbAlgorithm, checkInterval); + hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name))); + hostLbCheckExecutor.schedule(new PreferredHostCheckerTask(), checkInterval, TimeUnit.MILLISECONDS); + return; + } + + logger.info("Scheduling a recurring preferred host checker task with host.lb.interval={} ms", checkInterval); hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name))); hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval, TimeUnit.MILLISECONDS); @@ -606,9 +613,9 @@ protected void setupStartupCommand(final StartupCommand startup) { } protected String getAgentArch() { - final Script command = new Script("/usr/bin/arch", 500, logger); - final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); - return command.execute(parser); + String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 2000); + logger.debug("Arch for agent: {} found: {}", _name, arch); + return arch; } @Override @@ -800,6 +807,9 @@ protected void processRequest(final Request request, final Link link) { } commandsInProgress.incrementAndGet(); try { + if (cmd.isReconcile()) { + cmd.setRequestSequence(request.getSequence()); + } answer = serverResource.executeRequest(cmd); } finally { commandsInProgress.decrementAndGet(); @@ -925,7 +935,7 @@ private Answer setupAgentCertificate(final SetupCertificateCommand cmd) { return new SetupCertificateAnswer(true); } - private void processManagementServerList(final List msList, final List avoidMsList, final String lbAlgorithm, final Long lbCheckInterval) { + private void processManagementServerList(final List msList, final List avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final boolean triggerHostLB) { if (CollectionUtils.isNotEmpty(msList) && StringUtils.isNotEmpty(lbAlgorithm)) { try { final String newMSHosts = String.format("%s%s%s", com.cloud.utils.StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm); @@ -938,26 +948,30 @@ private void processManagementServerList(final List msList, final List { + ScheduledExecutorService migrateAgentConnectionService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job")); + migrateAgentConnectionService.schedule(() -> { migrateAgentConnection(cmd.getAvoidMsList()); }, 3, TimeUnit.SECONDS); + migrateAgentConnectionService.shutdown(); } catch (Exception e) { String errMsg = "Migrate agent connection failed, due to " + e.getMessage(); logger.debug(errMsg, e); @@ -1021,6 +1035,8 @@ private void processPingAnswer(final PingAnswer answer) { if ((answer.isSendStartup()) && reconnectAllowed) { logger.info("Management server requested startup command to reinitialize the agent"); sendStartup(link); + } else { + serverResource.processPingAnswer((PingAnswer) answer); } shell.setAvoidHosts(answer.getAvoidMsList()); } @@ -1041,7 +1057,7 @@ public void processReadyCommand(final Command cmd) { } verifyAgentArch(ready.getArch()); - processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval()); + processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval(), false); logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName()); } @@ -1087,6 +1103,9 @@ public void processOtherTask(final Task task) { Answer answer = null; commandsInProgress.incrementAndGet(); try { + if (command.isReconcile()) { + command.setRequestSequence(req.getSequence()); + } answer = serverResource.executeRequest(command); } finally { commandsInProgress.decrementAndGet(); @@ -1303,7 +1322,6 @@ public void doTask(final Task task) throws TaskExecutionException { processResponse((Response)request, task.getLink()); } else { //put the requests from mgt server into another thread pool, as the request may take a longer time to finish. Don't block the NIO main thread pool - //processRequest(request, task.getLink()); requestHandler.submit(new AgentRequestHandler(getType(), getLink(), request)); } } catch (final ClassNotFoundException e) { @@ -1313,13 +1331,14 @@ public void doTask(final Task task) throws TaskExecutionException { } } else if (task.getType() == Task.Type.DISCONNECT) { try { - // an issue has been found if reconnect immediately after disconnecting. please refer to https://github.com/apache/cloudstack/issues/8517 + // an issue has been found if reconnect immediately after disconnecting. // wait 5 seconds before reconnecting + logger.debug("Wait for 5 secs before reconnecting, disconnect task - {}", () -> getLinkLog(task.getLink())); Thread.sleep(5000); } catch (InterruptedException e) { } shell.setConnectionTransfer(false); - logger.debug("Executing disconnect task - {}", () -> getLinkLog(task.getLink())); + logger.debug("Executing disconnect task - {} and reconnecting", () -> getLinkLog(task.getLink())); reconnect(task.getLink()); } else if (task.getType() == Task.Type.OTHER) { processOtherTask(task); diff --git a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java index feb1845d84b2..18a6b6df1006 100644 --- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java +++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java @@ -117,12 +117,26 @@ public class AgentProperties{ /** * Local storage path.
- * This property allows multiple values to be entered in a single String. The differente values must be separated by commas.
+ * This property allows multiple values to be entered in a single String. The different values must be separated by commas.
* Data type: String.
* Default value: /var/lib/libvirt/images/ */ public static final Property LOCAL_STORAGE_PATH = new Property<>("local.storage.path", "/var/lib/libvirt/images/"); + /** + * Enables TLS on the KVM image server transfer endpoint.
+ * Data type: Boolean.
+ * Default value: true + */ + public static final Property IMAGE_SERVER_TLS_ENABLED = new Property<>("image.server.tls.enabled", true); + + /** + * The IP address that the KVM image server listens on.
+ * Data type: String.
+ * Default value: null + */ + public static final Property IMAGE_SERVER_LISTEN_ADDRESS = new Property<>("image.server.listen.address", null, String.class); + /** * Directory where Qemu sockets are placed.
* These sockets are for the Qemu Guest Agent and SSVM provisioning.
@@ -134,7 +148,7 @@ public class AgentProperties{ /** * MANDATORY: The UUID for the local storage pool.
- * This property allows multiple values to be entered in a single String. The differente values must be separated by commas.
+ * This property allows multiple values to be entered in a single String. The different values must be separated by commas.
* Data type: String.
* Default value: null */ @@ -155,6 +169,14 @@ public class AgentProperties{ */ public static final Property CMDS_TIMEOUT = new Property<>("cmds.timeout", 7200); + /** + * The timeout (in seconds) for the snapshot merge operation, mainly used for classic volume snapshots and disk-only VM snapshots on file-based storage.
+ * This configuration is only considered if libvirt.events.enabled is also true.
+ * Data type: Integer.
+ * Default value: 259200 + */ + public static final Property QCOW2_DELTA_MERGE_TIMEOUT = new Property<>("qcow2.delta.merge.timeout", 60 * 60 * 72); + /** * This parameter sets the VM migration speed (in mbps). The default value is -1,
* which means that the agent will try to guess the speed of the guest network and consume all possible bandwidth.
@@ -213,6 +235,15 @@ public class AgentProperties{ */ public static final Property AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.script", "libvirt-vm-xml-transformer.groovy"); + /** + * This property is used with the agent.hooks.basedir property to define the Libvirt VM XML transformer shell script.
+ * The shell script is used to execute the Libvirt VM XML transformer script.
+ * For more information see the agent.properties file.
+ * Data type: String.
+ * Default value: libvirt-vm-xml-transformer.sh + */ + public static final Property AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.shell_script", "libvirt-vm-xml-transformer.sh"); + /** * This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_xml_transformer.script properties to define the Libvirt VM XML transformer method.
* Libvirt XML transformer hook does XML-to-XML transformation.
@@ -233,6 +264,15 @@ public class AgentProperties{ */ public static final Property AGENT_HOOKS_LIBVIRT_VM_ON_START_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.script", "libvirt-vm-state-change.groovy"); + /** + * This property is used with the agent.hooks.basedir property to define the Libvirt VM on start shell script.
+ * The shell script is used to execute the Libvirt VM on start script.
+ * For more information see the agent.properties file.
+ * Data type: String.
+ * Default value: libvirt-vm-state-change.sh + */ + public static final Property AGENT_HOOKS_LIBVIRT_VM_ON_START_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.shell_script", "libvirt-vm-state-change.sh"); + /** * This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_start.script properties to define the Libvirt VM on start method.
* The hook is called right after Libvirt successfully launched the VM.
@@ -252,6 +292,15 @@ public class AgentProperties{ */ public static final Property AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.script", "libvirt-vm-state-change.groovy"); + /** + * This property is used with the agent.hooks.basedir property to define the Libvirt VM on stop shell script.
+ * The shell script is used to execute the Libvirt VM on stop script.
+ * For more information see the agent.properties file.
+ * Data type: String.
+ * Default value: libvirt-vm-state-change.sh + */ + public static final Property AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.shell_script", "libvirt-vm-state-change.sh"); + /** * This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_stop.script properties to define the Libvirt VM on stop method.
* The hook is called right after libvirt successfully stopped the VM.
@@ -390,8 +439,9 @@ public class AgentProperties{ public static final Property GUEST_CPU_ARCH = new Property<>("guest.cpu.arch", null, String.class); /** - * This param will require CPU features on the CPU section.
- * The features listed in this property must be separated by a blank space (see example below).
+ * Specifies required CPU features for end-user and system VMs.
+ * These features must be present on the host CPU for VM deployment.
+ * Multiple features should be separated by whitespace (see example below).
* Possible values: vmx vme
* Data type: String.
* Default value: null @@ -758,6 +808,44 @@ public Property getWorkers() { */ public static final Property VIRTV2V_VERBOSE_ENABLED = new Property<>("virtv2v.verbose.enabled", false); + /** + * Set env TMPDIR var for virt-v2v Instance Conversion from VMware to KVM + * Data type: String.
+ * Default value: null + */ + public static final Property CONVERT_ENV_TMPDIR = new Property<>("convert.instance.env.tmpdir", null, String.class); + + /** + * Set env VIRT_V2V_TMPDIR var for virt-v2v Instance Conversion from VMware to KVM + * Data type: String.
+ * Default value: null + */ + public static final Property CONVERT_ENV_VIRTV2V_TMPDIR = new Property<>("convert.instance.env.virtv2v.tmpdir", null, String.class); + + /** + * Path to the VDDK library directory on the KVM conversion host, used when converting VMs from VMware to KVM via VDDK. + * This directory is passed to virt-v2v as -io vddk-libdir=<path>. + * Data type: String.
+ * Default value: null + */ + public static final Property VDDK_LIB_DIR = new Property<>("vddk.lib.dir", null, String.class); + + /** + * Ordered list of VDDK transports for virt-v2v, passed as -io vddk-transports=<value>. + * Example: nbd:nbdssl. + * Data type: String.
+ * Default value: null + */ + public static final Property VDDK_TRANSPORTS = new Property<>("vddk.transports", null, String.class); + + /** + * vCenter TLS certificate thumbprint used by virt-v2v VDDK mode, passed as -io vddk-thumbprint=<value>. + * If unset, the KVM host computes it at runtime from the vCenter endpoint. + * Data type: String.
+ * Default value: null + */ + public static final Property VDDK_THUMBPRINT = new Property<>("vddk.thumbprint", null, String.class); + /** * BGP controll CIDR * Data type: String.
@@ -818,12 +906,35 @@ public Property getWorkers() { */ public static final Property SSL_HANDSHAKE_TIMEOUT = new Property<>("ssl.handshake.timeout", 30, Integer.class); + /** + * Timeout (in seconds) to wait for the incremental snapshot to complete. + * */ + public static final Property INCREMENTAL_SNAPSHOT_TIMEOUT = new Property<>("incremental.snapshot.timeout", 10800); + + /** + * Timeout (in seconds) to wait for the snapshot reversion to complete. + * */ + public static final Property REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800); + + /** + * If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise.
+ * Data type: Boolean.
+ * Default value: false + */ + public static final Property CREATE_FULL_CLONE = new Property<>("create.full.clone", false); + + /** + * Time, in seconds, to wait before retrying to rebase during the incremental snapshot process. + * */ + public static final Property INCREMENTAL_SNAPSHOT_RETRY_REBASE_WAIT = new Property<>("incremental.snapshot.retry.rebase.wait", 60); + + public static class Property { private String name; private T defaultValue; private Class typeClass; - Property(String name, T value) { + public Property(String name, T value) { init(name, value); } diff --git a/agent/src/main/java/com/cloud/agent/resource/DummyResource.java b/agent/src/main/java/com/cloud/agent/resource/DummyResource.java index fe519ca9497f..4002e53b5858 100644 --- a/agent/src/main/java/com/cloud/agent/resource/DummyResource.java +++ b/agent/src/main/java/com/cloud/agent/resource/DummyResource.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import com.cloud.agent.IAgentControl; import com.cloud.agent.api.Answer; @@ -40,6 +39,7 @@ import com.cloud.storage.Storage; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.StringUtils; +import com.cloud.utils.UuidUtils; public class DummyResource implements ServerResource { String _name; @@ -133,7 +133,7 @@ protected StoragePoolInfo initializeLocalStorage() { String hostIp = getConfiguredProperty("private.ip.address", "127.0.0.1"); String localStoragePath = getConfiguredProperty("local.storage.path", "/mnt"); String lh = hostIp + localStoragePath; - String uuid = UUID.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString(); + String uuid = UuidUtils.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString(); String capacity = getConfiguredProperty("local.storage.capacity", "1000000000"); String available = getConfiguredProperty("local.storage.avail", "10000000"); diff --git a/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java index 26f9d4b3d732..ef98fa532ecb 100644 --- a/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java +++ b/agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java @@ -175,12 +175,12 @@ private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fin try { is.close(); } catch (final IOException e) { - logger.warn("Exception when closing , console proxy address : {}", proxyManagementIp); + logger.warn("Exception when closing , console proxy address: {}", proxyManagementIp); success = false; } } } catch (final IOException e) { - logger.warn("Unable to open console proxy command port url, console proxy address : {}", proxyManagementIp); + logger.warn("Unable to open console proxy command port url, console proxy address: {}", proxyManagementIp); success = false; } @@ -331,7 +331,7 @@ private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, fi final Object resource = this; logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy"); if (consoleProxyMain == null) { - logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", encryptorPassword); + logger.info("Running com.cloud.consoleproxy.ConsoleProxy"); consoleProxyMain = new Thread(new ManagedContextRunnable() { @Override protected void runInContext() { diff --git a/api/pom.xml b/api/pom.xml index ec68e24c7e59..c80c35593451 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT diff --git a/api/src/main/java/com/cloud/agent/api/Command.java b/api/src/main/java/com/cloud/agent/api/Command.java index eb979c0060b9..c4e99cb41707 100644 --- a/api/src/main/java/com/cloud/agent/api/Command.java +++ b/api/src/main/java/com/cloud/agent/api/Command.java @@ -19,9 +19,10 @@ import java.util.HashMap; import java.util.Map; -import com.cloud.agent.api.LogLevel.Log4jLevel; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.cloud.agent.api.LogLevel.Log4jLevel; /** * implemented by classes that extends the Command class. Command specifies @@ -35,6 +36,23 @@ public static enum OnError { Continue, Stop } + public enum State { + CREATED, // Command is created by management server + STARTED, // Command is started by agent + PROCESSING, // Processing by agent + PROCESSING_IN_BACKEND, // Processing in backend by agent + COMPLETED, // Operation succeeds by agent or management server + FAILED, // Operation fails by agent + RECONCILE_RETRY, // Ready for retry of reconciliation + RECONCILING, // Being reconciled by management server + RECONCILED, // Reconciled by management server + RECONCILE_SKIPPED, // Skip the reconciliation as the resource state is inconsistent with the command + RECONCILE_FAILED, // Fail to reconcile by management server + TIMED_OUT, // Timed out on management server or agent + INTERRUPTED, // Interrupted by management server or agent (for example agent is restarted), + DANGLED_IN_BACKEND // Backend process which cannot be processed normally (for example agent is restarted) + } + public static final String HYPERVISOR_TYPE = "hypervisorType"; // allow command to carry over hypervisor or other environment related context info @@ -42,6 +60,8 @@ public static enum OnError { protected Map contextMap = new HashMap(); private int wait; //in second private boolean bypassHostMaintenance = false; + private transient long requestSequence = 0L; + protected Map> externalDetails; protected Command() { this.wait = 0; @@ -82,6 +102,10 @@ public String getContextParam(String name) { return contextMap.get(name); } + public Map getContextMap() { + return contextMap; + } + public boolean allowCaching() { return true; } @@ -94,6 +118,26 @@ public void setBypassHostMaintenance(boolean bypassHostMaintenance) { this.bypassHostMaintenance = bypassHostMaintenance; } + public boolean isReconcile() { + return false; + } + + public long getRequestSequence() { + return requestSequence; + } + + public void setRequestSequence(long requestSequence) { + this.requestSequence = requestSequence; + } + + public void setExternalDetails(Map> externalDetails) { + this.externalDetails = externalDetails; + } + + public Map> getExternalDetails() { + return externalDetails; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java b/api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java index 85ffc1898209..5515a9c48bcb 100644 --- a/api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java +++ b/api/src/main/java/com/cloud/agent/api/VgpuTypesInfo.java @@ -15,10 +15,24 @@ // specific language governing permissions and limitations // under the License. package com.cloud.agent.api; + +import org.apache.cloudstack.gpu.GpuDevice; + public class VgpuTypesInfo { + private boolean passthroughEnabled = true; + private GpuDevice.DeviceType deviceType; + private String parentBusAddress; + private String busAddress; + private String numaNode; + private String pciRoot; + private String deviceId; + private String deviceName; + private String vendorId; + private String vendorName; private String modelName; private String groupName; + private String vmName; private Long maxHeads; private Long videoRam; private Long maxResolutionX; @@ -26,6 +40,7 @@ public class VgpuTypesInfo { private Long maxVgpuPerGpu; private Long remainingCapacity; private Long maxCapacity; + private boolean display = false; public String getModelName() { return modelName; @@ -39,22 +54,42 @@ public Long getVideoRam() { return videoRam; } + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; + } + public Long getMaxHeads() { return maxHeads; } + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; + } + public Long getMaxResolutionX() { return maxResolutionX; } + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + public Long getMaxResolutionY() { return maxResolutionY; } + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } + public Long getMaxVpuPerGpu() { return maxVgpuPerGpu; } + public void setMaxVgpuPerGpu(Long maxVgpuPerGpu) { + this.maxVgpuPerGpu = maxVgpuPerGpu; + } + public Long getRemainingCapacity() { return remainingCapacity; } @@ -71,8 +106,133 @@ public void setMaxVmCapacity(Long maxCapacity) { this.maxCapacity = maxCapacity; } - public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY, Long maxVgpuPerGpu, - Long remainingCapacity, Long maxCapacity) { + public boolean isPassthroughEnabled() { + return passthroughEnabled; + } + + public void setPassthroughEnabled(boolean passthroughEnabled) { + this.passthroughEnabled = passthroughEnabled; + } + + public GpuDevice.DeviceType getDeviceType() { + return deviceType; + } + + public void setDeviceType(GpuDevice.DeviceType deviceType) { + this.deviceType = deviceType; + } + + public String getParentBusAddress() { + return parentBusAddress; + } + + public void setParentBusAddress(String parentBusAddress) { + this.parentBusAddress = parentBusAddress; + } + + public String getBusAddress() { + return busAddress; + } + + public void setBusAddress(String busAddress) { + this.busAddress = busAddress; + } + + public String getNumaNode() { + return numaNode; + } + + public void setNumaNode(String numaNode) { + this.numaNode = numaNode; + } + + public String getPciRoot() { + return pciRoot; + } + + public void setPciRoot(String pciRoot) { + this.pciRoot = pciRoot; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + public boolean isDisplay() { + return display; + } + + public void setDisplay(boolean display) { + this.display = display; + } + + public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress, + String vendorId, String vendorName, String deviceId, String deviceName, String numaNode, String pciRoot + ) { + this.deviceType = deviceType; + this.groupName = groupName; + this.modelName = modelName; + this.busAddress = busAddress; + this.deviceId = deviceId; + this.deviceName = deviceName; + this.vendorId = vendorId; + this.vendorName = vendorName; + this.numaNode = numaNode; + this.pciRoot = pciRoot; + } + + public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress, + String vendorId, String vendorName, String deviceId, String deviceName + ) { + this.deviceType = deviceType; + this.groupName = groupName; + this.modelName = modelName; + this.busAddress = busAddress; + this.deviceId = deviceId; + this.deviceName = deviceName; + this.vendorId = vendorId; + this.vendorName = vendorName; + } + + public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX, + Long maxResolutionY, Long maxVgpuPerGpu, Long remainingCapacity, Long maxCapacity + ) { this.groupName = groupName; this.modelName = modelName; this.videoRam = videoRam; diff --git a/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java b/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java index 6396e3deb723..23167c5c53b0 100644 --- a/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java +++ b/api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java @@ -119,8 +119,7 @@ protected OVFPropertyTO createOVFPropertyFromNode(Node node, int index, String c boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true"); String label = ovfParser.getChildNodeValue(node, "Label"); String description = ovfParser.getChildNodeValue(node, "Description"); - logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category) - + " with key = " + key); + logger.debug("Creating OVF property index {} {} with key = {}", index, (category == null ? "" : " for category " + category), key); return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable, label, description, password, index, category); } @@ -152,7 +151,7 @@ public List getConfigurableOVFPropertiesFromDocument(Document doc if (child.getNodeName().equalsIgnoreCase("Category") || child.getNodeName().endsWith(":Category")) { lastCategoryFound = child.getTextContent(); - logger.info("Category found " + lastCategoryFound); + logger.info("Category found {}", lastCategoryFound); } else if (child.getNodeName().equalsIgnoreCase("Property") || child.getNodeName().endsWith(":Property")) { OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound); @@ -250,13 +249,13 @@ private List matchHardwareItemsToDiskAndFilesInformation(List extractDisksFromOvfDocumentTree(Document doc) { od._controller = getControllerType(items, od._diskId); vd.add(od); } - if (logger.isTraceEnabled()) { - logger.trace(String.format("found %d disk definitions",vd.size())); - } + logger.trace("Found {} disk definitions", vd.size()); return vd; } @@ -366,9 +363,7 @@ protected List extractFilesFromOvfDocumentTree(File ovfFile, Document d vf.add(of); } } - if (logger.isTraceEnabled()) { - logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath())); - } + logger.trace("Found {} file definitions in {}", vf.size(), ovfFile.getPath()); return vf; } @@ -506,7 +501,7 @@ private void writeDocumentToFile(String newOvfFilePath, Document doc) { outfile.write(writer.toString()); outfile.close(); } catch (IOException | TransformerException e) { - logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e); + logger.info("Unexpected exception caught while rewriting OVF: {}", e.getMessage(), e); throw new CloudRuntimeException(e); } } @@ -522,9 +517,7 @@ OVFFile getFileDefinitionFromDiskDefinition(String fileRef, List files) public List getNetPrerequisitesFromDocument(Document doc) throws InternalErrorException { if (doc == null) { - if (logger.isTraceEnabled()) { - logger.trace("no document to parse; returning no prerequisite networks"); - } + logger.trace("No document to parse; returning no prerequisite networks"); return Collections.emptyList(); } @@ -540,9 +533,7 @@ public List getNetPrerequisitesFromDocument(Document doc) throws I private void matchNicsToNets(Map nets, Node systemElement) { final DocumentTraversal traversal = (DocumentTraversal) systemElement; final NodeIterator iterator = traversal.createNodeIterator(systemElement, NodeFilter.SHOW_ELEMENT, null, true); - if (logger.isTraceEnabled()) { - logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size())); - } + logger.trace("Starting out with {} network-prerequisites, parsing hardware", nets.size()); int nicCount = 0; for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) { final Element e = (Element) n; @@ -550,9 +541,7 @@ private void matchNicsToNets(Map nets, Node systemElement) nicCount++; String name = e.getTextContent(); // should be in our nets if(nets.get(name) == null) { - if(logger.isInfoEnabled()) { - logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name)); - } + logger.info("Found a NIC definition without a Network definition by name {}, adding it to the list.", name); nets.put(name, new OVFNetworkTO()); } OVFNetworkTO thisNet = nets.get(name); @@ -561,9 +550,7 @@ private void matchNicsToNets(Map nets, Node systemElement) } } } - if (logger.isTraceEnabled()) { - logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount)); - } + logger.trace("Ending up with {} network-prerequisites, parsed {} nics", nets.size(), nicCount); } /** @@ -585,7 +572,7 @@ private void fillNicPrerequisites(OVFNetworkTO nic, Node parentNode) { int addressOnParent = Integer.parseInt(addressOnParentStr); nic.setAddressOnParent(addressOnParent); } catch (NumberFormatException e) { - logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr); + logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: {}", addressOnParentStr); } boolean automaticAllocation = StringUtils.isNotBlank(automaticAllocationStr) && Boolean.parseBoolean(automaticAllocationStr); @@ -597,7 +584,7 @@ private void fillNicPrerequisites(OVFNetworkTO nic, Node parentNode) { int instanceId = Integer.parseInt(instanceIdStr); nic.setInstanceID(instanceId); } catch (NumberFormatException e) { - logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr); + logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: {}", instanceIdStr); } nic.setResourceSubType(resourceSubType); @@ -630,9 +617,7 @@ private Map getNetworksFromDocumentTree(Document doc) { nets.put(networkName,network); } - if (logger.isTraceEnabled()) { - logger.trace(String.format("found %d networks in template", nets.size())); - } + logger.trace("Found {} Networks in Template", nets.size()); return nets; } @@ -771,7 +756,7 @@ private Long getLongValueFromString(String value) { try { return Long.parseLong(value); } catch (NumberFormatException e) { - logger.debug("Could not parse the value: " + value + ", ignoring it"); + logger.debug("Could not parse the value: {}, ignoring it", value); } } return null; @@ -782,7 +767,7 @@ private Integer getIntValueFromString(String value) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { - logger.debug("Could not parse the value: " + value + ", ignoring it"); + logger.debug("Could not parse the value: {}, ignoring it", value); } } return null; @@ -820,7 +805,7 @@ public List getEulaSectionsFromDocument(Document doc) { try { compressedLicense = compressOVFEula(eulaLicense); } catch (IOException e) { - logger.error("Could not compress the license for info " + eulaInfo); + logger.error("Could not compress the license for info {}", eulaInfo); continue; } OVFEulaSectionTO eula = new OVFEulaSectionTO(eulaInfo, compressedLicense, eulaIndex); diff --git a/api/src/main/java/com/cloud/agent/api/storage/OVFParser.java b/api/src/main/java/com/cloud/agent/api/storage/OVFParser.java index 38f478d63cf8..316ab4ea87b9 100644 --- a/api/src/main/java/com/cloud/agent/api/storage/OVFParser.java +++ b/api/src/main/java/com/cloud/agent/api/storage/OVFParser.java @@ -54,7 +54,7 @@ public OVFParser() { documentBuilderFactory.setNamespaceAware(true); documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { - logger.error("Cannot start the OVF parser: " + e.getMessage(), e); + logger.error("Cannot start the OVF parser: {}", e.getMessage(), e); } } @@ -70,7 +70,7 @@ public Document parseOVFFile(String ovfFilePath) { try { return documentBuilder.parse(new File(ovfFilePath)); } catch (SAXException | IOException e) { - logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e); + logger.error("Error parsing {} {}", ovfFilePath, e.getMessage(), e); return null; } } diff --git a/api/src/main/java/com/cloud/agent/api/to/BucketTO.java b/api/src/main/java/com/cloud/agent/api/to/BucketTO.java index f7e4bfea80fb..fd8237998a74 100644 --- a/api/src/main/java/com/cloud/agent/api/to/BucketTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/BucketTO.java @@ -26,10 +26,13 @@ public final class BucketTO { private String secretKey; + private long accountId; + public BucketTO(Bucket bucket) { this.name = bucket.getName(); this.accessKey = bucket.getAccessKey(); this.secretKey = bucket.getSecretKey(); + this.accountId = bucket.getAccountId(); } public BucketTO(String name) { @@ -47,4 +50,8 @@ public String getAccessKey() { public String getSecretKey() { return this.secretKey; } + + public long getAccountId() { + return this.accountId; + } } diff --git a/api/src/main/java/com/cloud/agent/api/to/DiskTO.java b/api/src/main/java/com/cloud/agent/api/to/DiskTO.java index d22df2df172e..5664de790919 100644 --- a/api/src/main/java/com/cloud/agent/api/to/DiskTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/DiskTO.java @@ -46,7 +46,7 @@ public class DiskTO { private Long diskSeq; private String path; private Volume.Type type; - private Map _details; + private Map details; public DiskTO() { @@ -92,10 +92,10 @@ public void setType(Volume.Type type) { } public void setDetails(Map details) { - _details = details; + this.details = details; } public Map getDetails() { - return _details; + return details; } } diff --git a/api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java b/api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java index 25c75001a3c1..69350815be3a 100644 --- a/api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java @@ -47,7 +47,7 @@ public class FirewallRuleTO implements InternalIdentity { int[] srcPortRange; boolean revoked; boolean alreadyAdded; - private List sourceCidrList; + protected List sourceCidrList; private List destCidrList; FirewallRule.Purpose purpose; private Integer icmpType; diff --git a/api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java b/api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java index 4afe080477b7..6e9cee06dd38 100644 --- a/api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/GPUDeviceTO.java @@ -16,7 +16,9 @@ // under the License. package com.cloud.agent.api.to; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import com.cloud.agent.api.VgpuTypesInfo; @@ -24,9 +26,23 @@ public class GPUDeviceTO { private String gpuGroup; private String vgpuType; + private int gpuCount; private HashMap> groupDetails = new HashMap>(); + private List gpuDevices = new ArrayList<>(); - public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap> groupDetails) { + public GPUDeviceTO(String gpuGroup, String vgpuType, int gpuCount, + HashMap> groupDetails, + List gpuDevices) { + this.gpuGroup = gpuGroup; + this.vgpuType = vgpuType; + this.groupDetails = groupDetails; + this.gpuCount = gpuCount; + this.gpuDevices = gpuDevices; + + } + + public GPUDeviceTO(String gpuGroup, String vgpuType, + HashMap> groupDetails) { this.gpuGroup = gpuGroup; this.vgpuType = vgpuType; this.groupDetails = groupDetails; @@ -48,6 +64,14 @@ public void setVgpuType(String vgpuType) { this.vgpuType = vgpuType; } + public int getGpuCount() { + return gpuCount; + } + + public void setGpuCount(int gpuCount) { + this.gpuCount = gpuCount; + } + public HashMap> getGroupDetails() { return groupDetails; } @@ -56,4 +80,11 @@ public void setGroupDetails(HashMap> grou this.groupDetails = groupDetails; } + public List getGpuDevices() { + return gpuDevices; + } + + public void setGpuDevices(List gpuDevices) { + this.gpuDevices = gpuDevices; + } } diff --git a/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java b/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java index f395f26aeed6..6c4b9e607c51 100644 --- a/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java @@ -71,7 +71,7 @@ public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, S this.destinations = new DestinationTO[destinations.size()]; this.stickinessPolicies = null; this.sslCert = null; - this.lbProtocol = null; + this.lbProtocol = protocol; int i = 0; for (LbDestination destination : destinations) { this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.isRevoked(), false); @@ -205,6 +205,10 @@ public LbSslCert getSslCert() { return this.sslCert; } + public void setLbSslCert(LbSslCert sslCert) { + this.sslCert = sslCert; + } + public String getSrcIpVlan() { return srcIpVlan; } diff --git a/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java b/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java index bd08ce811013..d65ec0e3daad 100644 --- a/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java @@ -36,7 +36,7 @@ public class NetworkTO { protected TrafficType type; protected URI broadcastUri; protected URI isolationUri; - protected boolean isSecurityGroupEnabled; + protected boolean securityGroupEnabled; protected String name; protected String ip6address; protected String ip6gateway; @@ -112,7 +112,7 @@ public String getName() { } public void setSecurityGroupEnabled(boolean enabled) { - this.isSecurityGroupEnabled = enabled; + this.securityGroupEnabled = enabled; } /** @@ -221,7 +221,7 @@ public void setIsolationuri(URI isolationUri) { } public boolean isSecurityGroupEnabled() { - return this.isSecurityGroupEnabled; + return this.securityGroupEnabled; } public void setIp6Dns1(String ip6Dns1) { diff --git a/api/src/main/java/com/cloud/agent/api/to/NicTO.java b/api/src/main/java/com/cloud/agent/api/to/NicTO.java index 573363c04fb1..2ed7d9f9a201 100644 --- a/api/src/main/java/com/cloud/agent/api/to/NicTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/NicTO.java @@ -33,6 +33,7 @@ public class NicTO extends NetworkTO { boolean dpdkEnabled; Integer mtu; Long networkId; + boolean enabled; String networkSegmentName; @@ -86,6 +87,14 @@ public void setUuid(String uuid) { this.nicUuid = uuid; } + public String getNicUuid() { + return nicUuid; + } + + public void setNicUuid(String nicUuid) { + this.nicUuid = nicUuid; + } + @Override public String toString() { return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString(); @@ -146,4 +155,12 @@ public String getNetworkSegmentName() { public void setNetworkSegmentName(String networkSegmentName) { this.networkSegmentName = networkSegmentName; } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } } diff --git a/api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java b/api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java index d43625c09a92..91f337c5f55b 100644 --- a/api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java @@ -21,8 +21,6 @@ import com.cloud.utils.net.NetUtils; import org.apache.commons.lang3.StringUtils; -import java.util.List; - /** * PortForwardingRuleTO specifies one port forwarding rule. * @@ -32,8 +30,6 @@ public class PortForwardingRuleTO extends FirewallRuleTO { String dstIp; int[] dstPortRange; - List sourceCidrList; - protected PortForwardingRuleTO() { super(); } diff --git a/api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java b/api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java index 18737c584b34..7daeb9649177 100644 --- a/api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java @@ -36,13 +36,17 @@ public class RemoteInstanceTO implements Serializable { private String vcenterPassword; private String vcenterHost; private String datacenterName; + private String clusterName; + private String hostName; public RemoteInstanceTO() { } - public RemoteInstanceTO(String instanceName) { + public RemoteInstanceTO(String instanceName, String clusterName, String hostName) { this.hypervisorType = Hypervisor.HypervisorType.VMware; this.instanceName = instanceName; + this.clusterName = clusterName; + this.hostName = hostName; } public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) { @@ -55,6 +59,12 @@ public RemoteInstanceTO(String instanceName, String instancePath, String vcenter this.datacenterName = datacenterName; } + public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName, String clusterName, String hostName) { + this(instanceName, instancePath, vcenterHost, vcenterUsername, vcenterPassword, datacenterName); + this.clusterName = clusterName; + this.hostName = hostName; + } + public Hypervisor.HypervisorType getHypervisorType() { return this.hypervisorType; } @@ -82,4 +92,12 @@ public String getVcenterHost() { public String getDatacenterName() { return datacenterName; } + + public String getClusterName() { + return clusterName; + } + + public String getHostName() { + return hostName; + } } diff --git a/api/src/main/java/com/cloud/agent/api/to/VirtualMachineMetadataTO.java b/api/src/main/java/com/cloud/agent/api/to/VirtualMachineMetadataTO.java new file mode 100644 index 000000000000..5b22afdedd53 --- /dev/null +++ b/api/src/main/java/com/cloud/agent/api/to/VirtualMachineMetadataTO.java @@ -0,0 +1,182 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api.to; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class VirtualMachineMetadataTO { + // VM details + private final String name; + private final String internalName; + private final String displayName; + private final String instanceUuid; + private final Integer cpuCores; + private final Integer memory; + private final Long created; + private final Long started; + + // Owner details + private final String ownerDomainUuid; + private final String ownerDomainName; + private final String ownerAccountUuid; + private final String ownerAccountName; + private final String ownerProjectUuid; + private final String ownerProjectName; + + // Host and service offering + private final String serviceOfferingName; + private final List serviceOfferingHostTags; + + // zone, pod, and cluster details + private final String zoneName; + private final String zoneUuid; + private final String podName; + private final String podUuid; + private final String clusterName; + private final String clusterUuid; + + // resource tags + private final Map resourceTags; + + public VirtualMachineMetadataTO( + String name, String internalName, String displayName, String instanceUuid, Integer cpuCores, Integer memory, Long created, Long started, + String ownerDomainUuid, String ownerDomainName, String ownerAccountUuid, String ownerAccountName, String ownerProjectUuid, String ownerProjectName, + String serviceOfferingName, List serviceOfferingHostTags, + String zoneName, String zoneUuid, String podName, String podUuid, String clusterName, String clusterUuid, Map resourceTags) { + /* + * Something failed in the metadata shall not be a fatal error, the VM can still be started + * Thus, the unknown fields just get an explicit "unknown" value so it can be fixed in case + * there are bugs on some execution paths. + * */ + + this.name = (name != null) ? name : "unknown"; + this.internalName = (internalName != null) ? internalName : "unknown"; + this.displayName = (displayName != null) ? displayName : "unknown"; + this.instanceUuid = (instanceUuid != null) ? instanceUuid : "unknown"; + this.cpuCores = (cpuCores != null) ? cpuCores : -1; + this.memory = (memory != null) ? memory : -1; + this.created = (created != null) ? created : 0; + this.started = (started != null) ? started : 0; + this.ownerDomainUuid = (ownerDomainUuid != null) ? ownerDomainUuid : "unknown"; + this.ownerDomainName = (ownerDomainName != null) ? ownerDomainName : "unknown"; + this.ownerAccountUuid = (ownerAccountUuid != null) ? ownerAccountUuid : "unknown"; + this.ownerAccountName = (ownerAccountName != null) ? ownerAccountName : "unknown"; + this.ownerProjectUuid = (ownerProjectUuid != null) ? ownerProjectUuid : "unknown"; + this.ownerProjectName = (ownerProjectName != null) ? ownerProjectName : "unknown"; + this.serviceOfferingName = (serviceOfferingName != null) ? serviceOfferingName : "unknown"; + this.serviceOfferingHostTags = (serviceOfferingHostTags != null) ? serviceOfferingHostTags : new ArrayList<>(); + this.zoneName = (zoneName != null) ? zoneName : "unknown"; + this.zoneUuid = (zoneUuid != null) ? zoneUuid : "unknown"; + this.podName = (podName != null) ? podName : "unknown"; + this.podUuid = (podUuid != null) ? podUuid : "unknown"; + this.clusterName = (clusterName != null) ? clusterName : "unknown"; + this.clusterUuid = (clusterUuid != null) ? clusterUuid : "unknown"; + + this.resourceTags = (resourceTags != null) ? resourceTags : new HashMap<>(); + } + + public String getName() { + return name; + } + + public String getInternalName() { + return internalName; + } + + public String getDisplayName() { + return displayName; + } + + public String getInstanceUuid() { + return instanceUuid; + } + + public Integer getCpuCores() { + return cpuCores; + } + + public Integer getMemory() { + return memory; + } + + public Long getCreated() { return created; } + + public Long getStarted() { + return started; + } + + public String getOwnerDomainUuid() { + return ownerDomainUuid; + } + + public String getOwnerDomainName() { + return ownerDomainName; + } + + public String getOwnerAccountUuid() { + return ownerAccountUuid; + } + + public String getOwnerAccountName() { + return ownerAccountName; + } + + public String getOwnerProjectUuid() { + return ownerProjectUuid; + } + + public String getOwnerProjectName() { + return ownerProjectName; + } + + public String getserviceOfferingName() { + return serviceOfferingName; + } + + public List getserviceOfferingHostTags() { + return serviceOfferingHostTags; + } + + public String getZoneName() { + return zoneName; + } + + public String getZoneUuid() { + return zoneUuid; + } + + public String getPodName() { + return podName; + } + + public String getPodUuid() { + return podUuid; + } + + public String getClusterName() { + return clusterName; + } + + public String getClusterUuid() { + return clusterUuid; + } + + public Map getResourceTags() { return resourceTags; } +} diff --git a/api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java index 6f24b1cd6ca8..9af6c731fd24 100644 --- a/api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java @@ -19,20 +19,22 @@ import java.util.List; import java.util.Map; import java.util.HashMap; +import java.util.stream.Collectors; import com.cloud.agent.api.LogLevel; import com.cloud.network.element.NetworkElement; import com.cloud.template.VirtualMachineTemplate.BootloaderType; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.VmDetailConstants; public class VirtualMachineTO { private long id; private String name; private BootloaderType bootloader; private VirtualMachine.State state; - Type type; - int cpus; + private Type type; + private int cpus; /** 'speed' is still here since 4.0.X/4.1.X management servers do not support @@ -43,49 +45,52 @@ public class VirtualMachineTO { So this is here for backwards compatibility with 4.0.X/4.1.X management servers and newer agents. */ - Integer speed; - Integer minSpeed; - Integer maxSpeed; - - long minRam; - long maxRam; - String hostName; - String arch; - String os; - String platformEmulator; - String bootArgs; - String[] bootupScripts; - boolean enableHA; - boolean limitCpuUse; - boolean enableDynamicallyScaleVm; + private Integer speed; + private Integer minSpeed; + private Integer maxSpeed; + + private long minRam; + private long maxRam; + private long requestedRam; + private String hostName; + private String arch; + private String os; + private String platformEmulator; + private String bootArgs; + private String[] bootupScripts; + private boolean enableHA; + private boolean limitCpuUse; + private boolean enableDynamicallyScaleVm; @LogLevel(LogLevel.Log4jLevel.Off) - String vncPassword; - String vncAddr; - Map params; - String uuid; - String bootType; - String bootMode; - boolean enterHardwareSetup; - - DiskTO[] disks; - NicTO[] nics; - GPUDeviceTO gpuDevice; - Integer vcpuMaxLimit; - List vmData = null; - - String configDriveLabel = null; - String configDriveIsoRootFolder = null; - String configDriveIsoFile = null; - NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY; - - Double cpuQuotaPercentage = null; - - Map guestOsDetails = new HashMap(); - Map extraConfig = new HashMap<>(); - Map networkIdToNetworkNameMap = new HashMap<>(); - DeployAsIsInfoTO deployAsIsInfo; - String metadataManufacturer; - String metadataProductName; + private String vncPassword; + private String vncAddr; + private Map details; + private Map params; + private String uuid; + private String bootType; + private String bootMode; + private boolean enterHardwareSetup; + + private DiskTO[] disks; + private NicTO[] nics; + private GPUDeviceTO gpuDevice; + private Integer vcpuMaxLimit; + private List vmData = null; + + private String configDriveLabel = null; + private String configDriveIsoRootFolder = null; + private String configDriveIsoFile = null; + private NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY; + + private Double cpuQuotaPercentage = null; + + private Map guestOsDetails = new HashMap(); + private Map extraConfig = new HashMap<>(); + private Map networkIdToNetworkNameMap = new HashMap<>(); + private DeployAsIsInfoTO deployAsIsInfo; + private String metadataManufacturer; + private String metadataProductName; + private VirtualMachineMetadataTO metadata; public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) { @@ -191,7 +196,11 @@ public Integer getMaxSpeed() { return maxSpeed; } - public boolean getLimitCpuUse() { + public boolean isEnableHA() { + return enableHA; + } + + public boolean isLimitCpuUse() { return limitCpuUse; } @@ -199,15 +208,20 @@ public long getMinRam() { return minRam; } - public void setRam(long minRam, long maxRam) { + public void setRam(long minRam, long maxRam, long requestedRam) { this.minRam = minRam; this.maxRam = maxRam; + this.requestedRam = requestedRam; } public long getMaxRam() { return maxRam; } + public long getRequestedRam() { + return requestedRam; + } + public String getHostName() { return hostName; } @@ -256,6 +270,10 @@ public void setBootupScripts(String[] bootupScripts) { this.bootupScripts = bootupScripts; } + public void setEnableHA(boolean enableHA) { + this.enableHA = enableHA; + } + public DiskTO[] getDisks() { return disks; } @@ -289,11 +307,11 @@ public void setVncAddr(String vncAddr) { } public Map getDetails() { - return params; + return details; } public void setDetails(Map params) { - this.params = params; + this.details = params; } public String getUuid() { @@ -431,6 +449,42 @@ public void setDeployAsIsInfo(DeployAsIsInfoTO deployAsIsInfo) { this.deployAsIsInfo = deployAsIsInfo; } + public void setSpeed(Integer speed) { + this.speed = speed; + } + + public void setMinSpeed(Integer minSpeed) { + this.minSpeed = minSpeed; + } + + public void setMaxSpeed(Integer maxSpeed) { + this.maxSpeed = maxSpeed; + } + + public void setMinRam(long minRam) { + this.minRam = minRam; + } + + public void setMaxRam(long maxRam) { + this.maxRam = maxRam; + } + + public void setLimitCpuUse(boolean limitCpuUse) { + this.limitCpuUse = limitCpuUse; + } + + public Map getParams() { + return params; + } + + public void setParams(Map params) { + this.params = params; + } + + public void setExtraConfig(Map extraConfig) { + this.extraConfig = extraConfig; + } + public String getMetadataManufacturer() { return metadataManufacturer; } @@ -447,8 +501,28 @@ public void setMetadataProductName(String metadataProductName) { this.metadataProductName = metadataProductName; } + public VirtualMachineMetadataTO getMetadata() { + return metadata; + } + + public void setMetadata(VirtualMachineMetadataTO metadata) { + this.metadata = metadata; + } + @Override public String toString() { return String.format("VM {id: \"%s\", name: \"%s\", uuid: \"%s\", type: \"%s\"}", id, name, uuid, type); } + + public Map getExternalDetails() { + if (details == null) { + return new HashMap<>(); + } + return details.entrySet().stream() + .filter(entry -> entry.getKey().startsWith(VmDetailConstants.EXTERNAL_DETAIL_PREFIX)) + .collect(Collectors.toMap( + entry -> entry.getKey().substring(VmDetailConstants.EXTERNAL_DETAIL_PREFIX.length()), + Map.Entry::getValue + )); + } } diff --git a/api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java b/api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java index 604720aaa290..5d028d31d5b6 100644 --- a/api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java +++ b/api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java @@ -22,19 +22,11 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.host.Host; import com.cloud.host.Host.Type; -import com.cloud.offering.ServiceOffering; import com.cloud.utils.component.Adapter; -import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; public interface HostAllocator extends Adapter { - /** - * @param UserVm vm - * @param ServiceOffering offering - **/ - boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering); - /** * Determines which physical hosts are suitable to * allocate the guest virtual machines on @@ -49,31 +41,6 @@ public interface HostAllocator extends Adapter { public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo); - /** - * Determines which physical hosts are suitable to allocate the guest - * virtual machines on - * - * Allocators must set any other hosts not considered for allocation in the - * ExcludeList avoid. Thus the avoid set and the list of hosts suitable, - * together must cover the entire host set in the cluster. - * - * @param VirtualMachineProfile - * vmProfile - * @param DeploymentPlan - * plan - * @param GuestType - * type - * @param ExcludeList - * avoid - * @param int returnUpTo (use -1 to return all possible hosts) - * @param boolean considerReservedCapacity (default should be true, set to - * false if host capacity calculation should not look at reserved - * capacity) - * @return List List of hosts that are suitable for VM allocation - **/ - - public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity); - /** * Determines which physical hosts are suitable to allocate the guest * virtual machines on diff --git a/api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java index d34c09c94fde..d8aa13710e23 100644 --- a/api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java +++ b/api/src/main/java/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java @@ -35,10 +35,10 @@ public class ListRecurringSnapshotScheduleCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.SNAPSHOT_POLICY_ID, type = CommandType.LONG, description = "lists recurring snapshots by snapshot policy ID") + @Parameter(name = ApiConstants.SNAPSHOT_POLICY_ID, type = CommandType.LONG, description = "Lists recurring Snapshots by Snapshot policy ID") private Long snapshotPolicyId; - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, required = true, description = "list recurring snapshots by volume ID") + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.LONG, required = true, description = "List recurring Snapshots by volume ID") private Long volumeId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/com/cloud/capacity/Capacity.java b/api/src/main/java/com/cloud/capacity/Capacity.java index a4e2c2a7f05d..4e584b18feee 100644 --- a/api/src/main/java/com/cloud/capacity/Capacity.java +++ b/api/src/main/java/com/cloud/capacity/Capacity.java @@ -34,13 +34,17 @@ public interface Capacity extends InternalIdentity, Identity { public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9; public static final short CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = 10; public static final short CAPACITY_TYPE_GPU = 19; + public static final short CAPACITY_TYPE_OBJECT_STORAGE = 20; + public static final short CAPACITY_TYPE_BACKUP_STORAGE = 21; public static final short CAPACITY_TYPE_CPU_CORE = 90; public static final List STORAGE_CAPACITY_TYPES = List.of(CAPACITY_TYPE_STORAGE, CAPACITY_TYPE_STORAGE_ALLOCATED, CAPACITY_TYPE_SECONDARY_STORAGE, - CAPACITY_TYPE_LOCAL_STORAGE); + CAPACITY_TYPE_LOCAL_STORAGE, + CAPACITY_TYPE_BACKUP_STORAGE, + CAPACITY_TYPE_OBJECT_STORAGE); public Long getHostOrPoolId(); diff --git a/api/src/main/java/com/cloud/configuration/ConfigurationService.java b/api/src/main/java/com/cloud/configuration/ConfigurationService.java index 97d4b42974b3..729f72b23ca2 100644 --- a/api/src/main/java/com/cloud/configuration/ConfigurationService.java +++ b/api/src/main/java/com/cloud/configuration/ConfigurationService.java @@ -17,18 +17,25 @@ package com.cloud.configuration; import java.util.List; +import java.util.Map; +import java.util.Objects; +import com.cloud.network.Network; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.command.admin.config.ResetCfgCmd; import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; +import org.apache.cloudstack.api.command.admin.network.CloneNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.network.CreateGuestNetworkIpv6PrefixCmd; import org.apache.cloudstack.api.command.admin.network.CreateManagementNetworkIpRangeCmd; -import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.network.DeleteGuestNetworkIpv6PrefixCmd; import org.apache.cloudstack.api.command.admin.network.DeleteManagementNetworkIpRangeCmd; import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.network.ListGuestNetworkIpv6PrefixesCmd; +import org.apache.cloudstack.api.command.admin.network.NetworkOfferingBaseCmd; import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.network.UpdatePodManagementNetworkIpRangeCmd; +import org.apache.cloudstack.api.command.admin.offering.CloneDiskOfferingCmd; +import org.apache.cloudstack.api.command.admin.offering.CloneServiceOfferingCmd; import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd; import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd; import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd; @@ -101,39 +108,52 @@ public interface ConfigurationService { */ ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd); + /** + * Clones a service offering with optional parameter overrides + * + * @param cmd + * the command object that specifies the source offering ID and optional parameter overrides + * @return the newly created service offering cloned from source, null otherwise + */ + ServiceOffering cloneServiceOffering(CloneServiceOfferingCmd cmd); + + /** + * Clones a disk offering with optional parameter overrides + * + * @param cmd + * the command object that specifies the source offering ID and optional parameter overrides + * @return the newly created disk offering cloned from source, null otherwise + */ + DiskOffering cloneDiskOffering(CloneDiskOfferingCmd cmd); + + /** + * Clones a network offering with optional parameter overrides + * + * @param cmd + * the command object that specifies the source offering ID and optional parameter overrides + * @return the newly created network offering cloned from source, null otherwise + */ + NetworkOffering cloneNetworkOffering(CloneNetworkOfferingCmd cmd); + /** * Updates a service offering * - * @param serviceOfferingId - * @param userId - * @param name - * @param displayText - * @param offerHA - * @param useVirtualNetwork - * @param tags * @return updated service offering */ ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd); /** * Deletes a service offering - * - * @param userId - * @param serviceOfferingId */ boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd); /** * Retrieve ID of domains for a service offering - * - * @param serviceOfferingId */ List getServiceOfferingDomains(Long serviceOfferingId); /** * Retrieve ID of domains for a service offering - * - * @param serviceOfferingId */ List getServiceOfferingZones(Long serviceOfferingId); @@ -143,7 +163,6 @@ public interface ConfigurationService { * @param cmd * - the command specifying diskOfferingId, name, description, tags * @return updated disk offering - * @throws */ DiskOffering updateDiskOffering(UpdateDiskOfferingCmd cmd); @@ -153,34 +172,22 @@ public interface ConfigurationService { * @param cmd * - the command specifying disk offering id * @return true or false - * @throws */ boolean deleteDiskOffering(DeleteDiskOfferingCmd cmd); /** * Creates a new disk offering - * - * @param domainId - * @param name - * @param description - * @param numGibibytes - * @param mirrored - * @param size * @return ID */ DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd); /** * Retrieve ID of domains for a disk offering - * - * @param diskOfferingId */ List getDiskOfferingDomains(Long diskOfferingId); /** * Retrieve ID of domains for a disk offering - * - * @param diskOfferingId */ List getDiskOfferingZones(Long diskOfferingId); @@ -201,11 +208,10 @@ public interface ConfigurationService { * TODO * @param allocationState * TODO + * @param storageAccessGroups * @return the new pod if successful, null otherwise - * @throws - * @throws */ - Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState); + Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List storageAccessGroups); /** * Creates a mutual exclusive IP range in the pod with same gateway, netmask. @@ -223,8 +229,7 @@ public interface ConfigurationService { /** * Updates a mutually exclusive IP range in the pod. * @param cmd - The command specifying pod ID, current Start IP, current End IP, new Start IP, new End IP. - * @throws com.cloud.exception.ConcurrentOperationException - * @return Success + * @throws com.cloud.exception.ConcurrentOperationException when this pod is already being accessed */ void updatePodIpRange(UpdatePodManagementNetworkIpRangeCmd cmd) throws ConcurrentOperationException; @@ -245,9 +250,6 @@ public interface ConfigurationService { /** * Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system. - * - * @param UpdatePodCmd - * api command */ Pod editPod(UpdatePodCmd cmd); @@ -257,17 +259,12 @@ public interface ConfigurationService { * @param cmd * - the command containing podId * @return true or false - * @throws , */ boolean deletePod(DeletePodCmd cmd); /** * Creates a new zone - * - * @param cmd * @return the zone if successful, null otherwise - * @throws - * @throws */ DataCenter createZone(CreateZoneCmd cmd); @@ -290,22 +287,7 @@ public interface ConfigurationService { * Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on * the * virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs - * - * @param userId - * @param vlanType - * - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be - * directly - * attached to UserVMs) - * @param zoneId - * @param accountId - * @param podId - * @param add - * @param vlanId - * @param gateway - * @param startIP - * @param endIP * @throws ResourceAllocationException TODO - * @throws * @return The new Vlan object */ Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, @@ -320,9 +302,6 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera /** * Marks the account with the default zone-id. * - * @param accountName - * @param domainId - * @param defaultZoneId * @return The new account object */ Account markDefaultZone(String accountName, long domainId, long defaultZoneId); @@ -333,7 +312,7 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera boolean releasePublicIpRange(ReleasePublicIpRangeCmd cmd); - NetworkOffering createNetworkOffering(CreateNetworkOfferingCmd cmd); + NetworkOffering createNetworkOffering(NetworkOfferingBaseCmd cmd); NetworkOffering updateNetworkOffering(UpdateNetworkOfferingCmd cmd); @@ -344,14 +323,12 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera /** * Retrieve ID of domains for a network offering * - * @param networkOfferingId */ List getNetworkOfferingDomains(Long networkOfferingId); /** * Retrieve ID of domains for a network offering * - * @param networkOfferingId */ List getNetworkOfferingZones(Long networkOfferingId); @@ -372,4 +349,16 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera List listPortableIps(long id); Boolean isAccountAllowedToCreateOfferingsWithTags(IsAccountAllowedToCreateOfferingsWithTagsCmd cmd); + + public static final Map ProviderDetailKeyMap = Map.of( + Network.Provider.Nsx.getName(), ApiConstants.NSX_DETAIL_KEY, + Network.Provider.Netris.getName(), ApiConstants.NETRIS_DETAIL_KEY + ); + + public static boolean IsIpRangeForProvider(Network.Provider provider) { + if (Objects.isNull(provider)) { + return false; + } + return ProviderDetailKeyMap.containsKey(provider.getName()); + } } diff --git a/api/src/main/java/com/cloud/configuration/Resource.java b/api/src/main/java/com/cloud/configuration/Resource.java index c7bf44de76c6..97be7f9d64c5 100644 --- a/api/src/main/java/com/cloud/configuration/Resource.java +++ b/api/src/main/java/com/cloud/configuration/Resource.java @@ -37,7 +37,8 @@ enum ResourceType { // All storage type resources are allocated_storage and not backup("backup", 12), backup_storage("backup_storage", 13), bucket("bucket", 14), - object_storage("object_storage", 15); + object_storage("object_storage", 15), + gpu("gpu", 16); private String name; private int ordinal; diff --git a/api/src/main/java/com/cloud/cpu/CPU.java b/api/src/main/java/com/cloud/cpu/CPU.java index 4e1b9f5a5011..11b38b73da53 100644 --- a/api/src/main/java/com/cloud/cpu/CPU.java +++ b/api/src/main/java/com/cloud/cpu/CPU.java @@ -16,52 +16,56 @@ // under the License. package com.cloud.cpu; -import com.cloud.utils.exception.CloudRuntimeException; import org.apache.commons.lang3.StringUtils; -import java.util.LinkedHashMap; -import java.util.Map; - public class CPU { + public enum CPUArch { + x86("i686", 32), + amd64("x86_64", 64), + arm64("aarch64", 64), + s390x("s390x", 64); - public static final String archX86Identifier = "i686"; - public static final String archX86_64Identifier = "x86_64"; - public static final String archARM64Identifier = "aarch64"; - - public static class CPUArch { - private static final Map cpuArchMap = new LinkedHashMap<>(); - - public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32); - public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64); - public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64); + private final String type; + private final int bits; - private String type; - private int bits; - - public CPUArch(String type, int bits) { + CPUArch(String type, int bits) { this.type = type; this.bits = bits; - cpuArchMap.put(type, this); + } + + public static CPUArch getDefault() { + return amd64; } public String getType() { - return this.type; + return type; } public int getBits() { - return this.bits; + return bits; } public static CPUArch fromType(String type) { if (StringUtils.isBlank(type)) { - return amd64; + return getDefault(); + } + for (CPUArch arch : values()) { + if (arch.type.equals(type)) { + return arch; + } + } + throw new IllegalArgumentException("Unsupported arch type: " + type); + } + + public static String getTypesAsCSV() { + StringBuilder sb = new StringBuilder(); + for (CPUArch arch : values()) { + sb.append(arch.getType()).append(","); } - switch (type) { - case archX86Identifier: return archX86; - case archX86_64Identifier: return amd64; - case archARM64Identifier: return arm64; - default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type)); + if (sb.length() > 0) { + sb.setLength(sb.length() - 1); } + return sb.toString(); } } } diff --git a/api/src/main/java/com/cloud/dc/Pod.java b/api/src/main/java/com/cloud/dc/Pod.java index 1cbab36f3bd4..17c5b615d4b6 100644 --- a/api/src/main/java/com/cloud/dc/Pod.java +++ b/api/src/main/java/com/cloud/dc/Pod.java @@ -43,4 +43,6 @@ public interface Pod extends InfrastructureEntity, Grouping, Identity, InternalI AllocationState getAllocationState(); boolean getExternalDhcp(); + + String getStorageAccessGroups(); } diff --git a/api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java b/api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java index 2697311d2b94..9471c3d5c84c 100644 --- a/api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java +++ b/api/src/main/java/com/cloud/deploy/DeploymentClusterPlanner.java @@ -62,11 +62,11 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner { "vm.allocation.algorithm", "Advanced", "random", - "Order in which hosts within a cluster will be considered for VM/volume allocation. The value can be 'random', 'firstfit', 'userdispersing', 'userconcentratedpod_random', 'userconcentratedpod_firstfit', or 'firstfitleastconsumed'.", + "Order in which hosts within a cluster will be considered for VM allocation. The value can be 'random', 'firstfit', 'userdispersing', or 'firstfitleastconsumed'.", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, - "random,firstfit,userdispersing,userconcentratedpod_random,userconcentratedpod_firstfit,firstfitleastconsumed"); + "random,firstfit,userdispersing,firstfitleastconsumed"); /** * This is called to determine list of possible clusters where a virtual diff --git a/api/src/main/java/com/cloud/deploy/DeploymentPlanner.java b/api/src/main/java/com/cloud/deploy/DeploymentPlanner.java index 354f9cfaac53..22d796d4a775 100644 --- a/api/src/main/java/com/cloud/deploy/DeploymentPlanner.java +++ b/api/src/main/java/com/cloud/deploy/DeploymentPlanner.java @@ -70,7 +70,7 @@ public interface DeploymentPlanner extends Adapter { boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid); public enum AllocationAlgorithm { - random, firstfit, userdispersing, userconcentratedpod_random, userconcentratedpod_firstfit; + random, firstfit, userdispersing, firstfitleastconsumed; } public enum PlannerResourceUsage { diff --git a/api/src/main/java/com/cloud/event/EventTypes.java b/api/src/main/java/com/cloud/event/EventTypes.java index 815bd2363d5a..42395bf89992 100644 --- a/api/src/main/java/com/cloud/event/EventTypes.java +++ b/api/src/main/java/com/cloud/event/EventTypes.java @@ -27,15 +27,21 @@ import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.backup.BackupRepositoryService; import org.apache.cloudstack.config.Configuration; import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet; +import org.apache.cloudstack.extension.Extension; +import org.apache.cloudstack.extension.ExtensionCustomAction; +import org.apache.cloudstack.gpu.GpuCard; +import org.apache.cloudstack.gpu.GpuDevice; +import org.apache.cloudstack.gpu.VgpuProfile; import org.apache.cloudstack.ha.HAConfig; import org.apache.cloudstack.network.BgpPeer; import org.apache.cloudstack.network.Ipv4GuestSubnetNetworkMap; import org.apache.cloudstack.quota.QuotaTariff; -import org.apache.cloudstack.storage.sharedfs.SharedFS; import org.apache.cloudstack.storage.object.Bucket; import org.apache.cloudstack.storage.object.ObjectStore; +import org.apache.cloudstack.storage.sharedfs.SharedFS; import org.apache.cloudstack.usage.Usage; import org.apache.cloudstack.vm.schedule.VMSchedule; @@ -289,9 +295,12 @@ public class EventTypes { //registering userdata events public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA"; + public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG"; + public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG"; - //register for user API and secret keys + //user API and secret keys public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY"; + public static final String EVENT_DELETE_SECRET_API_KEY = "DELETE.USER.KEY"; public static final String API_KEY_ACCESS_UPDATE = "API.KEY.ACCESS.UPDATE"; // Template Events @@ -366,16 +375,34 @@ public class EventTypes { // Service Offerings public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE"; + public static final String EVENT_SERVICE_OFFERING_CLONE = "SERVICE.OFFERING.CLONE"; public static final String EVENT_SERVICE_OFFERING_EDIT = "SERVICE.OFFERING.EDIT"; public static final String EVENT_SERVICE_OFFERING_DELETE = "SERVICE.OFFERING.DELETE"; // Disk Offerings public static final String EVENT_DISK_OFFERING_CREATE = "DISK.OFFERING.CREATE"; + public static final String EVENT_DISK_OFFERING_CLONE = "DISK.OFFERING.CLONE"; public static final String EVENT_DISK_OFFERING_EDIT = "DISK.OFFERING.EDIT"; public static final String EVENT_DISK_OFFERING_DELETE = "DISK.OFFERING.DELETE"; + // GPU Cards + public static final String EVENT_GPU_CARD_CREATE = "GPU.CARD.CREATE"; + public static final String EVENT_GPU_CARD_EDIT = "GPU.CARD.EDIT"; + public static final String EVENT_GPU_CARD_DELETE = "GPU.CARD.DELETE"; + + // vGPU Profile + public static final String EVENT_VGPU_PROFILE_CREATE = "VGPU.PROFILE.CREATE"; + public static final String EVENT_VGPU_PROFILE_EDIT = "VGPU.PROFILE.EDIT"; + public static final String EVENT_VGPU_PROFILE_DELETE = "VGPU.PROFILE.DELETE"; + + // GPU Devices + public static final String EVENT_GPU_DEVICE_CREATE = "GPU.DEVICE.CREATE"; + public static final String EVENT_GPU_DEVICE_EDIT = "GPU.DEVICE.EDIT"; + public static final String EVENT_GPU_DEVICE_DELETE = "GPU.DEVICE.DELETE"; + // Network offerings public static final String EVENT_NETWORK_OFFERING_CREATE = "NETWORK.OFFERING.CREATE"; + public static final String EVENT_NETWORK_OFFERING_CLONE = "NETWORK.OFFERING.CLONE"; public static final String EVENT_NETWORK_OFFERING_ASSIGN = "NETWORK.OFFERING.ASSIGN"; public static final String EVENT_NETWORK_OFFERING_EDIT = "NETWORK.OFFERING.EDIT"; public static final String EVENT_NETWORK_OFFERING_REMOVE = "NETWORK.OFFERING.REMOVE"; @@ -465,6 +492,7 @@ public class EventTypes { public static final String EVENT_ENABLE_PRIMARY_STORAGE = "ENABLE.PS"; public static final String EVENT_DISABLE_PRIMARY_STORAGE = "DISABLE.PS"; public static final String EVENT_SYNC_STORAGE_POOL = "SYNC.STORAGE.POOL"; + public static final String EVENT_CONFIGURE_STORAGE_ACCESS = "CONFIGURE.STORAGE.ACCESS"; public static final String EVENT_CHANGE_STORAGE_POOL_SCOPE = "CHANGE.STORAGE.POOL.SCOPE"; // VPN @@ -479,6 +507,7 @@ public class EventTypes { public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE = "VPN.S2S.CUSTOMER.GATEWAY.CREATE"; public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE = "VPN.S2S.CUSTOMER.GATEWAY.DELETE"; public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE = "VPN.S2S.CUSTOMER.GATEWAY.UPDATE"; + public static final String EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS = "VPN.S2S.GATEWAY.OBSOLETE.PARAMS"; public static final String EVENT_S2S_VPN_CONNECTION_CREATE = "VPN.S2S.CONNECTION.CREATE"; public static final String EVENT_S2S_VPN_CONNECTION_DELETE = "VPN.S2S.CONNECTION.DELETE"; public static final String EVENT_S2S_VPN_CONNECTION_RESET = "VPN.S2S.CONNECTION.RESET"; @@ -496,6 +525,8 @@ public class EventTypes { public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN"; public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE"; + public static final String EVENT_ZONE_VXLAN_ASSIGN = "ZONE.VXLAN.ASSIGN"; + public static final String EVENT_ZONE_VXLAN_RELEASE = "ZONE.VXLAN.RELEASE"; // Projects public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE"; @@ -556,6 +587,7 @@ public class EventTypes { // Network ACL public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE"; + public static final String EVENT_NETWORK_ACL_IMPORT = "NETWORK.ACL.IMPORT"; public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE"; public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE"; public static final String EVENT_NETWORK_ACL_UPDATE = "NETWORK.ACL.UPDATE"; @@ -570,6 +602,7 @@ public class EventTypes { // VPC offerings public static final String EVENT_VPC_OFFERING_CREATE = "VPC.OFFERING.CREATE"; + public static final String EVENT_VPC_OFFERING_CLONE = "VPC.OFFERING.CLONE"; public static final String EVENT_VPC_OFFERING_UPDATE = "VPC.OFFERING.UPDATE"; public static final String EVENT_VPC_OFFERING_DELETE = "VPC.OFFERING.DELETE"; @@ -602,16 +635,19 @@ public class EventTypes { // Backup and Recovery events public static final String EVENT_VM_BACKUP_IMPORT_OFFERING = "BACKUP.IMPORT.OFFERING"; + public static final String EVENT_VM_BACKUP_OFFERING_CLONE = "BACKUP.OFFERING.CLONE"; public static final String EVENT_VM_BACKUP_OFFERING_ASSIGN = "BACKUP.OFFERING.ASSIGN"; public static final String EVENT_VM_BACKUP_OFFERING_REMOVE = "BACKUP.OFFERING.REMOVE"; public static final String EVENT_VM_BACKUP_CREATE = "BACKUP.CREATE"; public static final String EVENT_VM_BACKUP_RESTORE = "BACKUP.RESTORE"; public static final String EVENT_VM_BACKUP_DELETE = "BACKUP.DELETE"; + public static final String EVENT_VM_BACKUP_OFFERING_REMOVED_AND_BACKUPS_DELETED = "BACKUP.OFFERING.BACKUPS.DEL"; public static final String EVENT_VM_BACKUP_RESTORE_VOLUME_TO_VM = "BACKUP.RESTORE.VOLUME.TO.VM"; public static final String EVENT_VM_BACKUP_SCHEDULE_CONFIGURE = "BACKUP.SCHEDULE.CONFIGURE"; public static final String EVENT_VM_BACKUP_SCHEDULE_DELETE = "BACKUP.SCHEDULE.DELETE"; public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC"; public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT"; + public static final String EVENT_VM_CREATE_FROM_BACKUP = "VM.CREATE.FROM.BACKUP"; // external network device events public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD"; @@ -687,6 +723,9 @@ public class EventTypes { public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE"; //Guest OS related events + public static final String EVENT_GUEST_OS_CATEGORY_ADD = "GUEST.OS.CATEGORY.ADD"; + public static final String EVENT_GUEST_OS_CATEGORY_DELETE = "GUEST.OS.CATEGORY.DELETE"; + public static final String EVENT_GUEST_OS_CATEGORY_UPDATE = "GUEST.OS.CATEGORY.UPDATE"; public static final String EVENT_GUEST_OS_ADD = "GUEST.OS.ADD"; public static final String EVENT_GUEST_OS_REMOVE = "GUEST.OS.REMOVE"; public static final String EVENT_GUEST_OS_UPDATE = "GUEST.OS.UPDATE"; @@ -795,6 +834,37 @@ public class EventTypes { // Resource Limit public static final String EVENT_RESOURCE_LIMIT_UPDATE = "RESOURCE.LIMIT.UPDATE"; + // Management Server + public static final String EVENT_MANAGEMENT_SERVER_REMOVE = "MANAGEMENT.SERVER.REMOVE"; + + // VM Lease + public static final String VM_LEASE_EXPIRED = "VM.LEASE.EXPIRED"; + public static final String VM_LEASE_DISABLED = "VM.LEASE.DISABLED"; + public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED"; + public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING"; + + // GUI Theme + public static final String EVENT_GUI_THEME_CREATE = "GUI.THEME.CREATE"; + public static final String EVENT_GUI_THEME_REMOVE = "GUI.THEME.REMOVE"; + public static final String EVENT_GUI_THEME_UPDATE = "GUI.THEME.UPDATE"; + + // Extension + public static final String EVENT_EXTENSION_CREATE = "EXTENSION.CREATE"; + public static final String EVENT_EXTENSION_UPDATE = "EXTENSION.UPDATE"; + public static final String EVENT_EXTENSION_DELETE = "EXTENSION.DELETE"; + public static final String EVENT_EXTENSION_RESOURCE_REGISTER = "EXTENSION.RESOURCE.REGISTER"; + public static final String EVENT_EXTENSION_RESOURCE_UNREGISTER = "EXTENSION.RESOURCE.UNREGISTER"; + public static final String EVENT_EXTENSION_CUSTOM_ACTION_ADD = "EXTENSION.CUSTOM.ACTION.ADD"; + public static final String EVENT_EXTENSION_CUSTOM_ACTION_UPDATE = "EXTENSION.CUSTOM.ACTION.UPDATE"; + public static final String EVENT_EXTENSION_CUSTOM_ACTION_DELETE = "EXTENSION.CUSTOM.ACTION.DELETE"; + + // Custom Action + public static final String EVENT_CUSTOM_ACTION = "CUSTOM.ACTION"; + + // Backup Repository + public static final String EVENT_BACKUP_REPOSITORY_ADD = "BACKUP.REPOSITORY.ADD"; + public static final String EVENT_BACKUP_REPOSITORY_UPDATE = "BACKUP.REPOSITORY.UPDATE"; + static { // TODO: need a way to force author adding event types to declare the entity details as well, with out braking @@ -981,16 +1051,34 @@ public class EventTypes { // Service Offerings entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class); + entityEventDetails.put(EVENT_SERVICE_OFFERING_CLONE, ServiceOffering.class); entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class); entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class); // Disk Offerings entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class); + entityEventDetails.put(EVENT_DISK_OFFERING_CLONE, DiskOffering.class); entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class); entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class); + // GPU Cards + entityEventDetails.put(EVENT_GPU_CARD_CREATE, GpuCard.class); + entityEventDetails.put(EVENT_GPU_CARD_EDIT, GpuCard.class); + entityEventDetails.put(EVENT_GPU_CARD_DELETE, GpuCard.class); + + // vGPU Profiles + entityEventDetails.put(EVENT_VGPU_PROFILE_CREATE, VgpuProfile.class); + entityEventDetails.put(EVENT_VGPU_PROFILE_EDIT, VgpuProfile.class); + entityEventDetails.put(EVENT_VGPU_PROFILE_DELETE, VgpuProfile.class); + + // GPU Devices + entityEventDetails.put(EVENT_GPU_DEVICE_CREATE, GpuDevice.class); + entityEventDetails.put(EVENT_GPU_DEVICE_EDIT, GpuDevice.class); + entityEventDetails.put(EVENT_GPU_DEVICE_DELETE, GpuDevice.class); + // Network offerings entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class); + entityEventDetails.put(EVENT_NETWORK_OFFERING_CLONE, NetworkOffering.class); entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class); entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class); entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class); @@ -1074,6 +1162,7 @@ public class EventTypes { entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, Site2SiteCustomerGateway.class); entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, Site2SiteCustomerGateway.class); entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, Site2SiteCustomerGateway.class); + entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_OBSOLETE_PARAMS, Site2SiteCustomerGateway.class); entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, Site2SiteVpnConnection.class); entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, Site2SiteVpnConnection.class); entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, Site2SiteVpnConnection.class); @@ -1289,6 +1378,34 @@ public class EventTypes { entityEventDetails.put(EVENT_SHAREDFS_DESTROY, SharedFS.class); entityEventDetails.put(EVENT_SHAREDFS_EXPUNGE, SharedFS.class); entityEventDetails.put(EVENT_SHAREDFS_RECOVER, SharedFS.class); + + // Management Server + entityEventDetails.put(EVENT_MANAGEMENT_SERVER_REMOVE, "ManagementServer"); + + // VM Lease + entityEventDetails.put(VM_LEASE_EXPIRED, VirtualMachine.class); + entityEventDetails.put(VM_LEASE_EXPIRING, VirtualMachine.class); + entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class); + entityEventDetails.put(VM_LEASE_CANCELLED, VirtualMachine.class); + + // GUI theme + entityEventDetails.put(EVENT_GUI_THEME_CREATE, "GuiTheme"); + entityEventDetails.put(EVENT_GUI_THEME_REMOVE, "GuiTheme"); + entityEventDetails.put(EVENT_GUI_THEME_UPDATE, "GuiTheme"); + + // Extension + entityEventDetails.put(EVENT_EXTENSION_CREATE, Extension.class); + entityEventDetails.put(EVENT_EXTENSION_UPDATE, Extension.class); + entityEventDetails.put(EVENT_EXTENSION_DELETE, Extension.class); + entityEventDetails.put(EVENT_EXTENSION_RESOURCE_REGISTER, Extension.class); + entityEventDetails.put(EVENT_EXTENSION_RESOURCE_UNREGISTER, Extension.class); + entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_ADD, ExtensionCustomAction.class); + entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_UPDATE, ExtensionCustomAction.class); + entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_DELETE, ExtensionCustomAction.class); + + // Backup Repository + entityEventDetails.put(EVENT_BACKUP_REPOSITORY_ADD, BackupRepositoryService.class); + entityEventDetails.put(EVENT_BACKUP_REPOSITORY_UPDATE, BackupRepositoryService.class); } public static boolean isNetworkEvent(String eventType) { diff --git a/api/src/main/java/com/cloud/exception/OperationTimedoutException.java b/api/src/main/java/com/cloud/exception/OperationTimedoutException.java index fe27408eb4e3..66b607100d97 100644 --- a/api/src/main/java/com/cloud/exception/OperationTimedoutException.java +++ b/api/src/main/java/com/cloud/exception/OperationTimedoutException.java @@ -40,7 +40,7 @@ public class OperationTimedoutException extends CloudException { boolean _isActive; public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) { - super("Commands " + seqId + " to Host " + agentId + " timed out after " + time); + super("Commands " + seqId + " to Host " + agentId + " timed out after " + time + " secs"); _agentId = agentId; _seqId = seqId; _time = time; diff --git a/api/src/main/java/com/cloud/ha/Investigator.java b/api/src/main/java/com/cloud/ha/Investigator.java index 88d802a1ce44..00371d395f5a 100644 --- a/api/src/main/java/com/cloud/ha/Investigator.java +++ b/api/src/main/java/com/cloud/ha/Investigator.java @@ -26,17 +26,19 @@ public interface Investigator extends Adapter { * Returns if the vm is still alive. * * @param vm to work on. + * @return true if vm is alive, otherwise false */ - public boolean isVmAlive(VirtualMachine vm, Host host) throws UnknownVM; + boolean isVmAlive(VirtualMachine vm, Host host) throws UnknownVM; - public Status isAgentAlive(Host agent); + /** + * Returns the agent status of the host. + * + * @param host + * @return status of the host agent + */ + Status getHostAgentStatus(Host host); class UnknownVM extends Exception { - - /** - * - */ private static final long serialVersionUID = 1L; - }; } diff --git a/api/src/main/java/com/cloud/host/Host.java b/api/src/main/java/com/cloud/host/Host.java index afac6df56312..b52348201516 100644 --- a/api/src/main/java/com/cloud/host/Host.java +++ b/api/src/main/java/com/cloud/host/Host.java @@ -53,9 +53,18 @@ public static String[] toStrings(Host.Type... types) { return strs; } } - public static final String HOST_UEFI_ENABLE = "host.uefi.enable"; - public static final String HOST_VOLUME_ENCRYPTION = "host.volume.encryption"; - public static final String HOST_INSTANCE_CONVERSION = "host.instance.conversion"; + + String HOST_UEFI_ENABLE = "host.uefi.enable"; + String HOST_VOLUME_ENCRYPTION = "host.volume.encryption"; + String HOST_INSTANCE_CONVERSION = "host.instance.conversion"; + String HOST_VDDK_SUPPORT = "host.vddk.support"; + String HOST_VDDK_LIB_DIR = "vddk.lib.dir"; + String HOST_VDDK_VERSION = "host.vddk.version"; + String HOST_OVFTOOL_VERSION = "host.ovftool.version"; + String HOST_VIRTV2V_VERSION = "host.virtv2v.version"; + String HOST_SSH_PORT = "host.ssh.port"; + + int DEFAULT_SSH_PORT = 22; /** * @return name of the machine. @@ -213,4 +222,6 @@ public static String[] toStrings(Host.Type... types) { ResourceState getResourceState(); CPU.CPUArch getArch(); + + String getStorageAccessGroups(); } diff --git a/api/src/main/java/com/cloud/host/HostStats.java b/api/src/main/java/com/cloud/host/HostStats.java index d14794401fa3..0e72b5f2d9d0 100644 --- a/api/src/main/java/com/cloud/host/HostStats.java +++ b/api/src/main/java/com/cloud/host/HostStats.java @@ -36,5 +36,4 @@ public interface HostStats { public HostStats getHostStats(); public double getLoadAverage(); - // public double getXapiMemoryUsageKBs(); } diff --git a/api/src/main/java/com/cloud/hypervisor/Hypervisor.java b/api/src/main/java/com/cloud/hypervisor/Hypervisor.java index 27ffef1c3708..1f8741d3b7b2 100644 --- a/api/src/main/java/com/cloud/hypervisor/Hypervisor.java +++ b/api/src/main/java/com/cloud/hypervisor/Hypervisor.java @@ -31,20 +31,22 @@ import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate; import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.RootDiskSizeOverride; import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigration; +import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigrationWithSnapshots; public class Hypervisor { public static class HypervisorType { public enum Functionality { DirectDownloadTemplate, RootDiskSizeOverride, - VmStorageMigration + VmStorageMigration, + VmStorageMigrationWithSnapshots } private static final Map hypervisorTypeMap = new LinkedHashMap<>(); public static final HypervisorType None = new HypervisorType("None"); //for storage hosts public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD, EnumSet.of(RootDiskSizeOverride, VmStorageMigration)); public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2, EnumSet.of(DirectDownloadTemplate, RootDiskSizeOverride, VmStorageMigration)); - public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration)); + public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration, VmStorageMigrationWithSnapshots)); public static final HypervisorType Hyperv = new HypervisorType("Hyperv"); public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox"); public static final HypervisorType Parralels = new HypervisorType("Parralels"); @@ -54,6 +56,7 @@ public enum Functionality { public static final HypervisorType Ovm3 = new HypervisorType("Ovm3", ImageFormat.RAW); public static final HypervisorType LXC = new HypervisorType("LXC"); public static final HypervisorType Custom = new HypervisorType("Custom", null, EnumSet.of(RootDiskSizeOverride)); + public static final HypervisorType External = new HypervisorType("External", null, EnumSet.of(RootDiskSizeOverride)); public static final HypervisorType Any = new HypervisorType("Any"); /*If you don't care about the hypervisor type*/ private final String name; private final ImageFormat imageFormat; diff --git a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java b/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java similarity index 76% rename from plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java rename to api/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java index 591da077aec6..80f6a6045c72 100644 --- a/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java +++ b/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesCluster.java @@ -44,6 +44,8 @@ enum Event { AutoscaleRequested, ScaleUpRequested, ScaleDownRequested, + AddNodeRequested, + RemoveNodeRequested, UpgradeRequested, OperationSucceeded, OperationFailed, @@ -58,7 +60,10 @@ enum State { Stopping("Resources for the Kubernetes cluster are being destroyed"), Stopped("All resources for the Kubernetes cluster are destroyed, Kubernetes cluster may still have ephemeral resource like persistent volumes provisioned"), Scaling("Transient state in which resources are either getting scaled up/down"), + ScalingStoppedCluster("Transient state in which the service offerings of stopped clusters are getting scaled"), Upgrading("Transient state in which cluster is getting upgraded"), + Importing("Transient state in which additional nodes are added as worker nodes to a cluster"), + RemovingNodes("Transient state in which additional nodes are removed from a cluster"), Alert("State to represent Kubernetes clusters which are not in expected desired state (operationally in active control place, stopped cluster VM's etc)."), Recovering("State in which Kubernetes cluster is recovering from alert state"), Destroyed("End state of Kubernetes cluster in which all resources are destroyed, cluster will not be usable further"), @@ -83,19 +88,35 @@ enum State { s_fsm.addTransition(State.Stopping, Event.OperationFailed, State.Alert); s_fsm.addTransition(State.Stopped, Event.StartRequested, State.Starting); + s_fsm.addTransition(State.Stopped, Event.OperationSucceeded, State.Stopped); + s_fsm.addTransition(State.Running, Event.OperationSucceeded, State.Running); s_fsm.addTransition(State.Running, Event.FaultsDetected, State.Alert); s_fsm.addTransition(State.Running, Event.AutoscaleRequested, State.Scaling); s_fsm.addTransition(State.Running, Event.ScaleUpRequested, State.Scaling); s_fsm.addTransition(State.Running, Event.ScaleDownRequested, State.Scaling); + s_fsm.addTransition(State.Stopped, Event.ScaleUpRequested, State.ScalingStoppedCluster); s_fsm.addTransition(State.Scaling, Event.OperationSucceeded, State.Running); - s_fsm.addTransition(State.Scaling, Event.OperationFailed, State.Alert); + s_fsm.addTransition(State.Scaling, Event.OperationFailed, State.Running); + s_fsm.addTransition(State.ScalingStoppedCluster, Event.OperationSucceeded, State.Stopped); + s_fsm.addTransition(State.ScalingStoppedCluster, Event.OperationFailed, State.Alert); s_fsm.addTransition(State.Running, Event.UpgradeRequested, State.Upgrading); s_fsm.addTransition(State.Upgrading, Event.OperationSucceeded, State.Running); s_fsm.addTransition(State.Upgrading, Event.OperationFailed, State.Alert); + s_fsm.addTransition(State.Running, Event.AddNodeRequested, State.Importing); + s_fsm.addTransition(State.Alert, Event.AddNodeRequested, State.Importing); + s_fsm.addTransition(State.Importing, Event.OperationSucceeded, State.Running); + s_fsm.addTransition(State.Importing, Event.OperationFailed, State.Running); + s_fsm.addTransition(State.Alert, Event.OperationSucceeded, State.Running); + + s_fsm.addTransition(State.Running, Event.RemoveNodeRequested, State.RemovingNodes); + s_fsm.addTransition(State.Alert, Event.RemoveNodeRequested, State.RemovingNodes); + s_fsm.addTransition(State.RemovingNodes, Event.OperationSucceeded, State.Running); + s_fsm.addTransition(State.RemovingNodes, Event.OperationFailed, State.Running); + s_fsm.addTransition(State.Alert, Event.RecoveryRequested, State.Recovering); s_fsm.addTransition(State.Recovering, Event.OperationSucceeded, State.Running); s_fsm.addTransition(State.Recovering, Event.OperationFailed, State.Alert); @@ -142,4 +163,14 @@ enum State { Long getMaxSize(); Long getSecurityGroupId(); ClusterType getClusterType(); + Long getControlNodeServiceOfferingId(); + Long getWorkerNodeServiceOfferingId(); + Long getEtcdNodeServiceOfferingId(); + Long getControlNodeTemplateId(); + Long getWorkerNodeTemplateId(); + Long getEtcdNodeTemplateId(); + Long getEtcdNodeCount(); + Long getCniConfigId(); + String getCniConfigDetails(); + boolean isCsiEnabled(); } diff --git a/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java b/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java index a13c1b3a6a89..5a6eaa3f7b9a 100644 --- a/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java +++ b/api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java @@ -18,12 +18,26 @@ import org.apache.cloudstack.acl.ControlledEntity; +import java.util.List; +import java.util.Map; + +import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.utils.component.Adapter; public interface KubernetesServiceHelper extends Adapter { + enum KubernetesClusterNodeType { + CONTROL, WORKER, ETCD, DEFAULT + } + ControlledEntity findByUuid(String uuid); ControlledEntity findByVmId(long vmId); void checkVmCanBeDestroyed(UserVm userVm); + void checkVmAffinityGroupsCanBeUpdated(UserVm userVm); + boolean isValidNodeType(String nodeType); + Map getServiceOfferingNodeTypeMap(Map> serviceOfferingNodeTypeMap); + Map getTemplateNodeTypeMap(Map> templateNodeTypeMap); + Map> getAffinityGroupNodeTypeMap(Map> affinityGroupNodeTypeMap); + void cleanupForAccount(Account account); } diff --git a/api/src/main/java/com/cloud/network/IpAddress.java b/api/src/main/java/com/cloud/network/IpAddress.java index ae1af4505773..70d652b54e99 100644 --- a/api/src/main/java/com/cloud/network/IpAddress.java +++ b/api/src/main/java/com/cloud/network/IpAddress.java @@ -99,4 +99,5 @@ enum Purpose { boolean isForSystemVms(); + boolean isForRouter(); } diff --git a/api/src/main/java/com/cloud/network/Ipv6Service.java b/api/src/main/java/com/cloud/network/Ipv6Service.java index 4ef5f98c38d8..e6c3b9250a7a 100644 --- a/api/src/main/java/com/cloud/network/Ipv6Service.java +++ b/api/src/main/java/com/cloud/network/Ipv6Service.java @@ -45,7 +45,7 @@ public interface Ipv6Service extends PluggableService, Configurable { static final ConfigKey Ipv6OfferingCreationEnabled = new ConfigKey("Advanced", Boolean.class, "ipv6.offering.enabled", "false", - "Indicates whether creation of IPv6 network/VPC offering is enabled or not.", + "Indicates whether creation of IPv6 Network/VPC offering is enabled or not.", true); static final ConfigKey Ipv6PrefixSubnetCleanupInterval = new ConfigKey("Advanced", Integer.class, diff --git a/api/src/main/java/com/cloud/network/Network.java b/api/src/main/java/com/cloud/network/Network.java index d3bc5005cb7a..e41eb880ffd5 100644 --- a/api/src/main/java/com/cloud/network/Network.java +++ b/api/src/main/java/com/cloud/network/Network.java @@ -206,6 +206,7 @@ public static class Provider { public static final Provider Tungsten = new Provider("Tungsten", false); public static final Provider Nsx = new Provider("Nsx", false); + public static final Provider Netris = new Provider("Netris", false); private final String name; private final boolean isExternal; @@ -324,9 +325,9 @@ enum Event { public enum State { - Allocated("Indicates the network configuration is in allocated but not setup"), Setup("Indicates the network configuration is setup"), Implementing( - "Indicates the network configuration is being implemented"), Implemented("Indicates the network configuration is in use"), Shutdown( - "Indicates the network configuration is being destroyed"), Destroy("Indicates that the network is destroyed"); + Allocated("Indicates the Network configuration is in allocated but not setup"), Setup("Indicates the Network configuration is setup"), Implementing( + "Indicates the Network configuration is being implemented"), Implemented("Indicates the Network configuration is in use"), Shutdown( + "Indicates the Network configuration is being destroyed"), Destroy("Indicates that the Network is destroyed"); protected static final StateMachine2 s_fsm = new StateMachine2(); @@ -509,4 +510,6 @@ public void setIp6Address(String ip6Address) { Integer getPrivateMtu(); Integer getNetworkCidrSize(); + + boolean getKeepMacAddressOnPublicNic(); } diff --git a/api/src/main/java/com/cloud/network/NetworkModel.java b/api/src/main/java/com/cloud/network/NetworkModel.java index a4cd87af0080..c212e6319eb4 100644 --- a/api/src/main/java/com/cloud/network/NetworkModel.java +++ b/api/src/main/java/com/cloud/network/NetworkModel.java @@ -125,6 +125,10 @@ public interface NetworkModel { */ String getNextAvailableMacAddressInNetwork(long networkConfigurationId) throws InsufficientAddressCapacityException; + String getUniqueMacAddress(long macAddress, long networkId, long datacenterId) throws InsufficientAddressCapacityException; + + boolean isMACUnique(String mac, long networkId); + PublicIpAddress getPublicIpAddress(long ipAddressId); List listPodVlans(long podId); @@ -305,6 +309,8 @@ public interface NetworkModel { NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri); + NicProfile getNicProfile(VirtualMachine vm, Nic nic, DataCenter dataCenter); + Set getAvailableIps(Network network, String requestedIp); String getDomainNetworkDomain(long domainId, long zoneId); @@ -362,4 +368,8 @@ List generateVmData(String userData, String userDataDetails, String se boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone, List networkIds, List securityGroupsIds); + + default long getMacIdentifier(Long dataCenterId) { + return 0; + } } diff --git a/api/src/main/java/com/cloud/network/NetworkProfile.java b/api/src/main/java/com/cloud/network/NetworkProfile.java index 2e8efb489308..d690344a0e38 100644 --- a/api/src/main/java/com/cloud/network/NetworkProfile.java +++ b/api/src/main/java/com/cloud/network/NetworkProfile.java @@ -385,6 +385,11 @@ public Integer getNetworkCidrSize() { return networkCidrSize; } + @Override + public boolean getKeepMacAddressOnPublicNic() { + return true; + } + @Override public String toString() { return String.format("NetworkProfile %s", diff --git a/api/src/main/java/com/cloud/network/NetworkService.java b/api/src/main/java/com/cloud/network/NetworkService.java index b8dd464b3655..53692f932a4e 100644 --- a/api/src/main/java/com/cloud/network/NetworkService.java +++ b/api/src/main/java/com/cloud/network/NetworkService.java @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; -import com.cloud.dc.DataCenter; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin; import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd; @@ -39,13 +38,16 @@ import org.apache.cloudstack.api.command.user.vm.ListNicsCmd; import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse; import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.network.element.InternalLoadBalancerElementService; +import com.cloud.agent.api.to.NicTO; +import com.cloud.dc.DataCenter; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network.IpAddresses; import com.cloud.network.Network.Service; import com.cloud.network.Networks.TrafficType; @@ -57,7 +59,6 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.Nic; import com.cloud.vm.NicSecondaryIp; -import org.apache.cloudstack.network.element.InternalLoadBalancerElementService; /** * The NetworkService interface is the "public" api to entities that make requests to the orchestration engine @@ -80,7 +81,7 @@ public interface NetworkService { true, ConfigKey.Scope.Zone); public static final ConfigKey AllowUsersToSpecifyVRMtu = new ConfigKey<>("Advanced", Boolean.class, - "allow.end.users.to.specify.vr.mtu", "false", "Allow end users to specify VR MTU", + "allow.end.users.to.specify.vr.mtu", "false", "Allow end Users to specify VR MTU", true, ConfigKey.Scope.Zone); List getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner); @@ -107,6 +108,10 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException; + Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner, + PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair vrIfaceMTUs) throws + InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException; + Pair, Integer> searchForNetworks(ListNetworksCmd cmd); boolean deleteNetwork(long networkId, boolean forced); @@ -268,4 +273,12 @@ Network createPrivateNetwork(String networkName, String displayText, long physic InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId); InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId); List getInternalLoadBalancerElements(); + + boolean handleCksIsoOnNetworkVirtualRouter(Long virtualRouterId, boolean mount) throws ResourceUnavailableException; + + IpAddresses getIpAddressesFromIps(String ipAddress, String ip6Address, String macAddress); + + String getNicVlanValueForExternalVm(NicTO nic); + + Long getPreferredNetworkIdForPublicIpRuleAssignment(IpAddress ip, Long networkId); } diff --git a/api/src/main/java/com/cloud/network/Networks.java b/api/src/main/java/com/cloud/network/Networks.java index dfa0ddb84cae..5f767686dc97 100644 --- a/api/src/main/java/com/cloud/network/Networks.java +++ b/api/src/main/java/com/cloud/network/Networks.java @@ -78,7 +78,7 @@ public URI toUri(T value) { } @Override public String getValueFrom(URI uri) { - return uri.getAuthority(); + return uri == null ? null : uri.getAuthority(); } }, Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) { @@ -96,7 +96,7 @@ public URI toUri(T value) { */ @Override public String getValueFrom(URI uri) { - return uri.getSchemeSpecificPart(); + return uri == null ? null : uri.getSchemeSpecificPart(); } }, Mido("mido", String.class), Pvlan("pvlan", String.class), @@ -129,7 +129,8 @@ public URI toUri(T value) { UnDecided(null, null), OpenDaylight("opendaylight", String.class), TUNGSTEN("tf", String.class), - NSX("nsx", String.class); + NSX("nsx", String.class), + Netris("netris", String.class); private final String scheme; private final Class type; @@ -176,7 +177,7 @@ public URI toUri(T value) { * @return the scheme as BroadcastDomainType */ public static BroadcastDomainType getSchemeValue(URI uri) { - return toEnumValue(uri.getScheme()); + return toEnumValue(uri == null ? null : uri.getScheme()); } /** @@ -190,7 +191,7 @@ public static BroadcastDomainType getTypeOf(String str) throws URISyntaxExceptio if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) { return Native; } - return getSchemeValue(new URI(str)); + return getSchemeValue(str == null ? null : new URI(str)); } /** @@ -219,7 +220,7 @@ public static BroadcastDomainType toEnumValue(String scheme) { * @return the host part as String */ public String getValueFrom(URI uri) { - return uri.getHost(); + return uri == null ? null : uri.getHost(); } /** @@ -242,7 +243,7 @@ public static String getValue(URI uri) { * @throws URISyntaxException the string is not even an uri */ public static String getValue(String uriString) throws URISyntaxException { - return getValue(new URI(uriString)); + return getValue(uriString == null ? null : new URI(uriString)); } /** diff --git a/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java index 9676badb4e90..d3804cd29daf 100644 --- a/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java +++ b/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java @@ -41,4 +41,6 @@ public interface PhysicalNetworkTrafficType extends InternalIdentity, Identity { String getHypervNetworkLabel(); String getOvm3NetworkLabel(); + + String getVlan(); } diff --git a/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java b/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java index eb65ae9088ec..22a46ce9ecdf 100644 --- a/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java +++ b/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java @@ -26,7 +26,7 @@ public interface RouterHealthCheckResult { String getCheckType(); - boolean getCheckResult(); + VirtualNetworkApplianceService.RouterHealthStatus getCheckResult(); Date getLastUpdateTime(); diff --git a/api/src/main/java/com/cloud/network/SDNProviderNetworkRule.java b/api/src/main/java/com/cloud/network/SDNProviderNetworkRule.java new file mode 100644 index 000000000000..a22db4287dcd --- /dev/null +++ b/api/src/main/java/com/cloud/network/SDNProviderNetworkRule.java @@ -0,0 +1,358 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network; + +import java.util.List; + +public class SDNProviderNetworkRule { + + protected long domainId; + protected long accountId; + protected long zoneId; + protected Long networkResourceId; + protected String networkResourceName; + protected boolean isVpcResource; + protected long vmId; + protected long ruleId; + protected String publicIp; + protected String vmIp; + protected String publicPort; + protected String privatePort; + protected String protocol; + protected String algorithm; + protected List sourceCidrList; + protected List destinationCidrList; + protected Integer icmpCode; + + protected Integer icmpType; + protected String trafficType; + protected Network.Service service; + + public long getDomainId() { + return domainId; + } + + public void setDomainId(long domainId) { + this.domainId = domainId; + } + + public long getAccountId() { + return accountId; + } + + public void setAccountId(long accountId) { + this.accountId = accountId; + } + + public long getZoneId() { + return zoneId; + } + + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + + public Long getNetworkResourceId() { + return networkResourceId; + } + + public void setNetworkResourceId(Long networkResourceId) { + this.networkResourceId = networkResourceId; + } + + public String getNetworkResourceName() { + return networkResourceName; + } + + public void setNetworkResourceName(String networkResourceName) { + this.networkResourceName = networkResourceName; + } + + public boolean isVpcResource() { + return isVpcResource; + } + + public void setVpcResource(boolean vpcResource) { + isVpcResource = vpcResource; + } + + public long getVmId() { + return vmId; + } + + public void setVmId(long vmId) { + this.vmId = vmId; + } + + public long getRuleId() { + return ruleId; + } + + public void setRuleId(long ruleId) { + this.ruleId = ruleId; + } + + public String getPublicIp() { + return publicIp; + } + + public void setPublicIp(String publicIp) { + this.publicIp = publicIp; + } + + public String getVmIp() { + return vmIp; + } + + public void setVmIp(String vmIp) { + this.vmIp = vmIp; + } + + public String getPublicPort() { + return publicPort; + } + + public void setPublicPort(String publicPort) { + this.publicPort = publicPort; + } + + public String getPrivatePort() { + return privatePort; + } + + public void setPrivatePort(String privatePort) { + this.privatePort = privatePort; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public void setAlgorithm(String algorithm) { + this.algorithm = algorithm; + } + + public String getAlgorithm() { + return algorithm; + } + + public Network.Service getService() { + return service; + } + + public void setService(Network.Service service) { + this.service = service; + } + + public Integer getIcmpCode() { + return icmpCode; + } + + public void setIcmpCode(Integer icmpCode) { + this.icmpCode = icmpCode; + } + + public Integer getIcmpType() { + return icmpType; + } + + public void setIcmpType(Integer icmpType) { + this.icmpType = icmpType; + } + + public List getSourceCidrList() { + return sourceCidrList; + } + + public void setSourceCidrList(List sourceCidrList) { + this.sourceCidrList = sourceCidrList; + } + + public List getDestinationCidrList() { + return destinationCidrList; + } + + public void setDestinationCidrList(List destinationCidrList) { + this.destinationCidrList = destinationCidrList; + } + + public String getTrafficType() { + return trafficType; + } + + public void setTrafficType(String trafficType) { + this.trafficType = trafficType; + } + + public static class Builder { + public long domainId; + public long accountId; + public long zoneId; + public Long networkResourceId; + public String networkResourceName; + public boolean isVpcResource; + public long vmId; + + public long ruleId; + public String publicIp; + public String vmIp; + public String publicPort; + public String privatePort; + public String protocol; + public String algorithm; + public List sourceCidrList; + public List destinationCidrList; + public String trafficType; + public Integer icmpType; + public Integer icmpCode; + public Network.Service service; + + public Builder() { + // Default constructor + } + + public Builder setDomainId(long domainId) { + this.domainId = domainId; + return this; + } + + public Builder setAccountId(long accountId) { + this.accountId = accountId; + return this; + } + + public Builder setZoneId(long zoneId) { + this.zoneId = zoneId; + return this; + } + + public Builder setNetworkResourceId(Long networkResourceId) { + this.networkResourceId = networkResourceId; + return this; + } + + public Builder setNetworkResourceName(String networkResourceName) { + this.networkResourceName = networkResourceName; + return this; + } + + public Builder setVpcResource(boolean isVpcResource) { + this.isVpcResource = isVpcResource; + return this; + } + + + public Builder setVmId(long vmId) { + this.vmId = vmId; + return this; + } + + public Builder setRuleId(long ruleId) { + this.ruleId = ruleId; + return this; + } + + public Builder setPublicIp(String publicIp) { + this.publicIp = publicIp; + return this; + } + + public Builder setVmIp(String vmIp) { + this.vmIp = vmIp; + return this; + } + + public Builder setPublicPort(String publicPort) { + this.publicPort = publicPort; + return this; + } + + public Builder setPrivatePort(String privatePort) { + this.privatePort = privatePort; + return this; + } + + public Builder setProtocol(String protocol) { + this.protocol = protocol; + return this; + } + + public Builder setAlgorithm(String algorithm) { + this.algorithm = algorithm; + return this; + } + + public Builder setTrafficType(String trafficType) { + this.trafficType = trafficType; + return this; + } + + public Builder setIcmpType(Integer icmpType) { + this.icmpType = icmpType; + return this; + } + + public Builder setIcmpCode(Integer icmpCode) { + this.icmpCode = icmpCode; + return this; + } + + public Builder setSourceCidrList(List sourceCidrList) { + this.sourceCidrList = sourceCidrList; + return this; + } + + public Builder setDestinationCidrList(List destinationCidrList) { + this.destinationCidrList = destinationCidrList; + return this; + } + + public Builder setService(Network.Service service) { + this.service = service; + return this; + } + + public SDNProviderNetworkRule build() { + SDNProviderNetworkRule rule = new SDNProviderNetworkRule(); + rule.setDomainId(this.domainId); + rule.setAccountId(this.accountId); + rule.setZoneId(this.zoneId); + rule.setNetworkResourceId(this.networkResourceId); + rule.setNetworkResourceName(this.networkResourceName); + rule.setVpcResource(this.isVpcResource); + rule.setVmId(this.vmId); + rule.setVmIp(this.vmIp); + rule.setPublicIp(this.publicIp); + rule.setPublicPort(this.publicPort); + rule.setPrivatePort(this.privatePort); + rule.setProtocol(this.protocol); + rule.setRuleId(this.ruleId); + rule.setAlgorithm(this.algorithm); + rule.setIcmpType(this.icmpType); + rule.setIcmpCode(this.icmpCode); + rule.setSourceCidrList(this.sourceCidrList); + rule.setDestinationCidrList(this.destinationCidrList); + rule.setTrafficType(this.trafficType); + rule.setService(service); + return rule; + } + } +} diff --git a/api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java b/api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java index 994df875f7d3..51036abe0609 100644 --- a/api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java +++ b/api/src/main/java/com/cloud/network/Site2SiteVpnConnection.java @@ -24,7 +24,7 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable { enum State { - Pending, Connecting, Connected, Disconnected, Error, + Pending, Connecting, Connected, Disconnected, Error, Removed } @Override diff --git a/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java index cb92739d2837..a60f1d49336a 100644 --- a/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java +++ b/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java @@ -87,4 +87,8 @@ void startRouterForHA(VirtualMachine vm, Map performRouterHealthChecks(long routerId); void collectNetworkStatistics(T router, Nic nic); + + enum RouterHealthStatus{ + SUCCESS, FAILED, WARNING, UNKNOWN; + } } diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleService.java b/api/src/main/java/com/cloud/network/as/AutoScaleService.java index ceca4de68428..4aef10f8de9e 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleService.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleService.java @@ -70,6 +70,8 @@ public interface AutoScaleService { Counter createCounter(CreateCounterCmd cmd); + Counter getCounter(long counterId); + boolean deleteCounter(long counterId) throws ResourceInUseException; List listCounters(ListCountersCmd cmd); diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java index c265c1f36a0a..c05b3bda3db5 100644 --- a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java +++ b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java @@ -43,7 +43,7 @@ public static State fromValue(String state) { } else if (state.equalsIgnoreCase("scaling")) { return SCALING; } else { - throw new IllegalArgumentException("Unexpected AutoScale VM group state : " + state); + throw new IllegalArgumentException("Unexpected AutoScale Instance group state : " + state); } } } diff --git a/api/src/main/java/com/cloud/network/element/NetworkElement.java b/api/src/main/java/com/cloud/network/element/NetworkElement.java index fa67575edd35..cb0fc2fca981 100644 --- a/api/src/main/java/com/cloud/network/element/NetworkElement.java +++ b/api/src/main/java/com/cloud/network/element/NetworkElement.java @@ -23,6 +23,7 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.IpAddress; import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; @@ -87,6 +88,14 @@ boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, Deplo boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException; + /** + * Release IP from the network provider if reserved + * @param ipAddress + */ + default boolean releaseIp(IpAddress ipAddress) { + return true; + } + /** * The network is being shutdown. * @param network diff --git a/api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java b/api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java index e99bc2fd416b..8dcc8b6d0a47 100644 --- a/api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java +++ b/api/src/main/java/com/cloud/network/element/PortForwardingServiceProvider.java @@ -17,12 +17,40 @@ package com.cloud.network.element; import java.util.List; +import java.util.Objects; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network; +import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.PortForwardingRule; +import com.cloud.network.vpc.NetworkACLItem; public interface PortForwardingServiceProvider extends NetworkElement, IpDeployingRequester { + + static String getPublicPortRange(PortForwardingRule rule) { + return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ? + String.valueOf(rule.getSourcePortStart()) : + String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd())); + } + + static String getPrivatePFPortRange(PortForwardingRule rule) { + return rule.getDestinationPortStart() == rule.getDestinationPortEnd() ? + String.valueOf(rule.getDestinationPortStart()) : + String.valueOf(rule.getDestinationPortStart()).concat("-").concat(String.valueOf(rule.getDestinationPortEnd())); + } + + static String getPrivatePortRange(FirewallRule rule) { + return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ? + String.valueOf(rule.getSourcePortStart()) : + String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd())); + } + + static String getPrivatePortRangeForACLRule(NetworkACLItem rule) { + return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ? + String.valueOf(rule.getSourcePortStart()) : + String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd())); + } + /** * Apply rules * @param network diff --git a/api/src/main/java/com/cloud/network/element/VpcProvider.java b/api/src/main/java/com/cloud/network/element/VpcProvider.java index 6debd1fbc2d8..fe8c8f8612f7 100644 --- a/api/src/main/java/com/cloud/network/element/VpcProvider.java +++ b/api/src/main/java/com/cloud/network/element/VpcProvider.java @@ -55,4 +55,8 @@ boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List rules) throws ResourceUnavailableException; boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address); + + default boolean updateVpc(Vpc vpc, String previousVpcName) { + return true; + } } diff --git a/api/src/main/java/com/cloud/network/guru/NetworkGuru.java b/api/src/main/java/com/cloud/network/guru/NetworkGuru.java index 7b81c75ed845..ced664e54a96 100644 --- a/api/src/main/java/com/cloud/network/guru/NetworkGuru.java +++ b/api/src/main/java/com/cloud/network/guru/NetworkGuru.java @@ -215,4 +215,8 @@ void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDe default boolean isSlaacV6Only() { return true; } + + default boolean update(Network network, String prevNetworkName) { + return true; + } } diff --git a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java index 46f17237e029..b7fe3b26761c 100644 --- a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java +++ b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java @@ -41,13 +41,23 @@ public interface LoadBalancingRulesService { /** * Create a load balancer rule from the given ipAddress/port to the given private port + * @param xId an existing UUID for this rule (for instance a device generated one) + * @param name + * @param description + * @param srcPortStart + * @param srcPortEnd + * @param defPortStart + * @param defPortEnd + * @param ipAddrId + * @param protocol + * @param algorithm + * @param networkId + * @param lbOwnerId * @param openFirewall - * TODO - * @param forDisplay TODO - * @param cmd - * the command specifying the ip address, public port, protocol, private port, and algorithm - * + * @param lbProtocol + * @param forDisplay * @return the newly created LoadBalancerVO if successful, null otherwise + * @throws NetworkRuleConflictException * @throws InsufficientAddressCapacityException */ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, @@ -98,7 +108,7 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri /** * Assign a virtual machine or list of virtual machines, or Map of to a load balancer. */ - boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, boolean isAutoScaleVM); + boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, Map vmIdNetworkMap, boolean isAutoScaleVM); boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey); @@ -106,7 +116,7 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException; - boolean assignCertToLoadBalancer(long lbRuleId, Long certId); + boolean assignCertToLoadBalancer(long lbRuleId, Long certId, boolean isForced); boolean removeCertFromLoadBalancer(long lbRuleId); diff --git a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareClientException.java b/api/src/main/java/com/cloud/network/netris/NetrisLbBackend.java similarity index 63% rename from vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareClientException.java rename to api/src/main/java/com/cloud/network/netris/NetrisLbBackend.java index 828eed4622de..afc21f7f511b 100644 --- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareClientException.java +++ b/api/src/main/java/com/cloud/network/netris/NetrisLbBackend.java @@ -14,20 +14,28 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.hypervisor.vmware.util; +package com.cloud.network.netris; -import com.cloud.exception.CloudException; +public class NetrisLbBackend { + private long vmId; + private String vmIp; + private int port; -public class VmwareClientException extends CloudException { - public VmwareClientException(String message, Throwable cause) { - super(message, cause); + public NetrisLbBackend(long vmId, String vmIp, int port) { + this.vmId = vmId; + this.vmIp = vmIp; + this.port = port; } - public VmwareClientException(String msg) { - super(msg); + public long getVmId() { + return vmId; } - // TODO embed vmware classes in this one for use downstream - public VmwareClientException(String msg, Exception embedded) { - super(msg, embedded); + + public String getVmIp() { + return vmIp; + } + + public int getPort() { + return port; } } diff --git a/api/src/main/java/com/cloud/network/netris/NetrisNetworkRule.java b/api/src/main/java/com/cloud/network/netris/NetrisNetworkRule.java new file mode 100644 index 000000000000..211517ead491 --- /dev/null +++ b/api/src/main/java/com/cloud/network/netris/NetrisNetworkRule.java @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.netris; + +import com.cloud.network.SDNProviderNetworkRule; + + +import java.util.List; + +public class NetrisNetworkRule { + public enum NetrisRuleAction { + PERMIT, DENY + } + + private SDNProviderNetworkRule baseRule; + private NetrisRuleAction aclAction; + private List lbBackends; + private String lbRuleName; + private String lbCidrList; + private String reason; + + public NetrisNetworkRule(Builder builder) { + this.baseRule = builder.baseRule; + this.aclAction = builder.aclAction; + this.lbBackends = builder.lbBackends; + this.reason = builder.reason; + this.lbCidrList = builder.lbCidrList; + this.lbRuleName = builder.lbRuleName; + } + + public NetrisRuleAction getAclAction() { + return aclAction; + } + + public List getLbBackends() { + return lbBackends; + } + + public String getReason() { + return reason; + } + + public String getLbCidrList() {return lbCidrList; } + + public String getLbRuleName() { return lbRuleName; } + + public SDNProviderNetworkRule getBaseRule() { + return baseRule; + } + + // Builder class extending the parent builder + public static class Builder { + private SDNProviderNetworkRule baseRule; + private NetrisRuleAction aclAction; + private List lbBackends; + private String reason; + private String lbCidrList; + private String lbRuleName; + + public Builder baseRule(SDNProviderNetworkRule baseRule) { + this.baseRule = baseRule; + return this; + } + + public Builder aclAction(NetrisRuleAction aclAction) { + this.aclAction = aclAction; + return this; + } + + public Builder lbBackends(List lbBackends) { + this.lbBackends = lbBackends; + return this; + } + + public Builder reason(String reason) { + this.reason = reason; + return this; + } + + public Builder lbCidrList(String lbCidrList) { + this.lbCidrList = lbCidrList; + return this; + } + + public Builder lbRuleName(String lbRuleName) { + this.lbRuleName = lbRuleName; + return this; + } + + public NetrisNetworkRule build() { + return new NetrisNetworkRule(this); + } + } +} diff --git a/api/src/main/java/com/cloud/network/netris/NetrisProvider.java b/api/src/main/java/com/cloud/network/netris/NetrisProvider.java new file mode 100644 index 000000000000..fccf2930e976 --- /dev/null +++ b/api/src/main/java/com/cloud/network/netris/NetrisProvider.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.netris; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface NetrisProvider extends InternalIdentity, Identity { + long getZoneId(); + String getName(); + String getUrl(); + String getUsername(); + String getSiteName(); + String getTenantName(); + String getNetrisTag(); +} diff --git a/api/src/main/java/com/cloud/network/netris/NetrisService.java b/api/src/main/java/com/cloud/network/netris/NetrisService.java new file mode 100644 index 000000000000..110e9f07105a --- /dev/null +++ b/api/src/main/java/com/cloud/network/netris/NetrisService.java @@ -0,0 +1,310 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.netris; + +import com.cloud.network.IpAddress; +import com.cloud.network.Network; +import com.cloud.network.SDNProviderNetworkRule; +import com.cloud.network.vpc.StaticRoute; +import com.cloud.network.vpc.Vpc; + +import java.util.List; + +/** + * Interface for Netris Services that provides methods to manage VPCs, networks, + * NAT rules, network rules, and static routes in an SDN (Software Defined Networking) environment. + */ + +public interface NetrisService { + + /** + * Creates IPAM (IP Address Management) allocations for zone-level public ranges. + * + * @param zoneId the ID of the zone + * @return true if the operation is successful, false otherwise + */ + boolean createIPAMAllocationsForZoneLevelPublicRanges(long zoneId); + + /** + * Creates a VPC (Virtual Private Cloud) resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcId the ID of the VPC + * @param vpcName the name of the VPC + * @param sourceNatEnabled true if source NAT is enabled + * @param cidr the CIDR of the VPC + * @param isVpcNetwork true if it is a VPC network + * @return true if the operation is successful, false otherwise + */ + boolean createVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled, String cidr, boolean isVpcNetwork); + + /** + * Updates an existing VPC resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcId the ID of the VPC + * @param vpcName the new name of the VPC + * @param previousVpcName the previous name of the VPC + * @return true if the operation is successful, false otherwise + */ + boolean updateVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, String previousVpcName); + + /** + * Deletes a VPC resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpc the VPC to delete + * @return true if the operation is successful, false otherwise + */ + boolean deleteVpcResource(long zoneId, long accountId, long domainId, Vpc vpc); + + /** + * Creates a virtual network (vNet) resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the name of the network + * @param networkId the ID of the network + * @param cidr the CIDR of the network + * @param globalRouting true if global routing is enabled + * @return true if the operation is successful, false otherwise + */ + boolean createVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr, Boolean globalRouting); + + /** + * Updates an existing vNet resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the new name of the network + * @param networkId the ID of the network + * @param prevNetworkName the previous name of the network + * @return true if the operation is successful, false otherwise + */ + boolean updateVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String prevNetworkName); + + /** + * Deletes an existing vNet resource. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the name of the network + * @param networkId the ID of the network + * @param cidr the CIDR of the network + * @return true if the operation is successful, false otherwise + */ + boolean deleteVnetResource(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr); + + /** + * Creates a source NAT rule for a VPC or network. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the name of the network + * @param networkId the ID of the network + * @param isForVpc true if the rule applies to a VPC + * @param vpcCidr the VPC CIDR + * @param sourceNatIp the source NAT IP + * @return true if the operation is successful, false otherwise + */ + boolean createSnatRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, long networkId, boolean isForVpc, String vpcCidr, String sourceNatIp); + + /** + * Creates a port forwarding rule for a VPC or network. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the name of the network + * @param networkId the ID of the network + * @param isForVpc true if the rule applies to a VPC + * @param vpcCidr the VPC CIDR + * @param networkRule the network rule to forward + * @return true if the operation is successful, false otherwise + */ + boolean createPortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule); + + /** + * Deletes a port forwarding rule for a VPC or network. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param vpcName the name of the VPC + * @param vpcId the ID of the VPC + * @param networkName the name of the network + * @param networkId the ID of the network + * @param isForVpc true if the rule applies to a VPC + * @param vpcCidr the VPC CIDR + * @param networkRule the network rule to remove + * @return true if the operation is successful, false otherwise + */ + boolean deletePortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule); + + /** + * Updates the source NAT IP for a specified VPC. + * + * @param vpc the VPC to updates + * @param address the new source NAT IP address + * @return true if the operation is successful, false otherwise + */ + boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address); + + /** + * Creates a static NAT rule for a specific VM. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param networkResourceName the name of the network resource + * @param networkResourceId the ID of the network resource + * @param isForVpc true if the rule applies to a VPC + * @param vpcCidr the VPC CIDR + * @param staticNatIp the static NAT IP + * @param vmIp the VM's IP address + * @param vmId the ID of the VM + * @return true if the operation is successful, false otherwise + */ + boolean createStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String vpcCidr, String staticNatIp, String vmIp, long vmId); + + /** + * Deletes a static NAT rule for a specific VM. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param networkResourceName the name of the network resource + * @param networkResourceId the ID of the network resource + * @param isForVpc true if the rule applies to a VPC + * @param staticNatIp the static NAT IP + * @param vmId the ID of the VM + * @return true if the operation is successful, false otherwise + */ + boolean deleteStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String staticNatIp, long vmId); + + /** + * Adds firewall rules to a specific network. + * + * @param network the target network + * @param firewallRules the list of firewall rules to add + * @return true if the operation is successful, false otherwise + */ + boolean addFirewallRules(Network network, List firewallRules); + + /** + * Deletes firewall rules from a specific network. + * + * @param network the target network + * @param firewallRules the list of firewall rules to delete + * @return true if the operation is successful, false otherwise + */ + boolean deleteFirewallRules(Network network, List firewallRules); + + /** + * Adds or updates a static route for a specific network or VPC. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param networkResourceName the name of the network resource + * @param networkResourceId the ID of the network resource + * @param isForVpc true if it is for a VPC + * @param prefix the IP prefix of the route + * @param nextHop the next hop address + * @param routeId the ID of the route + * @param updateRoute true if the route should be updated + * @return true if the operation is successful, false otherwise + */ + boolean addOrUpdateStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId, boolean updateRoute); + + /** + * Deletes a specific static route for a network or VPC. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param networkResourceName the name of the network resource + * @param networkResourceId the ID of the network resource + * @param isForVpc true if it is for a VPC + * @param prefix the IP prefix of the route + * @param nextHop the next hop address + * @param routeId the ID of the route + * @return true if the operation is successful, false otherwise + */ + boolean deleteStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId); + + /** + * Lists static routes for a specific network or VPC. + * + * @param zoneId the ID of the zone + * @param accountId the ID of the account + * @param domainId the ID of the domain + * @param networkResourceName the name of the network resource + * @param networkResourceId the ID of the network resource + * @param isForVpc true if it is for a VPC + * @param prefix the IP prefix of the route + * @param nextHop the next hop address + * @param routeId the ID of the route + * @return a list of static routes + */ + List listStaticRoutes(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId); + + /** + * Releases a NAT IP address. + * + * @param zoneId the ID of the zone + * @param publicIp the public NAT IP to release + * @return true if the operation is successful, false otherwise + */ + boolean releaseNatIp(long zoneId, String publicIp); + + /** + * Creates or updates a load balancer (LB) rule. + * + * @param rule the network rule for the load balancer + * @return true if the operation is successful, false otherwise + */ + boolean createOrUpdateLbRule(NetrisNetworkRule rule); + + /** + * Deletes a load balancer (LB) rule. + * + * @param rule the network rule to delete + * @return true if the operation is successful, false otherwise + */ + boolean deleteLbRule(NetrisNetworkRule rule); +} diff --git a/api/src/main/java/com/cloud/network/nsx/NsxService.java b/api/src/main/java/com/cloud/network/nsx/NsxService.java index bc4e6aafbfec..1adb7461cc09 100644 --- a/api/src/main/java/com/cloud/network/nsx/NsxService.java +++ b/api/src/main/java/com/cloud/network/nsx/NsxService.java @@ -16,9 +16,10 @@ // under the License. package com.cloud.network.nsx; +import org.apache.cloudstack.framework.config.ConfigKey; + import com.cloud.network.IpAddress; import com.cloud.network.vpc.Vpc; -import org.apache.cloudstack.framework.config.ConfigKey; public interface NsxService { @@ -33,4 +34,5 @@ public interface NsxService { boolean createVpcNetwork(Long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled); boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address); + String getSegmentId(long domainId, long accountId, long zoneId, Long vpcId, long networkId); } diff --git a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java index 56a0622a52ba..5143611ee828 100644 --- a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java +++ b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java @@ -108,8 +108,7 @@ public LbStickinessMethod(StickinessMethodType methodType, String description) { } public void addParam(String name, Boolean required, String description, Boolean isFlag) { - /* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */ - // LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, description); + /* is this still a valid comment: FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */ LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, " ", isFlag); _paramList.add(param); return; @@ -133,7 +132,6 @@ public String getDescription() { public void setDescription(String description) { /* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */ - //this.description = description; this._description = " "; } } diff --git a/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java index 40aee1f08f1d..84e48d5d5b8a 100644 --- a/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java +++ b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java @@ -19,6 +19,7 @@ import java.util.List; import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd; +import org.apache.cloudstack.api.command.user.network.ImportNetworkACLCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd; import org.apache.cloudstack.api.command.user.network.MoveNetworkAclItemCmd; @@ -98,4 +99,6 @@ public interface NetworkACLService { NetworkACLItem moveNetworkAclRuleToNewPosition(MoveNetworkAclItemCmd moveNetworkAclItemCmd); NetworkACLItem moveRuleToTheTopInACLList(NetworkACLItem ruleBeingMoved); + + List importNetworkACLRules(ImportNetworkACLCmd cmd) throws ResourceUnavailableException; } diff --git a/api/src/main/java/com/cloud/network/vpc/StaticRoute.java b/api/src/main/java/com/cloud/network/vpc/StaticRoute.java index 5707ca140246..739fca328b8c 100644 --- a/api/src/main/java/com/cloud/network/vpc/StaticRoute.java +++ b/api/src/main/java/com/cloud/network/vpc/StaticRoute.java @@ -25,6 +25,7 @@ enum State { Staged, // route been created but has never got through network rule conflict detection. Routes in this state can not be sent to VPC virtual router. Add, // Add means the route has been created and has gone through network rule conflict detection. Active, // Route has been sent to the VPC router and reported to be active. + Update, Revoke, // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database. Deleting // rule has been revoked and is scheduled for deletion } @@ -32,7 +33,9 @@ enum State { /** * @return */ - long getVpcGatewayId(); + Long getVpcGatewayId(); + + String getNextHop(); /** * @return diff --git a/api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java index cb4849f1f7b2..c8fc073911fe 100644 --- a/api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java +++ b/api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java @@ -23,7 +23,8 @@ public class StaticRouteProfile implements StaticRoute { private String targetCidr; private long accountId; private long domainId; - private long gatewayId; + private Long gatewayId; + private String nextHop; private StaticRoute.State state; private long vpcId; String vlanTag; @@ -46,6 +47,18 @@ public StaticRouteProfile(StaticRoute staticRoute, VpcGateway gateway) { ipAddress = gateway.getIp4Address(); } + public StaticRouteProfile(StaticRoute staticRoute) { + id = staticRoute.getId(); + uuid = staticRoute.getUuid(); + targetCidr = staticRoute.getCidr(); + accountId = staticRoute.getAccountId(); + domainId = staticRoute.getDomainId(); + gatewayId = staticRoute.getVpcGatewayId(); + state = staticRoute.getState(); + vpcId = staticRoute.getVpcId(); + gateway = staticRoute.getNextHop(); + } + @Override public long getAccountId() { return accountId; @@ -57,10 +70,15 @@ public long getDomainId() { } @Override - public long getVpcGatewayId() { + public Long getVpcGatewayId() { return gatewayId; } + @Override + public String getNextHop() { + return nextHop; + } + @Override public String getCidr() { return targetCidr; diff --git a/api/src/main/java/com/cloud/network/vpc/Vpc.java b/api/src/main/java/com/cloud/network/vpc/Vpc.java index e9a831c9d839..a0686e2bf7d0 100644 --- a/api/src/main/java/com/cloud/network/vpc/Vpc.java +++ b/api/src/main/java/com/cloud/network/vpc/Vpc.java @@ -105,4 +105,8 @@ public enum State { String getIp6Dns1(); String getIp6Dns2(); + + boolean useRouterIpAsResolver(); + + boolean getKeepMacAddressOnPublicNic(); } diff --git a/api/src/main/java/com/cloud/network/vpc/VpcOffering.java b/api/src/main/java/com/cloud/network/vpc/VpcOffering.java index 38263f59667c..f84602232159 100644 --- a/api/src/main/java/com/cloud/network/vpc/VpcOffering.java +++ b/api/src/main/java/com/cloud/network/vpc/VpcOffering.java @@ -32,6 +32,8 @@ public enum State { public static final String redundantVPCOfferingName = "Redundant VPC offering"; public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode"; public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode"; + public static final String DEFAULT_VPC_ROUTE_NETRIS_OFFERING_NAME = "VPC offering with Netris - Route Mode"; + public static final String DEFAULT_VPC_NAT_NETRIS_OFFERING_NAME = "VPC offering with Netris - NAT Mode"; /** * @@ -56,8 +58,6 @@ public enum State { */ boolean isDefault(); - boolean isForNsx(); - NetworkOffering.NetworkMode getNetworkMode(); /** @@ -84,4 +84,6 @@ public enum State { NetworkOffering.RoutingMode getRoutingMode(); Boolean isSpecifyAsNumber(); + + boolean isConserveMode(); } diff --git a/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java index 10f1ddcc12d6..891cfb02d9df 100644 --- a/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java +++ b/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Map; +import org.apache.cloudstack.api.command.admin.vpc.CloneVPCOfferingCmd; import org.apache.cloudstack.api.command.admin.vpc.CreateVPCOfferingCmd; import org.apache.cloudstack.api.command.admin.vpc.UpdateVPCOfferingCmd; import org.apache.cloudstack.api.command.user.vpc.ListVPCOfferingsCmd; @@ -34,12 +35,14 @@ public interface VpcProvisioningService { VpcOffering createVpcOffering(CreateVPCOfferingCmd cmd); + VpcOffering cloneVPCOffering(CloneVPCOfferingCmd cmd); + VpcOffering createVpcOffering(String name, String displayText, List supportedServices, Map> serviceProviders, Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol, - Long serviceOfferingId, Boolean forNsx, NetworkOffering.NetworkMode networkMode, + Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode, List domainIds, List zoneIds, VpcOffering.State state, - NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber); + NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber, boolean conserveMode); Pair,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd); diff --git a/api/src/main/java/com/cloud/network/vpc/VpcService.java b/api/src/main/java/com/cloud/network/vpc/VpcService.java index af2a9847a62d..3d0ba43263f5 100644 --- a/api/src/main/java/com/cloud/network/vpc/VpcService.java +++ b/api/src/main/java/com/cloud/network/vpc/VpcService.java @@ -48,17 +48,17 @@ public interface VpcService { * @param vpcName * @param displayText * @param cidr - * @param networkDomain TODO + * @param networkDomain TODO * @param ip4Dns1 * @param ip4Dns2 - * @param displayVpc TODO + * @param displayVpc TODO + * @param useVrIpResolver * @return * @throws ResourceAllocationException TODO */ Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain, String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize, - Long asNumber, List bgpPeerIds) - throws ResourceAllocationException; + Long asNumber, List bgpPeerIds, Boolean useVrIpResolver, boolean keepMacAddressOnPublicNic) throws ResourceAllocationException; /** * Persists VPC record in the database @@ -104,7 +104,7 @@ Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, Strin * @throws ResourceUnavailableException if during restart some resources may not be available * @throws InsufficientCapacityException if for instance no address space, compute or storage is sufficiently available */ - Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp) throws ResourceUnavailableException, InsufficientCapacityException; + Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp, Boolean keepMacAddressOnPublicNic) throws ResourceUnavailableException, InsufficientCapacityException; /** * Lists VPC(s) based on the parameters passed to the API call @@ -238,7 +238,7 @@ Pair, Integer> listVpcs(Long id, String vpcName, String disp * @param cidr * @return */ - StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException; + StaticRoute createStaticRoute(Long gatewayId, Long vpcId, String nextHop, String cidr) throws NetworkRuleConflictException; /** * Lists static routes based on parameters passed to the call diff --git a/api/src/main/java/com/cloud/offering/DiskOffering.java b/api/src/main/java/com/cloud/offering/DiskOffering.java index e1c41f77cbf5..d74f5703cc99 100644 --- a/api/src/main/java/com/cloud/offering/DiskOffering.java +++ b/api/src/main/java/com/cloud/offering/DiskOffering.java @@ -37,7 +37,7 @@ enum State { State getState(); enum DiskCacheMode { - NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"); + NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"), HYPERVISOR_DEFAULT("hypervisor_default"); private final String _diskCacheMode; @@ -69,6 +69,8 @@ public String toString() { boolean isCustomized(); + boolean isShared(); + void setDiskSize(long diskSize); long getDiskSize(); @@ -99,7 +101,6 @@ public String toString() { Long getBytesReadRateMaxLength(); - void setBytesWriteRate(Long bytesWriteRate); Long getBytesWriteRate(); @@ -112,7 +113,6 @@ public String toString() { Long getBytesWriteRateMaxLength(); - void setIopsReadRate(Long iopsReadRate); Long getIopsReadRate(); @@ -133,7 +133,6 @@ public String toString() { Long getIopsWriteRateMax(); - void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength); Long getIopsWriteRateMaxLength(); diff --git a/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java b/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java index d83039e15c2b..12dcf423e34f 100644 --- a/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java +++ b/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java @@ -31,6 +31,13 @@ public DiskOfferingInfo(DiskOffering diskOffering) { _diskOffering = diskOffering; } + public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) { + _diskOffering = diskOffering; + _size = size; + _minIops = minIops; + _maxIops = maxIops; + } + public void setDiskOffering(DiskOffering diskOffering) { _diskOffering = diskOffering; } diff --git a/api/src/main/java/com/cloud/offering/NetworkOffering.java b/api/src/main/java/com/cloud/offering/NetworkOffering.java index 7011aea679ee..5000a4f8c626 100644 --- a/api/src/main/java/com/cloud/offering/NetworkOffering.java +++ b/api/src/main/java/com/cloud/offering/NetworkOffering.java @@ -64,6 +64,8 @@ enum RoutingMode { public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC = "DefaultNATNSXNetworkOfferingForVpc"; public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC_WITH_ILB = "DefaultNATNSXNetworkOfferingForVpcWithInternalLB"; public static final String DEFAULT_ROUTED_NSX_OFFERING_FOR_VPC = "DefaultRoutedNSXNetworkOfferingForVpc"; + public static final String DEFAULT_ROUTED_NETRIS_OFFERING_FOR_VPC = "DefaultRoutedNetrisNetworkOfferingForVpc"; + public static final String DEFAULT_NAT_NETRIS_OFFERING_FOR_VPC = "DefaultNATNetrisNetworkOfferingForVpc"; public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering"; public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering"; public final static String QuickCloudNoServices = "QuickCloudNoServices"; @@ -102,10 +104,6 @@ enum RoutingMode { boolean isForVpc(); - boolean isForTungsten(); - - boolean isForNsx(); - NetworkMode getNetworkMode(); TrafficType getTrafficType(); diff --git a/api/src/main/java/com/cloud/offering/ServiceOffering.java b/api/src/main/java/com/cloud/offering/ServiceOffering.java index acb7a9f1cf91..532123e4373a 100644 --- a/api/src/main/java/com/cloud/offering/ServiceOffering.java +++ b/api/src/main/java/com/cloud/offering/ServiceOffering.java @@ -142,4 +142,8 @@ enum StorageType { Boolean getDiskOfferingStrictness(); void setDiskOfferingStrictness(boolean diskOfferingStrictness); + + Long getVgpuProfileId(); + + Integer getGpuCount(); } diff --git a/api/src/main/java/com/cloud/org/Cluster.java b/api/src/main/java/com/cloud/org/Cluster.java index 5124168084c6..b0aa6bb04cf2 100644 --- a/api/src/main/java/com/cloud/org/Cluster.java +++ b/api/src/main/java/com/cloud/org/Cluster.java @@ -41,4 +41,6 @@ public static enum ClusterType { ManagedState getManagedState(); CPU.CPUArch getArch(); + + String getStorageAccessGroups(); } diff --git a/api/src/main/java/com/cloud/projects/ProjectService.java b/api/src/main/java/com/cloud/projects/ProjectService.java index 5080cb5a7812..d11e9ae0446d 100644 --- a/api/src/main/java/com/cloud/projects/ProjectService.java +++ b/api/src/main/java/com/cloud/projects/ProjectService.java @@ -82,7 +82,7 @@ public interface ProjectService { Project updateProject(long id, String name, String displayText, String newOwnerName, Long userId, Role newRole) throws ResourceAllocationException; - boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType); + boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType) throws ResourceAllocationException; boolean deleteAccountFromProject(long projectId, String accountName); @@ -100,6 +100,6 @@ public interface ProjectService { Project findByProjectAccountIdIncludingRemoved(long projectAccountId); - boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole); + boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole) throws ResourceAllocationException; } diff --git a/api/src/main/java/com/cloud/resource/ResourceService.java b/api/src/main/java/com/cloud/resource/ResourceService.java index 562c3c418df1..3cdf8fc64e99 100644 --- a/api/src/main/java/com/cloud/resource/ResourceService.java +++ b/api/src/main/java/com/cloud/resource/ResourceService.java @@ -95,4 +95,11 @@ public interface ResourceService { boolean releaseHostReservation(Long hostId); + void updatePodStorageAccessGroups(long podId, List newStorageAccessGroups); + + void updateZoneStorageAccessGroups(long zoneId, List newStorageAccessGroups); + + void updateClusterStorageAccessGroups(Long clusterId, List newStorageAccessGroups); + + void updateHostStorageAccessGroups(Long hostId, List newStorageAccessGroups); } diff --git a/api/src/main/java/com/cloud/resource/ResourceState.java b/api/src/main/java/com/cloud/resource/ResourceState.java index 70738c7921bc..e91cf820b081 100644 --- a/api/src/main/java/com/cloud/resource/ResourceState.java +++ b/api/src/main/java/com/cloud/resource/ResourceState.java @@ -76,6 +76,10 @@ public static Event toEvent(String e) { } } + public static List s_maintenanceStates = List.of(ResourceState.Maintenance, + ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance, + ResourceState.ErrorInPrepareForMaintenance); + public ResourceState getNextState(Event a) { return s_fsm.getNextState(this, a); } @@ -98,8 +102,7 @@ public static String[] toString(ResourceState... states) { } public static boolean isMaintenanceState(ResourceState state) { - return Arrays.asList(ResourceState.Maintenance, ResourceState.ErrorInMaintenance, - ResourceState.PrepareForMaintenance, ResourceState.ErrorInPrepareForMaintenance).contains(state); + return s_maintenanceStates.contains(state); } public static boolean canAttemptMaintenance(ResourceState state) { diff --git a/api/src/main/java/com/cloud/server/ManagementService.java b/api/src/main/java/com/cloud/server/ManagementService.java index 18f3e901cd93..bcca229c06bc 100644 --- a/api/src/main/java/com/cloud/server/ManagementService.java +++ b/api/src/main/java/com/cloud/server/ManagementService.java @@ -20,21 +20,24 @@ import java.util.List; import java.util.Map; -import com.cloud.user.UserData; import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd; import org.apache.cloudstack.api.command.admin.config.ListCfgGroupsByCmd; import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd; import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd; +import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCategoryCmd; import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCmd; import org.apache.cloudstack.api.command.admin.guest.AddGuestOsMappingCmd; +import org.apache.cloudstack.api.command.admin.guest.DeleteGuestOsCategoryCmd; import org.apache.cloudstack.api.command.admin.guest.GetHypervisorGuestOsNamesCmd; import org.apache.cloudstack.api.command.admin.guest.ListGuestOsMappingCmd; import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsCmd; import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsMappingCmd; +import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCategoryCmd; import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCmd; import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd; +import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd; import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd; import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd; import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd; @@ -59,8 +62,10 @@ import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd; import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd; +import org.apache.cloudstack.api.command.user.userdata.DeleteCniConfigurationCmd; import org.apache.cloudstack.api.command.user.userdata.DeleteUserDataCmd; import org.apache.cloudstack.api.command.user.userdata.ListUserDataCmd; +import org.apache.cloudstack.api.command.user.userdata.RegisterCniConfigurationCmd; import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd; import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd; import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd; @@ -71,6 +76,8 @@ import com.cloud.capacity.Capacity; import com.cloud.dc.Pod; import com.cloud.dc.Vlan; +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ManagementServerException; import com.cloud.exception.ResourceUnavailableException; @@ -85,11 +92,13 @@ import com.cloud.storage.GuestOsCategory; import com.cloud.storage.StoragePool; import com.cloud.user.SSHKeyPair; +import com.cloud.user.UserData; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; import com.cloud.vm.InstanceGroup; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.VirtualMachineProfile; /** * Hopefully this is temporary. @@ -168,6 +177,12 @@ public interface ManagementService { */ Pair, Integer> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd); + GuestOsCategory addGuestOsCategory(AddGuestOsCategoryCmd cmd); + + GuestOsCategory updateGuestOsCategory(UpdateGuestOsCategoryCmd cmd); + + boolean deleteGuestOsCategory(DeleteGuestOsCategoryCmd cmd); + /** * Obtains a list of all guest OS mappings * @@ -360,17 +375,23 @@ public interface ManagementService { * The api command class. * @return The list of userdatas found. */ - Pair, Integer> listUserDatas(ListUserDataCmd cmd); + Pair, Integer> listUserDatas(ListUserDataCmd cmd, boolean forCks); + + /** + * Registers a cni configuration. + * + * @param cmd The api command class. + * @return A VO with the registered user data. + */ + UserData registerCniConfiguration(RegisterCniConfigurationCmd cmd); /** * Registers a userdata. * - * @param cmd - * The api command class. + * @param cmd The api command class. * @return A VO with the registered userdata. */ UserData registerUserData(RegisterUserDataCmd cmd); - /** * Deletes a userdata. * @@ -380,6 +401,14 @@ public interface ManagementService { */ boolean deleteUserData(DeleteUserDataCmd cmd); + /** + * Deletes user data. + * + * @param cmd + * The api command class. + * @return True on success. False otherwise. + */ + boolean deleteCniConfiguration(DeleteCniConfigurationCmd cmd); /** * Search registered key pairs for the logged in user. * @@ -443,6 +472,19 @@ public interface ManagementService { Ternary, Integer>, List, Map> listHostsForMigrationOfVM(VirtualMachine vm, Long startIndex, Long pageSize, String keyword, List vmList); + /** + * Apply affinity group constraints and other exclusion rules for VM migration. + * This is a helper method that can be used independently for per-iteration affinity checks in DRS. + * + * @param vm The virtual machine to migrate + * @param vmProfile The VM profile + * @param plan The deployment plan + * @param vmList List of VMs with current/simulated placements for affinity processing + * @return ExcludeList containing hosts to avoid + */ + ExcludeList applyAffinityConstraints(VirtualMachine vm, VirtualMachineProfile vmProfile, + DeploymentPlan plan, List vmList); + /** * List storage pools for live migrating of a volume. The API returns list of all pools in the cluster to which the * volume can be migrated. Current pool is not included in the list. In case of vSphere datastore cluster storage pools, @@ -481,4 +523,6 @@ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableE Pair patchSystemVM(PatchSystemVMCmd cmd); + boolean removeManagementServer(RemoveManagementServerCmd cmd); + } diff --git a/api/src/main/java/com/cloud/server/ResourceIconManager.java b/api/src/main/java/com/cloud/server/ResourceIconManager.java index e5111d9160b8..d10b3eb0cd5b 100644 --- a/api/src/main/java/com/cloud/server/ResourceIconManager.java +++ b/api/src/main/java/com/cloud/server/ResourceIconManager.java @@ -16,7 +16,9 @@ // under the License. package com.cloud.server; +import java.util.Collection; import java.util.List; +import java.util.Map; public interface ResourceIconManager { @@ -25,4 +27,8 @@ public interface ResourceIconManager { boolean deleteResourceIcon(List resourceIds, ResourceTag.ResourceObjectType resourceType); ResourceIcon getByResourceTypeAndUuid(ResourceTag.ResourceObjectType type, String resourceId); + + Map getByResourceTypeAndIds(ResourceTag.ResourceObjectType type, Collection resourceIds); + + Map getByResourceTypeAndUuids(ResourceTag.ResourceObjectType type, Collection resourceUuids); } diff --git a/api/src/main/java/com/cloud/server/ResourceManagerUtil.java b/api/src/main/java/com/cloud/server/ResourceManagerUtil.java index 9a3b51a70d56..f5081cbe307b 100644 --- a/api/src/main/java/com/cloud/server/ResourceManagerUtil.java +++ b/api/src/main/java/com/cloud/server/ResourceManagerUtil.java @@ -18,6 +18,7 @@ public interface ResourceManagerUtil { long getResourceId(String resourceId, ResourceTag.ResourceObjectType resourceType); + long getResourceId(String resourceId, ResourceTag.ResourceObjectType resourceType, boolean checkAccess); String getUuid(String resourceId, ResourceTag.ResourceObjectType resourceType); ResourceTag.ResourceObjectType getResourceType(String resourceTypeStr); void checkResourceAccessible(Long accountId, Long domainId, String exceptionMessage); diff --git a/api/src/main/java/com/cloud/server/ResourceTag.java b/api/src/main/java/com/cloud/server/ResourceTag.java index 9bbb5d43eaeb..32305753f1ae 100644 --- a/api/src/main/java/com/cloud/server/ResourceTag.java +++ b/api/src/main/java/com/cloud/server/ResourceTag.java @@ -16,14 +16,14 @@ // under the License. package com.cloud.server; -import org.apache.cloudstack.acl.ControlledEntity; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - import java.util.HashMap; import java.util.Locale; import java.util.Map; +import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + public interface ResourceTag extends ControlledEntity, Identity, InternalIdentity { // FIXME - extract enum to another interface as its used both by resourceTags and resourceMetaData code @@ -66,10 +66,11 @@ public enum ResourceObjectType { LBStickinessPolicy(false, true), LBHealthCheckPolicy(false, true), SnapshotPolicy(true, true), + GuestOsCategory(false, false, true), GuestOs(false, true), NetworkOffering(false, true), VpcOffering(true, false), - Domain(false, false, true), + Domain(true, false, true), ObjectStore(false, false, true); diff --git a/api/src/main/java/com/cloud/storage/GuestOsCategory.java b/api/src/main/java/com/cloud/storage/GuestOsCategory.java index b46418d5c8f9..e1ee44891582 100644 --- a/api/src/main/java/com/cloud/storage/GuestOsCategory.java +++ b/api/src/main/java/com/cloud/storage/GuestOsCategory.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.storage; +import java.util.Date; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; @@ -27,4 +29,7 @@ public interface GuestOsCategory extends Identity, InternalIdentity { void setName(String name); + boolean isFeatured(); + + Date getCreated(); } diff --git a/api/src/main/java/com/cloud/storage/Snapshot.java b/api/src/main/java/com/cloud/storage/Snapshot.java index fc919e442b2e..c0a7b812ed9e 100644 --- a/api/src/main/java/com/cloud/storage/Snapshot.java +++ b/api/src/main/java/com/cloud/storage/Snapshot.java @@ -48,7 +48,7 @@ public boolean equals(String snapshotType) { } public enum State { - Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed, + Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed, Hidden, //it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage Error; diff --git a/api/src/main/java/com/cloud/storage/Storage.java b/api/src/main/java/com/cloud/storage/Storage.java index 05b8b3ab7a86..5b3e97698fda 100644 --- a/api/src/main/java/com/cloud/storage/Storage.java +++ b/api/src/main/java/com/cloud/storage/Storage.java @@ -30,6 +30,7 @@ public static enum ImageFormat { OVA(true, true, true, "ova"), VHDX(true, true, true, "vhdx"), BAREMETAL(false, false, false, "BAREMETAL"), + EXTERNAL(false, false, false, "EXTERNAL"), VMDK(true, true, false, "vmdk"), VDI(true, true, false, "vdi"), TAR(false, false, false, "tar"), @@ -127,7 +128,7 @@ public static enum FileSystem { public static enum TemplateType { ROUTING, // Router template SYSTEM, /* routing, system vm template */ - BUILTIN, /* buildin template */ + BUILTIN, /* builtin template */ PERHOST, /* every host has this template, don't need to install it in secondary storage */ USER, /* User supplied template/iso */ VNF, /* VNFs (virtual network functions) template */ diff --git a/api/src/main/java/com/cloud/storage/StorageService.java b/api/src/main/java/com/cloud/storage/StorageService.java index b8df75cd3e4c..a29c8f6aecef 100644 --- a/api/src/main/java/com/cloud/storage/StorageService.java +++ b/api/src/main/java/com/cloud/storage/StorageService.java @@ -22,6 +22,7 @@ import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; import org.apache.cloudstack.api.command.admin.storage.ChangeStoragePoolScopeCmd; +import org.apache.cloudstack.api.command.admin.storage.ConfigureStorageAccessCmd; import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd; @@ -99,6 +100,8 @@ public interface StorageService { StoragePool disablePrimaryStoragePool(Long id); + boolean configureStorageAccess(ConfigureStorageAccessCmd cmd); + StoragePool getStoragePool(long id); boolean deleteImageStore(DeleteImageStoreCmd cmd); @@ -131,7 +134,7 @@ public interface StorageService { void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd); - ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; + ObjectStore discoverObjectStore(String name, String url, Long size, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd); diff --git a/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java index f43d5331222f..7d5b2d7c57d7 100644 --- a/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java +++ b/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java @@ -17,14 +17,18 @@ package com.cloud.storage; import java.util.Date; +import java.util.List; import org.apache.cloudstack.api.InternalIdentity; public interface VMTemplateStorageResourceAssoc extends InternalIdentity { public static enum Status { - UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED + UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, LIMIT_REACHED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED } + List ERROR_DOWNLOAD_STATES = List.of(Status.DOWNLOAD_ERROR, Status.ABANDONED, Status.LIMIT_REACHED, Status.UNKNOWN); + List PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS); + String getInstallPath(); long getTemplateId(); diff --git a/api/src/main/java/com/cloud/storage/VolumeApiService.java b/api/src/main/java/com/cloud/storage/VolumeApiService.java index b7b5423244cf..43ead8d287b9 100644 --- a/api/src/main/java/com/cloud/storage/VolumeApiService.java +++ b/api/src/main/java/com/cloud/storage/VolumeApiService.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; +import com.cloud.dc.DataCenter; import com.cloud.exception.ResourceAllocationException; import com.cloud.offering.DiskOffering; import com.cloud.user.Account; @@ -56,9 +57,9 @@ public interface VolumeApiService { Boolean.class, "use.https.to.upload", "true", - "Determines the protocol (HTTPS or HTTP) ACS will use to generate links to upload ISOs, volumes, and templates. When set as 'true', ACS will use protocol HTTPS, otherwise, it will use protocol HTTP. Default value is 'true'.", + "Controls whether upload links for ISOs, volumes, and templates use HTTPS (true, default) or HTTP (false). After changing this setting, the Secondary Storage VM (SSVM) must be recreated", true, - ConfigKey.Scope.StoragePool); + ConfigKey.Scope.Zone); /** * Creates the database object for a volume based on the given criteria @@ -70,6 +71,10 @@ public interface VolumeApiService { */ Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException; + Volume allocVolume(long ownerId, Long zoneId, Long diskOfferingId, Long vmId, Long snapshotId, String name, + Long cmdSize, Boolean displayVolume, Long cmdMinIops, Long cmdMaxIops, String customId) + throws ResourceAllocationException; + /** * Creates the volume based on the given criteria * @@ -80,6 +85,8 @@ public interface VolumeApiService { */ Volume createVolume(CreateVolumeCmd cmd); + Volume createVolume(long volumeId, Long vmId, Long snapshotId, Long storageId, Boolean display); + /** * Resizes the volume based on the given criteria * @@ -113,10 +120,10 @@ public interface VolumeApiService { Volume detachVolumeFromVM(DetachVolumeCmd cmd); - Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map tags, List zoneIds) + Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map tags, List zoneIds, List poolIds, Boolean useStorageReplication) throws ResourceAllocationException; - Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List zoneIds) throws ResourceAllocationException; + Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List zoneIds, List storagePoolIds, Boolean useStorageReplication) throws ResourceAllocationException; Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, Boolean deleteProtection, @@ -137,7 +144,7 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId, void updateDisplay(Volume volume, Boolean displayVolume); - Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName) throws ResourceAllocationException; + Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName, Long vmSnapshotId) throws ResourceAllocationException; /** * Checks if the storage pool supports the disk offering tags. @@ -171,8 +178,17 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId, * */ boolean doesStoragePoolSupportDiskOffering(StoragePool destPool, DiskOffering diskOffering); + + /** + * Checks if the storage pool supports the required disk offering tags + * destPool the storage pool to check the disk offering tags + * diskOfferingTags the tags that should be supported + * return whether the tags are supported in the storage pool + */ boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags); + boolean validateConditionsToReplaceDiskOfferingOfVolume(Volume volume, DiskOffering newDiskOffering, StoragePool destPool); + Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge); void destroyVolume(long volumeId); @@ -194,4 +210,6 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId, Pair checkAndRepairVolume(CheckAndRepairVolumeCmd cmd) throws ResourceAllocationException; Long getVolumePhysicalSize(Storage.ImageFormat format, String path, String chainInfo); + + Long getCustomDiskOfferingIdForVolumeUpload(Account owner, DataCenter zone, boolean encryptEnabledOnly); } diff --git a/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java index 67afd6aa4e24..d52e645ec799 100644 --- a/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java +++ b/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java @@ -85,7 +85,7 @@ public interface SnapshotApiService { * the command that specifies the volume criteria * @return list of snapshot policies */ - Pair, Integer> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd); + Pair, Integer> listSnapshotPolicies(ListSnapshotPoliciesCmd cmd); boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd); diff --git a/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java index 22d5dfb9c1b8..13009a9808aa 100644 --- a/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java +++ b/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java @@ -16,11 +16,12 @@ // under the License. package com.cloud.storage.snapshot; +import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Displayable; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -public interface SnapshotPolicy extends Identity, InternalIdentity, Displayable { +public interface SnapshotPolicy extends ControlledEntity, Identity, InternalIdentity, Displayable { long getVolumeId(); diff --git a/api/src/main/java/com/cloud/template/TemplateApiService.java b/api/src/main/java/com/cloud/template/TemplateApiService.java index 5b494c308c3c..6138f24c92b0 100644 --- a/api/src/main/java/com/cloud/template/TemplateApiService.java +++ b/api/src/main/java/com/cloud/template/TemplateApiService.java @@ -58,10 +58,23 @@ public interface TemplateApiService { VirtualMachineTemplate prepareTemplate(long templateId, long zoneId, Long storageId); + /** + * Detach ISO from VM + * @param vmId id of the VM + * @param isoId id of the ISO (when passed). If it is not passed, it will get it from user_vm table + * @param extraParams forced, isVirtualRouter + * @return true when operation succeeds, false if not + */ + boolean detachIso(long vmId, Long isoId, Boolean... extraParams); - boolean detachIso(long vmId, boolean forced); - - boolean attachIso(long isoId, long vmId, boolean forced); + /** + * Attach ISO to a VM + * @param isoId id of the ISO to attach + * @param vmId id of the VM to attach the ISO to + * @param extraParams: forced, isVirtualRouter + * @return true when operation succeeds, false if not + */ + boolean attachIso(long isoId, long vmId, Boolean... extraParams); /** * Deletes a template diff --git a/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java b/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java index d8872d5fe724..b8c646048b97 100644 --- a/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java +++ b/api/src/main/java/com/cloud/template/VirtualMachineTemplate.java @@ -145,10 +145,14 @@ public enum TemplateFilter { boolean isDeployAsIs(); + boolean isForCks(); + Long getUserDataId(); UserData.UserDataOverridePolicy getUserDataOverridePolicy(); CPU.CPUArch getArch(); + Long getExtensionId(); + } diff --git a/api/src/main/java/com/cloud/user/Account.java b/api/src/main/java/com/cloud/user/Account.java index 6be4d0a48f6e..1cc5eae64a66 100644 --- a/api/src/main/java/com/cloud/user/Account.java +++ b/api/src/main/java/com/cloud/user/Account.java @@ -71,6 +71,7 @@ public static Type getFromValue(Integer type){ } public static final long ACCOUNT_ID_SYSTEM = 1; + public static final long ACCOUNT_ID_ADMIN = 2; public String getAccountName(); diff --git a/api/src/main/java/com/cloud/user/AccountService.java b/api/src/main/java/com/cloud/user/AccountService.java index e2c3bed0c295..fc450e9179c5 100644 --- a/api/src/main/java/com/cloud/user/AccountService.java +++ b/api/src/main/java/com/cloud/user/AccountService.java @@ -21,12 +21,13 @@ import com.cloud.utils.Pair; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.acl.RolePermissionEntity; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd; -import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd; -import org.apache.cloudstack.api.command.admin.user.RegisterCmd; -import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd; import com.cloud.dc.DataCenter; import com.cloud.domain.Domain; @@ -35,7 +36,16 @@ import com.cloud.offering.DiskOffering; import com.cloud.offering.NetworkOffering; import com.cloud.offering.ServiceOffering; +import org.apache.cloudstack.api.command.admin.user.DeleteUserKeysCmd; +import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd; +import org.apache.cloudstack.api.command.admin.user.ListUserKeyRulesCmd; +import org.apache.cloudstack.api.command.admin.user.ListUserKeysCmd; +import org.apache.cloudstack.api.command.admin.user.RegisterUserKeysCmd; +import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; +import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.auth.UserTwoFactorAuthenticator; +import org.apache.cloudstack.backup.BackupOffering; public interface AccountService { @@ -58,7 +68,8 @@ UserAccount createUserAccount(String userName, String password, String firstName User getSystemUser(); - User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID); + User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, + String accountName, Long domainId, String userUUID, boolean isPasswordChangeRequired); User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, User.Source source); @@ -77,23 +88,31 @@ User createUser(String userName, String password, String firstName, String lastN Account getActiveAccountById(long accountId); + Account getActiveAccountByUuid(String accountUuid); + Account getAccount(long accountId); + Account getAccountByUuid(String accountUuid); + User getActiveUser(long userId); + User getOneActiveUserForAccount(Account account); + User getUserIncludingRemoved(long userId); boolean isRootAdmin(Long accountId); boolean isDomainAdmin(Long accountId); + boolean isResourceDomainAdmin(Long accountId); + boolean isNormalUser(long accountId); User getActiveUserByRegistrationToken(String registrationToken); void markUserRegistered(long userId); - public String[] createApiKeyAndSecretKey(RegisterCmd cmd); + ApiKeyPair createApiKeyAndSecretKey(RegisterUserKeysCmd cmd); public String[] createApiKeyAndSecretKey(final long userId); @@ -113,13 +132,19 @@ User createUser(String userName, String password, String firstName, String lastN void checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException; + void checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException; + void checkAccess(User user, ControlledEntity entity); void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName, ControlledEntity... entities) throws PermissionDeniedException; void validateAccountHasAccessToResource(Account account, AccessType accessType, Object resource); - Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly); + void validateCallingUserHasAccessToDesiredUser(Long userId); + + Long finalizeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly); + + Long finalizeAccountId(Long accountId, String accountName, Long domainId, Long projectId); /** * returns the user account object for a given user id @@ -128,9 +153,15 @@ User createUser(String userName, String password, String firstName, String lastN */ UserAccount getUserAccountById(Long userId); - public Pair> getKeys(GetUserKeysCmd cmd); + Pair> getKeys(GetUserKeysCmd cmd); + + ListResponse listKeys(ListUserKeysCmd cmd); + + List listKeyRules(ListUserKeyRulesCmd cmd); + + void deleteApiKey(DeleteUserKeysCmd cmd); - public Pair> getKeys(Long userId); + void deleteApiKey(ApiKeyPair id); /** * Lists user two-factor authentication provider plugins @@ -145,4 +176,13 @@ User createUser(String userName, String password, String firstName, String lastN */ UserTwoFactorAuthenticator getUserTwoFactorAuthenticationProvider(final Long domainId); + ApiKeyPair getLatestUserKeyPair(Long userId); + + ApiKeyPair getKeyPairById(Long id); + + ApiKeyPair getKeyPairByApiKey(String apiKey); + + String getAccessingApiKey(BaseCmd cmd); + + List getAllKeypairPermissions(String apiKey); } diff --git a/api/src/main/java/com/cloud/user/ApiKeyPairState.java b/api/src/main/java/com/cloud/user/ApiKeyPairState.java new file mode 100644 index 000000000000..63405c62e320 --- /dev/null +++ b/api/src/main/java/com/cloud/user/ApiKeyPairState.java @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.user; + +public enum ApiKeyPairState { + ENABLED, REMOVED, EXPIRED +} diff --git a/api/src/main/java/com/cloud/user/ResourceLimitService.java b/api/src/main/java/com/cloud/user/ResourceLimitService.java index 2f4ad1347be5..9c493fb383c9 100644 --- a/api/src/main/java/com/cloud/user/ResourceLimitService.java +++ b/api/src/main/java/com/cloud/user/ResourceLimitService.java @@ -30,11 +30,12 @@ import com.cloud.offering.DiskOffering; import com.cloud.offering.ServiceOffering; import com.cloud.template.VirtualMachineTemplate; +import org.apache.cloudstack.resourcelimit.Reserver; public interface ResourceLimitService { static final ConfigKey MaxAccountSecondaryStorage = new ConfigKey<>("Account Defaults", Long.class, "max.account.secondary.storage", "400", - "The default maximum secondary storage space (in GiB) that can be used for an account", false); + "The default maximum secondary storage space (in GiB) that can be used for an Account", false); static final ConfigKey MaxProjectSecondaryStorage = new ConfigKey<>("Project Defaults", Long.class, "max.project.secondary.storage", "400", "The default maximum secondary storage space (in GiB) that can be used for a project", false); static final ConfigKey ResourceCountCheckInterval = new ConfigKey<>("Advanced", Long.class, "resourcecount.check.interval", "300", @@ -50,8 +51,14 @@ public interface ResourceLimitService { "The default maximum number of projects that can be created for an account",false); static final ConfigKey DefaultMaxDomainProjects = new ConfigKey<>("Domain Defaults",Long.class,"max.domain.projects","50", "The default maximum number of projects that can be created for a domain",false); - - static final List HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory); + static final ConfigKey DefaultMaxAccountGpus = new ConfigKey<>("Account Defaults",Long.class,"max.account.gpus","20", + "The default maximum number of GPU devices that can be used for an account", false); + static final ConfigKey DefaultMaxDomainGpus = new ConfigKey<>("Domain Defaults",Long.class,"max.domain.gpus","20", + "The default maximum number of GPU devices that can be used for a domain", false); + static final ConfigKey DefaultMaxProjectGpus = new ConfigKey<>("Project Defaults",Long.class,"max.project.gpus","20", + "The default maximum number of GPU devices that can be used for a project", false); + + static final List HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory, ResourceType.gpu); static final List StorageTagsSupportingTypes = List.of(ResourceType.volume, ResourceType.primary_storage); /** @@ -185,6 +192,7 @@ public interface ResourceLimitService { */ public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException; public void checkResourceLimitWithTag(Account account, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException; + public void checkResourceLimitWithTag(Account account, Long domainId, boolean considerSystemAccount, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException; /** * Gets the count of resources for a resource type and account @@ -245,12 +253,12 @@ public interface ResourceLimitService { List getResourceLimitStorageTags(DiskOffering diskOffering); void updateTaggedResourceLimitsAndCountsForAccounts(List responses, String tag); void updateTaggedResourceLimitsAndCountsForDomains(List responses, String tag); - void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException; - + void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List reservations) throws ResourceAllocationException; + List getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering); void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize, - DiskOffering currentOffering, DiskOffering newOffering) throws ResourceAllocationException; + DiskOffering currentOffering, DiskOffering newOffering, List reservations) throws ResourceAllocationException; - void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException; + void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List reservations) throws ResourceAllocationException; void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering); void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering); @@ -267,21 +275,23 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering); void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering); - void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException; + void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, List reservations) throws ResourceAllocationException; void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template); void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template); void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu, - Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException; + Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template, List reservations) throws ResourceAllocationException; void checkVmResourceLimitsForTemplateChange(Account owner, Boolean display, ServiceOffering offering, - VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate) throws ResourceAllocationException; + VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate, List reservations) throws ResourceAllocationException; - void checkVmCpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu) throws ResourceAllocationException; void incrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu); void decrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu); - void checkVmMemoryResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory) throws ResourceAllocationException; void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory); void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory); + void incrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu); + void decrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu); + + long recalculateDomainResourceCount(final long domainId, final ResourceType type, String tag); } diff --git a/api/src/main/java/com/cloud/user/User.java b/api/src/main/java/com/cloud/user/User.java index 041b39ad2729..da7245a47980 100644 --- a/api/src/main/java/com/cloud/user/User.java +++ b/api/src/main/java/com/cloud/user/User.java @@ -65,14 +65,6 @@ public enum Source { public void setState(Account.State state); - public String getApiKey(); - - public void setApiKey(String apiKey); - - public String getSecretKey(); - - public void setSecretKey(String secretKey); - public String getTimezone(); public void setTimezone(String timezone); diff --git a/api/src/main/java/com/cloud/user/UserAccount.java b/api/src/main/java/com/cloud/user/UserAccount.java index e6b07fb371eb..5736244e3259 100644 --- a/api/src/main/java/com/cloud/user/UserAccount.java +++ b/api/src/main/java/com/cloud/user/UserAccount.java @@ -39,10 +39,6 @@ public interface UserAccount extends InternalIdentity { String getState(); - String getApiKey(); - - String getSecretKey(); - Date getCreated(); Date getRemoved(); diff --git a/api/src/main/java/com/cloud/user/UserData.java b/api/src/main/java/com/cloud/user/UserData.java index fa0c50473c0d..13a3c74f3679 100644 --- a/api/src/main/java/com/cloud/user/UserData.java +++ b/api/src/main/java/com/cloud/user/UserData.java @@ -29,4 +29,5 @@ public enum UserDataOverridePolicy { String getUserData(); String getParams(); + boolean isForCks(); } diff --git a/api/src/main/java/com/cloud/vm/Nic.java b/api/src/main/java/com/cloud/vm/Nic.java index afc44b8d39fa..cc0b294205ca 100644 --- a/api/src/main/java/com/cloud/vm/Nic.java +++ b/api/src/main/java/com/cloud/vm/Nic.java @@ -162,4 +162,6 @@ public enum ReservationStrategy { String getIPv6Address(); Integer getMtu(); + + boolean isEnabled(); } diff --git a/api/src/main/java/com/cloud/vm/NicProfile.java b/api/src/main/java/com/cloud/vm/NicProfile.java index a0c80ceb1bfb..d3ed7b4b87d2 100644 --- a/api/src/main/java/com/cloud/vm/NicProfile.java +++ b/api/src/main/java/com/cloud/vm/NicProfile.java @@ -52,6 +52,7 @@ public class NicProfile implements InternalIdentity, Serializable { boolean defaultNic; Integer networkRate; boolean isSecurityGroupEnabled; + boolean enabled; Integer orderIndex; @@ -87,6 +88,7 @@ public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, broadcastType = network.getBroadcastDomainType(); trafficType = network.getTrafficType(); format = nic.getAddressFormat(); + enabled = nic.isEnabled(); iPv4Address = nic.getIPv4Address(); iPv4Netmask = nic.getIPv4Netmask(); @@ -414,6 +416,14 @@ public void setIpv4AllocationRaceCheck(boolean ipv4AllocationRaceCheck) { this.ipv4AllocationRaceCheck = ipv4AllocationRaceCheck; } + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + // // OTHER METHODS // diff --git a/api/src/main/java/com/cloud/vm/UserVmService.java b/api/src/main/java/com/cloud/vm/UserVmService.java index 72b18b70e186..67aa0534a5f3 100644 --- a/api/src/main/java/com/cloud/vm/UserVmService.java +++ b/api/src/main/java/com/cloud/vm/UserVmService.java @@ -16,14 +16,18 @@ // under the License. package com.cloud.vm; +import com.cloud.storage.Snapshot; +import com.cloud.storage.Volume; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import com.cloud.deploy.DeploymentPlan; import org.apache.cloudstack.api.BaseCmd.HTTPMethod; import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd; import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd; import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd; +import org.apache.cloudstack.api.command.user.vm.CreateVMFromBackupCmd; import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd; import org.apache.cloudstack.api.command.user.vm.RebootVMCmd; @@ -36,6 +40,7 @@ import org.apache.cloudstack.api.command.user.vm.StartVMCmd; import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd; import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd; +import org.apache.cloudstack.api.command.user.vm.UpdateVmNicCmd; import org.apache.cloudstack.api.command.user.vm.UpdateVmNicIpCmd; import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd; @@ -60,6 +65,7 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.uservm.UserVm; +import com.cloud.utils.Pair; import com.cloud.utils.exception.ExecutionException; public interface UserVmService { @@ -111,7 +117,7 @@ UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, E UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ResourceAllocationException; - void startVirtualMachine(UserVm vm) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException; + void startVirtualMachine(UserVm vm, DeploymentPlan plan) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException; void startVirtualMachineForHA(VirtualMachine vm, Map params, DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException, @@ -147,6 +153,8 @@ void startVirtualMachineForHA(VirtualMachine vm, Map securityGroupIdList, - Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, + Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard, List affinityGroupIdList, Map customParameter, String customId, Map> dhcpOptionMap, Map dataDiskTemplateToDiskOfferingMap, - Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId) throws InsufficientCapacityException, + Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; /** @@ -294,10 +302,10 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s * available. */ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, - List securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, + List securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList, Map customParameters, String customId, Map> dhcpOptionMap, - Map dataDiskTemplateToDiskOfferingMap, Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; + Map dataDiskTemplateToDiskOfferingMap, Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; /** * Creates a User VM in Advanced Zone (Security Group feature is disabled) @@ -366,10 +374,10 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin * available. */ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, Account owner, - String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, + String hostName, String displayName, Long diskOfferingId, Long diskSize, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList, Map customParameters, String customId, Map> dhcpOptionMap, Map dataDiskTemplateToDiskOfferingMap, - Map templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId) + Map templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; @@ -503,14 +511,44 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException void collectVmNetworkStatistics (UserVm userVm); - UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceName, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard, - final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey, + /** + * Import VM into CloudStack + * @param zone importing zone + * @param host importing host + * @param template template for the imported VM + * @param instanceNameInternal set to null to CloudStack to autogenerate from the next available VM ID on database + * @param displayName display name for the imported VM + * @param owner owner of the imported VM + * @param userData user data for the imported VM + * @param caller caller account + * @param isDisplayVm true to display the imported VM + * @param keyboard keyboard distribution for the imported VM + * @param accountId account ID + * @param userId user ID + * @param serviceOffering service offering for the imported VM + * @param sshPublicKey ssh key for the imported VM + * @param guestOsId guest OS ID for the imported VM (if not passed, then the guest OS of the template will be used) + * @param hostName the name for the imported VM + * @param hypervisorType hypervisor type for the imported VM + * @param customParameters details for the imported VM + * @param powerState power state of the imported VM + * @param networkNicMap network to nic mapping + * @return the imported VM + * @throws InsufficientCapacityException in case of errors + */ + UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceNameInternal, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard, + final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey, final Long guestOsId, final String hostName, final HypervisorType hypervisorType, final Map customParameters, final VirtualMachine.PowerState powerState, final LinkedHashMap> networkNicMap) throws InsufficientCapacityException; /** * Unmanage a guest VM from CloudStack - * @return true if the VM is successfully unmanaged, false if not. + * + * @return (true if successful, false if not, hostUuid) if the VM is successfully unmanaged. */ - boolean unmanageUserVM(Long vmId); + Pair unmanageUserVM(Long vmId, Long targetHostId); + + UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws InsufficientCapacityException, ResourceAllocationException, ResourceUnavailableException; + + UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException; } diff --git a/api/src/main/java/com/cloud/vm/VirtualMachine.java b/api/src/main/java/com/cloud/vm/VirtualMachine.java index e2ea408e7b8c..41c9a864c9d0 100644 --- a/api/src/main/java/com/cloud/vm/VirtualMachine.java +++ b/api/src/main/java/com/cloud/vm/VirtualMachine.java @@ -124,11 +124,13 @@ public static StateMachine2 getStat s_fsm.addTransition(new Transition(State.Stopping, VirtualMachine.Event.StopRequested, State.Stopping, null)); s_fsm.addTransition(new Transition(State.Stopping, VirtualMachine.Event.AgentReportShutdowned, State.Stopped, Arrays.asList(new Impact[]{Impact.USAGE}))); s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.OperationFailed, State.Expunging,null)); + // Note: In addition to the Stopped -> Error transition for failed VM creation, + // a VM can also transition from Expunging to Error on OperationFailedToError. + s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.OperationFailedToError, State.Error, null)); s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging,null)); s_fsm.addTransition(new Transition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging, null)); s_fsm.addTransition(new Transition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging, null)); s_fsm.addTransition(new Transition(State.Stopped, Event.RestoringRequested, State.Restoring, null)); - s_fsm.addTransition(new Transition(State.Expunging, Event.RestoringRequested, State.Restoring, null)); s_fsm.addTransition(new Transition(State.Destroyed, Event.RestoringRequested, State.Restoring, null)); s_fsm.addTransition(new Transition(State.Restoring, Event.RestoringSuccess, State.Stopped, null)); s_fsm.addTransition(new Transition(State.Restoring, Event.RestoringFailed, State.Stopped, null)); diff --git a/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java b/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java index c67ee4eabc28..5c78d6bedd64 100644 --- a/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java +++ b/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java @@ -78,6 +78,7 @@ public static class Param { public static final Param BootIntoSetup = new Param("enterHardwareSetup"); public static final Param PreserveNics = new Param("PreserveNics"); public static final Param ConsiderLastHost = new Param("ConsiderLastHost"); + public static final Param ReturnAfterVolumePrepare = new Param("ReturnAfterVolumePrepare"); private String name; diff --git a/api/src/main/java/com/cloud/vm/VmDetailConstants.java b/api/src/main/java/com/cloud/vm/VmDetailConstants.java index 29803d5271b4..33cc6da70812 100644 --- a/api/src/main/java/com/cloud/vm/VmDetailConstants.java +++ b/api/src/main/java/com/cloud/vm/VmDetailConstants.java @@ -41,6 +41,7 @@ public interface VmDetailConstants { String KVM_VNC_PORT = "kvm.vnc.port"; String KVM_VNC_ADDRESS = "kvm.vnc.address"; String KVM_VNC_PASSWORD = "kvm.vnc.password"; + String KVM_GUEST_OS_MACHINE_TYPE = "kvm.guest.os.machine.type"; // KVM specific, custom virtual GPU hardware String VIDEO_HARDWARE = "video.hardware"; @@ -54,6 +55,9 @@ public interface VmDetailConstants { String NIC_MULTIQUEUE_NUMBER = "nic.multiqueue.number"; String NIC_PACKED_VIRTQUEUES_ENABLED = "nic.packed.virtqueues.enabled"; + // KVM specific, disk controllers + String KVM_SKIP_FORCE_DISK_CONTROLLER = "skip.force.disk.controller"; + // Mac OSX guest specific (internal) String SMC_PRESENT = "smc.present"; String FIRMWARE = "firmware"; @@ -89,6 +93,10 @@ public interface VmDetailConstants { String DEPLOY_AS_IS_CONFIGURATION = "configurationId"; String KEY_PAIR_NAMES = "keypairnames"; String CKS_CONTROL_NODE_LOGIN_USER = "controlNodeLoginUser"; + String CKS_NODE_TYPE = "node"; + String OFFERING = "offering"; + String TEMPLATE = "template"; + String AFFINITY_GROUP = "affinitygroup"; // VMware to KVM VM migrations specific String VMWARE_TO_KVM_PREFIX = "vmware-to-kvm"; @@ -101,4 +109,31 @@ public interface VmDetailConstants { String VMWARE_HOST_NAME = String.format("%s-host", VMWARE_TO_KVM_PREFIX); String VMWARE_DISK = String.format("%s-disk", VMWARE_TO_KVM_PREFIX); String VMWARE_MAC_ADDRESSES = String.format("%s-mac-addresses", VMWARE_TO_KVM_PREFIX); + + // TPM + String VIRTUAL_TPM_ENABLED = "virtual.tpm.enabled"; + String VIRTUAL_TPM_MODEL = "virtual.tpm.model"; + String VIRTUAL_TPM_VERSION = "virtual.tpm.version"; + + // CPU mode and model, ADMIN only + String GUEST_CPU_MODE = "guest.cpu.mode"; + String GUEST_CPU_MODEL = "guest.cpu.model"; + + // Lease related + String INSTANCE_LEASE_EXPIRY_DATE = "leaseexpirydate"; + String INSTANCE_LEASE_EXPIRY_ACTION = "leaseexpiryaction"; + String INSTANCE_LEASE_EXECUTION = "leaseactionexecution"; + + // External orchestrator related + String MAC_ADDRESS = "mac_address"; + String EXPUNGE_EXTERNAL_VM = "expunge.external.vm"; + String EXTERNAL_DETAIL_PREFIX = "External:"; + String CLOUDSTACK_VM_DETAILS = "cloudstack.vm.details"; + String CLOUDSTACK_VLAN = "cloudstack.vlan"; + + // KVM Checkpoints related + String ACTIVE_CHECKPOINT_ID = "active.checkpoint.id"; + String ACTIVE_CHECKPOINT_CREATE_TIME = "active.checkpoint.create.time"; + String LAST_CHECKPOINT_ID = "last.checkpoint.id"; + String LAST_CHECKPOINT_CREATE_TIME = "last.checkpoint.create.time"; } diff --git a/api/src/main/java/com/cloud/vm/VmDiskInfo.java b/api/src/main/java/com/cloud/vm/VmDiskInfo.java new file mode 100644 index 000000000000..b8779a8d77c6 --- /dev/null +++ b/api/src/main/java/com/cloud/vm/VmDiskInfo.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.vm; + +import com.cloud.offering.DiskOffering; +import com.cloud.offering.DiskOfferingInfo; + +public class VmDiskInfo extends DiskOfferingInfo { + private Long _deviceId; + + public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) { + super(diskOffering, size, minIops, maxIops); + } + + public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops, Long deviceId) { + super(diskOffering, size, minIops, maxIops); + _deviceId = deviceId; + } + + public Long getDeviceId() { + return _deviceId; + } +} diff --git a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java index 3897df2d5e67..b4b144e2f8af 100644 --- a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java +++ b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java @@ -29,9 +29,10 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity, StateObject { enum State { - Allocated("The VM snapshot is allocated but has not been created yet."), Creating("The VM snapshot is being created."), Ready( - "The VM snapshot is ready to be used."), Reverting("The VM snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed( - "The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered"); + Allocated("The Instance Snapshot is allocated but has not been created yet."), Creating("The Instance Snapshot is being created."), Ready( + "The Instance Snapshot is ready to be used."), Reverting("The Instance Snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed( + "The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered"), + Hidden("The Instance snapshot is hidden from the user and cannot be recovered."); String _description; @@ -60,6 +61,8 @@ public String getDescription() { s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging); s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed); s_fsm.addTransition(Expunging, Event.OperationFailed, Error); + s_fsm.addTransition(Expunging, Event.Hide, Hidden); + s_fsm.addTransition(Hidden, Event.ExpungeRequested, Expunging); } } @@ -68,7 +71,7 @@ enum Type { } enum Event { - CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested, + CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested, Hide, } @Override diff --git a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java index 84a56aaedd34..754e463e7101 100644 --- a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java +++ b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java @@ -19,6 +19,7 @@ import java.util.List; +import com.cloud.utils.fsm.NoTransitionException; import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd; import com.cloud.exception.ConcurrentOperationException; @@ -53,4 +54,6 @@ UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityExce * @param id vm id */ boolean deleteVMSnapshotsFromDB(Long vmId, boolean unmanage); + + void updateOperationFailed(VMSnapshot vmSnapshot) throws NoTransitionException; } diff --git a/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java b/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java index 660f64f43ef2..286a3598e4fb 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java +++ b/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java @@ -20,6 +20,7 @@ import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.utils.component.Adapter; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission; import java.util.List; @@ -31,8 +32,8 @@ public interface APIChecker extends Adapter { // If true, apiChecker has checked the operation // If false, apiChecker is unable to handle the operation or not implemented // On exception, checkAccess failed don't allow - boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException; - boolean checkAccess(Account account, String apiCommandName) throws PermissionDeniedException; + boolean checkAccess(User user, String apiCommandName, ApiKeyPairPermission... apiKeyPairPermissions) throws PermissionDeniedException; + boolean checkAccess(Account account, String apiCommandName, ApiKeyPairPermission... apiKeyPairPermissions) throws PermissionDeniedException; /** * Verifies if the account has permission for the given list of APIs and returns only the allowed ones. * @@ -43,4 +44,5 @@ public interface APIChecker extends Adapter { */ List getApisAllowedToUser(Role role, User user, List apiNames) throws PermissionDeniedException; boolean isEnabled(); + List getImplicitRolePermissions(RoleType roleType); } diff --git a/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java b/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java index 251c6b6d3f9e..f382b1c6964f 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java +++ b/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java @@ -21,7 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity; public interface RolePermissionEntity extends InternalIdentity, Identity { - public enum Permission { + enum Permission { ALLOW, DENY } Rule getRule(); diff --git a/api/src/main/java/org/apache/cloudstack/acl/RoleService.java b/api/src/main/java/org/apache/cloudstack/acl/RoleService.java index f041c8342aec..14e0a608a925 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/RoleService.java +++ b/api/src/main/java/org/apache/cloudstack/acl/RoleService.java @@ -104,5 +104,26 @@ public interface RoleService { List findAllPermissionsBy(Long roleId); + List findAllRolePermissionsEntityBy(Long roleId, boolean considerImplicitRules); + Permission getRolePermission(String permission); + + int removeRolesIfNeeded(List roles); + + /** + * Checks if the role of the caller account has compatible permissions of the specified role permissions. + * For each permission of the {@param rolePermissionsToAccess}, the role of the caller needs to contain the same permission. + * + * @param rolePermissions the permissions of the caller role. + * @param rolePermissionsToAccess the permissions for the role that the caller role wants to access. + * @return True if the role can be accessed with the given permissions; false otherwise. + */ + boolean roleHasPermission(Map rolePermissions, List rolePermissionsToAccess); + + /** + * Given a list of role permissions, returns a {@link Map} containing the API name as the key and the {@link RolePermissionEntity} for the API as the value. + * + * @param rolePermissions Permissions for the role from role. + */ + Map getRoleRulesAndPermissions(List rolePermissions); } diff --git a/api/src/main/java/org/apache/cloudstack/acl/RoleType.java b/api/src/main/java/org/apache/cloudstack/acl/RoleType.java index 005d47c85bc2..c33488cd9239 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/RoleType.java +++ b/api/src/main/java/org/apache/cloudstack/acl/RoleType.java @@ -23,8 +23,11 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import java.util.Collection; +import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import java.util.Set; // Enum for default roles in CloudStack public enum RoleType { @@ -100,15 +103,39 @@ public static Long getRoleByAccountType(final Long roleId, final Account.Type ac return roleId; } + public static int toCombinedMask(Collection roles) { + int combinedMask = 0; + if (roles != null) { + for (RoleType role : roles) { + combinedMask |= role.getMask(); + } + } + return combinedMask; + } + + public static Set fromCombinedMask(int combinedMask) { + Set roles = EnumSet.noneOf(RoleType.class); + for (RoleType roleType : RoleType.values()) { + if ((combinedMask & roleType.getMask()) != 0) { + roles.add(roleType); + } + } + if (roles.isEmpty()) { + roles.add(Unknown); + } + return roles; + } + + /** * This method returns the role account type if the role isn't null, else it returns the default account type. * */ public static Account.Type getAccountTypeByRole(final Role role, final Account.Type defautAccountType) { if (role != null) { - LOGGER.debug(String.format("Role [%s] is not null; therefore, we use its account type [%s].", role, defautAccountType)); + LOGGER.debug("Role [{}] is not null; therefore, we use its Account type [{}].", role, defautAccountType); return role.getRoleType().getAccountType(); } - LOGGER.debug(String.format("Role is null; therefore, we use the default account type [%s] value.", defautAccountType)); + LOGGER.debug("Role is null; therefore, we use the default Account type [{}] value.", defautAccountType); return defautAccountType; } } diff --git a/api/src/main/java/org/apache/cloudstack/acl/Rule.java b/api/src/main/java/org/apache/cloudstack/acl/Rule.java index a4ef7773f67b..ad01825a95f1 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/Rule.java +++ b/api/src/main/java/org/apache/cloudstack/acl/Rule.java @@ -25,16 +25,18 @@ public final class Rule { private final String rule; + private final Pattern matchingPattern; private final static Pattern ALLOWED_PATTERN = Pattern.compile("^[a-zA-Z0-9*]+$"); public Rule(final String rule) { validate(rule); this.rule = rule; + matchingPattern = Pattern.compile(rule.toLowerCase().replace("*", "(\\w*\\*?)+")); } public boolean matches(final String commandName) { - return StringUtils.isNotEmpty(commandName) - && commandName.toLowerCase().matches(rule.toLowerCase().replace("*", "\\w*")); + return StringUtils.isNotEmpty(commandName) && + matchingPattern.matcher(commandName.toLowerCase()).matches(); } public String getRuleString() { diff --git a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java index 82a8ec5fe932..fa17df7c6ed4 100644 --- a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java +++ b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java @@ -27,6 +27,8 @@ import com.cloud.user.User; import com.cloud.utils.component.Adapter; +import org.apache.cloudstack.backup.BackupOffering; + /** * SecurityChecker checks the ownership and access control to objects within */ @@ -145,4 +147,6 @@ boolean checkAccess(Account caller, AccessType accessType, String action, Contro boolean checkAccess(Account account, NetworkOffering nof, DataCenter zone) throws PermissionDeniedException; boolean checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException; + + boolean checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException; } diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java new file mode 100644 index 000000000000..ecce0ae50824 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.apikeypair; + +import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +public interface ApiKeyPair extends ControlledEntity, InternalIdentity, Identity { + Long getUserId(); + Date getStartDate(); + Date getEndDate(); + Date getCreated(); + String getDescription(); + String getApiKey(); + String getSecretKey(); + String getName(); + Date getRemoved(); + void setRemoved(Date date); + void validateDate(); + boolean hasEndDatePassed(); +} diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java new file mode 100644 index 000000000000..60b3834cc073 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.apikeypair; + +import org.apache.cloudstack.acl.RolePermissionEntity; + +public interface ApiKeyPairPermission extends RolePermissionEntity { + long getApiKeyPairId(); +} diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java new file mode 100644 index 000000000000..de9c829b17dc --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.apikeypair; + +import java.util.List; + +public interface ApiKeyPairService { + List findAllPermissionsByKeyPairId(Long apiKeyPairId, Long roleId); + + ApiKeyPair findByApiKey(String apiKey); + + ApiKeyPair findById(Long id); +} diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java index 69f391a5656a..f5a71b994525 100644 --- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java @@ -34,27 +34,27 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the affinity group") + @Param(description = "The ID of the affinity group") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the affinity group") + @Param(description = "The name of the affinity group") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the affinity group") + @Param(description = "The description of the affinity group") private String description; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the affinity group") + @Param(description = "The account owning the affinity group") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the affinity group") + @Param(description = "The domain ID of the affinity group") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the affinity group") + @Param(description = "The domain name of the affinity group") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -62,19 +62,19 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie private String domainPath; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project ID of the affinity group") + @Param(description = "The project ID of the affinity group") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the affinity group") + @Param(description = "The project name of the affinity group") private String projectName; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the affinity group") + @Param(description = "The type of the affinity group") private String type; @SerializedName("virtualmachineIds") - @Param(description = "virtual machine IDs associated with this affinity group") + @Param(description = "Instance IDs associated with this affinity group") private List vmIdList; @SerializedName("dedicatedresources") diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java index 018e5f5bab5a..03992c0c1c7c 100644 --- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java +++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java @@ -66,5 +66,4 @@ public interface AffinityGroupService { boolean isAffinityGroupAvailableInDomain(long affinityGroupId, long domainId); - } diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java index 6f5fb23d159e..7ddf6dd9f73f 100644 --- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java @@ -29,7 +29,7 @@ public class AffinityGroupTypeResponse extends BaseResponse { @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the affinity group") + @Param(description = "The type of the affinity group") private String type; public AffinityGroupTypeResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java index 9995d8039e1f..96ca35f264ca 100644 --- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java +++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java @@ -29,6 +29,9 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor { + public static final String AFFINITY_TYPE_HOST = "host affinity"; + public static final String AFFINITY_TYPE_HOST_ANTI = "host anti-affinity"; + protected String _type; @Override diff --git a/api/src/main/java/org/apache/cloudstack/alert/AlertService.java b/api/src/main/java/org/apache/cloudstack/alert/AlertService.java index 1250284b5c27..fcc87908bd5d 100644 --- a/api/src/main/java/org/apache/cloudstack/alert/AlertService.java +++ b/api/src/main/java/org/apache/cloudstack/alert/AlertService.java @@ -24,18 +24,24 @@ public interface AlertService { public static class AlertType { - private static Set defaultAlertTypes = new HashSet(); + private static final Set defaultAlertTypes = new HashSet<>(); private final String name; private final short type; + private final boolean repetitionAllowed; - private AlertType(short type, String name, boolean isDefault) { + private AlertType(short type, String name, boolean isDefault, boolean repetitionAllowed) { this.name = name; this.type = type; + this.repetitionAllowed = repetitionAllowed; if (isDefault) { defaultAlertTypes.add(this); } } + private AlertType(short type, String name, boolean isDefault) { + this(type, name, isDefault, false); + } + public static final AlertType ALERT_TYPE_MEMORY = new AlertType(Capacity.CAPACITY_TYPE_MEMORY, "ALERT.MEMORY", true); public static final AlertType ALERT_TYPE_CPU = new AlertType(Capacity.CAPACITY_TYPE_CPU, "ALERT.CPU", true); public static final AlertType ALERT_TYPE_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_STORAGE, "ALERT.STORAGE", true); @@ -45,34 +51,38 @@ private AlertType(short type, String name, boolean isDefault) { public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = new AlertType(Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET, "ALERT.NETWORK.IPV6SUBNET", true); public static final AlertType ALERT_TYPE_PRIVATE_IP = new AlertType(Capacity.CAPACITY_TYPE_PRIVATE_IP, "ALERT.NETWORK.PRIVATEIP", true); public static final AlertType ALERT_TYPE_SECONDARY_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_SECONDARY_STORAGE, "ALERT.STORAGE.SECONDARY", true); - public static final AlertType ALERT_TYPE_HOST = new AlertType((short)7, "ALERT.COMPUTE.HOST", true); - public static final AlertType ALERT_TYPE_USERVM = new AlertType((short)8, "ALERT.USERVM", true); - public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType((short)9, "ALERT.SERVICE.DOMAINROUTER", true); - public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType((short)10, "ALERT.SERVICE.CONSOLEPROXY", true); + public static final AlertType ALERT_TYPE_HOST = new AlertType((short)7, "ALERT.COMPUTE.HOST", true, true); + public static final AlertType ALERT_TYPE_USERVM = new AlertType((short)8, "ALERT.USERVM", true, true); + public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType((short)9, "ALERT.SERVICE.DOMAINROUTER", true, true); + public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType((short)10, "ALERT.SERVICE.CONSOLEPROXY", true, true); public static final AlertType ALERT_TYPE_ROUTING = new AlertType((short)11, "ALERT.NETWORK.ROUTING", true); - public static final AlertType ALERT_TYPE_STORAGE_MISC = new AlertType((short)12, "ALERT.STORAGE.MISC", true); + public static final AlertType ALERT_TYPE_STORAGE_MISC = new AlertType((short)12, "ALERT.STORAGE.MISC", true, true); public static final AlertType ALERT_TYPE_USAGE_SERVER = new AlertType((short)13, "ALERT.USAGE", true); - public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true); + public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true, true); public static final AlertType ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = new AlertType((short)15, "ALERT.NETWORK.DOMAINROUTERMIGRATE", true); public static final AlertType ALERT_TYPE_CONSOLE_PROXY_MIGRATE = new AlertType((short)16, "ALERT.SERVICE.CONSOLEPROXYMIGRATE", true); public static final AlertType ALERT_TYPE_USERVM_MIGRATE = new AlertType((short)17, "ALERT.USERVM.MIGRATE", true); public static final AlertType ALERT_TYPE_VLAN = new AlertType((short)18, "ALERT.NETWORK.VLAN", true); - public static final AlertType ALERT_TYPE_SSVM = new AlertType((short)19, "ALERT.SERVICE.SSVM", true); + public static final AlertType ALERT_TYPE_SSVM = new AlertType((short)19, "ALERT.SERVICE.SSVM", true, true); public static final AlertType ALERT_TYPE_USAGE_SERVER_RESULT = new AlertType((short)20, "ALERT.USAGE.RESULT", true); public static final AlertType ALERT_TYPE_STORAGE_DELETE = new AlertType((short)21, "ALERT.STORAGE.DELETE", true); public static final AlertType ALERT_TYPE_UPDATE_RESOURCE_COUNT = new AlertType((short)22, "ALERT.RESOURCE.COUNT", true); public static final AlertType ALERT_TYPE_USAGE_SANITY_RESULT = new AlertType((short)23, "ALERT.USAGE.SANITY", true); public static final AlertType ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = new AlertType((short)24, "ALERT.NETWORK.DIRECTPUBLICIP", true); public static final AlertType ALERT_TYPE_LOCAL_STORAGE = new AlertType((short)25, "ALERT.STORAGE.LOCAL", true); - public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType((short)26, "ALERT.RESOURCE.EXCEED", true); + public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType((short)26, "ALERT.RESOURCE.EXCEED", true, true); public static final AlertType ALERT_TYPE_SYNC = new AlertType((short)27, "ALERT.TYPE.SYNC", true); - public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType((short)28, "ALERT.UPLOAD.FAILED", true); - public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType((short)29, "ALERT.OOBM.AUTHERROR", true); - public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true); - public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true); + public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType((short)28, "ALERT.UPLOAD.FAILED", true, true); + public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType((short)29, "ALERT.OOBM.AUTHERROR", true, true); + public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true, true); + public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true, true); public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true); - public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true); - public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true); + public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)33, "ALERT.VR.PUBLIC.IFACE.MTU", true); + public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)34, "ALERT.VR.PRIVATE.IFACE.MTU", true); + public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true, true); + public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", true, true); + public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true); + public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true); public short getType() { return type; @@ -82,6 +92,10 @@ public String getName() { return name; } + public boolean isRepetitionAllowed() { + return repetitionAllowed; + } + private static AlertType getAlertType(short type) { for (AlertType alertType : defaultAlertTypes) { if (alertType.getType() == type) { @@ -105,7 +119,7 @@ public static AlertType generateAlert(short type, String name) { if (defaultAlert != null && !defaultAlert.getName().equalsIgnoreCase(name)) { throw new InvalidParameterValueException("There is a default alert having type " + type + " and name " + defaultAlert.getName()); } else { - return new AlertType(type, name, false); + return new AlertType(type, name, false, false); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/APICommand.java b/api/src/main/java/org/apache/cloudstack/api/APICommand.java index c559be081165..b77649046ca9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/APICommand.java +++ b/api/src/main/java/org/apache/cloudstack/api/APICommand.java @@ -50,4 +50,6 @@ RoleType[] authorized() default {}; Class[] entityType() default {}; + + String httpMethod() default ""; } diff --git a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java index 083a1be00f56..13f351f3a27f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java @@ -29,28 +29,28 @@ public abstract class AbstractGetUploadParamsCmd extends BaseCmd { - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume/template/iso") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Volume/Template/ISO") private String name; - @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "the format for the volume/template/iso. Possible values include QCOW2, OVA, " + @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "The format for the Volume/Template/ISO. Possible values include QCOW2, OVA, " + "and VHD.") private String format; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the zone the volume/template/iso is " + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The ID of the zone the Volume/Template/ISO is " + "to be hosted on") private Long zoneId; - @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume/template/iso " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) + @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "The checksum value of this Volume/Template/ISO " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) private String checksum; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional accountName. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId. If the account parameter is used, " + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "An optional domainId. If the Account parameter is used, " + "domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume/template/iso for the project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload Volume/Template/ISO for the project") private Long projectId; public String getName() { @@ -81,6 +81,34 @@ public Long getProjectId() { return projectId; } + public void setName(String name) { + this.name = name; + } + + public void setFormat(String format) { + this.format = format; + } + + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + public void setProjectId(Long projectId) { + this.projectId = projectId; + } + public GetUploadParamsResponse createGetUploadParamsResponse(UUID id, URL postURL, String metadata, String timeout, String signature) { return new GetUploadParamsResponse(id, postURL, metadata, timeout, signature); } diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java b/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java index f2f52cec9697..e2ebb242cbf2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java @@ -61,6 +61,7 @@ public enum ApiCommandResourceType { AffinityGroup(org.apache.cloudstack.affinity.AffinityGroup.class), InternalLbVm(com.cloud.network.router.VirtualRouter.class), DedicatedGuestVlanRange(com.cloud.network.GuestVlan.class), + GuestOsCategory(com.cloud.storage.GuestOsCategory.class), GuestOs(com.cloud.storage.GuestOS.class), GuestOsMapping(com.cloud.storage.GuestOSHypervisor.class), Network(com.cloud.network.Network.class), @@ -84,9 +85,11 @@ public enum ApiCommandResourceType { ObjectStore(org.apache.cloudstack.storage.object.ObjectStore.class), Bucket(org.apache.cloudstack.storage.object.Bucket.class), QuotaTariff(org.apache.cloudstack.quota.QuotaTariff.class), - KubernetesCluster(null), + KubernetesCluster(com.cloud.kubernetes.cluster.KubernetesCluster.class), KubernetesSupportedVersion(null), - SharedFS(org.apache.cloudstack.storage.sharedfs.SharedFS.class); + SharedFS(org.apache.cloudstack.storage.sharedfs.SharedFS.class), + Extension(org.apache.cloudstack.extension.Extension.class), + ExtensionCustomAction(org.apache.cloudstack.extension.ExtensionCustomAction.class); private final Class clazz; @@ -124,8 +127,8 @@ public String toString() { } public static ApiCommandResourceType fromString(String value) { - if (StringUtils.isNotEmpty(value) && EnumUtils.isValidEnum(ApiCommandResourceType.class, value)) { - return valueOf(value); + if (StringUtils.isNotBlank(value) && EnumUtils.isValidEnumIgnoreCase(ApiCommandResourceType.class, value)) { + return EnumUtils.getEnumIgnoreCase(ApiCommandResourceType.class, value); } return null; } diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java index 627e7395e1e1..c5671d22d07b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java @@ -19,19 +19,25 @@ public class ApiConstants { public static final String ACCOUNT = "account"; public static final String ACCOUNTS = "accounts"; + public static final String ACCOUNT_NAME = "accountname"; + public static final String ACCOUNT_STATE_TO_SHOW = "accountstatetoshow"; public static final String ACCOUNT_TYPE = "accounttype"; public static final String ACCOUNT_ID = "accountid"; public static final String ACCOUNT_IDS = "accountids"; public static final String ACCUMULATE = "accumulate"; + public static final String ACQUIRED = "acquired"; public static final String ACTIVATION_RULE = "activationrule"; public static final String ACTIVITY = "activity"; public static final String ADAPTER_TYPE = "adaptertype"; + public static final String ADDITONAL_CONFIG_ENABLED = "additionalconfigenabled"; public static final String ADDRESS = "address"; public static final String ALGORITHM = "algorithm"; public static final String ALIAS = "alias"; + public static final String ALLOCATED = "allocated"; public static final String ALLOCATED_DATE = "allocateddate"; public static final String ALLOCATED_ONLY = "allocatedonly"; public static final String ALLOCATED_TIME = "allocated"; + public static final String ALLOWED_ROLE_TYPES = "allowedroletypes"; public static final String ALLOW_USER_FORCE_STOP_VM = "allowuserforcestopvm"; public static final String ANNOTATION = "annotation"; public static final String API_KEY = "apikey"; @@ -42,6 +48,7 @@ public class ApiConstants { public static final String AS_NUMBER_ID = "asnumberid"; public static final String ASN_RANGE = "asnrange"; public static final String ASN_RANGE_ID = "asnrangeid"; + public static final String API_KEY_FILTER = "apikeyfilter"; public static final String ASYNC_BACKUP = "asyncbackup"; public static final String AUTO_SELECT = "autoselect"; public static final String USER_API_KEY = "userapikey"; @@ -59,7 +66,11 @@ public class ApiConstants { public static final String BACKUP_STORAGE_AVAILABLE = "backupstorageavailable"; public static final String BACKUP_STORAGE_LIMIT = "backupstoragelimit"; public static final String BACKUP_STORAGE_TOTAL = "backupstoragetotal"; + public static final String BACKUP_VM_OFFERING_REMOVED = "vmbackupofferingremoved"; + public static final String IS_BACKUP_VM_EXPUNGED = "isbackupvmexpunged"; public static final String BACKUP_TOTAL = "backuptotal"; + public static final String BALANCE = "balance"; + public static final String BALANCES = "balances"; public static final String BASE64_IMAGE = "base64image"; public static final String BGP_PEERS = "bgppeers"; public static final String BGP_PEER_IDS = "bgppeerids"; @@ -68,6 +79,8 @@ public class ApiConstants { public static final String BOOTABLE = "bootable"; public static final String BIND_DN = "binddn"; public static final String BIND_PASSWORD = "bindpass"; + public static final String BLANK_INSTANCE = "blankinstance"; + public static final String BUS_ADDRESS = "busaddress"; public static final String BYTES_READ_RATE = "bytesreadrate"; public static final String BYTES_READ_RATE_MAX = "bytesreadratemax"; public static final String BYTES_READ_RATE_MAX_LENGTH = "bytesreadratemaxlength"; @@ -75,6 +88,7 @@ public class ApiConstants { public static final String BYTES_WRITE_RATE_MAX = "byteswriteratemax"; public static final String BYTES_WRITE_RATE_MAX_LENGTH = "byteswriteratemaxlength"; public static final String BYPASS_VLAN_OVERLAP_CHECK = "bypassvlanoverlapcheck"; + public static final String CALLER = "caller"; public static final String CAPACITY = "capacity"; public static final String CATEGORY = "category"; public static final String CAN_REVERT = "canrevert"; @@ -90,9 +104,13 @@ public class ApiConstants { public static final String CONVERT_INSTANCE_HOST_ID = "convertinstancehostid"; public static final String CONVERT_INSTANCE_STORAGE_POOL_ID = "convertinstancepoolid"; public static final String ENABLED_REVOCATION_CHECK = "enabledrevocationcheck"; + public static final String CLIENT_ADDRESS = "clientaddress"; + public static final String COMBINED_CAPACITY_ORDERING = "COMBINED"; public static final String CONTROLLER = "controller"; public static final String CONTROLLER_UNIT = "controllerunit"; + public static final String CONSOLE_ENDPOINT_CREATOR_ADDRESS = "consoleendpointcreatoraddress"; public static final String COPY_IMAGE_TAGS = "copyimagetags"; + public static final String CPU_OVERCOMMIT_RATIO = "cpuOvercommitRatio"; public static final String CSR = "csr"; public static final String PRIVATE_KEY = "privatekey"; public static final String DATASTORE_HOST = "datastorehost"; @@ -119,12 +137,19 @@ public class ApiConstants { public static final String CN = "cn"; public static final String COMMAND = "command"; public static final String CMD_EVENT_TYPE = "cmdeventtype"; + public static final String CNI_CONFIG = "cniconfig"; + public static final String CNI_CONFIG_ID = "cniconfigurationid"; + public static final String CNI_CONFIG_DETAILS = "cniconfigdetails"; + public static final String CNI_CONFIG_NAME = "cniconfigname"; + public static final String CSI_ENABLED = "csienabled"; public static final String COMPONENT = "component"; + public static final String CPU = "CPU"; public static final String CPU_CORE_PER_SOCKET = "cpucorepersocket"; public static final String CPU_NUMBER = "cpunumber"; public static final String CPU_SPEED = "cpuspeed"; public static final String CPU_LOAD_AVERAGE = "cpuloadaverage"; public static final String CREATED = "created"; + public static final String CROSS_ZONE_INSTANCE_CREATION = "crosszoneinstancecreation"; public static final String CTX_ACCOUNT_ID = "ctxaccountid"; public static final String CTX_DETAILS = "ctxDetails"; public static final String CTX_USER_ID = "ctxuserid"; @@ -133,18 +158,23 @@ public class ApiConstants { public static final String CUSTOMIZED = "customized"; public static final String CUSTOMIZED_IOPS = "customizediops"; public static final String CUSTOM_ID = "customid"; + public static final String CUSTOM_ACTION_ID = "customactionid"; public static final String CUSTOM_JOB_ID = "customjobid"; + public static final String CURRENCY = "currency"; public static final String CURRENT_START_IP = "currentstartip"; public static final String CURRENT_END_IP = "currentendip"; public static final String ENCRYPT = "encrypt"; public static final String ENCRYPT_FORMAT = "encryptformat"; public static final String ENCRYPT_ROOT = "encryptroot"; public static final String ENCRYPTION_SUPPORTED = "encryptionsupported"; + public static final String ETCD_IPS = "etcdips"; public static final String MIN_IOPS = "miniops"; public static final String MAX_IOPS = "maxiops"; public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve"; public static final String DATACENTER_NAME = "datacentername"; + public static final String DATADISKS_DETAILS = "datadisksdetails"; public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist"; + public static final String DATE = "date"; public static final String DEFAULT_VALUE = "defaultvalue"; public static final String DELETE_PROTECTION = "deleteprotection"; public static final String DESCRIPTION = "description"; @@ -152,10 +182,13 @@ public class ApiConstants { public static final String DESTINATION_ZONE_ID = "destzoneid"; public static final String DETAILS = "details"; public static final String DEVICE_ID = "deviceid"; + public static final String DEVICE_IDS = "deviceids"; + public static final String DEVICE_NAME = "devicename"; public static final String DIRECT_DOWNLOAD = "directdownload"; public static final String DISK = "disk"; public static final String DISK_OFFERING_ID = "diskofferingid"; public static final String NEW_DISK_OFFERING_ID = "newdiskofferingid"; + public static final String ORCHESTRATOR_REQUIRES_PREPARE_VM = "orchestratorrequirespreparevm"; public static final String OVERRIDE_DISK_OFFERING_ID = "overridediskofferingid"; public static final String DISK_KBS_READ = "diskkbsread"; public static final String DISK_KBS_WRITE = "diskkbswrite"; @@ -188,36 +221,51 @@ public class ApiConstants { public static final String DOMAIN_PATH = "domainpath"; public static final String DOMAIN_ID = "domainid"; public static final String DOMAIN__ID = "domainId"; + public static final String DUMMY = "dummy"; public static final String DURATION = "duration"; public static final String ELIGIBLE = "eligible"; public static final String EMAIL = "email"; + public static final String ENABLE_CSI = "enablecsi"; public static final String END_ASN = "endasn"; public static final String END_DATE = "enddate"; public static final String END_IP = "endip"; public static final String END_IPV6 = "endipv6"; public static final String END_PORT = "endport"; public static final String ENTRY_TIME = "entrytime"; + public static final String ERROR_MESSAGE = "errormessage"; public static final String EVENT_ID = "eventid"; public static final String EVENT_TYPE = "eventtype"; public static final String EXPIRES = "expires"; public static final String EXTRA_CONFIG = "extraconfig"; + public static final String EXTRA_PARAMS = "extraparams"; public static final String EXTRA_DHCP_OPTION = "extradhcpoption"; public static final String EXTRA_DHCP_OPTION_NAME = "extradhcpoptionname"; public static final String EXTRA_DHCP_OPTION_CODE = "extradhcpoptioncode"; public static final String EXTRA_DHCP_OPTION_VALUE = "extradhcpvalue"; public static final String EXTERNAL = "external"; public static final String EXTERNAL_UUID = "externaluuid"; + public static final String EXTERNAL_DETAILS = "externaldetails"; + public static final String PARAMETERS = "parameters"; + public static final String EXTENSION = "extension"; + public static final String EXTENSION_ID = "extensionid"; + public static final String EXTENSION_NAME = "extensionname"; + public static final String EXTENSIONS_PATH = "extensionspath"; public static final String FENCE = "fence"; public static final String FETCH_LATEST = "fetchlatest"; public static final String FILESYSTEM = "filesystem"; public static final String FIRSTNAME = "firstname"; public static final String FORCED = "forced"; public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage"; + public static final String FORCE_CONVERT_TO_POOL = "forceconverttopool"; + public static final String FORCE_DELETE_HOST = "forcedeletehost"; public static final String FORCE_MS_TO_IMPORT_VM_FILES = "forcemstoimportvmfiles"; + public static final String FORCE_UPDATE_OS_TYPE = "forceupdateostype"; public static final String FORMAT = "format"; public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork"; public static final String FOR_SYSTEM_VMS = "forsystemvms"; + public static final String FOR_PROVIDER = "forprovider"; + public static final String FROM_CHECKPOINT_ID = "fromcheckpointid"; public static final String FULL_PATH = "fullpath"; public static final String GATEWAY = "gateway"; public static final String IP6_GATEWAY = "ip6gateway"; @@ -244,6 +292,7 @@ public class ApiConstants { public static final String HOST = "host"; public static final String HOST_CONTROL_STATE = "hostcontrolstate"; public static final String HOSTS_MAP = "hostsmap"; + public static final String HTTP_REQUEST_TYPE = "httprequesttype"; public static final String HYPERVISOR = "hypervisor"; public static final String INLINE = "inline"; public static final String INSTANCE = "instance"; @@ -262,6 +311,7 @@ public class ApiConstants { public static final String PREVIOUS_OWNER_ID = "previousownerid"; public static final String PREVIOUS_OWNER_NAME = "previousownername"; public static final String NEXT_ACL_RULE_ID = "nextaclruleid"; + public static final String NEXT_HOP = "nexthop"; public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash"; public static final String IMAGE_PATH = "imagepath"; public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported"; @@ -269,7 +319,10 @@ public class ApiConstants { public static final String INTERNAL_DNS2 = "internaldns2"; public static final String INTERNET_PROTOCOL = "internetprotocol"; public static final String INTERVAL_TYPE = "intervaltype"; - public static final String LOCATION_TYPE = "locationtype"; + public static final String INSTANCE_LEASE_DURATION = "leaseduration"; + public static final String INSTANCE_LEASE_ENABLED = "instanceleaseenabled"; + public static final String INSTANCE_LEASE_EXPIRY_ACTION = "leaseexpiryaction"; + public static final String INSTANCE_LEASE_EXPIRY_DATE= "leaseexpirydate"; public static final String IOPS_READ_RATE = "iopsreadrate"; public static final String IOPS_READ_RATE_MAX = "iopsreadratemax"; public static final String IOPS_READ_RATE_MAX_LENGTH = "iopsreadratemaxlength"; @@ -279,11 +332,13 @@ public class ApiConstants { public static final String IP_ADDRESS = "ipaddress"; public static final String IP_ADDRESSES = "ipaddresses"; public static final String IP6_ADDRESS = "ip6address"; + public static final String IP6_ADDRESSES = "ip6addresses"; public static final String IP_ADDRESS_ID = "ipaddressid"; public static final String IS_2FA_ENABLED = "is2faenabled"; public static final String IS_2FA_VERIFIED = "is2faverified"; public static final String IS_2FA_MANDATED = "is2famandated"; + public static final String IS_ACTIVE = "isactive"; public static final String IS_ASYNC = "isasync"; public static final String IP_AVAILABLE = "ipavailable"; public static final String IP_LIMIT = "iplimit"; @@ -296,6 +351,7 @@ public class ApiConstants { public static final String IS_EXTRACTABLE = "isextractable"; public static final String IS_FEATURED = "isfeatured"; public static final String IS_IMPLICIT = "isimplicit"; + public static final String IS_ISO = "isiso"; public static final String IS_PORTABLE = "isportable"; public static final String IS_PUBLIC = "ispublic"; public static final String IS_PERSISTENT = "ispersistent"; @@ -311,33 +367,44 @@ public class ApiConstants { public static final String JOB_STATUS = "jobstatus"; public static final String KEEPALIVE_ENABLED = "keepaliveenabled"; public static final String KERNEL_VERSION = "kernelversion"; + public static final String KEYPAIR_ID = "keypairid"; public static final String KEY = "key"; public static final String LABEL = "label"; public static final String LASTNAME = "lastname"; public static final String LAST_BOOT = "lastboottime"; public static final String LAST_SERVER_START = "lastserverstart"; public static final String LAST_SERVER_STOP = "lastserverstop"; + public static final String LEASED = "leased"; public static final String LEVEL = "level"; public static final String LENGTH = "length"; public static final String LIMIT = "limit"; public static final String LIMIT_CPU_USE = "limitcpuuse"; public static final String LIST_HOSTS = "listhosts"; + public static final String LOCATION_TYPE = "locationtype"; public static final String LOCK = "lock"; public static final String LUN = "lun"; public static final String LBID = "lbruleid"; public static final String LB_PROVIDER = "lbprovider"; public static final String MAC_ADDRESS = "macaddress"; + public static final String MAC_ADDRESSES = "macaddresses"; + public static final String MANUAL_UPGRADE = "manualupgrade"; + public static final String MATCH_TYPE = "matchtype"; public static final String MAX = "max"; public static final String MAX_SNAPS = "maxsnaps"; public static final String MAX_BACKUPS = "maxbackups"; public static final String MAX_CPU_NUMBER = "maxcpunumber"; public static final String MAX_MEMORY = "maxmemory"; + public static final String MEMORY_OVERCOMMIT_RATIO = "memoryOvercommitRatio"; + public static final String MESSAGE = "message"; public static final String MIN_CPU_NUMBER = "mincpunumber"; public static final String MIN_MEMORY = "minmemory"; public static final String MIGRATION_TYPE = "migrationtype"; + public static final String MIGRATION_JOB_ID = "migrationjobid"; + public static final String MIGRATION_JOB_STATUS = "migrationjobstatus"; public static final String MIGRATIONS = "migrations"; public static final String MEMORY = "memory"; public static final String MODE = "mode"; + public static final String MOUNT_CKS_ISO_ON_VR = "mountcksisoonvr"; public static final String MULTI_ARCH = "ismultiarch"; public static final String NSX_MODE = "nsxmode"; public static final String NETWORK_MODE = "networkmode"; @@ -348,12 +415,15 @@ public class ApiConstants { public static final String NETMASK = "netmask"; public static final String NEW_NAME = "newname"; public static final String NIC = "nic"; + public static final String NICS = "nics"; public static final String NIC_NETWORK_LIST = "nicnetworklist"; public static final String NIC_IP_ADDRESS_LIST = "nicipaddresslist"; public static final String NIC_MULTIQUEUE_NUMBER = "nicmultiqueuenumber"; public static final String NIC_PACKED_VIRTQUEUES_ENABLED = "nicpackedvirtqueuesenabled"; public static final String NEW_START_IP = "newstartip"; public static final String NEW_END_IP = "newendip"; + public static final String KUBERNETES_NODE_VERSION = "kubernetesnodeversion"; + public static final String NUMA_NODE = "numanode"; public static final String NUM_RETRIES = "numretries"; public static final String OFFER_HA = "offerha"; public static final String OS_DISTRIBUTION = "osdistribution"; @@ -370,6 +440,13 @@ public class ApiConstants { public static final String OS_TYPE_ID = "ostypeid"; public static final String OS_DISPLAY_NAME = "osdisplayname"; public static final String OS_NAME_FOR_HYPERVISOR = "osnameforhypervisor"; + public static final String GPU_CARD_ID = "gpucardid"; + public static final String GPU_CARD_NAME = "gpucardname"; + public static final String GPU_COUNT = "gpucount"; + public static final String GPU_DISPLAY = "gpudisplay"; + public static final String GPU_DEVICE_TYPE = "gpudevicetype"; + public static final String GPU_ENABLED = "gpuenabled"; + public static final String MAX_VGPU_PER_PHYSICAL_GPU = "maxvgpuperphysicalgpu"; public static final String GUEST_OS_LIST = "guestoslist"; public static final String GUEST_OS_COUNT = "guestoscount"; public static final String OS_MAPPING_CHECK_ENABLED = "osmappingcheckenabled"; @@ -381,14 +458,17 @@ public class ApiConstants { public static final String PARENT = "parent"; public static final String PARENT_ID = "parentid"; public static final String PARENT_DOMAIN_ID = "parentdomainid"; + public static final String PARENT_GPU_DEVICE_ID = "parentgpudeviceid"; public static final String PARENT_SUBNET = "parentsubnet"; public static final String PARENT_TEMPLATE_ID = "parenttemplateid"; public static final String PASSWORD = "password"; + public static final String PCI_ROOT = "pciroot"; public static final String CURRENT_PASSWORD = "currentpassword"; public static final String SHOULD_UPDATE_PASSWORD = "update_passwd_on_host"; public static final String PASSWORD_ENABLED = "passwordenabled"; public static final String SSHKEY_ENABLED = "sshkeyenabled"; public static final String PATH = "path"; + public static final String PATH_READY = "pathready"; public static final String PAYLOAD = "payload"; public static final String PAYLOAD_URL = "payloadurl"; public static final String PEERS = "peers"; @@ -411,6 +491,8 @@ public class ApiConstants { public static final String POST_URL = "postURL"; public static final String POWER_STATE = "powerstate"; public static final String PRECEDENCE = "precedence"; + public static final String PREPARE_VM = "preparevm"; + public static final String PRESERVE_IP = "preserveip"; public static final String PRIVATE_INTERFACE = "privateinterface"; public static final String PRIVATE_IP = "privateip"; public static final String PRIVATE_PORT = "privateport"; @@ -427,11 +509,16 @@ public class ApiConstants { public static final String PUBLIC_END_PORT = "publicendport"; public static final String PUBLIC_ZONE = "publiczone"; public static final String PURGE_RESOURCES = "purgeresources"; + public static final String RAM = "RAM"; + public static final String REBALANCE = "rebalance"; public static final String RECEIVED_BYTES = "receivedbytes"; public static final String RECONNECT = "reconnect"; public static final String RECOVER = "recover"; public static final String REPAIR = "repair"; + public static final String REPETITION_ALLOWED = "repetitionallowed"; public static final String REQUIRES_HVM = "requireshvm"; + public static final String RESERVED_RESOURCE_DETAILS = "reservedresourcedetails"; + public static final String RESOURCES = "resources"; public static final String RESOURCE_COUNT = "resourcecount"; public static final String RESOURCE_NAME = "resourcename"; public static final String RESOURCE_TYPE = "resourcetype"; @@ -443,12 +530,12 @@ public class ApiConstants { public static final String REGISTERED = "registered"; public static final String QUALIFIERS = "qualifiers"; public static final String QUERY_FILTER = "queryfilter"; + public static final String QUIESCE_VM = "quiescevm"; public static final String SCHEDULE = "schedule"; public static final String SCHEDULE_ID = "scheduleid"; public static final String SCOPE = "scope"; public static final String SEARCH_BASE = "searchbase"; public static final String SECONDARY_IP = "secondaryip"; - public static final String SECRET_KEY = "secretkey"; public static final String SECURITY_GROUP_IDS = "securitygroupids"; public static final String SECURITY_GROUP_NAMES = "securitygroupnames"; public static final String SECURITY_GROUP_NAME = "securitygroupname"; @@ -456,16 +543,21 @@ public class ApiConstants { public static final String SENT = "sent"; public static final String SENT_BYTES = "sentbytes"; public static final String SERIAL = "serial"; + public static final String SERVICE_IP = "serviceip"; public static final String SERVICE_OFFERING_ID = "serviceofferingid"; + public static final String SERVICE_OFFERING_NAME = "serviceofferingname"; public static final String SESSIONKEY = "sessionkey"; public static final String SHOW_CAPACITIES = "showcapacities"; public static final String SHOW_REMOVED = "showremoved"; + public static final String SHOW_RESOURCES = "showresources"; public static final String SHOW_RESOURCE_ICON = "showicon"; public static final String SHOW_INACTIVE = "showinactive"; public static final String SHOW_UNIQUE = "showunique"; + public static final String SHOW_PERMISSIONS = "showpermissions"; public static final String SIGNATURE = "signature"; public static final String SIGNATURE_VERSION = "signatureversion"; public static final String SINCE = "since"; + public static final String SITE_NAME = "sitename"; public static final String SIZE = "size"; public static final String SIZEGB = "sizegb"; public static final String SNAPSHOT = "snapshot"; @@ -473,7 +565,11 @@ public class ApiConstants { public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid"; public static final String SNAPSHOT_TYPE = "snapshottype"; public static final String SNAPSHOT_QUIESCEVM = "quiescevm"; + + public static final String USE_STORAGE_REPLICATION = "usestoragereplication"; + public static final String SOURCE_CIDR_LIST = "sourcecidrlist"; + public static final String SOURCE_OFFERING_ID = "sourceofferingid"; public static final String SOURCE_ZONE_ID = "sourcezoneid"; public static final String SSL_VERIFICATION = "sslverification"; public static final String START_ASN = "startasn"; @@ -485,22 +581,30 @@ public class ApiConstants { public static final String STATE = "state"; public static final String STATS = "stats"; public static final String STATUS = "status"; + public static final String STORAGE_TYPE = "storagetype"; + public static final String STORAGE_POLICY = "storagepolicy"; + public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled"; public static final String STORAGE_CAPABILITIES = "storagecapabilities"; public static final String STORAGE_CUSTOM_STATS = "storagecustomstats"; - public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled"; - public static final String STORAGE_POLICY = "storagepolicy"; - public static final String STORAGE_POOL = "storagepool"; - public static final String STORAGE_TYPE = "storagetype"; public static final String SUBNET = "subnet"; public static final String OWNER = "owner"; public static final String SWAP_OWNER = "swapowner"; public static final String SYSTEM_VM_TYPE = "systemvmtype"; public static final String TAGS = "tags"; public static final String STORAGE_TAGS = "storagetags"; + public static final String STORAGE_ACCESS_GROUPS = "storageaccessgroups"; + public static final String STORAGE_ACCESS_GROUP = "storageaccessgroup"; + public static final String CLUSTER_STORAGE_ACCESS_GROUPS = "clusterstorageaccessgroups"; + public static final String POD_STORAGE_ACCESS_GROUPS = "podstorageaccessgroups"; + public static final String ZONE_STORAGE_ACCESS_GROUPS = "zonestorageaccessgroups"; public static final String SUCCESS = "success"; + public static final String SUCCESS_MESSAGE = "successmessage"; public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine"; public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot"; public static final String TARGET_IQN = "targetiqn"; + public static final String TARIFF_ID = "tariffid"; + public static final String TARIFF_NAME = "tariffname"; + public static final String TASKS_FILTER = "tasksfilter"; public static final String TEMPLATE_FILTER = "templatefilter"; public static final String TEMPLATE_ID = "templateid"; public static final String TEMPLATE_IDS = "templateids"; @@ -510,13 +614,18 @@ public class ApiConstants { public static final String TIMEOUT = "timeout"; public static final String TIMEZONE = "timezone"; public static final String TIMEZONEOFFSET = "timezoneoffset"; + public static final String TENANT_NAME = "tenantname"; public static final String TOTAL = "total"; public static final String TOTAL_SUBNETS = "totalsubnets"; + public static final String TO_CHECKPOINT_ID = "tocheckpointid"; + public static final String TOTAL_QUOTA = "totalquota"; public static final String TYPE = "type"; public static final String TRUST_STORE = "truststore"; public static final String TRUST_STORE_PASSWORD = "truststorepass"; + public static final String UNIT = "unit"; public static final String URL = "url"; public static final String USAGE_INTERFACE = "usageinterface"; + public static final String USED = "used"; public static final String USED_SUBNETS = "usedsubnets"; public static final String USED_IOPS = "usediops"; public static final String USER_DATA = "userdata"; @@ -535,9 +644,18 @@ public class ApiConstants { public static final String USER_CONFIGURABLE = "userconfigurable"; public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist"; public static final String USER_SECRET_KEY = "usersecretkey"; + public static final String USE_VDDK = "usevddk"; public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork"; + public static final String USE_VIRTUAL_ROUTER_IP_RESOLVER = "userouteripresolver"; public static final String UPDATE_IN_SEQUENCE = "updateinsequence"; + public static final String VALIDATION_FORMAT = "validationformat"; public static final String VALUE = "value"; + public static final String VALUE_OPTIONS = "valueoptions"; + public static final String VENDOR_ID = "vendorid"; + public static final String VENDOR_NAME = "vendorname"; + public static final String VGPU_PROFILE_ID = "vgpuprofileid"; + public static final String VGPU_PROFILE_NAME = "vgpuprofilename"; + public static final String VIRTUAL_MACHINE = "virtualmachine"; public static final String VIRTUAL_MACHINE_ID = "virtualmachineid"; public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids"; public static final String VIRTUAL_MACHINE_NAME = "virtualmachinename"; @@ -547,11 +665,18 @@ public class ApiConstants { public static final String VIRTUAL_MACHINE_STATE = "vmstate"; public static final String VIRTUAL_MACHINES = "virtualmachines"; public static final String USAGE_ID = "usageid"; + public static final String USAGE_NAME = "usagename"; public static final String USAGE_TYPE = "usagetype"; public static final String INCLUDE_TAGS = "includetags"; public static final String VLAN = "vlan"; public static final String VLAN_RANGE = "vlanrange"; + public static final String WORKER_SERVICE_OFFERING_ID = "workerofferingid"; + public static final String WORKER_SERVICE_OFFERING_NAME = "workerofferingname"; + public static final String CONTROL_SERVICE_OFFERING_ID = "controlofferingid"; + public static final String CONTROL_SERVICE_OFFERING_NAME = "controlofferingname"; + public static final String ETCD_SERVICE_OFFERING_ID = "etcdofferingid"; + public static final String ETCD_SERVICE_OFFERING_NAME = "etcdofferingname"; public static final String REMOVE_VLAN = "removevlan"; public static final String VLAN_ID = "vlanid"; public static final String ISOLATED_PVLAN = "isolatedpvlan"; @@ -561,8 +686,10 @@ public class ApiConstants { public static final String IS_DEDICATED = "isdedicated"; public static final String TAKEN = "taken"; public static final String VM_AVAILABLE = "vmavailable"; + public static final String VM_DETAILS = "vmdetails"; public static final String VM_LIMIT = "vmlimit"; public static final String VM_TOTAL = "vmtotal"; + public static final String VM_SETTINGS = "vmsettings"; public static final String VM_TYPE = "vmtype"; public static final String VNET = "vnet"; public static final String IS_VOLATILE = "isvolatile"; @@ -630,7 +757,7 @@ public class ApiConstants { public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist"; public static final String ZONE_TOKEN = "zonetoken"; public static final String DHCP_PROVIDER = "dhcpprovider"; - public static final String RESULT = "success"; + public static final String RESULT = "result"; public static final String RESUME = "resume"; public static final String LUN_ID = "lunId"; public static final String IQN = "iqn"; @@ -660,6 +787,7 @@ public class ApiConstants { public static final String ROLE_TYPE = "roletype"; public static final String ROLE_NAME = "rolename"; public static final String PERMISSION = "permission"; + public static final String PERMISSIONS = "permissions"; public static final String RULE = "rule"; public static final String RULES = "rules"; public static final String RULE_ID = "ruleid"; @@ -744,6 +872,7 @@ public class ApiConstants { public static final String LIST_ALL = "listall"; public static final String LIST_ONLY_REMOVED = "listonlyremoved"; public static final String LIST_SYSTEM_VMS = "listsystemvms"; + public static final String LIST_VM_DETAILS = "listvmdetails"; public static final String IP_RANGES = "ipranges"; public static final String IPV4_ROUTING = "ip4routing"; public static final String IPV4_ROUTES = "ip4routes"; @@ -753,6 +882,7 @@ public class ApiConstants { public static final String IS_SOURCE_NAT = "issourcenat"; public static final String IS_STATIC_NAT = "isstaticnat"; public static final String ITERATIONS = "iterations"; + public static final String ITEMS = "items"; public static final String SORT_BY = "sortby"; public static final String CHANGE_CIDR = "changecidr"; public static final String PURPOSE = "purpose"; @@ -876,9 +1006,12 @@ public class ApiConstants { public static final String REGION_ID = "regionid"; public static final String VPC_OFF_ID = "vpcofferingid"; public static final String VPC_OFF_NAME = "vpcofferingname"; + public static final String VPC_OFFERING_CONSERVE_MODE = "vpcofferingconservemode"; public static final String NETWORK = "network"; public static final String VPC_ID = "vpcid"; public static final String VPC_NAME = "vpcname"; + public static final String VPC_GATEWAY_ID = "vpcgatewayid"; + public static final String VPC_GATEWAY_IP = "vpcgatewayip"; public static final String GATEWAY_ID = "gatewayid"; public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy"; public static final String RESOURCE_IDS = "resourceids"; @@ -902,6 +1035,7 @@ public class ApiConstants { public static final String SPLIT_CONNECTIONS = "splitconnections"; public static final String FOR_VPC = "forvpc"; public static final String FOR_NSX = "fornsx"; + public static final String FOR_CKS = "forcks"; public static final String NSX_SUPPORT_LB = "nsxsupportlb"; public static final String NSX_SUPPORTS_INTERNAL_LB = "nsxsupportsinternallb"; public static final String FOR_TUNGSTEN = "fortungsten"; @@ -919,7 +1053,7 @@ public class ApiConstants { public static final String NSX_PROVIDER_PORT = "nsxproviderport"; public static final String NSX_CONTROLLER_ID = "nsxcontrollerid"; public static final String S3_ACCESS_KEY = "accesskey"; - public static final String S3_SECRET_KEY = "secretkey"; + public static final String SECRET_KEY = "secretkey"; public static final String S3_END_POINT = "endpoint"; public static final String S3_BUCKET_NAME = "bucket"; public static final String S3_SIGNER = "s3signer"; @@ -1021,6 +1155,7 @@ public class ApiConstants { public static final String RESOURCE_DETAILS = "resourcedetails"; public static final String RESOURCE_ICON = "icon"; + public static final String RESOURCE_MAP = "resourcemap"; public static final String EXPUNGE = "expunge"; public static final String FOR_DISPLAY = "fordisplay"; public static final String PASSIVE = "passive"; @@ -1052,10 +1187,14 @@ public class ApiConstants { public static final String NETWORK_SPANNED_ZONES = "zonesnetworkspans"; public static final String METADATA = "metadata"; public static final String PHYSICAL_SIZE = "physicalsize"; + public static final String CHAIN_SIZE = "chainsize"; public static final String OVM3_POOL = "ovm3pool"; public static final String OVM3_CLUSTER = "ovm3cluster"; public static final String OVM3_VIP = "ovm3vip"; public static final String CLEAN_UP_DETAILS = "cleanupdetails"; + public static final String CLEAN_UP_EXTERNAL_DETAILS = "cleanupexternaldetails"; + public static final String CLEAN_UP_EXTRA_CONFIG = "cleanupextraconfig"; + public static final String CLEAN_UP_PARAMETERS = "cleanupparameters"; public static final String VIRTUAL_SIZE = "virtualsize"; public static final String NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid"; public static final String NETSCALER_SERVICEPACKAGE_ID = "netscalerservicepackageid"; @@ -1063,6 +1202,7 @@ public class ApiConstants { public static final String ZONE_ID_LIST = "zoneids"; public static final String DESTINATION_ZONE_ID_LIST = "destzoneids"; + public static final String STORAGE_ID_LIST = "storageids"; public static final String ADMIN = "admin"; public static final String CHECKSUM_PARAMETER_PREFIX_DESCRIPTION = "The parameter containing the checksum will be considered a MD5sum if it is not prefixed\n" + " and just a plain ascii/utf8 representation of a hexadecimal string. If it is required to\n" @@ -1104,12 +1244,17 @@ public class ApiConstants { public static final String DOCKER_REGISTRY_EMAIL = "dockerregistryemail"; public static final String ISO_NAME = "isoname"; public static final String ISO_STATE = "isostate"; + public static final String ISO_URL = "isourl"; public static final String SEMANTIC_VERSION = "semanticversion"; public static final String KUBERNETES_VERSION_ID = "kubernetesversionid"; public static final String KUBERNETES_VERSION_NAME = "kubernetesversionname"; public static final String MASTER_NODES = "masternodes"; public static final String NODE_IDS = "nodeids"; public static final String CONTROL_NODES = "controlnodes"; + public static final String ETCD_NODES = "etcdnodes"; + public static final String EXTERNAL_NODES = "externalnodes"; + public static final String IS_EXTERNAL_NODE = "isexternalnode"; + public static final String IS_ETCD_NODE = "isetcdnode"; public static final String MIN_SEMANTIC_VERSION = "minimumsemanticversion"; public static final String MIN_KUBERNETES_VERSION_ID = "minimumkubernetesversionid"; public static final String NODE_ROOT_DISK_SIZE = "noderootdisksize"; @@ -1118,6 +1263,15 @@ public class ApiConstants { public static final String AUTOSCALING_ENABLED = "autoscalingenabled"; public static final String MIN_SIZE = "minsize"; public static final String MAX_SIZE = "maxsize"; + public static final String NODE_TYPE_OFFERING_MAP = "nodeofferings"; + public static final String NODE_TYPE_TEMPLATE_MAP = "nodetemplates"; + public static final String NODE_TYPE_AFFINITY_GROUP_MAP = "nodeaffinitygroups"; + public static final String CONTROL_AFFINITY_GROUP_IDS = "controlaffinitygroupids"; + public static final String CONTROL_AFFINITY_GROUP_NAMES = "controlaffinitygroupnames"; + public static final String WORKER_AFFINITY_GROUP_IDS = "workeraffinitygroupids"; + public static final String WORKER_AFFINITY_GROUP_NAMES = "workeraffinitygroupnames"; + public static final String ETCD_AFFINITY_GROUP_IDS = "etcdaffinitygroupids"; + public static final String ETCD_AFFINITY_GROUP_NAMES = "etcdaffinitygroupnames"; public static final String BOOT_TYPE = "boottype"; public static final String BOOT_MODE = "bootmode"; @@ -1139,6 +1293,7 @@ public class ApiConstants { public static final String PROVIDER_FOR_2FA = "providerfor2fa"; public static final String ISSUER_FOR_2FA = "issuerfor2fa"; public static final String MANDATE_2FA = "mandate2fa"; + public static final String PASSWORD_CHANGE_REQUIRED = "passwordchangerequired"; public static final String SECRET_CODE = "secretcode"; public static final String LOGIN = "login"; public static final String LOGOUT = "logout"; @@ -1161,12 +1316,18 @@ public class ApiConstants { public static final String OBJECT_LOCKING = "objectlocking"; public static final String ENCRYPTION = "encryption"; public static final String QUOTA = "quota"; + public static final String QUOTA_CONSUMED = "quotaconsumed"; + public static final String QUOTA_USAGE = "quotausage"; public static final String ACCESS_KEY = "accesskey"; public static final String SOURCE_NAT_IP = "sourcenatipaddress"; public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid"; public static final String HAS_RULES = "hasrules"; public static final String NSX_DETAIL_KEY = "forNsx"; + public static final String NETRIS_DETAIL_KEY = "forNetris"; + public static final String NETRIS_TAG = "netristag"; + public static final String NETRIS_VXLAN_ID = "netrisvxlanid"; + public static final String NETRIS_URL = "netrisurl"; public static final String DISK_PATH = "diskpath"; public static final String IMPORT_SOURCE = "importsource"; public static final String TEMP_PATH = "temppath"; @@ -1207,6 +1368,13 @@ public class ApiConstants { public static final String OBJECT_STORAGE_LIMIT = "objectstoragelimit"; public static final String OBJECT_STORAGE_TOTAL = "objectstoragetotal"; + public static final String KEEP_MAC_ADDRESS_ON_PUBLIC_NIC = "keepmacaddressonpublicnic"; + + public static final String PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC = + "Indicates whether to use the same MAC address for the public NIC of VRs on the same network. If \"true\", when creating redundant routers or recreating" + + " a VR, CloudStack will use the same MAC address for the public NIC of all VRs. Otherwise, if \"false\", new public NICs will always have " + + " a new MAC address."; + public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " + "a boolean or a numeric value: if it results in a boolean value, the tariff value will be applied according to the result; if it results in a numeric value, the " + "numeric value will be applied; if the result is neither a boolean nor a numeric value, the tariff will not be applied. If the rule is not informed, the tariff " + @@ -1220,8 +1388,32 @@ public class ApiConstants { "however, the following formats are also accepted: \"yyyy-MM-dd HH:mm:ss\" (e.g.: \"2023-01-01 12:00:00\") and \"yyyy-MM-dd\" (e.g.: \"2023-01-01\" - if the time is not " + "added, it will be interpreted as \"23:59:59\"). If the recommended format is not used, the date will be considered in the server timezone."; + public static final String PARAMETER_DESCRIPTION_MAX_BACKUPS = "The maximum number of backups to keep for a VM. " + + "If \"0\", no retention policy will be applied and, thus, no backups from the schedule will be automatically deleted. " + + "This parameter is only supported for the Dummy, NAS and EMC Networker backup provider."; + public static final String VMWARE_DC = "vmwaredc"; + public static final String CSS = "css"; + + public static final String JSON_CONFIGURATION = "jsonconfiguration"; + + public static final String COMMON_NAMES = "commonnames"; + + public static final String COMMON_NAME = "commonname"; + + public static final String DOMAIN_IDS = "domainids"; + + public static final String SHOW_PUBLIC = "showpublic"; + + public static final String LIST_ONLY_DEFAULT_THEME = "listonlydefaulttheme"; + + public static final String RECURSIVE_DOMAINS = "recursivedomains"; + + public static final String VPN_CUSTOMER_GATEWAY_PARAMETERS = "vpncustomergatewayparameters"; + public static final String OBSOLETE_PARAMETERS = "obsoleteparameters"; + public static final String EXCLUDED_PARAMETERS = "excludedparameters"; + /** * This enum specifies IO Drivers, each option controls specific policies on I/O. * Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0). @@ -1274,6 +1466,10 @@ public enum DomainDetails { all, resource, min; } + public enum ExtensionDetails { + all, resource, external, min; + } + public enum ApiKeyAccess { DISABLED(false), ENABLED(true), diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java index 03dc37325d4b..616c37484d87 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiErrorCode.java @@ -22,6 +22,7 @@ */ public enum ApiErrorCode { + BAD_REQUEST(400), UNAUTHORIZED(401), UNAUTHORIZED2FA(511), METHOD_NOT_ALLOWED(405), diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java index cbbcdc3bda42..1ee41ac86c22 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java @@ -21,8 +21,11 @@ import javax.servlet.http.HttpSession; +import org.apache.cloudstack.context.CallContext; + import com.cloud.domain.Domain; import com.cloud.exception.CloudAuthenticationException; +import com.cloud.user.Account; import com.cloud.user.UserAccount; public interface ApiServerService { @@ -48,4 +51,24 @@ public ResponseObject loginUser(HttpSession session, String username, String pas boolean forgotPassword(UserAccount userAccount, Domain domain); boolean resetPassword(UserAccount userAccount, String token, String password); + + String getDomainId(Map params); + + boolean isPostRequestsAndTimestampsEnforced(); + + AsyncCmdResult processAsyncCmd(BaseAsyncCmd cmdObj, Map params, CallContext ctx, Long callerUserId, Account caller) throws Exception; + + class AsyncCmdResult { + public final Long objectId; + public final String objectUuid; + public final BaseAsyncCmd asyncCmd; + public final long jobId; + + public AsyncCmdResult(Long objectId, String objectUuid, BaseAsyncCmd asyncCmd, long jobId) { + this.objectId = objectId; + this.objectUuid = objectUuid; + this.asyncCmd = asyncCmd; + this.jobId = jobId; + } + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java index 6859b0a7f406..c67c5a023e09 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java @@ -29,6 +29,7 @@ public abstract class BaseAsyncCmd extends BaseCmd { public static final String migrationSyncObject = "migration"; public static final String snapshotHostSyncObject = "snapshothost"; public static final String gslbSyncObject = "globalserverloadbalancer"; + public static final String user = "user"; private Object job; diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java index 8680d7f11de3..b9b13dcfd884 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java @@ -19,8 +19,8 @@ public abstract class BaseAsyncCreateCustomIdCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.CUSTOM_ID, type = CommandType.STRING, - description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only") - private String customId; + description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only") + protected String customId; public String getCustomId() { return customId; diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java index b251c6ef2ec2..c1777d3b8f84 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java @@ -21,7 +21,7 @@ public abstract class BaseAsyncCustomIdCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.CUSTOM_ID, type = CommandType.STRING, - description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin}) + description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin}) private String customId; public String getCustomId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java index 0aa8366bcd5c..2a64a1fb6fd8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java @@ -25,7 +25,7 @@ import org.apache.cloudstack.backup.BackupOffering; import org.apache.cloudstack.context.CallContext; -public abstract class BaseBackupListCmd extends BaseListCmd { +public abstract class BaseBackupListCmd extends BaseListAccountResourcesCmd { protected void setupResponseBackupOfferingsList(final List offerings, final Integer count) { final ListResponse response = new ListResponse<>(); diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java index 457afdc88478..00b1bc310d5a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java @@ -35,10 +35,12 @@ import org.apache.cloudstack.acl.ProjectRoleService; import org.apache.cloudstack.acl.RoleService; import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairService; import org.apache.cloudstack.affinity.AffinityGroupService; import org.apache.cloudstack.alert.AlertService; import org.apache.cloudstack.annotation.AnnotationService; import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.gpu.GpuService; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService; import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService; @@ -94,6 +96,7 @@ import com.cloud.utils.db.EntityManager; import com.cloud.utils.db.UUIDManager; import com.cloud.vm.UserVmService; +import com.cloud.vm.VmDetailConstants; import com.cloud.vm.snapshot.VMSnapshotService; public abstract class BaseCmd { @@ -130,6 +133,8 @@ public static enum CommandType { @Inject public UserVmService _userVmService; @Inject + public GpuService gpuService; + @Inject public ManagementService _mgr; @Inject public StorageService _storageService; @@ -216,6 +221,8 @@ public static enum CommandType { @Inject public Ipv6Service ipv6Service; @Inject + public ApiKeyPairService apiKeyPairService; + @Inject public VnfTemplateManager vnfTemplateManager; @Inject public BucketApiService _bucketService; @@ -378,7 +385,7 @@ public List getParamFields() { if (roleIsAllowed) { validFields.add(field); } else { - logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in"); + logger.debug("Ignoring parameter {} as the caller is not authorized to pass it in", parameterAnnotation.name()); } } @@ -484,4 +491,18 @@ public Map convertDetailsToMap(Map details) { } return detailsMap; } + + public Map convertExternalDetailsToMap(Map externalDetails) { + Map customparameterMap = convertDetailsToMap(externalDetails); + Map details = new HashMap<>(); + for (String key : customparameterMap.keySet()) { + String value = customparameterMap.get(key); + details.put(VmDetailConstants.EXTERNAL_DETAIL_PREFIX + key, value); + } + return details; + } + + public String getResourceUuid(String parameterName) { + return CallContext.current().getApiResourceUuid(parameterName); + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java index 7ca9f1efe7ef..8a2292eadd07 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java @@ -22,7 +22,7 @@ public abstract class BaseCustomIdCmd extends BaseCmd { @Parameter(name = ApiConstants.CUSTOM_ID, type = CommandType.STRING, - description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin}) + description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin}) private String customId; public String getCustomId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java index aa5273ace3bc..bb18080dfcc4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java @@ -19,7 +19,7 @@ public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd implements IBaseListAccountResourcesCmd { - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by Account. Must be used with the domainId parameter.") private String accountName; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java index 7a8cee337705..640caa935425 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java @@ -27,10 +27,10 @@ public abstract class BaseListDomainResourcesCmd extends BaseListCmd implements @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "list only resources belonging to the domain specified") + description = "List only resources belonging to the domain specified") private Long domainId; - @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false," + @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "Defaults to false," + " but if true, lists all resources from the parent specified by the domainId till leaves.") private Boolean recursive; diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java index 0bcfba15ea6e..d3c999ddb048 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java @@ -20,7 +20,7 @@ public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd implements IBaseListProjectAndAccountResourcesCmd { - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "list objects by project; if projectid=-1 lists All VMs") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "List objects by project; if projectid=-1 lists All Instances") private Long projectId; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java index 0e8e136a6c19..20c270c30b21 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java @@ -19,7 +19,7 @@ import org.apache.commons.lang3.BooleanUtils; public abstract class BaseListRetrieveOnlyResourceCountCmd extends BaseListTaggedResourcesCmd { - @Parameter(name = ApiConstants.RETRIEVE_ONLY_RESOURCE_COUNT, type = CommandType.BOOLEAN, description = "makes the API's response contains only the resource count") + @Parameter(name = ApiConstants.RETRIEVE_ONLY_RESOURCE_COUNT, type = CommandType.BOOLEAN, description = "Makes the API's response contains only the resource count") private Boolean retrieveOnlyResourceCount; public Boolean getRetrieveOnlyResourceCount() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java index be95547a8a73..27e58233b249 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java @@ -33,7 +33,7 @@ public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd implem //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplatePermissionsResponse.class, required = true, description = "the template ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplatePermissionsResponse.class, required = true, description = "The Template ID") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java index 45016c1a2a26..ebf0c4b19a00 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java @@ -25,11 +25,11 @@ public abstract class BaseResponse implements ResponseObject { private transient String objectName; @SerializedName(ApiConstants.JOB_ID) - @Param(description = "the UUID of the latest async job acting on this object") + @Param(description = "The UUID of the latest async job acting on this object") protected String jobId; @SerializedName(ApiConstants.JOB_STATUS) - @Param(description = "the current status of the latest async job acting on this object") + @Param(description = "The current status of the latest async job acting on this object") private Integer jobStatus; public BaseResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java index f7c0c21395f8..19d88382ce78 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java @@ -22,7 +22,7 @@ public abstract class BaseResponseWithAnnotations extends BaseResponse { @SerializedName(ApiConstants.HAS_ANNOTATIONS) - @Param(description = "true if the entity/resource has annotations") + @Param(description = "True if the entity/resource has annotations") private Boolean hasAnnotation; public Boolean hasAnnotation() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java index 1ffe4657bd98..48be5c6b4de0 100755 --- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java @@ -22,11 +22,11 @@ public abstract class BaseResponseWithAssociatedNetwork extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) - @Param(description = "the ID of the Network associated with this private gateway") + @Param(description = "The ID of the Network associated with this private gateway") private String associatedNetworkId; @SerializedName(ApiConstants.ASSOCIATED_NETWORK) - @Param(description = "the name of the Network associated with this private gateway") + @Param(description = "The name of the Network associated with this private gateway") private String associatedNetworkName; public void setAssociatedNetworkId(String associatedNetworkId) { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java index 710b9f0b9ecf..a01cd5677bac 100755 --- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java @@ -26,7 +26,7 @@ public abstract class BaseResponseWithTagInformation extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated", responseObject = ResourceTagResponse.class) protected Set tags; public void addTag(ResourceTagResponse tag) { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java index 9a8282df1121..94c5d8ff39fc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java @@ -30,45 +30,49 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if image is bootable, false otherwise; available only for updateIso API") + @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "True if image is bootable, false otherwise; available only for updateIso API") private Boolean bootable; - @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requires HVM, false otherwise; available only for updateTemplate API") + @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "True if the Template requires HVM, false otherwise; available only for updateTemplate API") private Boolean requiresHvm; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the image", length = 4096) + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the image", length = 4096) private String displayText; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the image file") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the image file") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the image file") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, length = 251, description = "The name of the image file") private String templateName; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, - description = "the ID of the OS type that best represents the OS of this image.") + description = "The ID of the OS type that best represents the OS of this image.") private Long osTypeId; - @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "the format for the image") + @Parameter(name = ApiConstants.FORCE_UPDATE_OS_TYPE, type = CommandType.BOOLEAN, since = "4.21", description = "Force OS type update. Warning: Updating OS type will " + + "update the guest OS configuration for all the existing Instances deployed with this template/iso, which may affect their behavior.") + private Boolean forceUpdateOsType; + + @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "The format for the image") private String format; - @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "true if the image supports the password reset feature; default is false") + @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "True if the image supports the password reset feature; default is false") private Boolean passwordEnabled; - @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false") + @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the SSHkey upload feature; default is false") private Boolean sshKeyEnabled; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the template, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the Template, integer") private Integer sortKey; @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, - description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") + description = "True if Template/ISO contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory") private Boolean isDynamicallyScalable; - @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router") + @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "True if the Template type is routing i.e., if Template is used to deploy router") protected Boolean isRoutingType; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61") @@ -76,11 +80,11 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd { @Parameter(name = ApiConstants.CLEAN_UP_DETAILS, type = CommandType.BOOLEAN, - description = "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)") + description = "Optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)") private Boolean cleanupDetails; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64", + description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; @@ -112,6 +116,10 @@ public Long getOsTypeId() { return osTypeId; } + public Boolean getForceUpdateOsType() { + return forceUpdateOsType; + } + public Boolean getPasswordEnabled() { return passwordEnabled; } @@ -145,8 +153,8 @@ public Map getDetails() { return (Map) (paramsCollection.toArray())[0]; } - public boolean isCleanupDetails(){ - return cleanupDetails == null ? false : cleanupDetails.booleanValue(); + public boolean isCleanupDetails() { + return cleanupDetails != null && cleanupDetails; } public CPU.CPUArch getCPUArch() { diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java index e6ee0897db02..0a62591ddc24 100644 --- a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java @@ -40,31 +40,31 @@ protected String getResponseName() { @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "a comma delimited list of accounts within caller's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of Accounts within caller's domain. If specified, \"op\" parameter has to be passed in.") private List accountNames; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the template ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The Template ID") private Long id; - @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise") + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True for featured Template/ISO, false otherwise") private Boolean featured; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true for public template/iso, false for private templates/isos") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True for public Template/ISO, false for private Templates/ISOs") private Boolean isPublic; @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, - description = "true if the template/iso is extractable, false other wise. Can be set only by root admin") + description = "True if the Template/ISO is extractable, false otherwise. Can be set only by root admin") private Boolean isExtractable; - @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)") + @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "Permission operator (add, remove, reset)") private String operation; @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class, - description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of projects. If specified, \"op\" parameter has to be passed in.") private List projectIds; // /////////////////////////////////////////////////// @@ -121,7 +121,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Template/ISO permissions"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java index ea0d946ee417..b0738cf78e16 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java +++ b/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java @@ -22,28 +22,28 @@ import java.util.Map; import java.util.Set; -import com.cloud.bgp.ASNumber; -import com.cloud.bgp.ASNumberRange; - -import org.apache.cloudstack.storage.object.Bucket; +import org.apache.cloudstack.api.response.ConsoleSessionResponse; +import org.apache.cloudstack.consoleproxy.ConsoleSession; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission; import org.apache.cloudstack.affinity.AffinityGroup; import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.ApiConstants.HostDetails; import org.apache.cloudstack.api.ApiConstants.VMDetails; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd; -import org.apache.cloudstack.api.response.AccountResponse; -import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse; import org.apache.cloudstack.api.response.ASNRangeResponse; import org.apache.cloudstack.api.response.ASNumberResponse; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse; import org.apache.cloudstack.api.response.AsyncJobResponse; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.BackupOfferingResponse; import org.apache.cloudstack.api.response.BackupRepositoryResponse; -import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.api.response.BackupScheduleResponse; +import org.apache.cloudstack.api.response.BaseRolePermissionResponse; import org.apache.cloudstack.api.response.BucketResponse; import org.apache.cloudstack.api.response.CapacityResponse; import org.apache.cloudstack.api.response.ClusterResponse; @@ -60,25 +60,27 @@ import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.cloudstack.api.response.EventResponse; import org.apache.cloudstack.api.response.ExtractResponse; -import org.apache.cloudstack.api.response.SharedFSResponse; import org.apache.cloudstack.api.response.FirewallResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.GuestOsMappingResponse; import org.apache.cloudstack.api.response.GuestVlanRangeResponse; import org.apache.cloudstack.api.response.GuestVlanResponse; +import org.apache.cloudstack.api.response.GuiThemeResponse; import org.apache.cloudstack.api.response.HostForMigrationResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse; import org.apache.cloudstack.api.response.HypervisorGuestOsNamesResponse; import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.cloudstack.api.response.IpQuarantineResponse; import org.apache.cloudstack.api.response.ImageStoreResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse; import org.apache.cloudstack.api.response.IpForwardingRuleResponse; +import org.apache.cloudstack.api.response.IpQuarantineResponse; import org.apache.cloudstack.api.response.IsolationMethodResponse; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; import org.apache.cloudstack.api.response.LBHealthCheckResponse; import org.apache.cloudstack.api.response.LBStickinessResponse; import org.apache.cloudstack.api.response.ListResponse; @@ -115,6 +117,7 @@ import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.ServiceResponse; +import org.apache.cloudstack.api.response.SharedFSResponse; import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse; @@ -144,7 +147,6 @@ import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.VpnUsersResponse; import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.cloudstack.backup.Backup; import org.apache.cloudstack.backup.BackupOffering; import org.apache.cloudstack.backup.BackupRepository; import org.apache.cloudstack.backup.BackupSchedule; @@ -153,16 +155,21 @@ import org.apache.cloudstack.direct.download.DirectDownloadCertificate; import org.apache.cloudstack.direct.download.DirectDownloadCertificateHostMap; import org.apache.cloudstack.direct.download.DirectDownloadManager; +import org.apache.cloudstack.gui.theme.GuiThemeJoin; import org.apache.cloudstack.management.ManagementServerHost; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; import org.apache.cloudstack.region.PortableIp; import org.apache.cloudstack.region.PortableIpRange; import org.apache.cloudstack.region.Region; import org.apache.cloudstack.secstorage.heuristics.Heuristic; -import org.apache.cloudstack.storage.sharedfs.SharedFS; +import org.apache.cloudstack.storage.object.Bucket; import org.apache.cloudstack.storage.object.ObjectStore; +import org.apache.cloudstack.storage.sharedfs.SharedFS; import org.apache.cloudstack.usage.Usage; +import org.apache.cloudstack.vm.UnmanagedInstanceTO; +import com.cloud.bgp.ASNumber; +import com.cloud.bgp.ASNumberRange; import com.cloud.capacity.Capacity; import com.cloud.configuration.ResourceCount; import com.cloud.configuration.ResourceLimit; @@ -223,10 +230,11 @@ import com.cloud.projects.ProjectInvitation; import com.cloud.region.ha.GlobalLoadBalancerRule; import com.cloud.resource.RollingMaintenanceManager; -import com.cloud.server.ResourceTag; import com.cloud.server.ResourceIcon; +import com.cloud.server.ResourceTag; import com.cloud.storage.GuestOS; import com.cloud.storage.GuestOSHypervisor; +import com.cloud.storage.GuestOsCategory; import com.cloud.storage.ImageStore; import com.cloud.storage.Snapshot; import com.cloud.storage.StoragePool; @@ -240,14 +248,13 @@ import com.cloud.user.UserAccount; import com.cloud.user.UserData; import com.cloud.uservm.UserVm; -import com.cloud.utils.net.Ip; import com.cloud.utils.Pair; +import com.cloud.utils.net.Ip; import com.cloud.vm.InstanceGroup; import com.cloud.vm.Nic; import com.cloud.vm.NicSecondaryIp; import com.cloud.vm.VirtualMachine; import com.cloud.vm.snapshot.VMSnapshot; -import org.apache.cloudstack.vm.UnmanagedInstanceTO; public interface ResponseGenerator { UserResponse createUserResponse(UserAccount user); @@ -310,6 +317,8 @@ public interface ResponseGenerator { PodResponse createPodResponse(Pod pod, Boolean showCapacities); + PodResponse createMinimalPodResponse(Pod pod); + ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities, Boolean showResourceIcon); DataCenterGuestIpv6PrefixResponse createDataCenterGuestIpv6PrefixResponse(DataCenterGuestIpv6Prefix prefix); @@ -324,6 +333,8 @@ public interface ResponseGenerator { ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities); + ClusterResponse createMinimalClusterResponse(Cluster cluster); + FirewallRuleResponse createPortForwardingRuleResponse(PortForwardingRule fwRule); IpForwardingRuleResponse createIpForwardingRuleResponse(StaticNatRule fwRule); @@ -332,6 +343,8 @@ public interface ResponseGenerator { UserVm findUserVmById(Long vmId); + UserVm findUserVmByNicId(Long nicId); + Volume findVolumeById(Long volumeId); Account findAccountByNameDomain(String accountName, Long domainId); @@ -481,6 +494,10 @@ List createTemplateResponses(ResponseView view, VirtualMachine AutoScaleVmGroupResponse createAutoScaleVmGroupResponse(AutoScaleVmGroup vmGroup); + GuestOSCategoryResponse createGuestOSCategoryResponse(GuestOsCategory guestOsCategory); + + GuestOSCategoryResponse createGuestOSCategoryResponse(GuestOsCategory guestOsCategory, boolean showIcon); + GuestOSResponse createGuestOSResponse(GuestOS os); GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor osHypervisor); @@ -523,8 +540,6 @@ List createTemplateResponses(ResponseView view, VirtualMachine UserDataResponse createUserDataResponse(UserData userData); - BackupResponse createBackupResponse(Backup backup); - BackupScheduleResponse createBackupScheduleResponse(BackupSchedule backup); BackupOfferingResponse createBackupOfferingResponse(BackupOffering policy); @@ -568,4 +583,14 @@ List createTemplateResponses(ResponseView view, VirtualMachine BackupRepositoryResponse createBackupRepositoryResponse(BackupRepository repository); SharedFSResponse createSharedFSResponse(ResponseView view, SharedFS sharedFS); + + void updateTemplateIsoResponsesForIcons(List responses, ResourceTag.ResourceObjectType type); + + GuiThemeResponse createGuiThemeResponse(GuiThemeJoin guiThemeJoin); + + ConsoleSessionResponse createConsoleSessionResponse(ConsoleSession consoleSession, ResponseView responseView); + + ApiKeyPairResponse createKeyPairResponse(ApiKeyPair keyPair); + + ListResponse createKeypairPermissionsResponse(List permissions); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java index 6dbc6acc59a9..cc154ed964b3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java @@ -50,12 +50,12 @@ public class CreateAccountCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "Name of the account to be created. The user will be added to this newly created account. If no account is specified, the username will be used as the account name.") + description = "Name of the Account to be created. The user will be added to this newly created account. If no Account is specified, the username will be used as the Account name.") private String accountName; @Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.INTEGER, - description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin") + description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin") private Integer accountType; @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.") @@ -64,13 +64,13 @@ public class CreateAccountCmd extends BaseCmd { @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.") private Long domainId; - @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "email") + @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "E-mail") private String email; - @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "firstname") + @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "First name") private String firstName; - @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "lastname") + @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "Last name") private String lastName; @Parameter(name = ApiConstants.PASSWORD, @@ -87,16 +87,16 @@ public class CreateAccountCmd extends BaseCmd { @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Unique username.") private String userName; - @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the account's networks") + @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the Account's Networks") private String networkDomain; - @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters") + @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for Account used to store specific parameters") private Map details; - @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding account from external provisioning system") + @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding Account from external provisioning system") private String accountUUID; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding Account from external provisioning system") private String userUUID; ///////////////////////////////////////////////////// @@ -177,7 +177,7 @@ public long getEntityOwnerId() { @Override public void execute() { validateParams(); - CallContext.current().setEventDetails("Account Name: " + getUsername() + ", Domain Id:" + getDomainId()); + CallContext.current().setEventDetails("Account Name: " + getUsername() + ", Domain ID:" + getResourceUuid(ApiConstants.DOMAIN_ID)); UserAccount userAccount = _accountService.createUserAccount(this); if (userAccount != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java index a90fc4aebe9c..c207801e3640 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java @@ -35,7 +35,7 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {Account.class}, +@APICommand(name = "deleteAccount", description = "Deletes an Account and all Users associated with this Account", responseObject = SuccessResponse.class, entityType = {Account.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAccountCmd extends BaseAsyncCmd { @@ -79,8 +79,8 @@ public String getEventType() { @Override public String getEventDescription() { Account account = _accountService.getAccount(getId()); - return (account != null ? "Deleting user account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users" - : "Account delete, but this account does not exist in the system"); + return (account != null ? "Deleting user Account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users" + : "Cannot delete Account - it does not exist in the system"); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java index 55293eca619e..f7f8bd974272 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java @@ -50,13 +50,13 @@ public class DisableAccountCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Disables specified account.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Disables specified Account.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Disables specified account in this domain.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Disables specified Account in this domain.") private Long domainId; - @Parameter(name = ApiConstants.LOCK, type = CommandType.BOOLEAN, required = true, description = "If true, only lock the account; else disable the account") + @Parameter(name = ApiConstants.LOCK, type = CommandType.BOOLEAN, required = true, description = "If true, only lock the Account; else disable the Account") private Boolean lockRequested; @Inject @@ -108,19 +108,27 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "disabling account: " + getAccountName() + " in domain: " + getDomainId(); + String message = "Disabling Account "; + + if (getId() != null) { + message += "with ID: " + getResourceUuid(ApiConstants.ID); + } else { + message += getAccountName() + " in Domain: " + getResourceUuid(ApiConstants.DOMAIN_ID); + } + + return message; } @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId()); + CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getResourceUuid(ApiConstants.DOMAIN_ID)); Account result = _regionService.disableAccount(this); if (result != null){ AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock Account" : "Failed to disable Account"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java index da96383f1345..7478bc8b8116 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java @@ -46,10 +46,10 @@ public class EnableAccountCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Enables specified account.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Enables specified Account.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Enables specified account in this domain.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Enables specified Account in this domain.") private Long domainId; @Inject @@ -98,7 +98,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Account"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java index 09a626ac9547..50e9ba4989cd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java @@ -23,7 +23,7 @@ import com.cloud.user.Account; -@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Full, entityType = {Account.class}, +@APICommand(name = "listAccounts", description = "Lists Accounts and provides detailed Account information for listed Accounts", responseObject = AccountResponse.class, responseView = ResponseView.Full, entityType = {Account.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListAccountsCmdByAdmin extends ListAccountsCmd { } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java index d7847373e927..3ec191acf846 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java @@ -28,7 +28,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "lockAccount", - description = "This deprecated function used to locks an account. Look for the API DisableAccount instead", + description = "This deprecated function used to lock an Account. Look for the API DisableAccount instead", responseObject = AccountResponse.class, entityType = {Account.class}, requestHasSensitiveInfo = false, @@ -47,7 +47,7 @@ public class LockAccountCmd extends BaseCmd { type = CommandType.UUID, entityType = DomainResponse.class, required = true, - description = "Locks the specified account on this domain.") + description = "Locks the specified Account on this domain.") private Long domainId; ///////////////////////////////////////////////////// @@ -78,6 +78,6 @@ public long getEntityOwnerId() { @Override public void execute() { - throw new CloudRuntimeException("LockAccount does not lock accounts. Its implementation is disabled. Use DisableAccount instead"); + throw new CloudRuntimeException("LockAccount does not lock Accounts. Its implementation is disabled. Use DisableAccount instead."); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java index 3347a0d09f37..b6b975ae1ce7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java @@ -41,7 +41,7 @@ import com.cloud.user.Account; -@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class}, +@APICommand(name = "updateAccount", description = "Updates Account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class}, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateAccountCmd extends BaseCmd implements UserCmd { @@ -52,24 +52,24 @@ public class UpdateAccountCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Current account name") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Current Account name") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The UUID of the domain where the account exists") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The UUID of the domain where the Account exists") private Long domainId; - @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "The UUID of the dynamic role to set for the account") + @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "The UUID of the dynamic role to set for the Account") private Long roleId; - @Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, description = "New name for the account") + @Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, description = "New name for the Account") private String newName; @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, - description = "Network domain for the account's networks; empty string will update domainName with NULL value") + description = "Network domain for the Account's networks; empty string will update domainName with NULL value") private String networkDomain; - @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the account used to store specific parameters") + @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the Account used to store specific parameters") private Map details; @Parameter(name = ApiConstants.API_KEY_ACCESS, type = CommandType.STRING, description = "Determines if Api key access for this user is enabled, disabled or inherits the value from its parent, the domain level setting api.key.access", since = "4.20.1.0", authorized = {RoleType.Admin}) @@ -144,7 +144,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Account"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java index e67a3e2c0a00..59a09ef7a486 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java @@ -109,7 +109,7 @@ private void validateRoleParameters() { } if (getRoleId() != null && getRoleId() < 1L) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role ID provided"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java index 232c4760e1e6..13405431f63e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java @@ -81,7 +81,7 @@ public void execute() { if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } - CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription()); + CallContext.current().setEventDetails("Role ID: " + role.getUuid() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription()); final RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription()); if (rolePermission == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission"); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java index fd2d11aeda0a..80ec08260ab2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java @@ -70,7 +70,7 @@ public void execute() { if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id"); } - CallContext.current().setEventDetails("Role id: " + role.getId()); + CallContext.current().setEventDetails("Role ID: " + role.getUuid()); boolean result = roleService.deleteRole(role); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java index bedaca9e23af..cf4a62bf6c43 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java @@ -68,7 +68,7 @@ public void execute() { if (rolePermission == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided"); } - CallContext.current().setEventDetails("Role permission id: " + rolePermission.getId()); + CallContext.current().setEventDetails("Role permission ID: " + rolePermission.getUuid()); boolean result = roleService.deleteRolePermission(rolePermission); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java index 80cb92c8362f..2c5659b2bc4b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java @@ -55,7 +55,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id"); } - CallContext.current().setEventDetails("Role id: " + role.getId()); + CallContext.current().setEventDetails("Role ID: " + role.getUuid()); boolean result = roleService.disableRole(role); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java index c4a6505d52f6..05dfbe1270fa 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java @@ -55,7 +55,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id"); } - CallContext.current().setEventDetails("Role id: " + role.getId()); + CallContext.current().setEventDetails("Role ID: " + role.getUuid()); boolean result = roleService.enableRole(role); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java index 7d002cd889b6..78fe062ac43e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java @@ -46,7 +46,7 @@ public class UpdateRoleCmd extends RoleCmd { description = "ID of the role", validations = {ApiArgValidator.PositiveNumber}) private Long roleId; - @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "creates a role with this unique name") + @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "Creates a role with this unique name") private String roleName; @Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, description = "The description of the role") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java index 3f926092ec3e..992564413f6b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java @@ -53,7 +53,7 @@ public class UpdateRolePermissionCmd extends BaseCmd { private Long roleId; @Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = RolePermissionResponse.class, - description = "The parent role permission uuid, use 0 to move this rule at the top of the list") + description = "The parent role permission UUID, use 0 to move this rule at the top of the list") private List rulePermissionOrder; @Parameter(name = ApiConstants.RULE_ID, type = CommandType.UUID, entityType = RolePermissionResponse.class, @@ -111,7 +111,7 @@ public void execute() { if (getRuleId() != null || getRulePermission() != null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder"); } - CallContext.current().setEventDetails("Reordering permissions for role id: " + role.getId()); + CallContext.current().setEventDetails("Reordering permissions for role with ID: " + role.getUuid()); final List rolePermissionsOrder = new ArrayList<>(); for (Long rolePermissionId : getRulePermissionOrder()) { final RolePermission rolePermission = roleService.findRolePermission(rolePermissionId); @@ -129,7 +129,7 @@ public void execute() { if (rolePermission == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid rule id provided"); } - CallContext.current().setEventDetails("Updating permission for rule id: " + getRuleId() + " to: " + getRulePermission().toString()); + CallContext.current().setEventDetails("Updating permission for rule with ID: " + getResourceUuid(ApiConstants.RULE_ID) + " to: " + getRulePermission().toString()); result = roleService.updateRolePermission(role, rolePermission, getRulePermission()); } SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java index ed17a876b248..f71daee5b531 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java @@ -41,7 +41,7 @@ public class CreateProjectRoleCmd extends ProjectRoleCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true, - description = "creates a project role with this unique name") + description = "Creates a project role with this unique name") private String projectRoleName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java index d39c2312aa91..e085c10cee0b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java @@ -72,7 +72,7 @@ public void execute() { if (projectRole == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid project role ID provided"); } - CallContext.current().setEventDetails("Project Role ID: " + projectRole.getId() + ", Rule:" + getRule() + ", Permission: " + getPermission() + ", Description: " + getDescription()); + CallContext.current().setEventDetails("Project Role ID: " + projectRole.getUuid() + ", Rule:" + getRule() + ", Permission: " + getPermission() + ", Description: " + getDescription()); final ProjectRolePermission projectRolePermission = projRoleService.createProjectRolePermission(this); if (projectRolePermission == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create project role permission"); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java index 9f8d82489584..84f73e7a1a32 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java @@ -69,7 +69,7 @@ public void execute() { if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find project role with provided id"); } - CallContext.current().setEventDetails("Deleting Project Role with id: " + role.getId()); + CallContext.current().setEventDetails("Deleting Project Role with ID: " + role.getUuid()); boolean result = projRoleService.deleteProjectRole(role, getProjectId()); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java index ac68278535e2..d7941a6a4cc3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java @@ -70,7 +70,7 @@ public void execute() { if (rolePermission == null || rolePermission.getProjectId() != getProjectId()) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided for the project"); } - CallContext.current().setEventDetails("Deleting Project Role permission with id: " + rolePermission.getId()); + CallContext.current().setEventDetails("Deleting Project Role permission with ID: " + rolePermission.getUuid()); boolean result = projRoleService.deleteProjectRolePermission(rolePermission); SuccessResponse response = new SuccessResponse(); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java index e876dbc9b58a..dedbb410ea56 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java @@ -72,7 +72,7 @@ public String getRoleName() { @Override public void execute() { - List projectRoles; + List projectRoles = new ArrayList<>(); if (getProjectId() != null && getProjectRoleId() != null) { projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId())); } else if (StringUtils.isNotBlank(getRoleName())) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java index 3bc8b3d61868..80dbfd71275f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java @@ -43,7 +43,7 @@ public class UpdateProjectRoleCmd extends ProjectRoleCmd { private Long id; @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, - description = "creates a project role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty}) + description = "Creates a project role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty}) private String projectRoleName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java index dd59310c66ae..fd0c043f2321 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java @@ -57,7 +57,7 @@ public class UpdateProjectRolePermissionCmd extends BaseCmd { private Long projectId; @Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectRolePermissionResponse.class, - description = "The parent role permission uuid, use 0 to move this rule at the top of the list") + description = "ID of the parent role permission, use 0 to move this rule at the top of the list") private List projectRulePermissionOrder; @Parameter(name = ApiConstants.PROJECT_ROLE_PERMISSION_ID, type = CommandType.UUID, entityType = ProjectRolePermissionResponse.class, @@ -115,7 +115,7 @@ public void execute() { if (getProjectRuleId() != null || getProjectRolePermission() != null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder"); } - CallContext.current().setEventDetails("Reordering permissions for role id: " + projectRole.getId()); + CallContext.current().setEventDetails("Reordering permissions for role with ID: " + projectRole.getUuid()); result = updateProjectRolePermissionOrder(projectRole); } else if (getProjectRuleId() != null || getProjectRolePermission() != null ) { @@ -123,7 +123,7 @@ public void execute() { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder"); } ProjectRolePermission rolePermission = getValidProjectRolePermission(); - CallContext.current().setEventDetails("Updating project role permission for rule id: " + getProjectRuleId() + " to: " + getProjectRolePermission().toString()); + CallContext.current().setEventDetails("Updating project role permission for rule ID: " + getProjectRuleId() + " to: " + getProjectRolePermission().toString()); result = projRoleService.updateProjectRolePermission(projectId, projectRole, rolePermission, getProjectRolePermission()); } SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java index 7397697bd2cc..88c48103c1b4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java @@ -40,7 +40,7 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "The ID of the zone") private String zoneId; @Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java index 672691ffbd8f..a34de31f78e1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd; import org.apache.cloudstack.api.response.IPAddressResponse; -@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full, +@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an Account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AssociateIPAddrCmdByAdmin extends AssociateIPAddrCmd implements AdminCmd { } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java index 4bd6aa7227c8..9976747e1b62 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.network.IpAddress; -@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Full, +@APICommand(name = "listPublicIpAddresses", description = "Lists all public IP addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, entityType = {IpAddress.class}) public class ListPublicIpAddressesCmdByAdmin extends ListPublicIpAddressesCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java index 7d4cab6a0ac4..266c8eecd58c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java @@ -70,7 +70,7 @@ public void execute() { response.setDisplayText("IP is released successfully"); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod ip "); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod IP"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java index 43e70838e18f..fbe2d3cc0bd2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java @@ -26,7 +26,7 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the " +@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of an Instance. The Instance has to be stopped and restarted for the " + "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java index c2ded921c401..834fda1834bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java @@ -33,22 +33,22 @@ import org.apache.cloudstack.context.CallContext; import org.apache.commons.lang3.BooleanUtils; -@APICommand(name = "addAnnotation", description = "add an annotation.", responseObject = AnnotationResponse.class, +@APICommand(name = "addAnnotation", description = "Add an annotation.", responseObject = AnnotationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.11", authorized = {RoleType.Admin}) public class AddAnnotationCmd extends BaseCmd { - @Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "the annotation text") + @Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "The annotation text") private String annotation; @Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "The following entity types are allowed VM, VOLUME, SNAPSHOT, VM_SNAPSHOT, INSTANCE_GROUP, SSH_KEYPAIR, USER_DATA, NETWORK, VPC, PUBLIC_IP_ADDRESS, VPN_CUSTOMER_GATEWAY, TEMPLATE, ISO, KUBERNETES_CLUSTER, SERVICE_OFFERING, DISK_OFFERING, NETWORK_OFFERING, ZONE, POD, CLUSTER, HOST, DOMAIN, PRIMARY_STORAGE, SECONDARY_STORAGE, VR, SYSTEM_VM, AUTOSCALE_VM_GROUP, MANAGEMENT_SERVER") private String entityType; - @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "the id of the entity to annotate") + @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "The ID of the entity to annotate") private String entityUuid; @Parameter(name = ApiConstants.ADMINS_ONLY, type = CommandType.BOOLEAN, since = "4.16.0", - description = "the annotation is visible for admins only") + description = "The annotation is visible for admins only") private Boolean adminsOnly; public String getAnnotation() { @@ -77,7 +77,7 @@ public boolean isAdminsOnly() { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { - Preconditions.checkNotNull(getEntityUuid(),"I have to have an entity to set an annotation on!"); + Preconditions.checkNotNull(getEntityUuid(),"I need to have an entity to set an annotation on!"); Preconditions.checkState(AnnotationService.EntityType.contains(entityType),(java.lang.String)"'%s' is not a valid EntityType to put annotations on", entityType); AnnotationResponse annotationResponse = annotationService.addAnnotation(this); annotationResponse.setResponseName(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java index 3df4536786f4..fcaba5154e1f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java @@ -37,22 +37,22 @@ public class ListAnnotationsCmd extends BaseListCmd { - @Parameter(name = ApiConstants.ID, type = CommandType.STRING, description = "the id of the annotation") + @Parameter(name = ApiConstants.ID, type = CommandType.STRING, description = "The ID of the annotation") private String uuid; - @Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "the entity type") + @Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "The entity type") private String entityType; - @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "the id of the entity for which to show annotations") + @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "The ID of the entity for which to show annotations") private String entityUuid; @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, since = "4.16.0", - description = "optional: the id of the user of the annotation", required = false) + description = "Optional: The ID of the user of the annotation", required = false) private String userUuid; @Parameter(name = ApiConstants.ANNOTATION_FILTER, type = CommandType.STRING, since = "4.16.0", - description = "possible values are \"self\" and \"all\". " + description = "Possible values are \"self\" and \"all\". " + "* self : annotations that have been created by the calling user. " + "* all : all the annotations the calling user can access") private String annotationFilter; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java index 693ad09bfa9b..d173c35289f2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java @@ -30,12 +30,12 @@ import org.apache.cloudstack.api.response.AnnotationResponse; import org.apache.cloudstack.context.CallContext; -@APICommand(name = "removeAnnotation", description = "remove an annotation.", responseObject = AnnotationResponse.class, +@APICommand(name = "removeAnnotation", description = "Remove an annotation.", responseObject = AnnotationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.11", authorized = {RoleType.Admin}) public class RemoveAnnotationCmd extends BaseCmd { - @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "the id of the annotation") + @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "The ID of the annotation") private String uuid; public String getUuid() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java index b1b7295510cd..d0bd7042ead8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java @@ -30,7 +30,7 @@ import org.apache.cloudstack.api.response.AnnotationResponse; import org.apache.cloudstack.context.CallContext; -@APICommand(name = "updateAnnotationVisibility", description = "update an annotation visibility.", +@APICommand(name = "updateAnnotationVisibility", description = "Update an annotation visibility.", responseObject = AnnotationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16", authorized = {RoleType.Admin}) @@ -38,11 +38,11 @@ public class UpdateAnnotationVisibilityCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, - description = "the id of the annotation") + description = "The ID of the annotation") private String uuid; @Parameter(name = ApiConstants.ADMINS_ONLY, type = CommandType.BOOLEAN, required = true, - description = "the annotation is visible for admins only") + description = "The annotation is visible for admins only") private Boolean adminsOnly; public String getUuid() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java index 7fa66ffff1f4..d7be56bf3f46 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.admin.autoscale; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -31,7 +32,7 @@ import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "createCounter", description = "Adds metric counter for VM auto scaling", responseObject = CounterResponse.class, +@APICommand(name = "createCounter", description = "Adds metric counter for Instance auto scaling", responseObject = CounterResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateCounterCmd extends BaseAsyncCreateCmd { private static final String s_name = "counterresponse"; @@ -89,9 +90,6 @@ public void create() { if (ctr != null) { this.setEntityId(ctr.getId()); this.setEntityUuid(ctr.getUuid()); - CounterResponse response = _responseGenerator.createCounterResponse(ctr); - response.setResponseName(getCommandName()); - this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName()); } @@ -99,6 +97,11 @@ public void create() { @Override public void execute() { + CallContext.current().setEventDetails("Counter ID: " + getEntityUuid()); + Counter ctr = _autoScaleService.getCounter(getEntityId()); + CounterResponse response = _responseGenerator.createCounterResponse(ctr); + response.setResponseName(getCommandName()); + this.setResponseObject(response); } @Override @@ -113,7 +116,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating a new Counter"; + return "Creating a new Counter"; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java index b7b2ce5cb70d..8e941965e84b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java @@ -32,7 +32,7 @@ import com.cloud.exception.ResourceInUseException; import com.cloud.user.Account; -@APICommand(name = "deleteCounter", description = "Deletes a counter for VM auto scaling", responseObject = SuccessResponse.class, +@APICommand(name = "deleteCounter", description = "Deletes a counter for Instance auto scaling", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteCounterCmd extends BaseAsyncCmd { @@ -40,7 +40,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "the ID of the counter") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "The ID of the counter") private Long id; // /////////////////////////////////////////////////// @@ -61,7 +61,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - logger.warn("Failed to delete counter with Id: " + getId()); + logger.warn("Failed to delete counter with Id: {}", getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter."); } } @@ -91,6 +91,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting a counter."; + return "Deleting auto scaling counter with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java new file mode 100644 index 000000000000..500a77f3d4fc --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java @@ -0,0 +1,166 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; +import org.apache.cloudstack.api.response.BackupOfferingResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.BackupOffering; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.utils.exception.CloudRuntimeException; + +import java.util.Arrays; +import java.util.List; +import java.util.function.LongFunction; + +@APICommand(name = "cloneBackupOffering", + description = "Clones a backup offering from an existing offering", + responseObject = BackupOfferingResponse.class, since = "4.23.0", + authorized = {RoleType.Admin}) +public class CloneBackupOfferingCmd extends BaseAsyncCmd implements DomainAndZoneIdResolver { + + @Inject + protected BackupManager backupManager; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + //////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, type = BaseCmd.CommandType.UUID, entityType = BackupOfferingResponse.class, + required = true, description = "The ID of the source backup offering to clone from") + private Long sourceOfferingId; + + @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true, + description = "The name of the cloned offering") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, required = false, + description = "The description of the cloned offering") + private String description; + + @Parameter(name = ApiConstants.EXTERNAL_ID, type = BaseCmd.CommandType.STRING, required = false, + description = "The backup offering ID (from backup provider side)") + private String externalId; + + @Parameter(name = ApiConstants.ZONE_ID, type = BaseCmd.CommandType.UUID, entityType = ZoneResponse.class, + description = "The zone ID", required = false) + private Long zoneId; + + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.STRING, + description = "the ID of the containing domain(s) as comma separated string, public for public offerings", + length = 4096) + private String domainIds; + + @Parameter(name = ApiConstants.ALLOW_USER_DRIVEN_BACKUPS, type = BaseCmd.CommandType.BOOLEAN, + description = "Whether users are allowed to create adhoc backups and backup schedules", required = false) + private Boolean userDrivenBackups; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSourceOfferingId() { + return sourceOfferingId; + } + + public String getName() { + return name; + } + + public String getExternalId() { + return externalId; + } + + public Long getZoneId() { + return zoneId; + } + + public String getDescription() { + return description; + } + + public Boolean getUserDrivenBackups() { + return userDrivenBackups; + } + + public List getDomainIds() { + if (domainIds != null && !domainIds.isEmpty()) { + return Arrays.asList(Arrays.stream(domainIds.split(",")).map(domainId -> Long.parseLong(domainId.trim())).toArray(Long[]::new)); + } + LongFunction> defaultDomainsProvider = null; + if (backupManager != null) { + defaultDomainsProvider = backupManager::getBackupOfferingDomains; + } + return resolveDomainIds(domainIds, sourceOfferingId, defaultDomainsProvider, "backup offering"); + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { + try { + BackupOffering policy = backupManager.cloneBackupOffering(this); + if (policy == null) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone backup offering"); + } + BackupOfferingResponse response = _responseGenerator.createBackupOfferingResponse(policy); + response.setResponseName(getCommandName()); + setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } catch (CloudRuntimeException e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_BACKUP_OFFERING_CLONE; + } + + @Override + public String getEventDescription() { + return "Cloning backup offering: " + name + " from source offering: " + (sourceOfferingId == null ? "" : sourceOfferingId.toString()); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java new file mode 100644 index 000000000000..c98bfb850529 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java @@ -0,0 +1,100 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.BackupResponse; +import org.apache.cloudstack.api.response.ImageTransferResponse; +import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.backup.ImageTransfer; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.utils.EnumUtils; + +@APICommand(name = "createImageTransfer", + description = "Create image transfer for a disk in backup. This API is intended for testing only and is disabled by default.", + responseObject = ImageTransferResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class CreateImageTransferCmd extends BaseCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Parameter(name = ApiConstants.BACKUP_ID, + type = CommandType.UUID, + entityType = BackupResponse.class, + description = "ID of the backup") + private Long backupId; + + @Parameter(name = ApiConstants.VOLUME_ID, + type = CommandType.UUID, + entityType = VolumeResponse.class, + required = true, + description = "ID of the disk/volume") + private Long volumeId; + + @Parameter(name = ApiConstants.DIRECTION, + type = CommandType.STRING, + required = true, + description = "Direction of the transfer: upload, download") + private String direction; + + @Parameter(name = ApiConstants.FORMAT, + type = CommandType.STRING, + description = "Format for the image transfer: raw/cow. 'raw' will create an NBD backend. 'cow' will use the File backend." + + "For download, only the 'raw' format is supported. Default: raw") + private String format; + + public Long getBackupId() { + return backupId; + } + + public Long getVolumeId() { + return volumeId; + } + + public ImageTransfer.Direction getDirection() { + return ImageTransfer.Direction.valueOf(direction); + } + + public ImageTransfer.Format getFormat() { + return EnumUtils.getEnum(ImageTransfer.Format.class, format); + } + + @Override + public void execute() { + ImageTransferResponse response = kvmBackupExportService.createImageTransfer(this); + response.setObjectName(ImageTransfer.class.getSimpleName().toLowerCase()); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java new file mode 100644 index 000000000000..d0e17e86d427 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java @@ -0,0 +1,85 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +@APICommand(name = "deleteVirtualMachineCheckpoint", + description = "Delete a VM checkpoint. This API is intended for testing only and is disabled by default.", + responseObject = SuccessResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class DeleteVmCheckpointCmd extends BaseCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, + type = CommandType.UUID, + entityType = UserVmResponse.class, + required = true, + description = "ID of the VM") + private Long vmId; + + @Parameter(name = "checkpointid", + type = CommandType.STRING, + required = true, + description = "Checkpoint ID") + private String checkpointId; + + public Long getVmId() { + return vmId; + } + + public String getCheckpointId() { + return checkpointId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } + + public void setCheckpointId(String checkpointId) { + this.checkpointId = checkpointId; + } + + @Override + public void execute() { + boolean result = kvmBackupExportService.deleteVmCheckpoint(this); + SuccessResponse response = new SuccessResponse(getCommandName()); + response.setSuccess(result); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java new file mode 100644 index 000000000000..45173f8668ee --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java @@ -0,0 +1,103 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.BackupResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.backup.Backup; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.event.EventTypes; + +@APICommand(name = "finalizeBackup", + description = "Finalize a VM backup session. This API is intended for testing only and is disabled by default.", + responseObject = BackupResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class FinalizeBackupCmd extends BaseAsyncCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Inject + private BackupManager backupManager; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, + type = CommandType.UUID, + entityType = UserVmResponse.class, + required = true, + description = "ID of the VM") + private Long vmId; + + @Parameter(name = ApiConstants.ID, + type = CommandType.UUID, + entityType = BackupResponse.class, + required = true, + description = "ID of the backup") + private Long backupId; + + public Long getVmId() { + return vmId; + } + + public Long getBackupId() { + return backupId; + } + + @Override + public void execute() { + Backup backup = kvmBackupExportService.finalizeBackup(this); + + if (backup == null) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Backup"); + } + + BackupResponse response = backupManager.createBackupResponse(backup, null); + + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } + + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_BACKUP_CREATE; + } + + @Override + public String getEventDescription() { + return "Finalizing backup " + backupId; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java new file mode 100644 index 000000000000..dfc43e233bf2 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java @@ -0,0 +1,69 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.ImageTransferResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.backup.ImageTransfer; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +@APICommand(name = "finalizeImageTransfer", + description = "Finalize an image transfer. This API is intended for testing only and is disabled by default.", + responseObject = SuccessResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class FinalizeImageTransferCmd extends BaseCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Parameter(name = ApiConstants.ID, + type = CommandType.UUID, + entityType = ImageTransferResponse.class, + required = true, + description = "ID of the image transfer") + private Long imageTransferId; + + public Long getImageTransferId() { + return imageTransferId; + } + + @Override + public void execute() { + boolean result = kvmBackupExportService.finalizeImageTransfer(this); + SuccessResponse response = new SuccessResponse(getCommandName()); + response.setSuccess(result); + response.setObjectName(ImageTransfer.class.getSimpleName().toLowerCase()); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java index 7d3902bc4902..4cf27c561508 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java @@ -27,6 +27,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.BackupOfferingResponse; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.backup.BackupManager; import org.apache.cloudstack.backup.BackupOffering; @@ -40,6 +41,11 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.commons.collections.CollectionUtils; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; @APICommand(name = "importBackupOffering", description = "Imports a backup offering using a backup provider", @@ -48,18 +54,18 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd { @Inject - private BackupManager backupManager; + protected BackupManager backupManager; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// //////////////////////////////////////////////////// @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, - description = "the name of the backup offering") + description = "The name of the backup offering") private String name; @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = true, - description = "the description of the backup offering") + description = "The description of the backup offering") private String description; @Parameter(name = ApiConstants.EXTERNAL_ID, @@ -76,6 +82,14 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd { description = "Whether users are allowed to create adhoc backups and backup schedules", required = true) private Boolean userDrivenBackups; + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.LIST, + collectionType = CommandType.UUID, + entityType = DomainResponse.class, + description = "the ID of the containing domain(s), null for public offerings", + since = "4.23.0") + private List domainIds; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -100,6 +114,15 @@ public Boolean getUserDrivenBackups() { return userDrivenBackups == null ? false : userDrivenBackups; } + public List getDomainIds() { + if (CollectionUtils.isNotEmpty(domainIds)) { + Set set = new LinkedHashSet<>(domainIds); + domainIds.clear(); + domainIds.addAll(set); + } + return domainIds; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -134,6 +157,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Importing backup offering: " + name + " (external ID: " + externalId + ") on zone ID " + zoneId ; + return "Importing backup offering: " + name + " (external ID: " + externalId + ") on zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID) ; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListImageTransfersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListImageTransfersCmd.java new file mode 100644 index 000000000000..d810d21ab5f8 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListImageTransfersCmd.java @@ -0,0 +1,81 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.BackupResponse; +import org.apache.cloudstack.api.response.ImageTransferResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.backup.ImageTransfer; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +@APICommand(name = "listImageTransfers", + description = "List image transfers for a backup. This API is intended for testing only and is disabled by default.", + responseObject = ImageTransferResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class ListImageTransfersCmd extends BaseListCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Parameter(name = ApiConstants.ID, + type = CommandType.UUID, + entityType = ImageTransferResponse.class, + description = "ID of the Image Transfer") + private Long id; + + @Parameter(name = ApiConstants.BACKUP_ID, + type = CommandType.UUID, + entityType = BackupResponse.class, + description = "ID of the backup") + private Long backupId; + + public Long getId() { + return id; + } + + public Long getBackupId() { + return backupId; + } + + @Override + public void execute() { + List responses = kvmBackupExportService.listImageTransfers(this); + ListResponse response = new ListResponse<>(); + response.setResponses(responses); + response.setObjectName(ImageTransfer.class.getSimpleName().toLowerCase()); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListVmCheckpointsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListVmCheckpointsCmd.java new file mode 100644 index 000000000000..a61661e982de --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ListVmCheckpointsCmd.java @@ -0,0 +1,69 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.CheckpointResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.backup.KVMBackupExportService; + +@APICommand(name = "listVirtualMachineCheckpoints", + description = "List checkpoints for a VM. This API is intended for testing only and is disabled by default.", + responseObject = CheckpointResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) +public class ListVmCheckpointsCmd extends BaseListCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, + type = CommandType.UUID, + entityType = UserVmResponse.class, + required = true, + description = "ID of the VM") + private Long vmId; + + public Long getVmId() { + return vmId; + } + + @Override + public void execute() { + List responses = kvmBackupExportService.listVmCheckpoints(this); + ListResponse response = new ListResponse<>(); + response.setResponses(responses); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return 0; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/StartBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/StartBackupCmd.java new file mode 100644 index 000000000000..1bf6d45db049 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/StartBackupCmd.java @@ -0,0 +1,120 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.command.admin.backup; + +import javax.inject.Inject; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.response.BackupResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.backup.Backup; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.KVMBackupExportService; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.event.EventTypes; + +@APICommand(name = "startBackup", + description = "Start a VM backup session using pull mode backup-begin on the KVM host. This API is intended for testing only and is disabled by default.", + responseObject = BackupResponse.class, + since = "4.23.0", + authorized = {RoleType.Admin}) + public class StartBackupCmd extends BaseAsyncCreateCmd implements AdminCmd { + + @Inject + private KVMBackupExportService kvmBackupExportService; + + @Inject + private BackupManager backupManager; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, + type = CommandType.UUID, + entityType = UserVmResponse.class, + required = true, + description = "ID of the VM") + private Long vmId; + + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the backup") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, + type = CommandType.STRING, + description = "the description for the backup") + private String description; + + public Long getVmId() { + return vmId; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + @Override + public void execute() { + try { + Backup backup = kvmBackupExportService.startBackup(this); + BackupResponse response = backupManager.createBackupResponse(backup, null); + + response.setResponseName(getCommandName()); + setResponseObject(response); + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } + + @Override + public void create() { + Backup backup = kvmBackupExportService.createBackup(this); + + if (backup != null) { + setEntityId(backup.getId()); + setEntityUuid(backup.getUuid()); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Backup"); + } + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_BACKUP_CREATE; + } + + @Override + public String getEventDescription() { + return "Starting backup for Instance " + vmId; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java index 9de06715ee74..2f0dd6acd0e1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java @@ -25,19 +25,24 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; import org.apache.cloudstack.api.response.BackupOfferingResponse; import org.apache.cloudstack.backup.BackupManager; import org.apache.cloudstack.backup.BackupOffering; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; +import java.util.List; +import java.util.function.LongFunction; + @APICommand(name = "updateBackupOffering", description = "Updates a backup offering.", responseObject = BackupOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.16.0") -public class UpdateBackupOfferingCmd extends BaseCmd { +public class UpdateBackupOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver { @Inject private BackupManager backupManager; @@ -57,6 +62,13 @@ public class UpdateBackupOfferingCmd extends BaseCmd { @Parameter(name = ApiConstants.ALLOW_USER_DRIVEN_BACKUPS, type = CommandType.BOOLEAN, description = "Whether to allow user driven backups or not") private Boolean allowUserDrivenBackups; + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.STRING, + description = "the ID of the containing domain(s) as comma separated string, public for public offerings", + since = "4.23.0", + length = 4096) + private String domainIds; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -82,7 +94,7 @@ public Boolean getAllowUserDrivenBackups() { @Override public void execute() { try { - if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null) { + if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null && CollectionUtils.isEmpty(getDomainIds())) { throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the", "following should be informed: name, description or allowUserDrivenBackups.", id)); } @@ -98,11 +110,23 @@ public void execute() { this.setResponseObject(response); } catch (CloudRuntimeException e) { ApiErrorCode paramError = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR; - logger.error(String.format("Failed to update Backup Offering [id: %s] due to: [%s].", id, e.getMessage()), e); + logger.error("Failed to update Backup Offering [id: {}] due to: [{}].", id, e.getMessage(), e); throw new ServerApiException(paramError, e.getMessage()); } } + public List getDomainIds() { + // backupManager may be null in unit tests where the command is spied without injection. + // Avoid creating a method reference to a null receiver which causes NPE. When backupManager + // is null, pass null as the defaultDomainsProvider so resolveDomainIds will simply return + // an empty list or parse the explicit domainIds string. + LongFunction> defaultDomainsProvider = null; + if (backupManager != null) { + defaultDomainsProvider = backupManager::getBackupOfferingDomains; + } + return resolveDomainIds(domainIds, id, defaultDomainsProvider, "backup offering"); + } + @Override public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java index 463af000f58b..79dad4269c9b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/IssueCertificateCmd.java @@ -149,6 +149,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "issuing certificate for domain(s)=" + domains + ", ip(s)=" + addresses; + return "Issuing certificate for domain(s)=" + domains + ", ip(s)=" + addresses; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java index a39985549ac8..d333a74fdb3b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/ProvisionCertificateCmd.java @@ -52,7 +52,7 @@ public class ProvisionCertificateCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, required = true, entityType = HostResponse.class, - description = "The host/agent uuid to which the certificate has to be provisioned (issued and propagated)") + description = "The host/agent ID to which the certificate has to be provisioned (issued and propagated)") private Long hostId; @Parameter(name = ApiConstants.RECONNECT, type = CommandType.BOOLEAN, @@ -63,6 +63,12 @@ public class ProvisionCertificateCmd extends BaseAsyncCmd { description = "Name of the CA service provider, otherwise the default configured provider plugin will be used") private String provider; + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, + description = "When true, uses SSH to re-provision the agent's certificate, bypassing the NIO agent connection. " + + "Use this when agents are disconnected due to a CA change. Supported for KVM hosts and SystemVMs. Default is false", + since = "4.23.0") + private Boolean forced; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -79,6 +85,10 @@ public String getProvider() { return provider; } + public boolean isForced() { + return forced != null && forced; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -90,7 +100,7 @@ public void execute() { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId()); } - boolean result = caManager.provisionCertificate(host, getReconnect(), getProvider()); + boolean result = caManager.provisionCertificate(host, getReconnect(), getProvider(), isForced()); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); setResponseObject(response); @@ -108,7 +118,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "provisioning certificate for host id=" + hostId + " using provider=" + provider; + return "Provisioning certificate for host with ID: " + getResourceUuid(ApiConstants.HOST_ID) + " using provider: " + provider; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java index 381bed65f95c..c2212442f4ba 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ca/RevokeCertificateCmd.java @@ -105,6 +105,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "revoking certificate with serial id=" + serial + ", cn=" + cn; + return "Revoking certificate with serial id=" + serial + ", cn=" + cn; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java index 69cb43ce40ec..d8fa2123d228 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java @@ -19,21 +19,22 @@ import java.util.ArrayList; import java.util.List; - -import com.cloud.cpu.CPU; -import org.apache.cloudstack.api.ApiCommandResourceType; +import java.util.Map; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.api.response.ExtensionResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import com.cloud.cpu.CPU; import com.cloud.exception.DiscoveryException; import com.cloud.exception.ResourceInUseException; import com.cloud.org.Cluster; @@ -43,49 +44,48 @@ requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) public class AddClusterCmd extends BaseCmd { - - @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, required = true, description = "the cluster name") + @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, required = true, description = "The cluster name") private String clusterName; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = false, description = "the password for the host") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = false, description = "The password for the host") private String password; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the Pod ID for the host") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The Pod ID for the host") private Long podId; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, description = "the URL") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, description = "The URL") private String url; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = false, description = "the username for the cluster") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = false, description = "The username for the cluster") private String username; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the Zone ID for the cluster") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The Zone ID for the cluster") private Long zoneId; @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, - description = "hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator,Ovm3") + description = "Hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator,Ovm3,External") private String hypervisor; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64", + description = "The CPU arch of the cluster. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; - @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, required = true, description = "type of the cluster: CloudManaged, ExternalManaged") + @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, required = true, description = "Type of the cluster: CloudManaged, ExternalManaged") private String clusterType; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources") private String allocationState; - @Parameter(name = ApiConstants.VSM_USERNAME, type = CommandType.STRING, required = false, description = "the username for the VSM associated with this cluster") + @Parameter(name = ApiConstants.VSM_USERNAME, type = CommandType.STRING, required = false, description = "The username for the VSM associated with this cluster") private String vsmusername; - @Parameter(name = ApiConstants.VSM_PASSWORD, type = CommandType.STRING, required = false, description = "the password for the VSM associated with this cluster") + @Parameter(name = ApiConstants.VSM_PASSWORD, type = CommandType.STRING, required = false, description = "The password for the VSM associated with this cluster") private String vsmpassword; - @Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster") + @Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "The IP address of the VSM associated with this cluster") private String vsmipaddress; @Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, @@ -109,7 +109,7 @@ public class AddClusterCmd extends BaseCmd { @Parameter(name = ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, - description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.") + description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.") private String vSwitchNamePublicTraffic; @Parameter(name = ApiConstants.OVM3_POOL, type = CommandType.STRING, required = false, description = "Ovm3 native pooling enabled for cluster") @@ -118,6 +118,26 @@ public class AddClusterCmd extends BaseCmd { private String ovm3cluster; @Parameter(name = ApiConstants.OVM3_VIP, type = CommandType.STRING, required = false, description = "Ovm3 vip to use for pool (and cluster)") private String ovm3vip; + + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, + type = CommandType.LIST, collectionType = CommandType.STRING, + description = "comma separated list of storage access groups for the hosts in the cluster", + since = "4.21.0") + private List storageAccessGroups; + + + @Parameter(name = ApiConstants.EXTENSION_ID, + type = CommandType.UUID, entityType = ExtensionResponse.class, + description = "UUID of the extension", + since = "4.21.0") + private Long extensionId; + + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs to be added to the extension-resource mapping. Use the format externaldetails[i].=. Example: externaldetails[0].endpoint.url=https://example.com", + since = "4.21.0") + protected Map externalDetails; + public String getOvm3Pool() { return ovm3pool; } @@ -184,6 +204,10 @@ public String getHypervisor() { return hypervisor; } + public Long getExtensionId() { + return extensionId; + } + public String getClusterType() { return clusterType; } @@ -192,6 +216,10 @@ public void setClusterType(String type) { this.clusterType = type; } + public List getStorageAccessGroups() { + return storageAccessGroups; + } + @Override public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; @@ -214,6 +242,10 @@ public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public Map getExternalDetails() { + return convertDetailsToMap(externalDetails); + } + @Override public void execute() { try { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java index 2b1cfe8bcb58..afabf7fef166 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java @@ -38,7 +38,7 @@ public class DeleteClusterCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the cluster ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "The cluster ID") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ExecuteClusterDrsPlanCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ExecuteClusterDrsPlanCmd.java index 60f2c2b1deea..00e7da6e37c1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ExecuteClusterDrsPlanCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ExecuteClusterDrsPlanCmd.java @@ -142,6 +142,6 @@ public String getEventType() { @Override public String getEventDescription() { - return String.format("Executing DRS plan for cluster: %d", getId()); + return "Executing DRS plan for cluster with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java index 67d0678410cf..9fe4e3f5cfc1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java @@ -17,8 +17,11 @@ package org.apache.cloudstack.api.command.admin.cluster; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -28,7 +31,13 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.extension.Extension; +import org.apache.cloudstack.extension.ExtensionHelper; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; +import com.cloud.hypervisor.Hypervisor; import com.cloud.org.Cluster; import com.cloud.utils.Pair; @@ -36,38 +45,50 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListClustersCmd extends BaseListCmd { + @Inject + ExtensionHelper extensionHelper; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "lists clusters by the cluster ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "Lists clusters by the cluster ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists clusters by the cluster name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Lists clusters by the cluster name") private String clusterName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "lists clusters by Pod ID") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "Lists clusters by Pod ID") private Long podId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "lists clusters by Zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Lists clusters by Zone ID") private Long zoneId; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "lists clusters by hypervisor type") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "Lists clusters by hypervisor type") private String hypervisorType; - @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "lists clusters by cluster type") + @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "Lists clusters by cluster type") private String clusterType; - @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "lists clusters by allocation state") + @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Lists clusters by allocation state") private String allocationState; - @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "whether this cluster is managed by cloudstack") + @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "Whether this cluster is managed by cloudstack") private String managedState; - @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the clusters") + @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "Flag to display the capacity of the clusters") private Boolean showCapacities; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, + description = "CPU arch of the clusters", + since = "4.20.1") + private String arch; + + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING, + description = "the name of the storage access group", + since = "4.21.0") + private String storageAccessGroup; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -112,25 +133,64 @@ public Boolean getShowCapacities() { return showCapacities; } + public CPU.CPUArch getArch() { + return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch); + } + + public String getStorageAccessGroup() { + return storageAccessGroup; + } + + public ListClustersCmd() { + + } + + public ListClustersCmd(String storageAccessGroup) { + this.storageAccessGroup = storageAccessGroup; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// + protected void updateClustersExtensions(final List clusterResponses) { + if (CollectionUtils.isEmpty(clusterResponses)) { + return; + } + Map idExtensionMap = new HashMap<>(); + for (ClusterResponse response : clusterResponses) { + if (!Hypervisor.HypervisorType.External.getHypervisorDisplayName().equals(response.getHypervisorType())) { + continue; + } + Long extensionId = extensionHelper.getExtensionIdForCluster(response.getInternalId()); + if (extensionId == null) { + continue; + } + Extension extension = idExtensionMap.computeIfAbsent(extensionId, id -> extensionHelper.getExtension(id)); + if (extension == null) { + continue; + } + response.setExtensionId(extension.getUuid()); + response.setExtensionName(extension.getName()); + } + } + protected Pair, Integer> getClusterResponses() { Pair, Integer> result = _mgr.searchForClusters(this); - List clusterResponses = new ArrayList(); + List clusterResponses = new ArrayList<>(); for (Cluster cluster : result.first()) { ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, showCapacities); clusterResponse.setObjectName("cluster"); clusterResponses.add(clusterResponse); } - return new Pair, Integer>(clusterResponses, result.second()); + updateClustersExtensions(clusterResponses); + return new Pair<>(clusterResponses, result.second()); } @Override public void execute() { Pair, Integer> clusterResponses = getClusterResponses(); - ListResponse response = new ListResponse(); + ListResponse response = new ListResponse<>(); response.setResponses(clusterResponses.first(), clusterResponses.second()); response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java index c4ee87380ed9..77d0557af05b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java @@ -16,6 +16,8 @@ // under the License. package org.apache.cloudstack.api.command.admin.cluster; +import java.util.Map; + import com.cloud.cpu.CPU; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -37,29 +39,35 @@ public class UpdateClusterCmd extends BaseCmd { - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "the ID of the Cluster") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ClusterResponse.class, required = true, description = "The ID of the Cluster") private Long id; - @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "the cluster name") + @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "The cluster name") private String clusterName; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "hypervisor type of the cluster") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "Hypervisor type of the cluster") private String hypervisor; - @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "hypervisor type of the cluster") + @Parameter(name = ApiConstants.CLUSTER_TYPE, type = CommandType.STRING, description = "Hypervisor type of the cluster") private String clusterType; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources") private String allocationState; - @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "whether this cluster is managed by cloudstack") + @Parameter(name = ApiConstants.MANAGED_STATE, type = CommandType.STRING, description = "Whether this cluster is managed by cloudstack") private String managedState; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64", + description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs to be added to the extension-resource mapping. Use the format externaldetails[i].=. Example: externaldetails[0].endpoint.url=https://example.com", + since = "4.21.0") + protected Map externalDetails; + public String getClusterName() { return clusterName; } @@ -122,6 +130,10 @@ public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public Map getExternalDetails() { + return convertDetailsToMap(externalDetails); + } + @Override public void execute() { Cluster cluster = _resourceService.getCluster(getId()); @@ -130,7 +142,7 @@ public void execute() { } Cluster result = _resourceService.updateCluster(this); if (result != null) { - ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false); + ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(result, false); clusterResponse.setResponseName(getCommandName()); this.setResponseObject(clusterResponse); } else { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgGroupsByCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgGroupsByCmd.java index d735218169d6..c63e7cf92d4d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgGroupsByCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgGroupsByCmd.java @@ -40,7 +40,7 @@ public class ListCfgGroupsByCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "lists configuration group by group name") + @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "Lists configuration group by group name") private String groupName; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java index e365d8bc2dc7..055443934609 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java @@ -19,23 +19,23 @@ import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.commons.lang3.StringUtils; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ConfigurationResponse; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ImageStoreResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ManagementServerResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.config.Configuration; +import org.apache.commons.lang3.StringUtils; import com.cloud.exception.InvalidParameterValueException; import com.cloud.utils.Pair; @@ -52,55 +52,62 @@ public class ListCfgsByCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.CATEGORY, type = CommandType.STRING, description = "lists configurations by category") + @Parameter(name = ApiConstants.CATEGORY, type = CommandType.STRING, description = "Lists configurations by category") private String category; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists configuration by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Lists configuration by name") private String configName; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the Zone to update the parameter value for corresponding zone") + description = "The ID of the Zone to update the parameter value for corresponding zone") private Long zoneId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "the ID of the Cluster to update the parameter value for corresponding cluster") + description = "The ID of the Cluster to update the parameter value for corresponding cluster") private Long clusterId; @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, - description = "the ID of the Storage pool to update the parameter value for corresponding storage pool") + description = "The ID of the Storage pool to update the parameter value for corresponding storage pool") private Long storagePoolId; @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, - description = "the ID of the Account to update the parameter value for corresponding account") + description = "The ID of the Account to update the parameter value for corresponding account") private Long accountId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the Domain to update the parameter value for corresponding domain") + description = "The ID of the Domain to update the parameter value for corresponding domain") private Long domainId; @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.UUID, entityType = ImageStoreResponse.class, - description = "the ID of the Image Store to update the parameter value for corresponding image store") + description = "The ID of the Image Store to update the parameter value for corresponding image store") private Long imageStoreId; - @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "lists configuration by group name (primarily used for UI)", since = "4.18.0") + @Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, + type = CommandType.UUID, + entityType = ManagementServerResponse.class, + description = "the ID of the Management Server to update the parameter value for corresponding management server", + since = "4.23.0") + private Long managementServerId; + + @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "Lists configuration by group name (primarily used for UI)", since = "4.18.0") private String groupName; - @Parameter(name = ApiConstants.SUBGROUP, type = CommandType.STRING, description = "lists configuration by subgroup name (primarily used for UI)", since = "4.18.0") + @Parameter(name = ApiConstants.SUBGROUP, type = CommandType.STRING, description = "Lists configuration by subgroup name (primarily used for UI)", since = "4.18.0") private String subGroupName; - @Parameter(name = ApiConstants.PARENT, type = CommandType.STRING, description = "lists configuration by parent name (primarily used for UI)", since = "4.18.0") + @Parameter(name = ApiConstants.PARENT, type = CommandType.STRING, description = "Lists configuration by parent name (primarily used for UI)", since = "4.18.0") private String parentName; // /////////////////////////////////////////////////// @@ -139,6 +146,10 @@ public Long getImageStoreId() { return imageStoreId; } + public Long getManagementServerId() { + return managementServerId; + } + public String getGroupName() { return groupName; } @@ -200,6 +211,9 @@ private void setScope(ConfigurationResponse cfgResponse) { if (getImageStoreId() != null){ cfgResponse.setScope("imagestore"); } + if (getManagementServerId() != null){ + cfgResponse.setScope("managementserver"); + } } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java index e7cc9e0234e2..d8622f94b6b6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java @@ -47,7 +47,7 @@ public class ListHypervisorCapabilitiesCmd extends BaseListCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HypervisorCapabilitiesResponse.class, description = "ID of the hypervisor capability") private Long id; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor for which to restrict the search") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "The hypervisor for which to restrict the search") private String hypervisor; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ResetCfgCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ResetCfgCmd.java index f114b263b634..3c3c36b29d7e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ResetCfgCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/ResetCfgCmd.java @@ -23,16 +23,16 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.ImageStoreResponse; -import org.apache.cloudstack.framework.config.ConfigKey; - import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ConfigurationResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ImageStoreResponse; +import org.apache.cloudstack.api.response.ManagementServerResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.config.Configuration; +import org.apache.cloudstack.framework.config.ConfigKey; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -45,45 +45,52 @@ public class ResetCfgCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the configuration", validations = {ApiArgValidator.NotNullOrEmpty}) + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the configuration", validations = {ApiArgValidator.NotNullOrEmpty}) private String cfgName; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the Zone to reset the parameter value for corresponding zone") + description = "The ID of the Zone to reset the parameter value for corresponding zone") private Long zoneId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "the ID of the Cluster to reset the parameter value for corresponding cluster") + description = "The ID of the Cluster to reset the parameter value for corresponding cluster") private Long clusterId; @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, - description = "the ID of the Storage pool to reset the parameter value for corresponding storage pool") + description = "The ID of the Storage pool to reset the parameter value for corresponding storage pool") private Long storagePoolId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the Domain to reset the parameter value for corresponding domain") + description = "The ID of the Domain to reset the parameter value for corresponding domain") private Long domainId; @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, - description = "the ID of the Account to reset the parameter value for corresponding account") + description = "The ID of the Account to reset the parameter value for corresponding account") private Long accountId; @Parameter(name = ApiConstants.IMAGE_STORE_ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, - description = "the ID of the Image Store to reset the parameter value for corresponding image store") + description = "The ID of the Image Store to reset the parameter value for corresponding image store") private Long imageStoreId; + @Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, + type = CommandType.UUID, + entityType = ManagementServerResponse.class, + description = "the ID of the Management Server to update the parameter value for corresponding management server", + since = "4.23.0") + private Long managementServerId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -116,6 +123,10 @@ public Long getImageStoreId() { return imageStoreId; } + public Long getManagementServerId() { + return managementServerId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -149,6 +160,9 @@ public void execute() { if (getImageStoreId() != null) { response.setScope(ConfigKey.Scope.ImageStore.name()); } + if (getManagementServerId() != null) { + response.setScope(ConfigKey.Scope.ManagementServer.name()); + } response.setValue(cfg.second()); this.setResponseObject(response); } else { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java index dbf478df7012..9db9529dc8d8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java @@ -16,9 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.admin.config; -import com.cloud.utils.crypt.DBEncryptionUtil; import org.apache.cloudstack.acl.RoleService; -import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiArgValidator; import org.apache.cloudstack.api.ApiConstants; @@ -29,13 +27,17 @@ import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ConfigurationResponse; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ImageStoreResponse; +import org.apache.cloudstack.api.response.ManagementServerResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.config.Configuration; +import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.commons.lang3.StringUtils; import com.cloud.user.Account; +import com.cloud.utils.crypt.DBEncryptionUtil; @APICommand(name = "updateConfiguration", description = "Updates a configuration.", responseObject = ConfigurationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -45,49 +47,56 @@ public class UpdateCfgCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the configuration") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the configuration") private String cfgName; - @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "the value of the configuration", length = 4096) + @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "The value of the configuration", length = 4096) private String value; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the Zone to update the parameter value for corresponding zone") + description = "The ID of the Zone to update the parameter value for corresponding zone") private Long zoneId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "the ID of the Cluster to update the parameter value for corresponding cluster") + description = "The ID of the Cluster to update the parameter value for corresponding cluster") private Long clusterId; @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, - description = "the ID of the Storage pool to update the parameter value for corresponding storage pool") + description = "The ID of the Storage pool to update the parameter value for corresponding storage pool") private Long storagePoolId; @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, - description = "the ID of the Account to update the parameter value for corresponding account") + description = "The ID of the Account to update the parameter value for corresponding account") private Long accountId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the Domain to update the parameter value for corresponding domain") + description = "The ID of the Domain to update the parameter value for corresponding domain") private Long domainId; @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.UUID, entityType = ImageStoreResponse.class, - description = "the ID of the Image Store to update the parameter value for corresponding image store", + description = "The ID of the Image Store to update the parameter value for corresponding image store", validations = ApiArgValidator.PositiveNumber) private Long imageStoreId; + @Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, + type = CommandType.UUID, + entityType = ManagementServerResponse.class, + description = "the ID of the Management Server to update the parameter value for corresponding management server", + since = "4.23.0") + private Long managementServerId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -112,7 +121,7 @@ public Long getClusterId() { return clusterId; } - public Long getStoragepoolId() { + public Long getStoragePoolId() { return storagePoolId; } @@ -128,6 +137,10 @@ public Long getImageStoreId() { return imageStoreId; } + public Long getManagementServerId() { + return managementServerId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -150,7 +163,7 @@ public void execute() { ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg); response.setResponseName(getCommandName()); response = setResponseScopes(response); - response = setResponseValue(response, cfg); + setResponseValue(response, cfg); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config"); @@ -161,15 +174,13 @@ public void execute() { * Sets the configuration value in the response. If the configuration is in the `Hidden` or `Secure` categories, the value is encrypted before being set in the response. * @param response to be set with the configuration `cfg` value * @param cfg to be used in setting the response value - * @return the response with the configuration's value */ - public ConfigurationResponse setResponseValue(ConfigurationResponse response, Configuration cfg) { + public void setResponseValue(ConfigurationResponse response, Configuration cfg) { + String value = cfg.getValue(); if (cfg.isEncrypted()) { - response.setValue(DBEncryptionUtil.encrypt(getValue())); - } else { - response.setValue(getValue()); + value = DBEncryptionUtil.encrypt(value); } - return response; + response.setValue(value); } /** @@ -184,7 +195,7 @@ public ConfigurationResponse setResponseScopes(ConfigurationResponse response) { if (getClusterId() != null) { response.setScope("cluster"); } - if (getStoragepoolId() != null) { + if (getStoragePoolId() != null) { response.setScope("storagepool"); } if (getAccountId() != null) { @@ -193,6 +204,9 @@ public ConfigurationResponse setResponseScopes(ConfigurationResponse response) { if (getDomainId() != null) { response.setScope("domain"); } + if (getManagementServerId() != null) { + response.setScope(ConfigKey.Scope.ManagementServer.name().toLowerCase()); + } return response; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java index 01f7af108416..d7342654ec40 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java @@ -43,28 +43,28 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HypervisorCapabilitiesResponse.class, description = "ID of the hypervisor capability") private Long id; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor for which the hypervisor capabilities are to be updated", since = "4.19.1") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "The hypervisor for which the hypervisor capabilities are to be updated", since = "4.19.1") private String hypervisor; - @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, description = "the hypervisor version for which the hypervisor capabilities are to be updated", since = "4.19.1") + @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, description = "The hypervisor version for which the hypervisor capabilities are to be updated", since = "4.19.1") private String hypervisorVersion; - @Parameter(name = ApiConstants.SECURITY_GROUP_EANBLED, type = CommandType.BOOLEAN, description = "set true to enable security group for this hypervisor.") + @Parameter(name = ApiConstants.SECURITY_GROUP_EANBLED, type = CommandType.BOOLEAN, description = "Set true to enable security group for this hypervisor.") private Boolean securityGroupEnabled; - @Parameter(name = ApiConstants.MAX_GUESTS_LIMIT, type = CommandType.LONG, description = "the max number of Guest VMs per host for this hypervisor.") + @Parameter(name = ApiConstants.MAX_GUESTS_LIMIT, type = CommandType.LONG, description = "The maximum number of Guest Instances per host for this hypervisor.") private Long maxGuestsLimit; - @Parameter(name = ApiConstants.MAX_DATA_VOLUMES_LIMIT, type = CommandType.INTEGER, description = "the maximum number of Data Volumes that can be attached to a VM for this hypervisor.", since = "4.16.0") + @Parameter(name = ApiConstants.MAX_DATA_VOLUMES_LIMIT, type = CommandType.INTEGER, description = "The maximum number of Data Volumes that can be attached to an Instance for this hypervisor.", since = "4.16.0") private Integer maxDataVolumesLimit; - @Parameter(name = ApiConstants.STORAGE_MOTION_ENABLED, type = CommandType.BOOLEAN, description = "set true to enable storage motion support for this hypervisor", since = "4.16.0") + @Parameter(name = ApiConstants.STORAGE_MOTION_ENABLED, type = CommandType.BOOLEAN, description = "Set true to enable storage motion support for this hypervisor", since = "4.16.0") private Boolean storageMotionSupported; - @Parameter(name = ApiConstants.MAX_HOSTS_PER_CLUSTER, type = CommandType.INTEGER, description = "the maximum number of the hypervisor hosts per cluster ", since = "4.16.0") + @Parameter(name = ApiConstants.MAX_HOSTS_PER_CLUSTER, type = CommandType.INTEGER, description = "The maximum number of the hypervisor hosts per cluster ", since = "4.16.0") private Integer maxHostsPerClusterLimit; - @Parameter(name = ApiConstants.VM_SNAPSHOT_ENABELD, type = CommandType.BOOLEAN, description = "set true to enable VM snapshots for this hypervisor", since = "4.16.0") + @Parameter(name = ApiConstants.VM_SNAPSHOT_ENABELD, type = CommandType.BOOLEAN, description = "Set true to enable Instance Snapshots for this hypervisor", since = "4.16.0") private Boolean vmSnapshotEnabled; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/GetDiagnosticsDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/GetDiagnosticsDataCmd.java index 553ba6b1729d..c140de5aa01e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/GetDiagnosticsDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/GetDiagnosticsDataCmd.java @@ -48,7 +48,7 @@ entityType = {VirtualMachine.class}, responseHasSensitiveInfo = false, requestHasSensitiveInfo = false, - description = "Get diagnostics and files from system VMs", + description = "Get diagnostics and files from System VMs", since = "4.14.0.0", authorized = {RoleType.Admin}) public class GetDiagnosticsDataCmd extends BaseAsyncCmd { @@ -64,7 +64,7 @@ public class GetDiagnosticsDataCmd extends BaseAsyncCmd { entityType = SystemVmResponse.class, required = true, validations = {ApiArgValidator.PositiveNumber}, - description = "The ID of the system VM instance to retrieve diagnostics data files from") + description = "The ID of the System VM to retrieve diagnostics data files from") private Long id; @Parameter(name = ApiConstants.FILES, @@ -113,7 +113,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new CloudRuntimeException("failed to generate valid download url: " + downloadUrl); + throw new CloudRuntimeException("Failed to generate valid download url: " + downloadUrl); } } catch (ServerApiException e) { throw new CloudRuntimeException("Internal exception caught while retrieving diagnostics files: ", e); @@ -140,7 +140,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Getting diagnostics data files from system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Getting diagnostics data files from System Instance with ID: " + getResourceUuid(ApiConstants.TARGET_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/RunDiagnosticsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/RunDiagnosticsCmd.java index 4537eb6f215c..d1f22baf6604 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/RunDiagnosticsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/diagnostics/RunDiagnosticsCmd.java @@ -48,7 +48,7 @@ @APICommand(name = "runDiagnostics", responseObject = RunDiagnosticsResponse.class, entityType = {VirtualMachine.class}, responseHasSensitiveInfo = false, requestHasSensitiveInfo = false, - description = "Execute network-utility command (ping/arping/tracert) on system VMs remotely", + description = "Execute network-utility command (ping/arping/tracert) on System VMs remotely", authorized = {RoleType.Admin}, since = "4.12.0.0") public class RunDiagnosticsCmd extends BaseAsyncCmd { @@ -62,7 +62,7 @@ public class RunDiagnosticsCmd extends BaseAsyncCmd { @ACL(accessType = SecurityChecker.AccessType.OperateEntry) @Parameter(name = ApiConstants.TARGET_ID, type = CommandType.UUID, required = true, entityType = SystemVmResponse.class, validations = {ApiArgValidator.PositiveNumber}, - description = "The ID of the system VM instance to diagnose") + description = "The ID of the System VM to diagnose") private Long id; @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = true, @@ -70,7 +70,7 @@ public class RunDiagnosticsCmd extends BaseAsyncCmd { private String address; @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, required = true, - description = "The system VM diagnostics type valid options are: ping, traceroute, arping") + description = "The System VM diagnostics type valid options are: ping, traceroute, arping") private String type; @Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, @@ -153,7 +153,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public String getEventDescription() { - return "Executing diagnostics on system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Executing diagnostics on System Instance with ID: " + getResourceUuid(ApiConstants.TARGET_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ListTemplateDirectDownloadCertificatesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ListTemplateDirectDownloadCertificatesCmd.java index 145ff6ba7823..9a605ec4200d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ListTemplateDirectDownloadCertificatesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ListTemplateDirectDownloadCertificatesCmd.java @@ -41,7 +41,7 @@ import java.util.List; @APICommand(name = "listTemplateDirectDownloadCertificates", - description = "List the uploaded certificates for direct download templates", + description = "List the uploaded certificates for direct download Templates", responseObject = DirectDownloadCertificateResponse.class, since = "4.17.0", authorized = {RoleType.Admin}) @@ -51,15 +51,15 @@ public class ListTemplateDirectDownloadCertificatesCmd extends BaseListCmd { DirectDownloadManager directDownloadManager; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DirectDownloadCertificateResponse.class, - description = "list direct download certificate by ID") + description = "List direct download certificate by ID") private Long id; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the zone where certificates are uploaded") + description = "The zone where certificates are uploaded") private Long zoneId; @Parameter(name = ApiConstants.LIST_HOSTS, type = CommandType.BOOLEAN, - description = "if set to true: include the hosts where the certificate is uploaded to") + description = "If set to true: include the hosts where the certificate is uploaded to") private Boolean listHosts; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ProvisionTemplateDirectDownloadCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ProvisionTemplateDirectDownloadCertificateCmd.java index 88f538547e10..3dfbbd940c40 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ProvisionTemplateDirectDownloadCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/ProvisionTemplateDirectDownloadCertificateCmd.java @@ -50,11 +50,11 @@ public class ProvisionTemplateDirectDownloadCertificateCmd extends BaseCmd { DirectDownloadManager directDownloadManager; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DirectDownloadCertificateResponse.class, - description = "the id of the direct download certificate to provision", required = true) + description = "The id of the direct download certificate to provision", required = true) private Long id; @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "the host to provision the certificate", required = true) + description = "The host to provision the certificate", required = true) private Long hostId; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/RevokeTemplateDirectDownloadCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/RevokeTemplateDirectDownloadCertificateCmd.java index eb9031cbc587..1ad8f271cfcf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/RevokeTemplateDirectDownloadCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/RevokeTemplateDirectDownloadCertificateCmd.java @@ -59,23 +59,23 @@ public class RevokeTemplateDirectDownloadCertificateCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DirectDownloadCertificateResponse.class, - description = "id of the certificate") + description = "ID of the certificate") private Long certificateId; @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, - description = "(optional) alias of the SSL certificate") + description = "(Optional) alias of the SSL certificate") private String certificateAlias; @Parameter(name = ApiConstants.HYPERVISOR, type = BaseCmd.CommandType.STRING, - description = "(optional) hypervisor type") + description = "(Optional) hypervisor type") private String hypervisor; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "(optional) zone to revoke certificate", required = true) + description = "(Optional) zone to revoke certificate", required = true) private Long zoneId; @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "(optional) the host ID to revoke certificate") + description = "(Optional) the host ID to revoke certificate") private Long hostId; private void createResponse(final List hostsRevokeStatusList) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificateCmd.java index c5c102be56d6..ad440376a913 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificateCmd.java @@ -39,7 +39,7 @@ import java.util.List; @APICommand(name = "uploadTemplateDirectDownloadCertificate", - description = "Upload a certificate for HTTPS direct template download on KVM hosts", + description = "Upload a certificate for HTTPS direct Template download on KVM hosts", responseObject = DirectDownloadCertificateResponse.class, since = "4.11.0", authorized = {RoleType.Admin}) @@ -65,7 +65,7 @@ public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd { private Long zoneId; @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "(optional) the host ID to upload certificate") + description = "(Optional) the host ID to upload certificate") private Long hostId; private void createResponse(DirectDownloadCertificate certificate, final List hostStatusList) { @@ -95,7 +95,7 @@ public void execute() { } try { - logger.debug("Uploading certificate " + name + " to agents for Direct Download"); + logger.debug("Uploading certificate {} to agents for Direct Download", name); Pair> uploadStatus = directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor, zoneId, hostId); DirectDownloadCertificate certificate = uploadStatus.first(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java index c7f06920bb8d..d2775548a841 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java @@ -40,13 +40,13 @@ public class CreateDomainCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "creates domain with this name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Creates domain with this name") private String domainName; @Parameter(name = ApiConstants.PARENT_DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "assigns new domain a parent domain by domain ID of the parent. If no parent domain is specified, the ROOT domain is assumed.") + description = "Assigns new domain a parent domain by domain ID of the parent. If no parent domain is specified, the ROOT domain is assumed.") private Long parentDomainId; @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for networks in the domain") @@ -86,7 +86,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Domain Name: " + getDomainName() + ((getParentDomainId() != null) ? ", Parent DomainId :" + getParentDomainId() : "")); + CallContext.current().setEventDetails("Domain Name: " + getDomainName() + ((getParentDomainId() != null) ? ", Parent Domain ID:" + getResourceUuid(ApiConstants.PARENT_DOMAIN_ID) : "")); Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID()); if (domain != null) { DomainResponse response = _responseGenerator.createDomainResponse(domain); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java index db3bae25e399..cf02e6a56bf8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java @@ -49,7 +49,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, - description = "true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise") + description = "True if all domain resources (child domains, Accounts) have to be cleaned up, false otherwise") private Boolean cleanup; @Inject @@ -88,12 +88,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting domain: " + getId(); + return "Deleting domain with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Domain Id: " + getId()); + CallContext.current().setEventDetails("Domain ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _regionService.deleteDomain(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java index 8514bb6dda56..e93948987bb7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java @@ -42,15 +42,15 @@ public class ListDomainChildrenCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "list children domain by parent domain ID.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "List children domain by parent domain ID.") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list children domains by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List children domains by name") private String domainName; @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, - description = "to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".") + description = "To return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".") private Boolean recursive; @Parameter(name = ApiConstants.LIST_ALL, @@ -59,7 +59,7 @@ public class ListDomainChildrenCmd extends BaseListCmd { private Boolean listAll; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for domains") + description = "Flag to display the resource icon for domains") private Boolean showIcon; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java index 895e93289923..aa1978042265 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants.DomainDetails; -import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.UserCmd; @@ -39,7 +39,7 @@ @APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class, responseView = ResponseView.Restricted, entityType = {Domain.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListDomainsCmd extends BaseListCmd implements UserCmd { +public class ListDomainsCmd extends BaseListTaggedResourcesCmd implements UserCmd { private static final String s_name = "listdomainsresponse"; @@ -64,11 +64,11 @@ public class ListDomainsCmd extends BaseListCmd implements UserCmd { @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "comma separated list of domain details requested, value can be a list of [ all, resource, min]") + description = "Comma separated list of domain details requested, value can be a list of [ all, resource, min]") private List viewDetails; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for domains") + description = "Flag to display the resource icon for domains") private Boolean showIcon; @Parameter(name = ApiConstants.TAG, type = CommandType.STRING, description = "Tag for resource type to return usage", since = "4.20.0") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java index 353cb852bfdf..124a84931548 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java @@ -44,7 +44,7 @@ public class UpdateDomainCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainResponse.class, required = true, description = "ID of domain to update") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "updates domain with this name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Updates domain with this name") private String domainName; @Parameter(name = ApiConstants.NETWORK_DOMAIN, @@ -82,7 +82,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Domain Id: " + getId()); + CallContext.current().setEventDetails("Domain ID: " + getResourceUuid(ApiConstants.ID)); Domain domain = _regionService.updateDomain(this); if (domain != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmd.java new file mode 100644 index 000000000000..2faad89bf67e --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmd.java @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.gpu.GpuCard; + + +@APICommand(name = "createGpuCard", description = "Creates a GPU card definition in the system", + responseObject = GpuCardResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0") +public class CreateGpuCardCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.STRING, required = true, + description = "the device ID of the GPU card") + private String deviceId; + + @Parameter(name = ApiConstants.DEVICE_NAME, type = CommandType.STRING, required = true, + description = "the device name of the GPU card") + private String deviceName; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, + description = "the display name of the GPU card") + private String name; + + @Parameter(name = ApiConstants.VENDOR_NAME, type = CommandType.STRING, required = true, + description = "the vendor name of the GPU card") + private String vendorName; + + @Parameter(name = ApiConstants.VENDOR_ID, type = CommandType.STRING, required = true, + description = "the vendor ID of the GPU card") + private String vendorId; + + // Optional parameters for the passthrough vGPU profile display properties + @Parameter(name = ApiConstants.VIDEORAM, type = CommandType.LONG, + description = "the video RAM size in MB for the passthrough vGPU profile") + private Long videoRam; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public String getDeviceId() { + return deviceId; + } + + public String getDeviceName() { + return deviceName; + } + + public String getName() { + return name; + } + + public String getVendorName() { + return vendorName; + } + + public String getVendorId() { + return vendorId; + } + + public Long getVideoRam() { + return videoRam; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, + ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { + try { + GpuCard gpuCard = gpuService.createGpuCard(this); + if (gpuCard != null) { + GpuCardResponse response = new GpuCardResponse(gpuCard); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create GPU card"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create GPU card: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmd.java new file mode 100644 index 000000000000..e6386082a448 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmd.java @@ -0,0 +1,123 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; +import org.apache.cloudstack.gpu.GpuDevice; +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; + + +@APICommand(name = "createGpuDevice", description = "Creates a GPU device manually on a host", + responseObject = GpuDeviceResponse.class, since = "4.21.0", requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, authorized = {RoleType.Admin}) +public class CreateGpuDeviceCmd extends BaseCmd { + + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, + description = "ID of the host where the GPU device is located") + private Long hostId; + + @Parameter(name = ApiConstants.BUS_ADDRESS, type = CommandType.STRING, required = true, + description = "PCI bus address of the GPU device (e.g., 0000:01:00.0) or UUID for MDEV devices.") + private String busAddress; + + @Parameter(name = ApiConstants.GPU_CARD_ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + required = true, description = "ID of the GPU card type") + private Long gpuCardId; + + @Parameter(name = ApiConstants.VGPU_PROFILE_ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, + required = true, description = "ID of the vGPU profile") + private Long vgpuProfileId; + + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, + description = "Type of GPU device (PCI, MDEV, VGPUOnly). Defaults to PCI.") + private String type; + + @Parameter(name = ApiConstants.PARENT_GPU_DEVICE_ID, type = CommandType.UUID, entityType = GpuDeviceResponse.class, + description = "ID of the parent GPU device (for virtual GPU devices)") + private Long parentGpuDeviceId; + + @Parameter(name = ApiConstants.NUMA_NODE, type = CommandType.STRING, + description = "NUMA node of the GPU device (e.g., 0, 1, etc.). This is optional and can be used to " + + "specify the NUMA node for the GPU device which is used during allocation. Defaults to -1") + private String numaNode; + + public Long getHostId() { + return hostId; + } + + public String getBusAddress() { + return busAddress; + } + + public Long getGpuCardId() { + return gpuCardId; + } + + public Long getVgpuProfileId() { + return vgpuProfileId; + } + + public GpuDevice.DeviceType getType() { + GpuDevice.DeviceType deviceType = GpuDevice.DeviceType.PCI; + if (StringUtils.isNotBlank(type)) { + deviceType = EnumUtils.getEnumIgnoreCase(GpuDevice.DeviceType.class, type); + if (deviceType == null) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid GPU device type: " + type); + } + } + return deviceType; + } + + public Long getParentGpuDeviceId() { + return parentGpuDeviceId; + } + + public String getNumaNode() { + if (StringUtils.isBlank(numaNode)) { + return "-1"; // Default value for NUMA node + } + return numaNode; + } + + @Override + public void execute() { + try { + GpuDeviceResponse response = gpuService.createGpuDevice(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmd.java new file mode 100644 index 000000000000..3210773b6f45 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmd.java @@ -0,0 +1,131 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; + + +@APICommand(name = "createVgpuProfile", description = "Creates a vGPU profile in the system", + responseObject = VgpuProfileResponse.class, requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, since = "4.21.0", authorized = {RoleType.Admin}) +public class CreateVgpuProfileCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, + description = "the name of the vGPU profile") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, + description = "the description of the vGPU profile") + private String description; + + @Parameter(name = ApiConstants.GPU_CARD_ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + required = true, description = "the GPU card ID associated with this GPU device") + private Long cardId; + + @Parameter(name = ApiConstants.MAX_VGPU_PER_PHYSICAL_GPU, type = CommandType.LONG, + description = "Max vGPU per physical GPU. This is used to calculate capacity.") + private Long maxVgpuPerPgpu; + + @Parameter(name = ApiConstants.VIDEORAM, type = CommandType.LONG, + description = "the video RAM size in MB") + private Long videoRam; + + @Parameter(name = ApiConstants.MAXHEADS, type = CommandType.LONG, + description = "the maximum number of display heads") + private Long maxHeads; + + @Parameter(name = ApiConstants.MAXRESOLUTIONX, type = CommandType.LONG, + description = "the maximum X resolution") + private Long maxResolutionX; + + @Parameter(name = ApiConstants.MAXRESOLUTIONY, type = CommandType.LONG, + description = "the maximum Y resolution") + private Long maxResolutionY; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public Long getCardId() { + return cardId; + } + + public Long getMaxVgpuPerPgpu() { + return maxVgpuPerPgpu; + } + + public Long getVideoRam() { + return videoRam; + } + + public Long getMaxHeads() { + return maxHeads; + } + + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public Long getMaxResolutionY() { + return maxResolutionY; + } + + @Override + public void execute() { + try { + VgpuProfileResponse response = gpuService.createVgpuProfile(this); + if (response != null) { + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vGPU profile"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to create vGPU profile: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmd.java new file mode 100644 index 000000000000..9a510ecdead9 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmd.java @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + + +@APICommand(name = "deleteGpuCard", description = "Deletes a GPU card definition from the system", + responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin}) +public class DeleteGpuCardCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GpuCardResponse.class, required = true, + description = "the ID of the GPU card") + private Long id; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + @Override + public void execute() { + try { + boolean success = gpuService.deleteGpuCard(this); + if (success) { + SuccessResponse response = new SuccessResponse(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete GPU card"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete GPU card: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmd.java new file mode 100644 index 000000000000..9224afc66ecf --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmd.java @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + +import java.util.List; + +@APICommand(name = "deleteGpuDevice", description = "Deletes a vGPU profile from the system", + responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin}) +public class DeleteGpuDeviceCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, + entityType = GpuDeviceResponse.class, required = true, + description = "comma separated list of IDs of the GPU device") + private List ids; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public List getIds() { + return ids; + } + + @Override + public void execute() { + try { + boolean success = gpuService.deleteGpuDevices(this); + if (success) { + SuccessResponse response = new SuccessResponse(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vGPU profile"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to delete vGPU profile: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmd.java new file mode 100644 index 000000000000..a09a04199f57 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmd.java @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; + + +@APICommand(name = "deleteVgpuProfile", description = "Deletes a vGPU profile from the system", + responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin}) +public class DeleteVgpuProfileCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, required = true, + description = "the ID of the vGPU profile") + private Long id; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + @Override + public void execute() { + try { + boolean success = gpuService.deleteVgpuProfile(this); + if (success) { + SuccessResponse response = new SuccessResponse(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vGPU profile"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to delete vGPU profile: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmd.java new file mode 100644 index 000000000000..83aca1a2eb64 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmd.java @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.context.CallContext; + + +@APICommand(name = "discoverGpuDevices", description = "Discovers available GPU devices on a host", + responseObject = GpuDeviceResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin}) +public class DiscoverGpuDevicesCmd extends BaseListCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, + description = "ID of the host") + private Long id; + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation ////////////////// + /// ////////////////////////////////////////////////// + + @Override + public void execute() { + CallContext.current().setEventDetails("Discovering GPU Devices on host with ID: " + getResourceUuid(ApiConstants.ID)); + ListResponse response = gpuService.discoverGpuDevices(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdmin.java new file mode 100644 index 000000000000..b3c57713fcd1 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdmin.java @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.command.user.gpu.ListGpuDevicesCmd; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; + + +@APICommand(name = "listGpuDevices", description = "Lists all available GPU devices", + responseView = ResponseObject.ResponseView.Full, + responseObject = GpuDeviceResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0") +public class ListGpuDevicesCmdByAdmin extends ListGpuDevicesCmd implements AdminCmd { + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GpuDeviceResponse.class, + description = "ID of the GPU device") + private Long id; + + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, + description = "the host ID where the GPU device is attached") + private Long hostId; + + @Parameter(name = ApiConstants.GPU_CARD_ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + description = "the GPU card ID associated with the GPU device") + private Long gpuCardId; + + @Parameter(name = ApiConstants.VGPU_PROFILE_ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, + description = "the vGPU profile ID assigned to the GPU device") + private Long vgpuProfileId; + + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public Long getHostId() { + return hostId; + } + + public Long getGpuCardId() { + return gpuCardId; + } + + public Long getVgpuProfileId() { + return vgpuProfileId; + } + +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmd.java new file mode 100644 index 000000000000..5dfe6c3deee0 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmd.java @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + +import java.util.List; + +@APICommand(name = "manageGpuDevice", description = "Manages a GPU device", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.21.0", + authorized = {RoleType.Admin}) +public class ManageGpuDeviceCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, + entityType = GpuDeviceResponse.class, required = true, + description = "comma separated list of IDs of the GPU device") + private List ids; + + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public List getIds() { + return ids; + } + + @Override + public void execute() { + try { + if (gpuService.enableGpuDevice(this)) { + SuccessResponse response = new SuccessResponse(); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable GPU device"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable GPU device: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmd.java new file mode 100644 index 000000000000..46de23ec44be --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmd.java @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + +import java.util.List; + +@APICommand(name = "unmanageGpuDevice", description = "Unmanage a GPU device", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.21.0", + authorized = {RoleType.Admin}) +public class UnmanageGpuDeviceCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, + entityType = GpuDeviceResponse.class, required = true, + description = "comma separated list of IDs of the GPU device") + private List ids; + + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public List getIds() { + return ids; + } + + @Override + public void execute() { + try { + if (gpuService.disableGpuDevice(this)) { + SuccessResponse response = new SuccessResponse(); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable GPU device"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to disable GPU device: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmd.java new file mode 100644 index 000000000000..0061149a985f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmd.java @@ -0,0 +1,99 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.gpu.GpuCard; + + +@APICommand(name = "updateGpuCard", description = "Updates a GPU card definition in the system", + responseObject = GpuCardResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin}) +public class UpdateGpuCardCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GpuCardResponse.class, required = true, + description = "the ID of the GPU card") + private Long id; + + @Parameter(name = ApiConstants.DEVICE_NAME, type = CommandType.STRING, + description = "the device name of the GPU card") + private String deviceName; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the display name of the GPU card") + private String name; + + @Parameter(name = ApiConstants.VENDOR_NAME, type = CommandType.STRING, + description = "the vendor name of the GPU card") + private String vendorName; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getDeviceName() { + return deviceName; + } + + public String getName() { + return name; + } + + public String getVendorName() { + return vendorName; + } + + @Override + public void execute() { + try { + GpuCard gpuCard = gpuService.updateGpuCard(this); + if (gpuCard != null) { + GpuCardResponse response = new GpuCardResponse(gpuCard); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update GPU card"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update GPU card: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmd.java new file mode 100644 index 000000000000..5ad6e6e1a6f6 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmd.java @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; +import org.apache.cloudstack.gpu.GpuDevice; +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; + + +@APICommand(name = "updateGpuDevice", description = "Updates an existing GPU device", + responseObject = GpuDeviceResponse.class, since = "4.21.0", requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, authorized = {RoleType.Admin}) +public class UpdateGpuDeviceCmd extends BaseCmd { + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GpuDeviceResponse.class, required = true, + description = "ID of the GPU device to update") + private Long id; + + @Parameter(name = ApiConstants.GPU_CARD_ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + description = "New GPU card ID") + private Long gpuCardId; + + @Parameter(name = ApiConstants.VGPU_PROFILE_ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, + description = "New vGPU profile ID") + private Long vgpuProfileId; + + @Parameter(name = "type", type = CommandType.STRING, description = "New type of GPU device (PCI, MDEV, VGPUOnly)") + private String type; + + @Parameter(name = "parentgpudeviceid", type = CommandType.UUID, entityType = GpuDeviceResponse.class, + description = "New parent GPU device ID (for virtual GPU devices)") + private Long parentGpuDeviceId; + + @Parameter(name = ApiConstants.NUMA_NODE, type = CommandType.STRING, + description = "New NUMA node of the GPU device") + private String numaNode; + + public Long getId() { + return id; + } + + public Long getGpuCardId() { + return gpuCardId; + } + + public Long getVgpuProfileId() { + return vgpuProfileId; + } + + public GpuDevice.DeviceType getType() { + GpuDevice.DeviceType deviceType = null; + if (StringUtils.isNotBlank(type)) { + deviceType = EnumUtils.getEnumIgnoreCase(GpuDevice.DeviceType.class, type); + if (deviceType == null) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid GPU device type: " + type); + } + } + return deviceType; + } + + public Long getParentGpuDeviceId() { + return parentGpuDeviceId; + } + + public String getNumaNode() { + return numaNode; + } + + @Override + public void execute() { + try { + GpuDeviceResponse response = gpuService.updateGpuDevice(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmd.java new file mode 100644 index 000000000000..c8d60739bd45 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmd.java @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.VgpuProfileResponse; + + +@APICommand(name = "updateVgpuProfile", description = "Updates a vGPU profile in the system", + responseObject = VgpuProfileResponse.class, requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, since = "4.21.0", authorized = {RoleType.Admin}) +public class UpdateVgpuProfileCmd extends BaseCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, required = true, + description = "the ID of the vGPU profile") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the vGPU profile") + private String profileName; + + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, + description = "the description of the vGPU profile") + private String description; + + @Parameter(name = ApiConstants.MAX_VGPU_PER_PHYSICAL_GPU, type = CommandType.LONG, + description = "the maximum number of vGPUs per physical GPU") + private Long maxVgpuPerPgpu; + + @Parameter(name = ApiConstants.VIDEORAM, type = CommandType.LONG, + description = "the video RAM size in MB") + private Long videoRam; + + @Parameter(name = ApiConstants.MAXHEADS, type = CommandType.LONG, + description = "the maximum number of display heads") + private Long maxHeads; + + @Parameter(name = ApiConstants.MAXRESOLUTIONX, type = CommandType.LONG, + description = "the maximum X resolution") + private Long maxResolutionX; + + @Parameter(name = ApiConstants.MAXRESOLUTIONY, type = CommandType.LONG, + description = "the maximum Y resolution") + private Long maxResolutionY; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getProfileName() { + return profileName; + } + + public String getDescription() { + return description; + } + + public Long getMaxVgpuPerPgpu() { + return maxVgpuPerPgpu; + } + + public Long getVideoRam() { + return videoRam; + } + + public Long getMaxHeads() { + return maxHeads; + } + + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public Long getMaxResolutionY() { + return maxResolutionY; + } + + @Override + public void execute() { + try { + VgpuProfileResponse response = gpuService.updateVgpuProfile(this); + if (response != null) { + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vGPU profile"); + } + } catch (Exception e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to update vGPU profile: " + e.getMessage()); + } + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java new file mode 100644 index 000000000000..f099de43f5d2 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmd.java @@ -0,0 +1,93 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.guest; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; + +import com.cloud.storage.GuestOsCategory; +import com.cloud.user.Account; + +@APICommand(name = "addOsCategory", + description = "Adds a new OS category", + responseObject = GuestOSCategoryResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.21.0", + authorized = {RoleType.Admin}) +public class AddGuestOsCategoryCmd extends BaseCmd { + + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the OS category", + required = true) + private String name; + + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, + description = "Whether the category is featured or not") + private Boolean featured; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getName() { + return name; + } + + public boolean isFeatured() { + return Boolean.TRUE.equals(featured); + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + GuestOsCategory guestOs = _mgr.addGuestOsCategory(this); + if (guestOs != null) { + GuestOSCategoryResponse response = _responseGenerator.createGuestOSCategoryResponse(guestOs); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add new OS category"); + } + + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.GuestOsCategory; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java index b854e8389c4f..c0e995c497d2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCmd.java @@ -120,7 +120,7 @@ public void create() { @Override public void execute() { - CallContext.current().setEventDetails("Guest OS Id: " + getEntityId()); + CallContext.current().setEventDetails("Guest OS ID: " + getEntityUuid()); GuestOS guestOs = _mgr.getAddedGuestOs(getEntityId()); if (guestOs != null) { GuestOSResponse response = _responseGenerator.createGuestOSResponse(guestOs); @@ -138,7 +138,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "adding a new guest OS type Id: " + getEntityId(); + return "Adding a new guest OS type Id: " + getEntityId(); } @Override @@ -153,7 +153,7 @@ public String getCreateEventType() { @Override public String getCreateEventDescription() { - return "adding new guest OS type"; + return "Adding new guest OS type"; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java index 3fdfebb54bf5..1a32168308ed 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsMappingCmd.java @@ -133,7 +133,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "adding a new guest OS mapping Id: " + getEntityId(); + return "Adding a new guest OS mapping Id: " + getEntityId(); } @Override @@ -148,6 +148,6 @@ public String getCreateEventType() { @Override public String getCreateEventDescription() { - return "adding new guest OS mapping"; + return "Adding new guest OS mapping"; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java similarity index 53% rename from api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java rename to api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java index b3e7d2bec821..8cf62ee2aabb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/DeleteGuestOsCategoryCmd.java @@ -14,32 +14,39 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package org.apache.cloudstack.api.command.admin.user; -import org.apache.cloudstack.api.ApiCommandResourceType; +package org.apache.cloudstack.api.command.admin.guest; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.RegisterResponse; -import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; -import com.cloud.user.User; -@APICommand(name = "registerUserKeys", - responseObject = RegisterResponse.class, - description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user", - requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) -public class RegisterCmd extends BaseCmd { + +@APICommand(name = "deleteOsCategory", + description = "Deletes an OS category", + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.21.0", + authorized = {RoleType.Admin}) +public class DeleteGuestOsCategoryCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "User id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, + required = true, description = "ID of the OS category") private Long id; ///////////////////////////////////////////////////// @@ -50,44 +57,33 @@ public Long getId() { return id; } - public void setId(Long id) { - this.id = id; - } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override - public long getEntityOwnerId() { - User user = _entityMgr.findById(User.class, getId()); - if (user != null) { - return user.getAccountId(); + public void execute() { + boolean result = _mgr.deleteGuestOsCategory(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove OS category"); } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked } @Override - public Long getApiResourceId() { - return id; + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; } @Override public ApiCommandResourceType getApiResourceType() { - return ApiCommandResourceType.User; + return ApiCommandResourceType.GuestOsCategory; } @Override - public void execute() { - String[] keys = _accountService.createApiKeyAndSecretKey(this); - RegisterResponse response = new RegisterResponse(); - if (keys != null) { - response.setApiKey(keys[0]); - response.setSecretKey(keys[1]); - } - response.setObjectName("userkeys"); - response.setResponseName(getCommandName()); - this.setResponseObject(response); + public Long getApiResourceId() { + return getId(); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/GetHypervisorGuestOsNamesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/GetHypervisorGuestOsNamesCmd.java index da920a2ec2d0..811ecc8b165b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/GetHypervisorGuestOsNamesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/GetHypervisorGuestOsNamesCmd.java @@ -44,11 +44,11 @@ public class GetHypervisorGuestOsNamesCmd extends BaseAsyncCmd { validations = {ApiArgValidator.NotNullOrEmpty}) private String hypervisor; - @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = true, description = "Hypervisor version to get the guest os names (atleast one hypervisor host with the version specified must be available)", + @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = true, description = "Hypervisor version to get the guest OS names (at least one hypervisor host with the version specified must be available)", validations = {ApiArgValidator.NotNullOrEmpty}) private String hypervisorVersion; - @Parameter(name = ApiConstants.KEYWORD, type = CommandType.STRING, required = false, description = "Keyword for guest os name") + @Parameter(name = ApiConstants.KEYWORD, type = CommandType.STRING, required = false, description = "Keyword for guest OS name") private String keyword; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java index 23e62cdc7810..47082dae68c2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/ListGuestOsMappingCmd.java @@ -40,22 +40,22 @@ public class ListGuestOsMappingCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOsMappingResponse.class, required = false, description = "list mapping by its UUID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOsMappingResponse.class, required = false, description = "List mapping by its UUID") private Long id; - @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = false, description = "list mapping by Guest OS Type UUID") + @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = false, description = "List mapping by Guest OS Type UUID") private Long osTypeId; - @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = false, description = "list Guest OS mapping by OS display name") + @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = false, description = "List Guest OS mapping by OS display name") private String osDisplayName; - @Parameter(name = ApiConstants.OS_NAME_FOR_HYPERVISOR, type = CommandType.STRING, required = false, description = "list Guest OS mapping by OS mapping name with hypervisor") + @Parameter(name = ApiConstants.OS_NAME_FOR_HYPERVISOR, type = CommandType.STRING, required = false, description = "List Guest OS mapping by OS mapping name with hypervisor") private String osNameForHypervisor; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = false, description = "list Guest OS mapping by hypervisor") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = false, description = "List Guest OS mapping by hypervisor") private String hypervisor; - @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = false, description = "list Guest OS mapping by hypervisor version. Must be used with hypervisor parameter") + @Parameter(name = ApiConstants.HYPERVISOR_VERSION, type = CommandType.STRING, required = false, description = "List Guest OS mapping by hypervisor version. Must be used with hypervisor parameter") private String hypervisorVersion; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java index d38682ce5bb4..f5c7d965c13f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsCmd.java @@ -62,7 +62,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Guest OS Id: " + id); + CallContext.current().setEventDetails("Guest OS ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _mgr.removeGuestOs(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -74,7 +74,7 @@ public void execute() { @Override public String getEventDescription() { - return "Removing Guest OS: " + getId(); + return "Removing Guest OS with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java index a472ab672c55..bd4a53889f25 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/RemoveGuestOsMappingCmd.java @@ -62,7 +62,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Guest OS Mapping Id: " + id); + CallContext.current().setEventDetails("Guest OS Mapping ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _mgr.removeGuestOsMapping(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -74,7 +74,7 @@ public void execute() { @Override public String getEventDescription() { - return "Removing Guest OS Mapping: " + getId(); + return "Removing Guest OS Mapping with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java new file mode 100644 index 000000000000..4041967abe8a --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmd.java @@ -0,0 +1,113 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.guest; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; + +import com.cloud.storage.GuestOsCategory; +import com.cloud.user.Account; + +@APICommand(name = "updateOsCategory", + description = "Updates an OS category", + responseObject = GuestOSCategoryResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.21.0", + authorized = {RoleType.Admin}) +public class UpdateGuestOsCategoryCmd extends BaseCmd { + + + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, + required = true, description = "ID of the OS category") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name for the OS category") + private String name; + + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, + description = "Whether the category is featured or not") + private Boolean featured; + + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, + description = "sort key of the OS category for listing") + private Integer sortKey; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public Boolean isFeatured() { + return featured; + } + + public Integer getSortKey() { + return sortKey; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute() { + GuestOsCategory guestOs = _mgr.updateGuestOsCategory(this); + if (guestOs != null) { + GuestOSCategoryResponse response = _responseGenerator.createGuestOSCategoryResponse(guestOs); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update OS category"); + } + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.GuestOsCategory; + } + + @Override + public Long getApiResourceId() { + return getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java index c98cd149ef30..035ff6a19e24 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmd.java @@ -16,8 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.admin.guest; -import org.apache.commons.collections.MapUtils; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -25,18 +29,14 @@ import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.GuestOSResponse; -import org.apache.cloudstack.acl.RoleType; +import org.apache.commons.collections.MapUtils; import com.cloud.event.EventTypes; import com.cloud.storage.GuestOS; import com.cloud.user.Account; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - @APICommand(name = "updateGuestOs", description = "Updates the information about Guest OS", responseObject = GuestOSResponse.class, since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateGuestOsCmd extends BaseAsyncCmd { @@ -50,7 +50,7 @@ public class UpdateGuestOsCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = true, description = "UUID of the Guest OS") private Long id; - @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = true, description = "Unique display name for Guest OS") + @Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, description = "Unique display name for Guest OS") private String osDisplayName; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = false, description = "Map of (key/value pairs)") @@ -59,6 +59,12 @@ public class UpdateGuestOsCmd extends BaseAsyncCmd { @Parameter(name="forDisplay", type=CommandType.BOOLEAN, description="whether this guest OS is available for end users", authorized = {RoleType.Admin}) private Boolean display; + @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, + description = "the ID of the OS category", since = "4.21.0") + private Long osCategoryId; + + + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -71,9 +77,9 @@ public String getOsDisplayName() { return osDisplayName; } - public Map getDetails() { - Map detailsMap = new HashMap<>();; - if (MapUtils.isNotEmpty(detailsMap)) { + public Map getDetails() { + Map detailsMap = new HashMap<>(); + if (MapUtils.isNotEmpty(details)) { Collection servicesCollection = details.values(); Iterator iter = servicesCollection.iterator(); while (iter.hasNext()) { @@ -90,6 +96,10 @@ public Boolean getForDisplay() { return display; } + public Long getOsCategoryId() { + return osCategoryId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -113,7 +123,7 @@ public void execute() { @Override public String getEventDescription() { - return "Updating guest OS: " + getId(); + return "Updating guest OS with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java index fc67ef0a7e76..161bb5323070 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsMappingCmd.java @@ -86,7 +86,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Updating Guest OS Mapping: " + getId(); + return "Updating Guest OS with ID: " + getResourceUuid(ApiConstants.ID) + " mapping."; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java index 12033c04b80f..cb427e659495 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/ConfigureHAForHostCmd.java @@ -87,6 +87,7 @@ private void setupResponse(final boolean result, final String resourceUuid) { final HostHAResponse response = new HostHAResponse(); response.setId(resourceUuid); response.setProvider(getHaProvider().toLowerCase()); + response.setStatus(result); response.setResponseName(getCommandName()); setResponseObject(response); } @@ -102,7 +103,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE if (!result) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure HA provider for the host"); } - CallContext.current().setEventDetails("Host Id:" + host.getId() + " HA configured with provider: " + getHaProvider()); + CallContext.current().setEventDetails("Host ID:" + host.getUuid() + " HA configured with provider: " + getHaProvider()); CallContext.current().putContextParameter(Host.class, host.getUuid()); setupResponse(result, host.getUuid()); @@ -115,6 +116,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "configure HA for host: " + getHostId(); + return "Configuring HA for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java index d570746765be..63c657a9e454 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForClusterCmd.java @@ -89,7 +89,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find cluster by ID: " + getClusterId()); } final boolean result = haConfigManager.disableHA(cluster); - CallContext.current().setEventDetails("Cluster Id:" + cluster.getId() + " HA enabled: false"); + CallContext.current().setEventDetails("Cluster ID:" + cluster.getUuid() + " HA enabled: false"); CallContext.current().putContextParameter(Cluster.class, cluster.getUuid()); setupResponse(result); @@ -102,7 +102,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable HA for cluster: " + getClusterId(); + return "Disabling HA for cluster with ID: " + getResourceUuid(ApiConstants.CLUSTER_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java index 5a8b1f1954f2..b90f731ff565 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForHostCmd.java @@ -91,7 +91,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final boolean result = haConfigManager.disableHA(host.getId(), HAResource.ResourceType.Host); - CallContext.current().setEventDetails("Host Id:" + host.getId() + " HA enabled: false"); + CallContext.current().setEventDetails("Host ID:" + host.getUuid() + " HA enabled: false"); CallContext.current().putContextParameter(Host.class, host.getUuid()); setupResponse(result, host.getUuid()); @@ -104,6 +104,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable HA for host: " + getHostId(); + return "Disabling HA for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java index fbd57fa82a15..07a6fbd2b399 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/DisableHAForZoneCmd.java @@ -90,7 +90,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final boolean result = haConfigManager.disableHA(dataCenter); - CallContext.current().setEventDetails("Zone Id:" + dataCenter.getId() + " HA enabled: false"); + CallContext.current().setEventDetails("Zone ID:" + dataCenter.getUuid() + " HA enabled: false"); CallContext.current().putContextParameter(DataCenter.class, dataCenter.getUuid()); setupResponse(result); @@ -103,7 +103,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable HA for zone: " + getZoneId(); + return "Disabling HA for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java index 7e627939ca55..635fba988c60 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForClusterCmd.java @@ -90,7 +90,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final boolean result = haConfigManager.enableHA(cluster); - CallContext.current().setEventDetails("Cluster Id:" + cluster.getId() + " HA enabled: true"); + CallContext.current().setEventDetails("Cluster ID:" + cluster.getUuid() + " HA enabled: true"); CallContext.current().putContextParameter(Cluster.class, cluster.getUuid()); setupResponse(result); @@ -103,6 +103,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable HA for cluster: " + getClusterId(); + return "Enabling HA for cluster with ID: " + getResourceUuid(ApiConstants.CLUSTER_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java index aac3d3505198..0bda19a7ad3c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForHostCmd.java @@ -91,7 +91,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final boolean result = haConfigManager.enableHA(host.getId(), HAResource.ResourceType.Host); - CallContext.current().setEventDetails("Host Id:" + host.getId() + " HA enabled: true"); + CallContext.current().setEventDetails("Host ID:" + host.getUuid() + " HA enabled: true"); CallContext.current().putContextParameter(Host.class, host.getUuid()); setupResponse(result, host.getUuid()); @@ -104,6 +104,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable HA for host: " + getHostId(); + return "Enabling HA for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java index f9b1560bd8a1..f6d0f62bb120 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/ha/EnableHAForZoneCmd.java @@ -90,7 +90,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final boolean result = haConfigManager.enableHA(dataCenter); - CallContext.current().setEventDetails("Zone Id:" + dataCenter.getId() + " HA enabled: true"); + CallContext.current().setEventDetails("Zone ID:" + dataCenter.getUuid() + " HA enabled: true"); CallContext.current().putContextParameter(DataCenter.class, dataCenter.getUuid()); setupResponse(result); @@ -103,7 +103,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable HA for zone: " + getZoneId(); + return "Enabling HA for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java index ca27837aa881..5a1758345609 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import java.util.List; - +import java.util.Map; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -45,36 +45,49 @@ public class AddHostCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster ID for the host") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "The cluster ID for the host") private Long clusterId; - @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "the cluster name for the host") + @Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING, description = "The cluster name for the host") private String clusterName; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username for the host; required to be passed for hypervisors other than VMWare") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "The username for the host; required to be passed for hypervisors other than VMWare") private String username; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "the password for the host; required to be passed for hypervisors other than VMWare") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "The password for the host; required to be passed for hypervisors other than VMWare") private String password; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the Pod ID for the host") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The Pod ID for the host") private Long podId; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the host URL") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL, optionally add ssh port (format: 'host:port') for KVM hosts," + + " otherwise falls back to the port defined at the config 'kvm.host.discovery.ssh.port'") private String url; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the Zone ID for the host") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The Zone ID for the host") private Long zoneId; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "hypervisor type of the host") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "Hypervisor type of the host") private String hypervisor; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this Host for allocation of new resources") private String allocationState; - @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list of tags to be added to the host") + @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "List of tags to be added to the host") private List hostTags; + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, + type = CommandType.LIST, collectionType = CommandType.STRING, + description = "comma separated list of storage access groups for the host", + since = "4.21.0") + private List storageAccessGroups; + + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", + since = "4.21.0") + protected Map externalDetails; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -115,10 +128,18 @@ public List getHostTags() { return hostTags; } + public List getStorageAccessGroups() { + return storageAccessGroups; + } + public String getAllocationState() { return allocationState; } + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java index c965a39450bd..585fd1b87a88 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java @@ -29,6 +29,11 @@ import com.cloud.exception.DiscoveryException; import com.cloud.storage.ImageStore; import com.cloud.user.Account; +import org.apache.commons.collections.MapUtils; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; @APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -38,12 +43,15 @@ public class AddSecondaryStorageCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for the secondary storage") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The URL for the secondary storage") protected String url; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the secondary storage") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the secondary storage") protected Long zoneId; + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].copytemplatesfromothersecondarystorages=true") + protected Map details; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -56,6 +64,20 @@ public Long getZoneId() { return zoneId; } + public Map getDetails() { + Map detailsMap = new HashMap<>(); + if (MapUtils.isNotEmpty(details)) { + Collection props = details.values(); + for (Object prop : props) { + HashMap detail = (HashMap) prop; + for (Map.Entry entry: detail.entrySet()) { + detailsMap.put(entry.getKey(),entry.getValue()); + } + } + } + return detailsMap; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -68,7 +90,7 @@ public long getEntityOwnerId() { @Override public void execute(){ try{ - ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), null); + ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), getDetails()); ImageStoreResponse storeResponse = null; if (result != null ) { storeResponse = _responseGenerator.createImageStoreResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostAsDegradedCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostAsDegradedCmd.java index 4e9d997b3b76..56930d47b2ec 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostAsDegradedCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostAsDegradedCmd.java @@ -47,7 +47,7 @@ public class CancelHostAsDegradedCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = HostResponse.class, description = "host ID", required = true, validations = {ApiArgValidator.PositiveNumber}) + @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = HostResponse.class, description = "Host ID", required = true, validations = {ApiArgValidator.PositiveNumber}) private Long id; ///////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "declaring host: " + getId() + " as Degraded"; + return "Removing host with ID: " + getResourceUuid(ApiConstants.ID) + " from Degraded state."; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostMaintenanceCmd.java index 55fe8ec23cec..5d44bafb4b5c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostMaintenanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/CancelHostMaintenanceCmd.java @@ -40,7 +40,7 @@ public class CancelHostMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The host ID") private Long id; ///////////////////////////////////////////////////// @@ -76,7 +76,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "canceling maintenance for host: " + getId(); + return "Canceling maintenance for host with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeclareHostAsDegradedCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeclareHostAsDegradedCmd.java index 6bb8f382e541..1dd65a583706 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeclareHostAsDegradedCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeclareHostAsDegradedCmd.java @@ -33,7 +33,7 @@ import org.apache.cloudstack.context.CallContext; @APICommand(name = "declareHostAsDegraded", - description = "Declare host as 'Degraded'. Host must be on 'Disconnected' or 'Alert' state. The ADMIN must be sure that there are no VMs running on the respective host otherwise this command might corrupted VMs that were running on the 'Degraded' host.", + description = "Declare host as 'Degraded'. Host must be on 'Disconnected' or 'Alert' state. The ADMIN must be sure that there are no Instances running on the respective host otherwise this command might corrupted Instances that were running on the 'Degraded' host.", since = "4.16.0.0", responseObject = HostResponse.class, requestHasSensitiveInfo = false, @@ -47,7 +47,7 @@ public class DeclareHostAsDegradedCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = HostResponse.class, description = "host ID", required = true, validations = {ApiArgValidator.PositiveNumber}) + @Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = HostResponse.class, description = "Host ID", required = true, validations = {ApiArgValidator.PositiveNumber}) private Long id; ///////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "declaring host: " + getId() + " as Degraded"; + return "Declaring host with ID: " + getResourceUuid(ApiConstants.ID) + " as Degraded."; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java index 38325c2f072d..79ad1acec9f6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java @@ -37,17 +37,17 @@ public class DeleteHostCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The host ID") private Long id; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, - description = "Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped") + description = "Force delete the host. All HA enabled Instances running on the host will be put to HA; HA disabled ones will be stopped") private Boolean forced; @Parameter(name = ApiConstants.FORCED_DESTROY_LOCAL_STORAGE, type = CommandType.BOOLEAN, - description = "Force destroy local storage on this host. All VMs created on this local storage will be destroyed") + description = "Force destroy local storage on this host. All Instances created on this local storage will be destroyed") private Boolean forceDestroyLocalStorage; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java index db30e4f4c02f..4d6ef7419616 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java @@ -33,7 +33,7 @@ import com.cloud.utils.Pair; import com.cloud.utils.Ternary; -@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating a virtual machine.", responseObject = HostForMigrationResponse.class, +@APICommand(name = "findHostsForMigration", description = "Find hosts suitable for migrating an Instance.", responseObject = HostForMigrationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class FindHostsForMigrationCmd extends BaseListCmd { @@ -46,7 +46,7 @@ public class FindHostsForMigrationCmd extends BaseListCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "find hosts to which this VM can be migrated and flag the hosts with enough " + "CPU/RAM to host the VM") + description = "Find hosts to which this Instance can be migrated and flag the hosts with enough " + "CPU/RAM to host the Instance") private Long virtualMachineId; ///////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public void execute() { for (Host host : result.first()) { HostForMigrationResponse hostResponse = _responseGenerator.createHostForMigrationResponse(host); Boolean suitableForMigration = false; - if (hostsWithCapacity.contains(host)) { + if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) { suitableForMigration = true; } hostResponse.setSuitableForMigration(suitableForMigration); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java index 5e229521efe8..8f5e6c784d6e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Map; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -35,7 +34,9 @@ import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; import com.cloud.hypervisor.Hypervisor.HypervisorType; @@ -51,64 +52,75 @@ public class ListHostsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "lists hosts existing in particular cluster") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "Lists hosts existing in particular cluster") private Long clusterId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the id of the host") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, description = "The ID of the host") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the host") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the host") private String hostName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID for the host") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID for the host") private Long podId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "the state of the host") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the host") private String state; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the host type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "The host type") private String type; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the host") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the host") private Long zoneId; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = false, - description = "lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM") + description = "Lists hosts in the same cluster as this Instance and flag hosts with enough CPU/RAm to host this Instance") private Long virtualMachineId; @Parameter(name = ApiConstants.OUTOFBANDMANAGEMENT_ENABLED, type = CommandType.BOOLEAN, - description = "list hosts for which out-of-band management is enabled") + description = "List hosts for which out-of-band management is enabled") private Boolean outOfBandManagementEnabled; @Parameter(name = ApiConstants.OUTOFBANDMANAGEMENT_POWERSTATE, type = CommandType.STRING, - description = "list hosts by its out-of-band management interface's power state. Its value can be one of [On, Off, Unknown]") + description = "List hosts by its out-of-band management interface's power state. Its value can be one of [On, Off, Unknown]") private String outOfBandManagementPowerState; @Parameter(name = ApiConstants.RESOURCE_STATE, type = CommandType.STRING, - description = "list hosts by resource state. Resource state represents current state determined by admin of host, value can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]") + description = "List hosts by resource state. Resource state represents current state determined by admin of host, value can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]") private String resourceState; @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]") + description = "Comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]") private List viewDetails; - @Parameter(name = ApiConstants.HA_HOST, type = CommandType.BOOLEAN, description = "if true, list only hosts dedicated to HA") + @Parameter(name = ApiConstants.HA_HOST, type = CommandType.BOOLEAN, description = "If true, list only hosts dedicated to HA") private Boolean haHost; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "Hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator") private String hypervisor; @Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "the id of the management server", since="4.21.0") private Long managementServerId; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, description = "CPU Arch of the host", since = "4.20.1") + private String arch; + + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING, + description = "the name of the storage access group", + since = "4.21.0") + private String storageAccessGroup; + + @Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, description = "the host version", since = "4.20.3") + private String version; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -197,6 +209,26 @@ public Long getManagementServerId() { return managementServerId; } + public CPU.CPUArch getArch() { + return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch); + } + + public String getStorageAccessGroup() { + return storageAccessGroup; + } + + public ListHostsCmd() { + + } + + public ListHostsCmd(String storageAccessGroup) { + this.storageAccessGroup = storageAccessGroup; + } + + public String getVersion() { + return version; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -220,7 +252,7 @@ protected ListResponse getHostResponses() { for (Host host : result.first()) { HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails()); Boolean suitableForMigration = false; - if (hostsWithCapacity.contains(host)) { + if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) { suitableForMigration = true; } hostResponse.setSuitableForMigration(suitableForMigration); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForHostMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForHostMaintenanceCmd.java index 5c2b50c87239..843c7fd7fcbe 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForHostMaintenanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/PrepareForHostMaintenanceCmd.java @@ -40,7 +40,7 @@ public class PrepareForHostMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The host ID") private Long id; ///////////////////////////////////////////////////// @@ -76,7 +76,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "preparing host: " + getId() + " for maintenance"; + return "Preparing host with ID: " + getResourceUuid(ApiConstants.ID) + " for maintenance."; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java index 3550d61fdb97..b9892ed6033c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java @@ -41,7 +41,7 @@ public class ReconnectHostCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The host ID") private Long id; ///////////////////////////////////////////////////// @@ -77,7 +77,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "reconnecting host: " + getId(); + return "Reconnecting host with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java index 7fee0684c781..bddb5b13e452 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReleaseHostReservationCmd.java @@ -40,7 +40,7 @@ public class ReleaseHostReservationCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the host ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The host ID") private Long id; ///////////////////////////////////////////////////// @@ -72,7 +72,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "releasing reservation for host: " + getId(); + return "Releasing reservation from host with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java index 397f9c80735e..c085abd42c76 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java @@ -16,8 +16,9 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import com.cloud.host.Host; -import com.cloud.user.Account; +import java.util.List; +import java.util.Map; + import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -28,7 +29,8 @@ import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.HostResponse; -import java.util.List; +import com.cloud.host.Host; +import com.cloud.user.Account; @APICommand(name = "updateHost", description = "Updates a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -38,7 +40,7 @@ public class UpdateHostCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "the ID of the host to update") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, description = "The ID of the host to update") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Change the name of host", since = "4.15", authorized = {RoleType.Admin}) @@ -47,7 +49,7 @@ public class UpdateHostCmd extends BaseCmd { @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, - description = "the id of Os category to update the host with") + description = "The ID of OS category to update the host with") private Long osCategoryId; @Parameter(name = ApiConstants.ALLOCATION_STATE, @@ -55,18 +57,29 @@ public class UpdateHostCmd extends BaseCmd { description = "Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable") private String allocationState; - @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list of tags to be added to the host") + @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "List of tags to be added to the host") private List hostTags; @Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE) private Boolean isTagARule; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "the new uri for the secondary storage: nfs://host/path") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "The new URI for the secondary storage: nfs://host/path") private String url; @Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "Add an annotation to this host", since = "4.11", authorized = {RoleType.Admin}) private String annotation; + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", since = "4.21.0") + protected Map externalDetails; + + @Parameter(name = ApiConstants.CLEAN_UP_EXTERNAL_DETAILS, + type = CommandType.BOOLEAN, + description = "Optional boolean field, which indicates if external details should be cleaned up or not " + + "(If set to true, external details removed for this host, externaldetails field ignored; " + + "if false or not set, no action)", + since = "4.22.0") + protected Boolean cleanupExternalDetails; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -103,6 +116,14 @@ public String getAnnotation() { return annotation; } + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + + public boolean isCleanupExternalDetails() { + return Boolean.TRUE.equals(cleanupExternalDetails); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -126,7 +147,7 @@ public void execute() { this.setResponseObject(hostResponse); } catch (Exception e) { Host host = _entityMgr.findById(Host.class, getId()); - logger.debug("Failed to update host: {} with id {}", host, getId(), e); + logger.error("Failed to update {}", host, e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update host: %s with id %d, %s", host, getId(), e.getMessage())); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java index c94fe2c58656..f96f01d3a877 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java @@ -36,19 +36,19 @@ public class UpdateHostPasswordCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID") + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "The host ID") private Long hostId; - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster ID") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "The cluster ID") private Long clusterId; - @Parameter(name = ApiConstants.SHOULD_UPDATE_PASSWORD, type = CommandType.BOOLEAN, description = "if the password should also be updated on the hosts") + @Parameter(name = ApiConstants.SHOULD_UPDATE_PASSWORD, type = CommandType.BOOLEAN, description = "If the password should also be updated on the hosts") private Boolean updatePasswdOnHost; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "the username for the host/cluster") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "The username for the host/cluster") private String username; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the new password for the host/cluster") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "The new password for the host/cluster") private String password; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java index c94d326ee622..51aa86546603 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ConfigureInternalLoadBalancerElementCmd.java @@ -50,7 +50,7 @@ public class ConfigureInternalLoadBalancerElementCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class, required = true, - description = "the ID of the internal lb provider") + description = "The ID of the internal lb provider") private Long id; @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "Enables/Disables the Internal Load Balancer element") @@ -84,12 +84,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "configuring internal load balancer element: " + id; + return "Configuring internal load balancer element with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Internal load balancer element: " + id); + CallContext.current().setEventDetails("Internal load balancer element: " + getResourceUuid(ApiConstants.ID)); InternalLoadBalancerElementService service = _networkService.getInternalLoadBalancerElementById(id); VirtualRouterProvider result = service.configureInternalLoadBalancerElement(getId(), getEnabled()); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java index 924287b673ba..aa9e5f1ba7f4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/CreateInternalLoadBalancerElementCmd.java @@ -48,7 +48,7 @@ public class CreateInternalLoadBalancerElementCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = ProviderResponse.class, required = true, - description = "the network service provider ID of the internal load balancer element") + description = "The network service provider ID of the internal load balancer element") private Long nspId; ///////////////////////////////////////////////////// @@ -74,7 +74,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Virtual router element Id: " + getEntityId()); + CallContext.current().setEventDetails("Virtual router element ID: " + getEntityUuid()); InternalLoadBalancerElementService service = _networkService.getInternalLoadBalancerElementByNetworkServiceProviderId(getNspId()); VirtualRouterProvider result = service.getInternalLoadBalancerElement(getEntityId()); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java index 0eb00234382d..9ba23279c5df 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLBVMsCmd.java @@ -35,7 +35,7 @@ import com.cloud.network.router.VirtualRouter.Role; import com.cloud.vm.VirtualMachine; -@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB VMs.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "listInternalLoadBalancerVMs", description = "List internal LB Instances.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -45,36 +45,36 @@ public class ListInternalLBVMsCmd extends BaseListProjectAndAccountResourcesCmd //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID of the Internal LB VM") + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "The host ID of the Internal LB Instance") private Long hostId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the Internal LB VM") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the Internal LB Instance") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Internal LB VM") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Internal LB Instance") private String routerName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID of the Internal LB VM") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID of the Internal LB Instance") private Long podId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "the state of the Internal LB VM") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the Internal LB Instance") private String state; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the Internal LB VM") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID of the Internal LB Instance") private Long zoneId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list by network id") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List by Network ID") private Long networkId; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List Internal LB VMs by VPC") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List Internal LB Instances by VPC") private Long vpcId; - @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "if true is passed for this parameter, list only VPC Internal LB VMs") + @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "If true is passed for this parameter, list only VPC Internal LB Instances") private Boolean forVpc; @Parameter(name = ApiConstants.FETCH_ROUTER_HEALTH_CHECK_RESULTS, type = CommandType.BOOLEAN, since = "4.14", - description = "if true is passed for this parameter, also fetch last executed health check results for the VM. Default is false") + description = "If true is passed for this parameter, also fetch last executed health check results for the Instance. Default is false") private Boolean fetchHealthCheckResults; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java index b17cc22e7466..9cd7ba2656b5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java @@ -50,16 +50,16 @@ public class ListInternalLoadBalancerElementsCmd extends BaseListCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InternalLoadBalancerElementResponse.class, - description = "list internal load balancer elements by id") + description = "List internal load balancer elements by ID") private Long id; @Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, - description = "list internal load balancer elements by network service provider id") + description = "List internal load balancer elements by network service provider ID") private Long nspId; - @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "list internal load balancer elements by enabled state") + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "List internal load balancer elements by enabled state") private Boolean enabled; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java index 3dd7d2adf378..d9d4e46726fc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java @@ -38,7 +38,7 @@ import com.cloud.network.router.VirtualRouter.Role; import com.cloud.vm.VirtualMachine; -@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing internal lb vm.", entityType = {VirtualMachine.class}, +@APICommand(name = "startInternalLoadBalancerVM", responseObject = DomainRouterResponse.class, description = "Starts an existing Internal LB Instance.", entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StartInternalLBVMCmd extends BaseAsyncCmd { private static final String s_name = "startinternallbvmresponse"; @@ -47,7 +47,7 @@ public class StartInternalLBVMCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the Internal LB Instance") private Long id; ///////////////////////////////////////////////////// @@ -77,7 +77,7 @@ public long getEntityOwnerId() { if (router != null && router.getRole() == Role.INTERNAL_LB_VM) { return router.getAccountId(); } else { - throw new InvalidParameterValueException("Unable to find internal lb vm by id"); + throw new InvalidParameterValueException("Unable to find Internal LB Instance by ID"); } } @@ -88,7 +88,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "starting internal lb vm: " + getId(); + return "Starting internal LB Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -103,11 +103,11 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Internal Lb Vm Id: " + getId()); + CallContext.current().setEventDetails("Internal LB Instance ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.INTERNAL_LB_VM) { - throw new InvalidParameterValueException("Can't find internal lb vm by id"); + throw new InvalidParameterValueException("Can't find Internal LB Instance by ID"); } else { result = _internalLbSvc.startInternalLbVm(getId(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId()); } @@ -117,7 +117,7 @@ public void execute() throws ConcurrentOperationException, ResourceUnavailableEx routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start Internal LB Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java index a746e5d906d6..253c59e671e5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java @@ -37,7 +37,7 @@ import com.cloud.network.router.VirtualRouter.Role; import com.cloud.vm.VirtualMachine; -@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB vm.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "stopInternalLoadBalancerVM", description = "Stops an Internal LB Instance.", responseObject = DomainRouterResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StopInternalLBVMCmd extends BaseAsyncCmd { private static final String s_name = "stopinternallbvmresponse"; @@ -46,10 +46,10 @@ public class StopInternalLBVMCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the internal lb vm") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the internal LB Instance") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the Instance (Instance is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the Instance is stopped and should be marked as such.") private Boolean forced; // /////////////////////////////////////////////////// @@ -75,7 +75,7 @@ public long getEntityOwnerId() { if (vm != null && vm.getRole() == Role.INTERNAL_LB_VM) { return vm.getAccountId(); } else { - throw new InvalidParameterValueException("Unable to find internal lb vm by id"); + throw new InvalidParameterValueException("Unable to find Internal LB Instance by ID"); } } @@ -86,7 +86,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "stopping internal lb vm: " + getId(); + return "Stopping Internal LB Instance: " + getResourceUuid(ApiConstants.ID); } @Override @@ -105,11 +105,11 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("Internal lb vm Id: " + getId()); + CallContext.current().setEventDetails("Internal LB Instance ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) { - throw new InvalidParameterValueException("Can't find internal lb vm by id"); + throw new InvalidParameterValueException("Can't find Internal LB Instance by ID"); } else { result = _internalLbSvc.stopInternalLbVm(getId(), isForced(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId()); } @@ -119,7 +119,7 @@ public void execute() throws ConcurrentOperationException, ResourceUnavailableEx response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop Internal LB Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java index e39107b2593c..d253580f0983 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/AttachIsoCmdByAdmin.java @@ -22,6 +22,6 @@ import org.apache.cloudstack.api.command.user.iso.AttachIsoCmd; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, +@APICommand(name = "attachIso", description = "Attaches an ISO to an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AttachIsoCmdByAdmin extends AttachIsoCmd implements AdminCmd { } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java index f27c0c5c234a..f64326638a33 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/CopyIsoCmdByAdmin.java @@ -21,7 +21,7 @@ import org.apache.cloudstack.api.command.user.iso.CopyIsoCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "copyIso", description = "Copies an iso from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, +@APICommand(name = "copyIso", description = "Copies an ISO from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CopyIsoCmdByAdmin extends CopyIsoCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java index 5eeba2bfa301..553d0ae13c69 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/DetachIsoCmdByAdmin.java @@ -22,6 +22,6 @@ import org.apache.cloudstack.api.command.user.iso.DetachIsoCmd; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, +@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DetachIsoCmdByAdmin extends DetachIsoCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java index 46bd4f3766e7..b831a99cb0af 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/iso/ListIsoPermissionsCmdByAdmin.java @@ -1,4 +1,4 @@ -// Licensedname = "listIsoPermissions", to the Apache Software Foundation (ASF) under one +// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.response.TemplatePermissionsResponse; @APICommand(name = "listIsoPermissions", - description = "List iso visibility and all accounts that have permissions to view this iso.", + description = "List ISO visibility and all accounts that have permissions to view this ISO.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java index b11988b241fb..a37e058924f6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/loadbalancer/ListLoadBalancerRuleInstancesCmdByAdmin.java @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd; -@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Full, +@APICommand(name = "listLoadBalancerRuleInstances", description = "List all Instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListLoadBalancerRuleInstancesCmdByAdmin extends ListLoadBalancerRuleInstancesCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java index 7b7eae1d0e93..293cb34e7028 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java @@ -34,10 +34,10 @@ public class ListMgmtsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "the id of the management server") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "The ID of the management server") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the management server") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the management server") private String hostName; @Parameter(name = ApiConstants.PEERS, type = CommandType.BOOLEAN, @@ -45,6 +45,10 @@ public class ListMgmtsCmd extends BaseListCmd { since = "4.20.1.0") private Boolean peers; + @Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, + description = "the version of the management server", since = "4.20.3") + private String version; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -61,6 +65,10 @@ public Boolean getPeers() { return BooleanUtils.toBooleanDefaultIfNull(peers, false); } + public String getVersion() { + return version; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java new file mode 100644 index 000000000000..803b95bfa9e2 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.management; + +import com.cloud.event.EventTypes; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.response.ManagementServerResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; + +@APICommand(name = "removeManagementServer", description = "Removes a Management Server.", responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = RoleType.Admin) +public class RemoveManagementServerCmd extends BaseCmd { + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, required = true, description = "the ID of the Management Server") + private Long id; + + public Long getId() { + return id; + } + + @Override + public void execute() { + boolean result = _mgr.removeManagementServer(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove Management Server."); + } + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccountId(); + } + + public String getEventType() { + return EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java index 334772970431..e90a56a92abb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java @@ -55,7 +55,7 @@ public class AddNetworkDeviceCmd extends BaseCmd { description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall") private String type; - @Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "parameters for network device") + @Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "Parameters for network device") private Map paramList; public String getDeviceType() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java index 40a822393452..3e42a0103d8b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java @@ -52,22 +52,22 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, - description = "the Physical Network ID to add the provider to") + description = "The Physical Network ID to add the provider to") private Long physicalNetworkId; @Parameter(name = ApiConstants.DEST_PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "the destination Physical Network ID to bridge to") + description = "The destination Physical Network ID to bridge to") private Long destinationPhysicalNetworkId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name for the physical network service provider") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name for the physical network service provider") private String name; @Parameter(name = ApiConstants.SERVICE_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "the list of services to be enabled for this physical network service provider") + description = "The list of services to be enabled for this physical network service provider") private List enabledServices; ///////////////////////////////////////////////////// @@ -101,7 +101,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Network ServiceProvider Id: " + getEntityId()); + CallContext.current().setEventDetails("Network ServiceProvider ID: " + getEntityUuid()); PhysicalNetworkServiceProvider result = _networkService.getCreatedPhysicalNetworkServiceProvider(getEntityId()); if (result != null) { ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmd.java new file mode 100644 index 000000000000..19760ffaaa10 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmd.java @@ -0,0 +1,113 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.network; + +import java.util.List; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NetworkOfferingResponse; + +import com.cloud.offering.NetworkOffering; + +@APICommand(name = "cloneNetworkOffering", + description = "Clones a network offering. All parameters are copied from the source offering unless explicitly overridden. " + + "Use 'addServices' and 'dropServices' to modify the service list without respecifying everything.", + responseObject = NetworkOfferingResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.23.0") +public class CloneNetworkOfferingCmd extends NetworkOfferingBaseCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, + type = BaseCmd.CommandType.UUID, + entityType = NetworkOfferingResponse.class, + required = true, + description = "The ID of the source network offering to clone from") + private Long sourceOfferingId; + + @Parameter(name = "addservices", + type = CommandType.LIST, + collectionType = CommandType.STRING, + description = "Services to add to the cloned offering (in addition to source offering services). " + + "If specified along with 'supportedservices', this parameter is ignored.") + private List addServices; + + @Parameter(name = "dropservices", + type = CommandType.LIST, + collectionType = CommandType.STRING, + description = "Services to remove from the cloned offering (that exist in source offering). " + + "If specified along with 'supportedservices', this parameter is ignored.") + private List dropServices; + + @Parameter(name = ApiConstants.TRAFFIC_TYPE, + type = CommandType.STRING, + description = "The traffic type for the network offering. Supported type in current release is GUEST only") + private String traffictype; + + @Parameter(name = ApiConstants.GUEST_IP_TYPE, type = CommandType.STRING, description = "Guest type of the network offering: Shared or Isolated") + private String guestIptype; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSourceOfferingId() { + return sourceOfferingId; + } + + public List getAddServices() { + return addServices; + } + + public List getDropServices() { + return dropServices; + } + + public String getGuestIpType() { + return guestIptype; + } + + public String getTraffictype() { + return traffictype; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + NetworkOffering result = _configService.cloneNetworkOffering(this); + if (result != null) { + NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone network offering"); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateGuestNetworkIpv6PrefixCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateGuestNetworkIpv6PrefixCmd.java index f6b035c57837..614dcf9d0751 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateGuestNetworkIpv6PrefixCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateGuestNetworkIpv6PrefixCmd.java @@ -83,7 +83,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating guest IPv6 prefix " + getPrefix() + " for zone=" + getZoneId(); + return "Creating guest IPv6 prefix " + getPrefix() + " for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmd.java index a482cb1d4f27..4d645376a909 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmd.java @@ -85,7 +85,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating guest IPv4 subnet " + getSubnet() + " in zone subnet=" + getParentId(); + return "Creating guest IPv4 subnet " + getSubnet() + " in zone subnet: " + getResourceUuid(ApiConstants.PARENT_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmd.java index 5f48cf9c6327..48a6002fb5c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmd.java @@ -102,7 +102,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating guest IPv4 subnet " + getSubnet() + " for zone=" + getZoneId(); + return "Creating guest IPv4 subnet " + getSubnet() + " for zone: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java index 85cfddfb714f..2780c4eaf050 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateManagementNetworkIpRangeCmd.java @@ -34,6 +34,7 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; +import com.cloud.utils.StringUtils; @APICommand(name = "createManagementNetworkIpRange", description = "Creates a Management network IP range.", @@ -118,7 +119,7 @@ public Boolean isForSystemVms() { } public String getVlan() { - if (vlan == null || vlan.isEmpty()) { + if (StringUtils.isBlank(vlan)) { vlan = "untagged"; } return vlan; @@ -131,7 +132,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating management ip range from " + getStartIp() + " to " + getEndIp() + " and gateway=" + getGateWay() + ", netmask=" + getNetmask() + " of pod=" + getPodId(); + return "Creating management IP range from " + getStartIp() + " to " + getEndIp() + ", with gateway: " + getGateWay() + ", netmask:" + getNetmask() + " on pod:" + getPodId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java index d8b57f79528c..57d1d4fad116 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkCmdByAdmin.java @@ -31,24 +31,24 @@ import java.util.List; -@APICommand(name = "createNetwork", description = "Creates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full, entityType = {Network.class}, +@APICommand(name = "createNetwork", description = "Creates a Network", responseObject = NetworkResponse.class, responseView = ResponseView.Full, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkCmdByAdmin extends CreateNetworkCmd implements AdminCmd { - @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the network") + @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description = "The ID or VID of the network") private String vlan; - @Parameter(name=ApiConstants.BYPASS_VLAN_OVERLAP_CHECK, type=CommandType.BOOLEAN, description="when true bypasses VLAN id/range overlap check during network creation for shared and L2 networks") + @Parameter(name=ApiConstants.BYPASS_VLAN_OVERLAP_CHECK, type=CommandType.BOOLEAN, description = "When true bypasses VLAN ID/range overlap check during Network creation for shared and L2 Networks") private Boolean bypassVlanOverlapCheck; - @Parameter(name=ApiConstants.HIDE_IP_ADDRESS_USAGE, type=CommandType.BOOLEAN, description="when true ip address usage for the network will not be exported by the listUsageRecords API") + @Parameter(name=ApiConstants.HIDE_IP_ADDRESS_USAGE, type=CommandType.BOOLEAN, description = "When true IP address usage for the Network will not be exported by the listUsageRecords API") private Boolean hideIpAddressUsage; - @Parameter(name = ApiConstants.ROUTER_IP, type = CommandType.STRING, description = "IPV4 address to be assigned to a router in a shared network", since = "4.16", + @Parameter(name = ApiConstants.ROUTER_IP, type = CommandType.STRING, description = "IPv4 address to be assigned to a router in a shared Network", since = "4.16", validations = {ApiArgValidator.NotNullOrEmpty}) private String routerIp; - @Parameter(name = ApiConstants.ROUTER_IPV6, type = CommandType.STRING, description = "IPV6 address to be assigned to a router in a shared network", since = "4.16", + @Parameter(name = ApiConstants.ROUTER_IPV6, type = CommandType.STRING, description = "IPv6 address to be assigned to a router in a shared Network", since = "4.16", validations = {ApiArgValidator.NotNullOrEmpty}) private String routerIpv6; @@ -56,7 +56,7 @@ public class CreateNetworkCmdByAdmin extends CreateNetworkCmd implements AdminCm type = CommandType.LIST, collectionType = CommandType.UUID, entityType = BgpPeerResponse.class, - description = "Ids of the Bgp Peer for the network", + description = "IDs of the Bgp Peer for the Network", since = "4.20.0") private List bgpPeerIds; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java index af3db374a7c9..5c39060f9fa3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java @@ -16,477 +16,47 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import com.cloud.network.Network; -import com.cloud.network.VirtualRouterProvider; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.NetworkOfferingResponse; -import org.apache.cloudstack.api.response.ServiceOfferingResponse; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.network.Network.Capability; -import com.cloud.network.Network.Service; import com.cloud.offering.NetworkOffering; -import com.cloud.offering.NetworkOffering.Availability; -import com.cloud.user.Account; - -import static com.cloud.network.Network.Service.Dhcp; -import static com.cloud.network.Network.Service.Dns; -import static com.cloud.network.Network.Service.Lb; -import static com.cloud.network.Network.Service.StaticNat; -import static com.cloud.network.Network.Service.SourceNat; -import static com.cloud.network.Network.Service.PortForwarding; -import static com.cloud.network.Network.Service.NetworkACL; -import static com.cloud.network.Network.Service.UserData; -import static com.cloud.network.Network.Service.Firewall; @APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class CreateNetworkOfferingCmd extends BaseCmd { +public class CreateNetworkOfferingCmd extends NetworkOfferingBaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the network offering") - private String networkOfferingName; - - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the network offering, defaults to the value of 'name'.") - private String displayText; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, required = true, - description = "the traffic type for the network offering. Supported type in current release is GUEST only") + description = "The traffic type for the network offering. Supported type in current release is GUEST only") private String traffictype; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the network offering.", length = 4096) - private String tags; - - @Parameter(name = ApiConstants.SPECIFY_VLAN, type = CommandType.BOOLEAN, description = "true if network offering supports vlans") - private Boolean specifyVlan; - - @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "the availability of network offering. The default value is Optional. " - + " Another value is Required, which will make it as the default network offering for new networks ") - private String availability; - - @Parameter(name = ApiConstants.NETWORKRATE, type = CommandType.INTEGER, description = "data transfer rate in megabits per second allowed") - private Integer networkRate; - - @Parameter(name = ApiConstants.CONSERVE_MODE, type = CommandType.BOOLEAN, description = "true if the network offering is IP conserve mode enabled") - private Boolean conserveMode; - - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, - type = CommandType.UUID, - entityType = ServiceOfferingResponse.class, - description = "the service offering ID used by virtual router provider") - private Long serviceOfferingId; - - @Parameter(name = ApiConstants.GUEST_IP_TYPE, type = CommandType.STRING, required = true, description = "guest type of the network offering: Shared or Isolated") + @Parameter(name = ApiConstants.GUEST_IP_TYPE, type = CommandType.STRING, required = true, description = "Guest type of the network offering: Shared or Isolated") private String guestIptype; - @Parameter(name = ApiConstants.INTERNET_PROTOCOL, - type = CommandType.STRING, - description = "The internet protocol of network offering. Options are ipv4 and dualstack. Default is ipv4. dualstack will create a network offering that supports both IPv4 and IPv6", - since = "4.17.0") - private String internetProtocol; - - @Parameter(name = ApiConstants.SUPPORTED_SERVICES, - type = CommandType.LIST, - collectionType = CommandType.STRING, - description = "services supported by the network offering") - private List supportedServices; - - @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, - type = CommandType.MAP, - description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network") - private Map serviceProviderList; - - @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering") - private Map serviceCapabilitystList; - - @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, - type = CommandType.BOOLEAN, - description = "true if network offering supports specifying ip ranges; defaulted to false if not specified") - private Boolean specifyIpRanges; - - @Parameter(name = ApiConstants.IS_PERSISTENT, - type = CommandType.BOOLEAN, - description = "true if network offering supports persistent networks; defaulted to false if not specified") - private Boolean isPersistent; - - @Parameter(name = ApiConstants.FOR_VPC, - type = CommandType.BOOLEAN, - description = "true if network offering is meant to be used for VPC, false otherwise.") - private Boolean forVpc; - - @Parameter(name = ApiConstants.FOR_NSX, - type = CommandType.BOOLEAN, - description = "true if network offering is meant to be used for NSX, false otherwise.", - since = "4.20.0") - private Boolean forNsx; - - @Parameter(name = ApiConstants.NSX_SUPPORT_LB, - type = CommandType.BOOLEAN, - description = "true if network offering for NSX network offering supports Load balancer service.", - since = "4.20.0") - private Boolean nsxSupportsLbService; - - @Parameter(name = ApiConstants.NSX_SUPPORTS_INTERNAL_LB, - type = CommandType.BOOLEAN, - description = "true if network offering for NSX network offering supports Internal Load balancer service.", - since = "4.20.0") - private Boolean nsxSupportsInternalLbService; - - @Parameter(name = ApiConstants.NETWORK_MODE, - type = CommandType.STRING, - description = "Indicates the mode with which the network will operate. Valid option: NATTED or ROUTED", - since = "4.20.0") - private String networkMode; - - @Parameter(name = ApiConstants.FOR_TUNGSTEN, - type = CommandType.BOOLEAN, - description = "true if network offering is meant to be used for Tungsten-Fabric, false otherwise.") - private Boolean forTungsten; - - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.2.0", description = "Network offering details in key/value pairs." - + " Supported keys are internallbprovider/publiclbprovider with service provider as a value, and" - + " promiscuousmode/macaddresschanges/forgedtransmits with true/false as value to accept/reject the security settings if available for a nic/portgroup") - protected Map details; - - @Parameter(name = ApiConstants.EGRESS_DEFAULT_POLICY, - type = CommandType.BOOLEAN, - description = "true if guest network default egress policy is allow; false if default egress policy is deny") - private Boolean egressDefaultPolicy; - - @Parameter(name = ApiConstants.KEEPALIVE_ENABLED, - type = CommandType.BOOLEAN, - required = false, - description = "if true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.") - private Boolean keepAliveEnabled; - - @Parameter(name = ApiConstants.MAX_CONNECTIONS, - type = CommandType.INTEGER, - description = "maximum number of concurrent connections supported by the network offering") - private Integer maxConnections; - - @Parameter(name = ApiConstants.DOMAIN_ID, - type = CommandType.LIST, - collectionType = CommandType.UUID, - entityType = DomainResponse.class, - description = "the ID of the containing domain(s), null for public offerings") - private List domainIds; - - @Parameter(name = ApiConstants.ZONE_ID, - type = CommandType.LIST, - collectionType = CommandType.UUID, - entityType = ZoneResponse.class, - description = "the ID of the containing zone(s), null for public offerings", - since = "4.13") - private List zoneIds; - - @Parameter(name = ApiConstants.ENABLE, - type = CommandType.BOOLEAN, - description = "set to true if the offering is to be enabled during creation. Default is false", - since = "4.16") - private Boolean enable; - - @Parameter(name = ApiConstants.SPECIFY_AS_NUMBER, type = CommandType.BOOLEAN, since = "4.20.0", - description = "true if network offering supports choosing AS number") - private Boolean specifyAsNumber; - - @Parameter(name = ApiConstants.ROUTING_MODE, - type = CommandType.STRING, - since = "4.20.0", - description = "the routing mode for the network offering. Supported types are: Static or Dynamic.") - private String routingMode; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - public String getNetworkOfferingName() { - return networkOfferingName; - } - - public String getDisplayText() { - return StringUtils.isEmpty(displayText) ? networkOfferingName : displayText; - } - - public String getTags() { - return tags; - } - public String getTraffictype() { return traffictype; } - public Boolean getSpecifyVlan() { - return specifyVlan == null ? false : specifyVlan; - } - - public String getAvailability() { - return availability == null ? Availability.Optional.toString() : availability; - } - - public Integer getNetworkRate() { - return networkRate; - } - - public Long getServiceOfferingId() { - return serviceOfferingId; - } - - public List getSupportedServices() { - if (!isForNsx()) { - return supportedServices == null ? new ArrayList() : supportedServices; - } else { - List services = new ArrayList<>(List.of( - Dhcp.getName(), - Dns.getName(), - StaticNat.getName(), - SourceNat.getName(), - PortForwarding.getName(), - UserData.getName() - )); - if (getNsxSupportsLbService()) { - services.add(Lb.getName()); - } - if (Boolean.TRUE.equals(forVpc)) { - services.add(NetworkACL.getName()); - } else { - services.add(Firewall.getName()); - } - return services; - } - } - public String getGuestIpType() { return guestIptype; } - public String getInternetProtocol() { - return internetProtocol; - } - - public Boolean getSpecifyIpRanges() { - return specifyIpRanges == null ? false : specifyIpRanges; - } - - public Boolean getConserveMode() { - if (conserveMode == null) { - return true; - } - return conserveMode; - } - - public Boolean getIsPersistent() { - return isPersistent == null ? false : isPersistent; - } - - public Boolean getForVpc() { - return forVpc; - } - - public boolean isForNsx() { - return BooleanUtils.isTrue(forNsx); - } - - public String getNetworkMode() { - return networkMode; - } - - public boolean getNsxSupportsLbService() { - return BooleanUtils.isTrue(nsxSupportsLbService); - } - - public boolean getNsxSupportsInternalLbService() { - return BooleanUtils.isTrue(nsxSupportsInternalLbService); - } - - public Boolean getForTungsten() { - return forTungsten; - } - - public Boolean getEgressDefaultPolicy() { - if (egressDefaultPolicy == null) { - return true; - } - return egressDefaultPolicy; - } - - public Boolean getKeepAliveEnabled() { - return keepAliveEnabled; - } - - public Integer getMaxconnections() { - return maxConnections; - } - - public Map> getServiceProviders() { - Map> serviceProviderMap = new HashMap<>(); - if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) { - Collection servicesCollection = serviceProviderList.values(); - Iterator iter = servicesCollection.iterator(); - while (iter.hasNext()) { - HashMap services = (HashMap) iter.next(); - String service = services.get("service"); - String provider = services.get("provider"); - List providerList = null; - if (serviceProviderMap.containsKey(service)) { - providerList = serviceProviderMap.get(service); - } else { - providerList = new ArrayList(); - } - providerList.add(provider); - serviceProviderMap.put(service, providerList); - } - } else if (Boolean.TRUE.equals(forNsx)) { - getServiceProviderMapForNsx(serviceProviderMap); - } - return serviceProviderMap; - } - - private void getServiceProviderMapForNsx(Map> serviceProviderMap) { - String routerProvider = Boolean.TRUE.equals(getForVpc()) ? VirtualRouterProvider.Type.VPCVirtualRouter.name() : - VirtualRouterProvider.Type.VirtualRouter.name(); - List unsupportedServices = new ArrayList<>(List.of("Vpn", "SecurityGroup", "Connectivity", - "Gateway", "BaremetalPxeService")); - List routerSupported = List.of("Dhcp", "Dns", "UserData"); - List allServices = Service.listAllServices().stream().map(Service::getName).collect(Collectors.toList()); - if (routerProvider.equals(VirtualRouterProvider.Type.VPCVirtualRouter.name())) { - unsupportedServices.add("Firewall"); - } else { - unsupportedServices.add("NetworkACL"); - } - for (String service : allServices) { - if (unsupportedServices.contains(service)) - continue; - if (routerSupported.contains(service)) - serviceProviderMap.put(service, List.of(routerProvider)); - else - serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName())); - if (!getNsxSupportsLbService()) { - serviceProviderMap.remove(Lb.getName()); - } - } - } - - public Map getServiceCapabilities(Service service) { - Map capabilityMap = null; - - if (serviceCapabilitystList != null && !serviceCapabilitystList.isEmpty()) { - capabilityMap = new HashMap(); - Collection serviceCapabilityCollection = serviceCapabilitystList.values(); - Iterator iter = serviceCapabilityCollection.iterator(); - while (iter.hasNext()) { - HashMap svcCapabilityMap = (HashMap) iter.next(); - Capability capability = null; - String svc = svcCapabilityMap.get("service"); - String capabilityName = svcCapabilityMap.get("capabilitytype"); - String capabilityValue = svcCapabilityMap.get("capabilityvalue"); - - if (capabilityName != null) { - capability = Capability.getCapability(capabilityName); - } - - if ((capability == null) || (capabilityName == null) || (capabilityValue == null)) { - throw new InvalidParameterValueException("Invalid capability:" + capabilityName + " capability value:" + capabilityValue); - } - - if (svc.equalsIgnoreCase(service.getName())) { - capabilityMap.put(capability, capabilityValue); - } else { - //throw new InvalidParameterValueException("Service is not equal ") - } - } - } - - return capabilityMap; - } - - public Map getDetails() { - if (details == null || details.isEmpty()) { - return null; - } - - Collection paramsCollection = details.values(); - Object objlist[] = paramsCollection.toArray(); - Map params = (Map) (objlist[0]); - for (int i = 1; i < objlist.length; i++) { - params.putAll((Map) (objlist[i])); - } - - return params; - } - - public String getServicePackageId() { - Map data = getDetails(); - if (data == null) - return null; - return data.get(NetworkOffering.Detail.servicepackageuuid + ""); - } - - public List getDomainIds() { - if (CollectionUtils.isNotEmpty(domainIds)) { - Set set = new LinkedHashSet<>(domainIds); - domainIds.clear(); - domainIds.addAll(set); - } - return domainIds; - } - - public List getZoneIds() { - if (CollectionUtils.isNotEmpty(zoneIds)) { - Set set = new LinkedHashSet<>(zoneIds); - zoneIds.clear(); - zoneIds.addAll(set); - } - return zoneIds; - } - - public Boolean getEnable() { - if (enable != null) { - return enable; - } - return false; - } - - public boolean getSpecifyAsNumber() { - return BooleanUtils.toBoolean(specifyAsNumber); - } - - public String getRoutingMode() { - return routingMode; - } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @Override - public long getEntityOwnerId() { - return Account.ACCOUNT_ID_SYSTEM; - } @Override public void execute() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java index 7eb52b92456c..097b8a5b5458 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java @@ -36,7 +36,7 @@ import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; -@APICommand(name = "createPhysicalNetwork", description = "Creates a physical network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0", +@APICommand(name = "createPhysicalNetwork", description = "Creates a physical Network", responseObject = PhysicalNetworkResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { @@ -49,36 +49,36 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "the Zone ID for the physical network") + description = "The Zone ID for the physical Network") private Long zoneId; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the VLAN for the physical network") + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The VLAN for the physical Network") private String vlan; - @Parameter(name = ApiConstants.NETWORK_SPEED, type = CommandType.STRING, description = "the speed for the physical network[1G/10G]") + @Parameter(name = ApiConstants.NETWORK_SPEED, type = CommandType.STRING, description = "The speed for the physical Network[1G/10G]") private String speed; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "domain ID of the account owning a physical network") + description = "Domain ID of the Account owning a physical Network") private Long domainId; @Parameter(name = ApiConstants.BROADCAST_DOMAIN_RANGE, type = CommandType.STRING, - description = "the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic") + description = "The broadcast domain range for the physical Network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic") private String broadcastDomainRange; - @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "Tag the physical network") + @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "Tag the physical Network") private List tags; @Parameter(name = ApiConstants.ISOLATION_METHODS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "the isolation method for the physical network[VLAN/L3/GRE]") + description = "The isolation method for the physical Network[VLAN/VXLAN/GRE/STT/BCF_SEGMENT/SSP/ODL/L3VPN/VCS/NSX/NETRIS]") private List isolationMethods; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the physical network") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the physical Network") private String networkName; ///////////////////////////////////////////////////// @@ -139,7 +139,7 @@ public String getCreateEventDescription() { @Override public String getEventDescription() { - return "creating Physical Network. Id: " + getEntityId(); + return "Creating Physical Network. ID: " + getEntityId(); } ///////////////////////////////////////////////////// @@ -148,14 +148,14 @@ public String getEventDescription() { @Override public void execute() { - CallContext.current().setEventDetails("Physical Network Id: " + getEntityId()); + CallContext.current().setEventDetails("Physical Network ID: " + getEntityUuid()); PhysicalNetwork result = _networkService.getCreatedPhysicalNetwork(getEntityId()); if (result != null) { PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical Network"); } } @@ -168,7 +168,7 @@ public void create() throws ResourceAllocationException { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network entity"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical Network entity"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java index 42262cc2bf15..439edcbf8f99 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java @@ -50,24 +50,24 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = PodResponse.class, required = true, - description = "UUID of pod where the ip range belongs to") + description = "ID of pod where the IP range belongs to") private Long podId; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, required = true, description = "the beginning IP address") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, required = true, description = "The starting IP address") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address") private String endIp; @Parameter(name = ApiConstants.VLAN, type = CommandType.INTEGER, - description = "Optional. The vlan the ip range sits on, default to Null when it is not specified which means your network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly retrieve bridge from physical network traffic type table") + description = "Optional. The VLAN the IP range sits on, default to Null when it is not specified which means your network is not on any VLAN. This is mainly for VMware as other hypervisors can directly retrieve bridge from physical network traffic type table") private Integer vlan; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "the netmask for storage network") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "The netmask for storage network") private String netmask; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "the gateway for storage network") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "The gateway for storage network") private String gateway; ///////////////////////////////////////////////////// @@ -105,7 +105,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating storage ip range from " + getStartIp() + " to " + getEndIp() + " with vlan " + getVlan(); + return "Creating storage IP range from " + getStartIp() + " to " + getEndIp() + " with VLAN " + getVlan(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java index 355f738679e0..dcc1fa51dcee 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateGuestVlanRangeCmd.java @@ -44,23 +44,23 @@ public class DedicateGuestVlanRangeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.VLAN_RANGE, type = CommandType.STRING, required = true, description = "guest vlan range to be dedicated") + @Parameter(name = ApiConstants.VLAN_RANGE, type = CommandType.STRING, required = true, description = "Guest VLAN range to be dedicated") private String vlan; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account who will own the VLAN") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account who will own the VLAN") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "project who will own the VLAN") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Project who will own the VLAN") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a VLAN") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the Account owning a VLAN") private Long domainId; @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, - description = "physical network ID of the vlan") + description = "Physical Network ID of the VLAN") private Long physicalNetworkId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmd.java index 2df032c559c5..cc76b284e24a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmd.java @@ -82,7 +82,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Dedicating zone IPv4 subnet " + getId(); + return "Dedicating zone's IPv4 subnet with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteGuestNetworkIpv6PrefixCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteGuestNetworkIpv6PrefixCmd.java index e2ada4191a82..405bbb594edb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteGuestNetworkIpv6PrefixCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteGuestNetworkIpv6PrefixCmd.java @@ -63,7 +63,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting guest IPv6 prefix " + getId(); + return "Deleting guest IPv6 prefix with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmd.java index 28a646f9d036..f6b22f79dfc7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmd.java @@ -59,7 +59,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting guest IPv4 subnet " + getId(); + return "Deleting guest IPv4 subnet with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmd.java index 222bc1bad98d..0ff2a9ad70b8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmd.java @@ -59,7 +59,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting zone IPv4 subnet " + getId(); + return "Deleting zone IPv4 subnet with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java index 41cf5e518b34..1e69aaa6c440 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteManagementNetworkIpRangeCmd.java @@ -100,7 +100,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting management ip range from " + getStartIp() + " to " + getEndIp() + " of Pod: " + getPodId(); + return "Deleting management IP range from " + getStartIp() + " to " + getEndIp() + " from Pod: " + getResourceUuid(ApiConstants.POD_ID); } @Override @@ -116,7 +116,7 @@ public void execute() { logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (Exception e) { - logger.warn("Failed to delete management ip range from " + getStartIp() + " to " + getEndIp() + " of Pod: " + getPodId(), e); + logger.warn("Failed to delete management ip range from {} to {} of Pod: {}", getStartIp(), getEndIp(), getPodId(), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java index e0598b71ea17..a24fc0dc3714 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java @@ -40,7 +40,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd { type = CommandType.UUID, entityType = NetworkOfferingResponse.class, required = true, - description = "the ID of the network offering") + description = "The ID of the network offering") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java index 4b56612fddaa..2573e92b9860 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java @@ -45,7 +45,7 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = ProviderResponse.class, required = true, - description = "the ID of the network service provider") + description = "The ID of the network service provider") private Long id; ///////////////////////////////////////////////////// @@ -91,7 +91,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting Physical network ServiceProvider: " + getId(); + return "Deleting Physical network ServiceProvider with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java index 3233130211c4..9994e8e391d7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java @@ -43,7 +43,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, - description = "the ID of the Physical network") + description = "The ID of the Physical network") private Long id; ///////////////////////////////////////////////////// @@ -65,7 +65,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Physical Network Id: " + id); + CallContext.current().setEventDetails("Physical Network Id: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkService.deletePhysicalNetwork(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -77,7 +77,7 @@ public void execute() { @Override public String getEventDescription() { - return "Deleting Physical network: " + getId(); + return "Deleting Physical network with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java index 454dfba92f20..dcab38561408 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java @@ -46,7 +46,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = StorageNetworkIpRangeResponse.class, required = true, - description = "the uuid of the storage network ip range") + description = "The UUID of the storage network IP range") private Long id; ///////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting storage ip range " + getId(); + return "Deleting storage IP range with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -75,7 +75,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } catch (Exception e) { - logger.warn("Failed to delete storage network ip range " + getId(), e); + logger.warn("Failed to delete storage network ip range {}", getId(), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java index 0247a3069212..a5edbfdce4a9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListDedicatedGuestVlanRangesCmd.java @@ -44,33 +44,33 @@ public class ListDedicatedGuestVlanRangesCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestVlanRangeResponse.class, description = "list dedicated guest vlan ranges by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestVlanRangeResponse.class, description = "List dedicated guest VLAN ranges by ID") private Long id; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account with which the guest VLAN range is associated. Must be used with the domainId parameter.") + description = "The account with which the guest VLAN range is associated. Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "project who will own the guest VLAN range") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Project who will own the guest VLAN range") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID with which the guest VLAN range is associated. If used with the account parameter, returns all guest VLAN ranges for that account in the specified domain.") + description = "The domain ID with which the guest VLAN range is associated. If used with the account parameter, returns all guest VLAN ranges for that account in the specified domain.") private Long domainId; - @Parameter(name = ApiConstants.GUEST_VLAN_RANGE, type = CommandType.STRING, description = "the dedicated guest vlan range") + @Parameter(name = ApiConstants.GUEST_VLAN_RANGE, type = CommandType.STRING, description = "The dedicated guest vlan range") private String guestVlanRange; @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "physical network id of the guest VLAN range") + description = "Physical network ID of the guest VLAN range") private Long physicalNetworkId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "zone of the guest VLAN range") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Zone of the guest VLAN range") private Long zoneId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListGuestVlansCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListGuestVlansCmd.java index 4b368f5e0341..80c9540a8486 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListGuestVlansCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListGuestVlansCmd.java @@ -44,19 +44,19 @@ public class ListGuestVlansCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = false, description = "list guest vlan by id") + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = false, description = "List guest VLAN by ID") private Long id; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = false, description = "list guest vlan by zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = false, description = "List guest VLAN by zone") private Long zoneId; - @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = false, description = "list guest vlan by physical network") + @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = false, description = "List guest VLAN by physical network") private Long physicalNetworkId; - @Parameter(name = ApiConstants.VNET, type = CommandType.STRING, required = false, description = "list guest vlan by vnet") + @Parameter(name = ApiConstants.VNET, type = CommandType.STRING, required = false, description = "List guest VLAN by vnet") private String vnet; - @Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, required = false, description = "limits search results to allocated guest vlan. false by default.") + @Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, required = false, description = "Limits search results to allocated guest VLAN. False by default.") private Boolean allocatedOnly; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java index 768bab641087..ace635376eb4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java @@ -57,7 +57,7 @@ public class ListNetworkDeviceCmd extends BaseListCmd { description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall, PaloAltoFirewall") private String type; - @Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "parameters for network device") + @Parameter(name = ApiConstants.NETWORK_DEVICE_PARAMETER_LIST, type = CommandType.MAP, description = "Parameters for network device") private Map paramList; public String getDeviceType() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java index 68495a62215f..95071e41f6c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java @@ -44,13 +44,13 @@ public class ListNetworkServiceProvidersCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the Physical Network ID") + @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "The Physical Network ID") private Long physicalNetworkId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list providers by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List providers by name") private String name; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list providers by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List providers by state") private String state; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java index 8df1133d5e7c..bb564f1c3ded 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListNetworksCmdByAdmin.java @@ -30,7 +30,7 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworksCmdByAdmin extends ListNetworksCmd implements AdminCmd { - @Parameter(name= ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the network", since = "4.17.0") + @Parameter(name= ApiConstants.VLAN, type=CommandType.STRING, description = "The ID or VID of the network", since = "4.17.0") private String vlan; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java index 51a6ddabd9f1..27319ff3d671 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java @@ -43,13 +43,13 @@ public class ListPhysicalNetworksCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "list physical network by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "List physical network by id") private Long id; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the physical network") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the physical network") private Long zoneId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "search by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Search by name") private String networkName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java index 556162ca360d..3e32bed3d500 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java @@ -51,19 +51,19 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StorageNetworkIpRangeResponse.class, - description = "optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.") + description = "Optional parameter. Storage network IP range UUID, if specified, using it to search the range.") private Long rangeId; @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, - description = "optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.") + description = "Optional parameter. Pod UUID, if specified and range UUID is absent, using it to search the range.") private Long podId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.") + description = "Optional parameter. Zone UUID, if specified and both pod UUID and range UUID are absent, using it to search the range.") private Long zoneId; ///////////////////////////////////////////////////// @@ -97,7 +97,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (Exception e) { - logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId()); + logger.warn("Failed to list storage Network IP range for rangeId={} podId={} zoneId={}", getRangeId(), getPodId(), getZoneId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java index 120c6af41ad6..227e9b684526 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java @@ -40,10 +40,10 @@ responseHasSensitiveInfo = false) public class ListSupportedNetworkServicesCmd extends BaseListCmd { - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "network service provider name") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "Network service provider name") private String providerName; - @Parameter(name = ApiConstants.SERVICE, type = CommandType.STRING, description = "network service name to list providers and capabilities of") + @Parameter(name = ApiConstants.SERVICE, type = CommandType.STRING, description = "Network service name to list providers and capabilities of") private String serviceName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java index 8ef853b99da8..ad78bd3b406c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java @@ -38,7 +38,7 @@ import com.cloud.user.Account; import com.cloud.user.User; -@APICommand(name = "migrateNetwork", description = "moves a network to another physical network", +@APICommand(name = "migrateNetwork", description = "Moves a network to another physical network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class}, @@ -53,13 +53,13 @@ public class MigrateNetworkCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The ID of the network") protected Long id; - @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, required = true, description = "network offering ID") + @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, required = true, description = "Network offering ID") private Long networkOfferingId; - @Parameter(name = ApiConstants.RESUME, type = CommandType.BOOLEAN, description = "true if previous network migration cmd failed") + @Parameter(name = ApiConstants.RESUME, type = CommandType.BOOLEAN, description = "True if previous network migration cmd failed") private Boolean resume; ///////////////////////////////////////////////////// @@ -115,7 +115,7 @@ public void execute() { @Override public String getEventDescription() { - StringBuilder eventMsg = new StringBuilder("Migrating network: " + getId()); + String description = "Migrating Network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID); if (getNetworkOfferingId() != null) { Network network = _networkService.getNetwork(getId()); if (network == null) { @@ -128,11 +128,11 @@ public String getEventDescription() { throw new InvalidParameterValueException("Network offering id supplied is invalid"); } - eventMsg.append(". Original network offering id: " + oldOff.getUuid() + ", new network offering id: " + newOff.getUuid()); + description += ". Original Network Offering id: " + oldOff.getUuid() + ", new Network Offering id: " + newOff.getUuid(); } } - return eventMsg.toString(); + return description; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java index 3e0801be40b1..2973fea33c6a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java @@ -40,7 +40,7 @@ import com.cloud.user.User; @APICommand(name = "migrateVPC", - description = "moves a vpc to another physical network", + description = "Moves a VPC to another physical network", responseObject = VpcResponse.class, responseView = ResponseObject.ResponseView.Restricted, entityType = {Vpc.class}, @@ -56,16 +56,16 @@ public class MigrateVPCCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @ACL(accessType = SecurityChecker.AccessType.OperateEntry) @Parameter(name= ApiConstants.VPC_ID, type=CommandType.UUID, entityType = VpcResponse.class, - required=true, description = "the ID of the vpc") + required=true, description = "The ID of the VPC ") protected Long id; - @Parameter(name = ApiConstants.VPC_OFF_ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required=true, description = "vpc offering ID") + @Parameter(name = ApiConstants.VPC_OFF_ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required=true, description = "VPC offering ID") private Long vpcOfferingId; - @Parameter(name = ApiConstants.TIER_NETWORK_OFFERINGS, type = CommandType.MAP, description = "network offering ids for each network in the vpc. Example: tierNetworkOfferings[0].networkId=networkId1&tierNetworkOfferings[0].networkOfferingId=newNetworkofferingId1&tierNetworkOfferings[1].networkId=networkId2&tierNetworkOfferings[1].networkOfferingId=newNetworkofferingId2") + @Parameter(name = ApiConstants.TIER_NETWORK_OFFERINGS, type = CommandType.MAP, description = "Network offering IDs for each network in the VPC. Example: tierNetworkOfferings[0].networkId=networkId1&tierNetworkOfferings[0].networkOfferingId=newNetworkofferingId1&tierNetworkOfferings[1].networkId=networkId2&tierNetworkOfferings[1].networkOfferingId=newNetworkofferingId2") private Map> tierNetworkOfferings; - @Parameter(name = ApiConstants.RESUME, type = CommandType.BOOLEAN, description = "true if previous network migration cmd failed") + @Parameter(name = ApiConstants.RESUME, type = CommandType.BOOLEAN, description = "True if previous network migration cmd failed") private Boolean resume; ///////////////////////////////////////////////////// @@ -115,12 +115,12 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vpc"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate VPC"); } } @Override - public String getEventDescription() { return "Migrating vpc: " + getId() + " to new vpc offering (" + vpcOfferingId + ")"; } + public String getEventDescription() { return "Migrating VPC with ID: " + getResourceUuid(ApiConstants.VPC_ID) + " to new VPC offering with ID: " + getResourceUuid(ApiConstants.VPC_OFF_ID);} @Override public String getEventType() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java new file mode 100644 index 000000000000..1c832b7217ef --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java @@ -0,0 +1,493 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.network; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.network.Network; +import com.cloud.network.VirtualRouterProvider; +import com.cloud.offering.NetworkOffering; +import com.cloud.user.Account; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.cloud.network.Network.Service.Dhcp; +import static com.cloud.network.Network.Service.Dns; +import static com.cloud.network.Network.Service.Firewall; +import static com.cloud.network.Network.Service.Lb; +import static com.cloud.network.Network.Service.NetworkACL; +import static com.cloud.network.Network.Service.PortForwarding; +import static com.cloud.network.Network.Service.SourceNat; +import static com.cloud.network.Network.Service.StaticNat; +import static com.cloud.network.Network.Service.UserData; + +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNsxWithoutLb; +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNetrisNatted; +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNetrisRouted; + +public abstract class NetworkOfferingBaseCmd extends BaseCmd { + + public abstract String getGuestIpType(); + public abstract String getTraffictype(); + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the network offering") + private String networkOfferingName; + + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the network offering, defaults to the value of 'name'.") + private String displayText; + + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "The tags for the network offering.", length = 4096) + private String tags; + + @Parameter(name = ApiConstants.SPECIFY_VLAN, type = CommandType.BOOLEAN, description = "True if network offering supports VLANs") + private Boolean specifyVlan; + + @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "The availability of network offering. The default value is Optional. " + + " Another value is Required, which will make it as the default network offering for new networks ") + private String availability; + + @Parameter(name = ApiConstants.NETWORKRATE, type = CommandType.INTEGER, description = "Data transfer rate in megabits per second allowed") + private Integer networkRate; + + @Parameter(name = ApiConstants.CONSERVE_MODE, type = CommandType.BOOLEAN, description = "True if the network offering is IP conserve mode enabled") + private Boolean conserveMode; + + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, + type = CommandType.UUID, + entityType = ServiceOfferingResponse.class, + description = "The service offering ID used by virtual router provider") + private Long serviceOfferingId; + + @Parameter(name = ApiConstants.INTERNET_PROTOCOL, + type = CommandType.STRING, + description = "The internet protocol of network offering. Options are IPv4 and dualstack. Default is IPv4. dualstack will create a network offering that supports both IPv4 and IPv6", + since = "4.17.0") + private String internetProtocol; + + @Parameter(name = ApiConstants.SUPPORTED_SERVICES, + type = CommandType.LIST, + collectionType = CommandType.STRING, + description = "Services supported by the network offering") + private List supportedServices; + + @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, + type = CommandType.MAP, + description = "Provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network") + private Map serviceProviderList; + + @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "Desired service capabilities as part of network offering") + private Map serviceCapabilitiesList; + + @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, + type = CommandType.BOOLEAN, + description = "True if network offering supports specifying ip ranges; defaulted to false if not specified") + private Boolean specifyIpRanges; + + @Parameter(name = ApiConstants.IS_PERSISTENT, + type = CommandType.BOOLEAN, + description = "True if network offering supports persistent networks; defaulted to false if not specified") + private Boolean isPersistent; + + @Parameter(name = ApiConstants.FOR_VPC, + type = CommandType.BOOLEAN, + description = "True if network offering is meant to be used for VPC, false otherwise.") + private Boolean forVpc; + + @Deprecated + @Parameter(name = ApiConstants.FOR_NSX, + type = CommandType.BOOLEAN, + description = "true if network offering is meant to be used for NSX, false otherwise.", + since = "4.20.0") + private Boolean forNsx; + + @Parameter(name = ApiConstants.PROVIDER, + type = CommandType.STRING, + description = "Name of the provider providing the service", + since = "4.21.0") + private String provider; + + @Parameter(name = ApiConstants.NSX_SUPPORT_LB, + type = CommandType.BOOLEAN, + description = "True if network offering for NSX network offering supports Load balancer service.", + since = "4.20.0") + private Boolean nsxSupportsLbService; + + @Parameter(name = ApiConstants.NSX_SUPPORTS_INTERNAL_LB, + type = CommandType.BOOLEAN, + description = "True if network offering for NSX network offering supports Internal Load balancer service.", + since = "4.20.0") + private Boolean nsxSupportsInternalLbService; + + @Parameter(name = ApiConstants.NETWORK_MODE, + type = CommandType.STRING, + description = "Indicates the mode with which the network will operate. Valid option: NATTED or ROUTED", + since = "4.20.0") + private String networkMode; + + @Parameter(name = ApiConstants.FOR_TUNGSTEN, + type = CommandType.BOOLEAN, + description = "True if network offering is meant to be used for Tungsten-Fabric, false otherwise.") + private Boolean forTungsten; + + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.2.0", description = "Network offering details in key/value pairs." + + " Supported keys are internallbprovider/publiclbprovider with service provider as a value, and" + + " promiscuousmode/macaddresschanges/forgedtransmits with true/false as value to accept/reject the security settings if available for a nic/portgroup") + protected Map details; + + @Parameter(name = ApiConstants.EGRESS_DEFAULT_POLICY, + type = CommandType.BOOLEAN, + description = "True if guest network default egress policy is allow; false if default egress policy is deny") + private Boolean egressDefaultPolicy; + + @Parameter(name = ApiConstants.KEEPALIVE_ENABLED, + type = CommandType.BOOLEAN, + required = false, + description = "If true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.") + private Boolean keepAliveEnabled; + + @Parameter(name = ApiConstants.MAX_CONNECTIONS, + type = CommandType.INTEGER, + description = "Maximum number of concurrent connections supported by the Network offering") + private Integer maxConnections; + + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.LIST, + collectionType = CommandType.UUID, + entityType = DomainResponse.class, + description = "The ID of the containing domain(s), null for public offerings") + private List domainIds; + + @Parameter(name = ApiConstants.ZONE_ID, + type = CommandType.LIST, + collectionType = CommandType.UUID, + entityType = ZoneResponse.class, + description = "The ID of the containing zone(s), null for public offerings", + since = "4.13") + private List zoneIds; + + @Parameter(name = ApiConstants.ENABLE, + type = CommandType.BOOLEAN, + description = "Set to true if the offering is to be enabled during creation. Default is false", + since = "4.16") + private Boolean enable; + + @Parameter(name = ApiConstants.SPECIFY_AS_NUMBER, type = CommandType.BOOLEAN, since = "4.20.0", + description = "true if network offering supports choosing AS number") + private Boolean specifyAsNumber; + + @Parameter(name = ApiConstants.ROUTING_MODE, + type = CommandType.STRING, + since = "4.20.0", + description = "the routing mode for the network offering. Supported types are: Static or Dynamic.") + private String routingMode; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getNetworkOfferingName() { + return networkOfferingName; + } + + public String getDisplayText() { + return StringUtils.isEmpty(displayText) ? networkOfferingName : displayText; + } + + public String getTags() { + return tags; + } + + public Boolean getSpecifyVlan() { + return specifyVlan == null ? false : specifyVlan; + } + + public String getAvailability() { + return availability == null ? NetworkOffering.Availability.Optional.toString() : availability; + } + + public Integer getNetworkRate() { + return networkRate; + } + + public Long getServiceOfferingId() { + return serviceOfferingId; + } + + public boolean isExternalNetworkProvider() { + return Arrays.asList("NSX", "Netris").stream() + .anyMatch(s -> provider != null && s.equalsIgnoreCase(provider)); + } + + public boolean isForNsx() { + return provider != null && provider.equalsIgnoreCase("NSX"); + } + + public boolean isForNetris() { + return provider != null && provider.equalsIgnoreCase("Netris"); + } + + public String getProvider() { + return provider; + } + + public List getSupportedServices() { + if (!isExternalNetworkProvider()) { + return supportedServices == null ? new ArrayList() : supportedServices; + } else { + List services = new ArrayList<>(List.of( + Dhcp.getName(), + Dns.getName(), + UserData.getName() + )); + if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) { + services.addAll(Arrays.asList( + StaticNat.getName(), + SourceNat.getName(), + PortForwarding.getName())); + } + if (getNsxSupportsLbService() || (provider != null && isNetrisNatted(getProvider(), getNetworkMode()))) { + services.add(Lb.getName()); + } + if (Boolean.TRUE.equals(forVpc)) { + services.add(NetworkACL.getName()); + } else { + services.add(Firewall.getName()); + } + return services; + } + } + + public String getInternetProtocol() { + return internetProtocol; + } + + public Boolean getSpecifyIpRanges() { + return specifyIpRanges == null ? false : specifyIpRanges; + } + + public Boolean getConserveMode() { + if (conserveMode == null) { + return true; + } + return conserveMode; + } + + public Boolean getIsPersistent() { + return isPersistent == null ? false : isPersistent; + } + + public Boolean getForVpc() { + return forVpc; + } + + public String getNetworkMode() { + return networkMode; + } + + public boolean getNsxSupportsLbService() { + return BooleanUtils.isTrue(nsxSupportsLbService); + } + + public boolean getNsxSupportsInternalLbService() { + return BooleanUtils.isTrue(nsxSupportsInternalLbService); + } + + public Boolean getForTungsten() { + return forTungsten; + } + + public Boolean getEgressDefaultPolicy() { + if (egressDefaultPolicy == null) { + return true; + } + return egressDefaultPolicy; + } + + public Boolean getKeepAliveEnabled() { + return keepAliveEnabled; + } + + public Integer getMaxconnections() { + return maxConnections; + } + + public Map> getServiceProviders() { + Map> serviceProviderMap = new HashMap<>(); + if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) { + Collection servicesCollection = serviceProviderList.values(); + Iterator iter = servicesCollection.iterator(); + while (iter.hasNext()) { + HashMap services = (HashMap) iter.next(); + String service = services.get("service"); + String provider = services.get("provider"); + List providerList = null; + if (serviceProviderMap.containsKey(service)) { + providerList = serviceProviderMap.get(service); + } else { + providerList = new ArrayList(); + } + providerList.add(provider); + serviceProviderMap.put(service, providerList); + } + } else if (isExternalNetworkProvider()) { + getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName()); + } + return serviceProviderMap; + } + + private void getServiceProviderMapForExternalProvider(Map> serviceProviderMap, String provider) { + String routerProvider = Boolean.TRUE.equals(getForVpc()) ? VirtualRouterProvider.Type.VPCVirtualRouter.name() : + VirtualRouterProvider.Type.VirtualRouter.name(); + List unsupportedServices = new ArrayList<>(List.of("Vpn", "Gateway", "SecurityGroup", "Connectivity", "BaremetalPxeService")); + List routerSupported = List.of("Dhcp", "Dns", "UserData"); + List allServices = Network.Service.listAllServices().stream().map(Network.Service::getName).collect(Collectors.toList()); + if (routerProvider.equals(VirtualRouterProvider.Type.VPCVirtualRouter.name())) { + unsupportedServices.add("Firewall"); + } else { + unsupportedServices.add("NetworkACL"); + } + for (String service : allServices) { + if (unsupportedServices.contains(service)) + continue; + if (routerSupported.contains(service)) + serviceProviderMap.put(service, List.of(routerProvider)); + else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) || NetworkACL.getName().equalsIgnoreCase(service)) { + serviceProviderMap.put(service, List.of(provider)); + } + if (isNsxWithoutLb(getProvider(), getNsxSupportsLbService()) || isNetrisRouted(getProvider(), getNetworkMode())) { + serviceProviderMap.remove(Lb.getName()); + } + } + } + + public Map getServiceCapabilities(Network.Service service) { + Map capabilityMap = null; + + if (serviceCapabilitiesList != null && !serviceCapabilitiesList.isEmpty()) { + capabilityMap = new HashMap(); + Collection serviceCapabilityCollection = serviceCapabilitiesList.values(); + Iterator iter = serviceCapabilityCollection.iterator(); + while (iter.hasNext()) { + HashMap svcCapabilityMap = (HashMap) iter.next(); + Network.Capability capability = null; + String svc = svcCapabilityMap.get("service"); + String capabilityName = svcCapabilityMap.get("capabilitytype"); + String capabilityValue = svcCapabilityMap.get("capabilityvalue"); + + if (capabilityName != null) { + capability = Network.Capability.getCapability(capabilityName); + } + + if ((capability == null) || (capabilityName == null) || (capabilityValue == null)) { + throw new InvalidParameterValueException("Invalid capability:" + capabilityName + " capability value:" + capabilityValue); + } + + if (svc.equalsIgnoreCase(service.getName())) { + capabilityMap.put(capability, capabilityValue); + } else { + //throw new InvalidParameterValueException("Service is not equal ") + } + } + } + + return capabilityMap; + } + + public Map getDetails() { + if (details == null || details.isEmpty()) { + return null; + } + + Collection paramsCollection = details.values(); + Object objlist[] = paramsCollection.toArray(); + Map params = (Map) (objlist[0]); + for (int i = 1; i < objlist.length; i++) { + params.putAll((Map) (objlist[i])); + } + + return params; + } + + public String getServicePackageId() { + Map data = getDetails(); + if (data == null) + return null; + return data.get(NetworkOffering.Detail.servicepackageuuid + ""); + } + + public List getDomainIds() { + if (CollectionUtils.isNotEmpty(domainIds)) { + Set set = new LinkedHashSet<>(domainIds); + domainIds.clear(); + domainIds.addAll(set); + } + return domainIds; + } + + public List getZoneIds() { + if (CollectionUtils.isNotEmpty(zoneIds)) { + Set set = new LinkedHashSet<>(zoneIds); + zoneIds.clear(); + zoneIds.addAll(set); + } + return zoneIds; + } + + public Boolean getEnable() { + if (enable != null) { + return enable; + } + return false; + } + + public boolean getSpecifyAsNumber() { + return BooleanUtils.toBoolean(specifyAsNumber); + } + + public String getRoutingMode() { + return routingMode; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java index b3125ec36680..56d042719f68 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedGuestVlanRangeCmd.java @@ -44,7 +44,7 @@ public class ReleaseDedicatedGuestVlanRangeCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = GuestVlanRangeResponse.class, required = true, - description = "the ID of the dedicated guest vlan range") + description = "The ID of the dedicated guest VLAN range") private Long id; // /////////////////////////////////////////////////// @@ -72,7 +72,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Releasing a dedicated guest vlan range."; + return "Releasing dedicated guest VLAN range with ID: " + getResourceUuid(ApiConstants.ID); } // /////////////////////////////////////////////////// @@ -81,7 +81,7 @@ public String getEventDescription() { @Override public void execute() { - CallContext.current().setEventDetails("Dedicated guest vlan range Id: " + id); + CallContext.current().setEventDetails("Dedicated guest VLAN range ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkService.releaseDedicatedGuestVlanRange(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmd.java index 3e151b9b58f4..a5e763c0cb00 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmd.java @@ -59,7 +59,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Releasing a dedicated zone IPv4 subnet " + getId(); + return "Releasing dedicated zone IPv4 subnet with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmd.java index da7a23f50d9c..db5daa505bee 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmd.java @@ -69,7 +69,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating zone IPv4 subnet " + getId(); + return "Updating zone IPv4 subnet with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java index b3088a48840e..5879a998b36e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java @@ -29,7 +29,7 @@ @APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkCmdByAdmin extends UpdateNetworkCmd implements AdminCmd { - @Parameter(name= ApiConstants.HIDE_IP_ADDRESS_USAGE, type=CommandType.BOOLEAN, description="when true ip address usage for the network will not be exported by the listUsageRecords API") + @Parameter(name= ApiConstants.HIDE_IP_ADDRESS_USAGE, type=CommandType.BOOLEAN, description = "When true IP address usage for the Network will not be exported by the listUsageRecords API") private Boolean hideIpAddressUsage; public Boolean getHideIpAddressUsage() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java index 75fb45e1f115..df9f6ad0664d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java @@ -16,7 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; @@ -26,64 +25,63 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; import org.apache.cloudstack.api.response.NetworkOfferingResponse; -import org.apache.commons.lang3.StringUtils; -import com.cloud.dc.DataCenter; -import com.cloud.domain.Domain; -import com.cloud.exception.InvalidParameterValueException; + import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; @APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class UpdateNetworkOfferingCmd extends BaseCmd { +public class UpdateNetworkOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "the id of the network offering") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "The ID of the network offering") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the network offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the network offering") private String networkOfferingName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the network offering") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the network offering") private String displayText; - @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "the availability of network offering." + @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "The availability of network offering." + " The value is Required makes this network offering default for Guest Virtual Networks. Only one network offering can have the value Required ") private String availability; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the network offering, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the network offering, integer") private Integer sortKey; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "update state for the network offering") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Update state for the network offering") private String state; @Parameter(name = ApiConstants.KEEPALIVE_ENABLED, type = CommandType.BOOLEAN, required = false, - description = "if true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.") + description = "If true keepalive will be turned on in the loadbalancer. At the time of writing this has only an effect on haproxy; the mode http and httpclose options are unset in the haproxy conf file.") private Boolean keepAliveEnabled; @Parameter(name = ApiConstants.MAX_CONNECTIONS, type = CommandType.INTEGER, - description = "maximum number of concurrent connections supported by the network offering") + description = "Maximum number of concurrent connections supported by the network offering") private Integer maxConnections; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the network offering.", length = 4096) + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "The tags for the network offering.", length = 4096) private String tags; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.STRING, - description = "the ID of the containing domain(s) as comma separated string, public for public offerings") + length = 4096, + description = "The ID of the containing domain(s) as comma separated string, public for public offerings") private String domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, - description = "the ID of the containing zone(s) as comma separated string, all for all zones offerings", + description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings", since = "4.13", length = 4096) private String zoneIds; @@ -129,63 +127,11 @@ public String getTags() { } public List getDomainIds() { - List validDomainIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(domainIds)) { - if (domainIds.contains(",")) { - String[] domains = domainIds.split(","); - for (String domain : domains) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create network offering because invalid domain has been specified."); - } - } - } else { - domainIds = domainIds.trim(); - if (!domainIds.matches("public")) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create network offering because invalid domain has been specified."); - } - } - } - } else { - validDomainIds.addAll(_configService.getNetworkOfferingDomains(id)); - } - return validDomainIds; + return resolveDomainIds(domainIds, id, _configService::getNetworkOfferingDomains, "network offering"); } public List getZoneIds() { - List validZoneIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(zoneIds)) { - if (zoneIds.contains(",")) { - String[] zones = zoneIds.split(","); - for (String zone : zones) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create network offering because invalid zone has been specified."); - } - } - } else { - zoneIds = zoneIds.trim(); - if (!zoneIds.matches("all")) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create network offering because invalid zone has been specified."); - } - } - } - } else { - validZoneIds.addAll(_configService.getNetworkOfferingZones(id)); - } - return validZoneIds; + return resolveZoneIds(zoneIds, id, _configService::getNetworkOfferingZones, "network offering"); } ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java index b4801d9368eb..e0ce0aade1ee 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java @@ -47,13 +47,13 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Enabled/Disabled/Shutdown the physical network service provider") private String state; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProviderResponse.class, required = true, description = "network service provider id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProviderResponse.class, required = true, description = "Network service provider ID") private Long id; @Parameter(name = ApiConstants.SERVICE_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "the list of services to be enabled for this physical network service provider") + description = "The list of services to be enabled for this physical network service provider") private List enabledServices; ///////////////////////////////////////////////////// @@ -100,7 +100,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating physical network ServiceProvider: " + getId(); + return "Updating Physical Network ServiceProvider with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java index 162116470bd5..6a6264e418ce 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java @@ -38,19 +38,19 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, description = "physical network id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, description = "Physical Network ID") private Long id; - @Parameter(name = ApiConstants.NETWORK_SPEED, type = CommandType.STRING, description = "the speed for the physical network[1G/10G]") + @Parameter(name = ApiConstants.NETWORK_SPEED, type = CommandType.STRING, description = "The speed for the physical Network[1G/10G]") private String speed; - @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "Tag the physical network") + @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "Tag the physical Network") private List tags; @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Enabled/Disabled") private String state; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the VLAN for the physical network") + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The VLAN for the physical Network") private String vlan; ///////////////////////////////////////////////////// @@ -98,7 +98,7 @@ public void execute() { @Override public String getEventDescription() { - return "Updating Physical network: " + getId(); + return "Updating Physical Network with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePodManagementNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePodManagementNetworkIpRangeCmd.java index 6f90a070f0d1..0dfa83a68289 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePodManagementNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdatePodManagementNetworkIpRangeCmd.java @@ -113,7 +113,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating pod management IP range " + getNewStartIP() + "-" + getNewEndIP() + " of Pod: " + getPodId(); + return "Updating pod management IP range " + getNewStartIP() + "-" + getNewEndIP() + " of Pod: " + getResourceUuid(ApiConstants.POD_ID); } @Override @@ -139,7 +139,7 @@ public void execute() { logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (Exception e) { - logger.warn("Failed to update pod management IP range " + getNewStartIP() + "-" + getNewEndIP() + " of Pod: " + getPodId(), e); + logger.warn("Failed to update pod management IP range {}-{} of Pod: {}", getNewStartIP(), getNewEndIP(), getPodId(), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java index 65e2437417de..978e94a783a9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java @@ -51,16 +51,16 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd { description = "UUID of storage network ip range") private Long id; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the beginning IP address") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The beginning IP address") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address") private String endIp; @Parameter(name = ApiConstants.VLAN, type = CommandType.INTEGER, description = "Optional. the vlan the ip range sits on") private Integer vlan; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask for storage network") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask for storage network") private String netmask; ///////////////////////////////////////////////////// @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Update storage ip range " + getId() + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", vlan=" + getVlan() + ", netmask=" + getNetmask() + ']'; + return "Updating storage IP range " + getResourceUuid(ApiConstants.ID) + " [StartIp=" + getStartIp() + ", EndIp=" + getEndIp() + ", VLAN=" + getVlan() + ", netmask=" + getNetmask() + ']'; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmd.java index 1d6bffca342e..3c58cbb3c532 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmd.java @@ -80,7 +80,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Changing Bgp Peers for network " + getNetworkId(); + return "Changing BGP Peers for Network with ID: " + getResourceUuid(ApiConstants.NETWORK_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmd.java index 0c89f3f1d43c..8784f0672790 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmd.java @@ -80,7 +80,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Changing Bgp Peers for VPC " + getVpcId(); + return "Changing BGP Peers for VPC with ID: " + getResourceUuid(ApiConstants.VPC_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmd.java index 80642124938a..f1d9b6723091 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmd.java @@ -145,7 +145,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating Bgp Peer " + getAsNumber() + " for zone=" + getZoneId(); + return "Creating BGP Peer " + getAsNumber() + " for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmd.java index ec3d0ea11629..f1ef963e9872 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmd.java @@ -82,7 +82,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Dedicating Bgp Peer " + getId(); + return "Dedicating BGP Peer with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmd.java index a01711efa44f..a412e91bc48e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmd.java @@ -59,7 +59,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting Bgp Peer " + getId(); + return "Deleting BGP Peer with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmd.java index 92610c233ef0..c754d443c051 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmd.java @@ -59,7 +59,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Releasing a dedicated Bgp Peer " + getId(); + return "Releasing dedicated BGP Peer with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmd.java index ae44330ea033..f45c1ee5a2f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmd.java @@ -120,7 +120,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating Bgp Peer " + getId(); + return "Updating BGP Peer with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneDiskOfferingCmd.java new file mode 100644 index 000000000000..8d822be203ad --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneDiskOfferingCmd.java @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.offering; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; + +import com.cloud.offering.DiskOffering; + +@APICommand(name = "cloneDiskOffering", + description = "Clones a disk offering. All parameters from createDiskOffering are available. If not specified, values will be copied from the source offering.", + responseObject = DiskOfferingResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.23.0", + authorized = {RoleType.Admin, RoleType.DomainAdmin}) +public class CloneDiskOfferingCmd extends CreateDiskOfferingCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, + type = BaseCmd.CommandType.UUID, + entityType = DiskOfferingResponse.class, + required = true, + description = "The ID of the source disk offering to clone from") + private Long sourceOfferingId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSourceOfferingId() { + return sourceOfferingId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + DiskOffering result = _configService.cloneDiskOffering(this); + if (result != null) { + DiskOfferingResponse response = _responseGenerator.createDiskOfferingResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone disk offering"); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmd.java new file mode 100644 index 000000000000..d01ca4c195da --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmd.java @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.offering; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; + +import com.cloud.offering.ServiceOffering; + +@APICommand(name = "cloneServiceOffering", + description = "Clones a service offering. All parameters from createServiceOffering are available. If not specified, values will be copied from the source offering.", + responseObject = ServiceOfferingResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.23.0", + authorized = {RoleType.Admin, RoleType.DomainAdmin}) +public class CloneServiceOfferingCmd extends CreateServiceOfferingCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, + type = CommandType.UUID, + entityType = ServiceOfferingResponse.class, + required = true, + description = "The ID of the source service offering to clone from") + private Long sourceOfferingId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSourceOfferingId() { + return sourceOfferingId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + + @Override + public void execute() { + try { + ServiceOffering result = _configService.cloneServiceOffering(this); + if (result != null) { + ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone service offering"); + } + } catch (com.cloud.exception.InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } catch (com.cloud.utils.exception.CloudRuntimeException e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java index c46e4cd6b445..e1ff90e4bd89 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java @@ -52,106 +52,105 @@ public class CreateDiskOfferingCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.DISK_SIZE, type = CommandType.LONG, required = false, description = "size of the disk offering in GB (1GB = 1,073,741,824 bytes)") + @Parameter(name = ApiConstants.DISK_SIZE, type = CommandType.LONG, required = false, description = "Size of the disk offering in GB (1GB = 1,073,741,824 bytes)") private Long diskSize; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "An alternate display text of the disk offering, defaults to 'name'.", length = 4096) private String displayText; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the disk offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the disk offering") private String offeringName; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "tags for the disk offering", length = 4096) + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "Tags for the disk offering", length = 4096) private String tags; - @Parameter(name = ApiConstants.CUSTOMIZED, type = CommandType.BOOLEAN, description = "whether disk offering size is custom or not") + @Parameter(name = ApiConstants.CUSTOMIZED, type = CommandType.BOOLEAN, description = "Whether disk offering size is custom or not") private Boolean customized; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the containing domain(s), null for public offerings") + description = "The ID of the containing domain(s), null for public offerings") private List domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the containing zone(s), null for public offerings", + description = "The ID of the containing zone(s), null for public offerings", since = "4.13") private List zoneIds; - @Parameter(name = ApiConstants.STORAGE_TYPE, type = CommandType.STRING, description = "the storage type of the disk offering. Values are local and shared.") + @Parameter(name = ApiConstants.STORAGE_TYPE, type = CommandType.STRING, description = "The storage type of the disk offering. Values are local and shared.") private String storageType = ServiceOffering.StorageType.shared.toString(); @Parameter(name = ApiConstants.PROVISIONINGTYPE, type = CommandType.STRING, - description = "provisioning type used to create volumes. Valid values are thin, sparse, fat.") + description = "Provisioning type used to create volumes. Valid values are thin, sparse, fat.") private String provisioningType = ProvisioningType.THIN.toString(); @Parameter(name = ApiConstants.DISPLAY_OFFERING, type = CommandType.BOOLEAN, - description = "an optional field, whether to display the offering to the end user or not.") + description = "An optional field, whether to display the offering to the end user or not.") private Boolean displayOffering; - @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "bytes read rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "Bytes read rate of the disk offering") private Long bytesReadRate; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes read rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst bytes read rate of the disk offering") private Long bytesReadRateMax; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long bytesReadRateMaxLength; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "bytes write rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "Bytes write rate of the disk offering") private Long bytesWriteRate; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes write rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst bytes write rate of the disk offering") private Long bytesWriteRateMax; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long bytesWriteRateMaxLength; - @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "io requests read rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "I/O requests read rate of the disk offering") private Long iopsReadRate; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst requests read rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst requests read rate of the disk offering") private Long iopsReadRateMax; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long iopsReadRateMaxLength; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "io requests write rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "I/O requests write rate of the disk offering") private Long iopsWriteRate; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst io requests write rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst I/O requests write rate of the disk offering") private Long iopsWriteRateMax; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long iopsWriteRateMaxLength; - @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "whether disk offering iops is custom or not") + @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "Whether disk offering IOPS is custom or not") private Boolean customizedIops; - @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "min iops of the disk offering") + @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "Min IOPS of the disk offering") private Long minIops; - @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "max iops of the disk offering") + @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "Max IOPS of the disk offering") private Long maxIops; @Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE, type = CommandType.INTEGER, required = false, - description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)") + description = "Hypervisor Snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)") private Integer hypervisorSnapshotReserve; @Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, - required = false, - description = "the cache mode to use for this disk offering. none, writeback or writethrough", + description = "The cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default. If the hypervisor default cache mode is used on other hypervisors than KVM, it will fall back to none cache mode", since = "4.14") private String cacheMode; @@ -164,7 +163,7 @@ public class CreateDiskOfferingCmd extends BaseCmd { @Parameter(name = ApiConstants.ENCRYPT, type = CommandType.BOOLEAN, required=false, description = "Volumes using this offering should be encrypted", since = "4.18") private Boolean encrypt; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "details to specify disk offering parameters", since = "4.16") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details to specify disk offering parameters", since = "4.16") private Map details; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java index 8f6d5413d72d..4363d6861ba1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java @@ -29,14 +29,17 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; import org.apache.cloudstack.api.response.VsphereStoragePoliciesResponse; import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.vm.lease.VMLeaseManager; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.collections.CollectionUtils; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.ServiceOffering; @@ -51,143 +54,142 @@ public class CreateServiceOfferingCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.CPU_NUMBER, type = CommandType.INTEGER, required = false, description = "the CPU number of the service offering") + @Parameter(name = ApiConstants.CPU_NUMBER, type = CommandType.INTEGER, required = false, description = "The CPU number of the service offering") private Integer cpuNumber; @Parameter(name = ApiConstants.CPU_SPEED, type = CommandType.INTEGER, required = false, description = "For VMware and Xen based hypervisors this is the CPU speed of the service offering in MHz.\n" + "For the KVM hypervisor," + " the values of the parameters cpuSpeed and cpuNumber will be used to calculate the `shares` value. This value is used by the KVM hypervisor to calculate how much time" + - " the VM will have access to the host's CPU. The `shares` value does not have a unit, and its purpose is being a weight value for the host to compare between its guest" + - " VMs. For more information, see https://libvirt.org/formatdomain.html#cpu-tuning.") + " the Instance will have access to the host's CPU. The `shares` value does not have a unit, and its purpose is being a weight value for the host to compare between its guest" + + " Instances. For more information, see https://libvirt.org/formatdomain.html#cpu-tuning.") private Integer cpuSpeed; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the service offering, defaults to 'name'.") private String displayText; - @Parameter(name = ApiConstants.PROVISIONINGTYPE, type = CommandType.STRING, description = "provisioning type used to create volumes. Valid values are thin, sparse, fat.") + @Parameter(name = ApiConstants.PROVISIONINGTYPE, type = CommandType.STRING, description = "Provisioning type used to create volumes. Valid values are thin, sparse, fat.") private String provisioningType = Storage.ProvisioningType.THIN.toString(); - @Parameter(name = ApiConstants.MEMORY, type = CommandType.INTEGER, required = false, description = "the total memory of the service offering in MB") + @Parameter(name = ApiConstants.MEMORY, type = CommandType.INTEGER, required = false, description = "The total memory of the service offering in MB") private Integer memory; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the service offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the service offering") private String serviceOfferingName; - @Parameter(name = ApiConstants.OFFER_HA, type = CommandType.BOOLEAN, description = "the HA for the service offering") + @Parameter(name = ApiConstants.OFFER_HA, type = CommandType.BOOLEAN, description = "The HA for the service offering") private Boolean offerHa; - @Parameter(name = ApiConstants.LIMIT_CPU_USE, type = CommandType.BOOLEAN, description = "restrict the CPU usage to committed service offering") + @Parameter(name = ApiConstants.LIMIT_CPU_USE, type = CommandType.BOOLEAN, description = "Restrict the CPU usage to committed service offering") private Boolean limitCpuUse; @Parameter(name = ApiConstants.IS_VOLATILE, type = CommandType.BOOLEAN, - description = "true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM") + description = "True if the Instance needs to be volatile so that on every reboot, the original root disk is detached, then destroyed and a fresh root disk is created and attached to the Instance") private Boolean isVolatile; - @Parameter(name = ApiConstants.STORAGE_TYPE, type = CommandType.STRING, description = "the storage type of the service offering. Values are local and shared.") + @Parameter(name = ApiConstants.STORAGE_TYPE, type = CommandType.STRING, description = "The storage type of the service offering. Values are local and shared.") private String storageType; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for this service offering.") + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "The tags for this service offering.") private String tags; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the containing domain(s), null for public offerings") + description = "The ID of the containing domain(s), null for public offerings") private List domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the containing zone(s), null for public offerings", + description = "The ID of the containing zone(s), null for public offerings", since = "4.13") private List zoneIds; - @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.STRING, description = "the host tag for this service offering.") + @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.STRING, description = "The host tag for this service offering.") private String hostTag; - @Parameter(name = ApiConstants.IS_SYSTEM_OFFERING, type = CommandType.BOOLEAN, description = "is this a system vm offering") + @Parameter(name = ApiConstants.IS_SYSTEM_OFFERING, type = CommandType.BOOLEAN, description = "Is this a system vm offering") private Boolean isSystem; @Parameter(name = ApiConstants.SYSTEM_VM_TYPE, type = CommandType.STRING, - description = "the system VM type. Possible types are \"domainrouter\", \"consoleproxy\" and \"secondarystoragevm\".") + description = "The system VM type. Possible types are \"domainrouter\", \"consoleproxy\" and \"secondarystoragevm\".") private String systemVmType; @Parameter(name = ApiConstants.NETWORKRATE, type = CommandType.INTEGER, - description = "data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype") + description = "Data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype") private Integer networkRate; @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, - description = "The deployment planner heuristics used to deploy a VM of this offering. If null, value of global config vm.deployment.planner is used") + description = "The deployment planner heuristics used to deploy an Instance of this offering. If null, value of global config vm.deployment.planner is used") private String deploymentPlanner; - @Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters") + @Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "Details for planner, used to store specific parameters") private Map details; - @Parameter(name = ApiConstants.ROOT_DISK_SIZE, type = CommandType.LONG, since = "4.15", description = "the Root disk size in GB.") + @Parameter(name = ApiConstants.ROOT_DISK_SIZE, type = CommandType.LONG, since = "4.15", description = "The Root disk size in GB.") private Long rootDiskSize; - @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "bytes read rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "Bytes read rate of the disk offering") private Long bytesReadRate; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes read rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst bytes read rate of the disk offering") private Long bytesReadRateMax; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long bytesReadRateMaxLength; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "bytes write rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "Bytes write rate of the disk offering") private Long bytesWriteRate; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes write rate of the disk offering") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst bytes write rate of the disk offering") private Long bytesWriteRateMax; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long bytesWriteRateMaxLength; - @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "io requests read rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "I/O requests read rate of the disk offering") private Long iopsReadRate; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst requests read rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst requests read rate of the disk offering") private Long iopsReadRateMax; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long iopsReadRateMaxLength; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "io requests write rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "I/O requests write rate of the disk offering") private Long iopsWriteRate; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst io requests write rate of the disk offering") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "Burst io requests write rate of the disk offering") private Long iopsWriteRateMax; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "Length (in seconds) of the burst") private Long iopsWriteRateMaxLength; - @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "whether compute offering iops is custom or not", since = "4.4") + @Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "Whether compute offering iops is custom or not", since = "4.4") private Boolean customizedIops; - @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "min iops of the compute offering", since = "4.4") + @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "Min iops of the compute offering", since = "4.4") private Long minIops; - @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "max iops of the compute offering", since = "4.4") + @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, required = false, description = "Max iops of the compute offering", since = "4.4") private Long maxIops; @Parameter(name = ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE, type = CommandType.INTEGER, required = false, - description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", + description = "Hypervisor Snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", since = "4.4") private Integer hypervisorSnapshotReserve; @Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, - required = false, - description = "the cache mode to use for this disk offering. none, writeback or writethrough", + description = "The cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default. If the hypervisor default cache mode is used on other hypervisors than KVM, it will fall back to none cache mode", since = "4.14") private String cacheMode; @@ -226,14 +228,14 @@ public class CreateServiceOfferingCmd extends BaseCmd { private Long storagePolicy; @Parameter(name = ApiConstants.DYNAMIC_SCALING_ENABLED, type = CommandType.BOOLEAN, since = "4.16", - description = "true if virtual machine needs to be dynamically scalable of cpu or memory") + description = "True if Instance needs to be dynamically scalable of cpu or memory") protected Boolean isDynamicScalingEnabled; @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, - description = "the ID of the disk offering to which service offering should be mapped", + description = "The ID of the disk offering to which service offering should be mapped", since = "4.17") private Long diskOfferingId; @@ -251,7 +253,40 @@ public class CreateServiceOfferingCmd extends BaseCmd { since="4.20") private Boolean purgeResources; + @Parameter(name = ApiConstants.INSTANCE_LEASE_DURATION, + type = CommandType.INTEGER, + description = "Number of days instance is leased for.", + since = "4.21.0") + private Integer leaseDuration; + + @Parameter(name = ApiConstants.INSTANCE_LEASE_EXPIRY_ACTION, type = CommandType.STRING, since = "4.21.0", + description = "Lease expiry action, valid values are STOP and DESTROY") + private String leaseExpiryAction; + @Parameter(name = ApiConstants.VGPU_PROFILE_ID, + type = CommandType.UUID, + entityType = VgpuProfileResponse.class, + description = "the ID of the vGPU profile to which service offering should be mapped", + since = "4.21") + private Long vgpuProfileId; + + @Parameter(name = ApiConstants.GPU_COUNT, + type = CommandType.INTEGER, + description = "Count of GPUs to be used with this service offering. This is applicable only when passed with vGPU profile.", + since = "4.21") + private Integer gpuCount; + + @Parameter(name = ApiConstants.GPU_DISPLAY, + type = CommandType.BOOLEAN, + description = "Whether to enable GPU display for this service offering. This is applicable only when passed with vGPU profile. Defaults to false.", + since = "4.21") + private Boolean gpuDisplay; + + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", + since = "4.21.0") + private Map externalDetails; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -359,9 +394,15 @@ public Map getDetails() { } } } + + detailsMap.putAll(getExternalDetails()); return detailsMap; } + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + public Long getRootDiskSize() { return rootDiskSize; } @@ -487,10 +528,38 @@ public boolean getEncryptRoot() { return false; } + public VMLeaseManager.ExpiryAction getLeaseExpiryAction() { + if (StringUtils.isBlank(leaseExpiryAction)) { + return null; + } + VMLeaseManager.ExpiryAction action = EnumUtils.getEnumIgnoreCase(VMLeaseManager.ExpiryAction.class, leaseExpiryAction); + if (action == null) { + throw new InvalidParameterValueException("Invalid value configured for leaseexpiryaction, valid values are: " + + com.cloud.utils.EnumUtils.listValues(VMLeaseManager.ExpiryAction.values())); + } + return action; + } + + public Integer getLeaseDuration() { + return leaseDuration; + } + public boolean isPurgeResources() { return Boolean.TRUE.equals(purgeResources); } + public Long getVgpuProfileId() { + return vgpuProfileId; + } + + public Integer getGpuCount() { + return gpuCount; + } + + public Boolean getGpuDisplay() { + return Boolean.TRUE.equals(gpuDisplay); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java index 19203289d104..d08b4f144c26 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java @@ -40,7 +40,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd { type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, - description = "the ID of the service offering") + description = "The ID of the service offering") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java index fcd6b03d3e59..4b1cd2ff7255 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java @@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.IsAccountAllowedToCreateOfferingsWithTagsResponse; @APICommand(name = "isAccountAllowedToCreateOfferingsWithTags", description = "Return true if the specified account is allowed to create offerings with tags.", - responseObject = IsAccountAllowedToCreateOfferingsWithTagsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) + responseObject = IsAccountAllowedToCreateOfferingsWithTagsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + httpMethod = "GET") public class IsAccountAllowedToCreateOfferingsWithTagsCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID", required = true) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java index 370453804cfc..4d48327eeb77 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java @@ -16,7 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import java.util.ArrayList; import java.util.List; import com.cloud.offering.DiskOffering.State; @@ -27,19 +26,18 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; -import com.cloud.dc.DataCenter; -import com.cloud.domain.Domain; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.DiskOffering; import com.cloud.user.Account; @APICommand(name = "updateDiskOffering", description = "Updates a disk offering.", responseObject = DiskOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class UpdateDiskOfferingCmd extends BaseCmd { +public class UpdateDiskOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -47,80 +45,81 @@ public class UpdateDiskOfferingCmd extends BaseCmd { @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, - description = "updates alternate display text of the disk offering with this value", + description = "Updates alternate display text of the disk offering with this value", length = 4096) private String displayText; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, required = true, description = "ID of the disk offering") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "updates name of the disk offering with this value") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Updates name of the disk offering with this value") private String diskOfferingName; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the disk offering, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the disk offering, integer") private Integer sortKey; @Parameter(name = ApiConstants.DISPLAY_OFFERING, type = CommandType.BOOLEAN, - description = "an optional field, whether to display the offering to the end user or not.") + description = "An optional field, whether to display the offering to the end user or not.") private Boolean displayOffering; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.STRING, - description = "the ID of the containing domain(s) as comma separated string, public for public offerings", + description = "The ID of the containing domain(s) as comma separated string, public for public offerings", since = "4.13", length = 4096) private String domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, - description = "the ID of the containing zone(s) as comma separated string, all for all zones offerings", + description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings", + length = 4096, since = "4.13") private String zoneIds; @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, - description = "comma-separated list of tags for the disk offering, tags should match with existing storage pool tags", + description = "Comma-separated list of tags for the disk offering, tags should match with existing storage pool tags", since = "4.15") private String tags; - @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, description = "bytes read rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, description = "Bytes read rate of the disk offering", since = "4.15") private Long bytesReadRate; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, description = "burst bytes read rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, description = "Burst bytes read rate of the disk offering", since = "4.15") private Long bytesReadRateMax; - @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, description = "length (in seconds) of the burst", since = "4.15") + @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, description = "Length (in seconds) of the burst", since = "4.15") private Long bytesReadRateMaxLength; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, description = "bytes write rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, description = "Bytes write rate of the disk offering", since = "4.15") private Long bytesWriteRate; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, description = "burst bytes write rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, description = "Burst bytes write rate of the disk offering", since = "4.15") private Long bytesWriteRateMax; - @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, description = "length (in seconds) of the burst", since = "4.15") + @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, description = "Length (in seconds) of the burst", since = "4.15") private Long bytesWriteRateMaxLength; - @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, description = "io requests read rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, description = "I/O requests read rate of the disk offering", since = "4.15") private Long iopsReadRate; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, description = "burst requests read rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, description = "Burst requests read rate of the disk offering", since = "4.15") private Long iopsReadRateMax; - @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, description = "length (in seconds) of the burst", since = "4.15") + @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, description = "Length (in seconds) of the burst", since = "4.15") private Long iopsReadRateMaxLength; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, description = "io requests write rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, description = "I/O requests write rate of the disk offering", since = "4.15") private Long iopsWriteRate; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, description = "burst io requests write rate of the disk offering", since = "4.15") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, description = "Burst io requests write rate of the disk offering", since = "4.15") private Long iopsWriteRateMax; - @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, description = "length (in seconds) of the burst", since = "4.15") + @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, description = "Length (in seconds) of the burst", since = "4.15") private Long iopsWriteRateMaxLength; - @Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, description = "the cache mode to use for this disk offering", since = "4.15") + @Parameter(name = ApiConstants.CACHE_MODE, type = CommandType.STRING, description = "The cache mode to use for this disk offering", since = "4.15") private String cacheMode; @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the disk offering") @@ -151,63 +150,11 @@ public Boolean getDisplayOffering() { } public List getDomainIds() { - List validDomainIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(domainIds)) { - if (domainIds.contains(",")) { - String[] domains = domainIds.split(","); - for (String domain : domains) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create disk offering because invalid domain has been specified."); - } - } - } else { - domainIds = domainIds.trim(); - if (!domainIds.matches("public")) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create disk offering because invalid domain has been specified."); - } - } - } - } else { - validDomainIds.addAll(_configService.getDiskOfferingDomains(id)); - } - return validDomainIds; + return resolveDomainIds(domainIds, id, _configService::getDiskOfferingDomains, "disk offering"); } public List getZoneIds() { - List validZoneIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(zoneIds)) { - if (zoneIds.contains(",")) { - String[] zones = zoneIds.split(","); - for (String zone : zones) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create disk offering because invalid zone has been specified."); - } - } - } else { - zoneIds = zoneIds.trim(); - if (!zoneIds.matches("all")) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create disk offering because invalid zone has been specified."); - } - } - } - } else { - validZoneIds.addAll(_configService.getDiskOfferingZones(id)); - } - return validZoneIds; + return resolveZoneIds(zoneIds, id, _configService::getDiskOfferingZones, "disk offering"); } public String getTags() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java index e580f0d9f41a..8e37499c95ed 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java @@ -16,8 +16,8 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import java.util.ArrayList; import java.util.List; +import java.util.Map; import com.cloud.offering.ServiceOffering.State; import org.apache.cloudstack.api.APICommand; @@ -27,19 +27,18 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; -import com.cloud.dc.DataCenter; -import com.cloud.domain.Domain; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @APICommand(name = "updateServiceOffering", description = "Updates a service offering.", responseObject = ServiceOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class UpdateServiceOfferingCmd extends BaseCmd { +public class UpdateServiceOfferingCmd extends BaseCmd implements DomainAndZoneIdResolver { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -48,39 +47,40 @@ public class UpdateServiceOfferingCmd extends BaseCmd { type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, - description = "the ID of the service offering to be updated") + description = "The ID of the service offering to be updated") private Long id; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the service offering to be updated") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the service offering to be updated") private String displayText; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the service offering to be updated") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the service offering to be updated") private String serviceOfferingName; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the service offering, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the service offering, integer") private Integer sortKey; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.STRING, - description = "the ID of the containing domain(s) as comma separated string, public for public offerings", + description = "The ID of the containing domain(s) as comma separated string, public for public offerings", length = 4096) private String domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, - description = "the ID of the containing zone(s) as comma separated string, all for all zones offerings", + description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings", + length = 4096, since = "4.13") private String zoneIds; @Parameter(name = ApiConstants.STORAGE_TAGS, type = CommandType.STRING, - description = "comma-separated list of tags for the service offering, tags should match with existing storage pool tags", + description = "Comma-separated list of tags for the service offering, tags should match with existing storage pool tags", since = "4.16") private String storageTags; @Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.STRING, - description = "the host tag for this service offering.", + description = "The host tag for this service offering.", since = "4.16") private String hostTags; @@ -94,6 +94,20 @@ public class UpdateServiceOfferingCmd extends BaseCmd { since="4.20") private Boolean purgeResources; + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", + since = "4.21.0") + private Map externalDetails; + + @Parameter(name = ApiConstants.CLEAN_UP_EXTERNAL_DETAILS, + type = CommandType.BOOLEAN, + description = "Optional boolean field, which indicates if external details should be cleaned up or not " + + "(If set to true, external details removed for this offering, externaldetails field ignored; " + + "if false or not set, no action)", + since = "4.22.0") + protected Boolean cleanupExternalDetails; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -115,63 +129,11 @@ public Integer getSortKey() { } public List getDomainIds() { - List validDomainIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(domainIds)) { - if (domainIds.contains(",")) { - String[] domains = domainIds.split(","); - for (String domain : domains) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create service offering because invalid domain has been specified."); - } - } - } else { - domainIds = domainIds.trim(); - if (!domainIds.matches("public")) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create service offering because invalid domain has been specified."); - } - } - } - } else { - validDomainIds.addAll(_configService.getServiceOfferingDomains(id)); - } - return validDomainIds; + return resolveDomainIds(domainIds, id, _configService::getServiceOfferingDomains, "service offering"); } public List getZoneIds() { - List validZoneIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(zoneIds)) { - if (zoneIds.contains(",")) { - String[] zones = zoneIds.split(","); - for (String zone : zones) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create service offering because invalid zone has been specified."); - } - } - } else { - zoneIds = zoneIds.trim(); - if (!zoneIds.matches("all")) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create service offering because invalid zone has been specified."); - } - } - } - } else { - validZoneIds.addAll(_configService.getServiceOfferingZones(id)); - } - return validZoneIds; + return resolveZoneIds(zoneIds, id, _configService::getServiceOfferingZones, "service offering"); } public String getStorageTags() { @@ -194,6 +156,14 @@ public boolean isPurgeResources() { return Boolean.TRUE.equals(purgeResources); } + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + + public boolean isCleanupExternalDetails() { + return Boolean.TRUE.equals(cleanupExternalDetails); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java index e2c31d6cf072..b9a729bc1b77 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ChangeOutOfBandManagementPasswordCmd.java @@ -53,10 +53,10 @@ public class ChangeOutOfBandManagementPasswordCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the host") private Long hostId; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "the new host management interface password of maximum length 16, if none is provided a random password would be used") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "The new host management interface password of maximum length 16, if none is provided a random password would be used") private String password; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId()); } - CallContext.current().setEventDetails("Host Id: " + host.getId() + " Password: " + getPassword().charAt(0) + "****"); + CallContext.current().setEventDetails("Host ID: " + host.getUuid() + " Password: " + getPassword().charAt(0) + "****"); CallContext.current().putContextParameter(Host.class, host.getUuid()); final OutOfBandManagementResponse response = outOfBandManagementService.changePassword(host, getPassword()); @@ -101,7 +101,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "change out-of-band management password for host: " + getHostId(); + return "Changing out-of-band management password for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java index 157d3c627db5..4052539a51d7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ConfigureOutOfBandManagementCmd.java @@ -54,22 +54,22 @@ public class ConfigureOutOfBandManagementCmd extends BaseCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the host") private Long hostId; - @Parameter(name = ApiConstants.DRIVER, type = CommandType.STRING, required = true, description = "the host management interface driver, for example: ipmitool") + @Parameter(name = ApiConstants.DRIVER, type = CommandType.STRING, required = true, description = "The host management interface driver, for example: ipmitool") private String driver; - @Parameter(name = ApiConstants.ADDRESS, type = CommandType.STRING, required = true, description = "the host management interface IP address") + @Parameter(name = ApiConstants.ADDRESS, type = CommandType.STRING, required = true, description = "The host management interface IP address") private String address; - @Parameter(name = ApiConstants.PORT, type = CommandType.STRING, required = true, description = "the host management interface port") + @Parameter(name = ApiConstants.PORT, type = CommandType.STRING, required = true, description = "The host management interface port") private String port; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "the host management interface user") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "The host management interface user") private String username; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the host management interface password") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "The host management interface password") private String password; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java index 445e7b92665c..5b0f3a802071 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForClusterCmd.java @@ -54,7 +54,7 @@ public class DisableOutOfBandManagementForClusterCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.CLUSTER_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = ClusterResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the cluster") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the cluster") private Long clusterId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.disableOutOfBandManagement(cluster); - CallContext.current().setEventDetails("Cluster Id:" + cluster.getId() + " out-of-band management enabled: false"); + CallContext.current().setEventDetails("Cluster ID:" + cluster.getUuid() + " out-of-band management enabled: false"); CallContext.current().putContextParameter(Cluster.class, cluster.getUuid()); response.setResponseName(getCommandName()); @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable out-of-band management password for cluster: " + getClusterId(); + return "Disabling out-of-band management password for cluster with ID: " + getResourceUuid(ApiConstants.CLUSTER_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java index 7e4444e93fbd..c70622134531 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForHostCmd.java @@ -54,7 +54,7 @@ public class DisableOutOfBandManagementForHostCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = HostResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the host") private Long hostId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.disableOutOfBandManagement(host); - CallContext.current().setEventDetails("Host Id:" + host.getId() + " out-of-band management enabled: false"); + CallContext.current().setEventDetails("Host ID:" + host.getUuid() + " out-of-band management enabled: false"); CallContext.current().putContextParameter(Host.class, host.getUuid()); response.setId(host.getUuid()); @@ -94,7 +94,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable out-of-band management password for host: " + getHostId(); + return "Disabling out-of-band management password for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java index 2028f8fc2a07..2f2750580516 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/DisableOutOfBandManagementForZoneCmd.java @@ -54,7 +54,7 @@ public class DisableOutOfBandManagementForZoneCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ZONE_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = ZoneResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the zone") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the zone") private Long zoneId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.disableOutOfBandManagement(zone); - CallContext.current().setEventDetails("Zone Id:" + zone.getId() + " out-of-band management enabled: false"); + CallContext.current().setEventDetails("Zone ID:" + zone.getUuid() + " out-of-band management enabled: false"); CallContext.current().putContextParameter(DataCenter.class, zone.getUuid()); response.setResponseName(getCommandName()); @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "disable out-of-band management password for zone: " + getZoneId(); + return "Disabling out-of-band management password for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java index 549743b31728..4419ed18ee59 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForClusterCmd.java @@ -54,7 +54,7 @@ public class EnableOutOfBandManagementForClusterCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.CLUSTER_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = ClusterResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the cluster") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the cluster") private Long clusterId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(cluster); - CallContext.current().setEventDetails("Cluster Id:" + cluster.getId() + " out-of-band management enabled: true"); + CallContext.current().setEventDetails("Cluster ID:" + cluster.getUuid() + " out-of-band management enabled: true"); CallContext.current().putContextParameter(Cluster.class, cluster.getUuid()); response.setResponseName(getCommandName()); @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable out-of-band management password for cluster: " + getClusterId(); + return "Enabling out-of-band management password for cluster with ID: " + getResourceUuid(ApiConstants.CLUSTER_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java index 834181a5e1c5..b3f2e8aaf821 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForHostCmd.java @@ -54,7 +54,7 @@ public class EnableOutOfBandManagementForHostCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = HostResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the host") private Long hostId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(host); - CallContext.current().setEventDetails("Host Id:" + host.getId() + " out-of-band management enabled: true"); + CallContext.current().setEventDetails("Host ID:" + host.getUuid() + " out-of-band management enabled: true"); CallContext.current().putContextParameter(Host.class, host.getUuid()); response.setId(host.getUuid()); @@ -94,7 +94,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable out-of-band management password for host: " + getHostId(); + return "Enabling out-of-band management password for host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java index de4c4d801de1..8f6eb2dc3500 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/EnableOutOfBandManagementForZoneCmd.java @@ -54,7 +54,7 @@ public class EnableOutOfBandManagementForZoneCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ZONE_ID, type = BaseCmd.CommandType.UUID, required = true, entityType = ZoneResponse.class, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the zone") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the zone") private Long zoneId; ///////////////////////////////////////////////////// @@ -70,7 +70,7 @@ final public void execute() throws ResourceUnavailableException, InsufficientCap OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(zone); - CallContext.current().setEventDetails("Zone Id:" + zone.getId() + " out-of-band management enabled: true"); + CallContext.current().setEventDetails("Zone ID:" + zone.getUuid() + " out-of-band management enabled: true"); CallContext.current().putContextParameter(DataCenter.class, zone.getUuid()); response.setResponseName(getCommandName()); @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "enable out-of-band management password for zone: " + getZoneId(); + return "Enabling out-of-band management password for zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java index 97a813c9d476..bba3fee6ceca 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/IssueOutOfBandManagementPowerActionCmd.java @@ -53,14 +53,14 @@ public class IssueOutOfBandManagementPowerActionCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, required = true, - validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host") + validations = {ApiArgValidator.PositiveNumber}, description = "The ID of the host") private Long hostId; - @Parameter(name = ApiConstants.TIMEOUT, type = CommandType.LONG, description = "optional operation timeout in seconds that overrides the global or cluster-level out-of-band management timeout setting") + @Parameter(name = ApiConstants.TIMEOUT, type = CommandType.LONG, description = "Optional operation timeout in seconds that overrides the global or cluster-level out-of-band management timeout setting") private Long actionTimeout; @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true, - description = "out-of-band management power actions, valid actions are: ON, OFF, CYCLE, RESET, SOFT, STATUS") + description = "Out-of-band management power actions, valid actions are: ON, OFF, CYCLE, RESET, SOFT, STATUS") private String powerAction; ///////////////////////////////////////////////////// @@ -75,7 +75,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } final PowerOperation powerOperation = PowerOperation.valueOf(getPowerAction()); - CallContext.current().setEventDetails("Host Id: " + host.getId() + " Action: " + powerOperation.toString()); + CallContext.current().setEventDetails("Host ID: " + host.getUuid() + " Action: " + powerOperation.toString()); CallContext.current().putContextParameter(Host.class, host.getUuid()); final OutOfBandManagementResponse response = outOfBandManagementService.executePowerOperation(host, powerOperation, getActionTimeout()); @@ -107,7 +107,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "issue out-out-band management power action: " + getPowerAction() + " on host: " + getHostId(); + return "Issuing out-out-band management power action: " + getPowerAction() + " to host: " + getResourceUuid(ApiConstants.HOST_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java index c1d9a6db4296..6a178b64d876 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java @@ -30,6 +30,8 @@ import com.cloud.dc.Pod; import com.cloud.user.Account; +import java.util.List; + @APICommand(name = "createPod", description = "Creates a new Pod.", responseObject = PodResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePodCmd extends BaseCmd { @@ -38,31 +40,37 @@ public class CreatePodCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the Pod") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Pod") private String podName; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "the Zone ID in which the Pod will be created") + description = "The Zone ID in which the Pod will be created") private Long zoneId; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the starting IP address for the Pod") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The starting IP address for the Pod") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address for the Pod") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address for the Pod") private String endIp; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask for the Pod") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask for the Pod") private String netmask; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "the gateway for the Pod") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "The gateway for the Pod") private String gateway; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this Pod for allocation of new resources") private String allocationState; + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, + type = CommandType.LIST, collectionType = CommandType.STRING, + description = "comma separated list of storage access groups for the hosts in the pod", + since = "4.21.0") + private List storageAccessGroups; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -95,6 +103,10 @@ public String getAllocationState() { return allocationState; } + public List getStorageAccessGroups() { + return storageAccessGroups; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -111,7 +123,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState()); + Pod result = _configService.createPod(getZoneId(), getPodName(), getStartIp(), getEndIp(), getGateway(), getNetmask(), getAllocationState(), getStorageAccessGroups()); if (result != null) { PodResponse response = _responseGenerator.createPodResponse(result, false); response.setResponseName(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java index c1de800d745b..953fcc91fa71 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java @@ -38,7 +38,7 @@ public class DeletePodCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the ID of the Pod") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The ID of the Pod") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java index 5ad0b457ced7..a19bc3caf8b5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java @@ -40,21 +40,26 @@ public class ListPodsByCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, description = "list Pods by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, description = "List Pods by ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list Pods by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List Pods by name") private String podName; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list Pods by Zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "List Pods by Zone ID") private Long zoneId; - @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "list pods by allocation state") + @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "List pods by allocation state") private String allocationState; - @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the pods") + @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "Flag to display the capacity of the pods") private Boolean showCapacities; + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING, + description = "the name of the storage access group", + since = "4.21.0") + private String storageAccessGroup; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -79,6 +84,18 @@ public Boolean getShowCapacities() { return showCapacities; } + public String getStorageAccessGroup() { + return storageAccessGroup; + } + + public ListPodsByCmd() { + + } + + public ListPodsByCmd(String storageAccessGroup) { + this.storageAccessGroup = storageAccessGroup; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -86,8 +103,8 @@ public Boolean getShowCapacities() { @Override public void execute() { Pair, Integer> result = _mgr.searchForPods(this); - ListResponse response = new ListResponse(); - List podResponses = new ArrayList(); + ListResponse response = new ListResponse<>(); + List podResponses = new ArrayList<>(); for (Pod pod : result.first()) { PodResponse podResponse = _responseGenerator.createPodResponse(pod, showCapacities); podResponse.setObjectName("pod"); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java index 7dae6f4c7cf0..24a549c623ad 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java @@ -38,22 +38,22 @@ public class UpdatePodCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "the ID of the Pod") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The ID of the Pod") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Pod") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Pod") private String podName; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the starting IP address for the Pod") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The starting IP address for the Pod") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address for the Pod") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address for the Pod") private String endIp; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask of the Pod") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask of the Pod") private String netmask; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "the gateway for the Pod") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "The gateway for the Pod") private String gateway; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java index fd103c838309..1142bdd3f43c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java @@ -36,7 +36,7 @@ @APICommand(name = "createPortableIpRange", responseObject = PortableIpRangeResponse.class, - description = "adds a range of portable public IP's to a region", + description = "Adds a range of portable public IP's to a region", since = "4.2.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -51,16 +51,16 @@ public class CreatePortableIpRangeCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, required = true, description = "Id of the Region") private Integer regionId; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, required = true, description = "the beginning IP address in the portable IP range") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, required = true, description = "The beginning IP address in the portable IP range") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, required = true, description = "the ending IP address in the portable IP range") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, required = true, description = "The ending IP address in the portable IP range") private String endIp; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "the gateway for the portable IP range") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "The gateway for the portable IP range") private String gateway; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "the netmask of the portable IP range") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "The netmask of the portable IP range") private String netmask; @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "VLAN id, if not specified defaulted to untagged") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java index 3ff46fcc94d5..ac8fe66a8144 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java @@ -31,7 +31,7 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "deletePortableIpRange", description = "deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class, +@APICommand(name = "deletePortableIpRange", description = "Deletes a range of portable public IP's associated with a region", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeletePortableIpRangeCmd extends BaseAsyncCmd { @@ -83,7 +83,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting a portable public ip range"; + return "Deleting a portable public ip range with ID: " + getResourceUuid(ApiConstants.ID) ; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java index e654da6df449..92a1cc3822e9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java @@ -32,7 +32,7 @@ import com.cloud.user.Account; -@APICommand(name = "listPortableIpRanges", description = "list portable IP ranges", responseObject = PortableIpRangeResponse.class, +@APICommand(name = "listPortableIpRanges", description = "List portable IP ranges", responseObject = PortableIpRangeResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListPortableIpRangesCmd extends BaseListCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java index 4267f6a2c286..ec5bfdabf5ec 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java @@ -42,10 +42,10 @@ public class UpdateRegionCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.INTEGER, required = true, description = "Id of region to update") private Integer id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "updates region with this name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Updates region with this name") private String regionName; - @Parameter(name = ApiConstants.END_POINT, type = CommandType.STRING, description = "updates region with this end point") + @Parameter(name = ApiConstants.END_POINT, type = CommandType.STRING, description = "Updates region with this end point") private String endPoint; @Inject diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java index dc8c15cf09df..e495a1683292 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ArchiveAlertsCmd.java @@ -46,18 +46,18 @@ public class ArchiveAlertsCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class, - description = "the IDs of the alerts") + description = "The IDs of the alerts") private List ids; - @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "end date range to archive alerts" + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "End date range to archive alerts" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date endDate; - @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "start date range to archive alerts" + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Start date range to archive alerts" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date startDate; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "archive by alert type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Archive by alert type") private String type; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java index 1ae8c9441233..ba1b2be4008f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java @@ -27,7 +27,7 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; -@APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class, +@APICommand(name = "cleanVMReservations", description = "Cleanups Instance reservations in the database.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CleanVMReservationsCmd extends BaseAsyncCmd { @@ -63,7 +63,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "cleaning vm reservations in database"; + return "Cleaning Instance reservations in database"; } @Override @@ -73,7 +73,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } catch (Exception ex) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clean vm reservations"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clean Instance reservations"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java index 9262a120f72c..f59a16d83733 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/DeleteAlertsCmd.java @@ -46,18 +46,18 @@ public class DeleteAlertsCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class, - description = "the IDs of the alerts") + description = "The IDs of the alerts") private List ids; - @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "end date range to delete alerts" + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "End date range to delete alerts" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date endDate; - @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "start date range to delete alerts" + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Start date range to delete alerts" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date startDate; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "delete by alert type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Delete by alert type") private String type; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertTypesCmd.java index e7bfbdbc6254..dcd4f2c89ef2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertTypesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertTypesCmd.java @@ -16,7 +16,10 @@ // under the License. package org.apache.cloudstack.api.command.admin.resource; -import com.cloud.user.Account; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.apache.cloudstack.alert.AlertService; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.BaseCmd; @@ -24,9 +27,7 @@ import org.apache.cloudstack.api.response.AlertTypeResponse; import org.apache.cloudstack.api.response.ListResponse; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import com.cloud.user.Account; @APICommand(name = "listAlertTypes", description = "Lists all alerts types", responseObject = AlertResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -43,7 +44,8 @@ public void execute() { ListResponse response = new ListResponse<>(); List typeResponseList = new ArrayList<>(); for (AlertService.AlertType alertType : result) { - AlertTypeResponse alertResponse = new AlertTypeResponse(alertType.getType(), alertType.getName()); + AlertTypeResponse alertResponse = new AlertTypeResponse(alertType.getType(), alertType.getName(), + alertType.isRepetitionAllowed()); alertResponse.setObjectName("alerttype"); typeResponseList.add(alertResponse); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java index 64cf691e6a73..e88896703238 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java @@ -39,13 +39,13 @@ public class ListAlertsCmd extends BaseListCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AlertResponse.class, description = "the ID of the alert") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AlertResponse.class, description = "The ID of the alert") private Long id; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "list by alert type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "List by alert type") private String type; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list by alert name", since = "4.3") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List by alert name", since = "4.3") private String name; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java index 6b31c4cc43cd..ae98ca9dcd26 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java @@ -46,23 +46,23 @@ public class ListCapacityCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "lists capacity by the Zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Lists capacity by the Zone ID") private Long zoneId; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "lists capacity by the Pod ID") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "Lists capacity by the Pod ID") private Long podId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, since = "3.0.0", - description = "lists capacity by the Cluster ID") + description = "Lists capacity by the Cluster ID") private Long clusterId; - @Parameter(name = ApiConstants.FETCH_LATEST, type = CommandType.BOOLEAN, since = "3.0.0", description = "recalculate capacities and fetch the latest") + @Parameter(name = ApiConstants.FETCH_LATEST, type = CommandType.BOOLEAN, since = "3.0.0", description = "Recalculate capacities and fetch the latest") private Boolean fetchLatest; - @Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, description = "lists capacity by type" + "* CAPACITY_TYPE_MEMORY = 0" + "* CAPACITY_TYPE_CPU = 1" + @Parameter(name = ApiConstants.TYPE, type = CommandType.INTEGER, description = "Lists capacity by type" + "* CAPACITY_TYPE_MEMORY = 0" + "* CAPACITY_TYPE_CPU = 1" + "* CAPACITY_TYPE_STORAGE = 2" + "* CAPACITY_TYPE_STORAGE_ALLOCATED = 3" + "* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4" + "* CAPACITY_TYPE_PRIVATE_IP = 5" + "* CAPACITY_TYPE_SECONDARY_STORAGE = 6" + "* CAPACITY_TYPE_VLAN = 7" + "* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8" + "* CAPACITY_TYPE_LOCAL_STORAGE = 9" + "* CAPACITY_TYPE_GPU = 19" + "* CAPACITY_TYPE_CPU_CORE = 90.") @@ -132,11 +132,12 @@ public void execute() { Collections.sort(capacityResponses, new Comparator() { public int compare(CapacityResponse resp1, CapacityResponse resp2) { int res = resp1.getZoneName().compareTo(resp2.getZoneName()); + // Group by zone if (res != 0) { return res; - } else { - return resp1.getCapacityType().compareTo(resp2.getCapacityType()); } + // Sort by capacity type only if not already sorted by usage + return (getSortBy() != null) ? 0 : resp1.getCapacityType().compareTo(resp2.getCapacityType()); } }); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/StartRollingMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/StartRollingMaintenanceCmd.java index 04fa1002611c..3869b9cdf957 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/StartRollingMaintenanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/StartRollingMaintenanceCmd.java @@ -60,31 +60,31 @@ public class StartRollingMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.POD_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, - entityType = PodResponse.class, description = "the IDs of the pods to start maintenance on") + entityType = PodResponse.class, description = "The IDs of the pods to start maintenance on") private List podIds; @Parameter(name = ApiConstants.CLUSTER_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, - entityType = ClusterResponse.class, description = "the IDs of the clusters to start maintenance on") + entityType = ClusterResponse.class, description = "The IDs of the clusters to start maintenance on") private List clusterIds; @Parameter(name = ApiConstants.ZONE_ID_LIST, type = CommandType.LIST, collectionType = CommandType.UUID, - entityType = ZoneResponse.class, description = "the IDs of the zones to start maintenance on") + entityType = ZoneResponse.class, description = "The IDs of the zones to start maintenance on") private List zoneIds; @Parameter(name = ApiConstants.HOST_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, - entityType = HostResponse.class, description = "the IDs of the hosts to start maintenance on") + entityType = HostResponse.class, description = "The IDs of the hosts to start maintenance on") private List hostIds; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, - description = "if rolling mechanism should continue in case of an error") + description = "If rolling mechanism should continue in case of an error") private Boolean forced; @Parameter(name = ApiConstants.PAYLOAD, type = CommandType.STRING, - description = "the command to execute while hosts are on maintenance") + description = "The command to execute while hosts are on maintenance") private String payload; @Parameter(name = ApiConstants.TIMEOUT, type = CommandType.INTEGER, - description = "optional operation timeout (in seconds) that overrides the global timeout setting") + description = "Optional operation timeout (in seconds) that overrides the global timeout setting") private Integer timeout; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java index c5ae6890c3e5..7144bbaa6015 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java @@ -84,7 +84,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Uploading custom certificate to the db, and applying it to all the cpvms in the system"); + return ("Uploading custom certificate and applying it to all the CPVMs in the system"); } public static String getResultObjectName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/DeleteResourceIconCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/DeleteResourceIconCmd.java index e97a68bddcb6..6289879c1a27 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/DeleteResourceIconCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/DeleteResourceIconCmd.java @@ -31,7 +31,7 @@ import java.util.List; -@APICommand(name = "deleteResourceIcon", description = "deletes the resource icon from the specified resource(s)", +@APICommand(name = "deleteResourceIcon", description = "Deletes the resource icon from the specified resource(s)", responseObject = SuccessResponse.class, since = "4.16.0.0", entityType = {ResourceIcon.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin, RoleType.User}) @@ -45,10 +45,10 @@ public class DeleteResourceIconCmd extends BaseCmd { type = BaseCmd.CommandType.LIST, required = true, collectionType = BaseCmd.CommandType.STRING, - description = "list of resources to upload the icon/image for") + description = "List of resources to upload the icon/image for") private List resourceIds; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "type of the resource") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "Type of the resource") private String resourceType; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/ListResourceIconCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/ListResourceIconCmd.java index 6cc3173cf155..7b9c9671d47a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/ListResourceIconCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/ListResourceIconCmd.java @@ -42,10 +42,10 @@ public class ListResourceIconCmd extends BaseCmd { type = BaseCmd.CommandType.LIST, required = true, collectionType = BaseCmd.CommandType.STRING, - description = "list of resources to upload the icon/image for") + description = "List of resources to upload the icon/image for") private List resourceIds; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "type of the resource") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "Type of the resource") private String resourceType; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/UploadResourceIconCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/UploadResourceIconCmd.java index 5a6acd961bf5..9201e345302c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/UploadResourceIconCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/resource/icon/UploadResourceIconCmd.java @@ -55,10 +55,10 @@ public class UploadResourceIconCmd extends BaseCmd { type = BaseCmd.CommandType.LIST, required = true, collectionType = BaseCmd.CommandType.STRING, - description = "list of resources to upload the icon/image for") + description = "List of resources to upload the icon/image for") private List resourceIds; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "type of the resource") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = BaseCmd.CommandType.STRING, required = true, description = "Type of the resource") private String resourceType; @Parameter(name = ApiConstants.BASE64_IMAGE, type = BaseCmd.CommandType.STRING, required = true, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java index 4a8c0bc3a3b9..474e13de32f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureOvsElementCmd.java @@ -48,7 +48,7 @@ public class ConfigureOvsElementCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, required = true, description = "the ID of the ovs provider") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, required = true, description = "The ID of the ovs provider") private Long id; @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "Enabled/Disabled the service provider") @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "configuring ovs provider: " + id; + return "Configuring OVS provider with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -109,7 +109,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Ovs element: " + id); + CallContext.current().setEventDetails("OVS element: " + getResourceUuid(ApiConstants.ID)); OvsProvider result = _service.get(0).configure(this); if (result != null) { OvsProviderResponse ovsResponse = _responseGenerator diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java index aa119f3aca75..ba0110f014a0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java @@ -54,7 +54,7 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = VirtualRouterProviderResponse.class, required = true, - description = "the ID of the virtual router provider") + description = "The ID of the virtual router provider") private Long id; @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "Enabled/Disabled the service provider") @@ -100,7 +100,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "configuring virtual router provider: " + id; + return "Configuring virtual router with provider that has ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -115,7 +115,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Virtual router element: " + id); + CallContext.current().setEventDetails("Virtual router element ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouterProvider result = _service.get(0).configure(this); if (result != null) { VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java index e85531c83c4d..094e87ae0058 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java @@ -54,7 +54,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = ProviderResponse.class, required = true, - description = "the network service provider ID of the virtual router element") + description = "The network service provider ID of the virtual router element") private Long nspId; @Parameter(name = ApiConstants.PROVIDER_TYPE, @@ -98,7 +98,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Virtual router element Id: " + getEntityUuid()); + CallContext.current().setEventDetails("Virtual router element ID: " + getEntityUuid()); VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId()); if (result != null) { VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java index 39ccee47fbeb..d8355cadb0a0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java @@ -42,7 +42,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the router") private Long id; // /////////////////////////////////////////////////// @@ -74,7 +74,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "destroying router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()); + return "Destroying virtual router with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -90,7 +90,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { CallContext ctx = CallContext.current(); - ctx.setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId())); + ctx.setEventDetails("Router ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId()); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/GetRouterHealthCheckResultsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/GetRouterHealthCheckResultsCmd.java index 4bef26e05550..a302ebee1046 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/GetRouterHealthCheckResultsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/GetRouterHealthCheckResultsCmd.java @@ -52,10 +52,10 @@ public class GetRouterHealthCheckResultsCmd extends BaseCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ROUTER_ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, - required = true, description = "the ID of the router") + required = true, description = "The ID of the router") private Long routerId; - @Parameter(name = ApiConstants.PERFORM_FRESH_CHECKS, type = CommandType.BOOLEAN, description = "if true is passed for this parameter, " + + @Parameter(name = ApiConstants.PERFORM_FRESH_CHECKS, type = CommandType.BOOLEAN, description = "If true is passed for this parameter, " + "health checks are performed on the fly. Else last performed checks data is fetched") private Boolean performFreshChecks; @@ -87,7 +87,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException, InvalidParameterValueException, ServerApiException { - CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getRouterId())); + CallContext.current().setEventDetails("Router ID: " + getResourceUuid(ApiConstants.ROUTER_ID)); VirtualRouter router = _routerService.findRouter(getRouterId()); if (router == null || router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) { throw new InvalidParameterValueException("Can't find router by routerId"); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java index a267aa526691..5ed3ae0e208e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListOvsElementsCmd.java @@ -46,13 +46,13 @@ public class ListOvsElementsCmd extends BaseListCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, description = "list ovs elements by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, description = "List ovs elements by id") private Long id; - @Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, description = "list ovs elements by network service provider id") + @Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, description = "List ovs elements by network service provider id") private Long nspId; - @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "list network offerings by enabled state") + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "List network offerings by enabled state") private Boolean enabled; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java index e0cdc0dcf807..92ebd323169c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java @@ -16,8 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.commons.lang.BooleanUtils; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -32,7 +30,10 @@ import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; import com.cloud.network.router.VirtualRouter.Role; import com.cloud.vm.VirtualMachine; @@ -45,47 +46,52 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID of the router") + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "The host ID of the router") private Long hostId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the disk router") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the disk router") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the router") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the router") private String routerName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID of the router") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID of the router") private Long podId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "the state of the router") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the router") private String state; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the router") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID of the router") private Long zoneId; - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster ID of the router") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "The cluster ID of the router") private Long clusterId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list by network id") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List by network id") private Long networkId; @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List networks by VPC") private Long vpcId; - @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "if true is passed for this parameter, list only VPC routers") + @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "If true is passed for this parameter, list only VPC routers") private Boolean forVpc; - @Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, description = "list virtual router elements by version") + @Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, description = "List virtual router elements by version") private String version; @Parameter(name = ApiConstants.HEALTHCHECK_FAILED, type = CommandType.BOOLEAN, since = "4.16", - description = "if this parameter is passed, list only routers by health check results") + description = "If this parameter is passed, list only routers by health check results") private Boolean healthCheckFailed; @Parameter(name = ApiConstants.FETCH_ROUTER_HEALTH_CHECK_RESULTS, type = CommandType.BOOLEAN, since = "4.14", - description = "if true is passed for this parameter, also fetch last executed health check results for the router. Default is false") + description = "If true is passed for this parameter, also fetch last executed health check results for the router. Default is false") private Boolean fetchHealthCheckResults; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, + description = "CPU arch of the router", + since = "4.20.1") + private String arch; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -146,6 +152,10 @@ public boolean shouldFetchHealthCheckResults() { return BooleanUtils.isTrue(fetchHealthCheckResults); } + public CPU.CPUArch getArch() { + return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java index 424b8c29d041..6b175b10ebd9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java @@ -49,16 +49,16 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VirtualRouterProviderResponse.class, description = "list virtual router elements by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VirtualRouterProviderResponse.class, description = "List virtual router elements by id") private Long id; @Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, - description = "list virtual router elements by network service provider id") + description = "List virtual router elements by network service provider id") private Long nspId; - @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "list network offerings by enabled state") + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "List network offerings by enabled state") private Boolean enabled; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java index 1d97dd803098..d90208e36d34 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java @@ -43,7 +43,7 @@ public class RebootRouterCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the router") private Long id; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force reboot the router (Router is force Stopped and then Started)", since = "4.16.0") @@ -78,7 +78,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "rebooting router: " + this._uuidMgr.getUuid(VirtualMachine.class,getId()); + return "Rebooting router with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -97,7 +97,7 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId())); + CallContext.current().setEventDetails("Router ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = _routerService.rebootRouter(getId(), true, isForced()); if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java index 24ab78810374..263f53ca2e48 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java @@ -45,7 +45,7 @@ public class StartRouterCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the router") private Long id; ///////////////////////////////////////////////////// @@ -81,7 +81,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "starting router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Starting virtual router with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -96,7 +96,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Router Id: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java index 971086a57cff..838762740281 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java @@ -44,10 +44,10 @@ public class StopRouterCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "the ID of the router") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, required = true, description = "The ID of the router") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the Instance (Instance is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the Instance is stopped and should be marked as such.") private Boolean forced; // /////////////////////////////////////////////////// @@ -79,7 +79,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Stopping router: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Stopping virtual router with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -98,7 +98,7 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Router ID: " + getResourceUuid(ApiConstants.ID)); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java index 3265a089d672..1428ecbaeca2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java @@ -45,7 +45,7 @@ public class UpgradeRouterCmd extends BaseCmd { type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, - description = "the service offering ID to apply to the domain router") + description = "The service offering ID to apply to the domain router") private Long serviceOfferingId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java index 74464cab3150..6fdfa7d3642d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java @@ -39,7 +39,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer template", responseObject = BaseResponse.class, +@APICommand(name = "upgradeRouterTemplate", description = "Upgrades router to use newer Template", responseObject = BaseResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd { @@ -47,29 +47,29 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, description = "upgrades router with the specified Id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DomainRouterResponse.class, description = "Upgrades router with the specified Id") private Long id; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "upgrades all routers within the specified cluster") + description = "Upgrades all routers within the specified cluster") private Long clusterId; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "upgrades all routers within the specified pod") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "Upgrades all routers within the specified Pod") private Long podId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "upgrades all routers within the specified zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Upgrades all routers within the specified zone") private Long zoneId; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, - description="upgrades all routers owned by the specified account") + description = "Upgrades all routers owned by the specified account") private String account; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "upgrades all routers owned by the specified domain") + description = "Upgrades all routers owned by the specified domain") private Long domainId; ///////////////////////////////////////////////////// @@ -119,14 +119,14 @@ public Long getInstanceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Upgrading router template"); + CallContext.current().setEventDetails("Upgrading router with with ID: " + getResourceUuid(ApiConstants.ID) + " template"); List result = _routerService.upgradeRouterTemplate(this); if (result != null) { ListResponse response = _responseGenerator.createUpgradeRouterTemplateResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router Template"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java index 7c8f0e21afbb..72e2e96fe57b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreCmd.java @@ -43,21 +43,21 @@ public class AddImageStoreCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name for the image store") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name for the image store") private String name; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, length = 2048, description = "the URL for the image store") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, length = 2048, description = "The URL for the image store") private String url; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the image store") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the image store") private Long zoneId; - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true, description = "the image store provider name") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true, description = "The image store provider name") private String providerName; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, - description = "the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss") + description = "The details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss") private Map details; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java index 2fe3c7cd106a..75fcf125eb10 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddImageStoreS3CMD.java @@ -27,7 +27,7 @@ import static org.apache.cloudstack.api.ApiConstants.S3_HTTPS_FLAG; import static org.apache.cloudstack.api.ApiConstants.S3_MAX_ERROR_RETRY; import static org.apache.cloudstack.api.ApiConstants.S3_SIGNER; -import static org.apache.cloudstack.api.ApiConstants.S3_SECRET_KEY; +import static org.apache.cloudstack.api.ApiConstants.SECRET_KEY; import static org.apache.cloudstack.api.ApiConstants.S3_SOCKET_TIMEOUT; import static org.apache.cloudstack.api.ApiConstants.S3_USE_TCP_KEEPALIVE; import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN; @@ -64,7 +64,7 @@ public final class AddImageStoreS3CMD extends BaseCmd implements ClientOptions { @Parameter(name = S3_ACCESS_KEY, type = STRING, required = true, description = "S3 access key") private String accessKey; - @Parameter(name = S3_SECRET_KEY, type = STRING, required = true, description = "S3 secret key") + @Parameter(name = SECRET_KEY, type = STRING, required = true, description = "S3 secret key") private String secretKey; @Parameter(name = S3_END_POINT, type = STRING, required = true, description = "S3 endpoint") @@ -101,7 +101,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE Map dm = new HashMap(); dm.put(ApiConstants.S3_ACCESS_KEY, getAccessKey()); - dm.put(ApiConstants.S3_SECRET_KEY, getSecretKey()); + dm.put(ApiConstants.SECRET_KEY, getSecretKey()); dm.put(ApiConstants.S3_END_POINT, getEndPoint()); dm.put(ApiConstants.S3_BUCKET_NAME, getBucketName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmd.java index b779ba2a2b47..460b8d642e90 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmd.java @@ -56,6 +56,9 @@ public class AddObjectStoragePoolCmd extends BaseCmd { @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the storage pool") private String tags; + @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the total size of the object store in GiB. Used for tracking capacity and sending alerts", since = "4.21") + private Long size; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -68,6 +71,10 @@ public String getName() { return name; } + public Long getTotalSize() { + return size; + } + public Map getDetails() { Map detailsMap = null; if (details != null && !details.isEmpty()) { @@ -112,7 +119,7 @@ public long getEntityOwnerId() { @Override public void execute(){ try{ - ObjectStore result = _storageService.discoverObjectStore(getName(), getUrl(), getProviderName(), getDetails()); + ObjectStore result = _storageService.discoverObjectStore(getName(), getUrl(), getTotalSize(), getProviderName(), getDetails()); ObjectStoreResponse storeResponse = null; if (result != null) { storeResponse = _responseGenerator.createObjectStoreResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java index 7e925f286d09..7b69d25caef4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java @@ -42,7 +42,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "the primary storage ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "The primary storage ID") private Long id; ///////////////////////////////////////////////////// @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "canceling maintenance for primary storage pool: " + getId(); + return "Canceling maintenance mode for primary storage pool with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ChangeStoragePoolScopeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ChangeStoragePoolScopeCmd.java index d3b6a0746106..3bb16dfea5a4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ChangeStoragePoolScopeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ChangeStoragePoolScopeCmd.java @@ -28,7 +28,6 @@ import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; -import com.cloud.storage.StoragePool; @APICommand(name = "changeStoragePoolScope", description = "Changes the scope of a storage pool when the pool is in Disabled state." + "This feature is officially tested and supported for Hypervisors: KVM and VMware, Protocols: NFS and Ceph, and Storage Provider: DefaultPrimary. " + @@ -61,15 +60,7 @@ public String getEventType() { @Override public String getEventDescription() { - String description = "Change storage pool scope. Storage pool Id: "; - StoragePool pool = _entityMgr.findById(StoragePool.class, getId()); - if (pool != null) { - description += pool.getUuid(); - } else { - description += getId(); - } - description += " to " + getScope(); - return description; + return "Changing storage pool with ID: " + getResourceUuid(ApiConstants.ID) + " to scope " + scope; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ConfigureStorageAccessCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ConfigureStorageAccessCmd.java new file mode 100644 index 000000000000..c5459adfd2d0 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ConfigureStorageAccessCmd.java @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.storage; + +import java.util.List; + +import com.cloud.event.EventTypes; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.ZoneResponse; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; + +import com.cloud.user.Account; + +@APICommand(name = "configureStorageAccess", description = "Configure the storage access groups on zone/pod/cluster/host and storage, accordingly connections to the storage pools", responseObject = SuccessResponse.class, since = "4.21.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class ConfigureStorageAccessCmd extends BaseAsyncCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "UUID of the zone") + private Long zoneId; + + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "UUID of the pod") + private Long podId; + + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "UUID of the cluster") + private Long clusterId; + + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "UUID of the host") + private Long hostId; + + @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "UUID of the Storage Pool") + private Long storageId; + + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, type = CommandType.LIST, collectionType = CommandType.STRING, + description = "comma separated list of storage access groups for connecting the storage pools and the hosts", + since = "4.21.0") + private List storageAccessGroups; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getZoneId() { + return zoneId; + } + + public Long getPodId() { + return podId; + } + + public Long getClusterId() { + return clusterId; + } + + public Long getHostId() { + return hostId; + } + + public Long getStorageId() { + return storageId; + } + + public List getStorageAccessGroups() { + return storageAccessGroups; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.StoragePool; + } + + @Override + public void execute() { + try { + boolean result = _storageService.configureStorageAccess(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure storage access"); + } + } catch (Exception e) { + logger.debug("Failed to configure storage access ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure storage access, " + e.getMessage()); + } + } + + @Override + public String getEventType() { + return EventTypes.EVENT_CONFIGURE_STORAGE_ACCESS; + } + + @Override + public String getEventDescription() { + return "Configuring storage access groups"; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java index 5776eb6464cf..e197e9f94f11 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateSecondaryStagingStoreCmd.java @@ -34,7 +34,7 @@ import com.cloud.storage.ImageStore; import com.cloud.user.Account; -@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class, +@APICommand(name = "createSecondaryStagingStore", description = "Create secondary staging store.", responseObject = ImageStoreResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSecondaryStagingStoreCmd extends BaseCmd { @@ -42,19 +42,19 @@ public class CreateSecondaryStagingStoreCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, description = "the URL for the staging store") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, description = "The URL for the staging store") private String url; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the staging store") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the staging store") private Long zoneId; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "the details for the staging store") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "The details for the staging store") private Map> details; - @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, required = false, description = "the scope of the staging store: zone only for now") + @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, required = false, description = "The scope of the staging store: zone only for now") private String scope; - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = false, description = "the staging store provider name") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = false, description = "The staging store provider name") private String providerName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java index 75813a7aabf5..2aef856f58f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java @@ -46,46 +46,50 @@ public class CreateStoragePoolCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster ID for the storage pool") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "The cluster ID for the storage pool") private Long clusterId; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "the details for the storage pool") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "The details for the storage pool") private Map details; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name for the storage pool") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name for the storage pool") private String storagePoolName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID for the storage pool") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID for the storage pool") private Long podId; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the storage pool") + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "The tags for the storage pool") private String tags; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL of the storage pool") + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, type = CommandType.STRING, + description = "comma separated list of storage access groups for connecting to hosts having those specific groups", since = "4.21.0") + private String storageAccessGroups; + + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The URL of the storage pool") private String url; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the Zone ID for the storage pool") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The Zone ID for the storage pool") private Long zoneId; - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = false, description = "the storage provider name") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = false, description = "The storage provider name") private String storageProviderName; - @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, required = false, description = "the scope of the storage: cluster or zone") + @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, required = false, description = "The scope of the storage: cluster or zone") private String scope; - @Parameter(name = ApiConstants.MANAGED, type = CommandType.BOOLEAN, required = false, description = "whether the storage should be managed by CloudStack") + @Parameter(name = ApiConstants.MANAGED, type = CommandType.BOOLEAN, required = false, description = "Whether the storage should be managed by CloudStack") private Boolean managed; @Parameter(name = ApiConstants.CAPACITY_IOPS, type = CommandType.LONG, required = false, description = "IOPS CloudStack can provision from this storage pool") private Long capacityIops; - @Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "bytes CloudStack can provision from this storage pool") + @Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "Bytes CloudStack can provision from this storage pool") private Long capacityBytes; @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = false, - description = "hypervisor type of the hosts in zone that will be attached to this storage pool. KVM, VMware supported as of now.") + description = "Hypervisor type of the hosts in zone that will be attached to this storage pool. KVM, VMware supported as of now.") private String hypervisor; @Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE) @@ -115,6 +119,10 @@ public String getTags() { return tags; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + public String getUrl() { return url; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java index a0c2731ccdaf..68d9f37df3f0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DeleteSecondaryStagingStoreCmd.java @@ -37,7 +37,7 @@ public class DeleteSecondaryStagingStoreCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, required = true, description = "the staging store ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, required = true, description = "The staging store ID") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmd.java index 92019e70eca2..1d927ac5cbd6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmd.java @@ -94,6 +94,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Downloading object at path " + getPath() + " on image store " + getStoreId(); + return "Downloading object at path " + getPath() + " on image store " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java index a45f72766dc6..7f5e864ed910 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java @@ -43,7 +43,7 @@ public class FindStoragePoolsForMigrationCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the volume") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the volume") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java index 5270569de44e..62d460c354c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListImageStoresCmd.java @@ -33,22 +33,22 @@ public class ListImageStoresCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the image store") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the image store") private String storeName; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the image store protocol") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The image store protocol") private String protocol; - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "the image store provider") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "The image store provider") private String provider; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the image store") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the image store") private Long zoneId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, description = "the ID of the storage pool") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, description = "The ID of the storage pool") private Long id; - @Parameter(name = ApiConstants.READ_ONLY, type = CommandType.BOOLEAN, entityType = ImageStoreResponse.class, description = "read-only status of the image store", since = "4.15.0") + @Parameter(name = ApiConstants.READ_ONLY, type = CommandType.BOOLEAN, entityType = ImageStoreResponse.class, description = "Read-only status of the image store", since = "4.15.0") private Boolean readonly; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java index 0cad16a247fd..31cd3519c5bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListSecondaryStagingStoresCmd.java @@ -35,19 +35,19 @@ public class ListSecondaryStagingStoresCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the staging store") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the staging store") private String storeName; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the staging store protocol") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The staging store protocol") private String protocol; - @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "the staging store provider") + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "The staging store provider") private String provider; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the staging store") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the staging store") private Long zoneId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, description = "the ID of the staging store") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class, description = "The ID of the staging store") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageAccessGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageAccessGroupsCmd.java new file mode 100644 index 000000000000..d2a1757839f9 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageAccessGroupsCmd.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.storage; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.StorageAccessGroupResponse; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.response.ListResponse; + +@APICommand(name = "listStorageAccessGroups", description = "Lists storage access groups", responseObject = StorageAccessGroupResponse.class, since = "4.21.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class ListStorageAccessGroupsCmd extends BaseListCmd { + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "Name of the Storage access group") + private String name; + + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// + + public String getName() { + return name; + } + + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.StoragePool; + } + + @Override + public void execute() { + ListResponse response = _queryService.searchForStorageAccessGroups(this); + + response.setResponseName(getCommandName()); + + setResponseObject(response); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java index 57a87939b6bd..236a3769b64c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java @@ -41,32 +41,32 @@ public class ListStoragePoolsCmd extends BaseListCmd { @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "list storage pools belongig to the specific cluster") + description = "List storage pools belonging to the specific cluster") private Long clusterId; - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "the IP address for the storage pool") + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "The IP address for the storage pool") private String ipAddress; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the storage pool") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the storage pool") private String storagePoolName; - @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "the storage pool path") + @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "The storage pool path") private String path; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID for the storage pool") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID for the storage pool") private Long podId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID for the storage pool") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the storage pool") private Long zoneId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "the ID of the storage pool") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "The ID of the storage pool") private Long id; - @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, entityType = StoragePoolResponse.class, description = "the scope of the storage pool") + @Parameter(name = ApiConstants.SCOPE, type = CommandType.STRING, entityType = StoragePoolResponse.class, description = "The scope of the storage pool") private String scope; - @Parameter(name = ApiConstants.STATUS, type = CommandType.STRING, description = "the status of the storage pool") + @Parameter(name = ApiConstants.STATUS, type = CommandType.STRING, description = "The status of the storage pool") private String status; @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "host ID of the storage pools") @@ -74,6 +74,10 @@ public class ListStoragePoolsCmd extends BaseListCmd { @Parameter(name = ApiConstants.STORAGE_CUSTOM_STATS, type = CommandType.BOOLEAN, description = "If true, lists the custom stats of the storage pool", since = "4.18.1") private Boolean customStats; + + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING, description = "the name of the storage access group", since = "4.21.0") + private String storageAccessGroup; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -134,6 +138,17 @@ public Boolean getCustomStats() { return customStats != null && customStats; } + public String getStorageAccessGroup() { + return storageAccessGroup; + } + + public ListStoragePoolsCmd() { + } + + public ListStoragePoolsCmd(String storageAccessGroup) { + this.storageAccessGroup = storageAccessGroup; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java index efe7a23b5cb4..f7d4c1078359 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/ListStorageProvidersCmd.java @@ -40,7 +40,7 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListStorageProvidersCmd extends BaseListCmd { - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the type of storage provider: either primary or image", required = true) + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "The type of storage provider: either primary or image", required = true) private String type; public String getType() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/MigrateSecondaryStorageDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/MigrateSecondaryStorageDataCmd.java index 8f5a7aced3fe..edd9c25fbc10 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/MigrateSecondaryStorageDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/MigrateSecondaryStorageDataCmd.java @@ -32,7 +32,7 @@ import com.cloud.event.EventTypes; @APICommand(name = "migrateSecondaryStorageData", - description = "migrates data objects from one secondary storage to destination image store(s)", + description = "Migrates data objects from one secondary storage to destination image store(s)", responseObject = MigrationResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, @@ -49,7 +49,7 @@ public class MigrateSecondaryStorageDataCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.SRC_POOL, type = CommandType.UUID, entityType = ImageStoreResponse.class, - description = "id of the image store from where the data is to be migrated", + description = "ID of the image store from where the data is to be migrated", required = true) private Long id; @@ -57,7 +57,7 @@ public class MigrateSecondaryStorageDataCmd extends BaseAsyncCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ImageStoreResponse.class, - description = "id(s) of the destination secondary storage pool(s) to which the templates are to be migrated", + description = "ID(s) of the destination secondary storage pool(s) to which the Templates are to be migrated", required = true) private List migrateTo; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java index 818b3a5bbeab..9f0efe7f7a1b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "preparing storage pool: " + getId() + " for maintenance"; + return "Preparing storage pool with ID: " + getResourceUuid(ApiConstants.ID) + " for maintenance"; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/SyncStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/SyncStoragePoolCmd.java index 9f81f2f6c86c..684243c08299 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/SyncStoragePoolCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/SyncStoragePoolCmd.java @@ -67,7 +67,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Attempting to synchronise storage pool with management server"; + return "Attempting to synchronise storage pool with ID:" + getResourceUuid(ApiConstants.ID) + " with management server"; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java index 5ac34f27bada..022bbb9a9057 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateCloudToUseObjectStoreCmd.java @@ -42,17 +42,17 @@ public class UpdateCloudToUseObjectStoreCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name for the image store") + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description = "The name for the image store") private String name; - @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the URL for the image store") + @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description = "The URL for the image store") private String url; @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, - required=true, description="the image store provider name") + required=true, description = "The image store provider name") private String providerName; - @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss") + @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description = "The details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss") private Map details; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateObjectStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateObjectStoragePoolCmd.java index 497179d25ef1..ac007137ef1f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateObjectStoragePoolCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateObjectStoragePoolCmd.java @@ -44,6 +44,8 @@ public class UpdateObjectStoragePoolCmd extends BaseCmd { @Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "the url for the object store") private String url; + @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the total size of the object store in GiB. Used for tracking capacity and sending alerts. Set to 0 to stop tracking.", since = "4.21") + private Long size; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -61,6 +63,10 @@ public String getUrl() { return url; } + public Long getSize() { + return size; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java index f2d7bbeb189e..4b0a6ba00b28 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java @@ -44,22 +44,22 @@ public class UpdateStoragePoolCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "the Id of the storage pool") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "The Id of the storage pool") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, entityType = StoragePoolResponse.class, description = "Change the name of the storage pool", since = "4.15") private String name; - @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "comma-separated list of tags for the storage pool") + @Parameter(name = ApiConstants.TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "Comma-separated list of tags for the storage pool") private List tags; @Parameter(name = ApiConstants.CAPACITY_IOPS, type = CommandType.LONG, required = false, description = "IOPS CloudStack can provision from this storage pool") private Long capacityIops; - @Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "bytes CloudStack can provision from this storage pool") + @Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, required = false, description = "Bytes CloudStack can provision from this storage pool") private Long capacityBytes; - @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, description = "false to disable the pool for allocation of new volumes, true to" + + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, description = "False to disable the pool for allocation of new volumes, true to" + " enable it back.") private Boolean enabled; @@ -153,6 +153,8 @@ public void execute() { if (ObjectUtils.anyNotNull(name, capacityIops, capacityBytes, url, isTagARule, tags) || MapUtils.isNotEmpty(details)) { result = _storageService.updateStoragePool(this); + } else { + result = _storageService.getStoragePool(getId()); } if (enabled != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java index bd72f3213de1..cc0c77348a90 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java @@ -40,13 +40,13 @@ public class AddSwiftCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for swift") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The URL for swift") private String url; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account for swift") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account for swift") private String account; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username for swift") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "The username for swift") private String username; @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = " key for the user for swift") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java index e21a23349bb5..6645cd60023c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java @@ -35,7 +35,7 @@ public class ListSwiftsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the id of the swift") + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "The id of the swift") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java index 7e0faab2fb50..6b776d067784 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java @@ -33,7 +33,7 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroys a system virtual machine.", entityType = {VirtualMachine.class}, +@APICommand(name = "destroySystemVm", responseObject = SystemVmResponse.class, description = "Destroys a System VM.", entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DestroySystemVmCmd extends BaseAsyncCmd { @@ -43,7 +43,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, - description = "The ID of the system virtual machine") + description = "The ID of the System VM") private Long id; public Long getId() { @@ -76,7 +76,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "destroying system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Destroying System VM with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -91,14 +91,14 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("System VM ID: " + getResourceUuid(ApiConstants.ID)); VirtualMachine instance = _mgr.destroySystemVM(this); if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy System VM"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java index e8e5ee0ebad6..d339df850168 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.List; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -31,11 +30,13 @@ import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine; -@APICommand(name = "listSystemVms", description = "List system virtual machines.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "listSystemVms", description = "List System VMs.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSystemVMsCmd extends BaseListCmd { @@ -44,36 +45,41 @@ public class ListSystemVMsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the host ID of the system VM") + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "The host ID of the system VM") private Long hostId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, description = "the ID of the system VM") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, description = "The ID of the system VM") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the system VM") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the system VM") private String systemVmName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID of the system VM") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID of the system VM") private Long podId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "the state of the system VM") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the system VM") private String state; @Parameter(name = ApiConstants.SYSTEM_VM_TYPE, type = CommandType.STRING, - description = "the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".") + description = "The system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".") private String systemVmType; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the system VM") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID of the system VM") private Long zoneId; @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, - description = "the storage ID where vm's volumes belong to", + description = "The storage ID where Instance's volumes belong to", since = "3.0.1") private Long storageId; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, + description = "CPU arch of the system VM", + since = "4.20.1") + private String arch; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -110,6 +116,10 @@ public Long getStorageId() { return storageId; } + public CPU.CPUArch getArch() { + return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java index ccc6093aa834..feeb3f44553d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java @@ -43,7 +43,7 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a system virtual machine to the host specified.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "migrateSystemVm", description = "Attempts Migration of a System VM to the host specified.", responseObject = SystemVmResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class MigrateSystemVMCmd extends BaseAsyncCmd { @@ -55,7 +55,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "destination Host ID to migrate VM to") + description = "Destination Host ID to migrate Instance to") private Long hostId; @ACL(accessType = AccessType.OperateEntry) @@ -63,14 +63,14 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, - description = "the ID of the virtual machine") + description = "The ID of the Instance") private Long virtualMachineId; @Parameter(name = ApiConstants.STORAGE_ID, since = "4.16.0", type = CommandType.UUID, entityType = StoragePoolResponse.class, - description = "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume") + description = "Destination storage pool ID to migrate Instance volumes to. Required for migrating the root disk volume") private Long storageId; @Parameter(name = ApiConstants.AUTO_SELECT, @@ -120,7 +120,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()); + return "Attempting to migrate System VM with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } @Override @@ -136,24 +136,24 @@ public void execute() { // OfflineMigration performed when this parameter is specified StoragePool destStoragePool = _storageService.getStoragePool(getStorageId()); if (destStoragePool == null) { - throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM"); + throw new InvalidParameterValueException("Unable to find the storage pool to migrate the Instance"); } - CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to storage pool Id: " + getStorageId()); + CallContext.current().setEventDetails("System VM ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to storage pool with ID: " + getResourceUuid(ApiConstants.STORAGE_ID)); migratedVm = _userVmService.vmStorageMigration(getVirtualMachineId(), destStoragePool); } else { Host destinationHost = null; if (getHostId() != null) { destinationHost =_resourceService.getHost(getHostId()); if (destinationHost == null) { - throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId()); + throw new InvalidParameterValueException("Unable to find the host to migrate the Instance, host id=" + getHostId()); } if (destinationHost.getType() != Host.Type.Routing) { - throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one"); + throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the Instance, please specify another one"); } } else if (! isAutoSelect()) { throw new InvalidParameterValueException("Please specify a host or storage as destination, or pass 'autoselect=true' to automatically select a destination host which do not require storage migration"); } - CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId()); + CallContext.current().setEventDetails("System VM ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID)); if (destinationHost == null) { migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), null); } else { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/PatchSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/PatchSystemVMCmd.java index 4f4b26316673..13f6167513b0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/PatchSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/PatchSystemVMCmd.java @@ -19,7 +19,6 @@ import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.utils.Pair; -import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -40,13 +39,13 @@ public class PatchSystemVMCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, - description = "patches systemVM - CPVM/SSVM with the specified ID") + description = "Patches System VM - CPVM/SSVM with the specified ID") private Long id; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "If true, initiates copy of scripts and restart of the agent, even if the scripts version matches." + "To be used with ID parameter only") - private Boolean force; + private Boolean forced; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -58,7 +57,7 @@ public Long getId() { } public boolean isForced() { - return force != null && force; + return forced != null && forced; } ///////////////////////////////////////////////////// @@ -72,7 +71,7 @@ public String getEventType() { @Override public String getEventDescription() { - return String.format("Attempting to live patch System VM with Id: %s ", this._uuidMgr.getUuid(VirtualMachine.class, getId())); + return String.format("Attempting to live patch System VM with ID: %s ", getResourceUuid(ApiConstants.ID)); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java index 30bd51184ac3..0a0ffe847adc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java @@ -46,10 +46,10 @@ public class RebootSystemVmCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, - description = "The ID of the system virtual machine") + description = "The ID of the System VM") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force reboot the system VM (System VM is Stopped and then Started)", since = "4.16.0") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force reboot the System VM (System VM is Stopped and then Started)", since = "4.16.0") private Boolean forced; ///////////////////////////////////////////////////// @@ -86,7 +86,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "rebooting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Rebooting System VM with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -105,14 +105,14 @@ public boolean isForced() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); VirtualMachine result = _mgr.rebootSystemVM(this); if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot System Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java index 06e57674c537..061a2ad2deed 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java @@ -55,10 +55,10 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm") private Long id; - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the service offering ID to apply to the system vm") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "The service offering ID to apply to the system vm") private Long serviceOfferingId; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") private Map details; ///////////////////////////////////////////////////// @@ -74,7 +74,7 @@ public Long getServiceOfferingId() { } public Map getDetails() { - return details; + return convertDetailsToMap(details); } ///////////////////////////////////////////////////// @@ -98,7 +98,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("SystemVm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("System VM ID: " + getResourceUuid(ApiConstants.ID)); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { @@ -137,6 +137,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Upgrading system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId()); + return "Upgrading System VM with ID: " + getResourceUuid(ApiConstants.ID) + " to service offering: " + getResourceUuid(ApiConstants.SERVICE_OFFERING_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java index eac3d64ab59e..734b553c2dd5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java @@ -33,7 +33,7 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a system virtual machine.", entityType = {VirtualMachine.class}, +@APICommand(name = "startSystemVm", responseObject = SystemVmResponse.class, description = "Starts a System VM.", entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class StartSystemVMCmd extends BaseAsyncCmd { @@ -46,7 +46,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, - description = "The ID of the system virtual machine") + description = "The ID of the System VM") private Long id; ///////////////////////////////////////////////////// @@ -87,7 +87,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "starting system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Starting System VM with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -102,7 +102,7 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); VirtualMachine instance = _mgr.startSystemVM(getId()); if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java index 1d84382f5d22..bdcb5b407b39 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java @@ -49,10 +49,10 @@ public class StopSystemVmCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, - description = "The ID of the system virtual machine") + description = "The ID of the System VM") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the VM is stopped and should be marked as such.") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the Instance (Instance is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted). To be used if the caller knows the Instance is stopped and should be marked as such.") private Boolean forced; ///////////////////////////////////////////////////// @@ -89,7 +89,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "stopping system vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Stopping System VM with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -108,7 +108,7 @@ public boolean isForced() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); VirtualMachine result = _mgr.stopSystemVM(this); if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 5abe90e3f589..a27c04374c32 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -46,13 +46,13 @@ public class UpgradeSystemVMCmd extends BaseCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the System VM") private Long id; - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the service offering ID to apply to the system vm") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "The service offering ID to apply to the System VM") private Long serviceOfferingId; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") private Map details; ///////////////////////////////////////////////////// @@ -68,7 +68,7 @@ public Long getServiceOfferingId() { } public Map getDetails() { - return details; + return convertDetailsToMap(details); } ///////////////////////////////////////////////////// @@ -87,7 +87,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { @@ -100,7 +100,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot System VM"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java index b937e0b940cc..8e2854db308d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CopyTemplateCmdByAdmin.java @@ -21,6 +21,6 @@ import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, +@APICommand(name = "copyTemplate", description = "Copies a Template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CopyTemplateCmdByAdmin extends CopyTemplateCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java index 12609493b637..18a17c861ad1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/CreateTemplateCmdByAdmin.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. " - + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Full, +@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a Template of an Instance. " + "The Instance must be in a STOPPED state. " + + "A Template created from this command is automatically designated as a private Template visible to the account that created it.", responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateTemplateCmdByAdmin extends CreateTemplateCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java index ae0e220b4952..6115ff98f38a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatePermissionsCmdByAdmin.java @@ -1,4 +1,4 @@ -// Licensedname = "listTemplatePermissions", to the Apache Software Foundation (ASF) under one +// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.command.user.template.ListTemplatePermissionsCmd; import org.apache.cloudstack.api.response.TemplatePermissionsResponse; -@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Full, +@APICommand(name = "listTemplatePermissions", description = "List Template visibility and all accounts that have permissions to view this Template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTemplatePermissionsCmdByAdmin extends ListTemplatePermissionsCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java index 22eb0ff06599..54c0c8f702d5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/ListTemplatesCmdByAdmin.java @@ -28,7 +28,7 @@ import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", +@APICommand(name = "listTemplates", description = "List all public, private, and privileged Templates.", responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTemplatesCmdByAdmin extends ListTemplatesCmd implements AdminCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java index 9a59efb19f2a..136522d6bf80 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java @@ -34,7 +34,7 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "load template into primary storage", entityType = {VirtualMachineTemplate.class}, +@APICommand(name = "prepareTemplate", responseObject = TemplateResponse.class, description = "Load Template into primary storage", entityType = {VirtualMachineTemplate.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class PrepareTemplateCmd extends BaseCmd { @@ -47,7 +47,7 @@ public class PrepareTemplateCmd extends BaseCmd { type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "zone ID of the template to be prepared in primary storage(s).") + description = "Zone ID of the Template to be prepared in primary storage(s).") private Long zoneId; @ACL(accessType = AccessType.OperateEntry) @@ -55,7 +55,7 @@ public class PrepareTemplateCmd extends BaseCmd { type = CommandType.UUID, entityType = TemplateResponse.class, required = true, - description = "template ID of the template to be prepared in primary storage(s).") + description = "Template ID of the Template to be prepared in primary storage(s).") private Long templateId; @ACL(accessType = AccessType.OperateEntry) @@ -63,7 +63,7 @@ public class PrepareTemplateCmd extends BaseCmd { type = CommandType.UUID, entityType = StoragePoolResponse.class, required = false, - description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" + + description = "Storage pool ID of the primary storage pool to which the Template should be prepared. If it is not provided the Template" + " is prepared on all the available primary storage pools.") private Long storageId; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java index 91c0dd50e8e3..3eeb9ba7c737 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/RegisterTemplateCmdByAdmin.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, +@APICommand(name = "registerTemplate", description = "Registers an existing Template into the CloudStack cloud.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RegisterTemplateCmdByAdmin extends RegisterTemplateCmd implements AdminCmd { } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java index b1dfae3ed83f..b75a2c0755db 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/template/UpdateTemplateCmdByAdmin.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd; import org.apache.cloudstack.api.response.TemplateResponse; -@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, +@APICommand(name = "updateTemplate", description = "Updates attributes of a Template.", responseObject = TemplateResponse.class, responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTemplateCmdByAdmin extends UpdateTemplateCmd implements AdminCmd { } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java index b1810676b744..50abd953e63f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java @@ -46,10 +46,10 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, - description = "the Physical Network ID") + description = "The Physical Network ID") private Long physicalNetworkId; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, required = true, description = "the trafficType to be added to the physical network") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, required = true, description = "The trafficType to be added to the physical network") private String trafficType; @Parameter(name = ApiConstants.XENSERVER_NETWORK_LABEL, @@ -80,7 +80,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The VLAN id to be used for Management traffic by VMware host") private String vlan; - @Parameter(name=ApiConstants.ISOLATION_METHOD, type=CommandType.STRING, description="Used if physical network has multiple isolation types and traffic type is public." + @Parameter(name=ApiConstants.ISOLATION_METHOD, type=CommandType.STRING, description = "Used if physical network has multiple isolation types and traffic type is public." + " Choose which isolation method. Valid options currently 'vlan' or 'vxlan', defaults to 'vlan'.") private String isolationMethod; @@ -148,7 +148,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("TrafficType Id: " + getEntityId()); + CallContext.current().setEventDetails("Traffic type ID: " + getEntityUuid()); PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId()); if (result != null) { TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java index a1e4ebda09a3..3f07020e5fa2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java @@ -38,7 +38,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TrafficTypeResponse.class, required = true, description = "traffic type id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TrafficTypeResponse.class, required = true, description = "Traffic type ID") private Long id; ///////////////////////////////////////////////////// @@ -71,7 +71,7 @@ public void execute() { @Override public String getEventDescription() { - return "Deleting Traffic Type: " + getId(); + return "Deleting Traffic Type with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java index ed42bc42dbd1..03e17631ba8a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java @@ -38,7 +38,7 @@ public class ListTrafficMonitorsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "zone Id") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "Zone ID") private long zoneId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java index d106a736fcab..dc6e0f5dd69d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java @@ -26,14 +26,13 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; -import org.apache.cloudstack.api.response.ProviderResponse; import org.apache.cloudstack.api.response.TrafficTypeResponse; import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.user.Account; import com.cloud.utils.Pair; -@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0", +@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = TrafficTypeResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTrafficTypesCmd extends BaseListCmd { @@ -44,7 +43,7 @@ public class ListTrafficTypesCmd extends BaseListCmd { type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, required = true, - description = "the Physical Network ID") + description = "The Physical Network ID") private Long physicalNetworkId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java index c7b3c2b433b4..29b06a3b5259 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java @@ -39,7 +39,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TrafficTypeResponse.class, required = true, description = "traffic type id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TrafficTypeResponse.class, required = true, description = "Traffic type ID") private Long id; @Parameter(name = ApiConstants.XENSERVER_NETWORK_LABEL, @@ -118,7 +118,7 @@ public void execute() { @Override public String getEventDescription() { - return "Updating Traffic Type: " + getId(); + return "Updating Traffic Type with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index e2a2baecc866..684103cf8d39 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -26,6 +26,7 @@ import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang3.StringUtils; import com.cloud.user.Account; @@ -52,13 +53,13 @@ public class CreateUserCmd extends BaseCmd { description = "Creates the user under the specified domain. Has to be accompanied with the account parameter") private Long domainId; - @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "email") + @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "Email") private String email; - @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "firstname") + @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "Firstname") private String firstname; - @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "lastname") + @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "Lastname") private String lastname; @Parameter(name = ApiConstants.PASSWORD, @@ -78,6 +79,12 @@ public class CreateUserCmd extends BaseCmd { @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system") private String userUUID; + @Parameter(name = ApiConstants.PASSWORD_CHANGE_REQUIRED, + type = CommandType.BOOLEAN, + description = "Provide true to mandate the User to reset password on next login.", + since = "4.23.0") + private Boolean passwordChangeRequired; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -118,6 +125,10 @@ public String getUserUUID() { return userUUID; } + public Boolean isPasswordChangeRequired() { + return BooleanUtils.isTrue(passwordChangeRequired); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -147,7 +158,7 @@ public void execute() { CallContext.current().setEventDetails("UserName: " + getUserName() + ", FirstName :" + getFirstName() + ", LastName: " + getLastName()); User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), - getUserUUID()); + getUserUUID(), isPasswordChangeRequired()); if (user != null) { UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java index ddf21affb535..01886187f9b9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java @@ -42,7 +42,7 @@ public class DeleteUserCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "id of the user to be deleted") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user to be deleted") private Long id; @Inject @@ -82,7 +82,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("UserId: " + getId()); + CallContext.current().setEventDetails("User ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _regionService.deleteUser(this); if (!result) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user"); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserKeysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserKeysCmd.java new file mode 100644 index 000000000000..6cf55514ba36 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DeleteUserKeysCmd.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.user; + +import com.cloud.event.EventTypes; +import com.cloud.user.Account; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; +import org.apache.cloudstack.api.response.SuccessResponse; + +@APICommand(name = "deleteUserKeys", description = "Deletes a keypair from a user", responseObject = SuccessResponse.class, + since = "4.23.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class DeleteUserKeysCmd extends BaseAsyncCmd { + @ACL + @Parameter(name = ApiConstants.KEYPAIR_ID, type = CommandType.UUID, entityType = ApiKeyPairResponse.class, required = true, description = "ID of the keypair to be deleted.") + private Long id; + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.User; + } + + @Override + public long getEntityOwnerId() { + ApiKeyPair keyPair = apiKeyPairService.findById(id); + if (keyPair != null) { + return keyPair.getAccountId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + public Long getId() { + return id; + } + + @Override + public void execute() { + _accountService.deleteApiKey(this); + + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_DELETE_SECRET_API_KEY; + } + + @Override + public String getEventDescription() { + ApiKeyPair keyPair = apiKeyPairService.findById(id); + return String.format("Deleting API key pair with ID [%s]%s", + keyPair == null ? id : keyPair.getUuid(), + keyPair == null ? "." : String.format(" and name [%s].", keyPair.getName())); + } + + @Override + public Long getSyncObjId() { + return getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java index 974c1c7bebed..cc2bc0906a24 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java @@ -78,12 +78,12 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "disabling user: " + getId(); + return "Disabling User with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("UserId: " + getId()); + CallContext.current().setEventDetails("User ID: " + getResourceUuid(ApiConstants.ID)); UserAccount user = _regionService.disableUser(this); if (user != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java index 77d8d530daf2..9141a9bccf8a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java @@ -71,7 +71,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("UserId: " + getId()); + CallContext.current().setEventDetails("User ID: " + getResourceUuid(ApiConstants.ID)); UserAccount user = _regionService.enableUser(this); if (user != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java index 3427cef33661..a3dcf08c3a31 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.UserResponse; - +import org.apache.cloudstack.api.ApiArgValidator; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.UserAccount; @@ -35,7 +35,7 @@ public class GetUserCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.USER_API_KEY, type = CommandType.STRING, required = true, description = "API key of the user") + @Parameter(name = ApiConstants.USER_API_KEY, type = CommandType.STRING, required = true, description = "API key of the user", validations = {ApiArgValidator.NotNullOrEmpty}) private String apiKey; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java index cdd239f72b57..a651befcff7e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java @@ -26,39 +26,39 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.RegisterResponse; +import org.apache.cloudstack.api.response.RegisterUserKeyResponse; import org.apache.cloudstack.api.response.UserResponse; import java.util.Map; @APICommand(name = "getUserKeys", - description = "This command allows the user to query the seceret and API keys for the account", - responseObject = RegisterResponse.class, - requestHasSensitiveInfo = false, - responseHasSensitiveInfo = true, - authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin}, - since = "4.10.0") - -public class GetUserKeysCmd extends BaseCmd{ - - @Parameter(name= ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user whose keys are required") + description = "Queries the last registered secret and API keys of a user.", + responseObject = RegisterUserKeyResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true, + authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin}, + since = "4.10.0") +public class GetUserKeysCmd extends BaseCmd { + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user whose keys are required") private Long id; - - public Long getID(){ + public Long getId() { return id; - }public long getEntityOwnerId(){ - User user = _entityMgr.findById(User.class, getID()); - if(user != null){ + } + + public long getEntityOwnerId() { + User user = _entityMgr.findById(User.class, getId()); + if (user != null) { return user.getAccountId(); } - else return Account.ACCOUNT_ID_SYSTEM; + return Account.ACCOUNT_ID_SYSTEM; } - public void execute(){ + + public void execute() { Pair> keys = _accountService.getKeys(this); - RegisterResponse response = new RegisterResponse(); - if(keys != null){ + RegisterUserKeyResponse response = new RegisterUserKeyResponse(); + if (keys != null){ response.setApiKeyAccess(keys.first()); response.setApiKey(keys.second().get("apikey")); response.setSecretKey(keys.second().get("secretkey")); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeyRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeyRulesCmd.java new file mode 100644 index 000000000000..4345cae92911 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeyRulesCmd.java @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.user; + + +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; +import org.apache.cloudstack.api.response.BaseRolePermissionResponse; +import org.apache.cloudstack.api.response.ListResponse; + +import java.util.List; + +@APICommand(name = "listUserKeyRules", + description = "Lists the rules defined for a API key pair.", + responseObject = BaseRolePermissionResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.23.0") +public class ListUserKeyRulesCmd extends BaseCmd { + @ACL + @Parameter(name = ApiConstants.KEYPAIR_ID, type = CommandType.UUID, entityType = ApiKeyPairResponse.class, description = "ID of the key pair.", required = true) + private Long id; + + public Long getId() { + return id; + } + + public long getEntityOwnerId() { + ApiKeyPair keyPair = apiKeyPairService.findById(getId()); + if (keyPair != null) { + return keyPair.getAccountId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { + List permissions = _accountService.listKeyRules(this); + ListResponse response = _responseGenerator.createKeypairPermissionsResponse(permissions); + response.setResponseName(getCommandName()); + setResponseObject(response); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeysCmd.java new file mode 100644 index 000000000000..ded05d6381a0 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUserKeysCmd.java @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.user; + + +import com.cloud.user.Account; +import com.cloud.user.UserAccount; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; +import org.apache.cloudstack.api.response.UserResponse; + +@APICommand(name = "listUserKeys", + description = "Lists the API key pairs (API and secret keys) of a user.", + responseObject = ApiKeyPairResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = true, + authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin}, + since = "4.23.0") +public class ListUserKeysCmd extends BaseListCmd { + @ACL + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "ID of the user that owns the keys.") + private Long userId; + + @ACL + @Parameter(name = ApiConstants.KEYPAIR_ID, type = CommandType.UUID, entityType = ApiKeyPairResponse.class, description = "ID of the key pair.") + private Long keyPairId; + + @Parameter(name = ApiConstants.API_KEY_FILTER, type = CommandType.STRING, description = "API key of the key pair.") + private String apiKeyFilter; + + @Parameter(name = ApiConstants.SHOW_PERMISSIONS, type = CommandType.BOOLEAN, description = "Whether API Key rules should be returned. Defaults to false.") + private boolean showPermissions = false; + + @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin}, + description = "Lists all API key pairs of users that are accessible by the calling account. Only available for administrators. Defaults to false.") + private boolean listAll = false; + + public Long getUserId() { + return userId; + } + + public Long getKeyId() { + return keyPairId; + } + + public String getApiKeyFilter() { + return apiKeyFilter; + } + + public Boolean getShowPermissions() { + return showPermissions; + } + + public boolean getListAll() { + return listAll; + } + + public long getEntityOwnerId() { + if (getKeyId() != null) { + ApiKeyPair keypair = apiKeyPairService.findById(getKeyId()); + if (keypair != null) { + return keypair.getAccountId(); + } + } else if (getUserId() != null) { + UserAccount userAccount = _accountService.getUserAccountById(getUserId()); + if (userAccount != null) { + return userAccount.getAccountId(); + } + } + return Account.ACCOUNT_ID_SYSTEM; + } + + public void execute() { + ListResponse finalResponse = _accountService.listKeys(this); + finalResponse.setObjectName("userkeys"); + finalResponse.setResponseName(getCommandName()); + setResponseObject(finalResponse); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java index 2f29b1ec1e4d..0fe83fd0796c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java @@ -63,7 +63,7 @@ public class ListUsersCmd extends BaseListAccountResourcesCmd implements UserCmd private String apiKeyAccess; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for users") + description = "Flag to display the resource icon for users") private Boolean showIcon; @Parameter(name = ApiConstants.USER_SOURCE, type = CommandType.STRING, since = "4.21.0.0", diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java index e57258a45711..aab20f108f9e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/MoveUserCmd.java @@ -54,7 +54,7 @@ public class MoveUserCmd extends BaseCmd { type = CommandType.UUID, entityType = UserResponse.class, required = true, - description = "id of the user to be moved.") + description = "ID of the user to be moved.") private Long id; @Parameter(name = ApiConstants.ACCOUNT, @@ -116,7 +116,7 @@ public void execute() { Preconditions.checkNotNull(getId(),"I have to have an user to move!"); Preconditions.checkState(ObjectUtils.anyNotNull(getAccountId(),getAccountName()),"provide either an account name or an account id!"); - CallContext.current().setEventDetails("UserId: " + getId()); + CallContext.current().setEventDetails("User ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _regionService.moveUser(this); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterUserKeysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterUserKeysCmd.java new file mode 100644 index 000000000000..11d7c1d2ffab --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterUserKeysCmd.java @@ -0,0 +1,209 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.user; + +import com.cloud.event.EventTypes; +import com.cloud.user.Account; +import com.cloud.user.User; +import org.apache.cloudstack.acl.Rule; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.commons.lang3.StringUtils; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ApiKeyPairResponse; +import org.apache.cloudstack.api.response.UserResponse; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@APICommand(name = "registerUserKeys", + responseObject = ApiKeyPairResponse.class, + description = "Registers an API key pair (API and secret keys) for a user.", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) +public class RegisterUserKeysCmd extends BaseAsyncCmd { + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user.") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "API key pair name.") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "API key pair description.") + private String description; + + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Start date of the API key pair. " + + ApiConstants.PARAMETER_DESCRIPTION_START_DATE_POSSIBLE_FORMATS) + private Date startDate; + + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "Expiration date of the API key pair. " + + ApiConstants.PARAMETER_DESCRIPTION_END_DATE_POSSIBLE_FORMATS) + private Date endDate; + + @Parameter(name = ApiConstants.RULES, type = CommandType.MAP, description = "The rules of the API key pair. If no rules are informed, " + + "defaults to allowing all account permissions. Otherwise, only the explicitly informed permissions for the key pair will be " + + "considered. Lower indexed rules take precedence over higher. Thus, in the following example: " + + "\"rules[0].rule=deleteUserKeys rules[0].permission=deny rules[1].rule=*UserKey* rules[1].permission=allow\", all rules matching " + + "the expression \"*UserKeys*\" will be allowed, except for \"deleteUserKeys\".") + private Map rules; + + public void setUserId(Long userId) { + this.id = userId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public void setRules(Map rules) { + this.rules = rules; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public List> getRules() { + List> rulesDetails = new ArrayList<>(); + + if (rules == null) { + return rulesDetails; + } + + for (Object ruleObject : rules.values()) { + HashMap detail = (HashMap) ruleObject; + Map ruleDetails = new HashMap<>(); + + String rule = detail.get(ApiConstants.RULE); + if (StringUtils.isEmpty(rule)) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty rule has been provided in the [rules] parameter."); + } + + String permission = detail.get(ApiConstants.PERMISSION); + if (StringUtils.isEmpty(permission)) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Rule [%s] has no permission associated with it," + + " please specify if it is either [allow] or [deny].", rule)); + } + ruleDetails.put(ApiConstants.RULE, new Rule(rule)); + ruleDetails.put(ApiConstants.PERMISSION, roleService.getRolePermission(permission)); + + String description = detail.get(ApiConstants.DESCRIPTION); + if (StringUtils.isNotEmpty(description)) { + ruleDetails.put(ApiConstants.DESCRIPTION, description); + } + + rulesDetails.add(ruleDetails); + } + return rulesDetails; + } + + @Override + public long getEntityOwnerId() { + User user = _entityMgr.findById(User.class, getUserId()); + List accessibleUsers = _queryService.searchForAccessibleUsers(); + if (user != null && accessibleUsers.stream().anyMatch(u -> u == user.getId())) { + return user.getAccountId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + public Long getUserId() { + return id; + } + + @Override + public Long getApiResourceId() { + User user = _entityMgr.findById(User.class, getUserId()); + if (user != null) { + return user.getId(); + } + return null; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.User; + } + + @Override + public void execute() { + ApiKeyPair apiKeyPair = _accountService.createApiKeyAndSecretKey(this); + ApiKeyPairResponse response = new ApiKeyPairResponse(); + if (apiKeyPair != null) { + response = _responseGenerator.createKeyPairResponse(apiKeyPair); + } + response.setObjectName("userkeys"); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_REGISTER_FOR_SECRET_API_KEY; + } + + @Override + public String getEventDescription() { + String userUuid = getResourceUuid(ApiConstants.ID); + return String.format("Registering API keypair for user [%s].", userUuid == null ? id : userUuid); + } + + @Override + public String getSyncObjType() { + return BaseAsyncCmd.user; + } + + @Override + public Long getSyncObjId() { + return getUserId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java index 3d7f51ae2204..3f5ce2415022 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.region.RegionService; +import org.apache.commons.lang.BooleanUtils; import com.cloud.user.Account; import com.cloud.user.User; @@ -38,24 +39,26 @@ requestHasSensitiveInfo = true, responseHasSensitiveInfo = true) public class UpdateUserCmd extends BaseCmd { + @Inject + private RegionService _regionService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.USER_API_KEY, type = CommandType.STRING, description = "The API key for the user. Must be specified with userSecretKey") - private String apiKey; + @Parameter(name = ApiConstants.USER_API_KEY, type = CommandType.STRING, description = "Updates the latest API key of the user. Must be specified with usersecretkey") + private String userApiKey; - @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "email") + @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "Email") private String email; - @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, description = "first name") + @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, description = "First name") private String firstname; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "User uuid") private Long id; - @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, description = "last name") + @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, description = "Last name") private String lastname; @Parameter(name = ApiConstants.PASSWORD, @@ -67,8 +70,8 @@ public class UpdateUserCmd extends BaseCmd { @Parameter(name = ApiConstants.CURRENT_PASSWORD, type = CommandType.STRING, description = "Current password that was being used by the user. You must inform the current password when updating the password.", acceptedOnAdminPort = false) private String currentPassword; - @Parameter(name = ApiConstants.USER_SECRET_KEY, type = CommandType.STRING, description = "The secret key for the user. Must be specified with userApiKey") - private String secretKey; + @Parameter(name = ApiConstants.USER_SECRET_KEY, type = CommandType.STRING, description = "Updates the latest secret key of the user. Must be specified with userapikey.") + private String userSecretKey; @Parameter(name = ApiConstants.API_KEY_ACCESS, type = CommandType.STRING, description = "Determines if Api key access for this user is enabled, disabled or inherits the value from its parent, the owning account", since = "4.20.1.0", authorized = {RoleType.Admin}) private String apiKeyAccess; @@ -85,15 +88,18 @@ public class UpdateUserCmd extends BaseCmd { "This parameter is only used to mandate 2FA, not to disable 2FA", since = "4.18.0.0") private Boolean mandate2FA; - @Inject - private RegionService _regionService; + @Parameter(name = ApiConstants.PASSWORD_CHANGE_REQUIRED, + type = CommandType.BOOLEAN, + description = "Provide true to mandate the User to reset password on next login.", + since = "4.23.0") + private Boolean passwordChangeRequired; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// public String getApiKey() { - return apiKey; + return userApiKey; } public String getEmail() { @@ -121,7 +127,7 @@ public String getCurrentPassword() { } public String getSecretKey() { - return secretKey; + return userSecretKey; } public String getApiKeyAccess() { @@ -156,7 +162,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("UserId: " + getId()); + CallContext.current().setEventDetails("User ID: " + getResourceUuid(ApiConstants.ID)); UserAccount user = _regionService.updateUser(this); if (user != null) { @@ -193,4 +199,8 @@ public Long getApiResourceId() { public ApiCommandResourceType getApiResourceType() { return ApiCommandResourceType.User; } + + public Boolean isPasswordChangeRequired() { + return BooleanUtils.isTrue(passwordChangeRequired); + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java index c0ba99a82333..67278991383c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java @@ -16,7 +16,10 @@ // under the License. package org.apache.cloudstack.api.command.admin.vlan; +import com.cloud.configuration.ConfigurationService; +import com.cloud.network.Network; import com.cloud.utils.net.NetUtils; +import com.cloud.utils.StringUtils; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -39,7 +42,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -import java.util.Objects; @APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -52,70 +54,70 @@ public class CreateVlanIpRangeCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "account who will own the VLAN. If VLAN is Zone wide, this parameter should be omitted") + description = "Account who will own the VLAN. If VLAN is Zone wide, this parameter should be omitted") private String accountName; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "project who will own the VLAN. If VLAN is Zone wide, this parameter should be omitted") + description = "Project who will own the VLAN. If VLAN is Zone wide, this parameter should be omitted") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a VLAN") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the Account owning a VLAN") private Long domainId; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address in the VLAN IP range") + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address in the VLAN IP range") private String endIp; - @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "true if VLAN is of Virtual type, false if Direct") + @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "True if VLAN is of Virtual type, false if Direct") private Boolean forVirtualNetwork; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "the gateway of the VLAN IP range") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "The gateway of the VLAN IP range") private String gateway; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask of the VLAN IP range") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask of the VLAN IP range") private String netmask; @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, - description = "optional parameter. Have to be specified for Direct Untagged vlan only.") + description = "Optional parameter. Have to be specified for Direct Untagged vlan only.") private Long podId; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the beginning IP address in the VLAN IP range") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The beginning IP address in the VLAN IP range") private String startIp; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the ID or VID of the VLAN. If not specified," + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The ID or VID of the VLAN. If not specified," + " will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged") private String vlan; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the VLAN IP range") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID of the VLAN IP range") private Long zoneId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the network id") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The Network ID") private Long networkID; - @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the physical network id") + @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "The physical network ID") private Long physicalNetworkId; - @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "the beginning IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "The beginning IPv6 address in the IPv6 network range") private String startIpv6; - @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "the ending IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "The ending IPv6 address in the IPv6 network range") private String endIpv6; - @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "the gateway of the IPv6 network. Required " + @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "The gateway of the IPv6 network. Required " + "for Shared networks and Isolated networks when it belongs to VPC") private String ip6Gateway; - @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "the CIDR of IPv6 network, must be at least /64") + @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "The CIDR of IPv6 network, must be at least /64") private String ip6Cidr; - @Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not") + @Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "True if IP range is set to System VMs, false if not") private Boolean forSystemVms; - @Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if the IP range is used for NSX resource", since = "4.20.0") - private boolean forNsx; + @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "Provider name for which the IP range is reserved for", since = "4.21.0") + private String provider; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -157,12 +159,12 @@ public String getStartIp() { return startIp; } - public boolean isForNsx() { - return !Objects.isNull(forNsx) && forNsx; + public Network.Provider getProvider() { + return Network.Provider.getProvider(provider); } public String getVlan() { - if ((vlan == null || vlan.isEmpty()) && !isForNsx()) { + if (StringUtils.isBlank(vlan) && !ConfigurationService.IsIpRangeForProvider(getProvider())) { vlan = "untagged"; } return vlan; @@ -230,13 +232,13 @@ public void execute() throws ResourceUnavailableException, ResourceAllocationExc response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VLAN IP range"); } } catch (ConcurrentOperationException ex) { logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { - logger.info(ex); + logger.error(ex); throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java index cac029f3aa12..d4872fa369a6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DedicatePublicIpRangeCmd.java @@ -41,20 +41,20 @@ public class DedicatePublicIpRangeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "the id of the VLAN IP range") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "The ID of the VLAN IP range") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account who will own the VLAN") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account who will own the VLAN") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "project who will own the VLAN") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Project who will own the VLAN") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, required = true, - description = "domain ID of the account owning a VLAN") + description = "Domain ID of the account owning a VLAN") private Long domainId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java index 7ab0b053004c..768b6ecf4192 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java @@ -37,7 +37,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "the id of the VLAN IP range") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "The ID of the VLAN IP range") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java index c11b505c684d..875b36f5fe9b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java @@ -47,41 +47,41 @@ public class ListVlanIpRangesCmd extends BaseListCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account with which the VLAN IP range is associated. Must be used with the domainId parameter.") + description = "The account with which the VLAN IP range is associated. Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "project who will own the VLAN") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Project who will own the VLAN") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID with which the VLAN IP range is associated. If used with the account parameter, " + + description = "The domain ID with which the VLAN IP range is associated. If used with the account parameter, " + "returns all VLAN IP ranges for that account in the specified domain.") private Long domainId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = false, description = "the ID of the VLAN IP range") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = false, description = "The ID of the VLAN IP range") private Long id; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the Pod ID of the VLAN IP range") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The Pod ID of the VLAN IP range") private Long podId; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the ID or VID of the VLAN. Default is an \"untagged\" VLAN.") + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The ID or VID of the VLAN. Default is an \"untagged\" VLAN.") private String vlan; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the Zone ID of the VLAN IP range") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID of the VLAN IP range") private Long zoneId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "network id of the VLAN IP range") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "Network ID of the VLAN IP range") private Long networkId; - @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "true if VLAN is of Virtual type, false if Direct") + @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "True if VLAN is of Virtual type, false if Direct") private Boolean forVirtualNetwork; @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "physical network id of the VLAN IP range") + description = "Physical Network ID of the VLAN IP range") private Long physicalNetworkId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java index be4cea41cd89..e369516f5eec 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/ReleasePublicIpRangeCmd.java @@ -37,7 +37,7 @@ public class ReleasePublicIpRangeCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "the id of the Public IP range") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "The ID of the Public IP range") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmd.java index df6d99f8e2af..be8e8b39d4ed 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmd.java @@ -45,35 +45,35 @@ public class UpdateVlanIpRangeCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, - description = "the UUID of the VLAN IP range") + description = "The UUID of the VLAN IP range") private Long id; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "the gateway of the VLAN IP range") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "The gateway of the VLAN IP range") private String gateway; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask of the VLAN IP range") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask of the VLAN IP range") private String netmask; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the beginning IP address in the VLAN IP range") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The beginning IP address in the VLAN IP range") private String startIp; @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, - description = "the ending IP address in the VLAN IP range") + description = "The ending IP address in the VLAN IP range") private String endIp; - @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "the beginning IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "The beginning IPv6 address in the IPv6 Network range") private String startIpv6; - @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "the ending IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "The ending IPv6 address in the IPv6 Network range") private String endIpv6; - @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "the gateway of the IPv6 network") + @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "The gateway of the IPv6 Network") private String ip6Gateway; - @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "the CIDR of IPv6 network, must be at least /64") + @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "The CIDR of IPv6 Network, must be at least /64") private String ip6Cidr; - @Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not") + @Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "True if IP range is set to System VM, false if not") private Boolean forSystemVms; ///////////////////////////////////////////////////// @@ -144,7 +144,7 @@ public void execute() throws ResourceUnavailableException, ResourceAllocationExc response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to Update vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to Update VLAN IP range"); } } catch (ConcurrentOperationException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java index 7a8c409c8a8f..ce421433d50b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AddNicToVMCmdByAdmin.java @@ -25,6 +25,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "addNicToVirtualMachine", description = "Adds Instance to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AddNicToVMCmdByAdmin extends AddNicToVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java index 6f6a5237b3d1..50ff97ac676f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java @@ -39,7 +39,7 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "assignVirtualMachine", - description = "Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.", + description = "Change ownership of an Instance from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign an Instance from any account to any other account in any domain. A domain administrator can reassign an Instance to any account in the same domain.", responseObject = UserVmResponse.class, since = "3.0.0", entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, @@ -55,16 +55,16 @@ public class AssignVMCmd extends BaseCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "id of the VM to be moved") + description = "ID of the Instance to be moved") private Long virtualMachineId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account name of the new VM owner.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account name of the new Instance owner.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain id of the new VM owner.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain id of the new Instance owner.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the new VM owner.") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the new Instance owner.") private Long projectId; //Network information @@ -72,7 +72,7 @@ public class AssignVMCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, - description = "list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. " + description = "List of new network IDs in which the moved Instance will participate. In case no network ids are provided the Instance will be part of the default network for that zone. " + "In case there is no network yet created for the new account the default network will be created.") private List networkIds; @@ -81,10 +81,13 @@ public class AssignVMCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SecurityGroupResponse.class, - description = "list of security group ids to be applied on the virtual machine. " + - "In case no security groups are provided the VM is part of the default security group.") + description = "List of security group ids to be applied on the Instance. " + + "In case no security groups are provided the Instance is part of the default security group.") private List securityGroupIdList; + // Internal flag to allow assignment without adding a network + private boolean skipNetwork = false; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -113,6 +116,34 @@ public List getSecurityGroupIdList() { return securityGroupIdList; } + public boolean isSkipNetwork() { + return skipNetwork; + } + + ///////////////////////////////////////////////////// + /////////////////// Setters ///////////////////////// + ///////////////////////////////////////////////////// + + public void setVirtualMachineId(Long virtualMachineId) { + this.virtualMachineId = virtualMachineId; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + public void setProjectId(Long projectId) { + this.projectId = projectId; + } + + public void setSkipNetwork(boolean skipNetwork) { + this.skipNetwork = skipNetwork; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -126,7 +157,7 @@ public void execute() { setResponseObject(response); } catch (Exception e) { ApiErrorCode errorCode = e instanceof InvalidParameterValueException ? ApiErrorCode.PARAM_ERROR : ApiErrorCode.INTERNAL_ERROR; - String msg = String.format("Failed to move VM [%s].", getVmId()); + String msg = String.format("Failed to move Instance due to [%s].", getVmId()); logger.error(msg, e); throw new ServerApiException(errorCode, msg); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/CreateVMFromBackupCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/CreateVMFromBackupCmdByAdmin.java new file mode 100644 index 000000000000..d95f17ef304c --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/CreateVMFromBackupCmdByAdmin.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vm; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.command.admin.AdminCmd; +import org.apache.cloudstack.api.command.user.vm.CreateVMFromBackupCmd; +import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.UserVmResponse; + +import com.cloud.vm.VirtualMachine; + +@APICommand(name = "createVMFromBackup", + description = "Creates and automatically starts a VM from a backup.", + responseObject = UserVmResponse.class, + responseView = ResponseObject.ResponseView.Full, + entityType = {VirtualMachine.class}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, + since = "4.21.0", + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class CreateVMFromBackupCmdByAdmin extends CreateVMFromBackupCmd implements AdminCmd { + + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "destination Pod ID to deploy the VM to - parameter available for root admin only", since = "4.21") + private Long podId; + + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "destination Cluster ID to deploy the VM to - parameter available for root admin only", since = "4.21") + private Long clusterId; + + public Long getPodId() { + return podId; + } + + public Long getClusterId() { + return clusterId; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java index 6bb7657b86ba..b7c3b2ba41a6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdmin.java @@ -30,17 +30,30 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts an Instance based on a service offering, disk offering, and Template.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DeployVMCmdByAdmin extends DeployVMCmd implements AdminCmd { - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "destination Pod ID to deploy the VM to - parameter available for root admin only", since = "4.13") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "Destination Pod ID to deploy the Instance to - parameter available for root admin only", since = "4.13") private Long podId; - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "destination Cluster ID to deploy the VM to - parameter available for root admin only", since = "4.13") + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "Destination Cluster ID to deploy the Instance to - parameter available for root admin only", since = "4.13") private Long clusterId; + @Parameter(name = ApiConstants.BLANK_INSTANCE, + type = CommandType.BOOLEAN, + description = "Whether to create a blank instance without storage and network", + since = "4.23.0") + private Boolean blankInstance; + + // Internal flag to allow deploying instance with a given type + private String instanceType; + + ///////////////////////////////////////////////////// + ////////////////// Getters ////////////////////////// + ///////////////////////////////////////////////////// + public Long getPodId() { return podId; } @@ -48,4 +61,37 @@ public Long getPodId() { public Long getClusterId() { return clusterId; } + + @Override + public boolean isBlankInstance() { + return Boolean.TRUE.equals(blankInstance); + } + + @Override + public String getInstanceType() { + if (!isBlankInstance()) { + return null; + } + return instanceType; + } + + ///////////////////////////////////////////////////// + ////////////////// Setters ////////////////////////// + ///////////////////////////////////////////////////// + + public void setClusterId(Long clusterId) { + this.clusterId = clusterId; + } + + public void setBlankInstance(boolean blankInstance) { + this.blankInstance = blankInstance; + } + + public void setInstanceType(String instanceType) { + this.instanceType = instanceType; + } + + public void setCustomId(String customId) { + this.customId = customId; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java index 08a13649bfa9..cbe6494d4004 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/DestroyVMCmdByAdmin.java @@ -17,6 +17,8 @@ package org.apache.cloudstack.api.command.admin.vm; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.admin.AdminCmd; import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd; @@ -24,7 +26,23 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "destroyVirtualMachine", description = "Destroys an Instance. Once destroyed, only the administrator can recover it.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) -public class DestroyVMCmdByAdmin extends DestroyVMCmd implements AdminCmd {} +public class DestroyVMCmdByAdmin extends DestroyVMCmd implements AdminCmd { + + @Parameter( name = ApiConstants.FORCED, + type = CommandType.BOOLEAN, + description = "Force destroy the Instance", + since = "4.23.0") + Boolean forced; + + @Override + public boolean isForced() { + return Boolean.TRUE.equals(forced); + } + + public void setForced(Boolean forced) { + this.forced = forced; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java index a964e873bad1..2d9c5f93383c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java @@ -39,7 +39,7 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine; -@APICommand(name = "expungeVirtualMachine", description = "Expunge a virtual machine. Once expunged, it cannot be recoverd.", responseObject = SuccessResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "expungeVirtualMachine", description = "Expunge an Instance. Once expunged, it cannot be recovered.", responseObject = SuccessResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExpungeVMCmd extends BaseAsyncCmd { @@ -49,7 +49,7 @@ public class ExpungeVMCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long id; ///////////////////////////////////////////////////// @@ -81,7 +81,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Expunging vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Expunging Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -96,7 +96,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); try { UserVm result = _userVmService.expungeVm(this.getId()); @@ -104,7 +104,7 @@ public void execute() throws ResourceUnavailableException, ConcurrentOperationEx SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to expunge Instance"); } } catch (InvalidParameterValueException ipve) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java index 8745ef12ce44..2f0aba43ad0e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/GetVMUserDataCmd.java @@ -28,7 +28,7 @@ import com.cloud.user.Account; import com.cloud.uservm.UserVm; -@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4", +@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the Instance", responseObject = VMUserDataResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetVMUserDataCmd extends BaseCmd { @@ -36,7 +36,7 @@ public class GetVMUserDataCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long vmId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java index ae6ceff26c7d..3284dbafe7ca 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportUnmanagedInstanceCmd.java @@ -56,7 +56,7 @@ import com.cloud.vm.VmDetailConstants; @APICommand(name = "importUnmanagedInstance", - description = "Import unmanaged virtual machine from a given cluster.", + description = "Import unmanaged Instance from a given cluster.", responseObject = UserVmResponse.class, responseView = ResponseObject.ResponseView.Full, requestHasSensitiveInfo = false, @@ -76,83 +76,83 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = ClusterResponse.class, required = true, - description = "the cluster ID") + description = "The cluster ID") private Long clusterId; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, - description = "the name of the instance as it is known to the hypervisor") + description = "The name of the Instance as it is known to the hypervisor") private String name; @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, - description = "the display name of the instance") + description = "The display name of the Instance") private String displayName; @Parameter(name = ApiConstants.HOST_NAME, type = CommandType.STRING, - description = "the host name of the instance") + description = "The host name of the Instance") private String hostName; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "an optional account for the virtual machine. Must be used with domainId.") + description = "An optional account for the Instance. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "import instance to the domain specified") + description = "Import Instance to the domain specified") private Long domainId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "import instance for the project") + description = "Import Instance for the project") private Long projectId; @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "the ID of the template for the virtual machine") + description = "The ID of the Template for the Instance") private Long templateId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, - description = "the service offering for the virtual machine") + description = "The service offering for the Instance") private Long serviceOfferingId; @Parameter(name = ApiConstants.NIC_NETWORK_LIST, type = CommandType.MAP, - description = "VM nic to network id mapping using keys nic and network") + description = "VM NIC to network id mapping using keys NIC and network") private Map nicNetworkList; @Parameter(name = ApiConstants.NIC_IP_ADDRESS_LIST, type = CommandType.MAP, - description = "VM nic to ip address mapping using keys nic, ip4Address") + description = "VM NIC to ip address mapping using keys NIC, ip4Address") private Map nicIpAddressList; @Parameter(name = ApiConstants.DATADISK_OFFERING_LIST, type = CommandType.MAP, - description = "datadisk template to disk-offering mapping using keys disk and diskOffering") + description = "Datadisk Template to disk-offering mapping using keys disk and diskOffering") private Map dataDiskToDiskOfferingList; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, - description = "used to specify the custom parameters.") + description = "Used to specify the custom parameters.") private Map details; @Parameter(name = ApiConstants.MIGRATE_ALLOWED, type = CommandType.BOOLEAN, - description = "vm and its volumes are allowed to migrate to different host/pool when offerings passed are incompatible with current host/pool") + description = "Instance and its volumes are allowed to migrate to different host/pool when offerings passed are incompatible with current host/pool") private Boolean migrateAllowed; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, - description = "VM is imported despite some of its NIC's MAC addresses are already present, in case the MAC address exists then a new MAC address is generated") + description = "Instance is imported despite some of its NIC's MAC addresses are already present, in case the MAC address exists then a new MAC address is generated") private Boolean forced; ///////////////////////////////////////////////////// @@ -201,9 +201,7 @@ public Map getNicNetworkList() { for (Map entry : (Collection>)nicNetworkList.values()) { String nic = entry.get(VmDetailConstants.NIC); String networkUuid = entry.get(VmDetailConstants.NETWORK); - if (logger.isDebugEnabled()) { - logger.debug(String.format("nic, '%s', goes on net, '%s'", nic, networkUuid)); - } + logger.debug("Checking if NIC '{}' can be mapped on network '{}'", nic, networkUuid); if (StringUtils.isAnyEmpty(nic, networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) { throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic)); } @@ -219,9 +217,7 @@ public Map getNicIpAddressList() { for (Map entry : (Collection>)nicIpAddressList.values()) { String nic = entry.get(VmDetailConstants.NIC); String ipAddress = StringUtils.defaultIfEmpty(entry.get(VmDetailConstants.IP4_ADDRESS), null); - if (logger.isDebugEnabled()) { - logger.debug(String.format("nic, '%s', gets ip, '%s'", nic, ipAddress)); - } + logger.debug("Checking if IP address '{}' can be mapped to NIC '{}'", ipAddress, nic); if (StringUtils.isEmpty(nic)) { throw new InvalidParameterValueException(String.format("NIC ID: '%s' is invalid for IP address mapping", nic)); } @@ -244,9 +240,7 @@ public Map getDataDiskToDiskOfferingList() { for (Map entry : (Collection>)dataDiskToDiskOfferingList.values()) { String disk = entry.get(VmDetailConstants.DISK); String offeringUuid = entry.get(VmDetailConstants.DISK_OFFERING); - if (logger.isTraceEnabled()) { - logger.trace(String.format("disk, '%s', gets offering, '%s'", disk, offeringUuid)); - } + logger.trace("Checking if offering '{}' can be used on disk '{}'", offeringUuid, disk); if (StringUtils.isAnyEmpty(disk, offeringUuid) || _entityMgr.findByUuid(DiskOffering.class, offeringUuid) == null) { throw new InvalidParameterValueException(String.format("Disk offering ID: %s for disk ID: %s is invalid", offeringUuid, disk)); } @@ -277,8 +271,7 @@ public String getEventType() { @Override public String getEventDescription() { - String vmName = this.name; - return String.format("Importing unmanaged VM: %s", vmName); + return "Importing unmanaged Instance: " + name; } public boolean isForced() { @@ -298,7 +291,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { Account account = CallContext.current().getCallingAccount(); if (account != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java index db43b53ab9ab..db7dcc3fb44f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java @@ -30,6 +30,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; @@ -159,6 +160,33 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd { description = "(only for importing VMs from VMware to KVM) optional - if true, forces MS to export OVF from VMware to temporary storage, else uses KVM Host if ovftool is available, falls back to MS if not.") private Boolean forceMsToImportVmFiles; + @Parameter(name = ApiConstants.EXTRA_PARAMS, + type = CommandType.STRING, + since = "4.22", + description = "(only for importing VMs from VMware to KVM) optional - extra parameters to be passed on the virt-v2v command, if allowed by the administrator") + private String extraParams; + + @Parameter(name = ApiConstants.FORCE_CONVERT_TO_POOL, + type = CommandType.BOOLEAN, + since = "4.22", + description = "(only for importing VMs from VMware to KVM) optional - if true, forces virt-v2v conversions to write directly on the provided storage pool (avoid using temporary conversion pool).") + private Boolean forceConvertToPool; + + @Parameter(name = ApiConstants.OS_ID, + type = CommandType.UUID, + entityType = GuestOSResponse.class, + since = "4.22.1", + description = "(only for importing VMs from VMware to KVM) optional - the ID of the guest OS for the imported VM.") + private Long guestOsId; + + @Parameter(name = ApiConstants.USE_VDDK, + type = CommandType.BOOLEAN, + since = "4.22.1", + description = "(only for importing VMs from VMware to KVM) optional - if true, uses VDDK on the KVM conversion host for converting the VM. " + + "This parameter is mutually exclusive with " + ApiConstants.FORCE_MS_TO_IMPORT_VM_FILES + ".") + private Boolean useVddk; + + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -235,6 +263,10 @@ public Long getStoragePoolId() { return storagePoolId; } + public boolean getUseVddk() { + return BooleanUtils.toBooleanDefaultIfNull(useVddk, true); + } + public String getTmpPath() { return tmpPath; } @@ -248,6 +280,18 @@ public String getEventType() { return EventTypes.EVENT_VM_IMPORT; } + public String getExtraParams() { + return extraParams; + } + + public boolean getForceConvertToPool() { + return BooleanUtils.toBooleanDefaultIfNull(forceConvertToPool, false); + } + + public Long getGuestOsId() { + return guestOsId; + } + @Override public String getEventDescription() { String vmName = getName(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListImportVMTasksCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListImportVMTasksCmd.java new file mode 100644 index 000000000000..94b547ff4267 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListImportVMTasksCmd.java @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vm; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.ImportVMTaskResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.vm.ImportVmTasksManager; + +import javax.inject.Inject; + +@APICommand(name = "listImportVmTasks", + description = "List running import virtual machine tasks from a unmanaged hosts into CloudStack", + responseObject = ImportVMTaskResponse.class, + responseView = ResponseObject.ResponseView.Full, + requestHasSensitiveInfo = false, + authorized = {RoleType.Admin}, + since = "4.22") +public class ListImportVMTasksCmd extends BaseListCmd { + + @Inject + public ImportVmTasksManager importVmTasksManager; + + @Parameter(name = ApiConstants.ZONE_ID, + type = CommandType.UUID, + entityType = ZoneResponse.class, + required = true, + description = "the zone ID") + private Long zoneId; + + @Parameter(name = ApiConstants.ACCOUNT_ID, + type = CommandType.UUID, + entityType = AccountResponse.class, + description = "the ID of the Account") + private Long accountId; + + @Parameter(name = ApiConstants.VCENTER, + type = CommandType.STRING, + description = "The name/ip of vCenter. Make sure it is IP address or full qualified domain name for host running vCenter server.") + private String vcenter; + + @Parameter(name = ApiConstants.CONVERT_INSTANCE_HOST_ID, + type = CommandType.UUID, + entityType = HostResponse.class, + description = "Conversion host of the importing task") + private Long convertHostId; + + @Parameter(name = ApiConstants.TASKS_FILTER, type = CommandType.STRING, description = "Filter tasks by state, valid options are: All, Running, Completed, Failed") + private String tasksFilter; + + public Long getZoneId() { + return zoneId; + } + + public Long getAccountId() { + return accountId; + } + + public String getVcenter() { + return vcenter; + } + + public Long getConvertHostId() { + return convertHostId; + } + + public String getTasksFilter() { + return tasksFilter; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { + ListResponse response = importVmTasksManager.listImportVMTasks(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + Account account = CallContext.current().getCallingAccount(); + if (account != null) { + return account.getId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListUnmanagedInstancesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListUnmanagedInstancesCmd.java index 6932aa383fa2..1d6285684471 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListUnmanagedInstancesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListUnmanagedInstancesCmd.java @@ -41,7 +41,7 @@ import com.cloud.user.Account; @APICommand(name = "listUnmanagedInstances", - description = "Lists unmanaged virtual machines for a given cluster.", + description = "Lists unmanaged Instances for a given cluster.", responseObject = UnmanagedInstanceResponse.class, responseView = ResponseObject.ResponseView.Full, entityType = {UnmanagedInstanceTO.class}, @@ -62,12 +62,12 @@ public class ListUnmanagedInstancesCmd extends BaseListCmd { type = CommandType.UUID, entityType = ClusterResponse.class, required = true, - description = "the cluster ID") + description = "The cluster ID") private Long clusterId; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, - description = "the hypervisor name of the instance") + description = "The hypervisor name of the Instance") private String name; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java index b48941e7d17a..52309855a7a2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ListVMsCmdByAdmin.java @@ -30,7 +30,7 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "listVirtualMachines", description = "List the virtual machines owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "listVirtualMachines", description = "List the Instances owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListVMsCmdByAdmin extends ListVMsCmd implements AdminCmd { @@ -39,19 +39,19 @@ public class ListVMsCmdByAdmin extends ListVMsCmd implements AdminCmd { ///////////////////////////////////////////////////// @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class, - description="the host ID") + description = "The host ID") private Long hostId; @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, - description="the pod ID") + description = "The pod ID") private Long podId; @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.UUID, entityType=StoragePoolResponse.class, - description="the storage ID where vm's volumes belong to") + description = "The storage ID where Instance's volumes belong to") private Long storageId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "the cluster ID", since = "4.16.0") + description = "The cluster ID", since = "4.16.0") private Long clusterId; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java index 8881a2bc354e..467b92d415d2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.admin.vm; +import com.cloud.hypervisor.Hypervisor; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.APICommand; @@ -44,7 +45,7 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "migrateVirtualMachine", - description = "Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool", + description = "Attempts Migration of an Instance to a different host or Root volume of the Instance to a different storage pool", responseObject = UserVmResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) @@ -59,21 +60,21 @@ public class MigrateVMCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = HostResponse.class, required = false, - description = "Destination Host ID to migrate VM to.") + description = "Destination Host ID to migrate Instance to.") private Long hostId; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "the ID of the virtual machine") + description = "The ID of the Instance") private Long virtualMachineId; @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = false, - description = "Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume") + description = "Destination storage pool ID to migrate Instance volumes to. Required for migrating the root disk volume") private Long storageId; @Parameter(name = ApiConstants.AUTO_SELECT, @@ -123,15 +124,15 @@ public String getEventType() { @Override public String getEventDescription() { - String eventDescription; + String description = "Attempting to migrate Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); + if (getHostId() != null) { - eventDescription = String.format("Attempting to migrate VM id: %s to host Id: %s", getVirtualMachineId(), getHostId()); + description += " to host with ID: " +getResourceUuid(ApiConstants.HOST_ID); } else if (getStoragePoolId() != null) { - eventDescription = String.format("Attempting to migrate VM id: %s to storage pool Id: %s", getVirtualMachineId(), getStoragePoolId()); - } else { - eventDescription = String.format("Attempting to migrate VM id: %s", getVirtualMachineId()); + description = " to storage pool with ID: " + getResourceUuid(ApiConstants.STORAGE_ID); } - return eventDescription; + + return description; } @Override @@ -142,7 +143,11 @@ public void execute() { UserVm userVm = _userVmService.getUserVm(getVirtualMachineId()); if (userVm == null) { - throw new InvalidParameterValueException("Unable to find the VM by id=" + getVirtualMachineId()); + throw new InvalidParameterValueException("Unable to find the Instance by id=" + getVirtualMachineId()); + } + + if (Hypervisor.HypervisorType.External.equals(userVm.getHypervisorType())) { + throw new InvalidParameterValueException("Migrate VM instance operation is not allowed for External hypervisor type"); } Host destinationHost = null; @@ -151,18 +156,18 @@ public void execute() { if (getStoragePoolId() != null) { destStoragePool = _storageService.getStoragePool(getStoragePoolId()); if (destStoragePool == null) { - throw new InvalidParameterValueException("Unable to find the storage pool to migrate the VM"); + throw new InvalidParameterValueException("Unable to find the storage pool to migrate the Instance"); } - CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to storage pool Id: " + getStoragePoolId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to storage pool with ID: " + getResourceUuid(ApiConstants.STORAGE_ID)); } else if (getHostId() != null) { destinationHost = _resourceService.getHost(getHostId()); if (destinationHost == null) { - throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId()); + throw new InvalidParameterValueException("Unable to find the host to migrate the Instance, host id=" + getHostId()); } if (destinationHost.getType() != Host.Type.Routing) { - throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one"); + throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the Instance, please specify another one"); } - CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: " + getHostId()); + CallContext.current().setEventDetails("Instance Id: " + getVirtualMachineId() + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID)); } else if (! isAutoSelect()) { throw new InvalidParameterValueException("Please specify a host or storage as destination, or pass 'autoselect=true' to automatically select a destination host which do not require storage migration"); } @@ -179,7 +184,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate Instance"); } } catch (ResourceUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java index b736e8606364..ad298513ac0b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmd.java @@ -46,7 +46,7 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "migrateVirtualMachineWithVolume", - description = "Attempts Migration of a VM with its volumes to a different host", + description = "Attempts Migration of an Instance with its volumes to a different host", responseObject = UserVmResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) @@ -60,14 +60,14 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "Destination Host ID to migrate VM to.") + description = "Destination Host ID to migrate Instance to.") private Long hostId; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "the ID of the virtual machine") + description = "The ID of the Instance") private Long virtualMachineId; @Parameter(name = ApiConstants.MIGRATE_TO, @@ -84,7 +84,7 @@ public class MigrateVirtualMachineWithVolumeCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.AUTO_SELECT, since = "4.19.0", type = CommandType.BOOLEAN, - description = "Automatically select a destination host for a running instance, if hostId is not specified. false by default") + description = "Automatically select a destination host for a running Instance, if hostId is not specified. false by default") private Boolean autoSelect; ///////////////////////////////////////////////////// @@ -135,7 +135,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Attempting to migrate VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) + " to host Id: " + this._uuidMgr.getUuid(Host.class, getHostId()); + return "Attempting to migrate Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to host with ID: " + getResourceUuid(ApiConstants.HOST_ID); } @Override @@ -155,8 +155,8 @@ private Host getDestinationHost() { Host destinationHost = _resourceService.getHost(getHostId()); // OfflineVmwareMigration: destination host would have to not be a required parameter for stopped VMs if (destinationHost == null) { - logger.error(String.format("Unable to find the host with ID [%s].", getHostId())); - throw new InvalidParameterValueException("Unable to find the specified host to migrate the VM."); + logger.error("Unable to find the host with ID [{}].", getHostId()); + throw new InvalidParameterValueException("Unable to find the specified host to migrate the Instance."); } return destinationHost; } @@ -164,7 +164,7 @@ private Host getDestinationHost() { @Override public void execute() { if (hostId == null && MapUtils.isEmpty(migrateVolumeTo) && !Boolean.TRUE.equals(autoSelect)) { - throw new InvalidParameterValueException(String.format("Either %s or %s must be passed or %s must be true for migrating the VM.", ApiConstants.HOST_ID, ApiConstants.MIGRATE_TO, ApiConstants.AUTO_SELECT)); + throw new InvalidParameterValueException(String.format("Either %s or %s must be passed or %s must be true for migrating the Instance.", ApiConstants.HOST_ID, ApiConstants.MIGRATE_TO, ApiConstants.AUTO_SELECT)); } VirtualMachine virtualMachine = _userVmService.getVm(getVirtualMachineId()); @@ -188,7 +188,7 @@ public void execute() { if (migratedVm != null) { setResponseBasedOnVmType(virtualMachine, migratedVm); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate Instance"); } } catch (ResourceUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java index 5f6a7ab384be..36fdc9d8ec18 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RebootVMCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "rebootVirtualMachine", description = "Reboots an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RebootVMCmdByAdmin extends RebootVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java index f34d555dc707..4f63e22b8677 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java @@ -34,7 +34,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "recoverVirtualMachine", description = "Recovers a virtual machine.", responseObject = UserVmResponse.class, entityType = {VirtualMachine.class}, +@APICommand(name = "recoverVirtualMachine", description = "Recovers an Instance.", responseObject = UserVmResponse.class, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RecoverVMCmd extends BaseCmd { @@ -44,7 +44,7 @@ public class RecoverVMCmd extends BaseCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long id; ///////////////////////////////////////////////////// @@ -87,7 +87,7 @@ public void execute() throws ResourceAllocationException { recoverVmResponse.setResponseName(getCommandName()); setResponseObject(recoverVmResponse); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover Instance"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java index 89726afe99b5..e25c850e1278 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RemoveNicFromVMCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "removeNicFromVirtualMachine", description = "Removes Instance from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RemoveNicFromVMCmdByAdmin extends RemoveNicFromVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java index d7ab0c61bbbc..1b4af79d775d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMPasswordCmdByAdmin.java @@ -24,8 +24,8 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description="Resets the password for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state and the template must already " + +@APICommand(name = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description = "Resets the password for Instance. " + + "The Instance must be in a \"Stopped\" state and the Template must already " + "support this feature for this command to take effect. [async]", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMPasswordCmdByAdmin extends ResetVMPasswordCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java index ed9cc11fd5e4..046a90892da6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMSSHKeyCmdByAdmin.java @@ -25,7 +25,7 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for Instance. " + + "The Instance must be in a \"Stopped\" state. [async]", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMSSHKeyCmdByAdmin extends ResetVMSSHKeyCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMUserDataCmdAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMUserDataCmdAdmin.java index 83e3481840b9..6ae9cb837e56 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMUserDataCmdAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ResetVMUserDataCmdAdmin.java @@ -23,8 +23,8 @@ import org.apache.cloudstack.api.command.user.vm.ResetVMUserDataCmd; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "resetUserDataForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the UserData for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseObject.ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "resetUserDataForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the UserData for Instance. " + + "The Instance must be in a \"Stopped\" state. [async]", responseView = ResponseObject.ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMUserDataCmdAdmin extends ResetVMUserDataCmd implements AdminCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java index b3ee39829ab0..9a551653e628 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/RestoreVMCmdByAdmin.java @@ -24,7 +24,7 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "restoreVirtualMachine", description = "Restore an Instance to original Template/ISO or new Template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RestoreVMCmdByAdmin extends RestoreVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java index fd71a4459540..6ed7a0cca8d6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ScaleVMCmdByAdmin.java @@ -25,6 +25,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering. This command also considers the volume size in the service offering or disk offering linked to the new service offering and apply all characteristics to the root volume.", responseObject = SuccessResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "scaleVirtualMachine", description = "Scales the Instance to a new service offering. This command also considers the volume size in the service offering or disk offering linked to the new service offering and apply all characteristics to the root volume.", responseObject = SuccessResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ScaleVMCmdByAdmin extends ScaleVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java index f87622cf734a..30fab3b9382f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StartVMCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts an Instance.", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StartVMCmdByAdmin extends StartVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java index 2f7cc2198ef7..6dc1947712d6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/StopVMCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops an Instance.", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StopVMCmdByAdmin extends StopVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UnmanageVMInstanceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UnmanageVMInstanceCmd.java index bbcb8840f666..2c9f09dcd626 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UnmanageVMInstanceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UnmanageVMInstanceCmd.java @@ -27,6 +27,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; +import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; @@ -36,15 +37,17 @@ import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.UnmanageVMInstanceResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.vm.UnmanagedVMsManager; +import org.apache.commons.lang3.BooleanUtils; import javax.inject.Inject; @APICommand(name = "unmanageVirtualMachine", - description = "Unmanage a guest virtual machine.", + description = "Unmanage a Guest Instance.", entityType = {VirtualMachine.class}, responseObject = UnmanageVMInstanceResponse.class, requestHasSensitiveInfo = false, @@ -62,9 +65,23 @@ public class UnmanageVMInstanceCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "The ID of the virtual machine to unmanage") + description = "The ID of the Instance to unmanage") private Long vmId; + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, + entityType = HostResponse.class, required = false, + description = "ID of the host which will be used for unmanaging the Instance. " + + "Applicable only for KVM hypervisor and stopped Instances. Domain XML will be stored on this host.", + since = "4.22.0") + private Long hostId; + + @Parameter(name = ApiConstants.FORCED, + type = CommandType.BOOLEAN, + required = false, + description = "Force unmanaging Instance with config drive. Applicable only for KVM Hypervisor.", + since = "4.22.0") + private Boolean forced; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -80,7 +97,19 @@ public String getEventType() { @Override public String getEventDescription() { - return "unmanaging VM. VM ID = " + vmId; + return "Unmanaging Instance with ID: " + getResourceUuid(ApiConstants.ID); + } + + public Long getHostId() { + return hostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } + + public Boolean isForced() { + return BooleanUtils.isTrue(forced); } ///////////////////////////////////////////////////// @@ -92,10 +121,11 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { UnmanageVMInstanceResponse response = new UnmanageVMInstanceResponse(); try { - CallContext.current().setEventDetails("VM ID = " + vmId); - boolean result = unmanagedVMsManager.unmanageVMInstance(vmId); - response.setSuccess(result); - if (result) { + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); + Pair result = unmanagedVMsManager.unmanageVMInstance(vmId, hostId, isForced()); + if (result.first()) { + response.setSuccess(true); + response.setHostId(result.second()); response.setDetails("VM unmanaged successfully"); } } catch (Exception e) { @@ -124,5 +154,4 @@ public ApiCommandResourceType getApiResourceType() { public Long getApiResourceId() { return vmId; } - } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java index 1c4dde93a226..a702eb264c80 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateDefaultNicForVMCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on an Instance", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateDefaultNicForVMCmdByAdmin extends UpdateDefaultNicForVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java index cb4bb0433d63..46f5824de252 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpdateVMCmdByAdmin.java @@ -25,8 +25,8 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " + - "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " + - "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "updateVirtualMachine", description = "Updates properties of an Instance. The Instance has to be stopped and restarted for the " + + "new properties to take effect. UpdateVirtualMachine does not first check whether the Instance is stopped. " + + "Therefore, stop the Instance manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateVMCmdByAdmin extends UpdateVMCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java index f3230e64818c..9bf8ccb454b6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/UpgradeVMCmdByAdmin.java @@ -25,8 +25,8 @@ import com.cloud.vm.VirtualMachine; @Deprecated(since = "4.18") -@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="(This API is deprecated, use scaleVirtualMachine API)" + - "Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for " + +@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description = "(This API is deprecated, use scaleVirtualMachine API)" + + "Changes the service offering for an Instance. The Instance must be in a \"Stopped\" state for " + "this command to take effect.", responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java index 8f286626b992..a57362d62056 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vmsnapshot/RevertToVMSnapshotCmdByAdmin.java @@ -22,6 +22,6 @@ import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd; import org.apache.cloudstack.api.response.UserVmResponse; -@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Full, +@APICommand(name = "revertToVMSnapshot", description = "Revert Instance from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Full, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RevertToVMSnapshotCmdByAdmin extends RevertToVMSnapshotCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java index 6f31df79e1c9..20418d589405 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/AttachVolumeCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "attachVolume", description = "Attaches a disk volume to an Instance.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AttachVolumeCmdByAdmin extends AttachVolumeCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java index c0dfe42acb5f..e156475b29ae 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/CreateVolumeCmdByAdmin.java @@ -25,7 +25,7 @@ import com.cloud.storage.Volume; import com.cloud.vm.VirtualMachine; -@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Full, entityType = { +@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to an Instance to make use of it.", responseView = ResponseView.Full, entityType = { Volume.class, VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVolumeCmdByAdmin extends CreateVolumeCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java index 36a183bc89fc..05f9fe6a31a6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/DetachVolumeCmdByAdmin.java @@ -24,6 +24,6 @@ import com.cloud.vm.VirtualMachine; -@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, +@APICommand(name = "detachVolume", description = "Detaches a disk volume from an Instance.", responseObject = VolumeResponse.class, responseView = ResponseView.Full, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DetachVolumeCmdByAdmin extends DetachVolumeCmd implements AdminCmd {} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmd.java index 57c3ee586d35..50f4b9c1fbe5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmd.java @@ -156,7 +156,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/RecoverVolumeCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/RecoverVolumeCmdByAdmin.java index e276c8a00b65..b7c084ee6e78 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/RecoverVolumeCmdByAdmin.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/RecoverVolumeCmdByAdmin.java @@ -19,6 +19,7 @@ import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.ServerApiException; @@ -38,7 +39,7 @@ public class RecoverVolumeCmdByAdmin extends RecoverVolumeCmd implements AdminCm @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + getId()); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.recoverVolume(getId()); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmd.java index dcc8b2af8d74..ac573dd4ecb9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmd.java @@ -81,7 +81,7 @@ public String getEventType() { @Override public String getEventDescription() { - return String.format("Unmanaging Volume with ID %s", volumeId); + return "Unmanaging Volume with ID: " + getResourceUuid(ApiConstants.ID); } ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CloneVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CloneVPCOfferingCmd.java new file mode 100644 index 000000000000..2148ff5c2d4f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CloneVPCOfferingCmd.java @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vpc; + +import com.cloud.exception.ResourceAllocationException; +import com.cloud.network.vpc.VpcOffering; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.VpcOfferingResponse; + +import java.util.List; + +@APICommand(name = "cloneVPCOffering", + description = "Clones an existing VPC offering. All parameters are copied from the source offering unless explicitly overridden. " + + "Use 'addServices' and 'dropServices' to modify the service list without respecifying everything.", + responseObject = VpcOfferingResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + since = "4.23.0") +public class CloneVPCOfferingCmd extends CreateVPCOfferingCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, + type = BaseCmd.CommandType.UUID, + entityType = VpcOfferingResponse.class, + required = true, + description = "The ID of the source VPC offering to clone from") + private Long sourceOfferingId; + + @Parameter(name = "addservices", + type = CommandType.LIST, + collectionType = CommandType.STRING, + description = "Services to add to the cloned offering (in addition to source offering services). " + + "If specified along with 'supportedservices', this parameter is ignored.") + private List addServices; + + @Parameter(name = "dropservices", + type = CommandType.LIST, + collectionType = CommandType.STRING, + description = "Services to remove from the cloned offering (that exist in source offering). " + + "If specified along with 'supportedservices', this parameter is ignored.") + private List dropServices; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getSourceOfferingId() { + return sourceOfferingId; + } + + public List getAddServices() { + return addServices; + } + + public List getDropServices() { + return dropServices; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void create() throws ResourceAllocationException { + // Set a temporary entity ID (source offering ID) to prevent NullPointerException + // in ApiServer.queueCommand(). This will be updated in execute() with the actual + // cloned offering ID. + if (sourceOfferingId != null) { + setEntityId(sourceOfferingId); + } + } + + @Override + public void execute() { + VpcOffering result = _vpcProvSvc.cloneVPCOffering(this); + if (result != null) { + setEntityId(result.getId()); + setEntityUuid(result.getUuid()); + + VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone VPC offering"); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayByAdminCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayByAdminCmd.java index 1b2163853ec3..09f0d21d9dfd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayByAdminCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayByAdminCmd.java @@ -44,13 +44,13 @@ public class CreatePrivateGatewayByAdminCmd extends CreatePrivateGatewayCmd impl @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "the Physical Network ID the network belongs to") + description = "The Physical Network ID the network belongs to") private Long physicalNetworkId; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "the network implementation uri for the private gateway") + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The network implementation uri for the private gateway") private String broadcastUri; - @Parameter(name = ApiConstants.BYPASS_VLAN_OVERLAP_CHECK, type = CommandType.BOOLEAN, description = "when true bypasses VLAN id/range overlap check during private gateway creation") + @Parameter(name = ApiConstants.BYPASS_VLAN_OVERLAP_CHECK, type = CommandType.BOOLEAN, description = "When true bypasses VLAN id/range overlap check during private gateway creation") private Boolean bypassVlanOverlapCheck; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java index 73b4f5df196b..2b934a60da7a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.admin.vpc; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; @@ -25,10 +26,11 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; import com.cloud.network.VirtualRouterProvider; +import com.cloud.offering.NetworkOffering; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.commons.collections.CollectionUtils; @@ -57,6 +59,11 @@ import static com.cloud.network.Network.Service.PortForwarding; import static com.cloud.network.Network.Service.NetworkACL; import static com.cloud.network.Network.Service.UserData; +import static com.cloud.network.Network.Service.Gateway; + +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNetrisNatted; +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNetrisRouted; +import static org.apache.cloudstack.api.command.utils.OfferingUtils.isNsxWithoutLb; @APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -66,58 +73,65 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the vpc offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the VPC offering") private String vpcOfferingName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the vpc offering, defaults to the 'name'") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the VPC offering, defaults to the 'name'") private String displayText; @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "services supported by the vpc offering") + description = "Services supported by the VPC offering") private List supportedServices; - @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. " + @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "Provider to service mapping. " + "If not specified, the provider for the service will be mapped to the default provider on the physical network") private Map> serviceProviderList; - @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of vpc offering", since = "4.4") + @Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "Desired service capabilities as part of VPC offering", since = "4.4") private Map> serviceCapabilityList; @Parameter(name = ApiConstants.INTERNET_PROTOCOL, type = CommandType.STRING, - description = "The internet protocol of the offering. Options are ipv4 and dualstack. Default is ipv4. dualstack will create an offering that supports both IPv4 and IPv6", + description = "The internet protocol of the offering. Options are IPv4 and dualstack. Default is IPv4. dualstack will create an offering that supports both IPv4 and IPv6", since = "4.17.0") private String internetProtocol; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, - description = "the ID of the service offering for the VPC router appliance") + description = "The ID of the service offering for the VPC router appliance") private Long serviceOfferingId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the containing domain(s), null for public offerings") + description = "The ID of the containing domain(s), null for public offerings") private List domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the containing zone(s), null for public offerings", + description = "The ID of the containing zone(s), null for public offerings", since = "4.13") private List zoneIds; + @Deprecated @Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if network offering is meant to be used for NSX, false otherwise.", since = "4.20.0") private Boolean forNsx; + @Parameter(name = ApiConstants.PROVIDER, + type = CommandType.STRING, + description = "Name of the provider providing the service", + since = "4.21.0") + private String provider; + @Parameter(name = ApiConstants.NSX_SUPPORT_LB, type = CommandType.BOOLEAN, description = "true if network offering for NSX VPC offering supports Load balancer service.", @@ -126,7 +140,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.ENABLE, type = CommandType.BOOLEAN, - description = "set to true if the offering is to be enabled during creation. Default is false", + description = "Set to true if the offering is to be enabled during creation. Default is false", since = "4.16") private Boolean enable; @@ -146,6 +160,12 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd { description = "the routing mode for the VPC offering. Supported types are: Static or Dynamic.") private String routingMode; + @Parameter(name = ApiConstants.CONSERVE_MODE, type = CommandType.BOOLEAN, + since = "4.23.0", + description = "True if the VPC offering is IP conserve mode enabled, allowing public IPs to be used across multiple VPC tiers. Default value is false") + private Boolean conserveMode; + + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -158,29 +178,38 @@ public String getDisplayText() { return StringUtils.isEmpty(displayText) ? vpcOfferingName : displayText; } + public boolean isExternalNetworkProvider() { + return Arrays.asList("NSX", "Netris").stream() + .anyMatch(s -> provider != null && s.equalsIgnoreCase(provider)); + } + public List getSupportedServices() { - if (!isForNsx() && CollectionUtils.isEmpty(supportedServices)) { - throw new InvalidParameterValueException("Supported services needs to be provided"); - } - if (isForNsx()) { + // For external network providers, auto-populate services based on network mode + if (isExternalNetworkProvider()) { supportedServices = new ArrayList<>(List.of( Dhcp.getName(), Dns.getName(), - StaticNat.getName(), - SourceNat.getName(), NetworkACL.getName(), - PortForwarding.getName(), UserData.getName() )); - if (getNsxSupportsLbService()) { + if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) { + supportedServices.addAll(Arrays.asList( + StaticNat.getName(), + SourceNat.getName(), + PortForwarding.getName())); + } + if (NetworkOffering.NetworkMode.ROUTED.name().equalsIgnoreCase(getNetworkMode())) { + supportedServices.add(Gateway.getName()); + } + if (getNsxSupportsLbService() || isNetrisNatted(getProvider(), getNetworkMode())) { supportedServices.add(Lb.getName()); } } return supportedServices; } - public boolean isForNsx() { - return BooleanUtils.isTrue(forNsx); + public String getProvider() { + return provider; } public String getNetworkMode() { @@ -193,15 +222,13 @@ public boolean getNsxSupportsLbService() { public Map> getServiceProviders() { Map> serviceProviderMap = new HashMap<>(); - if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) { + if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) { Collection> servicesCollection = serviceProviderList.values(); Iterator> iter = servicesCollection.iterator(); while (iter.hasNext()) { Map obj = iter.next(); - if (logger.isTraceEnabled()) { - logger.trace("service provider entry specified: " + obj); - } - HashMap services = (HashMap) obj; + logger.trace("Service provider entry specified: {}", obj); + HashMap services = (HashMap)obj; String service = services.get("service"); String provider = services.get("provider"); List providerList = null; @@ -213,16 +240,18 @@ public Map> getServiceProviders() { providerList.add(provider); serviceProviderMap.put(service, providerList); } - } else if (Boolean.TRUE.equals(forNsx)) { - getServiceProviderMapForNsx(serviceProviderMap); + } else if (isExternalNetworkProvider()) { + getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName()); } return serviceProviderMap; } - private void getServiceProviderMapForNsx(Map> serviceProviderMap) { - List unsupportedServices = List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity", - "Gateway", "Firewall"); + private void getServiceProviderMapForExternalProvider(Map> serviceProviderMap, String provider) { + List unsupportedServices = new ArrayList<>(List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity", "Firewall")); + if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) { + unsupportedServices.add("Gateway"); + } List routerSupported = List.of("Dhcp", "Dns", "UserData"); List allServices = Network.Service.listAllServices().stream().map(Network.Service::getName).collect(Collectors.toList()); for (String service : allServices) { @@ -230,10 +259,12 @@ private void getServiceProviderMapForNsx(Map> serviceProvid continue; if (routerSupported.contains(service)) serviceProviderMap.put(service, List.of(VirtualRouterProvider.Type.VPCVirtualRouter.name())); - else - serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName())); + else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) || + Stream.of(NetworkACL.getName(), Gateway.getName()).anyMatch(s -> s.equalsIgnoreCase(service))) { + serviceProviderMap.put(service, List.of(provider)); + } } - if (!getNsxSupportsLbService()) { + if ((isNsxWithoutLb(getProvider(), getNsxSupportsLbService())) || isNetrisRouted(getProvider(), getNetworkMode())) { serviceProviderMap.remove(Lb.getName()); } } @@ -283,6 +314,10 @@ public String getRoutingMode() { return routingMode; } + public boolean isConserveMode() { + return BooleanUtils.toBoolean(conserveMode); + } + @Override public void create() throws ResourceAllocationException { VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java index d104edc381bc..a6b0538062b1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java @@ -45,7 +45,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, required = true, description = "the ID of the private gateway") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, required = true, description = "The ID of the private gateway") private Long id; ///////////////////////////////////////////////////// @@ -66,7 +66,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting private gateway id=" + id); + return "Deleting private gateway with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -76,7 +76,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Network ACL Id: " + id); + CallContext.current().setEventDetails("Network ACL ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _vpcService.deleteVpcPrivateGateway(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java index 6aa0c3f3afce..f579eeb87e4d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java @@ -38,7 +38,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required = true, description = "the ID of the VPC offering") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required = true, description = "The ID of the VPC offering") private Long id; ///////////////////////////////////////////////////// @@ -76,7 +76,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting VPC offering id=" + getId(); + return "Deleting VPC offering with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java index b59837281ef3..97f30f6fa2ef 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java @@ -16,7 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; -import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; @@ -26,49 +25,47 @@ import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver; import org.apache.cloudstack.api.response.VpcOfferingResponse; -import org.apache.commons.lang3.StringUtils; -import com.cloud.dc.DataCenter; -import com.cloud.domain.Domain; import com.cloud.event.EventTypes; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.vpc.VpcOffering; import com.cloud.user.Account; @APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class UpdateVPCOfferingCmd extends BaseAsyncCmd { +public class UpdateVPCOfferingCmd extends BaseAsyncCmd implements DomainAndZoneIdResolver { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required = true, description = "the id of the VPC offering") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, required = true, description = "The ID of the VPC offering") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the VPC offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the VPC offering") private String vpcOffName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the VPC offering") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the VPC offering") private String displayText; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "update state for the VPC offering; " + "supported states - Enabled/Disabled") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Update state for the VPC offering; " + "supported states - Enabled/Disabled") private String state; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.STRING, - description = "the ID of the containing domain(s) as comma separated string, public for public offerings", + description = "The ID of the containing domain(s) as comma separated string, public for public offerings", length = 4096) private String domainIds; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, - description = "the ID of the containing zone(s) as comma separated string, all for all zones offerings", + description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings", + length = 4096, since = "4.13") private String zoneIds; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the VPC offering, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the VPC offering, integer") private Integer sortKey; ///////////////////////////////////////////////////// @@ -92,63 +89,11 @@ public String getState() { } public List getDomainIds() { - List validDomainIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(domainIds)) { - if (domainIds.contains(",")) { - String[] domains = domainIds.split(","); - for (String domain : domains) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domain.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create VPC offering because invalid domain has been specified."); - } - } - } else { - domainIds = domainIds.trim(); - if (!domainIds.matches("public")) { - Domain validDomain = _entityMgr.findByUuid(Domain.class, domainIds.trim()); - if (validDomain != null) { - validDomainIds.add(validDomain.getId()); - } else { - throw new InvalidParameterValueException("Failed to create VPC offering because invalid domain has been specified."); - } - } - } - } else { - validDomainIds.addAll(_vpcProvSvc.getVpcOfferingDomains(id)); - } - return validDomainIds; + return resolveDomainIds(domainIds, id, _vpcProvSvc::getVpcOfferingDomains, "VPC offering"); } public List getZoneIds() { - List validZoneIds = new ArrayList<>(); - if (StringUtils.isNotEmpty(zoneIds)) { - if (zoneIds.contains(",")) { - String[] zones = zoneIds.split(","); - for (String zone : zones) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zone.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create VPC offering because invalid zone has been specified."); - } - } - } else { - zoneIds = zoneIds.trim(); - if (!zoneIds.matches("all")) { - DataCenter validZone = _entityMgr.findByUuid(DataCenter.class, zoneIds.trim()); - if (validZone != null) { - validZoneIds.add(validZone.getId()); - } else { - throw new InvalidParameterValueException("Failed to create VPC offering because invalid zone has been specified."); - } - } - } - } else { - validZoneIds.addAll(_vpcProvSvc.getVpcOfferingZones(id)); - } - return validZoneIds; + return resolveZoneIds(zoneIds, id, _vpcProvSvc::getVpcOfferingZones, "VPC offering"); } public Integer getSortKey() { @@ -182,7 +127,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating VPC offering id=" + getId(); + return "Updating VPC offering with ID:" + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java index 24660e41ed9b..d7f448d6ece6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java @@ -31,6 +31,8 @@ import com.cloud.dc.DataCenter; import com.cloud.user.Account; +import java.util.List; + @APICommand(name = "createZone", description = "Creates a Zone.", responseObject = ZoneResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateZoneCmd extends BaseCmd { @@ -40,28 +42,28 @@ public class CreateZoneCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, required = true, description = "the first DNS for the Zone") + @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, required = true, description = "The first DNS for the Zone") private String dns1; - @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "the second DNS for the Zone") + @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "The second DNS for the Zone") private String dns2; - @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "the first DNS for IPv6 network in the Zone") + @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "The first DNS for IPv6 network in the Zone") private String ip6Dns1; - @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "the second DNS for IPv6 network in the Zone") + @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "The second DNS for IPv6 network in the Zone") private String ip6Dns2; - @Parameter(name = ApiConstants.GUEST_CIDR_ADDRESS, type = CommandType.STRING, description = "the guest CIDR address for the Zone") + @Parameter(name = ApiConstants.GUEST_CIDR_ADDRESS, type = CommandType.STRING, description = "The guest CIDR address for the Zone") private String guestCidrAddress; - @Parameter(name = ApiConstants.INTERNAL_DNS1, type = CommandType.STRING, required = true, description = "the first internal DNS for the Zone") + @Parameter(name = ApiConstants.INTERNAL_DNS1, type = CommandType.STRING, required = true, description = "The first internal DNS for the Zone") private String internalDns1; - @Parameter(name = ApiConstants.INTERNAL_DNS2, type = CommandType.STRING, description = "the second internal DNS for the Zone") + @Parameter(name = ApiConstants.INTERNAL_DNS2, type = CommandType.STRING, description = "The second internal DNS for the Zone") private String internalDns2; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the Zone") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Zone") private String zoneName; @Parameter(name = ApiConstants.DOMAIN, type = CommandType.STRING, description = "Network domain name for the networks in the zone") @@ -70,24 +72,29 @@ public class CreateZoneCmd extends BaseCmd { @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the containing domain, null for public zones") + description = "The ID of the containing domain, null for public zones") private Long domainId; - @Parameter(name = ApiConstants.NETWORK_TYPE, type = CommandType.STRING, required = true, description = "network type of the zone, can be Basic or Advanced") + @Parameter(name = ApiConstants.NETWORK_TYPE, type = CommandType.STRING, required = true, description = "Network type of the zone, can be Basic or Advanced") private String networkType; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this Zone for allocation of new resources") private String allocationState; - @Parameter(name = ApiConstants.SECURITY_GROUP_EANBLED, type = CommandType.BOOLEAN, description = "true if network is security group enabled, false otherwise") + @Parameter(name = ApiConstants.SECURITY_GROUP_EANBLED, type = CommandType.BOOLEAN, description = "True if network is security group enabled, false otherwise") private Boolean securitygroupenabled; - @Parameter(name = ApiConstants.LOCAL_STORAGE_ENABLED, type = CommandType.BOOLEAN, description = "true if local storage offering enabled, false otherwise") + @Parameter(name = ApiConstants.LOCAL_STORAGE_ENABLED, type = CommandType.BOOLEAN, description = "True if local storage offering enabled, false otherwise") private Boolean localStorageEnabled; - @Parameter(name = ApiConstants.IS_EDGE, type = CommandType.BOOLEAN, description = "true if the zone is an edge zone, false otherwise", since = "4.18.0") + @Parameter(name = ApiConstants.IS_EDGE, type = CommandType.BOOLEAN, description = "True if the zone is an edge zone, false otherwise", since = "4.18.0") private Boolean isEdge; + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUPS, + type = CommandType.LIST, collectionType = CommandType.STRING, + description = "comma separated list of storage access groups for the hosts in the zone", + since = "4.21.0") + private List storageAccessGroups; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -162,6 +169,10 @@ public boolean isEdge() { return isEdge; } + public List getStorageAccessGroups() { + return storageAccessGroups; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java index b89636c6fe52..28d14a318753 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java @@ -38,7 +38,7 @@ public class DeleteZoneCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the Zone") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The ID of the Zone") private Long id; ///////////////////////////////////////////////////// @@ -60,7 +60,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Zone Id: " + getId()); + CallContext.current().setEventDetails("Zone ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _configService.deleteZone(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java index 5d3f5dcd47fa..42040290a411 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java @@ -95,7 +95,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Marking account with the default zone: " + getDefaultZoneId(); + return "Marking zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID) + " as default for account " + getResourceUuid(ApiConstants.ACCOUNT) + " in domain: " + getResourceUuid(ApiConstants.DOMAIN_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java index 1b2793d3e158..888ee6603ddf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java @@ -42,43 +42,43 @@ public class UpdateZoneCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first DNS for the Zone") + @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "The first DNS for the Zone") private String dns1; - @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "the second DNS for the Zone") + @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "The second DNS for the Zone") private String dns2; - @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "the first DNS for IPv6 network in the Zone") + @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "The first DNS for IPv6 network in the Zone") private String ip6Dns1; - @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "the second DNS for IPv6 network in the Zone") + @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "The second DNS for IPv6 network in the Zone") private String ip6Dns2; - @Parameter(name = ApiConstants.GUEST_CIDR_ADDRESS, type = CommandType.STRING, description = "the guest CIDR address for the Zone") + @Parameter(name = ApiConstants.GUEST_CIDR_ADDRESS, type = CommandType.STRING, description = "The guest CIDR address for the Zone") private String guestCidrAddress; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the Zone") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The ID of the Zone") private Long id; - @Parameter(name = ApiConstants.INTERNAL_DNS1, type = CommandType.STRING, description = "the first internal DNS for the Zone") + @Parameter(name = ApiConstants.INTERNAL_DNS1, type = CommandType.STRING, description = "The first internal DNS for the Zone") private String internalDns1; - @Parameter(name = ApiConstants.INTERNAL_DNS2, type = CommandType.STRING, description = "the second internal DNS for the Zone") + @Parameter(name = ApiConstants.INTERNAL_DNS2, type = CommandType.STRING, description = "The second internal DNS for the Zone") private String internalDns2; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the Zone") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Zone") private String zoneName; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "updates a private zone to public if set, but not vice-versa") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Updates a private zone to public if set, but not vice-versa") private Boolean isPublic; @Parameter(name = ApiConstants.ALLOCATION_STATE, type = CommandType.STRING, description = "Allocation state of this cluster for allocation of new resources") private String allocationState; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "the details for the Zone") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "The details for the Zone") private Map details; - @Parameter(name = ApiConstants.DHCP_PROVIDER, type = CommandType.STRING, description = "the dhcp Provider for the Zone") + @Parameter(name = ApiConstants.DHCP_PROVIDER, type = CommandType.STRING, description = "The DHCP Provider for the Zone") private String dhcpProvider; @Parameter(name = ApiConstants.DOMAIN, @@ -86,13 +86,13 @@ public class UpdateZoneCmd extends BaseCmd { description = "Network domain name for the networks in the zone; empty string will update domain with NULL value") private String domain; - @Parameter(name = ApiConstants.DNS_SEARCH_ORDER, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the dns search order list") + @Parameter(name = ApiConstants.DNS_SEARCH_ORDER, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The DNS search order list") private List dnsSearchOrder; - @Parameter(name = ApiConstants.LOCAL_STORAGE_ENABLED, type = CommandType.BOOLEAN, description = "true if local storage offering enabled, false otherwise") + @Parameter(name = ApiConstants.LOCAL_STORAGE_ENABLED, type = CommandType.BOOLEAN, description = "True if local storage offering enabled, false otherwise") private Boolean localStorageEnabled; - @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the zone, integer") + @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the zone, integer") private Integer sortKey; ///////////////////////////////////////////////////// @@ -178,7 +178,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Zone Id: " + getId()); + CallContext.current().setEventDetails("Zone ID: " + getResourceUuid(ApiConstants.ID)); DataCenter result = _configService.editZone(this); if (result != null) { ZoneResponse response = _responseGenerator.createZoneResponse(ResponseView.Full, result, false, false); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java b/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java new file mode 100644 index 000000000000..b302c4a9beec --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolver.java @@ -0,0 +1,114 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.offering; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.LongFunction; + +import com.cloud.dc.DataCenter; +import com.cloud.domain.Domain; +import com.cloud.exception.InvalidParameterValueException; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * Helper for commands that accept a domainIds or zoneIds string and need to + * resolve them to lists of IDs, falling back to an offering-specific + * default provider. + */ +public interface DomainAndZoneIdResolver { + /** + * Parse the provided domainIds string and return a list of domain IDs. + * If domainIds is empty, the defaultDomainsProvider will be invoked with the + * provided resource id to obtain the current domains. + */ + default List resolveDomainIds(final String domainIds, final Long id, final LongFunction> defaultDomainsProvider, final String resourceTypeName) { + final List validDomainIds = new ArrayList<>(); + final BaseCmd base = (BaseCmd) this; + final Logger logger = LogManager.getLogger(base.getClass()); + + if (StringUtils.isEmpty(domainIds)) { + if (defaultDomainsProvider != null) { + final List defaults = defaultDomainsProvider.apply(id); + if (defaults != null) { + validDomainIds.addAll(defaults); + } + } + return validDomainIds; + } + + final String[] domains = domainIds.split(","); + final String type = (resourceTypeName == null || resourceTypeName.isEmpty()) ? "offering" : resourceTypeName; + for (String domain : domains) { + final String trimmed = domain == null ? "" : domain.trim(); + if (trimmed.isEmpty() || "public".equalsIgnoreCase(trimmed)) { + continue; + } + + final Domain validDomain = base._entityMgr.findByUuid(Domain.class, trimmed); + if (validDomain == null) { + logger.warn("Invalid domain specified for {}", type); + throw new InvalidParameterValueException("Failed to create " + type + " because invalid domain has been specified."); + } + validDomainIds.add(validDomain.getId()); + } + + return validDomainIds; + } + + /** + * Parse the provided zoneIds string and return a list of zone IDs. + * If zoneIds is empty, the defaultZonesProvider will be invoked with the + * provided resource id to obtain the current zones. + */ + default List resolveZoneIds(final String zoneIds, final Long id, final LongFunction> defaultZonesProvider, final String resourceTypeName) { + final List validZoneIds = new ArrayList<>(); + final BaseCmd base = (BaseCmd) this; + final Logger logger = LogManager.getLogger(base.getClass()); + + if (StringUtils.isEmpty(zoneIds)) { + if (defaultZonesProvider != null) { + final List defaults = defaultZonesProvider.apply(id); + if (defaults != null) { + validZoneIds.addAll(defaults); + } + } + return validZoneIds; + } + + final String[] zones = zoneIds.split(","); + final String type = (resourceTypeName == null || resourceTypeName.isEmpty()) ? "offering" : resourceTypeName; + for (String zone : zones) { + final String trimmed = zone == null ? "" : zone.trim(); + if (trimmed.isEmpty() || "all".equalsIgnoreCase(trimmed)) { + continue; + } + + final DataCenter validZone = base._entityMgr.findByUuid(DataCenter.class, trimmed); + if (validZone == null) { + logger.warn("Invalid zone specified for {}: {}", type, trimmed); + throw new InvalidParameterValueException("Failed to create " + type + " because invalid zone has been specified."); + } + validZoneIds.add(validZone.getId()); + } + + return validZoneIds; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java index 2fbcb6df1ccb..63a0a6ca51e9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java @@ -18,6 +18,7 @@ import java.util.List; +import com.cloud.exception.ResourceAllocationException; import org.apache.cloudstack.api.ApiArgValidator; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.BaseCmd; @@ -40,7 +41,7 @@ import com.cloud.projects.Project; import com.cloud.projects.ProjectAccount; -@APICommand(name = "addAccountToProject", description = "Adds account to a project", responseObject = SuccessResponse.class, since = "3.0.0", +@APICommand(name = "addAccountToProject", description = "Adds Account to a project", responseObject = SuccessResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddAccountToProjectCmd extends BaseAsyncCmd { @@ -53,13 +54,13 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = ProjectResponse.class, required = true, - description = "ID of the project to add the account to") + description = "ID of the project to add the Account to") private Long projectId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "name of the account to be added to the project") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Name of the Account to be added to the project") private String accountName; - @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "email to which invitation to the project is going to be sent") + @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "Email to which invitation to the project is going to be sent") private String email; @Parameter(name = ApiConstants.PROJECT_ROLE_ID, type = CommandType.UUID, entityType = ProjectRoleResponse.class, @@ -67,7 +68,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd { private Long projectRoleId; @Parameter(name = ApiConstants.ROLE_TYPE, type = BaseCmd.CommandType.STRING, - description = "Project role type to be assigned to the user - Admin/Regular; default: Regular") + description = "Project role type to be assigned to the User - Admin/Regular; default: Regular") private String roleType; ///////////////////////////////////////////////////// @@ -106,18 +107,18 @@ public ProjectAccount.Role getRoleType() { ///////////////////////////////////////////////////// @Override - public void execute() { + public void execute() throws ResourceAllocationException { if (accountName == null && email == null) { throw new InvalidParameterValueException("Either accountName or email is required"); } - CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.PROJECT_ID) + "; accountName " + accountName); boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail(), getProjectRoleId(), getRoleType()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Account to the project"); } } @@ -146,10 +147,12 @@ public String getEventType() { @Override public String getEventDescription() { + String projectUuid = getResourceUuid(ApiConstants.PROJECT_ID); + if (accountName != null) { - return "Adding account " + getAccountName() + " to project: " + getProjectId(); + return "Adding account " + getAccountName() + " to project: " + projectUuid; } else { - return "Sending invitation to email " + email + " to join project: " + getProjectId(); + return "Sending invitation to email " + email + " to join project: " + projectUuid; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddUserToProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddUserToProjectCmd.java index 9cd845c774c5..683522039b17 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddUserToProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/AddUserToProjectCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.account; +import com.cloud.exception.ResourceAllocationException; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiArgValidator; @@ -38,7 +39,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.ProjectAccount; -@APICommand(name = "addUserToProject", description = "Adds user to a project", responseObject = SuccessResponse.class, since = "4.14", +@APICommand(name = "addUserToProject", description = "Adds User to a project", responseObject = SuccessResponse.class, since = "4.14", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin, RoleType.User}) public class AddUserToProjectCmd extends BaseAsyncCmd { @@ -50,13 +51,13 @@ public class AddUserToProjectCmd extends BaseAsyncCmd { type = BaseCmd.CommandType.UUID, entityType = ProjectResponse.class, required = true, - description = "ID of the project to add the user to") + description = "ID of the project to add the User to") private Long projectId; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Name of the user to be added to the project") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Name of the User to be added to the project") private String username; - @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "email ID of user to which invitation to the project is going to be sent") + @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, description = "Email ID of User to which invitation to the project is going to be sent") private String email; @Parameter(name = ApiConstants.PROJECT_ROLE_ID, type = BaseCmd.CommandType.UUID, entityType = ProjectRoleResponse.class, @@ -64,7 +65,7 @@ public class AddUserToProjectCmd extends BaseAsyncCmd { private Long projectRoleId; @Parameter(name = ApiConstants.ROLE_TYPE, type = BaseCmd.CommandType.STRING, - description = "Project role type to be assigned to the user - Admin/Regular") + description = "Project role type to be assigned to the User - Admin/Regular") private String roleType; ///////////////////////////////////////////////////// @@ -103,7 +104,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Adding user " + getUsername() + " to project: " + getProjectId(); + return "Adding User " + getUsername() + " to Project: " + getResourceUuid(ApiConstants.PROJECT_ID); } ///////////////////////////////////////////////////// @@ -111,14 +112,14 @@ public String getEventDescription() { ///////////////////////////////////////////////////// @Override - public void execute() { + public void execute() throws ResourceAllocationException { validateInput(); boolean result = _projectService.addUserToProject(getProjectId(), getUsername(), getEmail(), getProjectRoleId(), getRoleType()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Account to the project"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java index 5e0977938a30..74e6f2c804c7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java @@ -34,7 +34,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "deleteAccountFromProject", description = "Deletes account from the project", responseObject = SuccessResponse.class, since = "3.0.0", +@APICommand(name = "deleteAccountFromProject", description = "Deletes Account from the project", responseObject = SuccessResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { @@ -46,10 +46,10 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = ProjectResponse.class, required = true, - description = "ID of the project to remove the account from") + description = "ID of the project to remove the Account from") private Long projectId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, required = true, description = "name of the account to be removed from the project") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, required = true, description = "Name of the Account to be removed from the project") private String accountName; ///////////////////////////////////////////////////// @@ -70,13 +70,13 @@ public String getAccountName() { @Override public void execute() { - CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.PROJECT_ID) + "; accountName " + accountName); boolean result = _projectService.deleteAccountFromProject(projectId, accountName); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Account from the project"); } } @@ -103,7 +103,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Removing account " + accountName + " from project: " + projectId; + return "Removing Account " + accountName + " from project: " + getResourceUuid(ApiConstants.PROJECT_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteUserFromProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteUserFromProjectCmd.java index 0731d8378047..2677b206bdc1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteUserFromProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/DeleteUserFromProjectCmd.java @@ -37,7 +37,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; -@APICommand(name = "deleteUserFromProject", description = "Deletes user from the project", responseObject = SuccessResponse.class, since = "4.15.0", +@APICommand(name = "deleteUserFromProject", description = "Deletes User from the project", responseObject = SuccessResponse.class, since = "4.15.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin, RoleType.User}) public class DeleteUserFromProjectCmd extends BaseAsyncCmd { @@ -48,11 +48,11 @@ public class DeleteUserFromProjectCmd extends BaseAsyncCmd { type = BaseCmd.CommandType.UUID, entityType = ProjectResponse.class, required = true, - description = "ID of the project to remove the user from") + description = "ID of the project to remove the User from") private Long projectId; @Parameter(name = ApiConstants.USER_ID, type = BaseCmd.CommandType.UUID, entityType = UserResponse.class, - required = true, description = "Id of the user to be removed from the project") + required = true, description = "Id of the User to be removed from the project") private Long userId; ///////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Removing user " + userId + " from project: " + projectId; + return "Removing User " + getResourceUuid(ApiConstants.USER_ID) + " from project: " + getResourceUuid(ApiConstants.PROJECT_ID); } @Override @@ -107,13 +107,13 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Project ID: " + projectId + "; user ID: " + userId); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.PROJECT_ID) + "; User ID: " + getResourceUuid(ApiConstants.USER_ID)); boolean result = _projectService.deleteUserFromProject(getProjectId(), getUserId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Account from the project"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java index bd9ab30f4f1f..dd0ece878902 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java @@ -39,7 +39,7 @@ import com.cloud.server.ResourceTag; import com.cloud.user.Account; -@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = {Account.class}, +@APICommand(name = "listAccounts", description = "Lists Accounts and provides detailed Account information for listed Accounts", responseObject = AccountResponse.class, responseView = ResponseView.Restricted, entityType = {Account.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListAccountsCmd extends BaseListDomainResourcesCmd implements UserCmd { private static final String s_name = "listaccountsresponse"; @@ -50,32 +50,32 @@ public class ListAccountsCmd extends BaseListDomainResourcesCmd implements UserC @Parameter(name = ApiConstants.ACCOUNT_TYPE, type = CommandType.INTEGER, - description = "list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).") + description = "List Accounts by Account type. Valid Account types are 1 (admin), 2 (domain-admin), and 0 (user).") private Integer accountType; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "list account by account ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "List Account by Account ID") private Long id; - @Parameter(name = ApiConstants.IS_CLEANUP_REQUIRED, type = CommandType.BOOLEAN, description = "list accounts by cleanuprequired attribute (values are true or false)") + @Parameter(name = ApiConstants.IS_CLEANUP_REQUIRED, type = CommandType.BOOLEAN, description = "List accounts by cleanuprequired attribute (values are true or false)") private Boolean cleanupRequired; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list account by account name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List account by account name") private String searchName; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list accounts by state. Valid states are enabled, disabled, and locked.") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List accounts by state. Valid states are enabled, disabled, and locked.") private String state; @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "comma separated list of account details requested, value can be a list of [ all, resource, min]") + description = "Comma separated list of account details requested, value can be a list of [ all, resource, min]") private List viewDetails; @Parameter(name = ApiConstants.API_KEY_ACCESS, type = CommandType.STRING, description = "List accounts by the Api key access value", since = "4.20.1.0", authorized = {RoleType.Admin}) private String apiKeyAccess; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for accounts") + description = "Flag to display the resource icon for accounts") private Boolean showIcon; @Parameter(name = ApiConstants.TAG, type = CommandType.STRING, description = "Tag for resource type to return usage", since = "4.20.0") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java index 21aedc7d7725..aeacf7c60d56 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java @@ -29,7 +29,7 @@ import com.cloud.user.Account; -@APICommand(name = "listProjectAccounts", description = "Lists project's accounts", responseObject = ProjectResponse.class, since = "3.0.0", +@APICommand(name = "listProjectAccounts", description = "Lists project's Accounts", responseObject = ProjectResponse.class, since = "3.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListProjectAccountsCmd extends BaseListCmd { @@ -41,16 +41,16 @@ public class ListProjectAccountsCmd extends BaseListCmd { @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project") private Long projectId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list accounts of the project by account name") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List Accounts of the project by Account name") private String accountName; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "list invitation by user ID") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "List invitation by User ID") private Long userId; - @Parameter(name = ApiConstants.ROLE, type = CommandType.STRING, description = "list accounts of the project by role") + @Parameter(name = ApiConstants.ROLE, type = CommandType.STRING, description = "List Accounts of the project by role") private String role; - @Parameter(name = ApiConstants.PROJECT_ROLE_ID, type = CommandType.UUID, entityType = ProjectRoleResponse.class, description = "list accounts of the project by project role id") + @Parameter(name = ApiConstants.PROJECT_ROLE_ID, type = CommandType.UUID, entityType = ProjectRoleResponse.class, description = "List Accounts of the project by project role id") private Long projectRoleId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java index 5ea144785167..a62f9f316606 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java @@ -58,7 +58,7 @@ import com.cloud.user.Account; @APICommand(name = "associateIpAddress", - description = "Acquires and associates a public IP to an account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId ", + description = "Acquires and associates a public IP to an Account. Either of the parameters are required, i.e. either zoneId, or networkId, or vpcId ", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, @@ -72,58 +72,58 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd implements UserCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account to associate with this IP address") + description = "The Account to associate with this IP address") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the domain to associate with this IP address") + description = "The ID of the domain to associate with this IP address") private Long domainId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the availability zone you want to acquire an public IP address from") + description = "The ID of the availability zone you want to acquire an public IP address from") private Long zoneId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "The network this IP address should be associated to.") + description = "The Network this IP address should be associated to.") private Long networkId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "Deploy VM for the project") + description = "Deploy Instance for the project") private Long projectId; @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, - description = "the VPC you want the IP address to be associated with") + description = "The VPC you want the IP address to be associated with") private Long vpcId; @Parameter(name = ApiConstants.IS_PORTABLE, type = BaseCmd.CommandType.BOOLEAN, - description = "should be set to true if public IP is required to be transferable across zones, if not specified defaults to false") + description = "Should be set to true if public IP is required to be transferable across zones, if not specified defaults to false") private Boolean isPortable; @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, required = false, - description = "region ID from where portable IP is to be associated.") + description = "Region ID from where portable IP is to be associated.") private Integer regionId; @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the IP to the end user or not", since = "4.4", + description = "An optional field, whether to the display the IP to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="IP Address to be associated") + @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description = "IP Address to be associated") private String ipAddress; ///////////////////////////////////////////////////// @@ -198,21 +198,21 @@ public Long getNetworkId() { List networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(), _accountService.getAccount(getEntityOwnerId())); if (networks.size() == 0) { String domain = _domainService.getDomain(getDomainId()).getName(); - throw new InvalidParameterValueException("Account name=" + getAccountName() + " domain=" + domain + " doesn't have virtual networks in zone=" + + throw new InvalidParameterValueException("Account name=" + getAccountName() + " domain=" + domain + " doesn't have virtual Networks in zone=" + zone.getName()); } if (networks.size() < 1) { - throw new InvalidParameterValueException("Account doesn't have any isolated networks in the zone"); + throw new InvalidParameterValueException("Account doesn't have any isolated Networks in the zone"); } else if (networks.size() > 1) { - throw new InvalidParameterValueException("Account has more than one isolated network in the zone"); + throw new InvalidParameterValueException("Account has more than one isolated Network in the zone"); } return networks.get(0).getId(); } else { Network defaultGuestNetwork = _networkService.getExclusiveGuestNetwork(zoneId); if (defaultGuestNetwork == null) { - throw new InvalidParameterValueException("Unable to find a default guest network for account " + getAccountName() + " in domain ID=" + getDomainId()); + throw new InvalidParameterValueException("Unable to find a default guest Network for Account " + getAccountName() + " in domain ID=" + getDomainId()); } else { return defaultGuestNetwork.getId(); } @@ -253,7 +253,7 @@ public long getEntityOwnerId() { } else if (networkId != null) { Network network = _networkService.getNetwork(networkId); if (network == null) { - throw new InvalidParameterValueException("Unable to find network by network id specified"); + throw new InvalidParameterValueException("Unable to find Network by network id specified"); } NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); @@ -334,7 +334,7 @@ public void create() throws ResourceAllocationException { @Override public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException { - CallContext.current().setEventDetails("IP ID: " + getEntityId()); + CallContext.current().setEventDetails("IP address ID: " + getEntityUuid()); IpAddress result = null; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java index f4c06e512f07..835a2a69e3c9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java @@ -35,7 +35,7 @@ import com.cloud.network.IpAddress; import com.cloud.user.Account; -@APICommand(name = "disassociateIpAddress", description = "Disassociates an IP address from the account.", responseObject = SuccessResponse.class, +@APICommand(name = "disassociateIpAddress", description = "Disassociates an IP address from the Account.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, entityType = { IpAddress.class }) public class DisassociateIPAddrCmd extends BaseAsyncCmd { @@ -44,7 +44,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "the ID of the public IP address" + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "The ID of the public IP address" + " to disassociate. Mutually exclusive with the ipaddress parameter") private Long id; @@ -82,7 +82,7 @@ public Long getIpAddressId() { @Override public void execute() throws InsufficientAddressCapacityException { Long ipAddressId = getIpAddressId(); - CallContext.current().setEventDetails("IP ID: " + ipAddressId); + CallContext.current().setEventDetails("IP address ID: " + getResourceUuid(ApiConstants.ID)); boolean result = false; if (!isPortable()) { result = _networkService.releaseIpAddress(ipAddressId); @@ -108,7 +108,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Disassociating IP address with ID=" + id); + return ("Disassociating IP address with ID:" + getResourceUuid(ApiConstants.ID)); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java index 5760ca3ba1c3..d79381e57c4e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java @@ -50,64 +50,67 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, description = "limits search results to allocated public IP addresses") + @Parameter(name = ApiConstants.ALLOCATED_ONLY, type = CommandType.BOOLEAN, description = "Limits search results to allocated public IP addresses") private Boolean allocatedOnly; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "lists all public IP addresses by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Lists all public IP addresses by state. A comma-separated list of states can be passed.") private String state; - @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "the virtual network for the IP address") + @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, description = "The virtual Network for the IP address") private Boolean forVirtualNetwork; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "lists IP address by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "Lists IP address by ID") private Long id; - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "lists the specified IP address") + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "Lists the specified IP address") private String ipAddress; - @Parameter(name = ApiConstants.VLAN_ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, description = "lists all public IP addresses by VLAN ID") + @Parameter(name = ApiConstants.VLAN_ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, description = "Lists all public IP addresses by VLAN ID") private Long vlanId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "lists all public IP addresses by zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Lists all public IP addresses by zone ID") private Long zoneId; - @Parameter(name = ApiConstants.FOR_LOAD_BALANCING, type = CommandType.BOOLEAN, description = "list only IPs used for load balancing") + @Parameter(name = ApiConstants.FOR_LOAD_BALANCING, type = CommandType.BOOLEAN, description = "List only IPs used for load balancing") private Boolean forLoadBalancing; @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "lists all public IP addresses by physical network ID") + description = "Lists all public IP addresses by physical Network ID") private Long physicalNetworkId; @Parameter(name = ApiConstants.ASSOCIATED_NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "lists all public IP addresses associated to the network specified") + description = "Lists all public IP addresses associated to the Network specified") private Long associatedNetworkId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "lists all public IP addresses by source network ID", + description = "Lists all public IP addresses by source Network ID", since = "4.13.0") private Long networkId; - @Parameter(name = ApiConstants.IS_SOURCE_NAT, type = CommandType.BOOLEAN, description = "list only source NAT IP addresses") + @Parameter(name = ApiConstants.IS_SOURCE_NAT, type = CommandType.BOOLEAN, description = "List only source NAT IP addresses") private Boolean isSourceNat; - @Parameter(name = ApiConstants.IS_STATIC_NAT, type = CommandType.BOOLEAN, description = "list only static NAT IP addresses") + @Parameter(name = ApiConstants.IS_STATIC_NAT, type = CommandType.BOOLEAN, description = "List only static NAT IP addresses") private Boolean isStaticNat; @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List IPs belonging to the VPC") private Long vpcId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if range is dedicated for system VMs", since = "4.20.0") private Boolean forSystemVMs; + @Parameter(name = ApiConstants.FOR_PROVIDER, type = CommandType.BOOLEAN, description = "true if range is dedicated for external network provider", since = "4.21.0") + private Boolean forProvider; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -183,6 +186,10 @@ public boolean getForSystemVMs() { return BooleanUtils.isTrue(forSystemVMs); } + public boolean isForProvider() { + return BooleanUtils.isTrue(forProvider); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReleaseIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReleaseIPAddrCmd.java index effe45c51ed0..2fe94b29346d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReleaseIPAddrCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReleaseIPAddrCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.IpAddress; @APICommand(name = "releaseIpAddress", - description = "Releases an IP address from the account.", + description = "Releases an IP address from the Account.", since = "4.17", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, @@ -46,7 +46,7 @@ public class ReleaseIPAddrCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the ID of the public IP address" + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "The ID of the public IP address" + " to release") private Long id; @@ -73,7 +73,7 @@ public long getEntityOwnerId() { @Override public void execute() throws InsufficientAddressCapacityException { - CallContext.current().setEventDetails("IP ID: " + getIpAddressId()); + CallContext.current().setEventDetails("IP address ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkService.releaseReservedIpAddress(getIpAddressId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReserveIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReserveIPAddrCmd.java index e323d413b9ac..7d102abc07fb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReserveIPAddrCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/ReserveIPAddrCmd.java @@ -42,7 +42,7 @@ import com.cloud.user.Account; @APICommand(name = "reserveIpAddress", - description = "Reserve a public IP to an account.", + description = "Reserve a public IP to an Account.", since = "4.17", responseObject = IPAddressResponse.class, responseView = ResponseView.Restricted, @@ -57,24 +57,24 @@ public class ReserveIPAddrCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account to reserve with this IP address") + description = "The Account to reserve with this IP address") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the ID of the domain to reserve with this IP address") + description = "The ID of the domain to reserve with this IP address") private Long domainId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "the ID of the project to reserve with this IP address") + description = "The ID of the project to reserve with this IP address") private Long projectId; @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the IP to the end user or not", + description = "An optional field, whether to the display the IP to the end User or not", authorized = {RoleType.Admin}) private Boolean display; @@ -82,7 +82,7 @@ public class ReserveIPAddrCmd extends BaseCmd implements UserCmd { type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "the ID of the public IP address to reserve") + description = "The ID of the public IP address to reserve") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java index 194967e2e4a4..5e7308685a64 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java @@ -46,14 +46,14 @@ public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the ID of the public IP address" + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "The ID of the public IP address" + " to update") private Long id; // unexposed parameter needed for events logging @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the IP to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the IP to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java index ee0a38ef35dc..9647fd365640 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/CreateAffinityGroupCmd.java @@ -42,25 +42,25 @@ public class CreateAffinityGroupCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an account for the affinity group. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An account for the affinity group. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "domainId of the account owning the affinity group", + description = "DomainId of the account owning the affinity group", entityType = DomainResponse.class) private Long domainId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "create affinity group for project") + description = "Create affinity group for project") private Long projectId; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "optional description of the affinity group") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Optional description of the affinity group") private String description; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the affinity group") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the affinity group") private String affinityGroupName; @Parameter(name = ApiConstants.TYPE, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java index 2f24158cadbb..4eace28f5555 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java @@ -44,12 +44,12 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the affinity group. Must be specified with domain ID") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account of the affinity group. Must be specified with domain ID") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "the domain ID of account owning the affinity group", + description = "The domain ID of account owning the affinity group", entityType = DomainResponse.class) private Long domainId; @@ -63,7 +63,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the affinity group. Mutually exclusive with ID parameter") private String name; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "the project of the affinity group", entityType = ProjectResponse.class) + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "The project of the affinity group", entityType = ProjectResponse.class) private Long projectId; ///////////////////////////////////////////////////// @@ -123,7 +123,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting Affinity Group"; + return "Deleting Affinity Group with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java index ee23e3794ce1..2f30d8d8eeed 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/ListAffinityGroupsCmd.java @@ -36,19 +36,19 @@ public class ListAffinityGroupsCmd extends BaseListProjectAndAccountResourcesCmd //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists affinity groups by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Lists affinity groups by name") private String affinityGroupName; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, - description = "lists affinity groups by virtual machine ID", + description = "Lists affinity groups by Instance ID", entityType = UserVmResponse.class) private Long virtualMachineId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "list the affinity group by the ID provided", entityType = AffinityGroupResponse.class) + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "List the affinity group by the ID provided", entityType = AffinityGroupResponse.class) private Long id; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "lists affinity groups by type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Lists affinity groups by type") private String affinityGroupType; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java index 6cd9bce62595..7a7e3ee298a9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java @@ -46,7 +46,7 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "updateVMAffinityGroup", - description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the " + description = "Updates the affinity/anti-affinity group associations of an Instance. The Instance has to be stopped and restarted for the " + "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, @@ -61,7 +61,7 @@ public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long id; @ACL @@ -69,8 +69,8 @@ public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd implements UserCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, - description = "comma separated list of affinity groups id that are going to be applied to the virtual machine. " - + "Should be passed only when vm is created from a zone with Basic Network support." + " Mutually exclusive with securitygroupnames parameter") + description = "Comma separated list of affinity groups id that are going to be applied to the Instance. " + + "Should be passed only when Instance is created from a zone with Basic Network support." + " Mutually exclusive with securitygroupnames parameter") private List affinityGroupIdList; @ACL @@ -78,8 +78,8 @@ public class UpdateVMAffinityGroupCmd extends BaseAsyncCmd implements UserCmd { type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, - description = "comma separated list of affinity groups names that are going to be applied to the virtual machine." - + " Should be passed only when vm is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter") + description = "Comma separated list of affinity groups names that are going to be applied to the Instance." + + " Should be passed only when Instance is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter") private List affinityGroupNameList; ///////////////////////////////////////////////////// @@ -141,7 +141,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE throw new InvalidParameterValueException("affinitygroupids parameter or affinitygroupnames parameter must be given"); } - CallContext.current().setEventDetails("VM ID: " + getId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result = _affinityGroupService.updateVMAffinityGroups(getId(), getAffinityGroupIdList()); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("affgrp")); @@ -152,7 +152,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VM's affinity groups"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Instance's affinity groups"); } } @@ -163,7 +163,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "updating VM affinity group"; + return "Updating Instance affinity group"; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index a000e265f93b..f4bfcf4f135d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -37,7 +37,7 @@ import com.cloud.user.Account; @APICommand(name = "createAutoScalePolicy", - description = "Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.", + description = "Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale Instance group.", responseObject = AutoScalePolicyResponse.class, entityType = {AutoScalePolicy.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -51,25 +51,25 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, - description = "the name of the autoscale policy", + description = "The name of the autoscale policy", since = "4.18.0") private String name; @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true, - description = "the action to be executed if all the conditions evaluate to true for the specified duration.") + description = "The action to be executed if all the conditions evaluate to true for the specified duration.") private String action; @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, required = true, - description = "the duration in which the conditions have to be true before action is taken") + description = "The duration in which the conditions have to be true before action is taken") private int duration; @Parameter(name = ApiConstants.QUIETTIME, type = CommandType.INTEGER, - description = "the cool down period in which the policy should not be evaluated after the action has been taken") + description = "The cool down period in which the policy should not be evaluated after the action has been taken") private Integer quietTime; @Parameter(name = ApiConstants.CONDITION_IDS, @@ -77,7 +77,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { collectionType = CommandType.UUID, entityType = ConditionResponse.class, required = true, - description = "the list of IDs of the conditions that are being evaluated on every interval") + description = "The list of IDs of the conditions that are being evaluated on every interval") private List conditionIds; // /////////////////////////////////////////////////// @@ -160,7 +160,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating AutoScale Policy"; + return "Creating AutoScale Policy"; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index 7c9362d4b691..7c04a4c9d53b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -39,7 +39,7 @@ import com.cloud.network.rules.LoadBalancer; @APICommand(name = "createAutoScaleVmGroup", - description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", + description = "Creates and automatically starts an Instance based on a service offering, disk offering, and Template.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -55,28 +55,28 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private long lbRuleId; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, - description = "the name of the autoscale vmgroup", + description = "The name of the autoscale Instance Group", since = "4.18.0") private String name; @Parameter(name = ApiConstants.MIN_MEMBERS, type = CommandType.INTEGER, required = true, - description = "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.") + description = "The minimum number of members in the Instance Group, the number of Instances in the Instance group will be equal to or more than this number.") private int minMembers; @Parameter(name = ApiConstants.MAX_MEMBERS, type = CommandType.INTEGER, required = true, - description = "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.") + description = "The maximum number of members in the Instance Group, The number of Instances in the Instance group will be equal to or less than this number.") private int maxMembers; - @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency in which the performance counters to be collected") + @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "The frequency in which the performance counters to be collected") private Integer interval; @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, @@ -84,7 +84,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, required = true, - description = "list of scaleup autoscale policies") + description = "List of scaleup autoscale policies") private List scaleUpPolicyIds; @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, @@ -92,17 +92,17 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, required = true, - description = "list of scaledown autoscale policies") + description = "List of scaledown autoscale policies") private List scaleDownPolicyIds; @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, required = true, - description = "the autoscale profile that contains information about the vms in the vm group.") + description = "The autoscale profile that contains information about the Instances in the Instance group.") private long profileId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -180,12 +180,12 @@ public String getCreateEventType() { @Override public String getCreateEventDescription() { - return "creating AutoScale Vm Group"; + return "Creating AutoScale Instance Group"; } @Override public String getEventDescription() { - return "configuring AutoScale Vm Group. Vm Group Id: " + getEntityId(); + return "Configuring AutoScale Instance Group with ID: " + getEntityId(); } @Override @@ -213,7 +213,7 @@ public void create() throws ResourceAllocationException { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Instance Group"); } } @@ -231,11 +231,11 @@ public void execute() { } } catch (Exception ex) { // TODO what will happen if Resource Layer fails in a step in between - logger.warn("Failed to create autoscale vm group", ex); + logger.warn("Failed to create autoscale Instance group", ex); } finally { if (!success || vmGroup == null) { _autoScaleService.deleteAutoScaleVmGroup(getEntityId(), true); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Instance Group"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 2d84b20c5828..db9688aa09aa 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -44,7 +44,7 @@ import com.cloud.network.as.AutoScaleVmProfile; @APICommand(name = "createAutoScaleVmProfile", - description = "Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.", + description = "Creates a profile that contains information about the Instance which will be provisioned automatically by autoscale feature.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -61,33 +61,33 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "availability zone for the auto deployed virtual machine") + description = "Availability zone for the auto deployed Instance") private Long zoneId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, - description = "the service offering of the auto deployed virtual machine") + description = "The service offering of the auto deployed Instance") private Long serviceOfferingId; @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, - description = "the template of the auto deployed virtual machine") + description = "The Template of the auto deployed Instance") private Long templateId; @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.MAP, - description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine.\n" + description = "Parameters other than zoneId/serviceOfferringId/templateId of the auto deployed Instance.\n" + "Example: otherdeployparams[0].name=serviceofferingid&otherdeployparams[0].value=a7fb50f6-01d9-11ed-8bc1-77f8f0228926&otherdeployparams[1].name=rootdisksize&otherdeployparams[1].value=10 .\n" + "Possible parameters are \"rootdisksize\", \"diskofferingid\",\"size\", \"securitygroupids\", \"overridediskofferingid\", \"keypairs\", \"affinitygroupids'\" and \"networkids\".") private Map> otherDeployParams; @Parameter(name = ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD, type = CommandType.INTEGER, - description = "the time allowed for existing connections to get closed before a vm is expunged") + description = "The time allowed for existing connections to get closed before an Instance is expunged") private Integer expungeVmGracePeriod; @Parameter(name = ApiConstants.COUNTERPARAM_LIST, @@ -97,7 +97,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, - description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + description = "An optional binary data that can be sent to the Instance upon a successful deployment. " + "This binary data must be base64 encoded before adding it to the request. " + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + @@ -115,19 +115,19 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, - description = "the ID of the user used to launch and destroy the VMs") + description = "The ID of the user used to launch and destroy the Instances") private Long autoscaleUserId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that will own the autoscale VM profile") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account that will own the autoscale Instance profile") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the autoscale VM profile") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the autoscale Instance profile") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a autoscale VM profile") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the Account owning an autoscale Instance profile") private Long domainId; // /////////////////////////////////////////////////// @@ -232,7 +232,7 @@ public static String getResultObjectName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -247,7 +247,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating AutoScale Vm Profile"; + return "Creating AutoScale Instance Profile"; } @Override @@ -271,7 +271,7 @@ public void create() throws ResourceAllocationException { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Instance Profile"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index 0ffb9afdac4d..61745ccda7d1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -35,7 +35,7 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.network.as.Condition; -@APICommand(name = "createCondition", description = "Creates a condition for VM auto scaling", responseObject = ConditionResponse.class, entityType = {Condition.class}, +@APICommand(name = "createCondition", description = "Creates a condition for Instance auto scaling", responseObject = ConditionResponse.class, entityType = {Condition.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateConditionCmd extends BaseAsyncCreateCmd { private static final String s_name = "conditionresponse"; @@ -53,13 +53,13 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.THRESHOLD, type = CommandType.LONG, required = true, description = "Value for which the Counter will be evaluated with the Operator selected.") private Long threshold; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the condition. " + "Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account of the condition. " + "Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for condition") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for condition") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID of the account.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The domain ID of the account.") private Long domainId; // /////////////////////////////////////////////////// @@ -127,7 +127,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public String getEventDescription() { - return "creating a condition"; + return "Creating AutoScale condition"; } @Override @@ -137,7 +137,7 @@ public String getEventType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java index cee9460dbe60..45315cc744ca 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java @@ -46,7 +46,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, required = true, - description = "the ID of the autoscale policy") + description = "The ID of the autoscale policy") private Long id; // /////////////////////////////////////////////////// @@ -79,19 +79,19 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting AutoScale Policy: " + getId(); + return "Deleting AutoScale Policy with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("AutoScale Policy Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Policy ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _autoScaleService.deleteAutoScalePolicy(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - logger.warn("Failed to delete autoscale policy " + getId()); + logger.warn("Failed to delete autoscale policy {}", getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index 6bf2157533e1..99d6d903ba45 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -34,7 +34,7 @@ import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes a autoscale vm group.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmGroup.class}, +@APICommand(name = "deleteAutoScaleVmGroup", description = "Deletes an autoscale Instance group.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// @@ -46,12 +46,12 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, required = true, - description = "the ID of the autoscale group") + description = "The ID of the autoscale group") private Long id; @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, - description = "true if all VMs have to be cleaned up, false otherwise", + description = "True if all VMs have to be cleaned up, false otherwise", since = "4.18.0") private Boolean cleanup; @@ -89,19 +89,19 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting autoscale vm group: " + getId(); + return "Deleting AutoScale Instance group with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("AutoScale Vm Group Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Instance Group ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _autoScaleService.deleteAutoScaleVmGroup(id, getCleanup()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - logger.warn("Failed to delete autoscale vm group " + getId()); + logger.warn("Failed to delete autoscale Instance group {}", getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java index b90f6aa8ffa5..bf1e8ecb1677 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java @@ -34,7 +34,7 @@ import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.user.Account; -@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmProfile.class}, +@APICommand(name = "deleteAutoScaleVmProfile", description = "Deletes a autoscale Instance profile.", responseObject = SuccessResponse.class, entityType = {AutoScaleVmProfile.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, required = true, - description = "the ID of the autoscale profile") + description = "The ID of the autoscale profile") private Long id; // /////////////////////////////////////////////////// @@ -79,19 +79,19 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting autoscale vm profile: " + getId(); + return "Deleting AutoScale Instance profile with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("AutoScale VM Profile Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Instance Profile ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _autoScaleService.deleteAutoScaleVmProfile(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - logger.warn("Failed to delete autoscale vm profile " + getId()); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); + logger.warn("Failed to delete autoscale Instance profile {}", getId()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale Instance profile"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index 9590012e0375..38b77c1553f5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -35,7 +35,7 @@ import com.cloud.network.as.Condition; import com.cloud.user.Account; -@APICommand(name = "deleteCondition", description = "Removes a condition for VM auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, +@APICommand(name = "deleteCondition", description = "Removes a condition for Instance auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteConditionCmd extends BaseAsyncCmd { @@ -44,7 +44,7 @@ public class DeleteConditionCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "the ID of the condition.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "The ID of the condition.") private Long id; // /////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - logger.warn("Failed to delete condition " + getId()); + logger.warn("Failed to delete condition {}", getId()); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition."); } } @@ -100,6 +100,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting a condition."; + return "Deleting AutoScale condition with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java index 2414c0d82b62..316fefd62deb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, +@APICommand(name = "disableAutoScaleVmGroup", description = "Disables an AutoScale Instance Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { private static final String s_name = "disableautoscalevmGroupresponse"; @@ -47,7 +47,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, required = true, - description = "the ID of the autoscale group") + description = "The ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// @@ -62,7 +62,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Instance Group"); } } @@ -96,7 +96,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Disabling AutoScale Vm Group. Vm Group Id: " + getId(); + return "Disabling AutoScale Instance Group with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java index 96d329d3e0c8..8aea4690425e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Vm Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, +@APICommand(name = "enableAutoScaleVmGroup", description = "Enables an AutoScale Instance Group", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { private static final String s_name = "enableautoscalevmGroupresponse"; @@ -47,7 +47,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, required = true, - description = "the ID of the autoscale group") + description = "The ID of the autoscale group") private Long id; // /////////////////////////////////////////////////// @@ -62,7 +62,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Instance Group"); } } @@ -96,7 +96,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Enabling AutoScale Vm Group. Vm Group Id: " + getId(); + return "Enabling AutoScale Instance Group with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java index 4935889c5255..5ce0aa7f5b75 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java @@ -40,21 +40,21 @@ public class ListAutoScalePoliciesCmd extends BaseListProjectAndAccountResources // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "the ID of the autoscale policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "The ID of the autoscale policy") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the autoscale policy", since = "4.18.0") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the autoscale policy", since = "4.18.0") private String name; - @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.UUID, entityType = ConditionResponse.class, description = "the ID of the condition of the policy") + @Parameter(name = ApiConstants.CONDITION_ID, type = CommandType.UUID, entityType = ConditionResponse.class, description = "The ID of the condition of the policy") private Long conditionId; @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, - description = "the action to be executed if all the conditions evaluate to true for the specified duration.") + description = "The action to be executed if all the conditions evaluate to true for the specified duration.") private String action; - @Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of the autoscale vm group") + @Parameter(name = ApiConstants.VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "The ID of the autoscale Instance group") private Long vmGroupId; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java index 6aa4abcccd8c..4bb0ef091487 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java @@ -35,7 +35,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.as.AutoScaleVmGroup; -@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale vm groups.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, +@APICommand(name = "listAutoScaleVmGroups", description = "Lists autoscale Instance groups.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -44,25 +44,25 @@ public class ListAutoScaleVmGroupsCmd extends BaseListProjectAndAccountResources // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of the autoscale vm group") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "The ID of the autoscale Instance group") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the autoscale vmgroup", since = "4.18.0") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the autoscale vmgroup", since = "4.18.0") private String name; - @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "the ID of the loadbalancer") + @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "The ID of the loadbalancer") private Long loadBalancerId; - @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, description = "the ID of the profile") + @Parameter(name = ApiConstants.VMPROFILE_ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, description = "The ID of the profile") private Long profileId; - @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "the ID of the policy") + @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "The ID of the policy") private Long policyId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The availability zone ID") private Long zoneId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java index bcaea273ce84..4c95e7a4edcd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.as.AutoScaleVmProfile; -@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class}, +@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale Instance profiles.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourcesCmd { @@ -42,22 +42,22 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, description = "the ID of the autoscale vm profile") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, description = "The ID of the autoscale Instance profile") private Long id; - @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the templateid of the autoscale vm profile") + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "The templateid of the autoscale Instance profile") private Long templateId; - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list profiles by service offering id", since = "4.4") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "List profiles by service offering id", since = "4.4") private Long serviceOffId; - @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "the otherdeployparameters of the autoscale vm profile") + @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "The otherdeployparameters of the autoscale Instance profile") private String otherDeployParams; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "availability zone for the auto deployed virtual machine") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "Availability zone for the auto deployed Instance") private Long zoneId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java index febf937d75f6..02e54a15ac3a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.as.Condition; -@APICommand(name = "listConditions", description = "List Conditions for VM auto scaling", responseObject = ConditionResponse.class, +@APICommand(name = "listConditions", description = "List Conditions for Instance auto scaling", responseObject = ConditionResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListConditionsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -50,7 +50,7 @@ public class ListConditionsCmd extends BaseListProjectAndAccountResourcesCmd { description = "Counter-id of the condition.") private Long counterId; - @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "the ID of the policy") + @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, description = "The ID of the policy") private Long policyId; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java index d03584fd63d5..983c13f07a29 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java @@ -31,7 +31,7 @@ import com.cloud.network.as.Counter; import com.cloud.user.Account; -@APICommand(name = "listCounters", description = "List the counters for VM auto scaling", responseObject = CounterResponse.class, +@APICommand(name = "listCounters", description = "List the counters for Instance auto scaling", responseObject = CounterResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCountersCmd extends BaseListCmd { private static final String s_name = "counterresponse"; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index 927a9191fcc2..05af6a53a5d3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -48,23 +48,23 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, - description = "the name of the autoscale policy", + description = "The name of the autoscale policy", since = "4.18.0") private String name; - @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "the duration in which the conditions have to be true before action is taken") + @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "The duration in which the conditions have to be true before action is taken") private Integer duration; @Parameter(name = ApiConstants.QUIETTIME, type = CommandType.INTEGER, - description = "the cool down period in which the policy should not be evaluated after the action has been taken") + description = "The cool down period in which the policy should not be evaluated after the action has been taken") private Integer quietTime; @Parameter(name = ApiConstants.CONDITION_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ConditionResponse.class, - description = "the list of IDs of the conditions that are being evaluated on every interval") + description = "The list of IDs of the conditions that are being evaluated on every interval") private List conditionIds; @ACL(accessType = AccessType.OperateEntry) @@ -72,12 +72,12 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = AutoScalePolicyResponse.class, required = true, - description = "the ID of the autoscale policy") + description = "The ID of the autoscale policy") private Long id; @Override public void execute() { - CallContext.current().setEventDetails("AutoScale Policy Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Policy ID: " + getResourceUuid(ApiConstants.ID)); AutoScalePolicy result = _autoScaleService.updateAutoScalePolicy(this); if (result != null) { AutoScalePolicyResponse response = _responseGenerator.createAutoScalePolicyResponse(result); @@ -130,7 +130,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating Auto Scale Policy. Policy Id: " + getId(); + return "Updating AutoScale Policy with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index 69ae8aa36aa1..3e13ce10bfb4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -38,7 +38,7 @@ import com.cloud.network.as.AutoScaleVmGroup; import com.cloud.user.Account; -@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale vm group.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, +@APICommand(name = "updateAutoScaleVmGroup", description = "Updates an existing autoscale Instance group.", responseObject = AutoScaleVmGroupResponse.class, entityType = {AutoScaleVmGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { @@ -49,35 +49,35 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, - description = "the name of the autoscale vmgroup", + description = "The name of the autoscale vmgroup", since = "4.18.0") private String name; @Parameter(name = ApiConstants.MIN_MEMBERS, type = CommandType.INTEGER, - description = "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.") + description = "The minimum number of members in the vmgroup, the number of Instances in the Instance group will be equal to or more than this number.") private Integer minMembers; @Parameter(name = ApiConstants.MAX_MEMBERS, type = CommandType.INTEGER, - description = "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.") + description = "The maximum number of members in the vmgroup, The number of Instances in the Instance group will be equal to or less than this number.") private Integer maxMembers; - @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "the frequency in which the performance counters to be collected") + @Parameter(name = ApiConstants.INTERVAL, type = CommandType.INTEGER, description = "The frequency in which the performance counters to be collected") private Integer interval; @Parameter(name = ApiConstants.SCALEUP_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, - description = "list of scaleup autoscale policies") + description = "List of scaleup autoscale policies") private List scaleUpPolicyIds; @Parameter(name = ApiConstants.SCALEDOWN_POLICY_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AutoScalePolicyResponse.class, - description = "list of scaledown autoscale policies") + description = "List of scaledown autoscale policies") private List scaleDownPolicyIds; @ACL(accessType = AccessType.OperateEntry) @@ -85,10 +85,10 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, required = true, - description = "the ID of the autoscale group") + description = "The ID of the autoscale group") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the group to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -97,7 +97,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - CallContext.current().setEventDetails("AutoScale Vm Group Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Instance Group ID: " + getResourceUuid(ApiConstants.ID)); AutoScaleVmGroup result = _autoScaleService.updateAutoScaleVmGroup(this); if (result != null) { AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result); @@ -151,7 +151,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating AutoScale Vm Group. Vm Group Id: " + getId(); + return "Updating AutoScale Instance Group with ID: " + getId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index 0b73fd91b525..9495989df189 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -42,7 +42,7 @@ import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.user.Account; -@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale vm profile.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class}, +@APICommand(name = "updateAutoScaleVmProfile", description = "Updates an existing autoscale Instance profile.", responseObject = AutoScaleVmProfileResponse.class, entityType = {AutoScaleVmProfile.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { @@ -56,25 +56,25 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { type = CommandType.UUID, entityType = AutoScaleVmProfileResponse.class, required = true, - description = "the ID of the autoscale vm profile") + description = "The ID of the autoscale Instance profile") private Long id; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, - description = "the service offering of the auto deployed virtual machine", + description = "The service offering of the auto deployed Instance", since = "4.18.0") private Long serviceOfferingId; @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "the template of the auto deployed virtual machine") + description = "The Template of the auto deployed Instance") private Long templateId; @Parameter(name = ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD, type = CommandType.INTEGER, - description = "the time allowed for existing connections to get closed before a vm is destroyed") + description = "The time allowed for existing connections to get closed before an Instance is destroyed") private Integer expungeVmGracePeriod; @Parameter(name = ApiConstants.COUNTERPARAM_LIST, @@ -84,7 +84,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.MAP, - description = "parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine. \n" + description = "Parameters other than zoneId/serviceOfferringId/templateId of the auto deployed Instance. \n" + "Example: otherdeployparams[0].name=serviceofferingid&otherdeployparams[0].value=a7fb50f6-01d9-11ed-8bc1-77f8f0228926&otherdeployparams[1].name=rootdisksize&otherdeployparams[1].value=10 .\n" + "Possible parameters are \"rootdisksize\", \"diskofferingid\",\"size\", \"securitygroupids\", \"overridediskofferingid\", \"keypairs\", \"affinitygroupids'\" and \"networkids\".", since = "4.18.0") @@ -92,7 +92,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, - description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + description = "An optional binary data that can be sent to the Instance upon a successful deployment. " + "This binary data must be base64 encoded before adding it to the request. " + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + @@ -112,10 +112,10 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.AUTOSCALE_USER_ID, type = CommandType.UUID, entityType = UserResponse.class, - description = "the ID of the user used to launch and destroy the VMs") + description = "The ID of the user used to launch and destroy the Instances") private Long autoscaleUserId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the profile to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -124,14 +124,14 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCustomIdCmd { @Override public void execute() { - CallContext.current().setEventDetails("AutoScale Policy Id: " + getId()); + CallContext.current().setEventDetails("AutoScale Policy ID: " + getResourceUuid(ApiConstants.ID)); AutoScaleVmProfile result = _autoScaleService.updateAutoScaleVmProfile(this); if (result != null) { AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale Instance profile"); } } @@ -190,7 +190,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating AutoScale Vm Profile. Vm Profile Id: " + getId(); + return "Updating AutoScale Instance Profile with ID: " + getId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java index 4ed8244ff0c9..43de212da7b9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/autoscale/UpdateConditionCmd.java @@ -36,7 +36,7 @@ import com.cloud.network.as.Condition; import com.cloud.user.Account; -@APICommand(name = "updateCondition", description = "Updates a condition for VM auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, +@APICommand(name = "updateCondition", description = "Updates a condition for Instance auto scaling", responseObject = SuccessResponse.class, entityType = {Condition.class}, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0") public class UpdateConditionCmd extends BaseAsyncCmd { @@ -46,7 +46,7 @@ public class UpdateConditionCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "the ID of the condition.") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConditionResponse.class, required = true, description = "The ID of the condition.") private Long id; @Parameter(name = ApiConstants.RELATIONAL_OPERATOR, type = CommandType.STRING, required = true, description = "Relational Operator to be used with threshold. Valid values are EQ, GT, LT, GE, LE.") @@ -110,6 +110,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating a condition."; + return "Updating Instance AutoScale condition with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/AssignVirtualMachineToBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/AssignVirtualMachineToBackupOfferingCmd.java index 0e6b2bc165e4..29b1e740b67e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/AssignVirtualMachineToBackupOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/AssignVirtualMachineToBackupOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; @@ -40,7 +41,7 @@ import com.cloud.exception.ResourceUnavailableException; @APICommand(name = "assignVirtualMachineToBackupOffering", - description = "Assigns a VM to a backup offering", + description = "Assigns an Instance to a backup offering", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class AssignVirtualMachineToBackupOfferingCmd extends BaseAsyncCmd { @@ -56,7 +57,7 @@ public class AssignVirtualMachineToBackupOfferingCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the virtual machine") + description = "ID of the Instance") private Long vmId; @Parameter(name = ApiConstants.BACKUP_OFFERING_ID, @@ -90,7 +91,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add VM to backup offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Instance to backup offering"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -102,6 +103,16 @@ public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } + @Override + public Long getApiResourceId() { + return vmId; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.VirtualMachine; + } + @Override public String getEventType() { return EventTypes.EVENT_VM_BACKUP_OFFERING_ASSIGN; @@ -109,6 +120,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Assigning VM to backup offering ID: " + offeringId; + return "Assigning Instance with ID " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to backup offering with ID: " + getResourceUuid(ApiConstants.BACKUP_OFFERING_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupCmd.java index 2d3877882430..8a4053aa15da 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupCmd.java @@ -19,7 +19,6 @@ import javax.inject.Inject; -import com.cloud.storage.Snapshot; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -28,7 +27,6 @@ import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.BackupScheduleResponse; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.backup.BackupManager; @@ -43,7 +41,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "createBackup", - description = "Create VM backup", + description = "Create Instance backup", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class CreateBackupCmd extends BaseAsyncCreateCmd { @@ -59,15 +57,29 @@ public class CreateBackupCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the VM") + description = "ID of the Instance") private Long vmId; - @Parameter(name = ApiConstants.SCHEDULE_ID, - type = CommandType.LONG, - entityType = BackupScheduleResponse.class, - description = "backup schedule ID of the VM, if this is null, it indicates that it is a manual backup.", + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + description = "the name of the backup", since = "4.21.0") - private Long scheduleId; + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, + type = CommandType.STRING, + description = "the description for the backup", + since = "4.21.0") + private String description; + + @Parameter(name = ApiConstants.QUIESCE_VM, + type = CommandType.BOOLEAN, + required = false, + description = "Quiesce the instance before checkpointing the disks for backup. Applicable only to NAS backup provider. " + + "The filesystem is frozen before the backup starts and thawed immediately after. " + + "Requires the instance to have the QEMU Guest Agent installed and running.", + since = "4.21.0") + private Boolean quiesceVM; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -77,12 +89,16 @@ public Long getVmId() { return vmId; } - public Long getScheduleId() { - if (scheduleId != null) { - return scheduleId; - } else { - return Snapshot.MANUAL_POLICY_ID; - } + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public Boolean getQuiesceVM() { + return quiesceVM; } ///////////////////////////////////////////////////// @@ -92,13 +108,13 @@ public Long getScheduleId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { - boolean result = backupManager.createBackup(getVmId(), getScheduleId()); + boolean result = backupManager.createBackup(this, getJob()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Error while creating backup of VM"); + throw new CloudRuntimeException("Error while creating backup of Instance"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -107,7 +123,12 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE @Override public ApiCommandResourceType getApiResourceType() { - return ApiCommandResourceType.Backup; + return ApiCommandResourceType.VirtualMachine; + } + + @Override + public Long getApiResourceId() { + return vmId; } @Override @@ -122,7 +143,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating backup for VM " + vmId; + return "Creating backup for Instance " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupScheduleCmd.java index 1d0741e6217b..f6e17a2b3908 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/CreateBackupScheduleCmd.java @@ -21,12 +21,12 @@ import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.api.response.BackupScheduleResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.backup.BackupManager; @@ -37,8 +37,8 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "createBackupSchedule", - description = "Creates a user-defined VM backup schedule", - responseObject = BackupResponse.class, since = "4.14.0", + description = "Creates a User-defined Instance backup schedule", + responseObject = BackupScheduleResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class CreateBackupScheduleCmd extends BaseCmd { @@ -53,19 +53,19 @@ public class CreateBackupScheduleCmd extends BaseCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the VM for which schedule is to be defined") + description = "ID of the Instance for which schedule is to be defined") private Long vmId; @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, required = true, - description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY") + description = "Valid values are HOURLY, DAILY, WEEKLY, and MONTHLY") private String intervalType; @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = true, - description = "custom backup schedule, the format is:" + description = "Custom backup schedule, the format is:" + "for HOURLY MM*, for DAILY MM:HH*, for WEEKLY MM:HH:DD (1-7)*, for MONTHLY MM:HH:DD (1-28)") private String schedule; @@ -75,12 +75,19 @@ public class CreateBackupScheduleCmd extends BaseCmd { description = "Specifies a timezone for this command. For more information on the timezone parameter, see TimeZone Format.") private String timezone; - @Parameter(name = ApiConstants.MAX_BACKUPS, - type = CommandType.INTEGER, - description = "maximum number of backups to retain", - since = "4.21.0") + @Parameter(name = ApiConstants.MAX_BACKUPS, type = CommandType.INTEGER, + since = "4.21.0", description = ApiConstants.PARAMETER_DESCRIPTION_MAX_BACKUPS) private Integer maxBackups; + @Parameter(name = ApiConstants.QUIESCE_VM, + type = CommandType.BOOLEAN, + required = false, + description = "Quiesce the Instance before checkpointing the disks for backup. Applicable only to NAS backup provider. " + + "The filesystem is frozen before the backup starts and thawed immediately after. " + + "Requires the instance to have the QEMU Guest Agent installed and running.", + since = "4.21.0") + private Boolean quiesceVM; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -105,6 +112,10 @@ public Integer getMaxBackups() { return maxBackups; } + public Boolean getQuiesceVM() { + return quiesceVM; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -118,7 +129,7 @@ public void execute() throws ServerApiException { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Error while creating backup schedule of VM"); + throw new CloudRuntimeException("Error while creating backup schedule of Instance"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -129,4 +140,14 @@ public void execute() throws ServerApiException { public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } + + @Override + public Long getApiResourceId() { + return vmId; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.VirtualMachine; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupCmd.java index 7f0a63ecc912..faaf1735e1e9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupCmd.java @@ -41,7 +41,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "deleteBackup", - description = "Delete VM backup", + description = "Delete Instance backup", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class DeleteBackupCmd extends BaseAsyncCmd { @@ -57,13 +57,13 @@ public class DeleteBackupCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = BackupResponse.class, required = true, - description = "id of the VM backup") + description = "ID of the Instance backup") private Long backupId; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, - description = "force the deletion of backup which removes the entire backup chain but keep VM in Backup Offering", + description = "Force the deletion of backup which removes the entire backup chain but keep Instance in Backup Offering", since = "4.18.0.0") private Boolean forced; @@ -92,7 +92,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Error while deleting backup of VM"); + throw new CloudRuntimeException("Error while deleting backup of Instance"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -111,6 +111,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting backup ID " + backupId; + return "Deleting Backup with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java index 548f4d67b232..8dcf7574aed6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/DeleteBackupScheduleCmd.java @@ -40,10 +40,10 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "deleteBackupSchedule", - description = "Deletes the backup schedule of a VM", + description = "Deletes the backup schedule of a Instance", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) -public class DeleteBackupScheduleCmd extends BaseCmd { +public class DeleteBackupScheduleCmd extends BaseCmd { @Inject private BackupManager backupManager; @@ -52,17 +52,13 @@ public class DeleteBackupScheduleCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, - type = CommandType.UUID, - entityType = UserVmResponse.class, - description = "ID of the VM") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, + description = "ID of the VM from which all backup schedules will be deleted.") private Long vmId; - @Parameter(name = ApiConstants.ID, - type = CommandType.UUID, - entityType = BackupScheduleResponse.class, - description = "ID of the schedule", - since = "4.20.1") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BackupScheduleResponse.class, + since = "4.20.1", description = "ID of the backup schedule to be deleted. It has precedence over the 'virtualmachineid' parameter, " + + "i.e., when the 'id' parameter is specified, the 'virtualmachineid' parameter will be ignored.") private Long id; ///////////////////////////////////////////////////// @@ -89,7 +85,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Failed to delete VM backup schedule"); + throw new CloudRuntimeException("Failed to delete Instance backup schedule"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmd.java index fa6e3ea5d455..17bd06bfdd4b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmd.java @@ -24,7 +24,7 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.BackupScheduleResponse; @@ -39,19 +39,18 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.utils.exception.CloudRuntimeException; import java.util.ArrayList; import java.util.List; @APICommand(name = "listBackupSchedule", - description = "List backup schedule of a VM", + description = "List backup schedule of an Instance", responseObject = BackupScheduleResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) -public class ListBackupScheduleCmd extends BaseCmd { +public class ListBackupScheduleCmd extends BaseListProjectAndAccountResourcesCmd { @Inject - private BackupManager backupManager; + BackupManager backupManager; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -60,10 +59,16 @@ public class ListBackupScheduleCmd extends BaseCmd { @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - required = true, - description = "ID of the VM") + description = "ID of the Instance") private Long vmId; + @Parameter(name = ApiConstants.ID, + type = CommandType.UUID, + entityType = BackupScheduleResponse.class, + description = "the ID of the backup schedule", + since = "4.22.0") + private Long id; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -72,6 +77,10 @@ public Long getVmId() { return vmId; } + public Long getId() { + return id; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -79,19 +88,18 @@ public Long getVmId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try{ - List schedules = backupManager.listBackupSchedule(getVmId()); + List schedules = backupManager.listBackupSchedules(this); ListResponse response = new ListResponse<>(); List scheduleResponses = new ArrayList<>(); + if (!CollectionUtils.isNullOrEmpty(schedules)) { for (BackupSchedule schedule : schedules) { scheduleResponses.add(_responseGenerator.createBackupScheduleResponse(schedule)); } - response.setResponses(scheduleResponses, schedules.size()); - response.setResponseName(getCommandName()); - setResponseObject(response); - } else { - throw new CloudRuntimeException("No backup schedule exists for the VM"); } + response.setResponses(scheduleResponses, schedules.size()); + response.setResponseName(getCommandName()); + setResponseObject(response); } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupsCmd.java index 7d87cc37e6cd..fb9c92f433e5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupsCmd.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.BackupOfferingResponse; import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserVmResponse; @@ -45,7 +46,7 @@ import com.cloud.utils.Pair; @APICommand(name = "listBackups", - description = "Lists VM backups", + description = "Lists Instance backups", responseObject = BackupResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class ListBackupsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -60,21 +61,40 @@ public class ListBackupsCmd extends BaseListProjectAndAccountResourcesCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BackupResponse.class, - description = "id of the backup") + description = "ID of the backup") private Long id; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "id of the VM") + description = "ID of the Instance") private Long vmId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "list backups by zone id") + description = "List backups by zone id") private Long zoneId; + @Parameter(name = ApiConstants.NAME, + type = CommandType.STRING, + since = "4.21.0", + description = "list backups by name") + private String name; + + @Parameter(name = ApiConstants.BACKUP_OFFERING_ID, + type = CommandType.UUID, + entityType = BackupOfferingResponse.class, + since = "4.21.0", + description = "list backups by backup offering") + private Long backupOfferingId; + + @Parameter(name = ApiConstants.LIST_VM_DETAILS, + type = CommandType.BOOLEAN, + since = "4.21.0", + description = "list backups with VM details") + private Boolean listVmDetails; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -87,10 +107,22 @@ public Long getVmId() { return vmId; } + public String getName() { + return name; + } + + public Long getBackupOfferingId() { + return backupOfferingId; + } + public Long getZoneId() { return zoneId; } + public Boolean getListVmDetails() { + return listVmDetails; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -101,7 +133,7 @@ protected void setupResponseBackupList(final List backups, final Integer if (backup == null) { continue; } - BackupResponse backupResponse = _responseGenerator.createBackupResponse(backup); + BackupResponse backupResponse = backupManager.createBackupResponse(backup, this.getListVmDetails()); responses.add(backupResponse); } final ListResponse response = new ListResponse<>(); @@ -116,7 +148,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE Pair, Integer> result = backupManager.listBackups(this); setupResponseBackupList(result.first(), result.second()); } catch (Exception e) { - logger.debug("Exception while listing backups", e); + logger.error("Exception while listing backups", e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RemoveVirtualMachineFromBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RemoveVirtualMachineFromBackupOfferingCmd.java index c451bff54566..62c2f03d8807 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RemoveVirtualMachineFromBackupOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RemoveVirtualMachineFromBackupOfferingCmd.java @@ -21,6 +21,7 @@ import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; @@ -39,7 +40,7 @@ import com.cloud.exception.ResourceUnavailableException; @APICommand(name = "removeVirtualMachineFromBackupOffering", - description = "Removes a VM from any existing backup offering", + description = "Removes an Instance from any existing backup offering", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class RemoveVirtualMachineFromBackupOfferingCmd extends BaseAsyncCmd { @@ -55,12 +56,12 @@ public class RemoveVirtualMachineFromBackupOfferingCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the virtual machine") + description = "ID of the Instance") private Long vmId; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, - description = "Whether to force remove VM from the backup offering that may also delete VM backups.") + description = "Whether to force remove Instance from the backup offering that may also delete Instance backups.") private Boolean forced; ///////////////////////////////////////////////////// @@ -87,7 +88,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove VM from backup offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove Instance from backup offering"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -99,6 +100,16 @@ public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } + @Override + public Long getApiResourceId() { + return vmId; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.VirtualMachine; + } + @Override public String getEventType() { return EventTypes.EVENT_VM_BACKUP_OFFERING_REMOVE; @@ -106,6 +117,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Removing VM ID" + vmId + " from backup offering"; + return "Removing Instance with ID:" + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " from backup offering"; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreBackupCmd.java index 6d02a084b704..c29d117161f2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreBackupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreBackupCmd.java @@ -40,7 +40,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "restoreBackup", - description = "Restores an existing stopped or deleted VM using a VM backup", + description = "Restores an existing stopped or deleted Instance using an Instance backup", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class RestoreBackupCmd extends BaseAsyncCmd { @@ -80,7 +80,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Error while restoring VM from backup"); + throw new CloudRuntimeException("Error while restoring Instance from backup"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -99,6 +99,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Restoring VM from backup: " + backupId; + return "Restoring Instance from backup with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreVolumeFromBackupAndAttachToVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreVolumeFromBackupAndAttachToVMCmd.java index 310b0bd9bf13..c15e6f8de684 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreVolumeFromBackupAndAttachToVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/RestoreVolumeFromBackupAndAttachToVMCmd.java @@ -20,7 +20,9 @@ import javax.inject.Inject; import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; @@ -41,7 +43,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "restoreVolumeFromBackupAndAttachToVM", - description = "Restore and attach a backed up volume to VM", + description = "Restore and attach a backed up volume to Instance", responseObject = SuccessResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class RestoreVolumeFromBackupAndAttachToVMCmd extends BaseAsyncCmd { @@ -53,24 +55,27 @@ public class RestoreVolumeFromBackupAndAttachToVMCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// + @ACL @Parameter(name = ApiConstants.BACKUP_ID, type = CommandType.UUID, entityType = BackupResponse.class, required = true, - description = "ID of the VM backup") + description = "ID of the Instance backup") private Long backupId; + @ACL @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, required = true, description = "ID of the volume backed up") private String volumeUuid; + @ACL @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "id of the VM where to attach the restored volume") + description = "ID of the Instance where to attach the restored volume") private Long vmId; ///////////////////////////////////////////////////// @@ -107,7 +112,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new CloudRuntimeException("Error restoring volume and attaching to VM"); + throw new CloudRuntimeException("Error restoring volume and attaching to Instance"); } } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); @@ -121,6 +126,16 @@ public String getEventType() { @Override public String getEventDescription() { - return "Restoring volume "+ volumeUuid + " from backup " + backupId + " and attaching it to VM " + vmId; + return "Restoring volume "+ volumeUuid + " from backup " + getResourceUuid(ApiConstants.BACKUP_ID) + " and attaching it to Instance " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); + } + + @Override + public Long getApiResourceId() { + return vmId; + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.VirtualMachine; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/UpdateBackupScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/UpdateBackupScheduleCmd.java index 47c8dc42facd..f4938ee0f87d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/UpdateBackupScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/UpdateBackupScheduleCmd.java @@ -22,7 +22,7 @@ import org.apache.cloudstack.api.response.BackupResponse; @APICommand(name = "updateBackupSchedule", - description = "Updates a user-defined VM backup schedule", + description = "Updates a User-defined Instance backup schedule", responseObject = BackupResponse.class, since = "4.14.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class UpdateBackupScheduleCmd extends CreateBackupScheduleCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java index 5d0c838bc377..7caa4ce710ff 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/AddBackupRepositoryCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.backup.repository; +import com.cloud.utils.StringUtils; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -63,12 +64,14 @@ public class AddBackupRepositoryCmd extends BaseCmd { type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "ID of the zone where the backup repository is to be added") + description = "ID of the zone where the backup repository is to be added for taking backups") private Long zoneId; @Parameter(name = ApiConstants.CAPACITY_BYTES, type = CommandType.LONG, description = "capacity of this backup repository") private Long capacityBytes; + @Parameter(name = ApiConstants.CROSS_ZONE_INSTANCE_CREATION, type = CommandType.BOOLEAN, description = "backups on this repository can be used to create Instances on all Zones", since = "4.22.0") + private Boolean crossZoneInstanceCreation; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -98,7 +101,7 @@ public String getProvider() { } public String getMountOptions() { - return mountOptions == null ? "" : mountOptions; + return StringUtils.isBlank(mountOptions) ? "" : mountOptions; } public Long getZoneId() { @@ -109,6 +112,10 @@ public Long getCapacityBytes() { return capacityBytes; } + public Boolean crossZoneInstanceCreationEnabled() { + return crossZoneInstanceCreation; + } + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/UpdateBackupRepositoryCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/UpdateBackupRepositoryCmd.java new file mode 100644 index 000000000000..5ffd79e497ef --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/backup/repository/UpdateBackupRepositoryCmd.java @@ -0,0 +1,116 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.backup.repository; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.BackupRepositoryResponse; +import org.apache.cloudstack.backup.BackupRepository; +import org.apache.cloudstack.backup.BackupRepositoryService; +import org.apache.cloudstack.context.CallContext; + +import javax.inject.Inject; + +@APICommand(name = "updateBackupRepository", + description = "Update a backup repository", + responseObject = BackupRepositoryResponse.class, since = "4.22.0", + authorized = {RoleType.Admin}) +public class UpdateBackupRepositoryCmd extends BaseCmd { + + @Inject + private BackupRepositoryService backupRepositoryService; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, entityType = BackupRepositoryResponse.class, description = "ID of the backup repository") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the backup repository") + private String name; + + @Parameter(name = ApiConstants.ADDRESS, type = CommandType.STRING, description = "address of the backup repository") + private String address; + + @Parameter(name = ApiConstants.MOUNT_OPTIONS, type = CommandType.STRING, description = "shared storage mount options") + private String mountOptions; + + @Parameter(name = ApiConstants.CROSS_ZONE_INSTANCE_CREATION, type = CommandType.BOOLEAN, description = "backups in this repository can be used to create Instances on all Zones") + private Boolean crossZoneInstanceCreation; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public BackupRepositoryService getBackupRepositoryService() { + return backupRepositoryService; + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getAddress() { + return address; + } + + public String getMountOptions() { + return mountOptions == null ? "" : mountOptions; + } + + public Boolean crossZoneInstanceCreationEnabled() { + return crossZoneInstanceCreation; + } + + ///////////////////////////////////////////////////// + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + try { + BackupRepository result = backupRepositoryService.updateBackupRepository(this); + if (result != null) { + BackupRepositoryResponse response = _responseGenerator.createBackupRepositoryResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update the backup repository"); + } + } catch (Exception ex4) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex4.getMessage()); + } + + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccount().getId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/CreateBucketCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/CreateBucketCmd.java index 722556b8e2de..099b56368676 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/CreateBucketCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/CreateBucketCmd.java @@ -150,7 +150,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -181,7 +181,7 @@ public void create() throws ResourceAllocationException { @Override public void execute() { - CallContext.current().setEventDetails("Bucket Id: " + getEntityUuid()); + CallContext.current().setEventDetails("Bucket ID: " + getEntityUuid()); Bucket bucket; try { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/DeleteBucketCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/DeleteBucketCmd.java index 8cd2790e4ae2..abbb1760f9d2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/DeleteBucketCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/DeleteBucketCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api.command.user.bucket; import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.ResourceAllocationException; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.storage.object.Bucket; import com.cloud.user.Account; @@ -82,8 +83,8 @@ public ApiCommandResourceType getApiResourceType() { } @Override - public void execute() throws ConcurrentOperationException { - CallContext.current().setEventDetails("Bucket Id: " + this._uuidMgr.getUuid(Bucket.class, getId())); + public void execute() throws ConcurrentOperationException, ResourceAllocationException { + CallContext.current().setEventDetails("Bucket ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _bucketService.deleteBucket(id, CallContext.current().getCallingAccount()); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/UpdateBucketCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/UpdateBucketCmd.java index f913373c04b6..dc873c300497 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/UpdateBucketCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/bucket/UpdateBucketCmd.java @@ -113,7 +113,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() throws ConcurrentOperationException { - CallContext.current().setEventDetails("Bucket Id: " + this._uuidMgr.getUuid(Bucket.class, getId())); + CallContext.current().setEventDetails("Bucket ID: " + getResourceUuid(ApiConstants.ID)); boolean result = false; try { result = _bucketService.updateBucket(this, CallContext.current().getCallingAccount()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java index 0cecbb370202..2cb64070950b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java @@ -21,7 +21,9 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.CapabilitiesResponse; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.config.ApiServiceConfiguration; import com.cloud.user.Account; @@ -30,12 +32,22 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListCapabilitiesCmd extends BaseCmd { + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.UUID, + entityType = DomainResponse.class, + description = "the domain for listing capabilities.", + since = "4.23.0") + private Long domainId; @Override public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; } + public Long getDomainId() { + return domainId; + } + @Override public void execute() { Map capabilities = _mgr.listCapabilities(this); @@ -51,6 +63,7 @@ public void execute() { response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize")); response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled")); response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled")); + response.setSnapshotShowChainSize((Boolean)capabilities.get("SnapshotShowChainSize")); response.setAllowUserViewDestroyedVM((Boolean)capabilities.get("allowUserViewDestroyedVM")); response.setAllowUserExpungeRecoverVM((Boolean)capabilities.get("allowUserExpungeRecoverVM")); response.setAllowUserExpungeRecoverVolume((Boolean)capabilities.get("allowUserExpungeRecoverVolume")); @@ -72,6 +85,14 @@ public void execute() { response.setInstancesDisksStatsRetentionTime((Integer) capabilities.get(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME)); response.setSharedFsVmMinCpuCount((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_CPU_COUNT)); response.setSharedFsVmMinRamSize((Integer)capabilities.get(ApiConstants.SHAREDFSVM_MIN_RAM_SIZE)); + response.setInstanceLeaseEnabled((Boolean) capabilities.get(ApiConstants.INSTANCE_LEASE_ENABLED)); + response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH)); + response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED)); + response.setAdditionalConfigEnabled((Boolean) capabilities.get(ApiConstants.ADDITONAL_CONFIG_ENABLED)); + if (capabilities.containsKey(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS)) { + Map vpnCustomerGatewayParameters = (Map) capabilities.get(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS); + response.setVpnCustomerGatewayParameters(vpnCustomerGatewayParameters); + } response.setObjectName("capability"); response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/CreateConsoleEndpointCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/CreateConsoleEndpointCmd.java index 63b47e163b6b..41eaf36e4252 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/CreateConsoleEndpointCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/CreateConsoleEndpointCmd.java @@ -35,11 +35,12 @@ import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.utils.consoleproxy.ConsoleAccessUtils; import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.ObjectUtils; import javax.inject.Inject; import java.util.Map; -@APICommand(name = "createConsoleEndpoint", description = "Create a console endpoint to connect to a VM console", +@APICommand(name = "createConsoleEndpoint", description = "Create a console endpoint to connect to a Instance console", responseObject = CreateConsoleEndpointResponse.class, since = "4.18.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) @@ -53,7 +54,7 @@ public class CreateConsoleEndpointCmd extends BaseCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the VM") + description = "ID of the Instance") private Long vmId; @Parameter(name = ApiConstants.TOKEN, @@ -70,7 +71,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE CreateConsoleEndpointResponse response = createResponse(endpoint); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to generate console endpoint for vm " + vmId); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to generate console endpoint for Instance " + vmId); } } @@ -86,6 +87,10 @@ private CreateConsoleEndpointResponse createResponse(ConsoleEndpoint endpoint) { } private ConsoleEndpointWebsocketResponse createWebsocketResponse(ConsoleEndpoint endpoint) { + if (ObjectUtils.allNull(endpoint.getWebsocketHost(), endpoint.getWebsocketPort(), endpoint.getWebsocketPath(), + endpoint.getWebsocketToken(), endpoint.getWebsocketExtra())) { + return null; + } ConsoleEndpointWebsocketResponse wsResponse = new ConsoleEndpointWebsocketResponse(); wsResponse.setHost(endpoint.getWebsocketHost()); wsResponse.setPort(endpoint.getWebsocketPort()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmd.java new file mode 100644 index 000000000000..774cd9d59fe7 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmd.java @@ -0,0 +1,182 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.import org.apache.cloudstack.context.CallContext; +package org.apache.cloudstack.api.command.user.consoleproxy; + +import org.apache.cloudstack.consoleproxy.ConsoleSession; + +import com.cloud.user.Account; +import com.cloud.user.AccountService; +import com.cloud.user.UserAccount; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.ConsoleSessionResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.consoleproxy.ConsoleAccessManager; + +import javax.inject.Inject; +import java.util.Date; + +@APICommand(name = "listConsoleSessions", description = "Lists console sessions.", responseObject = ConsoleSessionResponse.class, + entityType = {ConsoleSession.class}, since = "4.21.0", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin, RoleType.User}) +public class ListConsoleSessionsCmd extends BaseListCmd { + @Inject + private AccountService accountService; + + @Inject + private ConsoleAccessManager consoleAccessManager; + + @ACL + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ConsoleSessionResponse.class, description = "The ID of the console session.") + private Long id; + + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The domain ID of the account that created the console endpoint.") + private Long domainId; + + @ACL + @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "The ID of the account that created the console endpoint.") + private Long accountId; + + @ACL + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "The ID of the user that created the console endpoint.") + private Long userId; + + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, authorized = {RoleType.Admin}, description = "Lists console sessions from the specified host.") + private Long hostId; + + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Lists console sessions generated from this date onwards. " + + ApiConstants.PARAMETER_DESCRIPTION_START_DATE_POSSIBLE_FORMATS) + private Date startDate; + + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "Lists console sessions generated up until this date. " + + ApiConstants.PARAMETER_DESCRIPTION_END_DATE_POSSIBLE_FORMATS) + private Date endDate; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the virtual machine.") + private Long vmId; + + @Parameter(name = ApiConstants.CONSOLE_ENDPOINT_CREATOR_ADDRESS, type = CommandType.STRING, description = "IP address of the creator of the console endpoint.") + private String consoleEndpointCreatorAddress; + + @Parameter(name = ApiConstants.CLIENT_ADDRESS, type = CommandType.STRING, description = "IP address of the client that accessed the console session.") + private String clientAddress; + + @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, + description = "Lists only active console sessions, defaults to true. Active sessions are the ones that have been acquired and have not been removed.") + private boolean activeOnly = true; + + @Parameter(name = ApiConstants.ACQUIRED, type = CommandType.BOOLEAN, + description = "Lists acquired console sessions, defaults to false. Acquired console sessions are the ones that have been accessed. " + + "The 'activeonly' parameter has precedence over the 'acquired' parameter, i.e., when the 'activeonly' parameter is 'true', the 'acquired' parameter value will be ignored.") + private boolean acquired = false; + + @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, + description = "Lists console sessions recursively per domain. If an account ID is informed, only the account's console sessions will be listed. Defaults to false.") + private boolean recursive = false; + + public Long getId() { + return id; + } + + public Long getDomainId() { + return domainId; + } + + public Long getAccountId() { + return accountId; + } + + public Long getUserId() { + return userId; + } + + public Long getHostId() { + return hostId; + } + + public Date getStartDate() { + return startDate; + } + + public Date getEndDate() { + return endDate; + } + + public Long getVmId() { + return vmId; + } + + public String getConsoleEndpointCreatorAddress() { + return consoleEndpointCreatorAddress; + } + + public String getClientAddress() { + return clientAddress; + } + + public boolean isActiveOnly() { + return activeOnly; + } + + public boolean getAcquired() { + return acquired; + } + + public boolean isRecursive() { + return recursive; + } + + @Override + public void execute() { + ListResponse response = consoleAccessManager.listConsoleSessions(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + if (getId() != null) { + ConsoleSession consoleSession = consoleAccessManager.listConsoleSessionById(getId()); + if (consoleSession != null) { + return consoleSession.getAccountId(); + } + } + + if (getAccountId() != null) { + return getAccountId(); + } + + if (getUserId() != null) { + UserAccount userAccount = accountService.getUserAccountById(getUserId()); + if (userAccount != null) { + return userAccount.getAccountId(); + } + } + + return Account.ACCOUNT_ID_SYSTEM; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java index 669b1782e9e4..e449f4b002bc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ArchiveEventsCmd.java @@ -48,18 +48,18 @@ public class ArchiveEventsCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = EventResponse.class, - description = "the IDs of the events") + description = "The IDs of the events") private List ids; - @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "end date range to archive events" + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "End date range to archive events" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date endDate; - @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "start date range to archive events" + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Start date range to archive events" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date startDate; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "archive by event type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Archive by event type") private String type; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java index c9c3f1d69554..db183a08e5ab 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/event/DeleteEventsCmd.java @@ -48,18 +48,18 @@ public class DeleteEventsCmd extends BaseCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = EventResponse.class, - description = "the IDs of the events") + description = "The IDs of the events") private List ids; - @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "end date range to delete events" + @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, description = "End date range to delete events" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date endDate; - @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "start date range to delete events" + @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, description = "Start date range to delete events" + " (including) this date (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-ddThh:mm:ss\")") private Date startDate; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "delete by event type") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Delete by event type") private String type; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java index b5273c649222..b86d1f8b956a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java @@ -36,43 +36,46 @@ public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = EventResponse.class, description = "the ID of the event") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = EventResponse.class, description = "The ID of the event") private Long id; - @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "the duration of the event") + @Parameter(name = ApiConstants.DURATION, type = CommandType.INTEGER, description = "The duration of the event") private Integer duration; @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, - description = "the end date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")") + description = "The end date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")") private Date endDate; - @Parameter(name = ApiConstants.ENTRY_TIME, type = CommandType.INTEGER, description = "the time the event was entered") + @Parameter(name = ApiConstants.ENTRY_TIME, type = CommandType.INTEGER, description = "The time the event was entered") private Integer entryTime; - @Parameter(name = ApiConstants.LEVEL, type = CommandType.STRING, description = "the event level (INFO, WARN, ERROR)") + @Parameter(name = ApiConstants.LEVEL, type = CommandType.STRING, description = "The event level (INFO, WARN, ERROR)") private String level; @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, - description = "the start date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")") + description = "The start date range of the list you want to retrieve (use format \"yyyy-MM-dd\" or the new format \"yyyy-MM-dd HH:mm:ss\")") private Date startDate; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the event type (see event types)") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "The event type (see event types)") private String type; - @Parameter(name = ApiConstants.START_ID, type = CommandType.UUID, entityType = EventResponse.class, description = "the parent/start ID of the event, when provided this will list all the events with the start/parent ID including the parent event") + @Parameter(name = ApiConstants.START_ID, type = CommandType.UUID, entityType = EventResponse.class, description = "The parent/start ID of the event, when provided this will list all the events with the start/parent ID including the parent event") private Long startId; - @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "the ID of the resource associated with the event", since="4.17.0") + @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "The ID of the resource associated with the event", since="4.17.0") private String resourceId; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "the type of the resource associated with the event", since="4.17.0") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "The type of the resource associated with the event", since="4.17.0") private String resourceType; - @Parameter(name = ApiConstants.ARCHIVED, type = CommandType.BOOLEAN, description = "true to list archived events otherwise false", since="4.19.0") + @Parameter(name = ApiConstants.ARCHIVED, type = CommandType.BOOLEAN, description = "True to list archived events otherwise false", since="4.19.0") private Boolean archived; + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "The state of the events", since="4.21.0") + private String state; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -121,6 +124,10 @@ public boolean getArchived() { return archived != null && archived; } + public String getState() { + return state; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java index 8cbbcea6a59f..3fd571b7a479 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java @@ -57,37 +57,37 @@ public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements F type = CommandType.UUID, entityType = NetworkResponse.class, required = true, - description = "the network id of the port forwarding rule") + description = "The Network ID of the port forwarding rule") private Long networkId; @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, - description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.") + description = "The protocol for the firewall rule. Valid values are TCP/UDP/ICMP.") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of firewall rule") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of firewall rule") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to forward traffic from. Multiple entries must be separated by a single comma character (,).") private List cidrlist; - @Parameter(name = ApiConstants.DEST_CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic to. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.DEST_CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to forward traffic to. Multiple entries must be separated by a single comma character (,).") private List destCidrList; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this ICMP message") private Integer icmpCode; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Type of firewallrule: system/user") private String type; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -147,7 +147,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId()); try { - CallContext.current().setEventDetails("Rule Id: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = _firewallService.applyEgressFirewallRules(rule, callerContext.getCallingAccount()); // State is different after the rule is applied, so get new object here rule = _entityMgr.findById(FirewallRule.class, getEntityId()); @@ -255,11 +255,8 @@ public void create() { } } catch (NetworkRuleConflictException ex) { String message = "Network rule conflict: "; - if (!logger.isTraceEnabled()) { - logger.info(message + ex.getMessage()); - } else { - logger.trace(message, ex); - } + logger.error("{}{}", message, ex.getMessage()); + logger.trace(message, ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java index efccb5c09b0d..bc65126f33bd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java @@ -57,34 +57,34 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "the IP address id of the port forwarding rule") + description = "The IP address ID of the port forwarding rule") private Long ipAddressId; @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, - description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.") + description = "The protocol for the firewall rule. Valid values are TCP/UDP/ICMP.") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of firewall rule") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of firewall rule") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the CIDR list to forward traffic from. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to forward traffic from. Multiple entries must be separated by a single comma character (,).") private List cidrlist; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this icmp message") private Integer icmpCode; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "Type of firewallrule: system/user") private String type; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -150,7 +150,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId()); try { - CallContext.current().setEventDetails("Rule ID: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = _firewallService.applyIngressFwRules(rule.getSourceIpAddressId(), callerContext.getCallingAccount()); // State is different after the rule is applied, so get new object here @@ -171,7 +171,7 @@ public void execute() throws ResourceUnavailableException { @Override public long getId() { - throw new UnsupportedOperationException("database ID can only provided by VO objects"); + throw new UnsupportedOperationException("Database ID can only provided by VO objects"); } @Override @@ -271,7 +271,7 @@ public void create() { setEntityUuid(result.getUuid()); } } catch (NetworkRuleConflictException ex) { - logger.trace("Network Rule Conflict: ", ex); + logger.error("Network Rule Conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java index 9d1fe176019d..2bc5fc2ee68b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java @@ -54,7 +54,6 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements PortForwardingRule { - // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// @@ -64,37 +63,37 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "the IP address id of the port forwarding rule") + description = "The IP address ID of the port forwarding rule") private Long ipAddressId; @Parameter(name = ApiConstants.PRIVATE_START_PORT, type = CommandType.INTEGER, required = true, - description = "the starting port of port forwarding rule's private port range") + description = "The starting port of port forwarding rule's private port range") private Integer privateStartPort; @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, - description = "the protocol for the port forwarding rule. Valid values are TCP or UDP.") + description = "The protocol for the port forwarding rule. Valid values are TCP or UDP.") private String protocol; @Parameter(name = ApiConstants.PRIVATE_END_PORT, type = CommandType.INTEGER, required = false, - description = "the ending port of port forwarding rule's private port range") + description = "The ending port of port forwarding rule's private port range") private Integer privateEndPort; @Parameter(name = ApiConstants.PUBLIC_START_PORT, type = CommandType.INTEGER, required = true, - description = "the starting port of port forwarding rule's public port range") + description = "The starting port of port forwarding rule's public port range") private Integer publicStartPort; @Parameter(name = ApiConstants.PUBLIC_END_PORT, type = CommandType.INTEGER, required = false, - description = "the ending port of port forwarding rule's private port range") + description = "The ending port of port forwarding rule's private port range") private Integer publicEndPort; @ACL(accessType = AccessType.OperateEntry) @@ -102,17 +101,17 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "the ID of the virtual machine for the port forwarding rule") + description = "The ID of the Instance for the port forwarding rule") private Long virtualMachineId; @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, - description = " the source CIDR list to allow traffic from; all other CIDRs will be blocked. " + + description = "The source CIDR list to allow traffic from; all other CIDRs will be blocked. " + "Multiple entries must be separated by a single comma character (,). This param will be used only for VPC tiers. By default, all CIDRs are allowed.") private List sourceCidrList; - @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end public port is automatically created; " + @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "If true, firewall rule for source/end public port is automatically created; " + "if false - firewall rule has to be created explicitly. If not specified 1) defaulted to false when PF" + " rule is being created for VPC guest network 2) in all other cases defaulted to true") private Boolean openFirewall; @@ -120,16 +119,16 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "the network of the virtual machine the port forwarding rule will be created for. " + description = "The Network of the Instance the port forwarding rule will be created for. " + "Required when public IP address is not associated with any guest network yet (VPC case).") private Long networkId; @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false, - description = "VM guest nic secondary IP address for the port forwarding rule") + description = "Instance guest NIC secondary IP address for the port forwarding rule") private String vmSecondaryIp; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -199,7 +198,7 @@ public void execute() throws ResourceUnavailableException { boolean success = true; PortForwardingRule rule = null; try { - CallContext.current().setEventDetails("Rule Id: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); if (getOpenFirewall()) { success = success && _firewallService.applyIngressFirewallRules(ipAddressId, callerContext.getCallingAccount()); @@ -278,13 +277,7 @@ public State getState() { @Override public long getNetworkId() { IpAddress ip = _entityMgr.findById(IpAddress.class, getIpAddressId()); - Long ntwkId = null; - - if (ip.getAssociatedWithNetworkId() != null) { - ntwkId = ip.getAssociatedWithNetworkId(); - } else { - ntwkId = networkId; - } + Long ntwkId = _networkService.getPreferredNetworkIdForPublicIpRuleAssignment(ip, networkId); if (ntwkId == null) { throw new InvalidParameterValueException("Unable to create port forwarding rule for the ipAddress id=" + ipAddressId + " as ip is not associated with any network and no networkId is passed in"); @@ -335,7 +328,7 @@ public void create() { Ip privateIp = getVmSecondaryIp(); if (privateIp != null) { if (!NetUtils.isValidIp4(privateIp.toString())) { - throw new InvalidParameterValueException("Invalid vm ip address"); + throw new InvalidParameterValueException("Invalid Instance IP address"); } } @@ -359,7 +352,7 @@ public String getEventType() { @Override public String getEventDescription() { IpAddress ip = _networkService.getIp(ipAddressId); - return ("Applying port forwarding rule for Ip: " + ip.getAddress() + " with virtual machine:" + virtualMachineId); + return ("Applying port forwarding rule for Ip: " + ip.getAddress() + " with Instance:" + virtualMachineId); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java index b93d943eab9f..4b606683a396 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java @@ -46,7 +46,7 @@ public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the firewall rule") private Long id; // unexposed parameter needed for events logging @@ -71,7 +71,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting egress firewall rule id=" + id); + return ("Deleting egress firewall rule with ID: " + getResourceUuid(ApiConstants.ID)); } @Override @@ -89,7 +89,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _firewallService.revokeEgressFirewallRule(id, true); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java index c4a4dfd75cb1..ff2dce8dacf0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java @@ -44,7 +44,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the firewall rule") private Long id; // unexposed parameter needed for events logging @@ -69,7 +69,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting firewall rule ID=" + id); + return ("Deleting firewall rule with ID:" + getResourceUuid(ApiConstants.ID)); } @Override @@ -87,7 +87,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _firewallService.revokeIngressFwRule(id, true); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java index 267d18d8a8a7..d0b607d7af48 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java @@ -48,7 +48,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the port forwarding rule") + description = "The ID of the port forwarding rule") private Long id; // unexposed parameter needed for events logging @@ -73,7 +73,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting port forwarding rule for ID=" + id); + return "Deleting port forwarding rule with ID:" + getResourceUuid(ApiConstants.ID); } @Override @@ -92,7 +92,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Rule ID: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); //revoke corresponding firewall rule first boolean result = _firewallService.revokeRelatedFirewallRule(id, true); result = result && _rulesService.revokePortForwardingRule(id, true); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java index aa0fd28fdec8..4a1547cccaee 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java @@ -48,16 +48,16 @@ public class ListEgressFirewallRulesCmd extends BaseListTaggedResourcesCmd imple @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "the network ID for the egress firewall services") + description = "The network ID for the egress firewall services") private Long networkId; @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "the ID of IP address of the firewall services") + description = "The ID of IP address of the firewall services") private Long ipAddressId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java index 19a05b158908..6cb560df8f0a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java @@ -47,17 +47,17 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd implements @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "the ID of IP address of the firewall services") + description = "The ID of IP address of the firewall services") private Long ipAddressId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "list firewall rules for certain network", + description = "List firewall rules for certain network", since = "4.3") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java index a2e9152a9e47..e5fd35f61eb4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java @@ -48,17 +48,17 @@ public class ListPortForwardingRulesCmd extends BaseListTaggedResourcesCmd { @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "the ID of IP address of the port forwarding services") + description = "The ID of IP address of the port forwarding services") private Long ipAddressId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "list port forwarding rules for certain network", + description = "List port forwarding rules for certain network", since = "4.3") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java index a8db4ec2b29e..26d561dbe03d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateEgressFirewallRuleCmd.java @@ -42,14 +42,14 @@ public class UpdateEgressFirewallRuleCmd extends BaseAsyncCustomIdCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the egress firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the egress firewall rule") private Long id; // unexposed parameter needed for events logging @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -69,7 +69,7 @@ public Boolean getDisplay() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); FirewallRule rule = _firewallService.updateEgressFirewallRule(id, this.getCustomId(), getDisplay()); FirewallResponse fwResponse = new FirewallResponse(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java index 89c9bc891eb0..1c2ea2b1897e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdateFirewallRuleCmd.java @@ -42,14 +42,14 @@ public class UpdateFirewallRuleCmd extends BaseAsyncCustomIdCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the firewall rule") private Long id; // unexposed parameter needed for events logging @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -70,7 +70,7 @@ public Boolean getDisplay() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule ID: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); FirewallRule rule = _firewallService.updateIngressFirewallRule(id, this.getCustomId(), getDisplay()); FirewallResponse fwResponse = new FirewallResponse(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java index ee4bd18ad40a..aaeca27375b7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java @@ -36,33 +36,33 @@ @APICommand(name = "updatePortForwardingRule", responseObject = FirewallRuleResponse.class, - description = "Updates a port forwarding rule. Only the private port and the virtual machine can be updated.", entityType = {PortForwardingRule.class}, + description = "Updates a port forwarding rule. Only the private port and the Instance can be updated.", entityType = {PortForwardingRule.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the port forwarding rule", since = "4.4") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the port forwarding rule", since = "4.4") private Long id; - @Parameter(name=ApiConstants.PRIVATE_START_PORT, type=CommandType.INTEGER, description="the private start port of the port forwarding rule") + @Parameter(name=ApiConstants.PRIVATE_START_PORT, type=CommandType.INTEGER, description = "The private start port of the port forwarding rule") private Integer privatePort; - @Parameter(name=ApiConstants.PRIVATE_END_PORT, type=CommandType.INTEGER, description="the private end port of the port forwarding rule") + @Parameter(name=ApiConstants.PRIVATE_END_PORT, type=CommandType.INTEGER, description = "The private end port of the port forwarding rule") private Integer privateEndPort; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "the ID of the virtual machine for the port forwarding rule") + description = "The ID of the Instance for the port forwarding rule") private Long virtualMachineId; - @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false, description = "VM guest nic Secondary ip address for the port forwarding rule", since = "4.5") + @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false, description = "Instance guest NIC Secondary IP address for the port forwarding rule", since = "4.5") private String vmGuestIp; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.CIDR_LIST, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmd.java new file mode 100644 index 000000000000..b035ecbe71b8 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmd.java @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gpu; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.ListResponse; + +@APICommand(name = "listGpuCards", description = "Lists all available GPU cards", + responseObject = GpuCardResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0") +public class ListGpuCardsCmd extends BaseListCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + description = "ID of the GPU card") + private Long id; + + @Parameter(name = ApiConstants.VENDOR_NAME, type = CommandType.STRING, + description = "vendor name of the GPU card") + private String vendorName; + + @Parameter(name = ApiConstants.VENDOR_ID, type = CommandType.STRING, + description = "vendor ID of the GPU card") + private String vendorId; + + @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.STRING, + description = "device ID of the GPU card") + private String deviceId; + + @Parameter(name = ApiConstants.DEVICE_NAME, type = CommandType.STRING, + description = "device name of the GPU card") + private String deviceName; + + @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, + description = "If true, only GPU cards which have a device will be listed. If false, all GPU cards will be listed.") + private Boolean activeOnly; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getVendorName() { + return vendorName; + } + + public String getVendorId() { + return vendorId; + } + + public String getDeviceId() { + return deviceId; + } + + public String getDeviceName() { + return deviceName; + } + + public boolean getActiveOnly() { + return Boolean.TRUE.equals(activeOnly); + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override public void execute() { + ListResponse response = gpuService.listGpuCards(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmd.java new file mode 100644 index 000000000000..19c920628519 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmd.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gpu; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.command.user.UserCmd; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.context.CallContext; + +@APICommand(name = "listGpuDevices", description = "Lists all available GPU devices", + responseView = ResponseObject.ResponseView.Restricted, + responseObject = GpuDeviceResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class ListGpuDevicesCmd extends BaseListCmd implements UserCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, + description = "the virtual machine ID to which the GPU device is allocated") + private Long vmId; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getVmId() { + return vmId; + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation ////////////////// + /// ////////////////////////////////////////////////// + + @Override + public void execute() { + CallContext.current().setEventDetails("Listing GPU devices"); + ListResponse response = gpuService.listGpuDevices(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmd.java new file mode 100644 index 000000000000..85bf91d7aeea --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmd.java @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gpu; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; + +@APICommand(name = "listVgpuProfiles", description = "Lists all available vGPU profiles", + responseObject = VgpuProfileResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0") +public class ListVgpuProfilesCmd extends BaseListCmd { + + /// ////////////////////////////////////////////////// + /// ///////////// API parameters ///////////////////// + /// ////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VgpuProfileResponse.class, + description = "ID of the vGPU profile") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the vGPU profile") + private String name; + + @Parameter(name = ApiConstants.GPU_CARD_ID, type = CommandType.UUID, entityType = GpuCardResponse.class, + description = "the GPU card ID associated with this GPU device") + private Long cardId; + + @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, + description = "If true, only vGPU profiles which have a device will be listed. If false, all vGPU profiles will be listed.") + private Boolean activeOnly; + + /// ////////////////////////////////////////////////// + /// //////////////// Accessors /////////////////////// + /// ////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public Long getCardId() { + return cardId; + } + + public boolean getActiveOnly() { + return Boolean.TRUE.equals(activeOnly); + } + + /// ////////////////////////////////////////////////// + /// //////////// API Implementation/////////////////// + /// ////////////////////////////////////////////////// + + @Override public void execute() { + ListResponse response = gpuService.listVgpuProfiles(this); + response.setResponseName(getCommandName()); + setResponseObject(response); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java index c74514d662ca..61e1d7aa5192 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java @@ -26,7 +26,9 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import com.cloud.cpu.CPU; import com.cloud.storage.GuestOsCategory; import com.cloud.utils.Pair; @@ -39,12 +41,48 @@ public class ListGuestOsCategoriesCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, description = "list Os category by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, description = "List OS category by ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list os category by name", since = "3.0.1") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List OS category by name", since = "3.0.1") private String name; + @Parameter(name = ApiConstants.IS_FEATURED, + type = CommandType.BOOLEAN, + description = "List available OS categories by featured or not", + since = "4.21.0") + private Boolean featured; + + @Parameter(name = ApiConstants.IS_ISO, + type = CommandType.BOOLEAN, + description = "List OS categories for which an ISO is available", + since = "4.21.0") + private Boolean iso; + + @Parameter(name = ApiConstants.IS_VNF, type = CommandType.BOOLEAN, + description = "List OS categories for which a VNF template is available", + since = "4.21.0") + private Boolean vnf; + + @Parameter(name = ApiConstants.ZONE_ID, + type = CommandType.UUID, + entityType = ZoneResponse.class, + description = "List available OS categories types for the zone", + since = "4.21.0") + private Long zoneId; + + @Parameter(name = ApiConstants.ARCH, + type = CommandType.STRING, + description = "List OS categories types available for given CPU architecture", + since = "4.21.0") + private String arch; + + @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, + type = CommandType.BOOLEAN, + description = "flag to display the resource image for the OS category", + since = "4.21.0") + private Boolean showIcon; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -57,6 +95,30 @@ public String getName() { return name; } + public Boolean isFeatured() { + return featured; + } + + public Boolean isIso() { + return iso; + } + + public Boolean isVnf() { + return vnf; + } + + public Long getZoneId() { + return zoneId; + } + + public CPU.CPUArch getArch() { + return arch == null ? null : CPU.CPUArch.fromType(arch); + } + + public boolean isShowIcon() { + return Boolean.TRUE.equals(showIcon); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -64,14 +126,11 @@ public String getName() { @Override public void execute() { Pair, Integer> result = _mgr.listGuestOSCategoriesByCriteria(this); - ListResponse response = new ListResponse(); - List osCatResponses = new ArrayList(); + ListResponse response = new ListResponse<>(); + List osCatResponses = new ArrayList<>(); for (GuestOsCategory osCategory : result.first()) { - GuestOSCategoryResponse categoryResponse = new GuestOSCategoryResponse(); - categoryResponse.setId(osCategory.getUuid()); - categoryResponse.setName(osCategory.getName()); - - categoryResponse.setObjectName("oscategory"); + GuestOSCategoryResponse categoryResponse = _responseGenerator.createGuestOSCategoryResponse(osCategory, + isShowIcon()); osCatResponses.add(categoryResponse); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java index b31a46692201..d558e4c4f245 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java @@ -42,13 +42,18 @@ public class ListGuestOsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, description = "list by Os type Id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, description = "List by OS type ID") private Long id; - @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, description = "list by Os Category id") + @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, + entityType = GuestOSResponse.class, since = "4.22.1", + description = "Comma separated list of OS types") + private List ids; + + @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, description = "List by OS Category ID") private Long osCategoryId; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "list os by description", since = "3.0.1") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "List OS by description", since = "3.0.1") private String description; @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", @@ -63,6 +68,10 @@ public Long getId() { return id; } + public List getIds() { + return ids; + } + public Long getOsCategoryId() { return osCategoryId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/CreateGuiThemeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/CreateGuiThemeCmd.java new file mode 100644 index 000000000000..8566b413cc12 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/CreateGuiThemeCmd.java @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gui.theme; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuiThemeResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.gui.theme.GuiTheme; +import org.apache.cloudstack.gui.theme.GuiThemeJoin; +import org.apache.cloudstack.gui.theme.GuiThemeService; + +import javax.inject.Inject; + +@APICommand(name = "createGuiTheme", description = "Creates a customized GUI theme for a set of Common Names (fixed or wildcard), a set of domain UUIDs, and/or a set of " + + "account UUIDs.", responseObject = GuiThemeResponse.class, entityType = {GuiTheme.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.21.0.0", authorized = {RoleType.Admin}) +public class CreateGuiThemeCmd extends BaseCmd { + + @Inject + GuiThemeService guiThemeService; + + @Parameter(name = ApiConstants.NAME, required = true, type = CommandType.STRING, length = 2048, description = "A name to identify the theme.") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, length = 4096, description = "A description for the theme.") + private String description; + + @Parameter(name = ApiConstants.CSS, type = CommandType.STRING, length = 65535, description = "The CSS to be retrieved and imported into the GUI " + + "when matching the theme access configurations.") + private String css; + + @Parameter(name = ApiConstants.JSON_CONFIGURATION, type = CommandType.STRING, length = 65535, description = "The JSON with the configurations to be " + + "retrieved and imported into the GUI when matching the theme access configurations.") + private String jsonConfiguration; + + @Parameter(name = ApiConstants.COMMON_NAMES, type = CommandType.STRING, length = 65535, description = "A set of Common Names (CN) (fixed or " + + "wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.com") + private String commonNames; + + @Parameter(name = ApiConstants.DOMAIN_IDS, type = CommandType.STRING, length = 65535, description = "A set of domain UUIDs (also known as ID for " + + "the end-user) separated by comma that can retrieve the theme.") + private String domainIds; + + @Parameter(name = ApiConstants.ACCOUNT_IDS, type = CommandType.STRING, length = 65535, description = "A set of account UUIDs (also known as ID for" + + " the end-user) separated by comma that can retrieve the theme.") + private String accountIds; + + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Defines whether a theme can be retrieved by anyone when only " + + "the `commonNames` is informed. If the `domainIds` or `accountIds` is informed, it is considered as `false`.") + private Boolean isPublic = true; + + @Parameter(name = ApiConstants.RECURSIVE_DOMAINS, type = CommandType.BOOLEAN, description = "Defines whether the subdomains of the informed domains are considered. Default " + + "value is false.") + private Boolean recursiveDomains = false; + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getCss() { + return css; + } + + public String getJsonConfiguration() { + return jsonConfiguration; + } + + public String getCommonNames() { + return commonNames; + } + + public String getDomainIds() { + return domainIds; + } + + public String getAccountIds() { + return accountIds; + } + + public Boolean getPublic() { + return isPublic; + } + + public Boolean getRecursiveDomains() { + return recursiveDomains; + } + + @Override + public void execute() { + GuiThemeJoin guiThemeJoin = guiThemeService.createGuiTheme(this); + + if (guiThemeJoin == null) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create the GUI theme."); + } + + GuiThemeResponse response = _responseGenerator.createGuiThemeResponse(guiThemeJoin); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccountId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/ListGuiThemesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/ListGuiThemesCmd.java new file mode 100644 index 000000000000..35a0a749aa94 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/ListGuiThemesCmd.java @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gui.theme; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.GuiThemeResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.gui.theme.GuiTheme; +import org.apache.cloudstack.gui.theme.GuiThemeService; + +import javax.inject.Inject; + +@APICommand(name = "listGuiThemes", description = "Lists GUI themes.", responseObject = GuiThemeResponse.class, entityType = {GuiTheme.class}, + since = "4.21.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.User, RoleType.DomainAdmin, + RoleType.ResourceAdmin}) +public class ListGuiThemesCmd extends BaseListCmd { + + @Inject + GuiThemeService guiThemeService; + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "The theme ID.", entityType = GuiThemeResponse.class) + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the theme.") + private String name; + + @Parameter(name = ApiConstants.COMMON_NAME, type = CommandType.STRING, description = "The internet Common Name (CN) to be filtered.") + private String commonName; + + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The ID of the domain to be filtered.") + private Long domainId; + + @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "The ID of the account to be filtered.") + private Long accountId; + + @Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "Whether to list all themes.") + private boolean listAll = false; + + @Parameter(name = ApiConstants.SHOW_REMOVED, type = CommandType.BOOLEAN, description = "Whether to list removed themes.") + private boolean showRemoved = false; + + @Parameter(name = ApiConstants.SHOW_PUBLIC, type = CommandType.BOOLEAN, description = "Whether to list public themes.") + private Boolean showPublic; + + @Parameter(name = ApiConstants.LIST_ONLY_DEFAULT_THEME, type = CommandType.BOOLEAN, description = "Whether to only list the default theme.") + private boolean listOnlyDefaultTheme = false; + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getCommonName() { + return commonName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getAccountId() { + return accountId; + } + + public boolean getListAll() { + return listAll; + } + + public boolean getShowRemoved() { + return showRemoved; + } + + public Boolean getShowPublic() { + return showPublic; + } + + public boolean getListOnlyDefaultTheme() { + return listOnlyDefaultTheme; + } + + @Override + public void execute() { + ListResponse response = guiThemeService.listGuiThemes(this); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/RemoveGuiThemeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/RemoveGuiThemeCmd.java new file mode 100644 index 000000000000..64164838eba4 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/RemoveGuiThemeCmd.java @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gui.theme; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.GuiThemeResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.gui.theme.GuiTheme; +import org.apache.cloudstack.gui.theme.GuiThemeService; + +import javax.inject.Inject; + +@APICommand(name = "removeGuiTheme", description = "Removes an existing GUI theme.", responseObject = GuiThemeResponse.class, entityType = {GuiTheme.class}, + since = "4.21.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin}) +public class RemoveGuiThemeCmd extends BaseCmd { + + @Inject + GuiThemeService guiThemeService; + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuiThemeResponse.class, required = true, + description = "The unique identifier of the GUI theme to be removed.") + private Long id; + + public Long getId() { + return id; + } + + @Override + public void execute() { + guiThemeService.removeGuiTheme(this); + final SuccessResponse response = new SuccessResponse(); + response.setResponseName(getCommandName()); + response.setSuccess(true); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccountId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/UpdateGuiThemeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/UpdateGuiThemeCmd.java new file mode 100644 index 000000000000..daef2235ce89 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/gui/theme/UpdateGuiThemeCmd.java @@ -0,0 +1,136 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.gui.theme; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.GuiThemeResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.gui.theme.GuiTheme; +import org.apache.cloudstack.gui.theme.GuiThemeJoin; +import org.apache.cloudstack.gui.theme.GuiThemeService; + +import javax.inject.Inject; + + +@APICommand(name = "updateGuiTheme", description = "Updates an existing GUI theme.", responseObject = GuiThemeResponse.class, entityType = {GuiTheme.class}, + since = "4.21.0.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin}) +public class UpdateGuiThemeCmd extends BaseCmd { + + @Inject + GuiThemeService guiThemeService; + + @Parameter(name = ApiConstants.ID, required = true, type = CommandType.UUID, entityType = GuiThemeResponse.class, description = "The ID of the theme to be updated.") + private Long id; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, length = 2048, description = "A name to identify the theme.") + private String name; + + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, length = 4096, description = "A description for the theme.") + private String description; + + @Parameter(name = ApiConstants.CSS, type = CommandType.STRING, length = 65535, description = "The CSS to be retrieved and imported into the GUI " + + "when matching the theme access configurations.") + private String css; + + @Parameter(name = ApiConstants.JSON_CONFIGURATION, type = CommandType.STRING, length = 65535, description = "The JSON with the configurations to be " + + "retrieved and imported into the GUI when matching the theme access configurations.") + private String jsonConfiguration; + + @Parameter(name = ApiConstants.COMMON_NAMES, type = CommandType.STRING, length = 65535, description = "A set of Common Names (CN) (fixed or " + + "wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.com") + private String commonNames; + + @Parameter(name = ApiConstants.DOMAIN_IDS, type = CommandType.STRING, length = 65535, description = "A set of domain UUIDs (also known as ID for " + + "the end-user) separated by comma that can retrieve the theme.") + private String domainIds; + + @Parameter(name = ApiConstants.RECURSIVE_DOMAINS, type = CommandType.BOOLEAN, description = "Defines whether the subdomains of the informed domains are considered. Default " + + "value is false.") + private Boolean recursiveDomains = false; + + @Parameter(name = ApiConstants.ACCOUNT_IDS, type = CommandType.STRING, length = 65535, description = "A set of account UUIDs (also known as ID for" + + " the end-user) separated by comma that can retrieve the theme.") + private String accountIds; + + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Defines whether a theme can be retrieved by anyone when only " + + "the `commonNames` is informed. If the `domainIds` or `accountIds` is informed, it is considered as `false`.") + private Boolean isPublic = true; + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getCss() { + return css; + } + + public String getJsonConfiguration() { + return jsonConfiguration; + } + + public String getCommonNames() { + return commonNames; + } + + public String getDomainIds() { + return domainIds; + } + + public String getAccountIds() { + return accountIds; + } + + public Boolean getRecursiveDomains() { + return recursiveDomains; + } + + public Boolean getIsPublic() { + return isPublic; + } + + @Override + public void execute() { + GuiThemeJoin guiThemeJoin = guiThemeService.updateGuiTheme(this); + + if (guiThemeJoin == null) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update the GUI theme."); + } + + GuiThemeResponse response = _responseGenerator.createGuiThemeResponse(guiThemeJoin); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + return CallContext.current().getCallingAccountId(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/CreateIpv6FirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/CreateIpv6FirewallRuleCmd.java index 18af5b2973ee..237af7e4601b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/CreateIpv6FirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/CreateIpv6FirewallRuleCmd.java @@ -43,7 +43,7 @@ import com.cloud.utils.net.NetUtils; @APICommand(name = "createIpv6FirewallRule", - description = "Creates an Ipv6 firewall rule in the given network (the network must not belong to VPC)", + description = "Creates an IPv6 firewall rule in the given Network (the Network must not belong to VPC)", responseObject = FirewallRuleResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, @@ -55,34 +55,34 @@ public class CreateIpv6FirewallRuleCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the Ipv6 firewall rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "The protocol for the Ipv6 firewall rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of Ipv6 firewall rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of Ipv6 firewall rule") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of Ipv6 firewall rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of Ipv6 firewall rule") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the source CIDR list to allow traffic from. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The source CIDR list to allow traffic from. Multiple entries must be separated by a single comma character (,).") private List sourceCidrList; - @Parameter(name = ApiConstants.DEST_CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the destination CIDR list to allow traffic to. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.DEST_CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The destination CIDR list to allow traffic to. Multiple entries must be separated by a single comma character (,).") private List destinationCidrlist; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this ICMP message") private Integer icmpCode; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The network of the VM the Ipv6 firewall rule will be created for", required = true) + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The Network of the Instance the Ipv6 firewall rule will be created for", required = true) private Long networkId; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the Ipv6 firewall rule, can be ingress or egress, defaulted to ingress if not specified") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "The traffic type for the Ipv6 firewall rule, can be ingress or egress, defaulted to ingress if not specified") private String trafficType; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end User or not", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -193,7 +193,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Creating ipv6 firewall rule"; + return "Creating IPv6 firewall rule"; } public Integer getIcmpCode() { @@ -232,7 +232,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; FirewallRule rule = ipv6Service.getIpv6FirewallRule(getEntityId()); try { - CallContext.current().setEventDetails("Rule ID: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = ipv6Service.applyIpv6FirewallRule(rule.getId()); // State is different after the rule is applied, so get new object here @@ -246,7 +246,7 @@ public void execute() throws ResourceUnavailableException { } finally { if (!success || rule == null) { ipv6Service.revokeIpv6FirewallRule(getEntityId()); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create ipv6 firewall rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create IPv6 firewall rule"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/DeleteIpv6FirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/DeleteIpv6FirewallRuleCmd.java index aaee19b59489..6df5ce1438a1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/DeleteIpv6FirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/DeleteIpv6FirewallRuleCmd.java @@ -45,7 +45,7 @@ public class DeleteIpv6FirewallRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the IPv6 firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the IPv6 firewall rule") private Long id; ///////////////////////////////////////////////////// @@ -66,7 +66,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting IPv6 firewall rule ID=" + id); + return "Deleting IPv6 firewall rule with ID:" + getResourceUuid(ApiConstants.ID); } @Override @@ -81,7 +81,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("IPv6 firewall rule ID: " + id); + CallContext.current().setEventDetails("IPv6 firewall rule ID: " + getResourceUuid(ApiConstants.ID)); boolean result = ipv6Service.revokeIpv6FirewallRule(id); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/ListIpv6FirewallRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/ListIpv6FirewallRulesCmd.java index 7ade2e3ed040..59401578cb25 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/ListIpv6FirewallRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/ListIpv6FirewallRulesCmd.java @@ -46,16 +46,16 @@ public class ListIpv6FirewallRulesCmd extends BaseListTaggedResourcesCmd impleme //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, - description = "Lists ipv6 firewall rule with the specified ID") + description = "Lists IPv6 firewall rule with the specified ID") private Long id; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list ipv6 firewall rules by network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List IPV6 firewall rules by Network ID") private Long networkId; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "list ipv6 firewall rules by traffic type - ingress or egress") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "List IPV6 firewall rules by traffic type - ingress or egress") private String trafficType; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/UpdateIpv6FirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/UpdateIpv6FirewallRuleCmd.java index 2d63d703dc5e..f090de4e8849 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/UpdateIpv6FirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ipv6/UpdateIpv6FirewallRuleCmd.java @@ -46,31 +46,31 @@ public class UpdateIpv6FirewallRuleCmd extends BaseAsyncCustomIdCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the ipv6 firewall rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the IPv6 firewall rule") private Long id; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the protocol for the Ipv6 firewall rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the Ipv6 firewall rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of Ipv6 firewall rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of Ipv6 firewall rule") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of Ipv6 firewall rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of Ipv6 firewall rule") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The cidr list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") private List cidrlist; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this ICMP message") private Integer icmpCode; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the Ipv6 firewall rule, can be Ingress or Egress, defaulted to Ingress if not specified") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "The traffic type for the Ipv6 firewall rule, can be Ingress or Egress, defaulted to Ingress if not specified") private String trafficType; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the Ipv6 firewall rule to the end user or not", since = "4.4", authorized = { + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the Ipv6 firewall rule to the end User or not", since = "4.4", authorized = { RoleType.Admin}) private Boolean display; @@ -143,7 +143,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating ipv6 firewall rule"; + return "Updating IPv6 firewall rule"; } public Integer getIcmpCode() { @@ -156,7 +156,7 @@ public Integer getIcmpType() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + getId()); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); FirewallRule rules = ipv6Service.updateIpv6FirewallRule(this); FirewallResponse ruleResponse = _responseGenerator.createIpv6FirewallRuleResponse(rules); setResponseObject(ruleResponse); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java index d795fbabb528..47d8d6c35f26 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java @@ -35,7 +35,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.uservm.UserVm; -@APICommand(name = "attachIso", description = "Attaches an ISO to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "attachIso", description = "Attaches an ISO to an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AttachIsoCmd extends BaseAsyncCmd implements UserCmd { @@ -46,11 +46,11 @@ public class AttachIsoCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, - required = true, description = "the ID of the ISO file") + required = true, description = "The ID of the ISO file") protected Long id; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - required = true, description = "the ID of the virtual machine") + required = true, description = "The ID of the Instance") protected Long virtualMachineId; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, @@ -86,7 +86,7 @@ public String getCommandName() { public long getEntityOwnerId() { UserVm vm = _entityMgr.findById(UserVm.class, getVirtualMachineId()); if (vm == null) { - throw new InvalidParameterValueException("Unable to find virtual machine by ID " + getVirtualMachineId()); + throw new InvalidParameterValueException("Unable to find Instance by ID " + getVirtualMachineId()); } return vm.getAccountId(); @@ -99,7 +99,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "attaching ISO: " + getId() + " to VM: " + getVirtualMachineId(); + return "Attaching ISO with ID: " + getResourceUuid(ApiConstants.ID) + " to Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -114,7 +114,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + getVirtualMachineId() + " ISO ID: " + getId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " ISO ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _templateService.attachIso(id, virtualMachineId, isForced()); if (result) { UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java index feae31026b9f..28dfd25b2428 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java @@ -41,13 +41,13 @@ public class DeleteIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the ISO file") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the ISO file") private Long id; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones") + description = "The ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones") private Long zoneId; ///////////////////////////////////////////////////// @@ -87,7 +87,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting ISO " + getId(); + return "Deleting ISO with ID: " + getResourceUuid(ApiConstants.ID) + " from zone " + getResourceUuid(ApiConstants.ZONE_ID); } @Override @@ -102,7 +102,7 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("ISO Id: " + getId()); + CallContext.current().setEventDetails("ISO ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _templateService.deleteIso(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java index 292e1c6f099b..cf4aa41f795c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java @@ -33,7 +33,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.uservm.UserVm; -@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "detachIso", description = "Detaches any ISO file (if any) currently attached to an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DetachIsoCmd extends BaseAsyncCmd implements UserCmd { @@ -44,7 +44,7 @@ public class DetachIsoCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - required = true, description = "The ID of the virtual machine") + required = true, description = "The ID of the Instance") protected Long virtualMachineId; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, @@ -78,7 +78,7 @@ public long getEntityOwnerId() { if (vm != null) { return vm.getAccountId(); } else { - throw new InvalidParameterValueException("Unable to find VM by ID " + getVirtualMachineId()); + throw new InvalidParameterValueException("Unable to find Instance by ID " + getVirtualMachineId()); } } @@ -89,7 +89,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "detaching ISO from VM: " + getVirtualMachineId(); + return "Detaching ISO from Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -104,7 +104,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - boolean result = _templateService.detachIso(virtualMachineId, isForced()); + boolean result = _templateService.detachIso(virtualMachineId, null, isForced()); if (result) { UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId); UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", userVm).get(0); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java index 7861c1e5d412..279db0f3104e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java @@ -43,20 +43,20 @@ public class ExtractIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the ISO file") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the ISO file") private Long id; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "the URL to which the ISO would be extracted") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "The URL to which the ISO would be extracted") private String url; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = false, - description = "the ID of the zone where the ISO is originally located") + description = "The ID of the zone where the ISO is originally located") private Long zoneId; - @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") + @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "The mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") private String mode; ///////////////////////////////////////////////////// @@ -101,7 +101,13 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "extracting ISO: " + getId() + " from zone: " + getZoneId(); + String description = "Extracting ISO: " + getResourceUuid(ApiConstants.ID); + + if (getZoneId() == null) { + description += "from zone: " + getResourceUuid(ApiConstants.ZONE_ID); + } + + return description; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java index 01a47f22b726..43cdf09a89cf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/GetUploadParamsForIsoCmd.java @@ -38,7 +38,7 @@ import com.cloud.exception.ResourceUnavailableException; @APICommand(name = "getUploadParamsForIso", - description = "upload an existing ISO into the CloudStack cloud.", + description = "Upload an existing ISO into the CloudStack cloud.", responseObject = GetUploadParamsResponse.class, since = "4.13", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -50,30 +50,30 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.BOOTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "true if this ISO is bootable. If not passed explicitly its assumed to be true") + @Parameter(name = ApiConstants.BOOTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "True if this ISO is bootable. If not passed explicitly its assumed to be true") private Boolean bootable; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = BaseCmd.CommandType.STRING, - description = "the display text of the ISO. This is usually used for display purposes.", + description = "The display text of the ISO. This is usually used for display purposes.", length = 4096) private String displayText; - @Parameter(name = ApiConstants.IS_FEATURED, type = BaseCmd.CommandType.BOOLEAN, description = "true if you want this ISO to be featured") + @Parameter(name = ApiConstants.IS_FEATURED, type = BaseCmd.CommandType.BOOLEAN, description = "True if you want this ISO to be featured") private Boolean featured; @Parameter(name = ApiConstants.IS_PUBLIC, type = BaseCmd.CommandType.BOOLEAN, - description = "true if you want to register the ISO to be publicly available to all users, false otherwise.") + description = "True if you want to register the ISO to be publicly available to all Users, false otherwise.") private Boolean publicIso; - @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "true if the ISO or its derivatives are extractable; default is false") + @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "True if the ISO or its derivatives are extractable; default is false") private Boolean extractable; @Parameter(name = ApiConstants.OS_TYPE_ID, type = BaseCmd.CommandType.UUID, entityType = GuestOSResponse.class, - description = "the ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed") + description = "The ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed") private Long osTypeId; ///////////////////////////////////////////////////// @@ -104,6 +104,29 @@ public Long getOsTypeId() { return osTypeId; } + public void setBootable(Boolean bootable) { + this.bootable = bootable; + } + + public void setDisplayText(String displayText) { + this.displayText = displayText; + } + + public void setFeatured(Boolean featured) { + this.featured = featured; + } + + public void setPublicIso(Boolean publicIso) { + this.publicIso = publicIso; + } + + public void setExtractable(Boolean extractable) { + this.extractable = extractable; + } + + public void setOsTypeId(Long osTypeId) { + this.osTypeId = osTypeId; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -135,7 +158,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true); + Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java index 6f220c774b84..069f3e4959bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java @@ -1,4 +1,4 @@ -// Licensedname = "listIsoPermissions", to the Apache Software Foundation (ASF) under one +// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file @@ -26,7 +26,7 @@ import com.cloud.storage.Storage.ImageFormat; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "listIsoPermissions", description = "List ISO visibility and all accounts that have permissions to view this ISO.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "listIsoPermissions", description = "List ISO visibility and all Accounts that have permissions to view this ISO.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListIsoPermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd implements UserCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java index 5c4d606a93cd..562cbc2c623d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java @@ -16,11 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import com.cloud.cpu.CPU; -import com.cloud.server.ResourceIcon; -import com.cloud.server.ResourceTag; -import org.apache.cloudstack.api.response.ResourceIconResponse; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -28,16 +23,17 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.UserCmd; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; +import com.cloud.server.ResourceTag; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; @APICommand(name = "listIsos", description = "Lists all available ISO files.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -49,52 +45,57 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if the ISO is bootable, false otherwise") + @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "True if the ISO is bootable, false otherwise") private Boolean bootable; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor for which to restrict the search") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "The hypervisor for which to restrict the search") private String hypervisor; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "list ISO by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "List ISO by ID") private Long id; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the ISO is publicly available to all users, false otherwise.") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True if the ISO is publicly available to all Users, false otherwise.") private Boolean publicIso; - @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "true if this ISO is ready to be deployed") + @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "If True, list ISOs that are ready to be deployed.") private Boolean ready; @Parameter(name = ApiConstants.ISO_FILTER, type = CommandType.STRING, - description = "possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " - + "* featured : templates that have been marked as featured and public. " - + "* self : templates that have been registered or created by the calling user. " - + "* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " - + "* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " - + "* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " - + "* community : templates that have been marked as public but not featured. " + "* all : all templates (only usable by admins).") + description = "Possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " + + "* featured : Templates that have been marked as featured and public. " + + "* self : Templates that have been registered or created by the calling User. " + + "* selfexecutable : same as self, but only returns Templates that can be used to deploy a new Instance. " + + "* sharedexecutable : Templates ready to be deployed that have been granted to the calling User by another User. " + + "* executable : Templates that are owned by the calling User, or public Templates, that can be used to deploy an Instance. " + + "* community : Templates that have been marked as public but not featured. " + "* all : all Templates (only usable by admins).") private String isoFilter = TemplateFilter.selfexecutable.toString(); - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list all ISOs by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List all ISOs by name") private String isoName; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The ID of the zone") private Long zoneId; - @Parameter(name=ApiConstants.SHOW_REMOVED, type=CommandType.BOOLEAN, description="show removed ISOs as well") + @Parameter(name=ApiConstants.SHOW_REMOVED, type=CommandType.BOOLEAN, description = "Show removed ISOs as well") private Boolean showRemoved; - @Parameter(name = ApiConstants.SHOW_UNIQUE, type = CommandType.BOOLEAN, description = "If set to true, list only unique isos across zones", since = "4.13.2") + @Parameter(name = ApiConstants.SHOW_UNIQUE, type = CommandType.BOOLEAN, description = "If set to true, list only unique ISOs across zones", since = "4.13.2") private Boolean showUnique; - @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "flag to display the resource image for the isos") + @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "Flag to display the resource image for the ISOs") private Boolean showIcon; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64", + description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; + @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType= GuestOSCategoryResponse.class, + description = "the ID of the OS category for the ISO", + since = "4.21.0") + private Long osCategoryId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -173,6 +174,10 @@ public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public Long getOsCategoryId() { + return osCategoryId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -190,24 +195,14 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { ListResponse response = _queryService.listIsos(this); - if (response != null && response.getCount() > 0 && getShowIcon()) { - updateIsoResponse(response.getResponses()); + if (response != null && getShowIcon()) { + _responseGenerator.updateTemplateIsoResponsesForIcons(response.getResponses(), + ResourceTag.ResourceObjectType.ISO); } response.setResponseName(getCommandName()); setResponseObject(response); } - private void updateIsoResponse(List response) { - for (TemplateResponse templateResponse : response) { - ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.ISO, templateResponse.getId()); - if (resourceIcon == null) { - continue; - } - ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon); - templateResponse.setResourceIconResponse(iconResponse); - } - } - public Long getStoragePoolId() { return null; }; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java index 81f525522895..1c57e902e221 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java @@ -50,52 +50,52 @@ public class RegisterIsoCmd extends BaseCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if this ISO is bootable. If not passed explicitly its assumed to be true") + @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "True if this ISO is bootable. If not passed explicitly its assumed to be true") private Boolean bootable; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, - description = "the display text of the ISO, defaults to the 'name'", + description = "The display text of the ISO, defaults to the 'name'", length = 4096) private String displayText; - @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if you want this ISO to be featured") + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True if you want this ISO to be featured") private Boolean featured; @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, - description = "true if you want to register the ISO to be publicly available to all users, false otherwise.") + description = "True if you want to register the ISO to be publicly available to all Users, false otherwise.") private Boolean publicIso; - @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the ISO or its derivatives are extractable; default is false") + @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "True if the ISO or its derivatives are extractable; default is false") private Boolean extractable; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the ISO") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, length = 251, description = "The name of the ISO") private String isoName; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, - description = "the ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed") + description = "The ID of the OS type that best represents the OS of this ISO. If the ISO is bootable this parameter needs to be passed") private Long osTypeId; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, description = "the URL to where the ISO is currently being hosted") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, description = "The URL to where the ISO is currently being hosted") private String url; @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, - required=true, description="the ID of the zone you wish to register the ISO to.") + required=true, description = "The ID of the zone you wish to register the ISO to.") protected Long zoneId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId. If the account parameter is used, domainId must also be used.") + description = "An optional domainId. If the Account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account name. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account name. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this ISO. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) + @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "The checksum value of this ISO. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) private String checksum; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Register ISO for the project") @@ -106,21 +106,21 @@ public class RegisterIsoCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, - description = "true if ISO contains XS/VMWare tools inorder to support dynamic scaling of VM CPU/memory") + description = "True if ISO contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory") protected Boolean isDynamicallyScalable; @Parameter(name=ApiConstants.DIRECT_DOWNLOAD, type = CommandType.BOOLEAN, - description = "true if ISO should bypass Secondary Storage and be downloaded to Primary Storage on deployment") + description = "True if ISO should bypass Secondary Storage and be downloaded to Primary Storage on deployment") private Boolean directDownload; @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, - description = "true if password reset feature is supported; default is false") + description = "True if password reset feature is supported; default is false") private Boolean passwordEnabled; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64", + description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; @@ -254,7 +254,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java index 783d78fdce32..2c8401831132 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java @@ -19,6 +19,7 @@ import java.util.Date; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiArgValidator; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; @@ -26,7 +27,7 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ManagementServerResponse; -@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the account.", responseObject = AsyncJobResponse.class, +@APICommand(name = "listAsyncJobs", description = "Lists all pending asynchronous jobs for the Account.", responseObject = AsyncJobResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd { @@ -40,6 +41,12 @@ public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd { @Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "The id of the management server", since="4.19") private Long managementServerId; + @Parameter(name = ApiConstants.RESOURCE_ID, validations = {ApiArgValidator.UuidString}, type = CommandType.STRING, description = "the ID of the resource associated with the job", since="4.22.1") + private String resourceId; + + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "the type of the resource associated with the job", since="4.22.1") + private String resourceType; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -52,6 +59,14 @@ public Long getManagementServerId() { return managementServerId; } + public String getResourceId() { + return resourceId; + } + + public String getResourceType() { + return resourceType; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java index 3d328543dc29..5c3b0084574b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java @@ -16,8 +16,8 @@ // under the License. package org.apache.cloudstack.api.command.user.job; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiArgValidator; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; @@ -34,9 +34,15 @@ public class QueryAsyncJobResultCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.JOB_ID, type = CommandType.UUID, entityType = AsyncJobResponse.class, required = true, description = "the ID of the asynchronous job") + @Parameter(name = ApiConstants.JOB_ID, type = CommandType.UUID, entityType = AsyncJobResponse.class, description = "The ID of the asynchronous job") private Long id; + @Parameter(name = ApiConstants.RESOURCE_ID, validations = {ApiArgValidator.UuidString}, type = CommandType.STRING, description = "the ID of the resource associated with the job", since="4.22.1") + private String resourceId; + + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "the type of the resource associated with the job", since="4.22.1") + private String resourceType; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -45,6 +51,14 @@ public Long getId() { return id; } + public String getResourceId() { + return resourceId; + } + + public String getResourceType() { + return resourceType; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java index 4f9d2f37d13f..c9b31dc84271 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignCertToLoadBalancerCmd.java @@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.SslCertResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.commons.lang3.BooleanUtils; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -47,21 +48,27 @@ public class AssignCertToLoadBalancerCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") Long lbRuleId; @Parameter(name = ApiConstants.CERTIFICATE_ID, type = CommandType.UUID, entityType = SslCertResponse.class, required = true, - description = "the ID of the certificate") + description = "The ID of the certificate") Long certId; + @Parameter(name = ApiConstants.FORCED, + type = CommandType.BOOLEAN, + since = "4.22", + description = "Force assign the certificate. If there is a certificate assigned to the LB, it will be removed at first.") + private Boolean forced; + @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { //To change body of implemented methods use File | Settings | File Templates. - if (_lbService.assignCertToLoadBalancer(getLbRuleId(), getCertId())) { + if (_lbService.assignCertToLoadBalancer(getLbRuleId(), getCertId(), isForced())) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { @@ -76,7 +83,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Assigning a certificate to a load balancer"; + return "Assigning certificate with ID: " + getResourceUuid(ApiConstants.CERTIFICATE_ID) + " to load balancer with ID: " + getResourceUuid(ApiConstants.LBID); } @Override @@ -95,4 +102,19 @@ public Long getCertId() { public Long getLbRuleId() { return lbRuleId; } + + public boolean isForced() { + return BooleanUtils.toBoolean(forced); + } + + @Override + public String getSyncObjType() { + return BaseAsyncCmd.networkSyncObject; + } + + @Override + public Long getSyncObjId() { + LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLbRuleId()); + return (lb != null)? lb.getNetworkId(): null; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java index c4424b1d9374..cc7cd2382b75 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Map; +import com.cloud.network.Network; +import com.cloud.utils.Pair; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.api.APICommand; @@ -45,7 +47,7 @@ import com.cloud.vm.VirtualMachine; @APICommand(name = "assignToLoadBalancerRule", - description = "Assigns virtual machine or a list of virtual machines to a load balancer rule.", + description = "Assigns an Instance or a list of Instances to a load balancer rule.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -60,19 +62,19 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long id; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = UserVmResponse.class, - description = "the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)") + description = "The list of IDs of the Instance that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)") private List virtualMachineIds; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID_IP, type = CommandType.MAP, - description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].vmip=10.1.1.75", + description = "VM ID and IP map, vmidipmap[0].vmid=1 vmidipmap[0].vmip=10.1.1.75. (Optional, for VPC Conserve Mode) Pass vmnetworkid. Example: vmidipmap[0].vmnetworkid=NETWORK_TIER_UUID", since = "4.4") private Map vmIdIpMap; @@ -112,12 +114,13 @@ public String getEventType() { @Override public String getEventDescription() { - return "applying instances for load balancer: " + getLoadBalancerId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; + return "Applying Instances for load balancer with ID: " + getResourceUuid(ApiConstants.ID) + " (Instances IDs: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; } - public Map> getVmIdIpListMap() { - Map> vmIdIpsMap = new HashMap>(); + public Pair>, Map> getVmIdIpListMapAndVmIdNetworkMap() { + Map> vmIdIpsMap = new HashMap<>(); + Map vmIdNetworkMap = new HashMap<>(); if (vmIdIpMap != null && !vmIdIpMap.isEmpty()) { Collection idIpsCollection = vmIdIpMap.values(); Iterator iter = idIpsCollection.iterator(); @@ -125,10 +128,11 @@ public Map> getVmIdIpListMap() { HashMap idIpsMap = (HashMap)iter.next(); String vmId = idIpsMap.get("vmid"); String vmIp = idIpsMap.get("vmip"); + String vmNetworkUuid = idIpsMap.get("vmnetworkid"); VirtualMachine lbvm = _entityMgr.findByUuid(VirtualMachine.class, vmId); if (lbvm == null) { - throw new InvalidParameterValueException("Unable to find virtual machine ID: " + vmId); + throw new InvalidParameterValueException("Unable to find Instance ID: " + vmId); } //check whether the given ip is valid ip or not @@ -145,25 +149,35 @@ public Map> getVmIdIpListMap() { ipsList = new ArrayList(); } ipsList.add(vmIp); + + if (vmNetworkUuid != null) { + Network vmNetwork = _entityMgr.findByUuid(Network.class, vmNetworkUuid); + if (vmNetwork == null) { + throw new InvalidParameterValueException("Unable to find Network ID: " + vmNetworkUuid); + } + vmIdNetworkMap.put(longVmId, vmNetwork.getId()); + } vmIdIpsMap.put(longVmId, ipsList); } } - return vmIdIpsMap; + return new Pair<>(vmIdIpsMap, vmIdNetworkMap); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID) + " Instances IDs: " + StringUtils.join(getVirtualMachineIds(), ",")); - Map> vmIdIpsMap = getVmIdIpListMap(); + Pair>, Map> mapsPair = getVmIdIpListMapAndVmIdNetworkMap(); + Map> vmIdIpsMap = mapsPair.first(); + Map vmIdNetworkMap = mapsPair.second(); boolean result = false; try { - result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap, false); + result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap, vmIdNetworkMap, false); }catch (CloudRuntimeException ex) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule due to: " + ex.getMessage()); } if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java index 2199dfb4e8b4..ae9eb31a2292 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateApplicationLoadBalancerCmd.java @@ -48,51 +48,51 @@ public class CreateApplicationLoadBalancerCmd extends BaseAsyncCreateCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the load balancer") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the load balancer") private String loadBalancerName; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer", length = 4096) + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer", length = 4096) private String description; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, required = true, entityType = NetworkResponse.class, - description = "The guest network the load balancer will be created for") + description = "The guest Network the load balancer will be created for") private Long networkId; @Parameter(name = ApiConstants.SOURCE_PORT, type = CommandType.INTEGER, required = true, - description = "the source port the network traffic will be load balanced from") + description = "The source port the Network traffic will be load balanced from") private Integer sourcePort; - @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, required = true, description = "load balancer algorithm (source, roundrobin, leastconn)") + @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, required = true, description = "Load balancer algorithm (source, roundrobin, leastconn)") private String algorithm; @Parameter(name = ApiConstants.INSTANCE_PORT, type = CommandType.INTEGER, required = true, - description = "the TCP port of the virtual machine where the network traffic will be load balanced to") + description = "The TCP port of the Instance where the network traffic will be load balanced to") private Integer instancePort; - @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "the source IP address the network traffic will be load balanced from") + @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "The source IP address the network traffic will be load balanced from") private String sourceIp; @Parameter(name = ApiConstants.SOURCE_IP_NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, - description = "the network id of the source ip address") + description = "The Network ID of the source IP address") private Long sourceIpNetworkId; @Parameter(name = ApiConstants.SCHEME, type = CommandType.STRING, required = true, - description = "the load balancer scheme. Supported value in this release is Internal") + description = "The load balancer scheme. Supported value in this release is Internal") private String scheme; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -193,7 +193,7 @@ public long getEntityOwnerId() { public void execute() throws ResourceAllocationException, ResourceUnavailableException { ApplicationLoadBalancerRule rule = null; try { - CallContext.current().setEventDetails("Load Balancer Id: " + getEntityId()); + CallContext.current().setEventDetails("Load Balancer ID: " + getEntityUuid()); // State might be different after the rule is applied, so get new object here rule = _entityMgr.findById(ApplicationLoadBalancerRule.class, getEntityId()); ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getEntityId())); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java index c24a5f19f077..7b5cda13f1a5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBHealthCheckPolicyCmd.java @@ -53,10 +53,10 @@ public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long lbRuleId; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer health check policy") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer health check policy") private String description; @Parameter(name = ApiConstants.HEALTHCHECK_PINGPATH, type = CommandType.STRING, required = false, description = "HTTP ping path") @@ -77,16 +77,16 @@ public class CreateLBHealthCheckPolicyCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.HEALTHCHECK_HEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, - description = "Number of consecutive health check success before declaring an instance healthy") + description = "Number of consecutive health check success before declaring an Instance healthy") private int healthyThreshold; @Parameter(name = ApiConstants.HEALTHCHECK_UNHEALTHY_THRESHOLD, type = CommandType.INTEGER, required = false, - description = "Number of consecutive health check failures before declaring an instance unhealthy") + description = "Number of consecutive health check failures before declaring an Instance unhealthy") private int unhealthyThreshold; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @@ -155,7 +155,7 @@ public void execute() throws ResourceAllocationException, ResourceUnavailableExc boolean success = false; try { - CallContext.current().setEventDetails("Load balancer health check policy ID : " + getEntityId()); + CallContext.current().setEventDetails("Load balancer health check policy ID : " + getEntityUuid()); success = _lbService.applyLBHealthCheckPolicy(this); if (success) { // State might be different after the rule is applied, so get new object here diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java index c6b5036bc955..e816e0f95ebb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java @@ -54,25 +54,25 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long lbRuleId; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer stickiness policy") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer stickiness policy") private String description; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the load balancer stickiness policy") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the load balancer stickiness policy") private String lbStickinessPolicyName; @Parameter(name = ApiConstants.METHOD_NAME, type = CommandType.STRING, required = true, - description = "name of the load balancer stickiness policy method, possible values are LbCookie, AppCookie, SourceBased") + description = "Name of the load balancer stickiness policy method, possible values are LbCookie, AppCookie, SourceBased") private String stickinessMethodName; - @Parameter(name = ApiConstants.PARAM_LIST, type = CommandType.MAP, description = "param list. Example: param[0].name=cookiename¶m[0].value=LBCookie ") + @Parameter(name = ApiConstants.PARAM_LIST, type = CommandType.MAP, description = "Param list. Example: param[0].name=cookiename¶m[0].value=LBCookie ") private Map paramList; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @@ -138,7 +138,7 @@ public void execute() throws ResourceAllocationException, ResourceUnavailableExc boolean success = false; try { - CallContext.current().setEventDetails("Rule Id: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = _lbService.applyLBStickinessPolicy(this); if (success) { // State might be different after the rule is applied, so get new object here diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java index 34798c4efe1c..bd72f248364e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java @@ -33,6 +33,7 @@ import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.lang3.StringUtils; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -57,65 +58,65 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements L //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, required = true, description = "load balancer algorithm (source, roundrobin, leastconn)") + @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, required = true, description = "Load balancer algorithm (source, roundrobin, leastconn)") private String algorithm; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer rule", length = 4096) + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer rule", length = 4096) private String description; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the load balancer rule") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the load balancer rule") private String loadBalancerRuleName; @Parameter(name = ApiConstants.PRIVATE_PORT, type = CommandType.INTEGER, required = true, - description = "the private port of the private IP address/virtual machine where the network traffic will be load balanced to") + description = "The private port of the private IP address/Instance where the network traffic will be load balanced to") private Integer privatePort; @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "public IP address ID from where the network traffic will be load balanced from") + description = "Public IP address ID from where the network traffic will be load balanced from") private Long publicIpId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = false, - description = "zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm") + description = "Zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm") private Long zoneId; @Parameter(name = ApiConstants.PUBLIC_PORT, type = CommandType.INTEGER, required = true, - description = "the public port from where the network traffic will be load balanced from") + description = "The public port from where the network traffic will be load balanced from") private Integer publicPort; - @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for" + @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "If true, firewall rule for" + " source/end public port is automatically created; if false - firewall rule has to be created explicitly. If not specified 1) defaulted to false when LB" + " rule is being created for VPC guest network 2) in all other cases defaulted to true") private Boolean openFirewall; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account associated with the load balancer. Must be used with the domainId parameter.") + description = "The Account associated with the load balancer. Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID associated with the load balancer") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The domain ID associated with the load balancer") private Long domainId; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, since = "4.18.0.0", description = "the source CIDR list to allow traffic from; " + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, since = "4.18.0.0", description = "The source CIDR list to allow traffic from; " + "all other CIDRs will be blocked. Multiple entries must be separated by a single comma character (,). By default, all CIDRs are allowed.") private List cidrlist; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The guest network this " - + "rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The guest Network this " + + "rule will be created for. Required when public IP address is not associated with any Guest Network yet (VPC case)") private Long networkId; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB such as tcp, udp or tcp-proxy.") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB such as TCP, UDP, TCP-proxy or SSL.") private String lbProtocol; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -206,7 +207,7 @@ public long getNetworkId() { } else { Network defaultGuestNetwork = _networkService.getExclusiveGuestNetwork(zoneId); if (defaultGuestNetwork == null) { - throw new InvalidParameterValueException("Unable to find a default guest network for account " + getAccountName() + " in domain ID=" + getDomainId()); + throw new InvalidParameterValueException("Unable to find a default guest Network for Account " + getAccountName() + " in domain ID=" + getDomainId()); } else { return defaultGuestNetwork.getId(); } @@ -216,7 +217,7 @@ public long getNetworkId() { if (ipAddr.getAssociatedWithNetworkId() != null) { return ipAddr.getAssociatedWithNetworkId(); } else { - throw new InvalidParameterValueException("IP address ID=" + publicIpId + " is not associated with any network"); + throw new InvalidParameterValueException("IP address ID=" + publicIpId + " is not associated with any Network"); } } } @@ -253,7 +254,7 @@ public List getSourceCidrList() { } public String getLbProtocol() { - return lbProtocol; + return StringUtils.trim(StringUtils.lowerCase(lbProtocol)); } ///////////////////////////////////////////////////// @@ -267,7 +268,7 @@ public void execute() throws ResourceAllocationException, ResourceUnavailableExc boolean success = true; LoadBalancer rule = null; try { - CallContext.current().setEventDetails("Rule Id: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); if (getOpenFirewall()) { success = success && _firewallService.applyIngressFirewallRules(getSourceIpAddressId(), callerContext.getCallingAccount()); @@ -339,10 +340,10 @@ public long getAccountId() { if (account != null) { return account.getId(); } else { - throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain ID=" + domainId); + throw new InvalidParameterValueException("Unable to find Account " + accountName + " in domain ID=" + domainId); } } else { - throw new InvalidParameterValueException("Can't define IP owner. Either specify account/domainId or publicIpId"); + throw new InvalidParameterValueException("Can't define IP owner. Either specify Account/domainId or publicIpId"); } } @@ -387,7 +388,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating load balancer: " + getName() + " account: " + getAccountName(); + return "Creating load balancer: " + getName() + " Account: " + getAccountName(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java index 410df086393c..8cfd1876325a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteApplicationLoadBalancerCmd.java @@ -39,7 +39,7 @@ public class DeleteApplicationLoadBalancerCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the Load Balancer") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the Load Balancer") private Long id; ///////////////////////////////////////////////////// @@ -71,12 +71,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting load balancer: " + getId(); + return "Deleting load balancer with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer ID: " + getId()); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _appLbService.deleteApplicationLoadBalancer(getId()); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java index 3cf1f345037a..c01c5a4ca01e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBHealthCheckPolicyCmd.java @@ -44,7 +44,7 @@ public class DeleteLBHealthCheckPolicyCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = LBHealthCheckResponse.class, required = true, - description = "the ID of the load balancer health check policy") + description = "The ID of the load balancer health check policy") private Long id; // /////////////////////////////////////////////////// @@ -76,12 +76,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting load balancer health check policy: " + getId(); + return "Deleting load balancer health check policy with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer health check policy Id: " + getId()); + CallContext.current().setEventDetails("Load balancer health check policy ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _lbService.deleteLBHealthCheckPolicy(getId(), true); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java index 5d04de3cae58..f26382478f4e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java @@ -45,7 +45,7 @@ public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = LBStickinessResponse.class, required = true, - description = "the ID of the LB stickiness policy") + description = "The ID of the LB stickiness policy") private Long id; // /////////////////////////////////////////////////// @@ -82,12 +82,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting load balancer stickiness policy: " + getId(); + return "Deleting load balancer stickiness policy with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer stickiness policy ID: " + getId()); + CallContext.current().setEventDetails("Load balancer stickiness policy ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _lbService.deleteLBStickinessPolicy(getId(), true); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java index b4079430ee32..a41808ced397 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java @@ -44,7 +44,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long id; ///////////////////////////////////////////////////// @@ -76,12 +76,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting load balancer: " + getId(); + return "Deleting load balancer with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer ID: " + getId()); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _firewallService.revokeRelatedFirewallRule(id, true); result = result && _lbService.deleteLoadBalancerRule(id, true); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java index d54f3e1155ec..b1d29f18f1a2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListApplicationLoadBalancersCmd.java @@ -43,28 +43,28 @@ public class ListApplicationLoadBalancersCmd extends BaseListTaggedResourcesCmd // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "the ID of the load balancer") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "The ID of the load balancer") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the load balancer") private String loadBalancerName; - @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "the source IP address of the load balancer") + @Parameter(name = ApiConstants.SOURCE_IP, type = CommandType.STRING, description = "The source IP address of the load balancer") private String sourceIp; @Parameter(name = ApiConstants.SOURCE_IP_NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "the network ID of the source IP address") + description = "The network ID of the source IP address") private Long sourceIpNetworkId; - @Parameter(name = ApiConstants.SCHEME, type = CommandType.STRING, description = "the scheme of the load balancer. Supported value is internal in the current release") + @Parameter(name = ApiConstants.SCHEME, type = CommandType.STRING, description = "The scheme of the load balancer. Supported value is internal in the current release") private String scheme; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the network ID of the load balancer") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The network ID of the load balancer") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java index cb2cdb446d1c..e91f315bdaf1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java @@ -44,13 +44,13 @@ public class ListLBHealthCheckPoliciesCmd extends BaseListCmd { @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long lbRuleId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBHealthCheckResponse.class, description = "the ID of the health check policy", since = "4.4") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBHealthCheckResponse.class, description = "The ID of the health check policy", since = "4.4") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java index a48e2ea37b71..a14f731435b1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java @@ -45,17 +45,17 @@ public class ListLBStickinessPoliciesCmd extends BaseListCmd { @Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long lbRuleId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBStickinessResponse.class, - description = "the ID of the load balancer stickiness policy") + description = "The ID of the load balancer stickiness policy") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java index 3bfc68a95bad..bf4604612b1d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java @@ -36,7 +36,7 @@ import com.cloud.uservm.UserVm; import com.cloud.utils.Pair; -@APICommand(name = "listLoadBalancerRuleInstances", description = "List all virtual machine instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "listLoadBalancerRuleInstances", description = "List all Instances that are assigned to a load balancer rule.", responseObject = LoadBalancerRuleVmMapResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd implements UserCmd { @@ -49,20 +49,20 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd implements Use @Parameter(name = ApiConstants.APPLIED, type = CommandType.BOOLEAN, - description = "true if listing all virtual machines currently applied to the load balancer rule; default is true") + description = "True if listing all Instances currently applied to the load balancer rule; default is true") private Boolean applied; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") private Long id; @Parameter(name = ApiConstants.LIST_LB_VMIPS, type = CommandType.BOOLEAN, - description = "true if load balancer rule VM IP information to be included; default is false") + description = "True if load balancer rule Instance IP information to be included; default is false") private boolean isListLbVmip; @@ -95,10 +95,10 @@ public String getCommandName() { public void execute() { Pair, List> vmServiceMap = _lbService.listLoadBalancerInstances(this); List result = vmServiceMap.first(); - logger.debug(String.format("A total of [%s] user VMs were obtained when listing the load balancer instances: [%s].", result.size(), result)); + logger.debug("A total of [{}] user VMs were obtained when listing the load balancer instances: [{}].", result.size(), result); List serviceStates = vmServiceMap.second(); - logger.debug(String.format("A total of [%s] service states were obtained when listing the load balancer instances: [%s].", serviceStates.size(), serviceStates)); + logger.debug("A total of [{}] service states were obtained when listing the load balancer instances: [{}].", serviceStates.size(), serviceStates); if (!isListLbVmip()) { ListResponse response = new ListResponse<>(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java index b8b82f0c4a89..6ee317567776 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java @@ -44,31 +44,31 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "the ID of the load balancer rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "The ID of the load balancer rule") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the load balancer rule") private String loadBalancerRuleName; @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "the public IP address ID of the load balancer rule") + description = "The public IP address ID of the load balancer rule") private Long publicIpId; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "the ID of the virtual machine of the load balancer rule") + description = "The ID of the Instance of the load balancer rule") private Long virtualMachineId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The availability zone ID") private Long zoneId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list by network ID the rule belongs to") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List by Network ID the rule belongs to") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java index dfaafe89923b..010a5ad6022d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveCertFromLoadBalancerCmd.java @@ -45,7 +45,7 @@ public class RemoveCertFromLoadBalancerCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule") + description = "The ID of the load balancer rule") Long lbRuleId; @Override @@ -67,7 +67,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Removing a certificate from a load balancer with ID " + getLbRuleId(); + return "Removing certificate from load balancer with ID " + getResourceUuid(ApiConstants.LBID); } @Override @@ -82,4 +82,15 @@ public long getEntityOwnerId() { public Long getLbRuleId() { return this.lbRuleId; } + + @Override + public String getSyncObjType() { + return BaseAsyncCmd.networkSyncObject; + } + + @Override + public Long getSyncObjId() { + LoadBalancer lb = _entityMgr.findById(LoadBalancer.class, getLbRuleId()); + return (lb != null)? lb.getNetworkId(): null; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java index d29f2676ed55..ffcafd47822c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java @@ -43,7 +43,7 @@ import com.cloud.user.Account; @APICommand(name = "removeFromLoadBalancerRule", - description = "Removes a virtual machine or a list of virtual machines from a load balancer rule.", + description = "Removes an Instance or a list of Instances from a load balancer rule.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -65,7 +65,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.LIST, collectionType = CommandType.UUID, entityType = UserVmResponse.class, - description = "the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)") + description = "The list of IDs of the Instances that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)") private List virtualMachineIds; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID_IP, @@ -121,7 +121,7 @@ public Map> getVmIdIpListMap() { VirtualMachine lbvm = _entityMgr.findByUuid(VirtualMachine.class, vmId); if (lbvm == null) { - throw new InvalidParameterValueException("Unable to find virtual machine ID: " + vmId); + throw new InvalidParameterValueException("Unable to find Instance ID: " + vmId); } Long longVmId = lbvm.getId(); @@ -143,12 +143,12 @@ public Map> getVmIdIpListMap() { @Override public String getEventDescription() { - return "removing instances from load balancer: " + getId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; + return "Removing Instances from load balancer with ID: " + getResourceUuid(ApiConstants.ID) + " (instances IDs: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID) + " Instances IDs: " + StringUtils.join(getVirtualMachineIds(), ",")); Map> vmIdIpsMap = getVmIdIpListMap(); try { boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap, false); @@ -156,10 +156,10 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove Instance from load balancer rule"); } }catch (InvalidParameterValueException ex) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove instance from load balancer rule"); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove Instance from load balancer rule"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java index d129cd8988f8..c2075c2c79e0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java @@ -38,10 +38,10 @@ public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the load balancer") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the load balancer") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -72,7 +72,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "updating load balancer: " + getId(); + return "Updating load balancer with ID: " + getResourceUuid(ApiConstants.ID); } @@ -81,7 +81,7 @@ public String getEventDescription() { ///////////////////////////////////////////////////// @Override public void execute() { - CallContext.current().setEventDetails("Load balancer ID: " + getId()); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID)); ApplicationLoadBalancerRule rule = _appLbService.updateApplicationLoadBalancer(getId(), this.getCustomId(), getDisplay()); ApplicationLoadBalancerResponse lbResponse = _responseGenerator.createLoadBalancerContainerReponse(rule, _lbService.getLbInstances(getId())); setResponseObject(lbResponse); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java index fdd98fc3a0a4..17bd61c502dc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBHealthCheckPolicyCmd.java @@ -37,7 +37,7 @@ public class UpdateLBHealthCheckPolicyCmd extends BaseAsyncCustomIdCmd{ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBHealthCheckResponse.class, required = true, description = "ID of load balancer health check policy") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -63,7 +63,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Update load balancer health check policy ID= " + id; + return "Update load balancer health check policy ID = " + id; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java index b2137cf262d8..e79c1c561206 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLBStickinessPolicyCmd.java @@ -33,10 +33,10 @@ public class UpdateLBStickinessPolicyCmd extends BaseAsyncCustomIdCmd{ ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBStickinessResponse.class, required = true, description = "id of lb stickiness policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBStickinessResponse.class, required = true, description = "ID of lb stickiness policy") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -62,7 +62,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Update load balancer stickiness policy ID= " + id; + return "Update load balancer stickiness policy ID = " + id; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java index 25254ba9eb75..0ac99f1c760c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java @@ -33,6 +33,7 @@ import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; +import java.util.List; @APICommand(name = "updateLoadBalancerRule", description = "Updates load balancer", responseObject = LoadBalancerResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -42,28 +43,31 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCustomIdCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, description = "load balancer algorithm (source, roundrobin, leastconn)") + @Parameter(name = ApiConstants.ALGORITHM, type = CommandType.STRING, description = "Load balancer algorithm (source, roundrobin, leastconn)") private String algorithm; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer rule", length = 4096) + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer rule", length = 4096) private String description; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the ID of the load balancer rule to update") + description = "The ID of the load balancer rule to update") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the load balancer rule") private String loadBalancerName; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the LB") private String lbProtocol; + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from", since = "4.22") + private List cidrList; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -92,6 +96,9 @@ public String getLbProtocol() { return lbProtocol; } + public List getCidrList() { + return cidrList; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -112,12 +119,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "updating load balancer rule"; + return "Updating load balancer rule with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Load balancer ID: " + getId()); + CallContext.current().setEventDetails("Load balancer ID: " + getResourceUuid(ApiConstants.ID)); LoadBalancer result = _lbService.updateLoadBalancerRule(this); if (result != null) { LoadBalancerResponse response = _responseGenerator.createLoadBalancerResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java index e51b4dee9db6..0032b7a0acdf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/UploadSslCertCmd.java @@ -61,13 +61,13 @@ public class UploadSslCertCmd extends BaseCmd { @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "Password for the private key") private String password; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that will own the SSL certificate") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account that will own the SSL certificate") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the SSL certificate") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the SSL certificate") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning the SSL certificate") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the account owning the SSL certificate") private Long domainId; @Parameter(name = ApiConstants.NAME , type = CommandType.STRING, required = true, description = "Name for the uploaded certificate") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java index e883a7a0e4dd..7963dfe5c7d3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java @@ -54,24 +54,24 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "the public IP address ID of the forwarding rule, already associated via associateIp") + description = "The public IP address ID of the forwarding rule, already associated via associateIp") private Long ipAddressId; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, required = true, description = "the start port for the rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, required = true, description = "The start port for the rule") private Integer startPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the end port for the rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The end port for the rule") private Integer endPort; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the rule. Valid values are TCP or UDP.") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "The protocol for the rule. Valid values are TCP or UDP.") private String protocol; @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, - description = "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. Has value true by default") + description = "If true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. Has value true by default") private Boolean openFirewall; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the CIDR list to forward traffic from. Multiple entries must be separated by a single comma character (,). This parameter is deprecated. Do not use.") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to forward traffic from. Multiple entries must be separated by a single comma character (,). This parameter is deprecated. Do not use.") private List cidrlist; ///////////////////////////////////////////////////// @@ -108,7 +108,7 @@ public void execute() throws ResourceUnavailableException { boolean result = true; FirewallRule rule = null; try { - CallContext.current().setEventDetails("Rule ID: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); if (getOpenFirewall()) { result = result && _firewallService.applyIngressFirewallRules(ipAddressId, CallContext.current().getCallingAccount()); @@ -148,7 +148,7 @@ public void create() { setEntityId(rule.getId()); setEntityUuid(rule.getUuid()); } catch (NetworkRuleConflictException e) { - logger.info("Unable to create static NAT rule due to ", e); + logger.error("Unable to create static NAT rule due to ", e); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } } @@ -172,14 +172,14 @@ public String getEventType() { @Override public String getEventDescription() { IpAddress ip = _networkService.getIp(ipAddressId); - return ("Applying an ipforwarding 1:1 NAT rule for IP: " + ip.getAddress() + " with virtual machine:" + getVirtualMachineId()); + return ("Applying an IP forwarding 1:1 NAT rule for IP: " + ip.getAddress() + " with Instance:" + getVirtualMachineId()); } private long getVirtualMachineId() { Long vmId = _networkService.getIp(ipAddressId).getAssociatedWithVmId(); if (vmId == null) { - throw new InvalidParameterValueException("IP address is not associated with any network, unable to create static NAT rule"); + throw new InvalidParameterValueException("IP address is not associated with any Network, unable to create static NAT rule"); } return vmId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java index e4c16a317518..ef9f428f8c8c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java @@ -42,7 +42,7 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the forwarding rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "The ID of the forwarding rule") private Long id; // unexposed parameter needed for events logging @@ -63,7 +63,7 @@ public Long getId() { @Override public void execute() { - CallContext.current().setEventDetails("Rule ID: " + id); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _firewallService.revokeRelatedFirewallRule(id, true); result = result && _rulesService.revokeStaticNatRule(id, true); @@ -95,7 +95,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting an IP forwarding 1:1 NAT rule ID:" + id); + return "Deleting IP forwarding 1:1 NAT rule with ID:" + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java index 2bee7dfcc895..d80d63541c0f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java @@ -46,7 +46,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "the public IP address ID for which static NAT feature is being disabled") + description = "The public IP address ID for which static NAT feature is being disabled") private Long ipAddressId; ///////////////////////////////////////////////////// @@ -67,7 +67,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Disabling static NAT for IP ID=" + ipAddressId); + return ("Disabling static NAT for IP with ID: " + getResourceUuid(ApiConstants.IP_ADDRESS_ID)); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java index 48c6cc20bf1c..23ad2852a8e3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java @@ -45,19 +45,19 @@ public class EnableStaticNatCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the public IP " + @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "The public IP " + "address ID for which static NAT feature is being enabled") private Long ipAddressId; - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "the ID of " - + "the virtual machine for enabling static NAT feature") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of " + + "the Instance for enabling static NAT feature") private Long virtualMachineId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "The network of the VM the static NAT will be enabled for." - + " Required when public IP address is not associated with any guest network yet (VPC case)") + description = "The Network of the Instance the static NAT will be enabled for." + + " Required when public IP address is not associated with any guest Network yet (VPC case)") private Long networkId; @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, @@ -101,7 +101,7 @@ public long getNetworkId() { if (ntwkId == null) { throw new InvalidParameterValueException("Unable to enable static NAT for the ipAddress id=" + ipAddressId + - " as IP is not associated with any network and no networkId is passed in"); + " as IP is not associated with any Network and no networkId is passed in"); } return ntwkId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java index 89981a6453b5..089ed972b3bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java @@ -46,7 +46,7 @@ public class ListIpForwardingRulesCmd extends BaseListProjectAndAccountResources @Parameter(name = ApiConstants.IP_ADDRESS_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, - description = "list the rule belonging to this public IP address") + description = "List the rule belonging to this public IP address") private Long publicIpAddressId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, description = "Lists rule with the specified ID.") @@ -55,7 +55,7 @@ public class ListIpForwardingRulesCmd extends BaseListProjectAndAccountResources @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "Lists all rules applied to the specified VM.") + description = "Lists all rules applied to the specified Instance.") private Long vmId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java index 8d8e598bcab8..1776436b31a3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java @@ -40,7 +40,7 @@ import com.cloud.user.Account; import com.cloud.utils.net.NetUtils; -@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given Network (the Network has to belong to VPC)", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkACLCmd extends BaseAsyncCreateCmd { @@ -48,40 +48,40 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "The protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of ACL") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of ACL") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of ACL") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the CIDR list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") - private List cidrlist; + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") + private List cidrList; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this ICMP message") private Integer icmpCode; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The network of the VM the ACL will be created for") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The Network of the Instance the ACL will be created for") private Long networkId; - @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "The network of the VM the ACL will be created for") + @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "The network of the Instance the ACL will be created for") private Long aclId; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL," + "can be ingress or egress, defaulted to ingress if not specified") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "The traffic type for the ACL," + "can be ingress or egress, defaulted to ingress if not specified") private String trafficType; @Parameter(name = ApiConstants.NUMBER, type = CommandType.INTEGER, description = "The number of the ACL item, its ordering") private Integer number; - @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") + @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "ACL entry action, allow or deny") private String action; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = { + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end User or not", since = "4.4", authorized = { RoleType.Admin}) private Boolean display; @@ -118,8 +118,8 @@ public void setProtocol(String protocol) { } public List getSourceCidrList() { - if (cidrlist != null) { - return cidrlist; + if (cidrList != null) { + return cidrList; } else { List oneCidrList = new ArrayList(); oneCidrList.add(NetUtils.ALL_IP4_CIDRS); @@ -238,6 +238,30 @@ public String getReason() { return reason; } + public void setCidrList(List cidrList) { + this.cidrList = cidrList; + } + + public void setIcmpType(Integer icmpType) { + this.icmpType = icmpType; + } + + public void setIcmpCode(Integer icmpCode) { + this.icmpCode = icmpCode; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public void setDisplay(Boolean display) { + this.display = display; + } + + public void setReason(String reason) { + this.reason = reason; + } + @Override public void create() { NetworkACLItem result = _networkACLService.createNetworkACLItem(this); @@ -250,7 +274,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; NetworkACLItem rule = _networkACLService.getNetworkACLItem(getEntityId()); try { - CallContext.current().setEventDetails("Rule ID: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = _networkACLService.applyNetworkACL(rule.getAclId()); // State is different after the rule is applied, so get new object here diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java index cd25a604e776..31d1b49c2e71 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java @@ -36,7 +36,7 @@ import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; -@APICommand(name = "createNetworkACLList", description = "Creates a network ACL. If no VPC is given, then it creates a global ACL that can be used by everyone.", +@APICommand(name = "createNetworkACLList", description = "Creates a Network ACL. If no VPC is given, then it creates a global ACL that can be used by everyone.", responseObject = NetworkACLResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { @@ -46,19 +46,19 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the network ACL list") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the Network ACL list") private String name; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Description of the network ACL list") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Description of the Network ACL list") private String description; @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, - description = "ID of the VPC associated with this network ACL list") + description = "ID of the VPC associated with this Network ACL list") private Long vpcId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the list to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; // /////////////////////////////////////////////////// @@ -112,7 +112,7 @@ public void execute() throws ResourceUnavailableException { setResponseObject(aclResponse); aclResponse.setResponseName(getCommandName()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Network ACL"); } } @@ -128,7 +128,7 @@ public long getEntityOwnerId() { } else { account = CallContext.current().getCallingAccount(); if (!Account.Type.ADMIN.equals(account.getType())) { - logger.warn(String.format("Only Root Admin can create global ACLs. Account [%s] cannot create any global ACL.", account)); + logger.error("Only Root Admin can create global ACLs. {} cannot create any global ACL.", account); throw new PermissionDeniedException("Only Root Admin can create global ACLs."); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java index aca3d3ca1b45..ee5b8568e835 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java @@ -57,68 +57,68 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the network") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the network") private String name; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the network") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the network") private String displayText; @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, required = true, - description = "the network offering ID") + description = "The network offering ID") private Long networkOfferingId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the zone ID for the network") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The zone ID for the network") private Long zoneId; @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, - description = "the physical network ID the network belongs to") + description = "The physical Network ID the network belongs to") private Long physicalNetworkId; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "the gateway of the network. Required " + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, description = "The gateway of the Network. Required " + "for shared networks and isolated networks when it belongs to VPC") private String gateway; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "the netmask of the network. Required " + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, description = "The netmask of the Network. Required " + "for shared networks and isolated networks when it belongs to VPC") private String netmask; - @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "the beginning IP address in the network IP range") + @Parameter(name = ApiConstants.START_IP, type = CommandType.STRING, description = "The beginning IP address in the Network IP range") private String startIp; - @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "the ending IP address in the network IP" + @Parameter(name = ApiConstants.END_IP, type = CommandType.STRING, description = "The ending IP address in the Network IP" + " range. If not specified, will be defaulted to startIP") private String endIp; - @Parameter(name = ApiConstants.ISOLATED_PVLAN, type = CommandType.STRING, description = "the isolated private VLAN for this network") + @Parameter(name = ApiConstants.ISOLATED_PVLAN, type = CommandType.STRING, description = "The isolated private VLAN for this Network") private String isolatedPvlan; @Parameter(name = ApiConstants.ISOLATED_PVLAN_TYPE, type = CommandType.STRING, - description = "the isolated private VLAN type for this network") + description = "The isolated private VLAN type for this network") private String isolatedPvlanType; - @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "network domain") + @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain") private String networkDomain; @Parameter(name = ApiConstants.ACL_TYPE, type = CommandType.STRING, description = "Access control type; supported values" - + " are account and domain. In 3.0 all shared networks should have aclType=Domain, and all isolated networks" - + " - Account. Account means that only the account owner can use the network, domain - all accounts in the domain can use the network") + + " are Account and domain. In 3.0 all shared networks should have aclType=Domain, and all isolated networks" + + " - Account. Account means that only the Account owner can use the network, domain - all accounts in the domain can use the network") private String aclType; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account that will own the network. Account should be under the selected domain") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the network") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the network") private Long projectId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a network. " + - "If the account is not specified, but the acltype is Account or not specified, the network will be automatically assigned to the caller account and domain. " + - "To create a network under the domain without linking it to any account, make sure to include acltype=Domain parameter in the api call. " + - "If account is not specified, but acltype is Domain, the network will be created for the specified domain.") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the account owning a network. " + + "If the Account is not specified, but the acltype is Account or not specified, the Network will be automatically assigned to the caller account and domain. " + + "To create a Network under the domain without linking it to any account, make sure to include acltype=Domain parameter in the api call. " + + "If Account is not specified, but acltype is Domain, the network will be created for the specified domain.") private Long domainId; @Parameter(name = ApiConstants.SUBDOMAIN_ACCESS, @@ -127,22 +127,22 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd { + " subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified") private Boolean subdomainAccess; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "the VPC network belongs to") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "The VPC network belongs to") private Long vpcId; @Parameter(name = ApiConstants.TUNGSTEN_VIRTUAL_ROUTER_UUID, type = CommandType.STRING, description = "Tungsten-Fabric virtual router the network belongs to") private String tungstenVirtualRouterUuid; - @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "the beginning IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.START_IPV6, type = CommandType.STRING, description = "The beginning IPv6 address in the IPv6 network range") private String startIpv6; - @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "the ending IPv6 address in the IPv6 network range") + @Parameter(name = ApiConstants.END_IPV6, type = CommandType.STRING, description = "The ending IPv6 address in the IPv6 network range") private String endIpv6; - @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "the gateway of the IPv6 network. Required for Shared networks") + @Parameter(name = ApiConstants.IP6_GATEWAY, type = CommandType.STRING, description = "The gateway of the IPv6 network. Required for Shared networks") private String ip6Gateway; - @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "the CIDR of IPv6 network, must be at least /64") + @Parameter(name = ApiConstants.IP6_CIDR, type = CommandType.STRING, description = "The CIDR of IPv6 network, must be at least /64") private String ip6Cidr; @Parameter(name = ApiConstants.EXTERNAL_ID, type = CommandType.STRING, description = "ID of the network in an external system.") @@ -150,7 +150,7 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) + description = "An optional field, whether to the display the network to the end User or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "Network ACL ID associated for the network") @@ -171,16 +171,16 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd { description = "MTU to be configured on the network VR's private interface(s)", since = "4.18.0") private Integer privateMtu; - @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the network", since = "4.18.0") + @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "The first IPv4 DNS for the network", since = "4.18.0") private String ip4Dns1; - @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "the second IPv4 DNS for the network", since = "4.18.0") + @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "The second IPv4 DNS for the network", since = "4.18.0") private String ip4Dns2; - @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "the first IPv6 DNS for the network", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "The first IPv6 DNS for the network", since = "4.18.0") private String ip6Dns1; - @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "the second IPv6 DNS for the network", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "The second IPv6 DNS for the network", since = "4.18.0") private String ip6Dns2; @Parameter(name = ApiConstants.SOURCE_NAT_IP, @@ -199,6 +199,11 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd { @Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, since = "4.20.0", description="the AS Number of the network") private Long asNumber; + @Parameter(name = ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + type = CommandType.BOOLEAN, since = "4.23.0", authorized = {RoleType.Admin}) + private Boolean keepMacAddressOnPublicNic; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -286,6 +291,10 @@ public String getSourceNatIP() { return sourceNatIP; } + public Boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + @Override public boolean isDisplay() { if(displayNetwork == null) @@ -417,7 +426,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkPermissionsCmd.java index 1df472cbb228..eb95bc781892 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkPermissionsCmd.java @@ -51,24 +51,24 @@ public class CreateNetworkPermissionsCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "a comma delimited list of accounts within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of accounts within owner's domain. If specified, \"op\" parameter has to be passed in.") private List accountNames; @Parameter(name = ApiConstants.ACCOUNT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AccountResponse.class, - description = "a comma delimited list of account IDs within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of account IDs within owner's domain. If specified, \"op\" parameter has to be passed in.") private List accountIds; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The network ID") private Long networkId; @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class, - description = "a comma delimited list of projects within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of projects within owner's domain. If specified, \"op\" parameter has to be passed in.") private List projectIds; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java index ca42626eacb5..a8506e06c4a3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java @@ -32,7 +32,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; -@APICommand(name = "deleteNetworkACL", description = "Deletes a network ACL", responseObject = SuccessResponse.class, +@APICommand(name = "deleteNetworkACL", description = "Deletes a Network ACL", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkACLCmd extends BaseAsyncCmd { @@ -40,7 +40,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLItemResponse.class, required = true, description = "the ID of the network ACL") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLItemResponse.class, required = true, description = "The ID of the Network ACL") private Long id; ///////////////////////////////////////////////////// @@ -61,7 +61,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting Network ACL ID=" + id); + return "Deleting Network ACL with ID:" + getResourceUuid(ApiConstants.ID); } @Override @@ -82,14 +82,14 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Network ACL item ID: " + id); + CallContext.current().setEventDetails("Network ACL item ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkACLService.revokeNetworkACLItem(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL item"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Network ACL item"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java index 45bc86e8c91d..3e3894a26864 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLListCmd.java @@ -40,7 +40,7 @@ public class DeleteNetworkACLListCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "The ID of the network ACL") private Long id; ///////////////////////////////////////////////////// @@ -61,7 +61,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting network ACL ID=" + id); + return ("Deleting network ACL with ID: " + getResourceUuid(ApiConstants.ID)); } @Override @@ -82,7 +82,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Network ACL ID: " + id); + CallContext.current().setEventDetails("Network ACL ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkACLService.deleteNetworkACL(id); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java index 8e8e18c67024..0543794e8bf5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java @@ -33,7 +33,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; -@APICommand(name = "deleteNetwork", description = "Deletes a network", responseObject = SuccessResponse.class, entityType = {Network.class}, +@APICommand(name = "deleteNetwork", description = "Deletes a Network", responseObject = SuccessResponse.class, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteNetworkCmd extends BaseAsyncCmd { @@ -41,7 +41,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The ID of the network") private Long id; @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a network." + @@ -66,7 +66,7 @@ public boolean isForced() { @Override public void execute() { - CallContext.current().setEventDetails("Network Id: " + id); + CallContext.current().setEventDetails("Network ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _networkService.deleteNetwork(id, isForced()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -93,7 +93,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting network: " + id; + return "Deleting network with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ImportNetworkACLCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ImportNetworkACLCmd.java new file mode 100644 index 000000000000..daf3633ce2a4 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ImportNetworkACLCmd.java @@ -0,0 +1,132 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.network; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.NetworkACLItemResponse; +import org.apache.cloudstack.api.response.NetworkACLResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.commons.collections.MapUtils; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.vpc.NetworkACLItem; +import com.cloud.user.Account; + +@APICommand(name = "importNetworkACL", description = "Imports Network ACL rules.", + responseObject = NetworkACLItemResponse.class, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + since = "4.22.1") +public class ImportNetworkACLCmd extends BaseAsyncCmd { + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + @Parameter( + name = ApiConstants.ACL_ID, + type = CommandType.UUID, + entityType = NetworkACLResponse.class, + required = true, + description = "The ID of the Network ACL to which the rules will be imported" + ) + private Long aclId; + + @Parameter(name = ApiConstants.RULES, type = CommandType.MAP, required = true, + description = "Rules param list, id and protocol are must. Invalid rules will be discarded. Example: " + + "rules[0].id=101&rules[0].protocol=tcp&rules[0].traffictype=ingress&rules[0].state=active&rules[0].cidrlist=192.168.1.0/24" + + "&rules[0].tags=web&rules[0].aclid=acl-001&rules[0].aclname=web-acl&rules[0].number=1&rules[0].action=allow&rules[0].fordisplay=true" + + "&rules[0].description=allow%20web%20traffic&rules[1].id=102&rules[1].protocol=udp&rules[1].traffictype=egress&rules[1].state=enabled" + + "&rules[1].cidrlist=10.0.0.0/8&rules[1].tags=db&rules[1].aclid=acl-002&rules[1].aclname=db-acl&rules[1].number=2&rules[1].action=deny" + + "&rules[1].fordisplay=false&rules[1].description=deny%20database%20traffic") + private Map rules; + + + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// + + // Returns map, corresponds to a rule with the details in the keys: + // id, protocol, startport, endport, traffictype, state, cidrlist, tags, aclid, aclname, number, action, fordisplay, description + public Map getRules() { + return rules; + } + + public Long getAclId() { + return aclId; + } + + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// + + + @Override + public void execute() throws ResourceUnavailableException { + validateParams(); + List importedRules = _networkACLService.importNetworkACLRules(this); + ListResponse response = new ListResponse<>(); + List aclResponse = new ArrayList<>(); + for (NetworkACLItem acl : importedRules) { + NetworkACLItemResponse ruleData = _responseGenerator.createNetworkACLItemResponse(acl); + aclResponse.add(ruleData); + } + response.setResponses(aclResponse, importedRules.size()); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + Account account = CallContext.current().getCallingAccount(); + if (account != null) { + return account.getId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NETWORK_ACL_IMPORT; + } + + @Override + public String getEventDescription() { + return "Importing ACL rules for ACL ID: " + getAclId(); + } + + + private void validateParams() { + if(MapUtils.isEmpty(rules)) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Rules parameter is empty or null"); + } + + if (getAclId() == null || _networkACLService.getNetworkACL(getAclId()) == null) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find Network ACL with provided ACL ID"); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java index c88f956943b4..62834a51e033 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLListsCmd.java @@ -43,16 +43,16 @@ public class ListNetworkACLListsCmd extends BaseListProjectAndAccountResourcesCm @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "Lists network ACL with the specified ID.") private Long id; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list network ACLs by network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List network ACLs by network ID") private Long networkId; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "list network ACLs by VPC ID") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List network ACLs by VPC ID") private Long vpcId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list network ACLs by specified name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List network ACLs by specified name") private String name; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java index 1ef2b9b7bfbf..159f07296eef 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java @@ -44,22 +44,22 @@ public class ListNetworkACLsCmd extends BaseListTaggedResourcesCmd { description = "Lists network ACL Item with the specified ID") private Long id; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list network ACL items by network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List network ACL items by network ID") private Long networkId; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "list network ACL items by traffic type - ingress or egress") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "List network ACL items by traffic type - ingress or egress") private String trafficType; - @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "list network ACL items by ACL ID") + @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "List network ACL items by ACL ID") private Long aclId; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "list network ACL items by protocol") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "List network ACL items by protocol") private String protocol; - @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "list network ACL items by action") + @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "List network ACL items by action") private String action; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java index bdc89d804cdf..ff3b61056be3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java @@ -39,75 +39,75 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "list network offerings by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "List network offerings by ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list network offerings by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List network offerings by name") private String networkOfferingName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "list network offerings by display text") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "List network offerings by display text") private String displayText; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "list by traffic type") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "List by traffic type") private String trafficType; - @Parameter(name = ApiConstants.IS_DEFAULT, type = CommandType.BOOLEAN, description = "true if need to list only default network offerings. Default value is false") + @Parameter(name = ApiConstants.IS_DEFAULT, type = CommandType.BOOLEAN, description = "True if need to list only default network offerings. Default value is false") private Boolean isDefault; - @Parameter(name = ApiConstants.SPECIFY_VLAN, type = CommandType.BOOLEAN, description = "the tags for the network offering.") + @Parameter(name = ApiConstants.SPECIFY_VLAN, type = CommandType.BOOLEAN, description = "The tags for the network offering.") private Boolean specifyVlan; - @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "the availability of network offering. Default value is required") + @Parameter(name = ApiConstants.AVAILABILITY, type = CommandType.STRING, description = "The availability of network offering. Default value is required") private String availability; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "list network offerings available for network creation in specific domain", + description = "List network offerings available for network creation in specific domain", since = "4.13") private Long domainId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "list network offerings available for network creation in specific zone") + description = "List network offerings available for network creation in specific zone") private Long zoneId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list network offerings by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List network offerings by state") private String state; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.") + description = "The ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.") private Long networkId; - @Parameter(name = ApiConstants.GUEST_IP_TYPE, type = CommandType.STRING, description = "list network offerings by guest type: shared or isolated") + @Parameter(name = ApiConstants.GUEST_IP_TYPE, type = CommandType.STRING, description = "List network offerings by guest type: shared or isolated") private String guestIpType; @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "list network offerings supporting certain services") + description = "List network offerings supporting certain services") private List supportedServices; @Parameter(name = ApiConstants.SOURCE_NAT_SUPPORTED, type = CommandType.BOOLEAN, - description = "true if need to list only netwok offerings where source NAT is supported, false otherwise") + description = "True if need to list only netwok offerings where source NAT is supported, false otherwise") private Boolean sourceNatSupported; @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, type = CommandType.BOOLEAN, - description = "true if need to list only network offerings which support specifying ip ranges") + description = "True if need to list only network offerings which support specifying ip ranges") private Boolean specifyIpRanges; - @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "list network offerings by tags", length = 4096) + @Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "List network offerings by tags", length = 4096) private String tags; - @Parameter(name = ApiConstants.IS_TAGGED, type = CommandType.BOOLEAN, description = "true if offering has tags specified") + @Parameter(name = ApiConstants.IS_TAGGED, type = CommandType.BOOLEAN, description = "True if offering has tags specified") private Boolean isTagged; - @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network offering can be used" + " only for network creation inside the VPC") + @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "The network offering can be used" + " only for network creation inside the VPC") private Boolean forVpc; @Parameter(name = ApiConstants.ROUTING_MODE, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkPermissionsCmd.java index 6ea4937e1153..e852fdccecb9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworkPermissionsCmd.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import java.util.List; -@APICommand(name = "listNetworkPermissions", description = "List network visibility and all accounts that have permissions to view this network.", +@APICommand(name = "listNetworkPermissions", description = "List Network visibility and all Accounts that have permissions to view this Network.", responseObject = NetworkPermissionsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, @@ -47,7 +47,7 @@ public class ListNetworkPermissionsCmd extends BaseCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Lists network permission by network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Lists Network permission by Network ID") private Long networkId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java index 0e8425b14b4b..79f2cf8c7449 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java @@ -42,7 +42,7 @@ import com.cloud.utils.Pair; import org.apache.commons.lang3.StringUtils; -@APICommand(name = "listNetworks", description = "Lists all available networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class}, +@APICommand(name = "listNetworks", description = "Lists all available Networks.", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNetworksCmd extends BaseListRetrieveOnlyResourceCountCmd implements UserCmd { private static final String s_name = "listnetworksresponse"; @@ -50,49 +50,52 @@ public class ListNetworksCmd extends BaseListRetrieveOnlyResourceCountCmd implem ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list networks by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List Networks by ID") private Long id; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the zone ID of the network") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list networks by name", since = "4.22.0") + private String name; + + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The zone ID of the Network") private Long zoneId; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the type of the network. Supported values are: isolated, l2, shared and all") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "The type of the Network. Supported values are: isolated, l2, shared and all") private String guestIpType; - @Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, description = "true if network is system, false otherwise") + @Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, description = "True if Network is system, false otherwise") private Boolean isSystem; - @Parameter(name = ApiConstants.ACL_TYPE, type = CommandType.STRING, description = "list networks by ACL (access control list) type. Supported values are account and domain") + @Parameter(name = ApiConstants.ACL_TYPE, type = CommandType.STRING, description = "List Networks by ACL (access control list) type. Supported values are Account and domain") private String aclType; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "type of the traffic") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "Type of the traffic") private String trafficType; - @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "list networks by physical network id") + @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "List Networks by physical Network ID") private Long physicalNetworkId; - @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list networks supporting certain services") + @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "List Networks supporting certain services") private List supportedServices; - @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list networks by restartRequired") + @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "List networks by restartRequired") private Boolean restartRequired; - @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, type = CommandType.BOOLEAN, description = "true if need to list only networks which support specifying IP ranges") + @Parameter(name = ApiConstants.SPECIFY_IP_RANGES, type = CommandType.BOOLEAN, description = "True if need to list only networks which support specifying IP ranges") private Boolean specifyIpRanges; @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List networks by VPC") private Long vpcId; - @Parameter(name = ApiConstants.CAN_USE_FOR_DEPLOY, type = CommandType.BOOLEAN, description = "list networks available for VM deployment") + @Parameter(name = ApiConstants.CAN_USE_FOR_DEPLOY, type = CommandType.BOOLEAN, description = "List networks available for Instance deployment") private Boolean canUseForDeploy; - @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "the network belongs to VPC") + @Parameter(name = ApiConstants.FOR_VPC, type = CommandType.BOOLEAN, description = "The network belongs to VPC") private Boolean forVpc; - @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "list networks by network offering ID") + @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "List networks by network offering ID") private Long networkOfferingId; @Parameter(name = ApiConstants.ASSOCIATED_NETWORK_ID, @@ -103,17 +106,17 @@ public class ListNetworksCmd extends BaseListRetrieveOnlyResourceCountCmd implem private Long associatedNetworkId; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for networks") + description = "Flag to display the resource icon for networks") private Boolean showIcon; @Parameter(name = ApiConstants.NETWORK_FILTER, type = CommandType.STRING, since = "4.17.0", - description = "possible values are \"account\", \"domain\", \"accountdomain\",\"shared\", and \"all\". Default value is \"all\"." - + "* account : account networks that have been registered for or created by the calling user. " - + "* domain : domain networks that have been registered for or created by the calling user. " - + "* accountdomain : account and domain networks that have been registered for or created by the calling user. " - + "* shared : networks that have been granted to the calling user by another user. " + description = "Possible values are \"account\", \"domain\", \"accountdomain\",\"shared\", and \"all\". Default value is \"all\"." + + "* account : account networks that have been registered for or created by the calling User. " + + "* domain : domain networks that have been registered for or created by the calling User. " + + "* accountdomain : account and domain networks that have been registered for or created by the calling User. " + + "* shared : networks that have been granted to the calling User by another User. " + "* all : all networks (account, domain and shared).") private String networkFilter; @@ -125,6 +128,10 @@ public Long getId() { return id; } + public String getName() { + return name; + } + public Long getZoneId() { return zoneId; } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java index 5d36dcfd8e93..6b525e63c185 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java @@ -28,7 +28,7 @@ import com.cloud.network.vpc.NetworkACLItem; import com.cloud.user.Account; -@APICommand(name = "moveNetworkAclItem", description = "Move an ACL rule to a position bettwen two other ACL rules of the same ACL network list", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +@APICommand(name = "moveNetworkAclItem", description = "Move an ACL rule to a position between two other ACL rules of the same ACL Network list", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class MoveNetworkAclItemCmd extends BaseAsyncCustomIdCmd { private static final String s_name = "moveNetworkAclItemResponse"; @@ -42,7 +42,7 @@ public class MoveNetworkAclItemCmd extends BaseAsyncCustomIdCmd { @Parameter(name = ApiConstants.NEXT_ACL_RULE_ID, type = CommandType.STRING, description = "The ID of the rule that is right after the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the last position of the network ACL list.") private String nextAclRuleUuid; - @Parameter(name = ApiConstants.MOVE_ACL_CONSISTENCY_HASH, type = CommandType.STRING, description = "Md5 hash used to check the consistency of the ACL rule list before applying the ACL rule move. This check is useful to manage concurrency problems that may happen when multiple users are editing the same ACL rule listing. The parameter is not required. Therefore, if the user does not send it, they assume the risk of moving ACL rules without checking the consistency of the access control list before executing the move. We use MD5 hash function on a String that is composed of all UUIDs of the ACL rules in concatenated in their respective order (order defined via 'number' field).") + @Parameter(name = ApiConstants.MOVE_ACL_CONSISTENCY_HASH, type = CommandType.STRING, description = "Md5 hash used to check the consistency of the ACL rule list before applying the ACL rule move. This check is useful to manage concurrency problems that may happen when multiple Users are editing the same ACL rule listing. The parameter is not required. Therefore, if the User does not send it, they assume the risk of moving ACL rules without checking the consistency of the access control list before executing the move. We use MD5 hash function on a String that is composed of all UUIDs of the ACL rules in concatenated in their respective order (order defined via 'number' field).") private String aclConsistencyHash; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/RemoveNetworkPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/RemoveNetworkPermissionsCmd.java index c199d872e0c0..546b460f16c5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/RemoveNetworkPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/RemoveNetworkPermissionsCmd.java @@ -34,7 +34,7 @@ import java.util.List; -@APICommand(name = "removeNetworkPermissions", description = "Removes network permissions.", +@APICommand(name = "removeNetworkPermissions", description = "Removes Network permissions.", responseObject = SuccessResponse.class, entityType = {Network.class}, requestHasSensitiveInfo = false, @@ -51,24 +51,24 @@ public class RemoveNetworkPermissionsCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "a comma delimited list of accounts within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of Accounts within owner's domain. If specified, \"op\" parameter has to be passed in.") private List accountNames; @Parameter(name = ApiConstants.ACCOUNT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AccountResponse.class, - description = "a comma delimited list of account IDs within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of account IDs within owner's domain. If specified, \"op\" parameter has to be passed in.") private List accountIds; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The Network ID") private Long networkId; @Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class, - description = "a comma delimited list of projects within owner's domain. If specified, \"op\" parameter has to be passed in.") + description = "A comma delimited list of projects within owner's domain. If specified, \"op\" parameter has to be passed in.") private List projectIds; // /////////////////////////////////////////////////// @@ -105,7 +105,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network permissions"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Network permissions"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java index f6e9557aadb3..0b210b6b95d8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ReplaceNetworkACLListCmd.java @@ -41,13 +41,13 @@ public class ReplaceNetworkACLListCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") + @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "The ID of the network ACL") private long aclId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "the ID of the network") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The ID of the network") private Long networkId; - @Parameter(name = ApiConstants.GATEWAY_ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "the ID of the private gateway") + @Parameter(name = ApiConstants.GATEWAY_ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "The ID of the private gateway") private Long privateGatewayId; ///////////////////////////////////////////////////// @@ -76,7 +76,13 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Associating network ACL ID=" + aclId + " with network ID=" + networkId); + String description = "Associating Network ACL with ID:" + getResourceUuid(ApiConstants.ACL_ID); + + if (getNetworkId() != null) { + description += " to Network with ID:" + getResourceUuid(ApiConstants.NETWORK_ID); + } + + return description; } @Override @@ -95,7 +101,7 @@ public void execute() throws ResourceUnavailableException { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Network ID and private gateway can't be passed at the same time"); } - CallContext.current().setEventDetails("Network ACL ID: " + aclId); + CallContext.current().setEventDetails("Network ACL ID: " + getResourceUuid(ApiConstants.ACL_ID)); boolean result = false; if (getPrivateGatewayId() != null) { result = _networkACLService.replaceNetworkACLonPrivateGw(aclId, privateGatewayId); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ResetNetworkPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ResetNetworkPermissionsCmd.java index a23b98c84a88..611e35028be0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/ResetNetworkPermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/ResetNetworkPermissionsCmd.java @@ -29,7 +29,7 @@ import com.cloud.network.Network; import com.cloud.user.Account; -@APICommand(name = "resetNetworkPermissions", description = "Resets network permissions.", +@APICommand(name = "resetNetworkPermissions", description = "Resets Network permissions.", responseObject = SuccessResponse.class, entityType = {Network.class}, requestHasSensitiveInfo = false, @@ -43,7 +43,7 @@ public class ResetNetworkPermissionsCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the network ID") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "The Network ID") private Long networkId; // /////////////////////////////////////////////////// @@ -65,7 +65,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network permissions"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Network permissions"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java index ffc2e36dee53..2742e5ef6d18 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java @@ -37,7 +37,7 @@ import com.cloud.network.Network; @APICommand(name = "restartNetwork", - description = "Restarts the network; includes 1) restarting network elements - virtual routers, DHCP servers 2) reapplying all public IPs 3) reapplying loadBalancing/portForwarding rules", + description = "Restarts the Network; includes 1) restarting network elements - virtual routers, DHCP servers 2) reapplying all public IPs 3) reapplying loadBalancing/portForwarding rules", responseObject = SuccessResponse.class, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -115,7 +115,7 @@ public Long getSyncObjId() { @Override public String getEventDescription() { - return "Restarting network: " + getNetworkId(); + return "Restarting Network with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java index 42cb0697edb4..f1ba3a55a96c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java @@ -41,37 +41,37 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLItemResponse.class, required = true, description = "the ID of the network ACL item") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLItemResponse.class, required = true, description = "The ID of the network ACL item") private Long id; - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "The starting port of ACL") private Integer publicStartPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of ACL") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "The ending port of ACL") private Integer publicEndPort; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).") private List cidrlist; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the ICMP message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this ICMP message") private Integer icmpCode; - @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL, can be Ingress or Egress, defaulted to Ingress if not specified") + @Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "The traffic type for the ACL, can be Ingress or Egress, defaulted to Ingress if not specified") private String trafficType; - @Parameter(name = ApiConstants.NUMBER, type = CommandType.INTEGER, description = "The network of the vm the ACL will be created for") + @Parameter(name = ApiConstants.NUMBER, type = CommandType.INTEGER, description = "The Network of the Instance the ACL will be created for") private Integer number; - @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny") + @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "ACL entry action, allow or deny") private String action; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = { + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the rule to the end User or not", since = "4.4", authorized = { RoleType.Admin}) private Boolean display; @@ -176,7 +176,7 @@ public String getReason() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + getId()); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); NetworkACLItem aclItem = _networkACLService.updateNetworkACLItem(this); NetworkACLItemResponse aclResponse = _responseGenerator.createNetworkACLItemResponse(aclItem); setResponseObject(aclResponse); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java index adab885542d1..fa29ed44b701 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLListCmd.java @@ -31,17 +31,17 @@ import com.cloud.network.vpc.NetworkACL; import com.cloud.user.Account; -@APICommand(name = "updateNetworkACLList", description = "Updates network ACL list", responseObject = SuccessResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +@APICommand(name = "updateNetworkACLList", description = "Updates Network ACL list", responseObject = SuccessResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkACLListCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "the ID of the network ACL") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = true, description = "The ID of the network ACL") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the list to the end user or not", since = "4.4", authorized = { + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the list to the end User or not", since = "4.4", authorized = { RoleType.Admin}) private Boolean display; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java index 0d92a635e7f9..7b6841d60976 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java @@ -39,7 +39,7 @@ import com.cloud.network.Network; import com.cloud.offering.NetworkOffering; -@APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class}, +@APICommand(name = "updateNetwork", description = "Updates a Network", responseObject = NetworkResponse.class, responseView = ResponseView.Restricted, entityType = {Network.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd implements UserCmd { @@ -50,33 +50,33 @@ public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = NetworkResponse.class, - required=true, description="the ID of the network") + required=true, description = "The ID of the network") protected Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the new name for the network") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The new name for the network") private String name; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the new display text for the network") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The new display text for the network") private String displayText; - @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "network domain") + @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain") private String networkDomain; @Parameter(name = ApiConstants.CHANGE_CIDR, type = CommandType.BOOLEAN, description = "Force update even if CIDR type is different") private Boolean changeCidr; - @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "network offering ID") + @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, entityType = NetworkOfferingResponse.class, description = "Network offering ID") private Long networkOfferingId; @Parameter(name = ApiConstants.GUEST_VM_CIDR, type = CommandType.STRING, description = "CIDR for guest VMs, CloudStack allocates IPs to guest VMs only from this CIDR") private String guestVmCidr; - @Parameter(name =ApiConstants.UPDATE_IN_SEQUENCE, type=CommandType.BOOLEAN, description = "if true, we will update the routers one after the other. applicable only for redundant router based networks using virtual router as provider") + @Parameter(name =ApiConstants.UPDATE_IN_SEQUENCE, type=CommandType.BOOLEAN, description = "If true, we will update the routers one after the other. applicable only for redundant router based networks using virtual router as provider") private Boolean updateInSequence; @Parameter(name = ApiConstants.DISPLAY_NETWORK, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) + description = "An optional field, whether to the display the network to the end User or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; @Parameter(name= ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "Setting this to true will cause a forced network update,", authorized = {RoleType.Admin}) @@ -90,21 +90,26 @@ public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd implements UserCmd { description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0") private Integer privateMtu; - @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the network. Empty string will update the first IPv4 DNS with the value from the zone", since = "4.18.0") + @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "The first IPv4 DNS for the network. Empty string will update the first IPv4 DNS with the value from the zone", since = "4.18.0") private String ip4Dns1; - @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "the second IPv4 DNS for the network. Empty string will update the second IPv4 DNS with the value from the zone", since = "4.18.0") + @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "The second IPv4 DNS for the network. Empty string will update the second IPv4 DNS with the value from the zone", since = "4.18.0") private String ip4Dns2; - @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "the first IPv6 DNS for the network. Empty string will update the first IPv6 DNS with the value from the zone", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "The first IPv6 DNS for the network. Empty string will update the first IPv6 DNS with the value from the zone", since = "4.18.0") private String ip6Dns1; - @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "the second IPv6 DNS for the network. Empty string will update the second IPv6 DNS with the value from the zone", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "The second IPv6 DNS for the network. Empty string will update the second IPv6 DNS with the value from the zone", since = "4.18.0") private String ip6Dns2; @Parameter(name = ApiConstants.SOURCE_NAT_IP, type = CommandType.STRING, description = "IPV4 address to be assigned to the public interface of the network router. This address must already be acquired for this network", since = "4.19") private String sourceNatIP; + @Parameter(name = ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + type = CommandType.BOOLEAN, since = "4.23.0", authorized = {RoleType.Admin}) + private Boolean keepMacAddressOnPublicNic; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -186,6 +191,10 @@ public String getSourceNatIP() { return sourceNatIP; } + public Boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/CreateRoutingFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/CreateRoutingFirewallRuleCmd.java index 7146d1ae1d19..85166f5ab84a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/CreateRoutingFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/CreateRoutingFirewallRuleCmd.java @@ -238,7 +238,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; FirewallRule rule = _firewallService.getFirewallRule(getEntityId()); try { - CallContext.current().setEventDetails("Rule ID: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); success = routedIpv4Manager.applyRoutingFirewallRule(rule.getId()); // State is different after the rule is applied, so get new object here @@ -250,7 +250,7 @@ public void execute() throws ResourceUnavailableException { } ruleResponse.setResponseName(getCommandName()); } catch (Exception ex) { - logger.error("Got exception when create Routing firewall rules: " + ex); + logger.error("Got exception when create Routing firewall rules: ", ex); } finally { if (!success || rule == null) { routedIpv4Manager.revokeRoutingFirewallRule(getEntityId()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmd.java index 16696f5f71b7..646b704e088c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmd.java @@ -67,7 +67,7 @@ public String getEventType() { @Override public String getEventDescription() { - return String.format("Deleting ipv4 routing firewall rule ID=%s", id); + return String.format("Deleting IPv4 routing firewall rule with ID: %s", getResourceUuid(ApiConstants.ID)); } @Override @@ -82,7 +82,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Routing firewall rule ID: " + id); + CallContext.current().setEventDetails("Routing firewall rule with ID: " + getResourceUuid(ApiConstants.ID)); boolean result = routedIpv4Manager.revokeRoutingFirewallRule(id); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/UpdateRoutingFirewallRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/UpdateRoutingFirewallRuleCmd.java index c6f6034b1ba1..3c3a07ceece1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/UpdateRoutingFirewallRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/network/routing/UpdateRoutingFirewallRuleCmd.java @@ -95,7 +95,7 @@ public String getEventDescription() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Rule Id: " + getId()); + CallContext.current().setEventDetails("Rule ID: " + getResourceUuid(ApiConstants.ID)); FirewallRule rule = routedIpv4Manager.updateRoutingFirewallRule(this); FirewallResponse ruleResponse = _responseGenerator.createFirewallResponse(rule); setResponseObject(ruleResponse); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java index f9b9ec59a400..c7343b95dd6b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java @@ -45,13 +45,13 @@ public class ListDiskOfferingsCmd extends BaseListProjectAndAccountResourcesCmd @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "ID of the disk offering") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the disk offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the disk offering") private String diskOfferingName; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "id of zone disk offering is associated with", + description = "ID of zone disk offering is associated with", since = "4.13") private Long zoneId; @@ -61,7 +61,7 @@ public class ListDiskOfferingsCmd extends BaseListProjectAndAccountResourcesCmd @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "The ID of the storage pool, tags of the storage pool are used to filter the offerings", since = "4.17") private Long storagePoolId; - @Parameter(name = ApiConstants.ENCRYPT, type = CommandType.BOOLEAN, description = "listed offerings support disk encryption", since = "4.18") + @Parameter(name = ApiConstants.ENCRYPT, type = CommandType.BOOLEAN, description = "Listed offerings support disk encryption", since = "4.18") private Boolean encrypt; @Parameter(name = ApiConstants.STORAGE_TYPE, diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java index 1b3f531e370d..cd6baaf827bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java @@ -26,6 +26,7 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; @@ -44,51 +45,51 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "ID of the service offering") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the service offering") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the service offering") private String serviceOfferingName; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.") + description = "The ID of the Instance. Pass this in if you want to see the available service offering that an Instance can be changed to.") private Long virtualMachineId; - @Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering") + @Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description = " Is this a System VM offering") private Boolean isSystem; @Parameter(name = ApiConstants.SYSTEM_VM_TYPE, type = CommandType.STRING, - description = "the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".") + description = "The system Instance type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".") private String systemVmType; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "id of zone disk offering is associated with", + description = "ID of zone disk offering is associated with", since = "4.13") private Long zoneId; @Parameter(name = ApiConstants.CPU_NUMBER, type = CommandType.INTEGER, - description = "the CPU number that listed offerings must support", + description = "The CPU number that listed offerings must support", since = "4.15") private Integer cpuNumber; @Parameter(name = ApiConstants.MEMORY, type = CommandType.INTEGER, - description = "the RAM memory that listed offering must support", + description = "The RAM memory that listed offering must support", since = "4.15") private Integer memory; @Parameter(name = ApiConstants.CPU_SPEED, type = CommandType.INTEGER, - description = "the CPU speed that listed offerings must support", + description = "The CPU speed that listed offerings must support", since = "4.15") private Integer cpuSpeed; @Parameter(name = ApiConstants.ENCRYPT_ROOT, type = CommandType.BOOLEAN, - description = "listed offerings support root disk encryption", + description = "Listed offerings support root disk encryption", since = "4.18") private Boolean encryptRoot; @@ -110,6 +111,19 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC since = "4.20.0") private Long templateId; + @Parameter(name = ApiConstants.VGPU_PROFILE_ID, + type = CommandType.UUID, + entityType = VgpuProfileResponse.class, + description = "The ID of the vGPU profile that listed offerings must support", + since = "4.21.0") + private Long vgpuProfileId; + + @Parameter(name = ApiConstants.GPU_ENABLED, + type = CommandType.BOOLEAN, + description = "Flag to indicate if the service offering supports GPU. If set to true, only service offerings that support GPU will be returned.", + since = "4.21.0") + private Boolean gpuEnabled; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -171,6 +185,30 @@ public Long getTemplateId() { return templateId; } + public Long getVgpuProfileId() { + return vgpuProfileId; + } + + public Boolean getGpuEnabled() { + return gpuEnabled; + } + + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; + } + + public void setCpuNumber(Integer cpuNumber) { + this.cpuNumber = cpuNumber; + } + + public void setMemory(Integer memory) { + this.memory = memory; + } + + public void setEncryptRoot(Boolean encryptRoot) { + this.encryptRoot = encryptRoot; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java index 42e045d4389f..c6717ac659a4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java @@ -42,7 +42,7 @@ public class ActivateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "id of the project to be modified") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project to be modified") private Long id; ///////////////////////////////////////////////////// @@ -80,7 +80,7 @@ public List getEntityOwnerIds() { @Override public void execute() { - CallContext.current().setEventDetails("Project id: " + getId()); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.ID)); Project project = _projectService.activateProject(getId()); if (project != null) { ProjectResponse response = _responseGenerator.createProjectResponse(project); @@ -98,6 +98,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Activating project: " + id; + return "Activating project with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java index cb93729381a4..2d0e92d47d4f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java @@ -44,20 +44,20 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account who will be Admin for the project") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account who will be Admin for the project") private String accountName; @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, - description = "user ID of the account to be assigned as owner of the project i.e., Project Admin", since = "4.15.0") + description = "User ID of the Account to be assigned as owner of the project i.e., Project Admin", since = "4.15.0") private Long userId; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "domain ID of the account owning a project") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Domain ID of the Account owning a project") private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "ID of the account owning a project") + @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "ID of the Account owning a project") private Long accountId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the project") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the project") private String name; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the project, defaults to the 'name´.") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java index 1fd205fdae41..c2a0c132448b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java @@ -42,10 +42,10 @@ public class DeleteProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "id of the project to be deleted") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project to be deleted") private Long id; - @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, since = "4.16.0", description = "true if all project resources have to be cleaned up, false otherwise") + @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, since = "4.16.0", description = "True if all project resources have to be cleaned up, false otherwise") private Boolean cleanup; ///////////////////////////////////////////////////// @@ -66,7 +66,7 @@ public Boolean isCleanup() { @Override public void execute() { - CallContext.current().setEventDetails("Project Id: " + id); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _projectService.deleteProject(id, isCleanup()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -83,7 +83,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting project: " + id; + return "Deleting project with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java index d1b17eda76b1..b1d129b8af77 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java @@ -37,7 +37,7 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectInvitationResponse.class, required = true, description = "id of the invitation") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectInvitationResponse.class, required = true, description = "ID of the invitation") private Long id; // /////////////////////////////////////////////////// @@ -59,7 +59,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Project invitation id " + id); + CallContext.current().setEventDetails("Project invitation ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _projectService.deleteProjectInvitation(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); @@ -76,7 +76,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Project invitatino id " + id + " is being removed"; + return "Removing project invitation with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java index 210394ec2ddf..679ba863b10a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java @@ -37,21 +37,21 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "list by project id") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "List by project ID") private Long projectId; @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, - description = "if true, list only active invitations - having Pending state and ones that are not timed out yet") + description = "If true, list only active invitations - having Pending state and ones that are not timed out yet") private boolean activeOnly; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list invitations by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List invitations by state") private String state; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectInvitationResponse.class, description = "list invitations by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectInvitationResponse.class, description = "List invitations by ID") private Long id; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "list invitation by user ID") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "List invitation by user ID") private Long userId; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java index d4679dbe0578..2f65429aca6a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java @@ -48,16 +48,16 @@ public class ListProjectsCmd extends BaseListAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "list projects by project ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "List projects by project ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list projects by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List projects by name") private String name; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "list projects by display text") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "List projects by display text") private String displayText; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list projects by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List projects by state") private String state; @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List projects by tags (key/value pairs)") @@ -69,11 +69,11 @@ public class ListProjectsCmd extends BaseListAccountResourcesCmd { @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "comma separated list of project details requested, value can be a list of [ all, resource, min]") + description = "Comma separated list of project details requested, value can be a list of [ all, resource, min]") private List viewDetails; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for projects") + description = "Flag to display the resource icon for projects") private Boolean showIcon; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java index a3eee8c80bb7..f67d0d55587d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java @@ -43,7 +43,7 @@ public class SuspendProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "id of the project to be suspended") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project to be suspended") private Long id; ///////////////////////////////////////////////////// @@ -60,7 +60,7 @@ public Long geId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("Project Id: " + id); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.ID)); Project project = _projectService.suspendProject(id); if (project != null) { ProjectResponse response = _responseGenerator.createProjectResponse(project); @@ -78,7 +78,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Suspending project: " + id; + return "Suspending project with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java index 4fabf7da788c..2d9bb92e4a36 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java @@ -45,27 +45,27 @@ public class UpdateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "id of the project to be modified") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project to be modified") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "new Admin account for the project") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "New Admin Account for the project") private String accountName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "display text of the project") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "Display text of the project") private String displayText; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "ID of the user to be promoted/demoted") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, description = "ID of the User to be promoted/demoted") private Long userId; - @Parameter(name = ApiConstants.ROLE_TYPE, type = CommandType.STRING, description = "Account level role to be assigned to the user/account : Admin/Regular") + @Parameter(name = ApiConstants.ROLE_TYPE, type = CommandType.STRING, description = "Account level role to be assigned to the User/Account : Admin/Regular") private String roleType; - @Parameter(name = ApiConstants.SWAP_OWNER, type = CommandType.BOOLEAN, description = "when true, it swaps ownership with the account/ user provided. " + + @Parameter(name = ApiConstants.SWAP_OWNER, type = CommandType.BOOLEAN, description = "When true, it swaps ownership with the Account/User provided. " + "Ideally to be used when a single project administrator is present. In case of multiple project admins, swapowner is to be set to false," + "to promote or demote the user/account based on the roleType (Regular or Admin) provided. Defaults to true") private Boolean swapOwner; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the project", since = "4.19.0") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the project", since = "4.19.0") private String name; ///////////////////////////////////////////////////// @@ -133,10 +133,10 @@ public List getEntityOwnerIds() { @Override public void execute() throws ResourceAllocationException { - CallContext.current().setEventDetails("Project id: " + getId()); + CallContext.current().setEventDetails("Project ID: " + getResourceUuid(ApiConstants.ID)); if (getAccountName() != null && getUserId() != null) { - throw new InvalidParameterValueException("Account name and user ID are mutually exclusive. Provide either account name" + - "to update account or user ID to update the user of the project"); + throw new InvalidParameterValueException("Account name and User ID are mutually exclusive. Provide either Account name" + + "to update Account or user ID to update the user of the project"); } Project project = null; @@ -161,6 +161,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating project: " + id; + return "Updating project with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java index 0cbd9f702c27..34918de7339f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java @@ -38,10 +38,10 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "id of the project to join") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, required = true, description = "ID of the project to join") private Long projectId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that is joining the project") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Account that is joining the project") private String accountName; @Parameter(name = ApiConstants.USER_ID, type = BaseCmd.CommandType.UUID, entityType = UserResponse.class, @@ -50,10 +50,10 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.TOKEN, type = CommandType.STRING, - description = "list invitations for specified account; this parameter has to be specified with domainId") + description = "List invitations for specified account; this parameter has to be specified with domainId") private String token; - @Parameter(name = ApiConstants.ACCEPT, type = CommandType.BOOLEAN, description = "if true, accept the invitation, decline if false. True by default") + @Parameter(name = ApiConstants.ACCEPT, type = CommandType.BOOLEAN, description = "If true, accept the invitation, decline if false. True by default") private Boolean accept; // /////////////////////////////////////////////////// @@ -92,7 +92,7 @@ public long getEntityOwnerId() { @Override public void execute() { - String eventDetails = "Project id: " + projectId + ";"; + String eventDetails = "Project id: " + getResourceUuid(ApiConstants.PROJECT_ID) + ";"; if (accountName != null) { eventDetails += " accountName: " + accountName + ";"; } else if (userId != null) { @@ -116,6 +116,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating project invitation for projectId " + projectId; + return "Updating project invitation for project with ID: " + getResourceUuid(ApiConstants.PROJECT_ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java index 649b2a7bd9bc..8bb38d97c134 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/AssignToGlobalLoadBalancerRuleCmd.java @@ -62,7 +62,7 @@ public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, required = true, - description = "the ID of the global load balancer rule") + description = "The ID of the global load balancer rule") private Long id; @Parameter(name = ApiConstants.LOAD_BALANCER_RULE_LIST, @@ -70,7 +70,7 @@ public class AssignToGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { collectionType = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the list load balancer rules that will be assigned to global load balancer rule") + description = "The list load balancer rules that will be assigned to global load balancer rule") private List loadBalancerRulesIds; @Parameter(name = ApiConstants.GSLB_LBRULE_WEIGHT_MAP, @@ -145,13 +145,13 @@ public String getEventType() { @Override public String getEventDescription() { - return "assign load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") + " to global load balancer rule " + getGlobalLoadBalancerRuleId(); + return "Assigning load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") + " to global load balancer rule " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { CallContext.current().setEventDetails( - "Global Load balancer rule Id: " + getGlobalLoadBalancerRuleId() + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); + "Global Load balancer rule ID: " + getResourceUuid(ApiConstants.ID) + " Instances IDs: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); boolean result = _gslbService.assignToGlobalLoadBalancerRule(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java index ddaadde78524..2ecd8ef22e65 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/CreateGlobalLoadBalancerRuleCmd.java @@ -47,41 +47,41 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the load balancer rule") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the load balancer rule") private String globalLoadBalancerRuleName; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer rule", length = 4096) + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer rule", length = 4096) private String description; @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, required = true, - description = "region where the global load balancer is going to be created.") + description = "Region where the global load balancer is going to be created.") private Integer regionId; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account associated with the global load balancer. Must be used with the domainId parameter.") + description = "The Account associated with the global load balancer. Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID associated with the load balancer") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The domain ID associated with the load balancer") private Long domainId; @Parameter(name = ApiConstants.GSLB_LB_METHOD, type = CommandType.STRING, required = false, - description = "load balancer algorithm (roundrobin, leastconn, proximity) " + description = "Load balancer algorithm (roundrobin, leastconn, proximity) " + "that method is used to distribute traffic across the zones participating in global server load balancing, if not specified defaults to 'round robin'") private String algorithm; @Parameter(name = ApiConstants.GSLB_STICKY_SESSION_METHOD, type = CommandType.STRING, required = false, - description = "session sticky method (sourceip) if not specified defaults to sourceip") + description = "Session sticky method (sourceip) if not specified defaults to sourceip") private String stickyMethod; - @Parameter(name = ApiConstants.GSLB_SERVICE_DOMAIN_NAME, type = CommandType.STRING, required = true, description = "domain name for the GSLB service.") + @Parameter(name = ApiConstants.GSLB_SERVICE_DOMAIN_NAME, type = CommandType.STRING, required = true, description = "Domain name for the GSLB service.") private String serviceDomainName; @Parameter(name = ApiConstants.GSLB_SERVICE_TYPE, type = CommandType.STRING, required = true, description = "GSLB service type (tcp, udp, http)") @@ -153,7 +153,7 @@ public void create() { GlobalLoadBalancerRule gslbRule = _gslbService.createGlobalLoadBalancerRule(this); this.setEntityId(gslbRule.getId()); this.setEntityUuid(gslbRule.getUuid()); - CallContext.current().setEventDetails("Rule Id: " + getEntityId()); + CallContext.current().setEventDetails("Rule ID: " + getEntityUuid()); } catch (Exception ex) { logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage()); @@ -180,7 +180,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java index 7f3308614ccf..b44b547463e5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/DeleteGlobalLoadBalancerRuleCmd.java @@ -50,7 +50,7 @@ public class DeleteGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, required = true, - description = "the ID of the global load balancer rule") + description = "The ID of the global load balancer rule") private Long id; ///////////////////////////////////////////////////// @@ -85,12 +85,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting global load balancer rule: " + getGlobalLoadBalancerId(); + return "Deleting global load balancer rule with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Deleting global Load balancer rule Id: " + getGlobalLoadBalancerId()); + CallContext.current().setEventDetails("Deleting global Load balancer rule with ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _gslbService.deleteGlobalLoadBalancerRule(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java index bf0cf22a2ecb..a4bd027fc976 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/ListGlobalLoadBalancerRuleCmd.java @@ -43,10 +43,10 @@ public class ListGlobalLoadBalancerRuleCmd extends BaseListTaggedResourcesCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, description = "the ID of the global load balancer rule") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, description = "The ID of the global load balancer rule") private Long id; - @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, description = "region ID") + @Parameter(name = ApiConstants.REGION_ID, type = CommandType.INTEGER, entityType = RegionResponse.class, description = "Region ID") private Integer regionId; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java index d4b02139892c..a0ec9a1296ab 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/RemoveFromGlobalLoadBalancerRuleCmd.java @@ -65,7 +65,7 @@ public class RemoveFromGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { collectionType = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, - description = "the list load balancer rules that will be assigned to global load balancer rule") + description = "The list load balancer rules that will be assigned to global load balancer rule") private List loadBalancerRulesIds; ///////////////////////////////////////////////////// @@ -108,13 +108,13 @@ public String getEventType() { @Override public String getEventDescription() { - return "removing load balancer rules:" + StringUtils.join(getLoadBalancerRulesIds(), ",") + " from global load balancer: " + getGlobalLoadBalancerRuleId(); + return "Removing load balancer rules:" + StringUtils.join(getLoadBalancerRulesIds(), ",") + " from global load balancer: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { CallContext.current().setEventDetails( - "Global Load balancer rule Id: " + getGlobalLoadBalancerRuleId() + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); + "Global Load balancer rule Id: " + getResourceUuid(ApiConstants.ID) + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); boolean result = _gslbService.removeFromGlobalLoadBalancerRule(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java index 7996998e5d92..a56672e29cac 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/region/ha/gslb/UpdateGlobalLoadBalancerRuleCmd.java @@ -33,7 +33,7 @@ import com.cloud.region.ha.GlobalLoadBalancingRulesService; import com.cloud.user.Account; -@APICommand(name = "updateGlobalLoadBalancerRule", description = "update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class, +@APICommand(name = "updateGlobalLoadBalancerRule", description = "Update global load balancer rules.", responseObject = GlobalLoadBalancerResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { @@ -46,23 +46,23 @@ public class UpdateGlobalLoadBalancerRuleCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = GlobalLoadBalancerResponse.class, required = true, - description = "the ID of the global load balancer rule") + description = "The ID of the global load balancer rule") private Long id; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the load balancer rule", length = 4096) + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the load balancer rule", length = 4096) private String description; @Parameter(name = ApiConstants.GSLB_LB_METHOD, type = CommandType.STRING, required = false, - description = "load balancer algorithm (roundrobin, leastconn, proximity) " + description = "Load balancer algorithm (roundrobin, leastconn, proximity) " + "that is used to distributed traffic across the zones participating in global server load balancing, if not specified defaults to 'round robin'") private String algorithm; @Parameter(name = ApiConstants.GSLB_STICKY_SESSION_METHOD, type = CommandType.STRING, required = false, - description = "session sticky method (sourceip) if not specified defaults to sourceip") + description = "Session sticky method (sourceip) if not specified defaults to sourceip") private String stickyMethod; // /////////////////////////////////////////////////// @@ -107,7 +107,7 @@ public long getEntityOwnerId() { @Override public void execute() { - org.apache.cloudstack.context.CallContext.current().setEventDetails("Global Load balancer Id: " + getId()); + org.apache.cloudstack.context.CallContext.current().setEventDetails("Global Load balancer ID: " + getResourceUuid(ApiConstants.ID)); GlobalLoadBalancerRule gslbRule = _gslbService.updateGlobalLoadBalancerRule(this); if (gslbRule != null) { GlobalLoadBalancerResponse response = _responseGenerator.createGlobalLoadBalancerResponse(gslbRule); @@ -125,6 +125,6 @@ public String getEventType() { @Override public String getEventDescription() { - return "updating global load balancer rule"; + return "Updating global load balancer rule with ID: " + getResourceUuid(ApiConstants.ID); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java index b9e43336217d..04b0ccc4cb07 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java @@ -42,7 +42,7 @@ public class GetCloudIdentifierCmd extends BaseCmd { type = CommandType.UUID, entityType = UserResponse.class, required = true, - description = "the user ID for the cloud identifier") + description = "The user ID for the cloud identifier") private Long userid; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListDetailOptionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListDetailOptionsCmd.java index 240852a74c52..273f931fa23c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListDetailOptionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListDetailOptionsCmd.java @@ -28,7 +28,7 @@ import org.apache.commons.lang3.StringUtils; @APICommand(name = "listDetailOptions", - description = "Lists all possible details and their options for a resource type such as a VM or a template", + description = "Lists all possible details and their options for a resource type such as an Instance or a Template", responseObject = DetailOptionsResponse.class, since = "4.13", requestHasSensitiveInfo = false, @@ -41,11 +41,11 @@ public class ListDetailOptionsCmd extends BaseCmd { ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, - description = "the resource type such as UserVm, Template etc.") + description = "The resource type such as UserVm, Template etc.") private String resourceType; @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, - description = "the UUID of the resource (optional)") + description = "The UUID of the resource (optional)") private String resourceId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java index 556f3b081f02..70d339abd6f2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java @@ -38,7 +38,7 @@ public class ListHypervisorsCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the zone id for listing hypervisors.") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The zone id for listing hypervisors.") private Long zoneId; // /////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java index 71b886ed12b6..4bda23617092 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java @@ -43,11 +43,11 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd private Long id; @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. " - + "0 - Instance. Number of instances a user can create. " + + "0 - Instance. Number of Instances a user can create. " + "1 - IP. Number of public IP addresses an account can own. " + "2 - Volume. Number of disk volumes an account can own. " - + "3 - Snapshot. Number of snapshots an account can own. " - + "4 - Template. Number of templates an account can register/create. " + + "3 - Snapshot. Number of Snapshots an account can own. " + + "4 - Template. Number of Templates an account can register/create. " + "5 - Project. Number of projects an account can own. " + "6 - Network. Number of networks an account can own. " + "7 - VPC. Number of VPC an account can own. " @@ -58,11 +58,11 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd private Integer resourceType; @Parameter(name = ApiConstants.RESOURCE_TYPE_NAME, type = CommandType.STRING, description = "Type of resource (wins over resourceType if both are provided). Values are: " - + "user_vm - Instance. Number of instances a user can create. " + + "user_vm - Instance. Number of Instances a user can create. " + "public_ip - IP. Number of public IP addresses an account can own. " + "volume - Volume. Number of disk volumes an account can own. " - + "snapshot - Snapshot. Number of snapshots an account can own. " - + "template - Template. Number of templates an account can register/create. " + + "snapshot - Snapshot. Number of Snapshots an account can own. " + + "template - Template. Number of Templates an account can register/create. " + "project - Project. Number of projects an account can own. " + "network - Network. Number of networks an account can own. " + "vpc - VPC. Number of VPC an account can own. " @@ -103,7 +103,7 @@ public String getTag() { @Override public void execute() { List result = - _resourceLimitService.searchForLimits(id, _accountService.finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), + _resourceLimitService.searchForLimits(id, _accountService.finalizeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(), getResourceTypeEnum(), getTag(), this.getStartIndex(), this.getPageSizeVal()); ListResponse response = new ListResponse(); List limitResponses = new ArrayList(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java index 49c6ee605c8c..d43bb29e9d27 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java @@ -61,11 +61,11 @@ public class UpdateResourceCountCmd extends BaseCmd { @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.INTEGER, description = "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. If not specified will update all resource counts" - + "0 - Instance. Number of instances a user can create. " + + "0 - Instance. Number of Instances a user can create. " + "1 - IP. Number of public IP addresses a user can own. " + "2 - Volume. Number of disk volumes a user can create. " - + "3 - Snapshot. Number of snapshots a user can create. " - + "4 - Template. Number of templates that a user can register/create. " + + "3 - Snapshot. Number of Snapshots a user can create. " + + "4 - Template. Number of Templates that a user can register/create. " + "5 - Project. Number of projects that a user can create. " + "6 - Network. Number of guest network a user can create. " + "7 - VPC. Number of VPC a user can create. " @@ -127,7 +127,7 @@ public long getEntityOwnerId() { @Override public void execute() { List result = - _resourceLimitService.recalculateResourceCount(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType(), getTag()); + _resourceLimitService.recalculateResourceCount(_accountService.finalizeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType(), getTag()); if ((result != null) && (result.size() > 0)) { ListResponse response = new ListResponse(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java index 3538a389a6e9..f88ef9678e31 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java @@ -57,13 +57,13 @@ public class UpdateResourceLimitCmd extends BaseCmd { type = CommandType.INTEGER, required = true, description = "Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 and 11. " - + "0 - Instance. Number of instances a user can create. " + + "0 - Instance. Number of Instances a user can create. " + "1 - IP. Number of public IP addresses a user can own. " + "2 - Volume. Number of disk volumes a user can create. " - + "3 - Snapshot. Number of snapshots a user can create. " - + "4 - Template. Number of templates that a user can register/create. " - + "5 - Project. Number of projects a user can create. " - + "6 - Network. Number of guest network a user can create. " + + "3 - Snapshot. Number of Snapshots a user can create. " + + "4 - Template. Number of Templates that a user can register/create. " + + "5 - Project. Number of Projects a user can create. " + + "6 - Network. Number of guest Network a user can create. " + "7 - VPC. Number of VPC a user can create. " + "8 - CPU. Total number of CPU cores a user can use. " + "9 - Memory. Total Memory (in MB) a user can use. " @@ -100,7 +100,7 @@ public Integer getResourceType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -110,7 +110,7 @@ public long getEntityOwnerId() { @Override public void execute() { - ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max, getTag()); + ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalizeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max, getTag()); if (result != null || (result == null && max != null && max.longValue() == -1L)) { ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result); response.setResponseName(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java index 13faafe348c0..7d0004c8e5d5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java @@ -58,43 +58,43 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "TCP is default. UDP is the other supported protocol") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "start port for this egress rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "Start port for this egress rule") private Integer startPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "end port for this egress rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "End port for this egress rule") private Integer endPort; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this icmp message") private Integer icmpCode; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list associated. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list associated. Multiple entries must be separated by a single comma character (,).") private List cidrList; - @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping") + @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "User to security group mapping") private Map userSecurityGroupList; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", + description = "An optional domainId for the security group. If the account parameter is used, domainId must also be used.", entityType = DomainResponse.class) private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional account for the security group. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class) + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "An optional project of the security group", entityType = ProjectResponse.class) private Long projectId; @ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class) + @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description = "The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class) private Long securityGroupId; // This @ACL will not work, since we don't have a way to convert this parameter to the entity like securityGroupId. //@ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupId parameter") + @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description = "The name of the security group. Mutually exclusive with securityGroupId parameter") private String securityGroupName; ///////////////////////////////////////////////////// @@ -166,7 +166,7 @@ public static String getResultObjectName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java index 640870fc3de3..d7a95d8204e6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java @@ -55,46 +55,46 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number (see /etc/protocols). ALL is default.") + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "The protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number (see /etc/protocols). ALL is default.") private String protocol; - @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "start port for this ingress rule") + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "Start port for this ingress rule") private Integer startPort; - @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "end port for this ingress rule") + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "End port for this ingress rule") private Integer endPort; - @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent") + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the icmp message being sent") private Integer icmpType; - @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message") + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "Error code for this icmp message") private Integer icmpCode; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list associated. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The cidr list associated. Multiple entries must be separated by a single comma character (,).") private List cidrList; - @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "user to security group mapping") + @Parameter(name = ApiConstants.USER_SECURITY_GROUP_LIST, type = CommandType.MAP, description = "User to security group mapping") private Map userSecurityGroupList; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", + description = "An optional domainId for the security group. If the account parameter is used, domainId must also be used.", entityType = DomainResponse.class) private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional account for the security group. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "an optional project of the security group", entityType = ProjectResponse.class) + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "An optional project of the security group", entityType = ProjectResponse.class) private Long projectId; @ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class) + @Parameter(name=ApiConstants.SECURITY_GROUP_ID, type=CommandType.UUID, description = "The ID of the security group. Mutually exclusive with securityGroupName parameter", entityType=SecurityGroupResponse.class) private Long securityGroupId; // This @ACL will not work, since we don't have a way to convert this parameter to the entity like securityGroupId. //@ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description="The name of the security group. Mutually exclusive with securityGroupId parameter") + @Parameter(name=ApiConstants.SECURITY_GROUP_NAME, type=CommandType.STRING, description = "The name of the security group. Mutually exclusive with securityGroupId parameter") private String securityGroupName; ///////////////////////////////////////////////////// @@ -166,7 +166,7 @@ public static String getResultObjectName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java index 673eaaef33da..333dc9ff7482 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java @@ -40,19 +40,19 @@ public class CreateSecurityGroupCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the security group. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional account for the security group. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "an optional domainId for the security group. If the account parameter is used, domainId must also be used.", + description = "An optional domainId for the security group. If the account parameter is used, domainId must also be used.", entityType = DomainResponse.class) private Long domainId; - @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the security group") + @Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "The description of the security group") private String description; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the security group") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the security group") private String securityGroupName; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "Create security group for project", entityType = ProjectResponse.class) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java index b2ea90792b8e..1882d80c1c1b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java @@ -43,20 +43,20 @@ public class DeleteSecurityGroupCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account of the security group. Must be specified with domain ID") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The account of the security group. Must be specified with domain ID") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, - description = "the domain ID of account owning the security group", + description = "The domain ID of account owning the security group", entityType = DomainResponse.class) private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "the project of the security group", entityType = ProjectResponse.class) + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, description = "The project of the security group", entityType = ProjectResponse.class) private Long projectId; @ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description="The ID of the security group. Mutually exclusive with name parameter", entityType=SecurityGroupResponse.class) + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, description = "The ID of the security group. Mutually exclusive with name parameter", entityType=SecurityGroupResponse.class) private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The ID of the security group. Mutually exclusive with id parameter") @@ -103,7 +103,7 @@ public Long getId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java index f93e7b39586b..0de3bd5bdb69 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java @@ -37,16 +37,16 @@ public class ListSecurityGroupsCmd extends BaseListTaggedResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.SECURITY_GROUP_NAME, type = CommandType.STRING, description = "lists security groups by name") + @Parameter(name = ApiConstants.SECURITY_GROUP_NAME, type = CommandType.STRING, description = "Lists security groups by name") private String securityGroupName; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, - description = "lists security groups by virtual machine id", + description = "Lists security groups by Instance id", entityType = UserVmResponse.class) private Long virtualMachineId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "list the security group by the id provided", entityType = SecurityGroupResponse.class) + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "List the security group by the id provided", entityType = SecurityGroupResponse.class) private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java index bf435406174c..91f2b7ad999a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java @@ -82,7 +82,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "revoking egress rule id: " + getId(); + return "Revoking egress rule with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java index c426647fe36c..2d7e591214df 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java @@ -83,7 +83,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "revoking ingress rule id: " + getId(); + return "Revoking ingress rule with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/UpdateSecurityGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/UpdateSecurityGroupCmd.java index 801fb6ac5e51..ea756927b039 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/UpdateSecurityGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/securitygroup/UpdateSecurityGroupCmd.java @@ -42,7 +42,7 @@ public class UpdateSecurityGroupCmd extends BaseCustomIdCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required=true, description="The ID of the security group.", entityType=SecurityGroupResponse.class) + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required=true, description = "The ID of the security group.", entityType=SecurityGroupResponse.class) private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The new name of the security group.") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ArchiveSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ArchiveSnapshotCmd.java index f72de2278cc7..cae2a32a09fd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ArchiveSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ArchiveSnapshotCmd.java @@ -36,7 +36,7 @@ import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.context.CallContext; -@APICommand(name = "archiveSnapshot", description = "Archives (moves) a snapshot on primary storage to secondary storage", +@APICommand(name = "archiveSnapshot", description = "Archives (moves) a Snapshot on primary storage to secondary storage", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ArchiveSnapshotCmd extends BaseAsyncCmd { @@ -44,7 +44,7 @@ public class ArchiveSnapshotCmd extends BaseAsyncCmd { @ACL(accessType = SecurityChecker.AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class, - required=true, description="The ID of the snapshot") + required=true, description = "The ID of the Snapshot") private Long id; @Override @@ -54,18 +54,18 @@ public String getEventType() { @Override public String getEventDescription() { - return "Archiving snapshot " + id + " to secondary storage"; + return "Archiving Snapshot with ID: " + getResourceUuid(ApiConstants.ID) + " to secondary storage"; } @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { - CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class,getId())); + CallContext.current().setEventDetails("Snapshot ID: " + getResourceUuid(ApiConstants.ID)); Snapshot snapshot = _snapshotService.archiveSnapshot(getId()); if (snapshot != null) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to archive snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to archive Snapshot"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java index 07973fcbfca5..c67439a2ef7c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmd.java @@ -17,9 +17,13 @@ package org.apache.cloudstack.api.command.user.snapshot; -import java.util.ArrayList; -import java.util.List; - +import com.cloud.dc.DataCenter; +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.exception.StorageUnavailableException; +import com.cloud.storage.Snapshot; +import com.cloud.user.Account; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -31,26 +35,24 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.UserCmd; import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; import org.apache.commons.collections.CollectionUtils; - -import com.cloud.dc.DataCenter; -import com.cloud.event.EventTypes; -import com.cloud.exception.ResourceAllocationException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.exception.StorageUnavailableException; -import com.cloud.storage.Snapshot; -import com.cloud.user.Account; +import org.apache.commons.lang3.BooleanUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.ArrayList; +import java.util.List; + @APICommand(name = "copySnapshot", description = "Copies a snapshot from one zone to another.", responseObject = SnapshotResponse.class, responseView = ResponseObject.ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class CopySnapshotCmd extends BaseAsyncCmd implements UserCmd { public static final Logger logger = LogManager.getLogger(CopySnapshotCmd.class.getName()); + private Snapshot snapshot; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -84,6 +86,24 @@ public class CopySnapshotCmd extends BaseAsyncCmd implements UserCmd { "Do not specify destzoneid and destzoneids together, however one of them is required.") protected List destZoneIds; + @Parameter(name = ApiConstants.STORAGE_ID_LIST, + type=CommandType.LIST, + collectionType = CommandType.UUID, + entityType = StoragePoolResponse.class, + required = false, + authorized = RoleType.Admin, + since = "4.21.0", + description = "A comma-separated list of IDs of the storage pools in other zones in which the snapshot will be made available. " + + "The snapshot will always be made available in the zone in which the volume is present. Currently supported for StorPool only") + protected List storagePoolIds; + + @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, + type=CommandType.BOOLEAN, + since = "4.21.0", + description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " + + "This is supported only for StorPool storage for now.") + protected Boolean useStorageReplication; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -106,7 +126,15 @@ public List getDestinationZoneIds() { destIds.add(destZoneId); return destIds; } - return null; + return new ArrayList<>(); + } + + public List getStoragePoolIds() { + return storagePoolIds; + } + + public Boolean useStorageReplication() { + return BooleanUtils.toBoolean(useStorageReplication); } @Override @@ -116,18 +144,22 @@ public String getEventType() { @Override public String getEventDescription() { - StringBuilder descBuilder = new StringBuilder(); + StringBuilder descBuilder = new StringBuilder("Copying snapshot with ID: " + getResourceUuid(ApiConstants.ID)); + if (getDestinationZoneIds() != null) { + descBuilder.append(" to zones: ["); + for (Long destId : getDestinationZoneIds()) { - descBuilder.append(", "); descBuilder.append(_uuidMgr.getUuid(DataCenter.class, destId)); + descBuilder.append(", "); } - if (descBuilder.length() > 0) { - descBuilder.deleteCharAt(0); - } + + descBuilder.deleteCharAt(descBuilder.length() - 1); + + descBuilder.append("]"); } - return "copying snapshot: " + _uuidMgr.getUuid(Snapshot.class, getId()) + ((descBuilder.length() > 0) ? " to zones: " + descBuilder.toString() : ""); + return descBuilder.toString(); } @Override @@ -152,7 +184,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { try { - if (destZoneId == null && CollectionUtils.isEmpty(destZoneIds)) + if (destZoneId == null && CollectionUtils.isEmpty(destZoneIds) && useStorageReplication()) throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Either destzoneid or destzoneids parameters have to be specified."); @@ -161,7 +193,7 @@ public void execute() throws ResourceUnavailableException { "Both destzoneid and destzoneids cannot be specified at the same time."); CallContext.current().setEventDetails(getEventDescription()); - Snapshot snapshot = _snapshotService.copySnapshot(this); + snapshot = _snapshotService.copySnapshot(this); if (snapshot != null) { SnapshotResponse response = _queryService.listSnapshot(this); @@ -177,6 +209,13 @@ public void execute() throws ResourceUnavailableException { logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); } + } + + public Snapshot getSnapshot() { + return snapshot; + } + public void setSnapshot(Snapshot snapshot) { + this.snapshot = snapshot; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java index 3289ac2fe106..d03df501847a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java @@ -16,11 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -32,6 +34,7 @@ import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.commons.collections.MapUtils; @@ -46,7 +49,7 @@ import com.cloud.user.Account; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "createSnapshot", description = "Creates an instant snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, +@APICommand(name = "createSnapshot", description = "Creates an instant Snapshot of a volume.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSnapshotCmd extends BaseAsyncCreateCmd { @@ -56,13 +59,13 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "The account of the snapshot. The account parameter must be used with the domainId parameter.") + description = "The Account of the Snapshot. The Account parameter must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume. If account is NOT provided then snapshot will be assigned to the caller account and domain.") + description = "The domain ID of the Snapshot. If used with the Account parameter, specifies a domain for the Account associated with the disk volume. If Account is NOT provided then snapshot will be assigned to the caller Account and domain.") private Long domainId; @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume") @@ -71,20 +74,20 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.POLICY_ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, - description = "policy id of the snapshot, if this is null, then use MANUAL_POLICY.") + description = "Policy ID of the Snapshot, if this is null, then use MANUAL_POLICY.") private Long policyId; - @Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true") + @Parameter(name = ApiConstants.SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "Quiesce Instance if true") private Boolean quiescevm; @Parameter(name = ApiConstants.LOCATION_TYPE, type = CommandType.STRING, required = false, description = "Currently applicable only for managed storage. " + "Valid location types: 'primary', 'secondary'. Default = 'primary'.") private String locationType; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the snapshot") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Snapshot") private String snapshotName; - @Parameter(name = ApiConstants.ASYNC_BACKUP, type = CommandType.BOOLEAN, required = false, description = "asynchronous backup if true") + @Parameter(name = ApiConstants.ASYNC_BACKUP, type = CommandType.BOOLEAN, required = false, description = "Asynchronous backup if true") private Boolean asyncBackup; @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "Map of tags (key/value pairs)") @@ -99,6 +102,22 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { since = "4.19.0") protected List zoneIds; + @Parameter(name = ApiConstants.STORAGE_ID_LIST, + type=CommandType.LIST, + collectionType = CommandType.UUID, + entityType = StoragePoolResponse.class, + authorized = RoleType.Admin, + description = "A comma-separated list of IDs of the storage pools in other zones in which the snapshot will be made available. " + + "The snapshot will always be made available in the zone in which the volume is present.", + since = "4.21.0") + protected List storagePoolIds; + + @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, + type=CommandType.BOOLEAN, + description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " + + "This is supported only for StorPool storage for now.") + protected Boolean useStorageReplication; + private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject; // /////////////////////////////////////////////////// @@ -161,6 +180,17 @@ public List getZoneIds() { return zoneIds; } + public List getStoragePoolIds() { + return storagePoolIds == null ? new ArrayList<>() : storagePoolIds; + } + + public Boolean useStorageReplication() { + if (useStorageReplication == null) { + return false; + } + return useStorageReplication; + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -186,7 +216,7 @@ public long getEntityOwnerId() { " as it's no longer active"); } } else if (account.getState() == Account.State.DISABLED) { - throw new PermissionDeniedException("The owner of template is disabled: " + account); + throw new PermissionDeniedException("The owner of Template is disabled: " + account); } return volume.getAccountId(); @@ -199,7 +229,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating snapshot for volume: " + getVolumeUuid(); + return "Creating Snapshot for volume: " + getResourceUuid(ApiConstants.VOLUME_ID); } @Override @@ -209,12 +239,12 @@ public ApiCommandResourceType getApiResourceType() { @Override public void create() throws ResourceAllocationException { - Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId(), getSnapshotName(), getLocationType(), getZoneIds()); + Snapshot snapshot = _volumeService.allocSnapshot(getVolumeId(), getPolicyId(), getSnapshotName(), getLocationType(), getZoneIds(), getStoragePoolIds(), useStorageReplication()); if (snapshot != null) { setEntityId(snapshot.getId()); setEntityUuid(snapshot.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot for volume" + getVolumeUuid()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Snapshot for volume" + getResourceUuid(ApiConstants.VOLUME_ID)); } } @@ -223,29 +253,28 @@ public void execute() { Snapshot snapshot; try { snapshot = - _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm(), getLocationType(), getAsyncBackup(), getTags(), getZoneIds()); + _volumeService.takeSnapshot(getVolumeId(), getPolicyId(), getEntityId(), _accountService.getAccount(getEntityOwnerId()), getQuiescevm(), getLocationType(), getAsyncBackup(), getTags(), getZoneIds(), getStoragePoolIds(), useStorageReplication()); if (snapshot != null) { SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Snapshot from volume [%s] was not found in database.", getVolumeUuid())); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Snapshot from volume [%s] was not found in database.", getResourceUuid(ApiConstants.VOLUME_ID))); } } catch (Exception e) { if (e.getCause() instanceof UnsupportedOperationException) { - throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, String.format("Failed to create snapshot due to unsupported operation: %s", e.getCause().getMessage())); + throw new ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, String.format("Failed to create Snapshot due to unsupported operation: %s", e.getCause().getMessage())); } - String errorMessage = "Failed to create snapshot due to an internal error creating snapshot for volume " + getVolumeUuid(); + String errorMessage = "Failed to create Snapshot due to an internal error creating Snapshot for volume " + getResourceUuid(ApiConstants.VOLUME_ID); logger.error(errorMessage, e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMessage); } } - private Snapshot.LocationType getLocationType() { - - if (Snapshot.LocationType.values() == null || Snapshot.LocationType.values().length == 0 || locationType == null) { + public Snapshot.LocationType getLocationType() { + if (locationType == null) { return null; } @@ -283,8 +312,4 @@ public Boolean getAsyncBackup() { return asyncBackup; } } - - protected String getVolumeUuid() { - return _uuidMgr.getUuid(Volume.class, getVolumeId()); - } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java index cdd908dfb87d..6fb5fb0463ab 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotFromVMSnapshotCmd.java @@ -39,7 +39,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "createSnapshotFromVMSnapshot", description = "Creates an instant snapshot of a volume from existing vm snapshot.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, since = "4.10.0", +@APICommand(name = "createSnapshotFromVMSnapshot", description = "Creates an instant Snapshot of a volume from existing Instance Snapshot.", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, since = "4.10.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd { @@ -51,10 +51,10 @@ public class CreateSnapshotFromVMSnapshotCmd extends BaseAsyncCreateCmd { private Long volumeId; @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class, - required=true, description="The ID of the VM snapshot") + required=true, description = "The ID of the Instance Snapshot") private Long vmSnapshotId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the snapshot") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the Snapshot") private String snapshotName; private String syncObjectType = BaseAsyncCmd.snapshotHostSyncObject; @@ -78,18 +78,18 @@ public String getSnapshotName() { private Long getVmId() { VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId()); if (vmsnapshot == null) { - throw new InvalidParameterValueException("Unable to find vm snapshot by id=" + getVMSnapshotId()); + throw new InvalidParameterValueException("Unable to find Instance Snapshot by id=" + getVMSnapshotId()); } UserVm vm = _entityMgr.findById(UserVm.class, vmsnapshot.getVmId()); if (vm == null) { - throw new InvalidParameterValueException("Unable to find vm by vm snapshot id=" + getVMSnapshotId()); + throw new InvalidParameterValueException("Unable to find Instance by Instance Snapshot id=" + getVMSnapshotId()); } return vm.getId(); } private Long getHostId() { VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId()); if (vmsnapshot == null) { - throw new InvalidParameterValueException("Unable to find vm snapshot by id=" + getVMSnapshotId()); + throw new InvalidParameterValueException("Unable to find Instance Snapshot by id=" + getVMSnapshotId()); } UserVm vm = _entityMgr.findById(UserVm.class, vmsnapshot.getVmId()); if (vm != null) { @@ -124,13 +124,13 @@ public long getEntityOwnerId() { if (account.getType() == Account.Type.PROJECT) { Project project = _projectService.findByProjectAccountId(vmsnapshot.getAccountId()); if (project == null) { - throw new InvalidParameterValueException(String.format("Unable to find project by account %s", account)); + throw new InvalidParameterValueException(String.format("Unable to find project by Account %s", account)); } if (project.getState() != Project.State.Active) { throw new PermissionDeniedException(String.format("Can't add resources to the project %s in state=%s as it's no longer active", project, project.getState())); } } else if (account.getState() == Account.State.DISABLED) { - throw new PermissionDeniedException("The owner of template is disabled: " + account); + throw new PermissionDeniedException("The owner of Template is disabled: " + account); } return vmsnapshot.getAccountId(); @@ -143,7 +143,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating snapshot from vm snapshot : " + this._uuidMgr.getUuid(VMSnapshot.class, getVMSnapshotId()); + return "Creating Snapshot from Instance Snapshot : " + getResourceUuid(ApiConstants.VOLUME_ID); } @Override @@ -153,20 +153,20 @@ public ApiCommandResourceType getApiResourceType() { @Override public void create() throws ResourceAllocationException { - Snapshot snapshot = this._volumeService.allocSnapshotForVm(getVmId(), getVolumeId(), getSnapshotName()); + Snapshot snapshot = this._volumeService.allocSnapshotForVm(getVmId(), getVolumeId(), getSnapshotName(), getVMSnapshotId()); if (snapshot != null) { this.setEntityId(snapshot.getId()); this.setEntityUuid(snapshot.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot from vm snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Snapshot from Instance Snapshot"); } } @Override public void execute() { VMSnapshot vmSnapshot = _vmSnapshotService.getVMSnapshotById(getVMSnapshotId()); - logger.info("CreateSnapshotFromVMSnapshotCmd with vm snapshot {} with id {} and snapshot [id: {}, uuid: {}]", vmSnapshot, getVMSnapshotId(), getEntityId(), getEntityUuid()); - CallContext.current().setEventDetails("Vm Snapshot Id: " + vmSnapshot.getUuid()); + logger.info("CreateSnapshotFromVMSnapshotCmd with {} and Snapshot [ID: {}, UUID: {}]", vmSnapshot, getEntityId(), getEntityUuid()); + CallContext.current().setEventDetails("Instance Snapshot ID: " + vmSnapshot.getUuid()); Snapshot snapshot = null; try { snapshot = _snapshotService.backupSnapshotFromVmSnapshot(getEntityId(), getVmId(), getVolumeId(), getVMSnapshotId()); @@ -175,19 +175,19 @@ public void execute() { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to create snapshot due to an internal error creating snapshot from vm snapshot %s", vmSnapshot)); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to create Snapshot due to an internal error creating Snapshot from Instance Snapshot %s", vmSnapshot)); } } catch (InvalidParameterValueException ex) { throw ex; } catch (Exception e) { logger.debug("Failed to create snapshot", e); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to create snapshot due to an internal error creating snapshot from vm snapshot %s", vmSnapshot)); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to create Snapshot due to an internal error creating Snapshot from Instance Snapshot %s", vmSnapshot)); } finally { if (snapshot == null) { try { _snapshotService.deleteSnapshot(getEntityId(), null); } catch (Exception e) { - logger.debug("Failed to clean failed snapshot {} with id {}", () -> _entityMgr.findById(Snapshot.class, getEntityId()), this::getEntityId); + logger.debug("Failed to clean failed Snapshot {} with ID {}", () -> _entityMgr.findById(Snapshot.class, getEntityId()), this::getEntityId); } } } @@ -209,4 +209,9 @@ public Long getSyncObjId() { } return null; } + + @Override + public Long getApiResourceId() { + return getEntityId(); + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java index e30b897db2ea..b1e7b2a00040 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java @@ -16,11 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.projects.Project; +import com.cloud.storage.Volume; +import com.cloud.storage.snapshot.SnapshotPolicy; +import com.cloud.user.Account; +import java.util.ArrayList; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -30,18 +32,18 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.commons.collections.MapUtils; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.projects.Project; -import com.cloud.storage.Volume; -import com.cloud.storage.snapshot.SnapshotPolicy; -import com.cloud.user.Account; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.lang3.BooleanUtils; -@APICommand(name = "createSnapshotPolicy", description = "Creates a snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class, +@APICommand(name = "createSnapshotPolicy", description = "Creates a Snapshot policy for the account.", responseObject = SnapshotPolicyResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateSnapshotPolicyCmd extends BaseCmd { @@ -50,13 +52,13 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, required = true, description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY") + @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, required = true, description = "Valid values are HOURLY, DAILY, WEEKLY, and MONTHLY") private String intervalType; - @Parameter(name = ApiConstants.MAX_SNAPS, type = CommandType.INTEGER, required = true, description = "maximum number of snapshots to retain") + @Parameter(name = ApiConstants.MAX_SNAPS, type = CommandType.INTEGER, required = true, description = "Maximum number of Snapshots to retain") private Integer maxSnaps; - @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = true, description = "time the snapshot is scheduled to be taken. " + "Format is:" + @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = true, description = "Time the Snapshot is scheduled to be taken. " + "Format is:" + "* if HOURLY, MM" + "* if DAILY, MM:HH" + "* if WEEKLY, MM:HH:DD (1-7)" + "* if MONTHLY, MM:HH:DD (1-28)") private String schedule; @@ -66,10 +68,10 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { description = "Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.") private String timezone; - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume") private Long volumeId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "Map of tags (key/value pairs)") @@ -83,6 +85,21 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { "The snapshots will always be made available in the zone in which the volume is present.") protected List zoneIds; + @Parameter(name = ApiConstants.STORAGE_ID_LIST, + type=CommandType.LIST, + collectionType = CommandType.UUID, + entityType = StoragePoolResponse.class, + description = "A comma-separated list of IDs of the storage pools in other zones in which the snapshot will be made available. " + + "The snapshot will always be made available in the zone in which the volume is present.", + since = "4.21.0") + protected List storagePoolIds; + + @Parameter (name = ApiConstants.USE_STORAGE_REPLICATION, + type=CommandType.BOOLEAN, + since = "4.21.0", + description = "Enables the snapshot to be copied to the supported primary storages when the config 'use.storage.replication' is set to true for the storage or globally. " + + "This is supported only for StorPool storage for now.") + protected Boolean useStorageReplication; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -119,6 +136,14 @@ public List getZoneIds() { return zoneIds; } + public List getStoragePoolIds() { + return storagePoolIds == null ? new ArrayList<>() : storagePoolIds; + } + + public Boolean useStorageReplication() { + return BooleanUtils.toBoolean(useStorageReplication); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -141,7 +166,7 @@ public long getEntityOwnerId() { throw ex; } } else if (account.getState() == Account.State.DISABLED) { - throw new PermissionDeniedException("The owner of template is disabled: " + account); + throw new PermissionDeniedException("The owner of Template is disabled: " + account); } return volume.getAccountId(); @@ -167,7 +192,7 @@ public void execute() { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Snapshot policy"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java index a0a8cfac9bd2..b4eaceb61ba6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java @@ -35,7 +35,7 @@ import com.cloud.storage.Snapshot; import com.cloud.user.Account; -@APICommand(name = "deleteSnapshot", description = "Deletes a snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = {Snapshot.class}, +@APICommand(name = "deleteSnapshot", description = "Deletes a Snapshot of a disk volume.", responseObject = SuccessResponse.class, entityType = {Snapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSnapshotCmd extends BaseAsyncCmd { @@ -45,7 +45,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = SnapshotResponse.class, - required=true, description="The ID of the snapshot") + required=true, description = "The ID of the Snapshot") private Long id; @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, description="The ID of the zone for the snapshot", since = "4.19.0") @@ -85,7 +85,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "deleting snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId()); + return "Deleting Snapshot with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -100,13 +100,13 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId())); + CallContext.current().setEventDetails("Snapshot ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _snapshotService.deleteSnapshot(getId(), getZoneId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Snapshot"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java index 6f4b60dc8b21..79ac80f78e86 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java @@ -30,7 +30,7 @@ import com.cloud.user.Account; -@APICommand(name = "deleteSnapshotPolicies", description = "Deletes snapshot policies for the account.", responseObject = SuccessResponse.class, +@APICommand(name = "deleteSnapshotPolicies", description = "Deletes Snapshot policies for the account.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteSnapshotPoliciesCmd extends BaseCmd { @@ -39,14 +39,14 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, description = "the Id of the snapshot policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, description = "The ID of the Snapshot policy") private Long id; @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SnapshotPolicyResponse.class, - description = "list of snapshots policy IDs separated by comma") + description = "List of Snapshots policy IDs separated by comma") private List ids; ///////////////////////////////////////////////////// @@ -77,7 +77,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Snapshot policy"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ExtractSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ExtractSnapshotCmd.java index 3f0f82ea4e3b..dacdd20b3969 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ExtractSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ExtractSnapshotCmd.java @@ -96,12 +96,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "Snapshot extraction job"; + return "Starting Snapshot extraction for Snapshot with ID: " + getResourceUuid(ApiConstants.ID); } @Override public void execute() { - CallContext.current().setEventDetails("Snapshot ID: " + this._uuidMgr.getUuid(Snapshot.class, getId())); + CallContext.current().setEventDetails("Snapshot ID: " + getResourceUuid(ApiConstants.ID)); String uploadUrl = _snapshotService.extractSnapshot(this); logger.info("Extract URL [{}] of snapshot [{}].", uploadUrl, id); if (uploadUrl != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java index 126a4080e6d2..df73a009a035 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java @@ -23,7 +23,7 @@ import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; @@ -32,22 +32,22 @@ import com.cloud.storage.snapshot.SnapshotPolicy; import com.cloud.utils.Pair; -@APICommand(name = "listSnapshotPolicies", description = "Lists snapshot policies.", responseObject = SnapshotPolicyResponse.class, +@APICommand(name = "listSnapshotPolicies", description = "Lists Snapshot policies.", responseObject = SnapshotPolicyResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListSnapshotPoliciesCmd extends BaseListCmd { +public class ListSnapshotPoliciesCmd extends BaseListProjectAndAccountResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "The ID of the disk volume") private Long volumeId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, description = "the ID of the snapshot policy") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotPolicyResponse.class, description = "The ID of the Snapshot policy") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -69,13 +69,14 @@ public boolean isDisplay() { public Long getId() { return id; } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override public void execute() { - Pair, Integer> result = _snapshotService.listPoliciesforVolume(this); + Pair, Integer> result = _snapshotService.listSnapshotPolicies(this); ListResponse response = new ListResponse(); List policyResponses = new ArrayList(); for (SnapshotPolicy policy : result.first()) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java index 826c54c2e052..316b9c8d0c9d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java @@ -31,7 +31,7 @@ import com.cloud.storage.Snapshot; -@APICommand(name = "listSnapshots", description = "Lists all available snapshots for the account.", responseObject = SnapshotResponse.class, entityType = { +@APICommand(name = "listSnapshots", description = "Lists all available Snapshots for the Account.", responseObject = SnapshotResponse.class, entityType = { Snapshot.class }, responseView = ResponseObject.ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { @@ -40,25 +40,25 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, description = "lists snapshot by snapshot ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SnapshotResponse.class, description = "Lists Snapshot by Snapshot ID") private Long id; - @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=SnapshotResponse.class, description="the IDs of the snapshots, mutually exclusive with id", since = "4.9") + @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=SnapshotResponse.class, description = "The IDs of the Snapshots, mutually exclusive with id", since = "4.9") private List ids; - @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, description = "valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.") + @Parameter(name = ApiConstants.INTERVAL_TYPE, type = CommandType.STRING, description = "Valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.") private String intervalType; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Lists Snapshot by Snapshot name") private String snapshotName; - @Parameter(name = ApiConstants.SNAPSHOT_TYPE, type = CommandType.STRING, description = "valid values are MANUAL or RECURRING.") + @Parameter(name = ApiConstants.SNAPSHOT_TYPE, type = CommandType.STRING, description = "Valid values are MANUAL or RECURRING.") private String snapshotType; - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "The ID of the disk volume") private Long volumeId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "List Snapshots by zone id") private Long zoneId; @Parameter(name = ApiConstants.SHOW_UNIQUE, type = CommandType.BOOLEAN, description = "If set to false, list templates across zones and their storages", since = "4.19.0") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java index fe3b4da0160e..59881dfdabe2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/RevertSnapshotCmd.java @@ -35,7 +35,7 @@ import com.cloud.storage.Snapshot; import com.cloud.user.Account; -@APICommand(name = "revertSnapshot", description = "This is supposed to revert a volume snapshot. This command is only supported with KVM so far", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, +@APICommand(name = "revertSnapshot", description = "This is supposed to revert a volume Snapshot. This command is only supported with KVM so far", responseObject = SnapshotResponse.class, entityType = {Snapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RevertSnapshotCmd extends BaseAsyncCmd { @@ -44,7 +44,7 @@ public class RevertSnapshotCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name= ApiConstants.ID, type= BaseCmd.CommandType.UUID, entityType = SnapshotResponse.class, - required=true, description="The ID of the snapshot") + required=true, description = "The ID of the Snapshot") private Long id; ///////////////////////////////////////////////////// @@ -74,7 +74,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "revert snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getId()); + return "Reverting Snapshot with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -89,14 +89,14 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getId())); + CallContext.current().setEventDetails("Snapshot ID: " + getResourceUuid(ApiConstants.ID)); Snapshot snapshot = _snapshotService.revertSnapshot(getId()); if (snapshot != null) { SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert Snapshot"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java index e7feb11f4afd..84f8d0b3c390 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/UpdateSnapshotPolicyCmd.java @@ -35,7 +35,7 @@ import org.apache.cloudstack.context.CallContext; -@APICommand(name = "updateSnapshotPolicy", description = "Updates the snapshot policy.", responseObject = SnapshotPolicyResponse.class, responseView = ResponseObject.ResponseView.Restricted, entityType = {Volume.class}, +@APICommand(name = "updateSnapshotPolicy", description = "Updates the Snapshot policy.", responseObject = SnapshotPolicyResponse.class, responseView = ResponseObject.ResponseView.Restricted, entityType = {Volume.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateSnapshotPolicyCmd extends BaseAsyncCustomIdCmd { @@ -44,12 +44,12 @@ public class UpdateSnapshotPolicyCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// @ACL(accessType = SecurityChecker.AccessType.OperateEntry) - @Parameter(name= ApiConstants.ID, type=CommandType.UUID, entityType=SnapshotPolicyResponse.class, description="the ID of the snapshot policy") + @Parameter(name= ApiConstants.ID, type=CommandType.UUID, entityType=SnapshotPolicyResponse.class, description = "The ID of the Snapshot policy") private Long id; @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the snapshot policy to the end user or not.", + description = "An optional field, whether to the display the Snapshot policy to the end user or not.", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @@ -80,11 +80,11 @@ public long getEntityOwnerId() { SnapshotPolicy policy = _entityMgr.findById(SnapshotPolicy.class, getId()); if (policy == null) { - throw new InvalidParameterValueException("Invalid snapshot policy id was provided"); + throw new InvalidParameterValueException("Invalid Snapshot policy ID was provided"); } Volume volume = _responseGenerator.findVolumeById(policy.getVolumeId()); if (volume == null) { - throw new InvalidParameterValueException("Snapshot policy's volume id doesn't exist"); + throw new InvalidParameterValueException("Snapshot policy's volume ID doesn't exist"); }else{ return volume.getAccountId(); } @@ -97,21 +97,21 @@ public String getEventType() { @Override public String getEventDescription() { - StringBuilder desc = new StringBuilder("Updating snapshot policy: "); + StringBuilder desc = new StringBuilder("Updating Snapshot policy: "); desc.append(getId()); return desc.toString(); } @Override public void execute() { - CallContext.current().setEventDetails("SnapshotPolicy Id: " + getId()); + CallContext.current().setEventDetails("Snapshot policy ID: " + getResourceUuid(ApiConstants.ID)); SnapshotPolicy result = _snapshotService.updateSnapshotPolicy(this); if (result != null) { SnapshotPolicyResponse response = _responseGenerator.createSnapshotPolicyResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update snapshot policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Snapshot policy"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java index 5212779e9654..1b79c11644fb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java @@ -40,16 +40,16 @@ public class CreateSSHKeyPairCmd extends BaseCmd { private String name; //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the SSH key. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the SSH key. If the Account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the SSH key") private Long projectId; ///////////////////////////////////////////////////// @@ -77,7 +77,7 @@ public Long getProjectId() { ///////////////////////////////////////////////////// @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java index 364ca77ae1fc..4ed8664a79d7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java @@ -41,13 +41,13 @@ public class DeleteSSHKeyPairCmd extends BaseCmd { @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the keypair") private String name; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account associated with the keypair. Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The Account associated with the keypair. Must be used with the domainId parameter.") private String accountName; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the domain ID associated with the keypair") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The domain ID associated with the keypair") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "the project associated with keypair") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "The project associated with keypair") private Long projectId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java index 6bf8dca864b0..343db1bc9565 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java @@ -37,7 +37,7 @@ public class ListSSHKeyPairsCmd extends BaseListProjectAndAccountResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SSHKeyPairResponse.class, description = "the ID of the ssh keypair") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SSHKeyPairResponse.class, description = "The ID of the SSH keypair") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "A key pair name to look for") diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java index 6a0c0541bb4f..f7af86d08357 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java @@ -43,16 +43,16 @@ public class RegisterSSHKeyPairCmd extends BaseCmd { private String publicKey; //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the SSH key. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the SSH key. If the Account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the SSH key") private Long projectId; ///////////////////////////////////////////////////// @@ -85,7 +85,7 @@ public Long getProjectId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSDiskOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSDiskOfferingCmd.java index b078ce4aae95..24290bc345e1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSDiskOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSDiskOfferingCmd.java @@ -117,7 +117,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Changing disk offering for the Shared FileSystem " + id; + return "Changing disk offering for the Shared FileSystem with ID:" + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSServiceOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSServiceOfferingCmd.java index 70fb543d64c3..1ac0f27067b4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSServiceOfferingCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ChangeSharedFSServiceOfferingCmd.java @@ -96,7 +96,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Changing service offering for the Shared FileSystem " + id; + return "Changing service offering for the Shared FileSystem with ID:" + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/CreateSharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/CreateSharedFSCmd.java index ddaa31612a89..595b611b5c0d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/CreateSharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/CreateSharedFSCmd.java @@ -230,7 +230,7 @@ public Long getApiResourceId() { } @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/DestroySharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/DestroySharedFSCmd.java index 09fae53f1284..35f16a4dc2a0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/DestroySharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/DestroySharedFSCmd.java @@ -95,7 +95,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Destroying Shared FileSystem " + id; + return "Destroying Shared FileSystem with ID:" + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ExpungeSharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ExpungeSharedFSCmd.java index 39b99218b667..8960aa3e4d40 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ExpungeSharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/ExpungeSharedFSCmd.java @@ -74,7 +74,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Expunging Shared FileSystem " + id; + return "Expunging Shared FileSystem with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/RestartSharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/RestartSharedFSCmd.java index 576c472b6eb2..75565796caa4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/RestartSharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/RestartSharedFSCmd.java @@ -94,7 +94,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Restarting Shared FileSystem " + id; + return "Restarting Shared FileSystem with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StartSharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StartSharedFSCmd.java index bd384aceef73..d7440b532b31 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StartSharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StartSharedFSCmd.java @@ -84,7 +84,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Starting Shared FileSystem " + id; + return "Starting Shared FileSystem with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StopSharedFSCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StopSharedFSCmd.java index d6e0737144a5..3800b16289e7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StopSharedFSCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/storage/sharedfs/StopSharedFSCmd.java @@ -92,7 +92,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Stopping Shared FileSystem " + id; + return "Stopping Shared FileSystem with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java index 30904db46c44..6350baefe9a5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java @@ -46,17 +46,17 @@ public class CreateTagsCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, required = true, description = "Map of tags (key/value pairs)") private Map tag; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "type of the resource") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "Type of the resource") private String resourceType; @Parameter(name = ApiConstants.RESOURCE_IDS, type = CommandType.LIST, required = true, collectionType = CommandType.STRING, - description = "list of resources to create the tags for") + description = "List of resources to create the tags for") private List resourceIds; - @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "identifies client specific tag. " + @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "Identifies client specific tag. " + "When the value is not null, the tag can't be used by cloudStack code internally") private String customer; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java index 8b3c83aa20a6..2590f7d67b7b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/tag/ListTagsCmd.java @@ -30,19 +30,19 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd { - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "List by resource type") private String resourceType; - @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id") + @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "List by resource ID") private String resourceId; - @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key") + @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "List by key") private String key; - @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "list by value") + @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "List by value") private String value; - @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "list by customer name") + @Parameter(name = ApiConstants.CUSTOMER, type = CommandType.STRING, description = "List by customer name") private String customer; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java index f094bc435070..02601b2257f1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java @@ -39,7 +39,7 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "copyTemplate", description = "Copies a template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "copyTemplate", description = "Copies a Template from one zone to another.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CopyTemplateCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "copytemplateresponse"; @@ -52,7 +52,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd implements UserCmd { type = CommandType.UUID, entityType = ZoneResponse.class, required = false, - description = "ID of the zone the template is being copied to.") + description = "ID of the zone the Template is being copied to.") protected Long destZoneId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, @@ -62,9 +62,9 @@ public class CopyTemplateCmd extends BaseAsyncCmd implements UserCmd { @Parameter(name = ApiConstants.SOURCE_ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "ID of the zone the template is currently hosted on. " + - "If not specified and template is cross-zone, " + - "then we will sync this template to region wide image store.") + description = "ID of the zone the Template is currently hosted on. " + + "If not specified and Template is cross-zone, " + + "then we will sync this Template to region wide image store.") private Long sourceZoneId; @Parameter(name = ApiConstants.DESTINATION_ZONE_ID_LIST, @@ -72,8 +72,8 @@ public class CopyTemplateCmd extends BaseAsyncCmd implements UserCmd { collectionType = CommandType.UUID, entityType = ZoneResponse.class, required = false, - description = "A list of IDs of the zones that the template needs to be copied to." + - "Specify this list if the template needs to copied to multiple zones in one go. " + + description = "A list of IDs of the zones that the Template needs to be copied to." + + "Specify this list if the Template needs to copied to multiple zones in one go. " + "Do not specify destzoneid and destzoneids together, however one of them is required.") protected List destZoneIds; @@ -136,19 +136,21 @@ public String getEventType() { @Override public String getEventDescription() { - StringBuilder descBuilder = new StringBuilder(); - if (getDestinationZoneIds() != null) { + String description = "Copying Template: " + getResourceUuid(ApiConstants.ID); + + if (getSourceZoneId() != null) { + description += " from zone: " + getResourceUuid(ApiConstants.SOURCE_ZONE_ID); + } + if (getDestinationZoneIds() != null) { + description += " to zones: "; for (Long destId : getDestinationZoneIds()) { - descBuilder.append(", "); - descBuilder.append(this._uuidMgr.getUuid(DataCenter.class, destId)); - } - if (descBuilder.length() > 0) { - descBuilder.deleteCharAt(0); + description += this._uuidMgr.getUuid(DataCenter.class, destId); + description += ", "; } } - return "copying template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) +((getSourceZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getSourceZoneId()) : "") + ((descBuilder.length() > 0) ? " to zones: " + descBuilder.toString() : ""); + return description; } @Override @@ -186,7 +188,7 @@ public void execute() throws ResourceAllocationException { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy Template"); } } catch (StorageUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java index 0a7bf2918435..b5e41ff449ca 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Map; +import com.cloud.cpu.CPU; import org.apache.cloudstack.acl.SecurityChecker; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; @@ -50,8 +51,8 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. " - + "A template created from this command is automatically designated as a private template visible to the account that created it.", responseView = ResponseView.Restricted, +@APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a Template of an Instance. " + "The Instance must be in a STOPPED state. " + + "A Template created from this command is automatically designated as a private Template visible to the account that created it.", responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd { private static final String s_name = "createtemplateresponse"; @@ -65,60 +66,60 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd { @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, - description = "The display text of the template, defaults to the 'name'.", + description = "The display text of the Template, defaults to the 'name'.", length = 4096) private String displayText; - @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise") + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True if this Template is a featured Template, false otherwise") private Boolean featured; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if this template is a public template, false otherwise") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True if this Template is a public Template, false otherwise") private Boolean publicTemplate; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Template") private String templateName; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = true, - description = "the ID of the OS Type that best represents the OS of this template.") + description = "The ID of the OS Type that best represents the OS of this Template.") private Long osTypeId; @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, - description = "true if the template supports the password reset feature; default is false") + description = "True if the Template supports the password reset feature; default is false") private Boolean passwordEnabled; - @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false") + @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the SSHkey upload feature; default is false") private Boolean sshKeyEnabled; - @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requires HVM, false otherwise") + @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "True if the Template requires HVM, false otherwise") private Boolean requiresHvm; @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class, - description = "the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in") + description = "The ID of the Snapshot the Template is being created from. Either this parameter, or volumeId has to be passed in") protected Long snapshotId; @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, - description = "the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in") + description = "The ID of the disk volume the Template is being created from. Either this parameter, or snapshotId has to be passed in") protected Long volumeId; @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class, - description="Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal") + description = "Optional, Instance ID. If this presents, it is going to create a baremetal Template for Instance this ID refers to. This is only for Instance whose hypervisor type is BareMetal") protected Long vmId; @Parameter(name = ApiConstants.URL, type = CommandType.STRING, length = 2048, - description = "Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server") + description = "Optional, only for baremetal hypervisor. The directory name where Template stored on CIFS server") private String url; - @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.") + @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "The tag for this Template.") private String templateTag; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61") @@ -126,10 +127,10 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd { @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, - description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") + description = "True if Template contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory") protected Boolean isDynamicallyScalable; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "create template for the project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Create Template for the project") private Long projectId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the zone for the template. Can be specified with snapshot only", since = "4.19.0") @@ -148,6 +149,11 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd { since = "4.19.0") private String accountName; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, + description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x. Defaults to x86_64", + since = "4.20.2") + private String arch; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -205,7 +211,7 @@ public String getUrl() { } public String getTemplateTag() { - return templateTag; + return StringUtils.isBlank(templateTag) ? null : templateTag; } public Map getDetails() { @@ -234,6 +240,10 @@ public String getAccountName() { return accountName; } + public CPU.CPUArch getArch() { + return CPU.CPUArch.fromType(arch); + } + // /////////////////////////////////////////////////// // ///////////// API Implementation/////////////////// // /////////////////////////////////////////////////// @@ -262,7 +272,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating template: " + getTemplateName(); + return "Creating Template: " + getTemplateName(); } @Override @@ -283,7 +293,7 @@ public void create() throws ResourceAllocationException { setEntityId(template.getId()); setEntityUuid(template.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Template"); } } @@ -291,7 +301,7 @@ public void create() throws ResourceAllocationException { @Override public void execute() { CallContext.current().setEventDetails( - "Template Id: " + getEntityUuid() + ((getSnapshotId() == null) ? " from volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) : " from snapshot Id: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId()))); + "Template ID: " + getEntityUuid() + ((getSnapshotId() == null) ? " from volume with ID: " + getResourceUuid(ApiConstants.VOLUME_ID) : " from Snapshot with ID: " + getResourceUuid(ApiConstants.SNAPSHOT_ID))); VirtualMachineTemplate template = _templateService.createPrivateTemplate(this); if (template != null) { @@ -308,7 +318,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private Template"); } } @@ -344,14 +354,12 @@ private void ensureAccessCheck(Account account) { private Long findAccountIdToUse(Account callingAccount) { Long accountIdToUse = null; try { - accountIdToUse = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + accountIdToUse = _accountService.finalizeAccountId(accountName, domainId, projectId, true); } catch (InvalidParameterValueException | PermissionDeniedException ex) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("An exception occurred while finalizing account id with accountName, domainId and projectId" + - "using callingAccountId=%s", callingAccount.getUuid()), ex); - } - logger.warn("Unable to find accountId associated with accountName=" + accountName + " and domainId=" - + domainId + " or projectId=" + projectId + ", using callingAccountId=" + callingAccount.getUuid()); + logger.error("Unable to find accountId associated with accountName={} and domainId={} or projectId={}" + + ", using callingAccountId={}", accountName, domainId, projectId, callingAccount.getUuid()); + logger.debug("An exception occurred while finalizing account id with accountName, domainId and projectId" + + "using callingAccountId={}", callingAccount.getUuid(), ex); } return accountIdToUse != null ? accountIdToUse : callingAccount.getAccountId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java index 5e9bf317fe1d..3c7b1e2708b8 100755 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java @@ -37,7 +37,7 @@ @APICommand(name = "deleteTemplate", responseObject = SuccessResponse.class, - description = "Deletes a template from the system. All virtual machines using the deleted template will not be affected.", + description = "Deletes a Template from the system. All Instances using the deleted Template will not be affected.", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteTemplateCmd extends BaseAsyncCmd { @@ -45,13 +45,13 @@ public class DeleteTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the Template") private Long id; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of zone of the template") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The ID of zone of the Template") private Long zoneId; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a template.", since = "4.9+") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a Template.", since = "4.9+") private Boolean forced; @Parameter(name = ApiConstants.IS_SYSTEM, type = CommandType.BOOLEAN, required = false, description = "Necessary if the template's type is system.", since = "4.20.0", authorized = {RoleType.Admin}) @@ -98,7 +98,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting template " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()); + return "Deleting Template with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -113,13 +113,13 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Template Id: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId())); + CallContext.current().setEventDetails("Template ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _templateService.deleteTemplate(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Template"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java index 0fa0679bfd9e..d3f039ce38de 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java @@ -28,13 +28,12 @@ import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; -import com.cloud.dc.DataCenter; import com.cloud.event.EventTypes; import com.cloud.exception.InternalErrorException; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "extractTemplate", description = "Extracts a template", responseObject = ExtractResponse.class, +@APICommand(name = "extractTemplate", description = "Extracts a Template", responseObject = ExtractResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ExtractTemplateCmd extends BaseAsyncCmd { @@ -43,20 +42,20 @@ public class ExtractTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the Template") private Long id; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "the url to which the ISO would be extracted") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "The url to which the ISO would be extracted") private String url; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = false, - description = "the ID of the zone where the ISO is originally located") + description = "The ID of the zone where the ISO is originally located") private Long zoneId; - @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") + @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "The mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") private String mode; ///////////////////////////////////////////////////// @@ -101,7 +100,14 @@ public String getEventType() { @Override public String getEventDescription() { - return "extracting template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) + ((getZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()) : ""); + String description = "Extracting Template with ID: " + getResourceUuid(ApiConstants.ID); + + Long zoneId = getZoneId(); + if (zoneId != null) { + description += "from zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); + } + + return description; } @Override @@ -125,7 +131,7 @@ public void execute() { response.setObjectName("template"); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract Template"); } } catch (InternalErrorException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java index 8fa1a5d53eb7..e6e178baada6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java @@ -38,7 +38,7 @@ import com.cloud.exception.ResourceAllocationException; -@APICommand(name = "getUploadParamsForTemplate", description = "upload an existing template into the CloudStack cloud. ", +@APICommand(name = "getUploadParamsForTemplate", description = "Upload an existing Template into the CloudStack cloud. ", responseObject = GetUploadParamsResponse.class, since = "4.6.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) @@ -46,18 +46,18 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd { private static final String s_name = "postuploadtemplateresponse"; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the template. This is usually used for display purposes.", length = 4096) + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the Template. This is usually used for display purposes.", length = 4096) private String displayText; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "the target hypervisor for the template") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "The target hypervisor for the Template") private String hypervisor; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = false, - description = "the ID of the OS Type that best represents the OS of this template. Not required for VMware as the guest OS is obtained from the OVF file.") + description = "The ID of the OS Type that best represents the OS of this Template. Not required for VMware as the guest OS is obtained from the OVF file.") private Long osTypeId; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the template. Valid options are: x86_64, aarch64", + description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; @@ -67,38 +67,48 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd { @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Template details in key/value pairs.") private Map details; - @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") + @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, description = "True if Template contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory") private Boolean isDynamicallyScalable; - @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template or its derivatives are extractable; default is false") + @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "True if the Template or its derivatives are extractable; default is false") private Boolean extractable; - @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise") + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True if this Template is a featured Template, false otherwise") private Boolean featured; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the template is available to all accounts; default is true") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True if the Template is available to all accounts; default is true") private Boolean publicTemplate; - @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router") + @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "True if the Template type is routing i.e., if Template is used to deploy router") private Boolean isRoutingType; - @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the password reset feature; default is false") + @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the password reset feature; default is false") private Boolean passwordEnabled; - @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if this template requires HVM") + @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "True if this Template requires HVM") private Boolean requiresHvm; - @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false") + @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the SSHkey upload feature; default is false") private Boolean sshKeyEnabled; - @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.") + @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "The tag for this Template.") private String templateTag; @Parameter(name=ApiConstants.DEPLOY_AS_IS, type = CommandType.BOOLEAN, - description = "(VMware only) true if VM deployments should preserve all the configurations defined for this template", since = "4.15.1") + description = "(VMware only) true if Instance deployments should preserve all the configurations defined for this Template", since = "4.15.1") private Boolean deployAsIs; + @Parameter(name=ApiConstants.FOR_CKS, + type = CommandType.BOOLEAN, + description = "if true, the templates would be available for deploying CKS clusters", since = "4.21.0") + protected Boolean forCks; + + @Parameter(name = ApiConstants.TEMPLATE_TYPE, type = CommandType.STRING, + description = "the type of the template. Valid options are: USER/VNF (for all users) and SYSTEM/ROUTING/BUILTIN (for admins only).", + since = "4.22.0") + private String templateType; + public String getDisplayText() { return StringUtils.isBlank(displayText) ? getName() : displayText; } @@ -160,7 +170,7 @@ public Boolean isSshKeyEnabled() { } public String getTemplateTag() { - return templateTag; + return StringUtils.isBlank(templateTag) ? null : templateTag; } public boolean isDeployAsIs() { @@ -168,10 +178,18 @@ public boolean isDeployAsIs() { Boolean.TRUE.equals(deployAsIs); } + public boolean isForCks() { + return Boolean.TRUE.equals(forCks); + } + public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public String getTemplateType() { + return templateType; + } + @Override public void execute() throws ServerApiException { validateRequest(); @@ -180,14 +198,14 @@ public void execute() throws ServerApiException { response.setResponseName(getCommandName()); setResponseObject(response); } catch (ResourceAllocationException | MalformedURLException e) { - logger.error("exception while registering template", e); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "exception while registering template: " + e.getMessage()); + logger.error("Exception while registering Template", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Exception while registering Template: " + e.getMessage()); } } private void validateRequest() { if (getZoneId() <= 0) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "invalid zoneid"); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid zoneid"); } if (!isDeployAsIs() && osTypeId == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Missing parameter ostypeid"); @@ -205,7 +223,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true); + Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java index 6d544df41871..7e7efcf87cf4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java @@ -1,4 +1,4 @@ -// Licensedname = "listTemplatePermissions", to the Apache Software Foundation (ASF) under one +// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file @@ -26,7 +26,7 @@ import com.cloud.storage.Storage.ImageFormat; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "listTemplatePermissions", description = "List template visibility and all accounts that have permissions to view this template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "listTemplatePermissions", description = "List Template visibility and all accounts that have permissions to view this Template.", responseObject = TemplatePermissionsResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTemplatePermissionsCmd extends BaseListTemplateOrIsoPermissionsCmd implements UserCmd { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java index bff65ef70a92..0b52413aaf19 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java @@ -16,17 +16,11 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import com.cloud.cpu.CPU; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.server.ResourceIcon; -import com.cloud.server.ResourceTag; -import org.apache.cloudstack.api.response.ResourceIconResponse; -import org.apache.commons.collections.CollectionUtils; - import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; import java.util.List; + import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -34,17 +28,23 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.command.user.UserCmd; +import org.apache.cloudstack.api.response.ExtensionResponse; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.server.ResourceTag; import com.cloud.template.VirtualMachineTemplate; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; -import org.apache.commons.lang3.StringUtils; -@APICommand(name = "listTemplates", description = "List all public, private, and privileged templates.", responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Restricted, +@APICommand(name = "listTemplates", description = "List all public, private, and privileged Templates.", responseObject = TemplateResponse.class, entityType = {VirtualMachineTemplate.class}, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements UserCmd { @@ -54,47 +54,47 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor for which to restrict the search") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "The hypervisor for which to restrict the search") private String hypervisor; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the template ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "The Template ID") private Long id; - @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=TemplateResponse.class, description="the IDs of the templates, mutually exclusive with id", since = "4.9") + @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=TemplateResponse.class, description = "The IDs of the Templates, mutually exclusive with id", since = "4.9") private List ids; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the template name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The Template name") private String templateName; @Parameter(name = ApiConstants.TEMPLATE_FILTER, type = CommandType.STRING, required = true, - description = "possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " - + "* featured : templates that have been marked as featured and public. " - + "* self : templates that have been registered or created by the calling user. " - + "* selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. " - + "* sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. " - + "* executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. " - + "* community : templates that have been marked as public but not featured. " + "* all : all templates (only usable by admins).") + description = "Possible values are \"featured\", \"self\", \"selfexecutable\",\"sharedexecutable\",\"executable\", and \"community\". " + + "* featured : Templates that have been marked as featured and public. " + + "* self : Templates that have been registered or created by the calling user. " + + "* selfexecutable : same as self, but only returns Templates that can be used to deploy a new Instance. " + + "* sharedexecutable : Templates ready to be deployed that have been granted to the calling user by another user. " + + "* executable : Templates that are owned by the calling user, or public Templates, that can be used to deploy an Instance. " + + "* community : Templates that have been marked as public but not featured. " + "* all : all Templates (only usable by admins).") private String templateFilter; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list templates by zoneId") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "List Templates by zoneId") private Long zoneId; - @Parameter(name = ApiConstants.SHOW_REMOVED, type = CommandType.BOOLEAN, description = "show removed templates as well") + @Parameter(name = ApiConstants.SHOW_REMOVED, type = CommandType.BOOLEAN, description = "Show removed Templates as well") private Boolean showRemoved; - @Parameter(name = ApiConstants.SHOW_UNIQUE, type = CommandType.BOOLEAN, description = "If set to true, list only unique templates across zones", since = "4.13.2") + @Parameter(name = ApiConstants.SHOW_UNIQUE, type = CommandType.BOOLEAN, description = "If set to true, list only unique Templates across zones", since = "4.13.2") private Boolean showUnique; - @Parameter(name = ApiConstants.PARENT_TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "list datadisk templates by parent template id", since = "4.4") + @Parameter(name = ApiConstants.PARENT_TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "List datadisk Templates by parent Template id", since = "4.4") private Long parentTemplateId; @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, since = "4.15", - description = "comma separated list of template details requested, value can be a list of [ all, min]") + description = "Comma separated list of Template details requested, value can be a list of [all, min]") private List viewDetails; @Parameter(name = ApiConstants.TEMPLATE_TYPE, type = CommandType.STRING, @@ -106,11 +106,29 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User since = "4.19.0") private Boolean isVnf; + @Parameter(name = ApiConstants.FOR_CKS, type = CommandType.BOOLEAN, + description = "list templates that can be used to deploy CKS clusters", + since = "4.21.0") + private Boolean forCks; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the template. Valid options are: x86_64, aarch64", + description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; + @Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, + description = "the ID of the OS category for the template", + since = "4.21.0") + private Long osCategoryId; + + @Parameter(name = ApiConstants.EXTENSION_ID, type = CommandType.UUID, entityType = ExtensionResponse.class, + description = "ID of the extension for the template", + since = "4.21.0") + private Long extensionId; + + @Parameter(name = ApiConstants.IS_READY, type = CommandType.BOOLEAN, description = "list templates that are ready to be deployed", since = "4.21.0") + private Boolean ready; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -180,10 +198,17 @@ public boolean listInReadyState() { boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community); + + if (!onlyReady) { + if (isReady() != null && isReady().booleanValue() != onlyReady) { + onlyReady = isReady().booleanValue(); + } + } + return onlyReady; } - @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "flag to display the resource image for the templates") + @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "Flag to display the resource image for the Templates") private Boolean showIcon; ///////////////////////////////////////////////////// @@ -198,6 +223,8 @@ public Boolean getVnf() { return isVnf; } + public Boolean getForCks() { return forCks; } + public CPU.CPUArch getArch() { if (StringUtils.isBlank(arch)) { return null; @@ -205,6 +232,18 @@ public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public Long getOsCategoryId() { + return osCategoryId; + } + + public Long getExtensionId() { + return extensionId; + } + + public Boolean isReady() { + return ready; + } + @Override public String getCommandName() { return s_name; @@ -218,24 +257,14 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { ListResponse response = _queryService.listTemplates(this); - if (response != null && response.getCount() > 0 && getShowIcon()) { - updateTemplateResponse(response.getResponses()); + if (response != null && getShowIcon()) { + _responseGenerator.updateTemplateIsoResponsesForIcons(response.getResponses(), + ResourceTag.ResourceObjectType.Template); } response.setResponseName(getCommandName()); setResponseObject(response); } - private void updateTemplateResponse(List response) { - for (TemplateResponse templateResponse : response) { - ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Template, templateResponse.getId()); - if (resourceIcon == null) { - continue; - } - ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon); - templateResponse.setResourceIconResponse(iconResponse); - } - } - public List getIds() { if (ids == null) { return Collections.emptyList(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java index 1f968b869b99..49992ac66611 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java @@ -16,15 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import com.cloud.cpu.CPU; -import com.cloud.hypervisor.Hypervisor; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; -import com.cloud.hypervisor.HypervisorGuru; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; @@ -35,6 +32,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.UserCmd; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ExtensionResponse; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectResponse; @@ -43,10 +41,13 @@ import org.apache.cloudstack.context.CallContext; import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; import com.cloud.exception.ResourceAllocationException; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.hypervisor.HypervisorGuru; import com.cloud.template.VirtualMachineTemplate; -@APICommand(name = "registerTemplate", description = "Registers an existing template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "registerTemplate", description = "Registers an existing Template into the CloudStack cloud. ", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RegisterTemplateCmd extends BaseCmd implements UserCmd { @@ -61,76 +62,76 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, - description = "The display text of the template, defaults to 'name'.", + description = "The display text of the Template, defaults to 'name'.", length = 4096) private String displayText; @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, - description = "the format for the template. Possible values include QCOW2, RAW, VHD and OVA.") + description = "The format for the Template. Possible values include QCOW2, RAW, VHD and OVA.") private String format; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "the target hypervisor for the template") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "The target hypervisor for the Template") protected String hypervisor; - @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true if this template is a featured template, false otherwise") + @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True if this Template is a featured Template, false otherwise") private Boolean featured; - @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true if the template is available to all accounts; default is true") + @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True if the Template is available to all accounts; default is true") private Boolean publicTemplate; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the template") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Template") private String templateName; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, required = false, - description = "the ID of the OS Type that best represents the OS of this template. Not applicable with VMware, as we honour what is defined in the template") + description = "The ID of the OS Type that best represents the OS of this Template. Not applicable with VMware, as we honour what is defined in the Template") private Long osTypeId; @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, - description = "true if the template supports the password reset feature; default is false") + description = "True if the Template supports the password reset feature; default is false") private Boolean passwordEnabled; - @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false") + @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the sshkey upload feature; default is false") private Boolean sshKeyEnabled; - @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "true if the template or its derivatives are extractable; default is false") + @Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "True if the Template or its derivatives are extractable; default is false") private Boolean extractable; - @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if this template requires HVM") + @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "True if this Template requires HVM") private Boolean requiresHvm; @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, - description = "the URL of where the template is hosted. Possible URL include http:// and https://") + description = "The URL of where the Template is hosted. Possible URL include http:// and https://") private String url; @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, - required=false, description="the ID of the zone the template is to be hosted on") + required=false, description = "The ID of the zone the Template is to be hosted on") protected Long zoneId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId. If the account parameter is used, domainId must also be used.") + description = "An optional domainId. If the account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional accountName. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this template. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) + @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "The checksum value of this Template. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) private String checksum; - @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.") + @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "The tag for this Template.") private String templateTag; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Register template for the project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Register Template for the project") private Long projectId; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, @@ -139,11 +140,11 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd { @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, - description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") + description = "True if Template contains XS/VMWare tools in order to support dynamic scaling of Instance cpu/memory") protected Boolean isDynamicallyScalable; @Deprecated - @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router") + @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "True if the Template type is routing i.e., if Template is used to deploy router") protected Boolean isRoutingType; @Parameter(name=ApiConstants.ZONE_ID_LIST, @@ -151,33 +152,46 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd { collectionType = CommandType.UUID, entityType = ZoneResponse.class, required=false, - description="A list of zone ids where the template will be hosted. Use this parameter if the template needs " + - "to be registered to multiple zones in one go. Use zoneid if the template " + + description = "A list of zone IDs where the Template will be hosted. Use this parameter if the Template needs " + + "to be registered to multiple zones in one go. Use zoneid if the Template " + "needs to be registered to only one zone." + - "Passing only -1 to this will cause the template to be registered as a cross " + - "zone template and will be copied to all zones. ") + "Passing only -1 to this will cause the Template to be registered as a cross " + + "zone Template and will be copied to all zones. ") protected List zoneIds; @Parameter(name=ApiConstants.DIRECT_DOWNLOAD, type = CommandType.BOOLEAN, - description = "true if template should bypass Secondary Storage and be downloaded to Primary Storage on deployment") + description = "True if Template should bypass Secondary Storage and be downloaded to Primary Storage on deployment") private Boolean directDownload; @Parameter(name=ApiConstants.DEPLOY_AS_IS, type = CommandType.BOOLEAN, - description = "(VMware only) true if VM deployments should preserve all the configurations defined for this template", since = "4.15.1") + description = "(VMware only) true if Instance deployments should preserve all the configurations defined for this Template", since = "4.15.1") protected Boolean deployAsIs; + @Parameter(name=ApiConstants.FOR_CKS, + type = CommandType.BOOLEAN, + description = "if true, the templates would be available for deploying CKS clusters", since = "4.21.0") + protected Boolean forCks; + @Parameter(name = ApiConstants.TEMPLATE_TYPE, type = CommandType.STRING, description = "the type of the template. Valid options are: USER/VNF (for all users) and SYSTEM/ROUTING/BUILTIN (for admins only).", since = "4.19.0") private String templateType; @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, - description = "the CPU arch of the template. Valid options are: x86_64, aarch64", + description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x", since = "4.20") private String arch; + @Parameter(name = ApiConstants.EXTENSION_ID, type = CommandType.UUID, entityType = ExtensionResponse.class, + description = "ID of the extension", + since = "4.21.0") + private Long extensionId; + + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].endpoint.url=urlvalue", since = "4.21.0") + protected Map externalDetails; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -265,7 +279,7 @@ public String getChecksum() { } public String getTemplateTag() { - return templateTag; + return StringUtils.isBlank(templateTag) ? null : templateTag; } public Map getDetails() { @@ -295,6 +309,10 @@ public boolean isDeployAsIs() { Boolean.TRUE.equals(deployAsIs); } + public boolean isForCks() { + return Boolean.TRUE.equals(forCks); + } + public String getTemplateType() { return templateType; } @@ -303,6 +321,14 @@ public CPU.CPUArch getArch() { return CPU.CPUArch.fromType(arch); } + public Long getExtensionId() { + return extensionId; + } + + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -318,7 +344,7 @@ public ApiCommandResourceType getInstanceType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -340,7 +366,7 @@ public void execute() throws ResourceAllocationException { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register Template"); } } catch (URISyntaxException ex1) { logger.info(ex1); @@ -367,7 +393,7 @@ protected void validateParameters() { .isFunctionalitySupported(Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate) || getHypervisor().equalsIgnoreCase(customHypervisor))) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Parameter directdownload " + - "is only allowed for KVM or %s templates", customHypervisor)); + "is only allowed for KVM or %s Templates", customHypervisor)); } if (!isDeployAsIs() && osTypeId == null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java index dbbd771293a4..56d50285692d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java @@ -30,7 +30,7 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "updateTemplate", description = "Updates attributes of a template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, +@APICommand(name = "updateTemplate", description = "Updates attributes of a Template.", responseObject = TemplateResponse.class, responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd implements UserCmd { private static final String s_name = "updatetemplateresponse"; @@ -40,12 +40,17 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd implements Use ///////////////////////////////////////////////////// @Parameter(name = ApiConstants.TEMPLATE_TYPE, type = CommandType.STRING, - description = "the type of the template. Valid options are: USER/VNF (for all users) and SYSTEM/ROUTING/BUILTIN (for admins only).") + description = "The type of the Template. Valid options are: USER/VNF (for all users) and SYSTEM/ROUTING/BUILTIN (for admins only).") private String templateType; @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.", since = "4.20.0") private String templateTag; + @Parameter(name = ApiConstants.FOR_CKS, type = CommandType.BOOLEAN, + description = "indicates that the template can be used for deployment of CKS clusters", + since = "4.21.0") + private Boolean forCks; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -63,6 +68,10 @@ public String getTemplateTag() { return templateTag; } + public Boolean getForCks() { + return forCks; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -106,7 +115,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Template"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java index de8f09a64005..9c408238fe21 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java @@ -24,9 +24,9 @@ import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; -@APICommand(name = "updateTemplatePermissions", responseObject = SuccessResponse.class, description = "Updates a template visibility permissions. " - + "A public template is visible to all accounts within the same domain. " + "A private template is visible only to the owner of the template. " - + "A privileged template is a private template with account permissions added. " + "Only accounts specified under the template permissions are visible to them.", entityType = {VirtualMachineTemplate.class}, +@APICommand(name = "updateTemplatePermissions", responseObject = SuccessResponse.class, description = "Updates a Template visibility permissions. " + + "A public Template is visible to all accounts within the same domain. " + "A private Template is visible only to the owner of the Template. " + + "A privileged Template is a private Template with account permissions added. " + "Only accounts specified under the Template permissions are visible to them.", entityType = {VirtualMachineTemplate.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateTemplatePermissionsCmd extends BaseUpdateTemplateOrIsoPermissionsCmd { @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/BaseRegisterUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/BaseRegisterUserDataCmd.java new file mode 100644 index 000000000000..c002bd226a0d --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/BaseRegisterUserDataCmd.java @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.userdata; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.network.NetworkModel; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public abstract class BaseRegisterUserDataCmd extends BaseCmd { + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the user data") + private String name; + + //Owner information + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the user data. Must be used with domainId.") + private String accountName; + + @Parameter(name = ApiConstants.DOMAIN_ID, + type = CommandType.UUID, + entityType = DomainResponse.class, + description = "an optional domainId for the user data. If the account parameter is used, domainId must also be used.") + private Long domainId; + + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the user data") + private Long projectId; + + @Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, description = "comma separated list of variables declared in user data content") + private String params; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getName() { + return name; + } + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getProjectId() { + return projectId; + } + + public String getParams() { + checkForVRMetadataFileNames(params); + return params; + } + + public void checkForVRMetadataFileNames(String params) { + if (StringUtils.isNotEmpty(params)) { + List keyValuePairs = new ArrayList<>(Arrays.asList(params.split(","))); + keyValuePairs.retainAll(NetworkModel.metadataFileNames); + if (!keyValuePairs.isEmpty()) { + throw new InvalidParameterValueException(String.format("Params passed here have a few virtual router metadata file names %s", keyValuePairs)); + } + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteCniConfigurationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteCniConfigurationCmd.java new file mode 100644 index 000000000000..8faa612d3d97 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteCniConfigurationCmd.java @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.userdata; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.user.Account; +import com.cloud.user.UserData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +@APICommand(name = "deleteCniConfiguration", description = "Deletes a CNI Configuration", responseObject = SuccessResponse.class, entityType = {UserData.class}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.21.0", + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class DeleteCniConfigurationCmd extends DeleteUserDataCmd { + + public static final Logger logger = LogManager.getLogger(DeleteCniConfigurationCmd.class.getName()); + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + boolean result = _mgr.deleteCniConfiguration(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + response.setSuccess(result); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete CNI configuration"); + } + } + + @Override + public long getEntityOwnerId() { + Account account = CallContext.current().getCallingAccount(); + Long domainId = this.getDomainId(); + String accountName = this.getAccountName(); + if ((account == null || _accountService.isAdmin(account.getId())) && (domainId != null && accountName != null)) { + Account userAccount = _responseGenerator.findAccountByNameDomain(accountName, domainId); + if (userAccount != null) { + return userAccount.getId(); + } + } + + if (account != null) { + return account.getId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteUserDataCmd.java index a1d1afc7b057..f6d29e5dc40c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/DeleteUserDataCmd.java @@ -43,20 +43,20 @@ public class DeleteUserDataCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, entityType = UserDataResponse.class, description = "the ID of the Userdata") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, entityType = UserDataResponse.class, description = "The ID of the Userdata") private Long id; //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the userdata. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional account for the userdata. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the userdata. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the userdata. If the account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the userdata") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the userdata") private Long projectId; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/LinkUserDataToTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/LinkUserDataToTemplateCmd.java index e322de00bb1b..c8c6d17d4162 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/LinkUserDataToTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/LinkUserDataToTemplateCmd.java @@ -34,7 +34,7 @@ import com.cloud.user.UserData; import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "linkUserDataToTemplate", description = "Link or unlink a userdata to a template.", responseObject = TemplateResponse.class, responseView = ResponseObject.ResponseView.Restricted, +@APICommand(name = "linkUserDataToTemplate", description = "Link or unlink a userdata to a Template.", responseObject = TemplateResponse.class, responseView = ResponseObject.ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class LinkUserDataToTemplateCmd extends BaseCmd implements AdminCmd { @@ -47,24 +47,24 @@ public class LinkUserDataToTemplateCmd extends BaseCmd implements AdminCmd { @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "the ID of the template for the virtual machine") + description = "The ID of the Template for the Instance") private Long templateId; @Parameter(name = ApiConstants.ISO_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "the ID of the ISO for the virtual machine") + description = "The ID of the ISO for the Instance") private Long isoId; @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, - description = "the ID of the userdata that has to be linked to template/ISO. If not provided existing userdata will be unlinked from the template/ISO") + description = "The ID of the userdata that has to be linked to Template/ISO. If not provided existing userdata will be unlinked from the Template/ISO") private Long userdataId; @Parameter(name = ApiConstants.USER_DATA_POLICY, type = CommandType.STRING, - description = "an optional override policy of the userdata. Possible values are - ALLOWOVERRIDE, APPEND, DENYOVERRIDE. Default policy is allowoverride") + description = "An optional override policy of the userdata. Possible values are - ALLOWOVERRIDE, APPEND, DENYOVERRIDE. Default policy is allowoverride") private String userdataPolicy; ///////////////////////////////////////////////////// @@ -96,7 +96,7 @@ public void execute() { try { result = _templateService.linkUserDataToTemplate(this); } catch (Exception e) { - throw new CloudRuntimeException(String.format("Failed to link userdata to template, due to: %s", e.getLocalizedMessage()), e); + throw new CloudRuntimeException(String.format("Failed to link userdata to Template, due to: %s", e.getLocalizedMessage()), e); } if (result != null) { TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(getResponseView(), result); @@ -109,7 +109,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to link userdata to template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to link userdata to Template"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListCniConfigurationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListCniConfigurationCmd.java new file mode 100644 index 000000000000..3a0c3f1168bc --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListCniConfigurationCmd.java @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.userdata; + +import com.cloud.user.UserData; +import com.cloud.utils.Pair; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.UserDataResponse; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.ArrayList; +import java.util.List; + +@APICommand(name = "listCniConfiguration", description = "List user data for CNI plugins", responseObject = UserDataResponse.class, entityType = {UserData.class}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.21.0", + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class ListCniConfigurationCmd extends ListUserDataCmd { + public static final Logger logger = LogManager.getLogger(ListCniConfigurationCmd.class.getName()); + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + Pair, Integer> resultList = _mgr.listUserDatas(this, true); + List responses = new ArrayList<>(); + for (UserData result : resultList.first()) { + UserDataResponse r = _responseGenerator.createUserDataResponse(result); + r.setObjectName(ApiConstants.CNI_CONFIG); + responses.add(r); + } + + ListResponse response = new ListResponse<>(); + response.setResponses(responses, resultList.second()); + response.setResponseName(getCommandName()); + setResponseObject(response); + } + + +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmd.java index 64ab3ec3d70e..693342305242 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmd.java @@ -38,7 +38,7 @@ public class ListUserDataCmd extends BaseListProjectAndAccountResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the Userdata") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "The ID of the Userdata") private Long id; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Userdata name to look for") @@ -61,7 +61,7 @@ public String getName() { @Override public void execute() { - Pair, Integer> resultList = _mgr.listUserDatas(this); + Pair, Integer> resultList = _mgr.listUserDatas(this, false); List responses = new ArrayList<>(); for (UserData result : resultList.first()) { UserDataResponse r = _responseGenerator.createUserDataResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterCniConfigurationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterCniConfigurationCmd.java new file mode 100644 index 000000000000..3f1de41eab89 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterCniConfigurationCmd.java @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.userdata; + +import com.cloud.user.UserData; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.UserDataResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@APICommand(name = "registerCniConfiguration", + description = "Register a CNI Configuration to be used with CKS cluster", + since = "4.21.0", + responseObject = SuccessResponse.class, + requestHasSensitiveInfo = false, + responseHasSensitiveInfo = false, + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class RegisterCniConfigurationCmd extends BaseRegisterUserDataCmd { + public static final Logger logger = LogManager.getLogger(RegisterCniConfigurationCmd.class.getName()); + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.CNI_CONFIG, type = CommandType.STRING, description = "CNI Configuration content to be registered as User data", length = 1048576) + private String cniConfig; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getCniConfig() { + return cniConfig; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() { + UserData result = _mgr.registerCniConfiguration(this); + UserDataResponse response = _responseGenerator.createUserDataResponse(result); + response.setResponseName(getCommandName()); + response.setObjectName(ApiConstants.CNI_CONFIG); + setResponseObject(response); + } + + @Override + public long getEntityOwnerId() { + Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true); + if (accountId == null) { + return CallContext.current().getCallingAccount().getId(); + } + + return accountId; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmd.java index 41d865d678c8..d99f2fd066d6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmd.java @@ -16,122 +16,61 @@ // under the License. package org.apache.cloudstack.api.command.user.userdata; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.UserDataResponse; import org.apache.cloudstack.context.CallContext; -import org.apache.commons.lang3.StringUtils; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.NetworkModel; import com.cloud.user.UserData; @APICommand(name = "registerUserData", - description = "Register a new userdata.", + description = "Register a new User Data.", since = "4.18", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) -public class RegisterUserDataCmd extends BaseCmd { +public class RegisterUserDataCmd extends BaseRegisterUserDataCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Name of the userdata") - private String name; - - //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the userdata. Must be used with domainId.") - private String accountName; - - @Parameter(name = ApiConstants.DOMAIN_ID, - type = CommandType.UUID, - entityType = DomainResponse.class, - description = "an optional domainId for the userdata. If the account parameter is used, domainId must also be used.") - private Long domainId; - - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the userdata") - private Long projectId; - @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, required = true, - description = "Base64 encoded userdata content. " + + description = "Base64 encoded User Data content. " + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + - "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + - "You also need to change vm.userdata.max.length value", + "Using HTTP POST (via POST body), you can send up to 32KB of data after base64 encoding, " + + "which can be increased upto 1MB using the vm.userdata.max.length setting", length = 1048576) - private String userData; - - @Parameter(name = ApiConstants.PARAMS, type = CommandType.STRING, description = "comma separated list of variables declared in userdata content") - private String params; - + protected String userData; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - public String getName() { - return name; - } - - public String getAccountName() { - return accountName; - } - - public Long getDomainId() { - return domainId; - } - - public Long getProjectId() { - return projectId; - } - public String getUserData() { return userData; } - public String getParams() { - checkForVRMetadataFileNames(params); - return params; - } - - public void checkForVRMetadataFileNames(String params) { - if (StringUtils.isNotEmpty(params)) { - List keyValuePairs = new ArrayList<>(Arrays.asList(params.split(","))); - keyValuePairs.retainAll(NetworkModel.metadataFileNames); - if (!keyValuePairs.isEmpty()) { - throw new InvalidParameterValueException(String.format("Params passed here have a few virtual router metadata file names %s", keyValuePairs)); - } - } - } - ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java index e76a75ae398a..6274e7e14963 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java @@ -50,7 +50,7 @@ public class AddIpToVmNicCmd extends BaseAsyncCreateCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "the ID of the nic to which you want to assign private IP") + @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "The ID of the NIC to which you want to assign private IP") private Long nicId; @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = false, description = "Secondary IP Address") @@ -67,7 +67,7 @@ public String getEntityTable() { private long getNetworkId() { Nic nic = _entityMgr.findById(Nic.class, nicId); if (nic == null) { - throw new InvalidParameterValueException("Can't find network id for specified nic"); + throw new InvalidParameterValueException("Can't find Network ID for specified NIC"); } return nic.getNetworkId(); } @@ -89,7 +89,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "associating ip to nic id=" + this._uuidMgr.getUuid(Nic.class, getNicId()) + " belonging to network id=" + this._uuidMgr.getUuid(Network.class, getNetworkId()); + return "Associating secondary IP address to NIC with ID: " + getResourceUuid(ApiConstants.NIC_ID) + " belonging to Network with ID: " + this._uuidMgr.getUuid(Network.class, getNetworkId()); } ///////////////////////////////////////////////////// @@ -108,23 +108,23 @@ public static String getResultObjectName() { @Override public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException { - CallContext.current().setEventDetails("Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); + CallContext.current().setEventDetails("Nic ID: " + getResourceUuid(ApiConstants.NIC_ID)); NicSecondaryIp result = _entityMgr.findById(NicSecondaryIp.class, getEntityId()); if (result != null) { - CallContext.current().setEventDetails("secondary Ip Id: " + getEntityUuid()); + CallContext.current().setEventDetails("Secondary IP address ID: " + getEntityUuid()); boolean success = false; success = _networkService.configureNicSecondaryIp(result, isZoneSGEnabled()); if (success == false) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set security group rules for the secondary ip"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set security group rules for the secondary IP"); } NicSecondaryIpResponse response = _responseGenerator.createSecondaryIPToNicResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary IP to NIC"); } } @@ -142,7 +142,7 @@ public ApiCommandResourceType getApiResourceType() { public long getEntityOwnerId() { Nic nic = _entityMgr.findById(Nic.class, nicId); if (nic == null) { - throw new InvalidParameterValueException("Can't find nic for id specified"); + throw new InvalidParameterValueException("Can't find NIC for id specified"); } long vmId = nic.getInstanceId(); VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, vmId); @@ -166,11 +166,11 @@ public void create() throws ResourceAllocationException { setEntityUuid(result.getUuid()); } } catch (InsufficientAddressCapacityException e) { - throw new InvalidParameterValueException("Allocating guest ip for nic failed : " + e.getMessage()); + throw new InvalidParameterValueException("Allocating guest IP for NIC failed : " + e.getMessage()); } if (result == null) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary IP to NIC"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java index ecd066d98cd5..f6ef955956f6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java @@ -40,14 +40,13 @@ import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; -import com.cloud.network.Network; import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.utils.net.Dhcp; import com.cloud.utils.net.NetUtils; import com.cloud.vm.VirtualMachine; -@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "addNicToVirtualMachine", description = "Adds Instance to specified Network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class AddNicToVMCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "addnictovirtualmachineresponse"; @@ -57,19 +56,19 @@ public class AddNicToVMCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="Virtual Machine ID") + required=true, description = "Instance ID") private Long vmId; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "Network ID") private Long netId; - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "IP Address for the new network") + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "IP Address for the new Network") private String ipaddr; - @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "Mac Address for the new network") + @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "Mac Address for the new Network") private String macaddr; - @Parameter(name = ApiConstants.DHCP_OPTIONS, type = CommandType.MAP, description = "DHCP options which are passed to the nic" + @Parameter(name = ApiConstants.DHCP_OPTIONS, type = CommandType.MAP, description = "DHCP options which are passed to the NIC" + " Example: dhcpoptions[0].dhcp:114=url&dhcpoptions[0].dhcp:66=www.test.com") private Map dhcpOptions; @@ -101,6 +100,26 @@ public String getMacAddress() { return NetUtils.standardizeMacAddress(macaddr); } + public void setVmId(Long vmId) { + this.vmId = vmId; + } + + public void setNetworkId(Long netId) { + this.netId = netId; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + public void setMacAddress(String macaddr) { + this.macaddr = macaddr; + } + + public void setDhcpOptions(Map dhcpOptions) { + this.dhcpOptions = dhcpOptions; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -121,7 +140,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Adding network " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " to user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()); + return "Adding NIC on Network " + getResourceUuid(ApiConstants.NETWORK_ID) + " to User Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -167,7 +186,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " Network ID: " + getResourceUuid(ApiConstants.NETWORK_ID)); UserVm result = _userVmService.addNicToVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); @@ -177,7 +196,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to vm. Refer to server logs for details."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to Instance. Refer to server logs for details."); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/BaseDeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/BaseDeployVMCmd.java new file mode 100644 index 000000000000..68b0821ba44d --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/BaseDeployVMCmd.java @@ -0,0 +1,851 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.vm; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Nonnull; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.affinity.AffinityGroupResponse; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.ApiArgValidator; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy; +import org.apache.cloudstack.api.BaseAsyncCreateCustomIdCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.user.UserCmd; +import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.UserDataResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.vm.lease.VMLeaseManager; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; + +import com.cloud.agent.api.LogLevel; +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network; +import com.cloud.network.Network.IpAddresses; +import com.cloud.offering.DiskOffering; +import com.cloud.template.VirtualMachineTemplate; +import com.cloud.utils.net.Dhcp; +import com.cloud.utils.net.NetUtils; +import com.cloud.vm.VmDetailConstants; +import com.cloud.vm.VmDiskInfo; + +public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityGroupAction, UserCmd { + + private static final String s_name = "deployvirtualmachineresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "availability zone for the virtual machine") + protected Long zoneId; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine", validations = {ApiArgValidator.RFCComplianceDomainName}) + protected String name; + + @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "an optional user generated name for the virtual machine") + protected String displayName; + + @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="The password of the virtual machine. If null, a random password will be generated for the VM.", + since="4.19.0.0") + protected String password; + + //Owner information + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the virtual machine. Must be used with domainId.") + protected String accountName; + + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used. If account is NOT provided then virtual machine will be assigned to the caller account and domain.") + protected Long domainId; + + //Network information + //@ACL(accessType = AccessType.UseEntry) + @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, description = "list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter") + protected List networkIds; + + @Parameter(name = ApiConstants.BOOT_TYPE, type = CommandType.STRING, required = false, description = "Guest VM Boot option either custom[UEFI] or default boot [BIOS]. Not applicable with VMware if the template is marked as deploy-as-is, as we honour what is defined in the template.", since = "4.14.0.0") + protected String bootType; + + @Parameter(name = ApiConstants.BOOT_MODE, type = CommandType.STRING, required = false, description = "Boot Mode [Legacy] or [Secure] Applicable when Boot Type Selected is UEFI, otherwise Legacy only for BIOS. Not applicable with VMware if the template is marked as deploy-as-is, as we honour what is defined in the template.", since = "4.14.0.0") + protected String bootMode; + + @Parameter(name = ApiConstants.BOOT_INTO_SETUP, type = CommandType.BOOLEAN, required = false, description = "Boot into hardware setup or not (ignored if startVm = false, only valid for vmware)", since = "4.15.0.0") + private Boolean bootIntoSetup; + + //DataDisk information + @ACL + @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine. If the template is of ISO format," + + " the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the " + + "offering for the data disk volume. If the templateId parameter passed is from a Template object," + + " the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is " + + "from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.") + private Long diskOfferingId; + + @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId") + private Long size; + + @Parameter(name = ApiConstants.ROOT_DISK_SIZE, + type = CommandType.LONG, + description = "Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided", + since = "4.4") + private Long rootdisksize; + + @Parameter(name = ApiConstants.DATADISKS_DETAILS, + type = CommandType.MAP, + since = "4.21.0", + description = "Disk offering details for creating multiple data volumes. Mutually exclusive with diskOfferingId." + + " Example: datadisksdetails[0].diskofferingid=a2a73a84-19db-4852-8930-dfddef053341&datadisksdetails[0].size=10&datadisksdetails[0].miniops=100&datadisksdetails[0].maxiops=200") + private Map dataDisksDetails; + + @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "an optional group for the virtual machine") + private String group; + + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor on which to deploy the virtual machine. " + + "The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call") + protected String hypervisor; + + @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, + description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + "This binary data must be base64 encoded before adding it to the request. " + + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + + "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + + "You also need to change vm.userdata.max.length value", + length = 1048576) + protected String userData; + + @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the Userdata", since = "4.18") + protected Long userdataId; + + @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.", since = "4.18") + private Map userdataDetails; + + @Deprecated + @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, description = "name of the ssh key pair used to login to the virtual machine") + private String sshKeyPairName; + + @Parameter(name = ApiConstants.SSH_KEYPAIRS, type = CommandType.LIST, collectionType = CommandType.STRING, since="4.17", description = "names of the ssh key pairs used to login to the virtual machine") + protected List sshKeyPairNames; + + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "destination Host ID to deploy the VM to - parameter available for root admin only") + private Long hostId; + + @ACL + @Parameter(name = ApiConstants.SECURITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups id that going to be applied to the virtual machine. " + + "Should be passed only when vm is created from a zone with Basic Network support." + " Mutually exclusive with securitygroupnames parameter") + protected List securityGroupIdList; + + @ACL + @Parameter(name = ApiConstants.SECURITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups names that going to be applied to the virtual machine." + + " Should be passed only when vm is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter") + private List securityGroupNameList; + + @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter." + + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid&iptonetworklist[0].mac=aa:bb:cc:dd:ee::ff - requests to use ip 10.10.10.11 in network id=uuid") + private Map ipToNetworkList; + + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "the ip address for default vm's network") + private String ipAddress; + + @Parameter(name = ApiConstants.IP6_ADDRESS, type = CommandType.STRING, description = "the ipv6 address for default vm's network") + private String ip6Address; + + @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network") + private String macAddress; + + @Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,es-latam,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us") + protected String keyboard; + + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project") + protected Long projectId; + + @Parameter(name = ApiConstants.START_VM, type = CommandType.BOOLEAN, description = "true if start vm after creating; defaulted to true if not specified") + private Boolean startVm; + + @ACL + @Parameter(name = ApiConstants.AFFINITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups id that are going to be applied to the virtual machine." + + " Mutually exclusive with affinitygroupnames parameter") + protected List affinityGroupIdList; + + @ACL + @Parameter(name = ApiConstants.AFFINITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups names that are going to be applied to the virtual machine." + + "Mutually exclusive with affinitygroupids parameter") + private List affinityGroupNameList; + + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, since = "4.2", description = "an optional field, whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) + protected Boolean displayVm; + + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters. 'extraconfig' is not allowed to be passed in details") + protected Map details; + + @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin }) + private String deploymentPlanner; + + @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the VM on start up" + + " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com") + private Map dhcpOptionsNetworkList; + + @Parameter(name = ApiConstants.DATADISK_OFFERING_LIST, type = CommandType.MAP, since = "4.11", description = "datadisk template to disk-offering mapping;" + + " an optional parameter used to create additional data disks from datadisk templates; can't be specified with diskOfferingId parameter") + private Map dataDiskTemplateToDiskOfferingList; + + @Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120) + protected String extraConfig; + + @Parameter(name = ApiConstants.COPY_IMAGE_TAGS, type = CommandType.BOOLEAN, since = "4.13", description = "if true the image tags (if any) will be copied to the VM, default value is false") + private Boolean copyImageTags; + + @Parameter(name = ApiConstants.PROPERTIES, type = CommandType.MAP, since = "4.15", + description = "used to specify the vApp properties.") + @LogLevel(LogLevel.Log4jLevel.Off) + private Map vAppProperties; + + @Parameter(name = ApiConstants.NIC_NETWORK_LIST, type = CommandType.MAP, since = "4.15", + description = "VMware only: used to specify network mapping of a vApp VMware template registered \"as-is\"." + + " Example nicnetworklist[0].ip=Nic-101&nicnetworklist[0].network=uuid") + @LogLevel(LogLevel.Log4jLevel.Off) + private Map vAppNetworks; + + @Parameter(name = ApiConstants.DYNAMIC_SCALING_ENABLED, type = CommandType.BOOLEAN, since = "4.16", + description = "true if virtual machine needs to be dynamically scalable") + protected Boolean dynamicScalingEnabled; + + @Parameter(name = ApiConstants.OVERRIDE_DISK_OFFERING_ID, type = CommandType.UUID, since = "4.17", entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine to be used for root volume instead of the disk offering mapped in service offering." + + "In case of virtual machine deploying from ISO, then the diskofferingid specified for root volume is ignored and uses this override disk offering id") + private Long overrideDiskOfferingId; + + @Parameter(name = ApiConstants.IOTHREADS_ENABLED, type = CommandType.BOOLEAN, required = false, + description = "IOThreads are dedicated event loop threads for supported disk devices to perform block I/O requests in order to improve scalability especially on an SMP host/guest with many LUNs.") + private Boolean iothreadsEnabled; + + @Parameter(name = ApiConstants.IO_DRIVER_POLICY, type = CommandType.STRING, description = "Controls specific policies on IO") + private String ioDriverPolicy; + + @Parameter(name = ApiConstants.NIC_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "4.18", + description = "The number of queues for multiqueue NICs.") + private Integer nicMultiqueueNumber; + + @Parameter(name = ApiConstants.NIC_PACKED_VIRTQUEUES_ENABLED, type = CommandType.BOOLEAN, since = "4.18", + description = "Enable packed virtqueues or not.") + private Boolean nicPackedVirtQueues; + + @Parameter(name = ApiConstants.INSTANCE_LEASE_DURATION, type = CommandType.INTEGER, since = "4.21.0", + description = "Number of days instance is leased for.") + private Integer leaseDuration; + + @Parameter(name = ApiConstants.INSTANCE_LEASE_EXPIRY_ACTION, type = CommandType.STRING, since = "4.21.0", + description = "Lease expiry action, valid values are STOP and DESTROY") + private String leaseExpiryAction; + + @Parameter(name = ApiConstants.EXTERNAL_DETAILS, + type = CommandType.MAP, + description = "Details in key/value pairs using format externaldetails[i].keyname=keyvalue. Example: externaldetails[0].server.type=typevalue", + since = "4.21.0") + protected Map externalDetails; + + private List dataDiskInfoList; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + public String getAccountName() { + if (accountName == null) { + return CallContext.current().getCallingAccount().getAccountName(); + } + return accountName; + } + + public Long getDiskOfferingId() { + return diskOfferingId; + } + + public String getDeploymentPlanner() { + return deploymentPlanner; + } + + public String getDisplayName() { + return displayName; + } + + public Long getDomainId() { + if (domainId == null) { + return CallContext.current().getCallingAccount().getDomainId(); + } + return domainId; + } + + public ApiConstants.BootType getBootType() { + if (StringUtils.isNotBlank(bootType)) { + try { + String type = bootType.trim().toUpperCase(); + return ApiConstants.BootType.valueOf(type); + } catch (IllegalArgumentException e) { + String errMesg = "Invalid bootType " + bootType + "Specified for vm " + getName() + + " Valid values are: " + Arrays.toString(ApiConstants.BootType.values()); + logger.warn(errMesg); + throw new InvalidParameterValueException(errMesg); + } + } + return null; + } + + public Map getDetails() { + Map customparameterMap = convertDetailsToMap(details); + + if (getBootType() != null) { + customparameterMap.put(getBootType().toString(), getBootMode().toString()); + } + + if (rootdisksize != null && !customparameterMap.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { + customparameterMap.put(VmDetailConstants.ROOT_DISK_SIZE, rootdisksize.toString()); + } + + IoDriverPolicy ioPolicy = getIoDriverPolicy(); + if (ioPolicy != null) { + customparameterMap.put(VmDetailConstants.IO_POLICY, ioPolicy.toString()); + } + + if (BooleanUtils.toBoolean(iothreadsEnabled)) { + customparameterMap.put(VmDetailConstants.IOTHREADS, BooleanUtils.toStringTrueFalse(iothreadsEnabled)); + } + + if (nicMultiqueueNumber != null) { + customparameterMap.put(VmDetailConstants.NIC_MULTIQUEUE_NUMBER, nicMultiqueueNumber.toString()); + } + + if (BooleanUtils.toBoolean(nicPackedVirtQueues)) { + customparameterMap.put(VmDetailConstants.NIC_PACKED_VIRTQUEUES_ENABLED, BooleanUtils.toStringTrueFalse(nicPackedVirtQueues)); + } + + if (MapUtils.isNotEmpty(externalDetails)) { + customparameterMap.putAll(getExternalDetails()); + } + return customparameterMap; + } + + public Map getExternalDetails() { + return convertExternalDetailsToMap(externalDetails); + } + + public ApiConstants.BootMode getBootMode() { + if (StringUtils.isNotBlank(bootMode)) { + try { + String mode = bootMode.trim().toUpperCase(); + return ApiConstants.BootMode.valueOf(mode); + } catch (IllegalArgumentException e) { + String msg = String.format("Invalid %s: %s specified for VM: %s. Valid values are: %s", + ApiConstants.BOOT_MODE, bootMode, getName(), Arrays.toString(ApiConstants.BootMode.values())); + logger.error(msg); + throw new InvalidParameterValueException(msg); + } + } + if (ApiConstants.BootType.UEFI.equals(getBootType())) { + String msg = String.format("%s must be specified for the VM with boot type: %s. Valid values are: %s", + ApiConstants.BOOT_MODE, getBootType(), Arrays.toString(ApiConstants.BootMode.values())); + logger.error(msg); + throw new InvalidParameterValueException(msg); + } + return null; + } + + public Map getVmProperties() { + Map map = new HashMap<>(); + if (MapUtils.isNotEmpty(vAppProperties)) { + Collection parameterCollection = vAppProperties.values(); + Iterator iterator = parameterCollection.iterator(); + while (iterator.hasNext()) { + HashMap entry = (HashMap)iterator.next(); + map.put(entry.get("key"), entry.get("value")); + } + } + return map; + } + + public Map getVmNetworkMap() { + Map map = new HashMap<>(); + if (MapUtils.isNotEmpty(vAppNetworks)) { + Collection parameterCollection = vAppNetworks.values(); + Iterator iterator = parameterCollection.iterator(); + while (iterator.hasNext()) { + HashMap entry = (HashMap) iterator.next(); + Integer nic; + try { + nic = Integer.valueOf(entry.get(VmDetailConstants.NIC)); + } catch (NumberFormatException nfe) { + nic = null; + } + String networkUuid = entry.get(VmDetailConstants.NETWORK); + logger.trace("Checking if NIC '{}' can be mapped on network '{}'", nic, networkUuid); + if (nic == null || StringUtils.isEmpty(networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) { + throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic)); + } + map.put(nic, _entityMgr.findByUuid(Network.class, networkUuid).getId()); + } + } + return map; + } + + public String getGroup() { + return group; + } + + public HypervisorType getHypervisor() { + return HypervisorType.getType(hypervisor); + } + + public Boolean isDisplayVm() { + return displayVm; + } + + @Override + public boolean isDisplay() { + if(displayVm == null) + return true; + else + return displayVm; + } + + public List getSecurityGroupNameList() { + return securityGroupNameList; + } + + public List getSecurityGroupIdList() { + return securityGroupIdList; + } + + public Long getSize() { + return size; + } + + public String getUserData() { + return userData; + } + + public Long getUserdataId() { + return userdataId; + } + + public Map getUserdataDetails() { + return convertDetailsToMap(userdataDetails); + } + + public Long getZoneId() { + return zoneId; + } + + public String getPassword() { + return password; + } + + public Integer getLeaseDuration() { + return leaseDuration; + } + + public VMLeaseManager.ExpiryAction getLeaseExpiryAction() { + if (StringUtils.isBlank(leaseExpiryAction)) { + return null; + } + VMLeaseManager.ExpiryAction action = EnumUtils.getEnumIgnoreCase(VMLeaseManager.ExpiryAction.class, leaseExpiryAction); + if (action == null) { + throw new InvalidParameterValueException("Invalid value configured for leaseexpiryaction, valid values are: " + + com.cloud.utils.EnumUtils.listValues(VMLeaseManager.ExpiryAction.values())); + } + return action; + } + + public List getNetworkIds() { + if (MapUtils.isNotEmpty(vAppNetworks)) { + if (CollectionUtils.isNotEmpty(networkIds) || ipAddress != null || getIp6Address() != null || MapUtils.isNotEmpty(ipToNetworkList)) { + throw new InvalidParameterValueException(String.format("%s can't be specified along with %s, %s, %s", ApiConstants.NIC_NETWORK_LIST, ApiConstants.NETWORK_IDS, ApiConstants.IP_ADDRESS, ApiConstants.IP_NETWORK_LIST)); + } else { + return new ArrayList<>(); + } + } + if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) { + if ((networkIds != null && !networkIds.isEmpty()) || ipAddress != null || getIp6Address() != null) { + throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress"); + } else { + List networks = new ArrayList(); + networks.addAll(getIpToNetworkMap().keySet()); + return networks; + } + } + return networkIds; + } + + public String getName() { + return name; + } + + public List getSSHKeyPairNames() { + List sshKeyPairs = new ArrayList(); + if(sshKeyPairNames != null) { + sshKeyPairs = sshKeyPairNames; + } + if(sshKeyPairName != null && !sshKeyPairName.isEmpty()) { + sshKeyPairs.add(sshKeyPairName); + } + return sshKeyPairs; + } + + public List getDataDiskInfoList() { + if (this.dataDiskInfoList != null) { + return this.dataDiskInfoList; + } + if (dataDisksDetails == null || dataDisksDetails.isEmpty()) { + return null; + } + if (dataDiskTemplateToDiskOfferingList != null) { + throw new InvalidParameterValueException("datadisktemplatetodiskofferinglist parameter can't be specified along with datadisksdetails parameter"); + } + List vmDiskInfoList = new ArrayList<>(); + Collection dataDisksCollection = dataDisksDetails.values(); + Iterator iter = dataDisksCollection.iterator(); + while (iter.hasNext()) { + HashMap dataDisk = (HashMap)iter.next(); + String diskOfferingUuid = dataDisk.get(ApiConstants.DISK_OFFERING_ID); + if (diskOfferingUuid == null) { + throw new InvalidParameterValueException("diskofferingid parameter is required for datadiskdetails"); + } + DiskOffering diskOffering = _entityMgr.findByUuid(DiskOffering.class, diskOfferingUuid); + if (diskOffering == null) { + throw new InvalidParameterValueException("Unable to find disk offering " + diskOfferingUuid); + } + if (diskOffering.isComputeOnly()) { + throw new InvalidParameterValueException(String.format("The disk offering id %d provided is directly mapped to a service offering, please provide an individual disk offering", diskOffering.getUuid())); + } + + Long size = null; + Long minIops = null; + Long maxIops = null; + if (dataDisk.get(ApiConstants.DEVICE_ID) == null) { + throw new InvalidParameterValueException("deviceid parameter is required for datadiskdetails"); + } + Long deviceId = Long.parseLong(dataDisk.get(ApiConstants.DEVICE_ID)); + if (diskOffering.isCustomized()) { + if (dataDisk.get(ApiConstants.SIZE) == null) { + throw new InvalidParameterValueException("Size is required for custom disk offering"); + } + size = Long.parseLong(dataDisk.get(ApiConstants.SIZE)); + } else { + size = diskOffering.getDiskSize() / (1024 * 1024 * 1024); + } + if (diskOffering.isCustomizedIops() != null && diskOffering.isCustomizedIops()) { + if (dataDisk.get(ApiConstants.MIN_IOPS) == null) { + throw new InvalidParameterValueException("Min IOPS is required for custom disk offering"); + } + if (dataDisk.get(ApiConstants.MAX_IOPS) == null) { + throw new InvalidParameterValueException("Max IOPS is required for custom disk offering"); + } + minIops = Long.parseLong(dataDisk.get(ApiConstants.MIN_IOPS)); + maxIops = Long.parseLong(dataDisk.get(ApiConstants.MAX_IOPS)); + } + VmDiskInfo vmDiskInfo = new VmDiskInfo(diskOffering, size, minIops, maxIops, deviceId); + vmDiskInfoList.add(vmDiskInfo); + } + this.dataDiskInfoList = vmDiskInfoList; + return dataDiskInfoList; + } + + public Long getHostId() { + return hostId; + } + + public boolean getStartVm() { + return startVm == null ? true : startVm; + } + + public Map getIpToNetworkMap() { + if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) { + throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter"); + } + LinkedHashMap ipToNetworkMap = null; + if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) { + ipToNetworkMap = new LinkedHashMap(); + Collection ipsCollection = ipToNetworkList.values(); + Iterator iter = ipsCollection.iterator(); + while (iter.hasNext()) { + HashMap ips = (HashMap)iter.next(); + Long networkId = getNetworkIdFomIpMap(ips); + IpAddresses addrs = getIpAddressesFromIpMap(ips); + ipToNetworkMap.put(networkId, addrs); + } + } + + return ipToNetworkMap; + } + + @Nonnull + private IpAddresses getIpAddressesFromIpMap(HashMap ips) { + String requestedIp = ips.get("ip"); + String requestedIpv6 = ips.get("ipv6"); + String requestedMac = ips.get("mac"); + if (requestedIpv6 != null) { + requestedIpv6 = NetUtils.standardizeIp6Address(requestedIpv6); + } + if (requestedMac != null) { + if(!NetUtils.isValidMac(requestedMac)) { + throw new InvalidParameterValueException("Mac address is not valid: " + requestedMac); + } else if(!NetUtils.isUnicastMac(requestedMac)) { + throw new InvalidParameterValueException("Mac address is not unicast: " + requestedMac); + } + requestedMac = NetUtils.standardizeMacAddress(requestedMac); + } + return new IpAddresses(requestedIp, requestedIpv6, requestedMac); + } + + @Nonnull + private Long getNetworkIdFomIpMap(HashMap ips) { + Long networkId; + final String networkid = ips.get("networkid"); + Network network = _networkService.getNetwork(networkid); + if (network != null) { + networkId = network.getId(); + } else { + try { + networkId = Long.parseLong(networkid); + } catch (NumberFormatException e) { + throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + networkid); + } + } + return networkId; + } + + public String getIpAddress() { + return ipAddress; + } + + public String getIp6Address() { + if (ip6Address == null) { + return null; + } + return NetUtils.standardizeIp6Address(ip6Address); + } + + + public String getMacAddress() { + if (macAddress == null) { + return null; + } + if(!NetUtils.isValidMac(macAddress)) { + throw new InvalidParameterValueException("Mac address is not valid: " + macAddress); + } else if(!NetUtils.isUnicastMac(macAddress)) { + throw new InvalidParameterValueException("Mac address is not unicast: " + macAddress); + } + return NetUtils.standardizeMacAddress(macAddress); + } + + public List getAffinityGroupIdList() { + if (affinityGroupNameList != null && affinityGroupIdList != null) { + throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter"); + } + + // transform group names to ids here + if (affinityGroupNameList != null) { + List affinityGroupIds = new ArrayList(); + for (String groupName : affinityGroupNameList) { + Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId()); + if (groupId == null) { + throw new InvalidParameterValueException("Unable to find affinity group by name " + groupName); + } else { + affinityGroupIds.add(groupId); + } + } + return affinityGroupIds; + } else { + return affinityGroupIdList; + } + } + + public String getKeyboard() { + // TODO Auto-generated method stub + return keyboard; + } + + public Map> getDhcpOptionsMap() { + Map> dhcpOptionsMap = new HashMap<>(); + if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) { + + Collection> paramsCollection = this.dhcpOptionsNetworkList.values(); + for (Map dhcpNetworkOptions : paramsCollection) { + String networkId = dhcpNetworkOptions.get(ApiConstants.NETWORK_ID); + + if (networkId == null) { + throw new IllegalArgumentException("No networkid specified when providing extra dhcp options."); + } + + Map dhcpOptionsForNetwork = new HashMap<>(); + dhcpOptionsMap.put(networkId, dhcpOptionsForNetwork); + + for (String key : dhcpNetworkOptions.keySet()) { + if (key.startsWith(ApiConstants.DHCP_PREFIX)) { + int dhcpOptionValue = Integer.parseInt(key.replaceFirst(ApiConstants.DHCP_PREFIX, "")); + dhcpOptionsForNetwork.put(dhcpOptionValue, dhcpNetworkOptions.get(key)); + } else if (!key.equals(ApiConstants.NETWORK_ID)) { + Dhcp.DhcpOptionCode dhcpOptionEnum = Dhcp.DhcpOptionCode.valueOfString(key); + dhcpOptionsForNetwork.put(dhcpOptionEnum.getCode(), dhcpNetworkOptions.get(key)); + } + } + + } + } + + return dhcpOptionsMap; + } + + public Map getDataDiskTemplateToDiskOfferingMap() { + if (diskOfferingId != null && dataDiskTemplateToDiskOfferingList != null) { + throw new InvalidParameterValueException("diskofferingid parameter can't be specified along with datadisktemplatetodiskofferinglist parameter"); + } + if (MapUtils.isEmpty(dataDiskTemplateToDiskOfferingList)) { + return new HashMap(); + } + + HashMap dataDiskTemplateToDiskOfferingMap = new HashMap(); + for (Object objDataDiskTemplates : dataDiskTemplateToDiskOfferingList.values()) { + HashMap dataDiskTemplates = (HashMap) objDataDiskTemplates; + Long dataDiskTemplateId; + DiskOffering dataDiskOffering = null; + VirtualMachineTemplate dataDiskTemplate= _entityMgr.findByUuid(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid")); + if (dataDiskTemplate == null) { + dataDiskTemplate = _entityMgr.findById(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid")); + if (dataDiskTemplate == null) + throw new InvalidParameterValueException("Unable to translate and find entity with datadisktemplateid " + dataDiskTemplates.get("datadisktemplateid")); + } + dataDiskTemplateId = dataDiskTemplate.getId(); + dataDiskOffering = _entityMgr.findByUuid(DiskOffering.class, dataDiskTemplates.get("diskofferingid")); + if (dataDiskOffering == null) { + dataDiskOffering = _entityMgr.findById(DiskOffering.class, dataDiskTemplates.get("diskofferingid")); + if (dataDiskOffering == null) + throw new InvalidParameterValueException("Unable to translate and find entity with diskofferingId " + dataDiskTemplates.get("diskofferingid")); + } + dataDiskTemplateToDiskOfferingMap.put(dataDiskTemplateId, dataDiskOffering); + } + return dataDiskTemplateToDiskOfferingMap; + } + + public String getExtraConfig() { + return extraConfig; + } + + public boolean getCopyImageTags() { + return copyImageTags == null ? false : copyImageTags; + } + + public Boolean getBootIntoSetup() { + return bootIntoSetup; + } + + public boolean isDynamicScalingEnabled() { + return dynamicScalingEnabled == null ? true : dynamicScalingEnabled; + } + + public Long getOverrideDiskOfferingId() { + return overrideDiskOfferingId; + } + + public IoDriverPolicy getIoDriverPolicy() { + if (StringUtils.isNotBlank(ioDriverPolicy)) { + try { + String policyType = ioDriverPolicy.trim().toUpperCase(); + return IoDriverPolicy.valueOf(policyType); + } catch (IllegalArgumentException e) { + String errMesg = String.format("Invalid io policy %s specified for vm %s. Valid values are: %s", ioDriverPolicy, getName(), Arrays.toString(IoDriverPolicy.values())); + logger.warn(errMesg); + throw new InvalidParameterValueException(errMesg); + } + } + return null; + } + + public String getInstanceType() { + return null; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + public static String getResultObjectName() { + return "virtualmachine"; + } + + @Override + public long getEntityOwnerId() { + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); + if (accountId == null) { + return CallContext.current().getCallingAccount().getId(); + } + + return accountId; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_CREATE; + } + + @Override + public String getCreateEventType() { + return EventTypes.EVENT_VM_CREATE; + } + + @Override + public String getCreateEventDescription() { + return "Creating Instance"; + } + + @Override + public String getEventDescription() { + if(getStartVm()) { + return "Starting Instance with ID: " + getEntityUuid(); + } + return "Deploying Instance with ID: " + getEntityUuid(); + } + + @Override + public ApiCommandResourceType getApiResourceType() { + return ApiCommandResourceType.VirtualMachine; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMFromBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMFromBackupCmd.java new file mode 100644 index 000000000000..a719062e1bca --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMFromBackupCmd.java @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.vm; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.BackupResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.UserVmResponse; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InsufficientServerCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.uservm.UserVm; +import com.cloud.vm.VirtualMachine; + +@APICommand(name = "createVMFromBackup", + description = "Creates and automatically starts a VM from a backup.", + responseObject = UserVmResponse.class, + responseView = ResponseObject.ResponseView.Restricted, + entityType = {VirtualMachine.class}, + requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, + since = "4.21.0", + authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) +public class CreateVMFromBackupCmd extends BaseDeployVMCmd { + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @ACL + @Parameter(name = ApiConstants.BACKUP_ID, + type = CommandType.UUID, + entityType = BackupResponse.class, + required = true, + description = "backup ID to create the VM from") + private Long backupId; + + @ACL + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "the ID of the service offering for the virtual machine") + private Long serviceOfferingId; + + @ACL + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the ID of the template for the virtual machine") + private Long templateId; + + @Parameter(name = ApiConstants.PRESERVE_IP, type = CommandType.BOOLEAN, description = "Use the same IP/MAC addresses as stored in the backup metadata. Works only if the original Instance is deleted and the IP/MAC address is available.") + private Boolean preserveIp; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getBackupId() { + return backupId; + } + + public Long getServiceOfferingId() { + return serviceOfferingId; + } + + public Long getTemplateId() { + return templateId; + } + + public boolean getPreserveIp() { + return (preserveIp != null) ? preserveIp : false; + } + + @Override + public void create() { + UserVm vm; + try { + vm = _userVmService.allocateVMFromBackup(this); + if (vm != null) { + setEntityId(vm.getId()); + setEntityUuid(vm.getUuid()); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm"); + } + } catch (InsufficientCapacityException ex) { + logger.info(ex); + logger.trace(ex.getMessage(), ex); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + } catch (ResourceUnavailableException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + } catch (ConcurrentOperationException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); + } catch (ResourceAllocationException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); + } + } + + @Override + public void execute () { + UserVm vm = null; + try { + vm = _userVmService.restoreVMFromBackup(this); + } catch (ResourceUnavailableException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + } catch (ResourceAllocationException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, ex.getMessage()); + } catch (ConcurrentOperationException ex) { + logger.warn("Exception: ", ex); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); + } catch (InsufficientCapacityException ex) { + StringBuilder message = new StringBuilder(ex.getMessage()); + if (ex instanceof InsufficientServerCapacityException) { + if (((InsufficientServerCapacityException)ex).isAffinityApplied()) { + message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them"); + } + } + logger.info("{}: {}", message.toString(), ex.getLocalizedMessage()); + logger.debug(message.toString(), ex); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString()); + } + + if (vm != null) { + UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", vm).get(0); + response.setResponseName(getCommandName()); + setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm uuid:"+getEntityUuid()); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMScheduleCmd.java index 5811eb1abfc5..7e9bdd942ed7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/CreateVMScheduleCmd.java @@ -32,7 +32,7 @@ import javax.inject.Inject; import java.util.Date; -@APICommand(name = "createVMSchedule", description = "Create VM Schedule", responseObject = VMScheduleResponse.class, +@APICommand(name = "createVMSchedule", description = "Create Instance Schedule", responseObject = VMScheduleResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class CreateVMScheduleCmd extends BaseCmd { @@ -44,7 +44,7 @@ public class CreateVMScheduleCmd extends BaseCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the VM for which schedule is to be defined") + description = "ID of the Instance for which schedule is to be defined") private Long vmId; @Parameter(name = ApiConstants.DESCRIPTION, @@ -56,7 +56,7 @@ public class CreateVMScheduleCmd extends BaseCmd { @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = true, - description = "Schedule for action on VM in cron format. e.g. '0 15 10 * *' for 'at 15:00 on 10th day of every month'") + description = "Schedule for action on Instance in cron format. e.g. '0 15 10 * *' for 'at 15:00 on 10th day of every month'") private String schedule; @Parameter(name = ApiConstants.TIMEZONE, @@ -68,27 +68,27 @@ public class CreateVMScheduleCmd extends BaseCmd { @Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, required = true, - description = "Action to take on the VM (start/stop/reboot/force_stop/force_reboot).") + description = "Action to take on the Instance (start/stop/reboot/force_stop/force_reboot).") private String action; @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, required = false, - description = "start date from which the schedule becomes active. Defaults to current date plus 1 minute." + description = "Start date from which the schedule becomes active. Defaults to current date plus 1 minute." + "Use format \"yyyy-MM-dd hh:mm:ss\")") private Date startDate; @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, required = false, - description = "end date after which the schedule becomes inactive" + description = "End date after which the schedule becomes inactive" + "Use format \"yyyy-MM-dd hh:mm:ss\")") private Date endDate; @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, - description = "Enable VM schedule. Defaults to true") + description = "Enable Instance schedule. Defaults to true") private Boolean enabled; ///////////////////////////////////////////////////// @@ -145,7 +145,7 @@ public void execute() { public long getEntityOwnerId() { VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, getVmId()); if (vm == null) { - throw new InvalidParameterValueException(String.format("Unable to find VM by id=%d", getVmId())); + throw new InvalidParameterValueException(String.format("Unable to find Instance by id=%d", getVmId())); } return vm.getAccountId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeleteVMScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeleteVMScheduleCmd.java index 775a902e0bb9..f34d07b045d9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeleteVMScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeleteVMScheduleCmd.java @@ -37,7 +37,7 @@ import java.util.Collections; import java.util.List; -@APICommand(name = "deleteVMSchedule", description = "Delete VM Schedule.", responseObject = SuccessResponse.class, +@APICommand(name = "deleteVMSchedule", description = "Delete Instance Schedule.", responseObject = SuccessResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class DeleteVMScheduleCmd extends BaseCmd { @@ -48,20 +48,20 @@ public class DeleteVMScheduleCmd extends BaseCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of VM") + description = "ID of Instance") private Long vmId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VMScheduleResponse.class, required = false, - description = "ID of VM schedule") + description = "ID of Instance schedule") private Long id; @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = VMScheduleResponse.class, required = false, - description = "IDs of VM schedule") + description = "IDs of Instance schedule") private List ids; ///////////////////////////////////////////////////// @@ -97,7 +97,7 @@ public void execute() { response.setObjectName(VMSchedule.class.getSimpleName().toLowerCase()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VM Schedules"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Instance Schedules"); } } @@ -105,7 +105,7 @@ public void execute() { public long getEntityOwnerId() { VirtualMachine vm = _entityMgr.findById(VirtualMachine.class, getVmId()); if (vm == null) { - throw new InvalidParameterValueException(String.format("Unable to find VM by id=%d", getVmId())); + throw new InvalidParameterValueException(String.format("Unable to find Instance by id=%d", getVmId())); } return vm.getAccountId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 52d42a95d981..0a943fab118d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -16,766 +16,190 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Stream; -import javax.annotation.Nonnull; - -import org.apache.cloudstack.acl.RoleType; -import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiArgValidator; -import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy; import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseAsyncCreateCustomIdCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.command.user.UserCmd; -import org.apache.cloudstack.api.response.DiskOfferingResponse; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.HostResponse; -import org.apache.cloudstack.api.response.NetworkResponse; -import org.apache.cloudstack.api.response.ProjectResponse; -import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.TemplateResponse; -import org.apache.cloudstack.api.response.UserDataResponse; import org.apache.cloudstack.api.response.UserVmResponse; -import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.context.CallContext; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import com.cloud.agent.api.LogLevel; -import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientServerCapacityException; -import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.Network; -import com.cloud.network.Network.IpAddresses; -import com.cloud.offering.DiskOffering; -import com.cloud.template.VirtualMachineTemplate; import com.cloud.uservm.UserVm; -import com.cloud.utils.net.Dhcp; -import com.cloud.utils.net.NetUtils; +import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VmDetailConstants; - -@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) -public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityGroupAction, UserCmd { - private static final String s_name = "deployvirtualmachineresponse"; +@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts an Instance based on a service offering, disk offering, and Template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, + requestHasSensitiveInfo = false) +public class DeployVMCmd extends BaseDeployVMCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "availability zone for the virtual machine") - private Long zoneId; - @ACL - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the ID of the service offering for the virtual machine") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "The ID of the Service offering for the Instance") private Long serviceOfferingId; @ACL - @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the template for the virtual machine") + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "The ID of the Template for the Instance") private Long templateId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine", validations = {ApiArgValidator.RFCComplianceDomainName}) - private String name; - - @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "an optional user generated name for the virtual machine") - private String displayName; - - @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="The password of the virtual machine. If null, a random password will be generated for the VM.", - since="4.19.0.0") - protected String password; - - //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the virtual machine. Must be used with domainId.") - private String accountName; - - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used. If account is NOT provided then virtual machine will be assigned to the caller account and domain.") - private Long domainId; - - //Network information - //@ACL(accessType = AccessType.UseEntry) - @Parameter(name = ApiConstants.NETWORK_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = NetworkResponse.class, description = "list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter") - private List networkIds; - - @Parameter(name = ApiConstants.BOOT_TYPE, type = CommandType.STRING, required = false, description = "Guest VM Boot option either custom[UEFI] or default boot [BIOS]. Not applicable with VMware if the template is marked as deploy-as-is, as we honour what is defined in the template.", since = "4.14.0.0") - private String bootType; - - @Parameter(name = ApiConstants.BOOT_MODE, type = CommandType.STRING, required = false, description = "Boot Mode [Legacy] or [Secure] Applicable when Boot Type Selected is UEFI, otherwise Legacy only for BIOS. Not applicable with VMware if the template is marked as deploy-as-is, as we honour what is defined in the template.", since = "4.14.0.0") - private String bootMode; - - @Parameter(name = ApiConstants.BOOT_INTO_SETUP, type = CommandType.BOOLEAN, required = false, description = "Boot into hardware setup or not (ignored if startVm = false, only valid for vmware)", since = "4.15.0.0") - private Boolean bootIntoSetup; - - //DataDisk information - @ACL - @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine. If the template is of ISO format," - + " the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the " - + "offering for the data disk volume. If the templateId parameter passed is from a Template object," - + " the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is " - + "from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.") - private Long diskOfferingId; - - @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId") - private Long size; - - @Parameter(name = ApiConstants.ROOT_DISK_SIZE, - type = CommandType.LONG, - description = "Optional field to resize root disk on deploy. Value is in GB. Only applies to template-based deployments. Analogous to details[0].rootdisksize, which takes precedence over this parameter if both are provided", - since = "4.4") - private Long rootdisksize; - - @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "an optional group for the virtual machine") - private String group; - - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor on which to deploy the virtual machine. " - + "The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call") - private String hypervisor; - - @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, - description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + - "This binary data must be base64 encoded before adding it to the request. " + - "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + - "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + - "You also need to change vm.userdata.max.length value", - length = 1048576) - private String userData; - - @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the Userdata", since = "4.18") - private Long userdataId; - - @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.", since = "4.18") - private Map userdataDetails; - - @Deprecated - @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, description = "name of the ssh key pair used to login to the virtual machine") - private String sshKeyPairName; - - @Parameter(name = ApiConstants.SSH_KEYPAIRS, type = CommandType.LIST, collectionType = CommandType.STRING, since="4.17", description = "names of the ssh key pairs used to login to the virtual machine") - private List sshKeyPairNames; - - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "destination Host ID to deploy the VM to - parameter available for root admin only") - private Long hostId; - - @ACL - @Parameter(name = ApiConstants.SECURITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups id that going to be applied to the virtual machine. " - + "Should be passed only when vm is created from a zone with Basic Network support." + " Mutually exclusive with securitygroupnames parameter") - private List securityGroupIdList; - - @ACL - @Parameter(name = ApiConstants.SECURITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = SecurityGroupResponse.class, description = "comma separated list of security groups names that going to be applied to the virtual machine." - + " Should be passed only when vm is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter") - private List securityGroupNameList; - - @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter." - + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid&iptonetworklist[0].mac=aa:bb:cc:dd:ee::ff - requests to use ip 10.10.10.11 in network id=uuid") - private Map ipToNetworkList; - - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "the ip address for default vm's network") - private String ipAddress; - - @Parameter(name = ApiConstants.IP6_ADDRESS, type = CommandType.STRING, description = "the ipv6 address for default vm's network") - private String ip6Address; - - @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network") - private String macAddress; - - @Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us") - private String keyboard; + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, since = "4.21") + private Long volumeId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project") - private Long projectId; - - @Parameter(name = ApiConstants.START_VM, type = CommandType.BOOLEAN, description = "true if start vm after creating; defaulted to true if not specified") - private Boolean startVm; - - @ACL - @Parameter(name = ApiConstants.AFFINITY_GROUP_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups id that are going to be applied to the virtual machine." - + " Mutually exclusive with affinitygroupnames parameter") - private List affinityGroupIdList; - - @ACL - @Parameter(name = ApiConstants.AFFINITY_GROUP_NAMES, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = AffinityGroupResponse.class, description = "comma separated list of affinity groups names that are going to be applied to the virtual machine." - + "Mutually exclusive with affinitygroupids parameter") - private List affinityGroupNameList; - - @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, since = "4.2", description = "an optional field, whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) - private Boolean displayVm; - - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters. 'extraconfig' is not allowed to be passed in details") - private Map details; - - @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin }) - private String deploymentPlanner; - - @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the VM on start up" - + " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com") - private Map dhcpOptionsNetworkList; - - @Parameter(name = ApiConstants.DATADISK_OFFERING_LIST, type = CommandType.MAP, since = "4.11", description = "datadisk template to disk-offering mapping;" + - " an optional parameter used to create additional data disks from datadisk templates; can't be specified with diskOfferingId parameter") - private Map dataDiskTemplateToDiskOfferingList; - - @Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120) - private String extraConfig; - - @Parameter(name = ApiConstants.COPY_IMAGE_TAGS, type = CommandType.BOOLEAN, since = "4.13", description = "if true the image tags (if any) will be copied to the VM, default value is false") - private Boolean copyImageTags; - - @Parameter(name = ApiConstants.PROPERTIES, type = CommandType.MAP, since = "4.15", - description = "used to specify the vApp properties.") - @LogLevel(LogLevel.Log4jLevel.Off) - private Map vAppProperties; - - @Parameter(name = ApiConstants.NIC_NETWORK_LIST, type = CommandType.MAP, since = "4.15", - description = "VMware only: used to specify network mapping of a vApp VMware template registered \"as-is\"." + - " Example nicnetworklist[0].ip=Nic-101&nicnetworklist[0].network=uuid") - @LogLevel(LogLevel.Log4jLevel.Off) - private Map vAppNetworks; - - @Parameter(name = ApiConstants.DYNAMIC_SCALING_ENABLED, type = CommandType.BOOLEAN, since = "4.16", - description = "true if virtual machine needs to be dynamically scalable") - protected Boolean dynamicScalingEnabled; - - @Parameter(name = ApiConstants.OVERRIDE_DISK_OFFERING_ID, type = CommandType.UUID, since = "4.17", entityType = DiskOfferingResponse.class, description = "the ID of the disk offering for the virtual machine to be used for root volume instead of the disk offering mapped in service offering." + - "In case of virtual machine deploying from ISO, then the diskofferingid specified for root volume is ignored and uses this override disk offering id") - private Long overrideDiskOfferingId; - - @Parameter(name = ApiConstants.IOTHREADS_ENABLED, type = CommandType.BOOLEAN, required = false, - description = "IOThreads are dedicated event loop threads for supported disk devices to perform block I/O requests in order to improve scalability especially on an SMP host/guest with many LUNs.") - private Boolean iothreadsEnabled; - - @Parameter(name = ApiConstants.IO_DRIVER_POLICY, type = CommandType.STRING, description = "Controls specific policies on IO") - private String ioDriverPolicy; - - @Parameter(name = ApiConstants.NIC_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "4.18", - description = "The number of queues for multiqueue NICs.") - private Integer nicMultiqueueNumber; - - @Parameter(name = ApiConstants.NIC_PACKED_VIRTQUEUES_ENABLED, type = CommandType.BOOLEAN, since = "4.18", - description = "Enable packed virtqueues or not.") - private Boolean nicPackedVirtQueues; + @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class, since = "4.21") + private Long snapshotId; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - public String getAccountName() { - if (accountName == null) { - return CallContext.current().getCallingAccount().getAccountName(); - } - return accountName; - } - - public Long getDiskOfferingId() { - return diskOfferingId; - } - - public String getDeploymentPlanner() { - return deploymentPlanner; - } - - public String getDisplayName() { - return displayName; - } - - public Long getDomainId() { - if (domainId == null) { - return CallContext.current().getCallingAccount().getDomainId(); - } - return domainId; - } - - public ApiConstants.BootType getBootType() { - if (StringUtils.isNotBlank(bootType)) { - try { - String type = bootType.trim().toUpperCase(); - return ApiConstants.BootType.valueOf(type); - } catch (IllegalArgumentException e) { - String errMesg = "Invalid bootType " + bootType + "Specified for vm " + getName() - + " Valid values are: " + Arrays.toString(ApiConstants.BootType.values()); - logger.warn(errMesg); - throw new InvalidParameterValueException(errMesg); - } - } - return null; - } - - public Map getDetails() { - Map customparameterMap = convertDetailsToMap(details); - - if (getBootType() != null) { - customparameterMap.put(getBootType().toString(), getBootMode().toString()); - } - - if (rootdisksize != null && !customparameterMap.containsKey(VmDetailConstants.ROOT_DISK_SIZE)) { - customparameterMap.put(VmDetailConstants.ROOT_DISK_SIZE, rootdisksize.toString()); - } - - IoDriverPolicy ioPolicy = getIoDriverPolicy(); - if (ioPolicy != null) { - customparameterMap.put(VmDetailConstants.IO_POLICY, ioPolicy.toString()); - } - - if (BooleanUtils.toBoolean(iothreadsEnabled)) { - customparameterMap.put(VmDetailConstants.IOTHREADS, BooleanUtils.toStringTrueFalse(iothreadsEnabled)); - } - - if (nicMultiqueueNumber != null) { - customparameterMap.put(VmDetailConstants.NIC_MULTIQUEUE_NUMBER, nicMultiqueueNumber.toString()); - } - - if (BooleanUtils.toBoolean(nicPackedVirtQueues)) { - customparameterMap.put(VmDetailConstants.NIC_PACKED_VIRTQUEUES_ENABLED, BooleanUtils.toStringTrueFalse(nicPackedVirtQueues)); - } - - return customparameterMap; - } - - - public ApiConstants.BootMode getBootMode() { - if (StringUtils.isNotBlank(bootMode)) { - try { - String mode = bootMode.trim().toUpperCase(); - return ApiConstants.BootMode.valueOf(mode); - } catch (IllegalArgumentException e) { - String msg = String.format("Invalid %s: %s specified for VM: %s. Valid values are: %s", - ApiConstants.BOOT_MODE, bootMode, getName(), Arrays.toString(ApiConstants.BootMode.values())); - logger.error(msg); - throw new InvalidParameterValueException(msg); - } - } - if (ApiConstants.BootType.UEFI.equals(getBootType())) { - String msg = String.format("%s must be specified for the VM with boot type: %s. Valid values are: %s", - ApiConstants.BOOT_MODE, getBootType(), Arrays.toString(ApiConstants.BootMode.values())); - logger.error(msg); - throw new InvalidParameterValueException(msg); - } - return null; - } - - public Map getVmProperties() { - Map map = new HashMap<>(); - if (MapUtils.isNotEmpty(vAppProperties)) { - Collection parameterCollection = vAppProperties.values(); - Iterator iterator = parameterCollection.iterator(); - while (iterator.hasNext()) { - HashMap entry = (HashMap)iterator.next(); - map.put(entry.get("key"), entry.get("value")); - } - } - return map; - } - - public Map getVmNetworkMap() { - Map map = new HashMap<>(); - if (MapUtils.isNotEmpty(vAppNetworks)) { - Collection parameterCollection = vAppNetworks.values(); - Iterator iterator = parameterCollection.iterator(); - while (iterator.hasNext()) { - HashMap entry = (HashMap) iterator.next(); - Integer nic; - try { - nic = Integer.valueOf(entry.get(VmDetailConstants.NIC)); - } catch (NumberFormatException nfe) { - nic = null; - } - String networkUuid = entry.get(VmDetailConstants.NETWORK); - if (logger.isTraceEnabled()) { - logger.trace(String.format("nic, '%s', goes on net, '%s'", nic, networkUuid)); - } - if (nic == null || StringUtils.isEmpty(networkUuid) || _entityMgr.findByUuid(Network.class, networkUuid) == null) { - throw new InvalidParameterValueException(String.format("Network ID: %s for NIC ID: %s is invalid", networkUuid, nic)); - } - map.put(nic, _entityMgr.findByUuid(Network.class, networkUuid).getId()); - } - } - return map; - } - - public String getGroup() { - return group; - } - - public HypervisorType getHypervisor() { - return HypervisorType.getType(hypervisor); - } - - public Boolean isDisplayVm() { - return displayVm; - } - - @Override - public boolean isDisplay() { - if(displayVm == null) - return true; - else - return displayVm; - } - - public List getSecurityGroupNameList() { - return securityGroupNameList; - } - - public List getSecurityGroupIdList() { - return securityGroupIdList; - } - public Long getServiceOfferingId() { return serviceOfferingId; } - public Long getSize() { - return size; - } - public Long getTemplateId() { return templateId; } - public String getUserData() { - return userData; + public Long getVolumeId() { + return volumeId; } - public Long getUserdataId() { - return userdataId; + public Long getSnapshotId() { + return snapshotId; } - public Map getUserdataDetails() { - return convertDetailsToMap(userdataDetails); + public boolean isVolumeOrSnapshotProvided() { + return volumeId != null || snapshotId != null; } - public Long getZoneId() { - return zoneId; + public boolean isBlankInstance() { + return false; } - public String getPassword() { - return password; - } - public List getNetworkIds() { - if (MapUtils.isNotEmpty(vAppNetworks)) { - if (CollectionUtils.isNotEmpty(networkIds) || ipAddress != null || getIp6Address() != null || MapUtils.isNotEmpty(ipToNetworkList)) { - throw new InvalidParameterValueException(String.format("%s can't be specified along with %s, %s, %s", ApiConstants.NIC_NETWORK_LIST, ApiConstants.NETWORK_IDS, ApiConstants.IP_ADDRESS, ApiConstants.IP_NETWORK_LIST)); - } else { - return new ArrayList<>(); - } - } - if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) { - if ((networkIds != null && !networkIds.isEmpty()) || ipAddress != null || getIp6Address() != null) { - throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress"); - } else { - List networks = new ArrayList(); - networks.addAll(getIpToNetworkMap().keySet()); - return networks; - } - } - return networkIds; - } - - public String getName() { - return name; - } - - public List getSSHKeyPairNames() { - List sshKeyPairs = new ArrayList(); - if(sshKeyPairNames != null) { - sshKeyPairs = sshKeyPairNames; - } - if(sshKeyPairName != null && !sshKeyPairName.isEmpty()) { - sshKeyPairs.add(sshKeyPairName); - } - return sshKeyPairs; - } - public Long getHostId() { - return hostId; + ///////////////////////////////////////////////////// + ////////////////// Setters ////////////////////////// + ///////////////////////////////////////////////////// + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; } - public boolean getStartVm() { - return startVm == null ? true : startVm; + public void setName(String name) { + this.name = name; } - public Map getIpToNetworkMap() { - if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) { - throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter"); - } - LinkedHashMap ipToNetworkMap = null; - if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) { - ipToNetworkMap = new LinkedHashMap(); - Collection ipsCollection = ipToNetworkList.values(); - Iterator iter = ipsCollection.iterator(); - while (iter.hasNext()) { - HashMap ips = (HashMap)iter.next(); - Long networkId = getNetworkIdFomIpMap(ips); - IpAddresses addrs = getIpAddressesFromIpMap(ips); - ipToNetworkMap.put(networkId, addrs); - } - } - - return ipToNetworkMap; + public void setDisplayName(String displayName) { + this.displayName = displayName; } - @Nonnull - private IpAddresses getIpAddressesFromIpMap(HashMap ips) { - String requestedIp = ips.get("ip"); - String requestedIpv6 = ips.get("ipv6"); - String requestedMac = ips.get("mac"); - if (requestedIpv6 != null) { - requestedIpv6 = NetUtils.standardizeIp6Address(requestedIpv6); - } - if (requestedMac != null) { - if(!NetUtils.isValidMac(requestedMac)) { - throw new InvalidParameterValueException("Mac address is not valid: " + requestedMac); - } else if(!NetUtils.isUnicastMac(requestedMac)) { - throw new InvalidParameterValueException("Mac address is not unicast: " + requestedMac); - } - requestedMac = NetUtils.standardizeMacAddress(requestedMac); - } - return new IpAddresses(requestedIp, requestedIpv6, requestedMac); + public void setAccountName(String accountName) { + this.accountName = accountName; } - @Nonnull - private Long getNetworkIdFomIpMap(HashMap ips) { - Long networkId; - final String networkid = ips.get("networkid"); - Network network = _networkService.getNetwork(networkid); - if (network != null) { - networkId = network.getId(); - } else { - try { - networkId = Long.parseLong(networkid); - } catch (NumberFormatException e) { - throw new InvalidParameterValueException("Unable to translate and find entity with networkId: " + networkid); - } - } - return networkId; + public void setDomainId(Long domainId) { + this.domainId = domainId; } - public String getIpAddress() { - return ipAddress; + public void setNetworkIds(List networkIds) { + this.networkIds = networkIds; } - public String getIp6Address() { - if (ip6Address == null) { - return null; - } - return NetUtils.standardizeIp6Address(ip6Address); + public void setBootType(String bootType) { + this.bootType = bootType; } - - public String getMacAddress() { - if (macAddress == null) { - return null; - } - if(!NetUtils.isValidMac(macAddress)) { - throw new InvalidParameterValueException("Mac address is not valid: " + macAddress); - } else if(!NetUtils.isUnicastMac(macAddress)) { - throw new InvalidParameterValueException("Mac address is not unicast: " + macAddress); - } - return NetUtils.standardizeMacAddress(macAddress); + public void setBootMode(String bootMode) { + this.bootMode = bootMode; } - public List getAffinityGroupIdList() { - if (affinityGroupNameList != null && affinityGroupIdList != null) { - throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter"); - } - - // transform group names to ids here - if (affinityGroupNameList != null) { - List affinityGroupIds = new ArrayList(); - for (String groupName : affinityGroupNameList) { - Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId()); - if (groupId == null) { - throw new InvalidParameterValueException("Unable to find affinity group by name " + groupName); - } else { - affinityGroupIds.add(groupId); - } - } - return affinityGroupIds; - } else { - return affinityGroupIdList; - } + public void setHypervisor(String hypervisor) { + this.hypervisor = hypervisor; } - public String getKeyboard() { - // TODO Auto-generated method stub - return keyboard; + public void setUserData(String userData) { + this.userData = userData; } - public Map> getDhcpOptionsMap() { - Map> dhcpOptionsMap = new HashMap<>(); - if (dhcpOptionsNetworkList != null && !dhcpOptionsNetworkList.isEmpty()) { - - Collection> paramsCollection = this.dhcpOptionsNetworkList.values(); - for (Map dhcpNetworkOptions : paramsCollection) { - String networkId = dhcpNetworkOptions.get(ApiConstants.NETWORK_ID); - - if (networkId == null) { - throw new IllegalArgumentException("No networkid specified when providing extra dhcp options."); - } - - Map dhcpOptionsForNetwork = new HashMap<>(); - dhcpOptionsMap.put(networkId, dhcpOptionsForNetwork); - - for (String key : dhcpNetworkOptions.keySet()) { - if (key.startsWith(ApiConstants.DHCP_PREFIX)) { - int dhcpOptionValue = Integer.parseInt(key.replaceFirst(ApiConstants.DHCP_PREFIX, "")); - dhcpOptionsForNetwork.put(dhcpOptionValue, dhcpNetworkOptions.get(key)); - } else if (!key.equals(ApiConstants.NETWORK_ID)) { - Dhcp.DhcpOptionCode dhcpOptionEnum = Dhcp.DhcpOptionCode.valueOfString(key); - dhcpOptionsForNetwork.put(dhcpOptionEnum.getCode(), dhcpNetworkOptions.get(key)); - } - } - - } - } - - return dhcpOptionsMap; + public void setKeyboard(String keyboard) { + this.keyboard = keyboard; } - public Map getDataDiskTemplateToDiskOfferingMap() { - if (diskOfferingId != null && dataDiskTemplateToDiskOfferingList != null) { - throw new InvalidParameterValueException("diskofferingid parameter can't be specified along with datadisktemplatetodiskofferinglist parameter"); - } - if (MapUtils.isEmpty(dataDiskTemplateToDiskOfferingList)) { - return new HashMap(); - } - - HashMap dataDiskTemplateToDiskOfferingMap = new HashMap(); - for (Object objDataDiskTemplates : dataDiskTemplateToDiskOfferingList.values()) { - HashMap dataDiskTemplates = (HashMap) objDataDiskTemplates; - Long dataDiskTemplateId; - DiskOffering dataDiskOffering = null; - VirtualMachineTemplate dataDiskTemplate= _entityMgr.findByUuid(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid")); - if (dataDiskTemplate == null) { - dataDiskTemplate = _entityMgr.findById(VirtualMachineTemplate.class, dataDiskTemplates.get("datadisktemplateid")); - if (dataDiskTemplate == null) - throw new InvalidParameterValueException("Unable to translate and find entity with datadisktemplateid " + dataDiskTemplates.get("datadisktemplateid")); - } - dataDiskTemplateId = dataDiskTemplate.getId(); - dataDiskOffering = _entityMgr.findByUuid(DiskOffering.class, dataDiskTemplates.get("diskofferingid")); - if (dataDiskOffering == null) { - dataDiskOffering = _entityMgr.findById(DiskOffering.class, dataDiskTemplates.get("diskofferingid")); - if (dataDiskOffering == null) - throw new InvalidParameterValueException("Unable to translate and find entity with diskofferingId " + dataDiskTemplates.get("diskofferingid")); - } - dataDiskTemplateToDiskOfferingMap.put(dataDiskTemplateId, dataDiskOffering); - } - return dataDiskTemplateToDiskOfferingMap; + public void setProjectId(Long projectId) { + this.projectId = projectId; } - public String getExtraConfig() { - return extraConfig; + public void setDisplayVm(Boolean displayVm) { + this.displayVm = displayVm; } - public boolean getCopyImageTags() { - return copyImageTags == null ? false : copyImageTags; + public void setUserDataId(Long userDataId) { + this.userdataId = userDataId; } - public Boolean getBootIntoSetup() { - return bootIntoSetup; + public void setAffinityGroupIds(List ids) { + this.affinityGroupIdList = ids; } - public boolean isDynamicScalingEnabled() { - return dynamicScalingEnabled == null ? true : dynamicScalingEnabled; + public void setDetails(Map details) { + this.details = details; } - public Long getOverrideDiskOfferingId() { - return overrideDiskOfferingId; + public void setExtraConfig(String extraConfig) { + this.extraConfig = extraConfig; } - public ApiConstants.IoDriverPolicy getIoDriverPolicy() { - if (StringUtils.isNotBlank(ioDriverPolicy)) { - try { - String policyType = ioDriverPolicy.trim().toUpperCase(); - return ApiConstants.IoDriverPolicy.valueOf(policyType); - } catch (IllegalArgumentException e) { - String errMesg = String.format("Invalid io policy %s specified for vm %s. Valid values are: %s", ioDriverPolicy, getName(), Arrays.toString(ApiConstants.IoDriverPolicy.values())); - logger.warn(errMesg); - throw new InvalidParameterValueException(errMesg); - } - } - return null; + public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) { + this.dynamicScalingEnabled = dynamicScalingEnabled; } - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - @Override - public String getCommandName() { - return s_name; + public void setServiceOfferingId(Long serviceOfferingId) { + this.serviceOfferingId = serviceOfferingId; } - public static String getResultObjectName() { - return "virtualmachine"; + public void setTemplateId(Long templateId) { + this.templateId = templateId; } - @Override - public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); - if (accountId == null) { - return CallContext.current().getCallingAccount().getId(); - } - - return accountId; + public void setVolumeId(Long volumeId) { + this.volumeId = volumeId; } - @Override - public String getEventType() { - return EventTypes.EVENT_VM_CREATE; + public void setSnapshotId(Long snapshotId) { + this.snapshotId = snapshotId; } - @Override - public String getCreateEventType() { - return EventTypes.EVENT_VM_CREATE; + public void setSshKeyPairNames(List sshKeyPairNames) { + this.sshKeyPairNames = sshKeyPairNames; } - @Override - public String getCreateEventDescription() { - return "creating Vm"; - } - - @Override - public String getEventDescription() { - if(getStartVm()) { - return "starting Vm. Vm Id: " + getEntityUuid(); - } - return "deploying Vm. Vm Id: " + getEntityUuid(); - } - - @Override - public ApiCommandResourceType getApiResourceType() { - return ApiCommandResourceType.VirtualMachine; + public void setSecurityGroupList(List securityGroupIdList) { + this.securityGroupIdList = securityGroupIdList; } @Override public void execute() { UserVm result; - CallContext.current().setEventDetails("Vm Id: " + getEntityUuid()); + CallContext.current().setEventDetails("Instance ID: " + getEntityUuid()); if (getStartVm()) { try { result = _userVmService.startVirtualMachine(this); @@ -795,12 +219,12 @@ public void execute() { message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them"); } } - logger.info(String.format("%s: %s", message.toString(), ex.getLocalizedMessage())); + logger.info("{}: {}", message.toString(), ex.getLocalizedMessage()); logger.debug(message.toString(), ex); throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString()); } } else { - logger.info("VM " + getEntityUuid() + " already created, load UserVm from DB"); + logger.info("Instance {} already created, load UserVm from DB", getEntityUuid()); result = _userVmService.finalizeCreateVirtualMachine(getEntityId()); } @@ -809,13 +233,16 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm uuid:"+getEntityUuid()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy Instance UUID:"+getEntityUuid()); } } - @Override public void create() throws ResourceAllocationException { + if (!isBlankInstance() && Stream.of(templateId, snapshotId, volumeId).filter(Objects::nonNull).count() != 1) { + throw new CloudRuntimeException("Please provide only one of the following parameters - template ID, volume ID or snapshot ID"); + } + try { UserVm vm = _userVmService.createVirtualMachine(this); @@ -823,7 +250,7 @@ public void create() throws ResourceAllocationException { setEntityId(vm.getId()); setEntityUuid(vm.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy Instance"); } } catch (InsufficientCapacityException ex) { logger.info(ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVnfApplianceCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVnfApplianceCmd.java index 4d50dd9c39bf..92ddfd5b2357 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVnfApplianceCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVnfApplianceCmd.java @@ -43,7 +43,7 @@ public class DeployVnfApplianceCmd extends DeployVMCmd implements UserCmd { @Parameter(name = ApiConstants.VNF_CONFIGURE_MANAGEMENT, type = CommandType.BOOLEAN, required = false, - description = "True by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. False otherwise. " + + description = "False by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. True otherwise. " + "Network rules are configured if management network is an isolated network or shared network with security groups.") private Boolean vnfConfigureManagement; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java index aa121162cb4e..aec0688f1779 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java @@ -41,7 +41,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "destroyVirtualMachine", description = "Destroys a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "destroyVirtualMachine", description = "Destroys an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class DestroyVMCmd extends BaseAsyncCmd implements UserCmd { @@ -54,12 +54,12 @@ public class DestroyVMCmd extends BaseAsyncCmd implements UserCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; @Parameter(name = ApiConstants.EXPUNGE, type = CommandType.BOOLEAN, - description = "If true is passed, the vm is expunged immediately. False by default.", + description = "If true is passed, the Instance is expunged immediately. False by default.", since = "4.2.1") private Boolean expunge; @@ -90,6 +90,10 @@ public List getVolumeIds() { return volumeIds; } + public boolean isForced() { + return false; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -116,7 +120,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "destroying vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Destroying Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -131,7 +135,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result = _userVmService.destroyVm(this); UserVmResponse response = new UserVmResponse(); @@ -140,10 +144,11 @@ public void execute() throws ResourceUnavailableException, ConcurrentOperationEx if (responses != null && !responses.isEmpty()) { response = responses.get(0); } - response.setResponseName("virtualmachine"); + response.setResponseName(getCommandName()); + response.setObjectName("virtualmachine"); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java index 11534fd43759..d2e6ef9e7428 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java @@ -30,7 +30,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "getVMPassword", responseObject = GetVMPasswordResponse.class, description = "Returns an encrypted password for the VM", entityType = {VirtualMachine.class}, +@APICommand(name = "getVMPassword", responseObject = GetVMPasswordResponse.class, description = "Returns an encrypted password for the Instance", entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class GetVMPasswordCmd extends BaseCmd { @@ -40,7 +40,7 @@ public class GetVMPasswordCmd extends BaseCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class - , required=true, description="The ID of the virtual machine") + , required=true, description = "The ID of the Instance") private Long id; ///////////////////////////////////////////////////// @@ -59,7 +59,7 @@ public Long getId() { public void execute() { String passwd = _mgr.getVMPassword(this); if (passwd == null || passwd.equals("")) - throw new InvalidParameterValueException("No password for VM with id '" + getId() + "' found."); + throw new InvalidParameterValueException("No password for Instance with ID '" + getId() + "' found."); setResponseObject(new GetVMPasswordResponse(getCommandName(), passwd)); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java index 0e659fc02a1a..7d2b27e7ac5f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListNicsCmd.java @@ -41,7 +41,7 @@ import com.cloud.user.Account; import com.cloud.vm.Nic; -@APICommand(name = "listNics", description = "list the vm nics IP to NIC", responseObject = NicResponse.class, +@APICommand(name = "listNics", description = "List the Instance NICs IP to NIC", responseObject = NicResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListNicsCmd extends BaseListCmd { @@ -49,16 +49,16 @@ public class ListNicsCmd extends BaseListCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = false, description = "the ID of the nic to list IPs") + @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = false, description = "The ID of the NIC to list IPs") private Long nicId; - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "the ID of the vm") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long vmId; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list nic of the specific vm's network") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List NIC of the specific Instance's Network") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -155,7 +155,7 @@ public void execute() throws ResourceUnavailableException, ResourceAllocationExc this.setResponseObject(response); } } catch (Exception e) { - logger.warn("Failed to list secondary ip address per nic "); + logger.warn("Failed to list secondary ip address per NIC"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMScheduleCmd.java index 3474f1ddcaad..be94315abe76 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMScheduleCmd.java @@ -31,7 +31,7 @@ import javax.inject.Inject; -@APICommand(name = "listVMSchedule", description = "List VM Schedules.", responseObject = VMScheduleResponse.class, +@APICommand(name = "listVMSchedule", description = "List Instance Schedules.", responseObject = VMScheduleResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class ListVMScheduleCmd extends BaseListCmd { @@ -42,14 +42,14 @@ public class ListVMScheduleCmd extends BaseListCmd { type = CommandType.UUID, entityType = UserVmResponse.class, required = true, - description = "ID of the VM for which schedule is to be defined") + description = "ID of the Instance for which schedule is to be defined") private Long vmId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VMScheduleResponse.class, required = false, - description = "ID of VM schedule") + description = "ID of Instance schedule") private Long id; @Parameter(name = ApiConstants.ACTION, @@ -61,7 +61,7 @@ public class ListVMScheduleCmd extends BaseListCmd { @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, - description = "ID of VM schedule") + description = "ID of Instance schedule") private Boolean enabled; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java index ac180b6d4569..46e3c7926f4e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java @@ -16,10 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; +import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.affinity.AffinityGroupResponse; @@ -33,6 +38,7 @@ import org.apache.cloudstack.api.command.user.UserCmd; import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.BackupOfferingResponse; +import org.apache.cloudstack.api.response.ExtensionResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.IsoVmResponse; import org.apache.cloudstack.api.response.ListResponse; @@ -46,16 +52,19 @@ import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +import com.cloud.cpu.CPU; import com.cloud.exception.InvalidParameterValueException; import com.cloud.server.ResourceIcon; import com.cloud.server.ResourceTag; +import com.cloud.storage.GuestOS; import com.cloud.vm.VirtualMachine; -@APICommand(name = "listVirtualMachines", description = "List the virtual machines owned by the account.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "listVirtualMachines", description = "List the Instances owned by the Account.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements UserCmd { @@ -64,95 +73,116 @@ public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.GROUP_ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "the group ID") + @Parameter(name = ApiConstants.GROUP_ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "The group ID") private Long groupId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the Instance") private Long id; - @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=UserVmResponse.class, description="the IDs of the virtual machines, mutually exclusive with id", since = "4.4") + @Parameter(name=ApiConstants.IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=UserVmResponse.class, description = "The IDs of the Instances, mutually exclusive with id", since = "4.4") private List ids; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "name of the virtual machine (a substring match is made against the parameter value, data for all matching VMs will be returned)") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the Instance (a substring match is made against the parameter value, data for all matching Instances will be returned)") private String name; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "State of the Instance. Possible values are: Running, Stopped, Present, Destroyed, Expunged. Present is used for the state equal not destroyed.") private String state; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the availability zone ID") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The availability zone ID") private Long zoneId; @Parameter(name = ApiConstants.FOR_VIRTUAL_NETWORK, type = CommandType.BOOLEAN, - description = "list by network type; true if need to list vms using Virtual Network, false otherwise") + description = "List by Network type; true if need to list Instances using Virtual Network, false otherwise") private Boolean forVirtualNetwork; - @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "list by network id") + @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "List by Network ID") private Long networkId; - @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the target hypervisor for the template") + @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "The target hypervisor for the Template") private String hypervisor; @Parameter(name = ApiConstants.DETAILS, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "comma separated list of vm details requested, " + description = "Comma separated list of Instance details requested, " + "value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp]." + " When no parameters are passed, all the details are returned if list.vm.default.details.stats is true (default)," + " otherwise when list.vm.default.details.stats is false the API response will exclude the stats details.") private List viewDetails; - @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "list vms by template") + @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "List Instances by Template") private Long templateId; - @Parameter(name = ApiConstants.ISO_ID, type = CommandType.UUID, entityType = IsoVmResponse.class, description = "list vms by iso") + @Parameter(name = ApiConstants.ISO_ID, type = CommandType.UUID, entityType = IsoVmResponse.class, description = "List Instances by ISO") private Long isoId; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "list vms by vpc") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List Instances by VPC") private Long vpcId; - @Parameter(name = ApiConstants.AFFINITY_GROUP_ID, type = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "list vms by affinity group") + @Parameter(name = ApiConstants.AFFINITY_GROUP_ID, type = CommandType.UUID, entityType = AffinityGroupResponse.class, description = "List Instances by affinity group") private Long affinityGroupId; - @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, description = "list vms by ssh keypair name") + @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, description = "List Instances by SSH keypair name") private String keypair; - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list by the service offering", since = "4.4") + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "List by the service offering", since = "4.4") private Long serviceOffId; - @Parameter(name = ApiConstants.BACKUP_OFFERING_ID, type = CommandType.UUID, entityType = BackupOfferingResponse.class, description = "list by the backup offering", since = "4.17") + @Parameter(name = ApiConstants.BACKUP_OFFERING_ID, type = CommandType.UUID, entityType = BackupOfferingResponse.class, description = "List by the backup offering", since = "4.17") private Long backupOffId; - @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; - @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, required = false, description = "the user ID that created the VM and is under the account that owns the VM") + @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, entityType = UserResponse.class, required = false, description = "The user ID that created the Instance and is under the Account that owns the Instance") private Long userId; - @Parameter(name = ApiConstants.SECURITY_GROUP_ID, type = CommandType.UUID, entityType = SecurityGroupResponse.class, description = "the security group ID", since = "4.15") + @Parameter(name = ApiConstants.SECURITY_GROUP_ID, type = CommandType.UUID, entityType = SecurityGroupResponse.class, description = "The security group ID", since = "4.15") private Long securityGroupId; - @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "list by the High Availability offering; true if filtering VMs with HA enabled; false for VMs with HA disabled", since = "4.15") + @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "List by the High Availability offering; true if filtering Instances with HA enabled; false for Instances with HA disabled", since = "4.15") private Boolean haEnabled; - @Parameter(name = ApiConstants.AUTOSCALE_VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "the ID of AutoScaling VM Group", since = "4.18.0") + @Parameter(name = ApiConstants.AUTOSCALE_VMGROUP_ID, type = CommandType.UUID, entityType = AutoScaleVmGroupResponse.class, description = "The ID of AutoScaling Instance Group", since = "4.18.0") private Long autoScaleVmGroupId; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for VMs", since = "4.16.0.0") + description = "Flag to display the resource icon for Instances", since = "4.16.0.0") private Boolean showIcon; @Parameter(name = ApiConstants.ACCUMULATE, type = CommandType.BOOLEAN, - description = "Accumulates the VM metrics data instead of returning only the most recent data collected. The default behavior is set by the global configuration vm.stats.increment.metrics.", + description = "Accumulates the Instance metrics data instead of returning only the most recent data collected. The default behavior is set by the global configuration vm.stats.increment.metrics.", since = "4.17.0") private Boolean accumulate; - @Parameter(name = ApiConstants.USER_DATA, type = CommandType.BOOLEAN, description = "Whether to return the VMs' user data or not. By default, user data will not be returned.", since = "4.18.0.0") + @Parameter(name = ApiConstants.USER_DATA, type = CommandType.BOOLEAN, description = "Whether to return the Instances' User data or not. By default, User data will not be returned.", since = "4.18.0.0") private Boolean showUserData; @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, required = false, description = "the instances by userdata", since = "4.20.1") private Long userdataId; + @Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, + description = "CPU arch of the VM", + since = "4.20.1") + private String arch; + + @Parameter(name = ApiConstants.LEASED, type = CommandType.BOOLEAN, + description = "Whether to return only leased instances", + since = "4.21.0") + private Boolean onlyLeasedInstances = false; + + @Parameter(name = ApiConstants.GPU_ENABLED, + type = CommandType.BOOLEAN, + description = "Flag to indicate if the VMs should be filtered by GPU support. If set to true, only VMs that support GPU will be returned.", + since = "4.21.0") + private Boolean gpuEnabled; + + @Parameter(name = ApiConstants.EXTENSION_ID, type = CommandType.UUID, + entityType = ExtensionResponse.class, description = "The ID of the Orchestrator extension for the VM", + since = "4.21.0") + private Long extensionId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -292,6 +322,22 @@ public Boolean getVnf() { return isVnf; } + public CPU.CPUArch getArch() { + return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch); + } + + public boolean getOnlyLeasedInstances() { + return BooleanUtils.toBoolean(onlyLeasedInstances); + } + + public Boolean getGpuEnabled() { + return gpuEnabled; + } + + public Long getExtensionId() { + return extensionId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -311,22 +357,75 @@ public void execute() { setResponseObject(response); } - protected void updateVMResponse(List response) { - for (UserVmResponse vmResponse : response) { - ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.UserVm, vmResponse.getId()); - if (resourceIcon == null) { - ResourceTag.ResourceObjectType type = ResourceTag.ResourceObjectType.Template; - String uuid = vmResponse.getTemplateId(); - if (vmResponse.getIsoId() != null) { - uuid = vmResponse.getIsoId(); - type = ResourceTag.ResourceObjectType.ISO; - } - resourceIcon = resourceIconManager.getByResourceTypeAndUuid(type, uuid); - if (resourceIcon == null) { - continue; - } + protected Map getResourceIconsUsingOsCategory(List responses) { + Set guestOsIds = responses.stream().map(UserVmResponse::getGuestOsId).collect(Collectors.toSet()); + List guestOSList = _entityMgr.listByUuids(GuestOS.class, guestOsIds); + Map guestOSMap = guestOSList.stream() + .collect(Collectors.toMap(GuestOS::getUuid, Function.identity())); + Set guestOsCategoryIds = guestOSMap.values().stream() + .map(GuestOS::getCategoryId) + .collect(Collectors.toSet()); + Map guestOsCategoryIcons = + resourceIconManager.getByResourceTypeAndIds(ResourceTag.ResourceObjectType.GuestOsCategory, + guestOsCategoryIds); + Map vmIcons = new HashMap<>(); + for (UserVmResponse response : responses) { + GuestOS guestOS = guestOSMap.get(response.getGuestOsId()); + if (guestOS != null) { + vmIcons.put(response.getId(), guestOsCategoryIcons.get(guestOS.getCategoryId())); + } + } + return vmIcons; + } + + protected Map getResourceIconsForUsingTemplateIso(List responses) { + Map vmTemplateIsoIdMap = new HashMap<>(); + Set templateUuids = new HashSet<>(); + Set isoUuids = new HashSet<>(); + for (UserVmResponse vmResponse : responses) { + if (vmResponse.getTemplateId() != null) { + templateUuids.add(vmResponse.getTemplateId()); + vmTemplateIsoIdMap.put(vmResponse.getId(), vmResponse.getTemplateId()); + } + if (vmResponse.getIsoId() != null) { + isoUuids.add(vmResponse.getIsoId()); + vmTemplateIsoIdMap.put(vmResponse.getId(), vmResponse.getIsoId()); + } + } + Map templateOrIsoIcons = resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.Template, templateUuids); + templateOrIsoIcons.putAll(resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.ISO, isoUuids)); + Map vmIcons = new HashMap<>(); + List noTemplateIsoIconResponses = new ArrayList<>(); + for (UserVmResponse response : responses) { + String uuid = vmTemplateIsoIdMap.get(response.getId()); + if (StringUtils.isNotBlank(uuid) && templateOrIsoIcons.containsKey(uuid)) { + vmIcons.put(response.getId(), + templateOrIsoIcons.get(vmTemplateIsoIdMap.get(response.getId()))); + continue; + } + noTemplateIsoIconResponses.add(response); + } + vmIcons.putAll(getResourceIconsUsingOsCategory(noTemplateIsoIconResponses)); + return vmIcons; + } + + protected void updateVMResponse(List responses) { + if (CollectionUtils.isEmpty(responses)) { + return; + } + Set vmUuids = responses.stream().map(UserVmResponse::getId).collect(Collectors.toSet()); + Map vmIcons = resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.UserVm, vmUuids); + List noVmIconResponses = responses + .stream() + .filter(r -> !vmIcons.containsKey(r.getId())) + .collect(Collectors.toList()); + vmIcons.putAll(getResourceIconsForUsingTemplateIso(noVmIconResponses)); + for (UserVmResponse vmResponse : responses) { + ResourceIcon icon = vmIcons.get(vmResponse.getId()); + if (icon == null) { + continue; } - ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon); + ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(icon); vmResponse.setResourceIconResponse(iconResponse); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java index 153f5ea65636..6f4431547848 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java @@ -39,7 +39,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "rebootVirtualMachine", description = "Reboots a virtual machine.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "rebootVirtualMachine", description = "Reboots an Instance.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RebootVMCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "rebootvirtualmachineresponse"; @@ -49,10 +49,10 @@ public class RebootVMCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force reboot the VM (VM is Stopped and then Started)", since = "4.16.0") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force reboot the Instance (It is Stopped and then Started)", since = "4.16.0") private Boolean forced; @Parameter(name = ApiConstants.BOOT_INTO_SETUP, type = CommandType.BOOLEAN, required = false, description = "Boot into hardware setup menu or not", since = "4.15.0.0") @@ -100,7 +100,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "rebooting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Rebooting User Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -115,7 +115,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result; result = _userVmService.rebootVirtualMachine(this); if (result !=null){ @@ -123,7 +123,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java index 2f53c3d4e4cd..f4c4d82b30d4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveIpFromVmNicCmd.java @@ -48,7 +48,7 @@ public class RemoveIpFromVmNicCmd extends BaseAsyncCmd { type = CommandType.UUID, required = true, entityType = NicSecondaryIpResponse.class, - description = "the ID of the secondary ip address to nic") + description = "The ID of the secondary ip address to NIC") private Long id; // unexposed parameter needed for events logging @@ -93,7 +93,7 @@ public NicSecondaryIp getIpEntry() { @Override public String getEventDescription() { - return ("Disassociating ip address with id=" + id); + return "Disassociating IP address with ID:" + getResourceUuid(ApiConstants.ID); } ///////////////////////////////////////////////////// @@ -132,7 +132,7 @@ private boolean isZoneSGEnabled() { @Override public void execute() throws InvalidParameterValueException { - CallContext.current().setEventDetails("Ip Id: " + id); + CallContext.current().setEventDetails("IP address ID: " + getResourceUuid(ApiConstants.ID)); NicSecondaryIp nicSecIp = getIpEntry(); if (nicSecIp == null) { @@ -159,10 +159,10 @@ public void execute() throws InvalidParameterValueException { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove secondary ip address for the nic"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove secondary IP address for the NIC"); } } catch (InvalidParameterValueException e) { - throw new InvalidParameterValueException("Removing guest ip from nic failed"); + throw new InvalidParameterValueException("Removing guest IP from NIC failed"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java index d9024f340228..cfbc64339909 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java @@ -19,8 +19,6 @@ import java.util.ArrayList; import java.util.EnumSet; -import com.cloud.vm.Nic; - import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -41,7 +39,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "removeNicFromVirtualMachine", description = "Removes VM from specified network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "removeNicFromVirtualMachine", description = "Removes Instance from specified Network by deleting a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RemoveNicFromVMCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "removenicfromvirtualmachineresponse"; @@ -51,7 +49,7 @@ public class RemoveNicFromVMCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="Virtual Machine ID") + required=true, description = "Instance ID") private Long vmId; @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID") @@ -89,7 +87,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Removing NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " from user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()); + return "Removing NIC with ID: " + getResourceUuid(ApiConstants.NIC_ID) + " from User Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -103,7 +101,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " NIC ID: " + getResourceUuid(ApiConstants.NIC_ID)); UserVm result = _userVmService.removeNicFromVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); @@ -113,7 +111,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from Instance, see error log for details"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java index 7270004aeed8..b6179efc0d35 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java @@ -39,8 +39,8 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description="Resets the password for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state and the template must already " + +@APICommand(name = "resetPasswordForVirtualMachine", responseObject=UserVmResponse.class, description = "Resets the password for the Instance. " + + "The Instance must be in a \"Stopped\" state and the Template must already " + "support this feature for this command to take effect. [async]", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMPasswordCmd extends BaseAsyncCmd implements UserCmd { @@ -52,7 +52,7 @@ public class ResetVMPasswordCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="The new password of the virtual machine. If null, a random password will be generated for the VM.", since="4.19.0") @@ -101,7 +101,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "resetting password for vm: " + getId(); + return "Resetting password for Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -120,18 +120,18 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE UserVm vm = _responseGenerator.findUserVmById(getId()); if (StringUtils.isBlank(password)) { password = _mgr.generateRandomPassword(); - logger.debug(String.format("Resetting VM [%s] password to a randomly generated password.", vm.getUuid())); + logger.debug("Resetting VM [{}] password to a randomly generated password.", vm.getUuid()); } else { - logger.debug(String.format("Resetting VM [%s] password to password defined by user.", vm.getUuid())); + logger.debug("Resetting VM [{}] password to password defined by user.", vm.getUuid()); } - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result = _userVmService.resetVMPassword(this, password); if (result != null){ UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset Instance password"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java index a4019411e1d2..73e4ec623f23 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java @@ -44,8 +44,8 @@ import java.util.ArrayList; import java.util.List; -@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state. [async]", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for the Instance. " + + "The Instance must be in a \"Stopped\" state. [async]", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class ResetVMSSHKeyCmd extends BaseAsyncCmd implements UserCmd { @@ -56,27 +56,27 @@ public class ResetVMSSHKeyCmd extends BaseAsyncCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long id; @Deprecated - @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING ,description = "name of the ssh key pair used to login to the virtual machine") + @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING ,description = "Name of the SSH key pair used to login to the Instance") String name; - @Parameter(name = ApiConstants.SSH_KEYPAIRS, type = CommandType.LIST, collectionType = CommandType.STRING, since="4.17", description = "names of the ssh key pairs to be used to login to the virtual machine") + @Parameter(name = ApiConstants.SSH_KEYPAIRS, type = CommandType.LIST, collectionType = CommandType.STRING, since="4.17", description = "Names of the SSH key pairs to be used to login to the Instance") List names; //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the SSH key. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the Instance. If the Account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the SSH key") private Long projectId; ///////////////////////////////////////////////////// @@ -121,7 +121,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "resetting SSHKey for vm: " + getId(); + return "Resetting SSH key for Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -152,7 +152,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result = _userVmService.resetVMSSHKey(this); if (result != null) { @@ -160,7 +160,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm SSHKey"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset SSHKey"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java index 0ecf4ff13845..8c513549506f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java @@ -40,8 +40,8 @@ import java.util.Map; -@APICommand(name = "resetUserDataForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the UserData for virtual machine. " + - "The virtual machine must be in a \"Stopped\" state.", responseView = ResponseObject.ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "resetUserDataForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the UserData for Instance. " + + "The Instance must be in a \"Stopped\" state.", responseView = ResponseObject.ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true, since = "4.18.0") public class ResetVMUserDataCmd extends BaseCmd implements UserCmd { @@ -52,12 +52,12 @@ public class ResetVMUserDataCmd extends BaseCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = SecurityChecker.AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the Instance") private Long id; @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, - description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + description = "An optional binary data that can be sent to the Instance upon a successful deployment. " + "This binary data must be base64 encoded before adding it to the request. " + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + @@ -65,23 +65,23 @@ public class ResetVMUserDataCmd extends BaseCmd implements UserCmd { length = 1048576) private String userData; - @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the userdata") + @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "The ID of the userdata") private Long userdataId; - @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.") + @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "Used to specify the parameters values for the variables in userdata.") private Map userdataDetails; //Owner information - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the virtual machine. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the Instance. Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the Instance. If the Account parameter is used, domainId must also be used.") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the virtual machine") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "An optional project for the Instance") private Long projectId; ///////////////////////////////////////////////////// @@ -143,7 +143,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result = _userVmService.resetVMUserData(this); if (result != null) { @@ -151,7 +151,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm SSHKey"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset SSHKey"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java index 3839049eee5e..d3459347687a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java @@ -44,7 +44,7 @@ import java.util.Map; -@APICommand(name = "restoreVirtualMachine", description = "Restore a VM to original template/ISO or new template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "restoreVirtualMachine", description = "Restore an Instance to original Template/ISO or new Template/ISO", responseObject = UserVmResponse.class, since = "3.0.0", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RestoreVMCmd extends BaseAsyncCmd implements UserCmd { @@ -52,13 +52,13 @@ public class RestoreVMCmd extends BaseAsyncCmd implements UserCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="Virtual Machine ID") + required=true, description = "Instance ID") private Long vmId; @Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, - description = "an optional template Id to restore vm from the new template. This can be an ISO id in case of restore vm deployed using ISO") + description = "An optional Template Id to restore Instance from the new Template. This can be an ISO id in case of restore Instance deployed using ISO") private Long templateId; @Parameter(name = ApiConstants.DISK_OFFERING_ID, @@ -90,21 +90,21 @@ public String getEventType() { @Override public String getEventDescription() { - return "Restore a VM to original template or specific snapshot"; + return "Restoring Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " to original Template or specific Snapshot"; } @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { UserVm result; - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID)); result = _userVmService.restoreVM(this); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore Instance " + getVmId()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java index 3af6d5245f00..36d0ad9c6500 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java @@ -39,13 +39,12 @@ import com.cloud.exception.ManagementServerException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.VirtualMachineMigrationException; -import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "scaleVirtualMachine", description = "Scales the virtual machine to a new service offering. This command also considers the volume size in the service offering or disk offering linked to the new service offering and apply all characteristics to the root volume.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "scaleVirtualMachine", description = "Scales the Instance to a new service offering. This command also considers the volume size in the service offering or disk offering linked to the new service offering and apply all characteristics to the root volume.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ScaleVMCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "scalevirtualmachineresponse"; @@ -55,14 +54,14 @@ public class ScaleVMCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class, - required=true, description="the ID of the service offering for the virtual machine") + required=true, description = "The ID of the service offering for the Instance") private Long serviceOfferingId; - @Parameter(name = ApiConstants.DETAILS, type = BaseCmd.CommandType.MAP, description = "name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") + @Parameter(name = ApiConstants.DETAILS, type = BaseCmd.CommandType.MAP, description = "Name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") private Map details; @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "New minimum number of IOPS for the custom disk offering", since = "4.17") @@ -148,7 +147,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "upgrading vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()) + " to service offering: " + this._uuidMgr.getUuid(ServiceOffering.class, getServiceOfferingId()); + return "Upgrading Instance with ID: " + getResourceUuid(ApiConstants.ID) + " to service offering with ID: " + getResourceUuid(ApiConstants.SERVICE_OFFERING_ID); } @Override @@ -185,7 +184,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java index c0311d599974..40ae91d4c264 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java @@ -47,7 +47,7 @@ import com.cloud.utils.exception.ExecutionException; import com.cloud.vm.VirtualMachine; -@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts a virtual machine.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "startVirtualMachine", responseObject = UserVmResponse.class, description = "Starts an Instance.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StartVMCmd extends BaseAsyncCmd implements UserCmd { @@ -58,37 +58,37 @@ public class StartVMCmd extends BaseAsyncCmd implements UserCmd { // /////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class, - required = true, description = "The ID of the virtual machine") + required = true, description = "The ID of the Instance") private Long id; @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, - description = "destination Pod ID to deploy the VM to - parameter available for root admin only") + description = "Destination Pod ID to deploy the Instance to - parameter available for root admin only") private Long podId; @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, - description = "destination Cluster ID to deploy the VM to - parameter available for root admin only") + description = "Destination Cluster ID to deploy the Instance to - parameter available for root admin only") private Long clusterId; @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, - description = "destination Host ID to deploy the VM to - parameter available for root admin only", + description = "Destination Host ID to deploy the Instance to - parameter available for root admin only", since = "3.0.1") private Long hostId; @Parameter(name = ApiConstants.CONSIDER_LAST_HOST, type = CommandType.BOOLEAN, - description = "True by default, CloudStack will firstly try to start the VM on the last host where it run on before stopping, if destination host is not specified. " + - "If false, CloudStack will not consider the last host and start the VM by normal process.", + description = "True by default, CloudStack will firstly try to start the Instance on the last host where it run on before stopping, if destination host is not specified. " + + "If false, CloudStack will not consider the last host and start the Instance by normal process.", since = "4.18.0", authorized = {RoleType.Admin}) private Boolean considerLastHost; - @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin }) + @Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for Instance allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin }) private String deploymentPlanner; @Parameter(name = ApiConstants.BOOT_INTO_SETUP, type = CommandType.BOOLEAN, required = false, description = "Boot into hardware setup menu or not", since = "4.15.0.0") @@ -161,7 +161,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "starting user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Starting User Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -177,7 +177,7 @@ public Long getApiResourceId() { @Override public void execute() { try { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result; result = _userVmService.startVirtualMachine(this); @@ -187,7 +187,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start an Instance"); } } catch (ConcurrentOperationException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java index bfd5d8d07f61..232eeebd34be 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java @@ -37,7 +37,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops a virtual machine.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "stopVirtualMachine", responseObject = UserVmResponse.class, description = "Stops an Instance.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class StopVMCmd extends BaseAsyncCmd implements UserCmd { @@ -49,12 +49,12 @@ public class StopVMCmd extends BaseAsyncCmd implements UserCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=UserVmResponse.class, - required = true, description = "The ID of the virtual machine") + required = true, description = "The ID of the Instance") private Long id; - @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the VM " - + "(vm is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted)." - + " This option is to be used if the caller knows the VM is stopped and should be marked as such.") + @Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force stop the Instance " + + "(Instance is marked as Stopped even when command fails to be send to the backend, otherwise a force poweroff is attempted)." + + " This option is to be used if the caller knows the Instance is stopped and should be marked as such.") private Boolean forced; // /////////////////////////////////////////////////// @@ -96,7 +96,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "stopping user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()); + return "Stopping User Instance with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -115,7 +115,7 @@ public boolean isForced() { @Override public void execute() throws ServerApiException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); UserVm result; result = _userVmService.stopVirtualMachine(getId(), isForced()); @@ -125,7 +125,7 @@ public void execute() throws ServerApiException, ConcurrentOperationException { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java index 837bde06a6ca..011edb1a9df4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java @@ -19,8 +19,6 @@ import java.util.ArrayList; import java.util.EnumSet; -import com.cloud.vm.Nic; - import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -41,7 +39,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on a VM", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "updateDefaultNicForVirtualMachine", description = "Changes the default NIC on an Instance", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "updatedefaultnicforvirtualmachineresponse"; @@ -52,7 +50,7 @@ public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd implements UserCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="Virtual Machine ID") + required=true, description = "Instance ID") private Long vmId; @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID") @@ -90,7 +88,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Updating NIC " + this._uuidMgr.getUuid(Nic.class, getNicId()) + " on user vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()); + return "Setting NIC " + getResourceUuid(ApiConstants.NIC_ID) + " as default to User Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -104,7 +102,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID) + " NIC ID: " + getResourceUuid(ApiConstants.NIC_ID)); UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); @@ -114,7 +112,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default nic for VM. Refer to server logs for details."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default NIC for Instance. Refer to server logs for details."); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java index 0f5dade96d25..a5f06e6ecbb3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java @@ -16,20 +16,20 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.uservm.UserVm; +import com.cloud.utils.StringUtils; import com.cloud.utils.exception.CloudRuntimeException; - -import org.apache.cloudstack.api.ApiArgValidator; -import org.apache.cloudstack.api.response.UserDataResponse; - +import com.cloud.utils.net.Dhcp; +import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiArgValidator; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; @@ -40,19 +40,20 @@ import org.apache.cloudstack.api.command.user.UserCmd; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.UserDataResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.vm.lease.VMLeaseManager; +import org.apache.commons.lang3.EnumUtils; -import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.user.Account; -import com.cloud.uservm.UserVm; -import com.cloud.utils.net.Dhcp; -import com.cloud.vm.VirtualMachine; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -@APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " + - "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " + - "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "updateVirtualMachine", description = "Updates properties of an Instance. The Instance has to be stopped and restarted for the " + + "new properties to take effect. UpdateVirtualMachine does not first check whether the Instance is stopped. " + + "Therefore, stop the Instance manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, UserCmd { private static final String s_name = "updatevirtualmachineresponse"; @@ -61,29 +62,29 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "user generated name") + @Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "User generated name") private String displayName; - @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "group of the virtual machine") + @Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "Group of the Instance") private String group; - @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "true if high-availability is enabled for the virtual machine, false otherwise") + @Parameter(name = ApiConstants.HA_ENABLE, type = CommandType.BOOLEAN, description = "True if high-availability is enabled for the Instance, false otherwise") private Boolean haEnable; @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; @Parameter(name = ApiConstants.OS_TYPE_ID, type = CommandType.UUID, entityType = GuestOSResponse.class, - description = "the ID of the OS type that best represents this VM.") + description = "The ID of the OS type that best represents this Instance.") private Long osTypeId; @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, - description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. " + + description = "An optional binary data that can be sent to the Instance upon a successful deployment. " + "This binary data must be base64 encoded before adding it to the request. " + "Using HTTP GET (via querystring), you can send up to 4KB of data after base64 encoding. " + "Using HTTP POST (via POST body), you can send up to 1MB of data after base64 encoding. " + @@ -92,24 +93,24 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, since = "4.16.0") private String userData; - @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "the ID of the userdata", since = "4.18") + @Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, description = "The ID of the userdata", since = "4.18") private Long userdataId; - @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "used to specify the parameters values for the variables in userdata.", since = "4.18") + @Parameter(name = ApiConstants.USER_DATA_DETAILS, type = CommandType.MAP, description = "Used to specify the parameters values for the variables in userdata.", since = "4.18") private Map userdataDetails; - @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.DISPLAY_VM, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the Instance to the end User or not.", authorized = {RoleType.Admin}) private Boolean displayVm; @Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE, type = CommandType.BOOLEAN, - description = "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory. This can be updated only when dynamic scaling is enabled on template, service offering and the corresponding global setting") + description = "True if Instance contains XS/VMWare tools in order to support dynamic scaling of Instance cpu/memory. This can be updated only when dynamic scaling is enabled on Template, service offering and the corresponding global setting") protected Boolean isDynamicallyScalable; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new host name of the vm. The VM has to be stopped/started for this update to take affect", validations = {ApiArgValidator.RFCComplianceDomainName}, since = "4.4") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "New host name of the Instance. The Instance has to be stopped/started for this update to take affect", validations = {ApiArgValidator.RFCComplianceDomainName}, since = "4.4") private String name; - @Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "instance name of the user vm", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "Instance name of the User Instance", since = "4.4", authorized = {RoleType.Admin}) private String instanceName; @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs. 'extraconfig' is not allowed to be passed in details.") @@ -120,7 +121,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = SecurityGroupResponse.class, - description = "list of security group ids to be applied on the virtual machine.") + description = "List of security group ids to be applied on the Instance.") private List securityGroupIdList; @ACL @@ -128,22 +129,22 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, type = CommandType.LIST, collectionType = CommandType.STRING, entityType = SecurityGroupResponse.class, - description = "comma separated list of security groups names that going to be applied to the virtual machine. " + - "Should be passed only when vm is created from a zone with Basic Network support. " + + description = "Comma separated list of security groups names that going to be applied to the Instance. " + + "Should be passed only when Instance is created from a zone with Basic Network support. " + "Mutually exclusive with securitygroupids parameter" ) private List securityGroupNameList; @Parameter(name = ApiConstants.CLEAN_UP_DETAILS, type = CommandType.BOOLEAN, - description = "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)") + description = "Optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)") private Boolean cleanupDetails; - @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the VM on start up" + @Parameter(name = ApiConstants.DHCP_OPTIONS_NETWORK_LIST, type = CommandType.MAP, description = "DHCP options which are passed to the Instance on start up" + " Example: dhcpoptionsnetworklist[0].dhcp:114=url&dhcpoptionsetworklist[0].networkid=networkid&dhcpoptionsetworklist[0].dhcp:66=www.test.com") private Map dhcpOptionsNetworkList; - @Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "an optional URL encoded string that can be passed to the virtual machine upon successful deployment", length = 5120) + @Parameter(name = ApiConstants.EXTRA_CONFIG, type = CommandType.STRING, since = "4.12", description = "An optional URL encoded string that can be passed to the Instance upon successful deployment", length = 5120) private String extraConfig; @Parameter(name = ApiConstants.DELETE_PROTECTION, @@ -154,11 +155,28 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction, " autoscaling groups or CKS, delete protection will be ignored.") private Boolean deleteProtection; + @Parameter(name = ApiConstants.INSTANCE_LEASE_DURATION, type = CommandType.INTEGER, since = "4.21.0", + description = "Number of days to lease the instance from now onward. Use -1 to remove the existing lease") + private Integer leaseDuration; + + @Parameter(name = ApiConstants.INSTANCE_LEASE_EXPIRY_ACTION, type = CommandType.STRING, since = "4.21.0", + description = "Lease expiry action, valid values are STOP and DESTROY") + private String leaseExpiryAction; + + @Parameter(name = ApiConstants.CLEAN_UP_EXTRA_CONFIG, type = CommandType.BOOLEAN, since = "4.23.0", + description = "Optional boolean field, which indicates if extraconfig for the instance should be " + + "cleaned up or not (If set to true, extraconfig removed for this instance, extraconfig field " + + "ignored; if false or not set, no action)") + private Boolean cleanupExtraConfig; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// public String getDisplayName() { + if (StringUtils.isBlank(displayName)) { + displayName = name; + } return displayName; } @@ -236,7 +254,7 @@ public Map> getDhcpOptionsMap() { String networkId = dhcpNetworkOptions.get(ApiConstants.NETWORK_ID); if(networkId == null) { - throw new IllegalArgumentException("No networkid specified when providing extra dhcp options."); + throw new IllegalArgumentException("No networkid specified when providing extra DHCP options."); } Map dhcpOptionsForNetwork = new HashMap<>(); @@ -262,14 +280,26 @@ public String getExtraConfig() { return extraConfig; } - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - public Long getOsTypeId() { return osTypeId; } + public boolean isCleanupExtraConfig() { + return Boolean.TRUE.equals(cleanupExtraConfig); + } + + public void setId(Long id) { + this.id = id; + } + + public void setSecurityGroupIdList(List securityGroupIdList) { + this.securityGroupIdList = securityGroupIdList; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override public String getCommandName() { return s_name; @@ -291,19 +321,19 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + ApiConstants.ID); UserVm result = null; try { result = _userVmService.updateVirtualMachine(this); } catch (CloudRuntimeException e) { - throw new CloudRuntimeException(String.format("Failed to update VM, due to: %s", e.getLocalizedMessage()), e); + throw new CloudRuntimeException(String.format("Failed to update Instance, due to: %s", e.getLocalizedMessage()), e); } if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Instance"); } } @@ -324,4 +354,21 @@ public Long getApiResourceId() { public ApiCommandResourceType getApiResourceType() { return ApiCommandResourceType.VirtualMachine; } + + public Integer getLeaseDuration() { + return leaseDuration; + } + + public VMLeaseManager.ExpiryAction getLeaseExpiryAction() { + if (StringUtils.isBlank(leaseExpiryAction)) { + return null; + } + VMLeaseManager.ExpiryAction action = EnumUtils.getEnumIgnoreCase(VMLeaseManager.ExpiryAction.class, leaseExpiryAction); + if (action == null) { + throw new InvalidParameterValueException("Invalid value configured for leaseexpiryaction, valid values are: " + + com.cloud.utils.EnumUtils.listValues(VMLeaseManager.ExpiryAction.values())); + } + return action; + } + } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMScheduleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMScheduleCmd.java index 72f85c1a99ce..b7222944fe07 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMScheduleCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMScheduleCmd.java @@ -32,7 +32,7 @@ import javax.inject.Inject; import java.util.Date; -@APICommand(name = "updateVMSchedule", description = "Update VM Schedule.", responseObject = VMScheduleResponse.class, +@APICommand(name = "updateVMSchedule", description = "Update Instance Schedule.", responseObject = VMScheduleResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0", authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) public class UpdateVMScheduleCmd extends BaseCmd { @@ -43,7 +43,7 @@ public class UpdateVMScheduleCmd extends BaseCmd { type = CommandType.UUID, entityType = VMScheduleResponse.class, required = true, - description = "ID of VM schedule") + description = "ID of Instance schedule") private Long id; @Parameter(name = ApiConstants.DESCRIPTION, @@ -55,7 +55,7 @@ public class UpdateVMScheduleCmd extends BaseCmd { @Parameter(name = ApiConstants.SCHEDULE, type = CommandType.STRING, required = false, - description = "Schedule for action on VM in cron format. e.g. '0 15 10 * *' for 'at 15:00 on 10th day of every month'") + description = "Schedule for action on Instance in cron format. e.g. '0 15 10 * *' for 'at 15:00 on 10th day of every month'") private String schedule; @Parameter(name = ApiConstants.TIMEZONE, @@ -67,21 +67,21 @@ public class UpdateVMScheduleCmd extends BaseCmd { @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, required = false, - description = "start date from which the schedule becomes active" + description = "Start date from which the schedule becomes active" + "Use format \"yyyy-MM-dd hh:mm:ss\")") private Date startDate; @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, required = false, - description = "end date after which the schedule becomes inactive" + description = "End date after which the schedule becomes inactive" + "Use format \"yyyy-MM-dd hh:mm:ss\")") private Date endDate; @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = false, - description = "Enable VM schedule") + description = "Enable Instance schedule") private Boolean enabled; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicCmd.java new file mode 100644 index 000000000000..363273a4670d --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicCmd.java @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.vm; + +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NicResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.context.CallContext; + +import com.cloud.event.EventTypes; +import com.cloud.user.Account; +import com.cloud.uservm.UserVm; + +import java.util.ArrayList; +import java.util.EnumSet; + +@APICommand(name = "updateVmNic", description = "Updates the specified VM NIC", responseObject = NicResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, + authorized = { RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User }) +public class UpdateVmNicCmd extends BaseAsyncCmd { + + @ACL + @Parameter(name = ApiConstants.NIC_ID, type = CommandType.UUID, entityType = NicResponse.class, required = true, description = "NIC ID") + private Long nicId; + + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "If true, sets the NIC state to UP; otherwise, sets the NIC state to DOWN") + private Boolean enabled; + + public Long getNicId() { + return nicId; + } + + public Boolean isEnabled() { + return enabled; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NIC_UPDATE; + } + + @Override + public String getEventDescription() { + return String.format("Updating NIC %s.", getResourceUuid(ApiConstants.NIC_ID)); + } + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmByNicId(nicId); + if (vm == null) { + return Account.ACCOUNT_ID_SYSTEM; + } + return vm.getAccountId(); + } + + @Override + public void execute() { + CallContext.current().setEventDetails(String.format("NIC ID: %s", getResourceUuid(ApiConstants.NIC_ID))); + + UserVm result = _userVmService.updateVirtualMachineNic(this); + + ArrayList dc = new ArrayList<>(); + dc.add(ApiConstants.VMDetails.valueOf("nics")); + EnumSet details = EnumSet.copyOf(dc); + + if (result != null){ + UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseObject.ResponseView.Restricted, "virtualmachine", details, result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update NIC from VM."); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java index 5c654701de91..6da34c7ef0b0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVmNicIpCmd.java @@ -46,14 +46,14 @@ import com.cloud.utils.net.NetUtils; import com.cloud.vm.Nic; -@APICommand(name = "updateVmNicIp", description = "Update the default Ip of a VM Nic", responseObject = UserVmResponse.class) +@APICommand(name = "updateVmNicIp", description = "Update the default IP of an Instance NIC", responseObject = UserVmResponse.class) public class UpdateVmNicIpCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType = NicResponse.class, required = true, - description="the ID of the nic to which you want to assign private IP") + description = "The ID of the NIC to which you want to assign private IP") private Long nicId; @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = false, @@ -79,7 +79,7 @@ public long getDomainId() { private long getZoneId() { Network ntwk = _entityMgr.findById(Network.class, getNetworkId()); if (ntwk == null) { - throw new InvalidParameterValueException("Can't find zone id for specified"); + throw new InvalidParameterValueException("Can't find zone ID for specified"); } return ntwk.getDataCenterId(); } @@ -87,7 +87,7 @@ private long getZoneId() { public Long getNetworkId() { Nic nic = _entityMgr.findById(Nic.class, nicId); if (nic == null) { - throw new InvalidParameterValueException("Can't find network id for specified nic"); + throw new InvalidParameterValueException("Can't find Network ID for specified NIC"); } Long networkId = nic.getNetworkId(); return networkId; @@ -123,7 +123,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "associating ip to nic id: " + this._uuidMgr.getUuid(Network.class, getNetworkId()) + " in zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()); + return "Associating IP to NIC with ID: " + getResourceUuid(ApiConstants.NIC_ID) + " in zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()); } ///////////////////////////////////////////////////// @@ -139,11 +139,11 @@ public static String getResultObjectName() { public void execute() throws ResourceUnavailableException, ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException { - CallContext.current().setEventDetails("Nic Id: " + getNicId() ); + CallContext.current().setEventDetails("NIC ID: " + getResourceUuid(ApiConstants.NIC_ID)); String ip; if ((ip = getIpaddress()) != null) { if (!NetUtils.isValidIp4(ip)) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid ip address " + ip); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Invalid IP address " + ip); } } @@ -156,7 +156,7 @@ public void execute() throws ResourceUnavailableException, ResourceAllocationExc response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update ip address on vm NIC. Refer to server logs for details."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update IP address on Instance NIC. Refer to server logs for details."); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java index 6a7422e70bbb..83908802a690 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java @@ -41,8 +41,8 @@ import com.cloud.vm.VirtualMachine; @Deprecated(since = "4.18") -@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description="(This API is deprecated, use scaleVirtualMachine API)" + - "Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for " + +@APICommand(name = "changeServiceForVirtualMachine", responseObject=UserVmResponse.class, description = "(This API is deprecated, use scaleVirtualMachine API)" + + "Changes the service offering for an Instance. The Instance must be in a \"Stopped\" state for " + "this command to take effect.", responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class UpgradeVMCmd extends BaseCmd implements UserCmd { @@ -54,14 +54,14 @@ public class UpgradeVMCmd extends BaseCmd implements UserCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description="The ID of the virtual machine") + required=true, description = "The ID of the Instance") private Long id; @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class, - required=true, description="the service offering ID to apply to the virtual machine") + required=true, description = "The service offering ID to apply to the Instance") protected Long serviceOfferingId; - @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") + @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Name value pairs of custom parameters for cpuspeed, memory and cpunumber. example details[i].name=value") private Map details; @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "New minimum number of IOPS for the custom disk offering", since = "4.17") @@ -139,7 +139,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceAllocationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.ID)); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { @@ -153,7 +153,7 @@ public void execute() throws ResourceAllocationException { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade Instance"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java index e2952b5bd818..12f534e1a221 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java @@ -30,7 +30,7 @@ import com.cloud.vm.InstanceGroup; -@APICommand(name = "createInstanceGroup", description = "Creates a vm group", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, +@APICommand(name = "createInstanceGroup", description = "Creates an Instance group", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVMGroupCmd extends BaseCmd { @@ -39,21 +39,21 @@ public class CreateVMGroupCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the instance group") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Instance group") private String groupName; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, - description = "the account of the instance group. The account parameter must be used with the domainId parameter.") + description = "The account of the Instance group. The account parameter must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID of account owning the instance group") + description = "The domain ID of account owning the Instance group") private Long domainId; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "The project of the instance group") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "The project of the Instance group") private Long projectId; // /////////////////////////////////////////////////// @@ -82,7 +82,7 @@ public Long getProjectId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -98,7 +98,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Instance Instance group"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java index b74bc43eeb7a..b07084a273c5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java @@ -31,7 +31,7 @@ import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; -@APICommand(name = "deleteInstanceGroup", description = "Deletes a vm group", responseObject = SuccessResponse.class, entityType = {InstanceGroup.class}, +@APICommand(name = "deleteInstanceGroup", description = "Deletes an Instance group", responseObject = SuccessResponse.class, entityType = {InstanceGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVMGroupCmd extends BaseCmd { @@ -40,7 +40,7 @@ public class DeleteVMGroupCmd extends BaseCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, required = true, description = "the ID of the instance group") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, required = true, description = "The ID of the Instance group") private Long id; ///////////////////////////////////////////////////// @@ -72,7 +72,7 @@ public void execute() { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Instance group"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java index 31845a956e92..ee918944046f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java @@ -26,7 +26,7 @@ import com.cloud.vm.InstanceGroup; -@APICommand(name = "listInstanceGroups", description = "Lists vm groups", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, +@APICommand(name = "listInstanceGroups", description = "Lists Instance groups", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -35,10 +35,10 @@ public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "list instance groups by ID") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, description = "List Instance groups by ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list instance groups by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List Instance groups by name") private String groupName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java index 5c553f064042..d63a5aea6dea 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java @@ -30,7 +30,7 @@ import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; -@APICommand(name = "updateInstanceGroup", description = "Updates a vm group", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, +@APICommand(name = "updateInstanceGroup", description = "Updates an Instance group", responseObject = InstanceGroupResponse.class, entityType = {InstanceGroup.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVMGroupCmd extends BaseCmd { @@ -42,7 +42,7 @@ public class UpdateVMGroupCmd extends BaseCmd { @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = InstanceGroupResponse.class, required = true, description = "Instance group ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new instance group name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "New Instance group name") private String groupName; ///////////////////////////////////////////////////// @@ -79,7 +79,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm instance group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Instance group"); } } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java index 18a478e9daec..d3128599b616 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java @@ -34,28 +34,27 @@ import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.uservm.UserVm; -import com.cloud.vm.VirtualMachine; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, +@APICommand(name = "createVMSnapshot", description = "Creates Snapshot for an Instance.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd { @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType = UserVmResponse.class, description = "The ID of the vm") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType = UserVmResponse.class, description = "The ID of the Instance") private Long vmId; - @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The description of the snapshot") + @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The description of the Snapshot") private String description; - @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot") + @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the Snapshot") private String displayName; - @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true") + @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "Snapshot memory if true") private Boolean snapshotMemory; - @Parameter(name = ApiConstants.VM_SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "quiesce vm if true") + @Parameter(name = ApiConstants.VM_SNAPSHOT_QUIESCEVM, type = CommandType.BOOLEAN, required = false, description = "Quiesce Instance if true") private Boolean quiescevm; public Boolean snapshotMemory() { @@ -92,20 +91,20 @@ public void create() throws ResourceAllocationException { try { vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(), getDisplayName(), getDescription(), snapshotMemory()); } catch (CloudRuntimeException e) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot: " + e.getMessage(), e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Instance Snapshot: " + e.getMessage(), e); } if (vmsnapshot != null) { setEntityId(vmsnapshot.getId()); setEntityUuid(vmsnapshot.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Instance Snapshot"); } } @Override public String getEventDescription() { - return "creating snapshot for VM: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()); + return "Creating Snapshot for Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override @@ -115,14 +114,14 @@ public String getEventType() { @Override public void execute() { - CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId())); + CallContext.current().setEventDetails("Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID)); VMSnapshot result = _vmSnapshotService.createVMSnapshot(getVmId(), getEntityId(), getQuiescevm()); if (result != null) { VMSnapshotResponse response = _responseGenerator.createVMSnapshotResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm snapshot due to an internal error creating snapshot for vm " + getVmId()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Instance Snapshot due to an internal error creating Snapshot for Instance " + getVmId()); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java index 94b8824f8685..3373ac534cc8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java @@ -35,7 +35,7 @@ import com.cloud.user.Account; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, +@APICommand(name = "deleteVMSnapshot", description = "Deletes an Instance Snapshot.", responseObject = SuccessResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVMSnapshotCmd extends BaseAsyncCmd { @@ -44,7 +44,7 @@ public class DeleteVMSnapshotCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = VMSnapshotResponse.class, required = true, - description = "The ID of the VM snapshot") + description = "The ID of the Instance Snapshot") private Long id; public Long getId() { @@ -62,19 +62,19 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getId())); + CallContext.current().setEventDetails("Instance Snapshot ID: " + getResourceUuid(ApiConstants.VM_SNAPSHOT_ID)); boolean result = _vmSnapshotService.deleteVMSnapshot(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Instance Snapshot"); } } @Override public String getEventDescription() { - return "Delete VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getId()); + return "Deleting Instance Snapshot with ID: " + getResourceUuid(ApiConstants.VM_SNAPSHOT_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java index 87dd6e0b4789..b5d603e000c1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java @@ -31,24 +31,24 @@ import com.cloud.utils.Pair; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, +@APICommand(name = "listVMSnapshot", description = "List Instance Snapshot by conditions", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd { - @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, entityType = VMSnapshotResponse.class, description = "The ID of the VM snapshot") + @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, entityType = VMSnapshotResponse.class, description = "The ID of the Instance Snapshot") private Long id; - @Parameter(name=ApiConstants.VM_SNAPSHOT_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=VMSnapshotResponse.class, description="the IDs of the vm snapshots, mutually exclusive with vmsnapshotid", since = "4.9") + @Parameter(name=ApiConstants.VM_SNAPSHOT_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=VMSnapshotResponse.class, description = "The IDs of the Instance Snapshots, mutually exclusive with vmsnapshotid", since = "4.9") private List ids; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the virtual machine snapshot") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "State of the Instance Snapshot") private String state; - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the vm") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the Instance") private Long vmId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name or display name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Lists Snapshot by Snapshot name or display name") private String vmSnapshotName; public String getState() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java index 310b45687d49..d44cefca5027 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToVMSnapshotCmd.java @@ -41,7 +41,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.snapshot.VMSnapshot; -@APICommand(name = "revertToVMSnapshot", description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Restricted, +@APICommand(name = "revertToVMSnapshot", description = "Revert Instance from a vmsnapshot.", responseObject = UserVmResponse.class, since = "4.2.0", responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true) public class RevertToVMSnapshotCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "reverttovmsnapshotresponse"; @@ -51,7 +51,7 @@ public class RevertToVMSnapshotCmd extends BaseAsyncCmd implements UserCmd { type = CommandType.UUID, required = true, entityType = VMSnapshotResponse.class, - description = "The ID of the vm snapshot") + description = "The ID of the Instance Snapshot") private Long vmSnapShotId; public Long getVmSnapShotId() { @@ -74,7 +74,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException { - CallContext.current().setEventDetails("vmsnapshot id: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId())); + CallContext.current().setEventDetails("Instance Snapshot ID: " + getResourceUuid(ApiConstants.VM_SNAPSHOT_ID)); UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId()); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), @@ -82,13 +82,13 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacity response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert VM snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revert Instance Snapshot"); } } @Override public String getEventDescription() { - return "Revert from VM snapshot: " + this._uuidMgr.getUuid(VMSnapshot.class, getVmSnapShotId()); + return "Reverting from Instance Snapshot with ID: " + getResourceUuid(ApiConstants.VM_SNAPSHOT_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java index 287991fa9846..9e1c1056fdf9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AddResourceDetailCmd.java @@ -40,13 +40,13 @@ public class AddResourceDetailCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = true, description = "Map of (key/value pairs)") private Map details; - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "type of the resource") + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, required = true, description = "Type of the resource") private String resourceType; - @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, required = true, collectionType = CommandType.STRING, description = "resource id to create the details for") + @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, required = true, collectionType = CommandType.STRING, description = "Resource ID to create the details for") private String resourceId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "pass false if you want this detail to be disabled for the regular user. True by default", since = "4.4") + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "Pass false if you want this detail to be disabled for the regular User. True by default", since = "4.4") private Boolean display; ///////////////////////////////////////////////////// @@ -90,7 +90,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "adding details to the resource "; + return "Adding details to the resource "; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AssignVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AssignVolumeCmd.java index 1a51aa03c226..f50abaf73c96 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AssignVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AssignVolumeCmd.java @@ -34,7 +34,7 @@ import java.util.Map; -@APICommand(name = AssignVolumeCmd.CMD_NAME, responseObject = VolumeResponse.class, description = "Changes ownership of a Volume from one account to another.", entityType = { +@APICommand(name = AssignVolumeCmd.CMD_NAME, responseObject = VolumeResponse.class, description = "Changes ownership of a Volume from one Account to another.", entityType = { Volume.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.18.0.0") public class AssignVolumeCmd extends BaseCmd implements UserCmd { public static final String CMD_NAME = "assignVolume"; @@ -47,7 +47,7 @@ public class AssignVolumeCmd extends BaseCmd implements UserCmd { private Long volumeId; @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, - description = "The ID of the account to which the volume will be assigned. Mutually exclusive with parameter 'projectid'.") + description = "The ID of the Account to which the volume will be assigned. Mutually exclusive with parameter 'projectid'.") private Long accountId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, @@ -70,6 +70,21 @@ public Long getProjectid() { return projectid; } + ///////////////////////////////////////////////////// + /////////////////// Setter/////////////////////////// + ///////////////////////////////////////////////////// + public void setVolumeId(Long volumeId) { + this.volumeId = volumeId; + } + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + public void setProjectId(Long projectid) { + this.projectid = projectid; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -81,7 +96,7 @@ public void execute() { if (result == null) { Map fullParams = getFullUrlParams(); if (accountId != null) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move volume [%s] to account [%s].", fullParams.get(ApiConstants.VOLUME_ID), + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move volume [%s] to Account [%s].", fullParams.get(ApiConstants.VOLUME_ID), fullParams.get(ApiConstants.ACCOUNT_ID))); } throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move volume [%s] to project [%s].", fullParams.get(ApiConstants.VOLUME_ID), diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java index 1a3b9220877f..8624043afc51 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java @@ -37,7 +37,7 @@ import com.cloud.user.Account; import com.cloud.vm.VirtualMachine; -@APICommand(name = "attachVolume", description = "Attaches a disk volume to a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "attachVolume", description = "Attaches a disk volume to an Instance.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AttachVolumeCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "attachvolumeresponse"; @@ -52,12 +52,12 @@ public class AttachVolumeCmd extends BaseAsyncCmd implements UserCmd { + "Please refer to the docs of your hypervisor for the correct mapping of the deviceID and the actual logical disk structure.") private Long deviceId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the disk volume") private Long id; @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, - required=true, description=" the ID of the virtual machine") + required=true, description = " the ID of the Instance") private Long virtualMachineId; ///////////////////////////////////////////////////// @@ -111,12 +111,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "attaching volume: " + this._uuidMgr.getUuid(Volume.class, getId()) + " to vm: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()); + return "Attaching volume with ID: " + getResourceUuid(ApiConstants.ID) + " to Instance with ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()) + " VmId: " + this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId())); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID) + " Instance ID: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID)); Volume result = _volumeService.attachVolumeToVM(this); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(getResponseView(), result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ChangeOfferingForVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ChangeOfferingForVolumeCmd.java index 404a02b04b8b..c8cda7e1c19c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ChangeOfferingForVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ChangeOfferingForVolumeCmd.java @@ -22,7 +22,6 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.offering.DiskOffering; import com.cloud.storage.Volume; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.APICommand; @@ -50,14 +49,14 @@ public class ChangeOfferingForVolumeCmd extends BaseAsyncCmd implements UserCmd //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, entityType = VolumeResponse.class, required = true, type = CommandType.UUID, description = "the ID of the volume") + @Parameter(name = ApiConstants.ID, entityType = VolumeResponse.class, required = true, type = CommandType.UUID, description = "The ID of the volume") private Long id; @Parameter(name = ApiConstants.DISK_OFFERING_ID, entityType = DiskOfferingResponse.class, type = CommandType.UUID, required = true, - description = "new disk offering id") + description = "New disk offering ID") private Long newDiskOfferingId; @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, required = false, description = "New volume size in GB for the custom disk offering") @@ -130,12 +129,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "Changing Disk offering of Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()) + " to " + this._uuidMgr.getUuid(DiskOffering.class, getNewDiskOfferingId()); + return "Changing disk offering of volume with ID: " + getResourceUuid(ApiConstants.ID) + " to " + getResourceUuid(ApiConstants.DISK_OFFERING_ID); } @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { - CallContext.current().setEventDetails("Volume Id: " + getId()); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.changeDiskOfferingForVolume(this); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseObject.ResponseView.Restricted, result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java index 56fdf6bc126c..fdbd4a61c072 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CheckAndRepairVolumeCmd.java @@ -105,7 +105,7 @@ public String getEventType() { @Override public String getEventDescription() { - return String.format("check and repair operation on volume: %s", this._uuidMgr.getUuid(Volume.class, getId())); + return "Starting checking and repairing operation on volume: " + getResourceUuid(ApiConstants.ID); } @Override @@ -120,7 +120,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() throws ResourceAllocationException { - CallContext.current().setEventDetails("Volume Id: " + getId()); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Pair result = _volumeService.checkAndRepairVolume(this); Volume volume = _responseGenerator.findVolumeById(getId()); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java index 7ffcea50b219..ec7a626fa156 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java @@ -32,6 +32,7 @@ import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; @@ -43,7 +44,7 @@ import com.cloud.storage.Volume; import com.cloud.vm.VirtualMachine; -@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.", responseView = ResponseView.Restricted, entityType = { +@APICommand(name = "createVolume", responseObject = VolumeResponse.class, description = "Creates a disk volume from a disk offering. This disk volume must still be attached to an Instance to make use of it.", responseView = ResponseView.Restricted, entityType = { Volume.class, VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserCmd { @@ -55,60 +56,68 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC @Parameter(name = ApiConstants.ACCOUNT, type = BaseCmd.CommandType.STRING, - description = "the account associated with the disk volume. Must be used with the domainId parameter.") + description = "The Account associated with the disk volume. Must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "the project associated with the volume. Mutually exclusive with account parameter") + description = "The project associated with the volume. Mutually exclusive with Account parameter") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID associated with the disk offering. If used with the account parameter" - + " returns the disk volume associated with the account for the specified domain." + - "If account is NOT provided then the volume will be assigned to the caller account and domain.") + description = "The domain ID associated with the disk offering. If used with the Account parameter" + + " returns the disk volume associated with the Account for the specified domain." + + "If account is NOT provided then the volume will be assigned to the caller Account and domain.") private Long domainId; @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, - description = "the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.") + description = "The ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.") private Long diskOfferingId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the disk volume") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the disk volume") private String volumeName; @Parameter(name = ApiConstants.SIZE, type = CommandType.LONG, description = "Arbitrary volume size") private Long size; - @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, description = "min iops") + @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, description = "Min IOPS") private Long minIops; - @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, description = "max iops") + @Parameter(name = ApiConstants.MAX_IOPS, type = CommandType.LONG, description = "Max IOPS") private Long maxIops; @Parameter(name = ApiConstants.SNAPSHOT_ID, type = CommandType.UUID, entityType = SnapshotResponse.class, - description = "the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.") + description = "The Snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.") private Long snapshotId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the availability zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The ID of the availability zone") private Long zoneId; - @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "an optional field, whether to display the volume to the end user or not.", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "An optional field, whether to display the volume to the end User or not.", authorized = {RoleType.Admin}) private Boolean displayVolume; @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "the ID of the virtual machine; to be used with snapshot Id, VM to which the volume gets attached after creation") + description = "The ID of the Instance; to be used with snapshot Id, Instance to which the volume gets attached after creation") private Long virtualMachineId; + @Parameter(name = ApiConstants.STORAGE_ID, + type = CommandType.UUID, + entityType = StoragePoolResponse.class, + description = "Storage pool ID to create the volume in. Cannot be used with the snapshotid parameter.", + authorized = {RoleType.Admin}, + since = "4.22.1") + private Long storageId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -142,6 +151,10 @@ public Long getMaxIops() { } public Long getSnapshotId() { + if (storageId != null && snapshotId != null) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, + "Snapshot ID cannot be specified with the Storage ID."); + } return snapshotId; } @@ -153,6 +166,14 @@ private Long getProjectId() { return projectId; } + public Long getStorageId() { + if (snapshotId != null && storageId != null) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, + "Storage ID cannot be specified with the Snapshot ID."); + } + return storageId; + } + public Boolean getDisplayVolume() { return displayVolume; } @@ -188,7 +209,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -203,7 +224,17 @@ public String getEventType() { @Override public String getEventDescription() { - return "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId())); + String description = "Creating volume "; + + if (getVolumeName() != null) { + description += getVolumeName(); + } + + if (getSnapshotId() != null) { + description += " from Snapshot: " + getResourceUuid(ApiConstants.SNAPSHOT_ID); + } + + return description; } @Override @@ -220,7 +251,7 @@ public void create() throws ResourceAllocationException { @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + getEntityUuid() + ((getSnapshotId() == null) ? "" : " from snapshot: " + this._uuidMgr.getUuid(Snapshot.class, getSnapshotId()))); + CallContext.current().setEventDetails("Volume ID: " + getEntityUuid() + ((getSnapshotId() == null) ? "" : " from Snapshot with ID: " + getResourceUuid(ApiConstants.SNAPSHOT_ID))); Volume volume = _volumeService.createVolume(this); if (volume != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(getResponseView(), volume); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java index 6111488a8021..e102d51f0378 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java @@ -43,7 +43,7 @@ public class DeleteVolumeCmd extends BaseCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, - required=true, description="The ID of the disk volume") + required=true, description = "The ID of the disk volume") private Long id; ///////////////////////////////////////////////////// @@ -84,7 +84,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() throws ConcurrentOperationException { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId())); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.destroyVolume(id, CallContext.current().getCallingAccount(), true, false); if (result != null) { SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DestroyVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DestroyVolumeCmd.java index 2eafb76e5915..12a44f76ea15 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DestroyVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DestroyVolumeCmd.java @@ -50,7 +50,7 @@ public class DestroyVolumeCmd extends BaseAsyncCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, - required=true, description="The ID of the volume") + required=true, description = "The ID of the volume") private Long id; @Parameter(name = ApiConstants.EXPUNGE, @@ -100,7 +100,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "destroying volume: " + getId(); + return "Destroying volume with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -115,7 +115,7 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + getId()); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.destroyVolume(getId(), CallContext.current().getCallingAccount(), getExpunge(), false); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java index 2fddcace84dd..f6e811da6055 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java @@ -38,7 +38,7 @@ import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; -@APICommand(name = "detachVolume", description = "Detaches a disk volume from a virtual machine.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, +@APICommand(name = "detachVolume", description = "Detaches a disk volume from an Instance.", responseObject = VolumeResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DetachVolumeCmd extends BaseAsyncCmd implements UserCmd { private static final String s_name = "detachvolumeresponse"; @@ -48,17 +48,17 @@ public class DetachVolumeCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, - description="the ID of the disk volume") + description= " The ID of the disk volume") private Long id; - @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.LONG, description = "the device ID on the virtual machine where volume is detached from") + @Parameter(name = ApiConstants.DEVICE_ID, type = CommandType.LONG, description = "The device ID on the Instance where volume is detached from") private Long deviceId; @ACL(accessType = AccessType.OperateEntry) @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, - description = "the ID of the virtual machine where the volume is detached from") + description = "The ID of the Instance where the volume is detached from") private Long virtualMachineId; ///////////////////////////////////////////////////// @@ -77,6 +77,10 @@ public Long getVirtualMachineId() { return virtualMachineId; } + public void setId(Long id) { + this.id = id; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -126,15 +130,19 @@ public String getEventType() { @Override public String getEventDescription() { - StringBuilder sb = new StringBuilder(); + String description = "Detaching volume"; + if (id != null) { - sb.append(": " + this._uuidMgr.getUuid(Volume.class, id)); - } else if ((deviceId != null) && (virtualMachineId != null)) { - sb.append(" with device id: " + deviceId + " from vm: " + ((getVirtualMachineId() != null) ? this._uuidMgr.getUuid(VirtualMachine.class, getVirtualMachineId()) : "" )); + description += ": " + getResourceUuid(ApiConstants.ID); + } + + if ((deviceId != null) && (virtualMachineId != null)) { + description += " with device id: " + deviceId + " from Instance: " + getResourceUuid(ApiConstants.VIRTUAL_MACHINE_ID); } else { - sb.append(" "); + description += " "; } - return "detaching volume" + sb.toString(); + + return description; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java index 9445aba23c06..f50d23a6b60c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java @@ -16,7 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; - import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; @@ -46,20 +45,20 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { @ACL(accessType = AccessType.OperateEntry) @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, - required=true, description="the ID of the volume") + required=true, description = "The ID of the volume") private Long id; - @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "the url to which the volume would be extracted") + @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = false, length = 2048, description = "The URL to which the volume would be extracted") private String url; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "the ID of the zone where the volume is located") + description = "The ID of the zone where the volume is located") private Long zoneId; - @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") + @Parameter(name = ApiConstants.MODE, type = CommandType.STRING, required = true, description = "The mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD") private String mode; ///////////////////////////////////////////////////// @@ -114,12 +113,12 @@ public String getEventType() { @Override public String getEventDescription() { - return "Extraction job"; + return "Extracting volume with ID: " + getResourceUuid(ApiConstants.ID) + " from zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId())); + CallContext.current().setEventDetails(getEventDescription()); String uploadUrl = _volumeService.extractVolume(this); if (uploadUrl != null) { ExtractResponse response = _responseGenerator.createVolumeExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java index 4ccd5f97993a..1e3b2e460772 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/GetUploadParamsForVolumeCmd.java @@ -40,7 +40,7 @@ public class GetUploadParamsForVolumeCmd extends AbstractGetUploadParamsCmd { @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.STRING, description = "Image store uuid") private String imageStoreUuid; - @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk " + @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "The ID of the disk " + "offering. This must be a custom sized offering since during upload of volume/template size is unknown.") private Long diskOfferingId; @@ -72,7 +72,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true); + Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java index 318836d8d877..93a2445ee8f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListResourceDetailsCmd.java @@ -34,20 +34,20 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListResourceDetailsCmd extends BaseListProjectAndAccountResourcesCmd { - @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "list by resource type", required = true) + @Parameter(name = ApiConstants.RESOURCE_TYPE, type = CommandType.STRING, description = "List by resource type", required = true) private String resourceType; - @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "list by resource id") + @Parameter(name = ApiConstants.RESOURCE_ID, type = CommandType.STRING, description = "List by resource ID") private String resourceId; - @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "list by key") + @Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = "List by key") private String key; - @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "list by key, value. Needs to be passed only along with key" , + @Parameter(name = ApiConstants.VALUE, type = CommandType.STRING, description = "List by key, value. Needs to be passed only along with key" , since = "4.4", authorized = { RoleType.Admin }) private String value; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "if set to true, only details marked with display=true, are returned." + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "If set to true, only details marked with display=true, are returned." + " False by default", since = "4.3", authorized = { RoleType.Admin }) private Boolean forDisplay; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java index a1024a988981..a4cd299dae9c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java @@ -50,55 +50,55 @@ public class ListVolumesCmd extends BaseListRetrieveOnlyResourceCountCmd impleme //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "list volumes on specified host") + @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "List volumes on specified host") private Long hostId; - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VolumeResponse.class, description = "The ID of the disk volume") private Long id; - @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = VolumeResponse.class, description = "the IDs of the volumes, mutually exclusive with id", since = "4.9") + @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = VolumeResponse.class, description = "The IDs of the volumes, mutually exclusive with id", since = "4.9") private List ids; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the disk volume") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the disk volume") private String volumeName; - @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "the pod id the disk volume belongs to") + @Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "The pod ID the disk volume belongs to") private Long podId; - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "the cluster id the disk volume belongs to", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "The cluster ID the disk volume belongs to", authorized = {RoleType.Admin}) private Long clusterId; - @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "the type of disk volume") + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "The type of disk volume") private String type; - @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "the ID of the virtual machine") + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, description = "The ID of the Instance") private Long virtualMachineId; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the availability zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The ID of the availability zone") private Long zoneId; - @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, entityType = StoragePoolResponse.class, description = "the ID of the storage pool, available to ROOT admin only", since = "4.3", authorized = { + @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, entityType = StoragePoolResponse.class, description = "The ID of the storage pool, available to ROOT admin only", since = "4.3", authorized = { RoleType.Admin}) private String storageId; @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, - description = "list volumes by disk offering of a service offering. If both service offering and " + + description = "List volumes by disk offering of a service offering. If both service offering and " + "disk offering are passed, service offering is ignored", since = "4.19.1") private Long serviceOfferingId; - @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "list volumes by disk offering", since = "4.4") + @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "List volumes by disk offering", since = "4.4") private Long diskOfferingId; - @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = { + @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = { RoleType.Admin}) private Boolean display; - @Parameter(name = ApiConstants.LIST_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "list system VMs; only ROOT admin is eligible to pass this parameter", since = "4.18", + @Parameter(name = ApiConstants.LIST_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "List system VMs; only ROOT admin is eligible to pass this parameter", since = "4.18", authorized = { RoleType.Admin }) private Boolean listSystemVms; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "state of the volume. Possible values are: Ready, Allocated, Destroy, Expunging, Expunged.") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "State of the volume. Possible values are: Ready, Allocated, Destroy, Expunging, Expunged.") private String state; @Parameter(name = ApiConstants.IS_ENCRYPTED, type = CommandType.BOOLEAN, description = "list only volumes that are encrypted", since = "4.19.1", diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java index a0a50c5b9fc5..9927978ad55e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java @@ -30,7 +30,6 @@ import org.apache.cloudstack.api.response.VolumeResponse; import com.cloud.event.EventTypes; -import com.cloud.storage.StoragePool; import com.cloud.storage.Volume; import com.cloud.user.Account; @@ -43,13 +42,13 @@ public class MigrateVolumeCmd extends BaseAsyncCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the volume") + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "The ID of the volume") private Long volumeId; - @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "destination storage pool ID to migrate the volume to") + @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, required = true, description = "Destination storage pool ID to migrate the volume to") private Long storageId; - @Parameter(name = ApiConstants.LIVE_MIGRATE, type = CommandType.BOOLEAN, required = false, description = "if the volume should be live migrated when it is attached to a running vm") + @Parameter(name = ApiConstants.LIVE_MIGRATE, type = CommandType.BOOLEAN, required = false, description = "If the volume should be live migrated when it is attached to a running Instance") private Boolean liveMigrate; @Parameter(name = ApiConstants.NEW_DISK_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "The new disk offering ID that replaces the current one used by the volume. This new disk offering is used to better reflect the new storage where the volume is going to be migrated to.") @@ -110,7 +109,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Attempting to migrate volume Id: " + this._uuidMgr.getUuid(Volume.class, getVolumeId()) + " to storage pool Id: " + this._uuidMgr.getUuid(StoragePool.class, getStoragePoolId()); + return "Attempting to migrate volume with ID: " + getResourceUuid(ApiConstants.VOLUME_ID) + " to storage pool: " + getResourceUuid(ApiConstants.STORAGE_ID); } public Long getNewDiskOfferingId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/RecoverVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/RecoverVolumeCmd.java index cd5a7735e382..4d6be7270afb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/RecoverVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/RecoverVolumeCmd.java @@ -87,7 +87,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + getId()); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.recoverVolume(getId()); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java index eb89115cf464..f8f744285c04 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java @@ -51,7 +51,7 @@ public class ResizeVolumeCmd extends BaseAsyncCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, entityType = VolumeResponse.class, required = true, type = CommandType.UUID, description = "the ID of the disk volume") + @Parameter(name = ApiConstants.ID, entityType = VolumeResponse.class, required = true, type = CommandType.UUID, description = "The ID of the disk volume") private Long id; @Parameter(name = ApiConstants.MIN_IOPS, type = CommandType.LONG, required = false, description = "New minimum number of IOPS") @@ -70,7 +70,7 @@ public class ResizeVolumeCmd extends BaseAsyncCmd implements UserCmd { entityType = DiskOfferingResponse.class, type = CommandType.UUID, required = false, - description = "new disk offering id") + description = "New disk offering ID") private Long newDiskOfferingId; @Parameter(name = ApiConstants.AUTO_MIGRATE, type = CommandType.BOOLEAN, required = false, @@ -190,11 +190,13 @@ public String getEventType() { @Override public String getEventDescription() { + String baseDescription = "Resizing volume with ID: " + getResourceUuid(ApiConstants.ID); + if (getSize() != null) { - return "Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + " GB"; - } else { - return "Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()); + baseDescription = baseDescription + " to size " + getSize() + " GB."; } + + return baseDescription; } @Override @@ -202,9 +204,9 @@ public void execute() { Volume volume = null; try { if (size != null) { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId()) + " to size " + getSize() + " GB"); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID) + " to size " + getSize() + " GB"); } else { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getEntityId())); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); } volume = _volumeService.resizeVolume(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java index 22b819c8cba2..00c50fa5ffff 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java @@ -47,7 +47,7 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd implements UserCmd { ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, description="the ID of the disk volume") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VolumeResponse.class, description = "The ID of the disk volume") private Long id; @Parameter(name = ApiConstants.PATH, type = CommandType.STRING, description = "The path of the volume", authorized = {RoleType.Admin}) @@ -71,10 +71,10 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd implements UserCmd { @Parameter(name = ApiConstants.DISPLAY_VOLUME, type = CommandType.BOOLEAN, - description = "an optional field, whether to the display the volume to the end user or not.", authorized = {RoleType.Admin}) + description = "An optional field, whether to the display the volume to the end User or not.", authorized = {RoleType.Admin}) private Boolean displayVolume; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "new name of the volume", since = "4.16") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "New name of the volume", since = "4.16") private String name; @Parameter(name = ApiConstants.DELETE_PROTECTION, @@ -178,7 +178,7 @@ public String getEventDescription() { @Override public void execute() { - CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId())); + CallContext.current().setEventDetails("Volume ID: " + getResourceUuid(ApiConstants.ID)); Volume result = _volumeService.updateVolume(getId(), getPath(), getState(), getStorageId(), getDisplayVolume(), getDeleteProtection(), getCustomId(), getEntityOwnerId(), getChainInfo(), getName()); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java index 339c276d59ea..33a9251e094f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java @@ -32,7 +32,6 @@ import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.context.CallContext; -import com.cloud.dc.DataCenter; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -53,36 +52,36 @@ public class UploadVolumeCmd extends BaseAsyncCmd implements UserCmd { @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, - description = "the format for the volume. Possible values include QCOW2, OVA, and VHD.") + description = "The format for the volume. Possible values include QCOW2, OVA, and VHD.") private String format; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the volume") private String volumeName; @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, length = 2048, - description = "the URL of where the volume is hosted. Possible URL include http:// and https://") + description = "The URL of where the volume is hosted. Possible URL include http:// and https://") private String url; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, - description = "the ID of the zone the volume is to be hosted on") + description = "The ID of the zone the volume is to be hosted on") private Long zoneId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId. If the account parameter is used, domainId must also be used. If account is NOT provided then volume will be assigned to the caller account and domain.") + description = "An optional domainId. If the Account parameter is used, domainId must also be used. If Account is NOT provided then volume will be assigned to the caller Account and domain.") private Long domainId; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional accountName. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) + @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "The checksum value of this volume. " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION) private String checksum; @Parameter(name = ApiConstants.IMAGE_STORE_UUID, type = CommandType.STRING, description = "Image store uuid") @@ -91,7 +90,7 @@ public class UploadVolumeCmd extends BaseAsyncCmd implements UserCmd { @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume for the project") private Long projectId; - @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "the ID of the disk offering. This must be a custom sized offering since during uploadVolume volume size is unknown.") + @Parameter(name = ApiConstants.DISK_OFFERING_ID, required = false, type = CommandType.UUID, entityType = DiskOfferingResponse.class, description = "The ID of the disk offering. This must be a custom sized offering since during uploadVolume volume size is unknown.") private Long diskOfferingId; ///////////////////////////////////////////////////// @@ -159,7 +158,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -169,7 +168,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "uploading volume: " + getVolumeName() + " in the zone " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()); + return "Uploading volume: " + getVolumeName() + " to zone with ID: " + getResourceUuid(ApiConstants.ZONE_ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreatePrivateGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreatePrivateGatewayCmd.java index dceaabf648de..7755abce6f7e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreatePrivateGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreatePrivateGatewayCmd.java @@ -44,7 +44,7 @@ import com.cloud.network.vpc.Vpc; import com.cloud.network.vpc.VpcGateway; -@APICommand(name = "createPrivateGateway", description = "Creates a private gateway", +@APICommand(name = "createPrivateGateway", description = "Creates a private Gateway", responseObject = PrivateGatewayResponse.class, responseView = ResponseView.Restricted, entityType = {VpcGateway.class}, @@ -58,40 +58,40 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd implements UserC //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "the gateway of the Private gateway") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "The Gateway of the Private Gateway") private String gateway; - @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "the netmask of the Private gateway") + @Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "The Netmask of the Private Gateway") private String netmask; - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = true, description = "the IP address of the Private gateaway") + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, required = true, description = "The IP address of the Private Gateway") private String ipAddress; @Parameter(name = ApiConstants.NETWORK_OFFERING_ID, type = CommandType.UUID, required = false, entityType = NetworkOfferingResponse.class, - description = "the uuid of the network offering to use for the private gateways network connection") + description = "The UUID of the Network offering to use for the private gateways Network connection") private Long networkOfferingId; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the VPC network belongs to") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "The VPC Network belongs to") private Long vpcId; @Parameter(name = ApiConstants.SOURCE_NAT_SUPPORTED, type = CommandType.BOOLEAN, required = false, - description = "source NAT supported value. Default value false. If 'true' source NAT is enabled on the private gateway" + description = "Source NAT supported value. Default value: false. When 'true', the source NAT is enabled on the private gateway" + " 'false': sourcenat is not supported") private Boolean isSourceNat; - @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = false, description = "the ID of the network ACL") + @Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, required = false, description = "The ID of the Network ACL") private Long aclId; @Parameter(name = ApiConstants.ASSOCIATED_NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, since = "4.17.0", - description = "The isolated network this private gateway is associated to.") + description = "The Isolated Network this private gateway is associated to.") private Long associatedNetworkId; ///////////////////////////////////////////////////// @@ -179,7 +179,7 @@ public void execute() throws InsufficientCapacityException, ConcurrentOperationE public long getEntityOwnerId() { Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); if (vpc == null) { - throw new InvalidParameterValueException("Invalid id is specified for the vpc"); + throw new InvalidParameterValueException("Invalid id is specified for the VPC"); } return vpc.getAccountId(); } @@ -203,7 +203,7 @@ public String getSyncObjType() { public Long getSyncObjId() { Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); if (vpc == null) { - throw new InvalidParameterValueException("Invalid id is specified for the vpc"); + throw new InvalidParameterValueException("Invalid ID is specified for the VPC"); } return vpc.getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java index b28c02cb8004..9b5d25aa0ddb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java @@ -27,6 +27,7 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.StaticRouteResponse; +import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; @@ -45,20 +46,40 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.GATEWAY_ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, - required = true, - description = "the gateway id we are creating static route for") + description = "The gateway ID we are creating static route for. Mutually exclusive with the nexthop parameter") private Long gatewayId; - @Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "static route cidr") + @Parameter(name = ApiConstants.VPC_ID, + type = CommandType.UUID, + entityType = VpcResponse.class, + description = "the vpc id for which the static route is created. This is required for nexthop parameter", + since = "4.21.0") + private Long vpcId; + + @Parameter(name = ApiConstants.NEXT_HOP, + type = CommandType.STRING, + description = "the next hop of static route. Mutually exclusive with the gatewayid parameter", + since = "4.21.0") + private String nextHop; + + @Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "Static route CIDR") private String cidr; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - public long getGatewayId() { + public Long getGatewayId() { return gatewayId; } + public Long getVpcId() { + return vpcId; + } + + public String getNextHop() { + return nextHop; + } + public String getCidr() { return cidr; } @@ -69,11 +90,11 @@ public String getCidr() { @Override public void create() throws ResourceAllocationException { try { - StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr()); + StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getVpcId(), getNextHop(), getCidr()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException ex) { - logger.info("Network rule conflict: " + ex.getMessage()); + logger.info("Network rule conflict: {}", ex.getMessage()); logger.trace("Network rule conflict: ", ex); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } @@ -94,7 +115,7 @@ public void execute() throws ResourceUnavailableException { boolean success = false; StaticRoute route = null; try { - CallContext.current().setEventDetails("Static route Id: " + getEntityId()); + CallContext.current().setEventDetails("Static route ID: " + getEntityUuid()); success = _vpcService.applyStaticRoute(getEntityId()); // State is different after the route is applied, so retrieve the object only here route = _entityMgr.findById(StaticRoute.class, getEntityId()); @@ -107,18 +128,15 @@ public void execute() throws ResourceUnavailableException { } finally { if (!success || route == null) { _entityMgr.remove(StaticRoute.class, getEntityId()); - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create static route"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a static route"); } } } @Override public long getEntityOwnerId() { - VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId); - if (gateway == null) { - throw new InvalidParameterValueException("Invalid gateway id is specified"); - } - return _entityMgr.findById(Vpc.class, gateway.getVpcId()).getAccountId(); + Long vpcId = getSyncObjId(); + return _entityMgr.findById(Vpc.class, vpcId).getAccountId(); } @Override @@ -128,11 +146,20 @@ public String getSyncObjType() { @Override public Long getSyncObjId() { - VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId); - if (gateway == null) { - throw new InvalidParameterValueException("Invalid id is specified for the gateway"); + if (gatewayId != null) { + VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId); + if (gateway == null) { + throw new InvalidParameterValueException("Invalid id is specified for the gateway"); + } + return gateway.getVpcId(); + } else if (vpcId != null) { + Vpc vpc = _entityMgr.findById(Vpc.class, vpcId); + if (vpc == null) { + throw new InvalidParameterValueException("Invalid vpc id is specified"); + } + return vpc.getId(); } - return gateway.getVpcId(); + throw new InvalidParameterValueException("One of vpcId or gatewayId must be specified"); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java index 2f62d0d7210d..86309d7f28a5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.cloudstack.acl.RoleType; @@ -51,24 +52,24 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd implements UserCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account associated with the VPC. " + + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The Account associated with the VPC. " + "Must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID associated with the VPC. " + - "If used with the account parameter returns the VPC associated with the account for the specified domain.") + description = "The domain ID associated with the VPC. " + + "If used with the Account parameter returns the VPC associated with the Account for the specified domain.") private Long domainId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "create VPC for the project") + description = "Create VPC for the project") private Long projectId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - required = true, description = "the ID of the availability zone") + required = true, description = "The ID of the availability zone") private Long zoneId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the VPC") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the VPC") private String vpcName; @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the VPC, defaults to its 'name'.") @@ -76,7 +77,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd implements UserCmd { private String displayText; @Parameter(name = ApiConstants.CIDR, type = CommandType.STRING, - description = "the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR") + description = "The CIDR of the VPC. All VPC Guest Network's CIDRs should be within this CIDR") private String cidr; @Parameter(name = ApiConstants.CIDR_SIZE, type = CommandType.INTEGER, @@ -85,46 +86,55 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd implements UserCmd { private Integer cidrSize; @Parameter(name = ApiConstants.VPC_OFF_ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, - required = true, description = "the ID of the VPC offering") + required = true, description = "The ID of the VPC offering") private Long vpcOffering; @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, - description = "VPC network domain. All networks inside the VPC will belong to this domain") + description = "VPC Network domain. All Networks inside the VPC will belong to this domain") private String networkDomain; @Parameter(name = ApiConstants.START, type = CommandType.BOOLEAN, - description = "If set to false, the VPC won't start (VPC VR will not get allocated) until its first network gets implemented. " + + description = "If set to false, the VPC won't start (VPC VR will not get allocated) until its first Network gets implemented. " + "True by default.", since = "4.3") private Boolean start; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPC to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER, - description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0") + description = "MTU to be configured on the Network VR's public facing interfaces", since = "4.18.0") private Integer publicMtu; - @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the VPC", since = "4.18.0") + @Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "The first IPv4 DNS for the VPC", since = "4.18.0") private String ip4Dns1; - @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "the second IPv4 DNS for the VPC", since = "4.18.0") + @Parameter(name = ApiConstants.DNS2, type = CommandType.STRING, description = "The second IPv4 DNS for the VPC", since = "4.18.0") private String ip4Dns2; - @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "the first IPv6 DNS for the VPC", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS1, type = CommandType.STRING, description = "The first IPv6 DNS for the VPC", since = "4.18.0") private String ip6Dns1; - @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "the second IPv6 DNS for the VPC", since = "4.18.0") + @Parameter(name = ApiConstants.IP6_DNS2, type = CommandType.STRING, description = "The second IPv6 DNS for the VPC", since = "4.18.0") private String ip6Dns2; - @Parameter(name = ApiConstants.SOURCE_NAT_IP, type = CommandType.STRING, description = "IPV4 address to be assigned to the public interface of the network router." + - "This address will be used as source NAT address for the networks in ths VPC. " + - "\nIf an address is given and it cannot be acquired, an error will be returned and the network won´t be implemented,", + @Parameter(name = ApiConstants.SOURCE_NAT_IP, type = CommandType.STRING, description = "IPv4 address to be assigned to the public interface of the Network router." + + "This address will be used as source NAT address for the Networks in ths VPC. " + + "\nIf an address is given and it cannot be acquired, an error will be returned and the Network won´t be implemented,", since = "4.19") private String sourceNatIP; @Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, since = "4.20.0", description="the AS Number of the VPC tiers") private Long asNumber; + @Parameter(name=ApiConstants.USE_VIRTUAL_ROUTER_IP_RESOLVER, type=CommandType.BOOLEAN, + description="(optional) for NSX based VPCs: when set to true, use the VR IP as nameserver, otherwise use DNS1 and DNS2") + private Boolean useVrIpResolver; + + @Parameter(name = ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + type = CommandType.BOOLEAN, since = "4.23.0", authorized = {RoleType.Admin}) + private boolean keepMacAddressOnPublicNic = true; + // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -205,6 +215,14 @@ public Long getAsNumber() { return asNumber; } + public boolean getUseVrIpResolver() { + return BooleanUtils.toBoolean(useVrIpResolver); + } + + public boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -264,7 +282,7 @@ public String getCommandName() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java index 01b6aae425b3..cf1805973b77 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java @@ -44,7 +44,7 @@ public class DeleteStaticRouteCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StaticRouteResponse.class, required = true, description = "the ID of the static route") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StaticRouteResponse.class, required = true, description = "The ID of the static route") private Long id; // unexposed parameter needed for events logging @@ -69,7 +69,7 @@ public String getEventType() { @Override public String getEventDescription() { - return ("Deleting static route id=" + id); + return "Deleting static route with ID: " + getResourceUuid(ApiConstants.ID); } @Override @@ -87,7 +87,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException { - CallContext.current().setEventDetails("Route Id: " + id); + CallContext.current().setEventDetails("Route ID: " + getResourceUuid(ApiConstants.ID)); boolean result = _vpcService.revokeStaticRoute(id); if (result) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java index c35d9084bcc5..e42b4761ea8f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java @@ -43,7 +43,7 @@ public class DeleteVPCCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the ID of the VPC") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "The ID of the VPC") private Long id; ///////////////////////////////////////////////////// @@ -65,7 +65,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "Deleting VPC id=" + getId(); + return "Deleting VPC with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java index 2304cef3c6d1..aadef68d5ae2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java @@ -43,19 +43,19 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "list private gateway by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "List private gateway by ID") private Long id; - @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "list gateways by ip address") + @Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "List gateways by IP address") private String ipAddress; - @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "list gateways by vlan") + @Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "List gateways by VLAN") private String vlan; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "list gateways by vpc") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List gateways by VPC") private Long vpcId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list gateways by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List gateways by state") private String state; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java index 36574e2a7777..babc38bc42f1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java @@ -38,16 +38,16 @@ public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StaticRouteResponse.class, description = "list static route by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = StaticRouteResponse.class, description = "List static route by ID") private Long id; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "list static routes by vpc id") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List static routes by VPC ID") private Long vpcId; - @Parameter(name = ApiConstants.GATEWAY_ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "list static routes by gateway id") + @Parameter(name = ApiConstants.GATEWAY_ID, type = CommandType.UUID, entityType = PrivateGatewayResponse.class, description = "List static routes by gateway ID") private Long gatewayId; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list static routes by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List static routes by state") private String state; public Long getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java index f48e113286a9..7d603a85993d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java @@ -38,38 +38,38 @@ public class ListVPCOfferingsCmd extends BaseListCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, description = "list VPC offerings by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, description = "List VPC offerings by ID") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list VPC offerings by name") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List VPC offerings by name") private String vpcOffName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "list VPC offerings by display text") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "List VPC offerings by display text") private String displayText; - @Parameter(name = ApiConstants.IS_DEFAULT, type = CommandType.BOOLEAN, description = "true if need to list only default " + "VPC offerings. Default value is false") + @Parameter(name = ApiConstants.IS_DEFAULT, type = CommandType.BOOLEAN, description = "True if need to list only default " + "VPC offerings. Default value is false") private Boolean isDefault; @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, - description = "list VPC offerings supporting certain services") + description = "List VPC offerings supporting certain services") private List supportedServices; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list VPC offerings by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List VPC offerings by state") private String state; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "list VPC offerings available for VPC creation in specific domain", + description = "List VPC offerings available for VPC creation in specific domain", since = "4.18") private Long domainId; @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, - description = "id of zone VPC offering is associated with", + description = "ID of zone VPC offering is associated with", since = "4.13") private Long zoneId; diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java index d128be1414d2..c4597d9b986c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java @@ -46,39 +46,39 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd implements UserCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// //////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "list VPC by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "List VPC by ID") private Long id; - @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list by zone") + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "List by zone") private Long zoneId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list by name of the VPC") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "List by name of the VPC") private String vpcName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "List by display text of " + "the VPC") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "List by display text of " + "The VPC") private String displayText; - @Parameter(name = ApiConstants.CIDR, type = CommandType.STRING, description = "list by cidr of the VPC. All VPC " - + "guest networks' cidrs should be within this CIDR") + @Parameter(name = ApiConstants.CIDR, type = CommandType.STRING, description = "List by CIDR of the VPC. All VPC " + + "Guest Network's CIDRs should be within this CIDR") private String cidr; - @Parameter(name = ApiConstants.VPC_OFF_ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, description = "list by ID of the VPC offering") + @Parameter(name = ApiConstants.VPC_OFF_ID, type = CommandType.UUID, entityType = VpcOfferingResponse.class, description = "List by ID of the VPC offering") private Long VpcOffId; - @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list VPC supporting certain services") + @Parameter(name = ApiConstants.SUPPORTED_SERVICES, type = CommandType.LIST, collectionType = CommandType.STRING, description = "List VPC supporting certain services") private List supportedServices; - @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list VPCs by state") + @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List VPCs by state") private String state; - @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "list VPCs by restartRequired option") + @Parameter(name = ApiConstants.RESTART_REQUIRED, type = CommandType.BOOLEAN, description = "List VPCs by restartRequired option") private Boolean restartRequired; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, - description = "flag to display the resource icon for VPCs") + description = "Flag to display the resource icon for VPCs") private Boolean showIcon; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java index 5ccd496eeb4c..f6a408a66a3d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java @@ -43,10 +43,10 @@ public class RestartVPCCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the id of the VPC") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "The ID of the VPC") private Long id; - @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, required = false, description = "If cleanup old network elements") + @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, required = false, description = "Should we cleanup the old Network elements") private Boolean cleanup = false; @Parameter(name = ApiConstants.MAKEREDUNDANT, type = CommandType.BOOLEAN, required = false, description = "Turn a single VPC into a redundant one.") @@ -118,7 +118,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "restarting VPC id=" + getId(); + return "Restarting VPC with ID: " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java index 6fcfb5311f62..6cfdb895977d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java @@ -47,28 +47,33 @@ public class UpdateVPCCmd extends BaseAsyncCustomIdCmd implements UserCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @ACL(accessType = AccessType.OperateEntry) - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the id of the VPC") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "The ID of the VPC") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the VPC") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the VPC") private String vpcName; - @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the VPC") + @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the VPC") private String displayText; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "Optional field, should we display the VPC to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; @Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER, - description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0") + description = "MTU to be configured on the Network VR's public facing interfaces", since = "4.18.0") private Integer publicMtu; @Parameter(name = ApiConstants.SOURCE_NAT_IP, type = CommandType.STRING, - description = "IPV4 address to be assigned to the public interface of the network router. This address must already be acquired for this VPC", + description = "IPV4 address to be assigned to the public interface of the Network router. This address must already be acquired for this VPC", since = "4.19") private String sourceNatIP; + @Parameter(name = ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, + type = CommandType.BOOLEAN, since = "4.23.0", authorized = {RoleType.Admin}) + private Boolean keepMacAddressOnPublicNic; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -97,6 +102,10 @@ public String getSourceNatIP() { return sourceNatIP; } + public Boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -143,7 +152,7 @@ public String getEventType() { @Override public String getEventDescription() { - return "updating VPC id=" + getId(); + return "Updating VPC " + getResourceUuid(ApiConstants.ID); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java index 59ba7e94b04d..78cd9a3ac7e4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java @@ -28,12 +28,11 @@ import org.apache.cloudstack.api.response.VpnUsersResponse; import org.apache.cloudstack.context.CallContext; -import com.cloud.domain.Domain; import com.cloud.event.EventTypes; import com.cloud.network.VpnUser; import com.cloud.user.Account; -@APICommand(name = "addVpnUser", description = "Adds vpn users", responseObject = VpnUsersResponse.class, entityType = {VpnUser.class}, +@APICommand(name = "addVpnUser", description = "Adds VPN Users", responseObject = VpnUsersResponse.class, entityType = {VpnUser.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class AddVpnUserCmd extends BaseAsyncCreateCmd { @@ -41,22 +40,22 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "username for the vpn user") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Username for the VPN User") private String userName; - @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "password for the username") + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "Password for the username") private String password; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the vpn user. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the VPN User. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "add vpn user to the specific project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Add VPN User to the specific project") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the VPN User. If the account parameter is used, domainId must also be used.") private Long domainId; ///////////////////////////////////////////////////// @@ -89,7 +88,7 @@ public Long getProjectId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -99,7 +98,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Add Remote Access VPN user for account " + getEntityOwnerId() + " username= " + getUserName(); + return "Add Remote Access VPN User for Account " + getEntityOwnerId() + " username= " + getUserName(); } @Override @@ -110,32 +109,17 @@ public String getEventType() { @Override public void execute() { VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId()); - Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId()); try { if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add VPN User"); } } catch (Exception ex) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } - - VpnUsersResponse vpnResponse = new VpnUsersResponse(); - vpnResponse.setId(vpnUser.getUuid()); - vpnResponse.setUserName(vpnUser.getUsername()); - vpnResponse.setAccountName(account.getAccountName()); // re-retrieve the vpnuser, as the call to `applyVpnUsers` might have changed the state vpnUser = _entityMgr.findById(VpnUser.class, getEntityId()); - vpnResponse.setState(vpnUser.getState().toString()); - - Domain domain = _entityMgr.findById(Domain.class, account.getDomainId()); - if (domain != null) { - vpnResponse.setDomainId(domain.getUuid()); - vpnResponse.setDomainName(domain.getName()); - vpnResponse.setDomainPath(domain.getPath()); - } - + VpnUsersResponse vpnResponse = _responseGenerator.createVpnUserResponse(vpnUser); vpnResponse.setResponseName(getCommandName()); - vpnResponse.setObjectName("vpnuser"); setResponseObject(vpnResponse); } @@ -145,7 +129,7 @@ public void create() { VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password); if (vpnUser == null) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add VPN User"); } setEntityId(vpnUser.getId()); setEntityUuid(vpnUser.getUuid()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java index 417ba2773c41..c730c2c5fe88 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java @@ -37,7 +37,7 @@ import com.cloud.network.IpAddress; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "createRemoteAccessVpn", description = "Creates a l2tp/ipsec remote access vpn", responseObject = RemoteAccessVpnResponse.class, entityType = {RemoteAccessVpn.class}, +@APICommand(name = "createRemoteAccessVpn", description = "Creates a l2tp/ipsec remote access VPN", responseObject = RemoteAccessVpnResponse.class, entityType = {RemoteAccessVpn.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { @@ -49,32 +49,32 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "public ip address id of the vpn server") + description = "Public IP address id of the VPN server") private Long publicIpId; @Parameter(name = "iprange", type = CommandType.STRING, required = false, - description = "the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server") + description = "The range of IP addresses to allocate to VPN clients. The first IP in the range will be taken by the VPN server") private String ipRange; @Deprecated - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the VPN. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the VPN. Must be used with domainId.") private String accountName; @Deprecated @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the VPN. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the VPN. If the account parameter is used, domainId must also be used.") private Long domainId; @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, - description = "if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. Has value true by default") + description = "If true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitly. Has value true by default") private Boolean openFirewall; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -127,7 +127,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Create Remote Access VPN for account " + getEntityOwnerId() + " using public ip id=" + publicIpId; + return "Create Remote Access VPN for Account " + getEntityOwnerId() + " using public ip id=" + publicIpId; } @Override @@ -143,10 +143,10 @@ public void create() { setEntityId(vpn.getId()); setEntityUuid(vpn.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access VPN"); } } catch (NetworkRuleConflictException e) { - logger.info("Network rule conflict: " + e.getMessage()); + logger.info("Network rule conflict: {}", e.getMessage()); logger.trace("Network Rule Conflict: ", e); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } @@ -161,7 +161,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access VPN"); } } catch (ResourceUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java index 0b5c46d36eb9..3d6b7918effd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java @@ -37,7 +37,7 @@ import com.cloud.network.vpc.Vpc; -@APICommand(name = "createVpnConnection", description = "Create site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, +@APICommand(name = "createVpnConnection", description = "Create site to site VPN connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { @@ -49,20 +49,20 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, - description = "id of the vpn gateway") + description = "ID of the VPN gateway") private Long vpnGatewayId; @Parameter(name = ApiConstants.S2S_CUSTOMER_GATEWAY_ID, type = CommandType.UUID, entityType = Site2SiteCustomerGatewayResponse.class, required = true, - description = "id of the customer gateway") + description = "ID of the customer gateway") private Long customerGatewayId; - @Parameter(name = ApiConstants.PASSIVE, type = CommandType.BOOLEAN, required = false, description = "connection is passive or not") + @Parameter(name = ApiConstants.PASSIVE, type = CommandType.BOOLEAN, required = false, description = "Connection is passive or not") private Boolean passive; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -114,7 +114,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Create site-to-site VPN connection for account " + getEntityOwnerId(); + return "Create site-to-site VPN connection for Account " + getEntityOwnerId(); } @Override @@ -130,10 +130,10 @@ public void create() { setEntityId(conn.getId()); setEntityUuid(conn.getUuid()); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site VPN connection"); } } catch (NetworkRuleConflictException e) { - logger.info("Network rule conflict: " + e.getMessage()); + logger.info("Network rule conflict: {}", e.getMessage()); logger.trace("Network Rule Conflict: ", e); throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } @@ -148,7 +148,7 @@ public void execute() { response.setResponseName(getCommandName()); setResponseObject(response); } else { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site VPN connection"); } } catch (ResourceUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java index a2fa0d9829c8..0da813eb4867 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java @@ -33,7 +33,7 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.network.Site2SiteCustomerGateway; -@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, +@APICommand(name = "createVpnCustomerGateway", description = "Creates site to site VPN customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnCustomerGatewayCmd extends BaseAsyncCreateCmd { @@ -41,13 +41,13 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCreateCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "name of this customer gateway") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "Name of this customer gateway") private String name; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "public ip address id of the customer gateway") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "Public IP address id of the customer gateway") private String gatewayIp; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.STRING, required = true, description = "guest cidr list of the customer gateway. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.STRING, required = true, description = "Guest cidr list of the customer gateway. Multiple entries must be separated by a single comma character (,).") private String peerCidrList; @Parameter(name = ApiConstants.IPSEC_PSK, type = CommandType.STRING, required = true, description = "IPsec Preshared-Key of the customer gateway. Cannot contain newline or double quotes.") @@ -77,18 +77,18 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.FORCE_ENCAP, type = CommandType.BOOLEAN, required = false, description = "Force Encapsulation for NAT traversal") private Boolean encap; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account associated with the gateway. Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The Account associated with the gateway. Must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID associated with the gateway. If used with the account parameter returns the " - + "gateway associated with the account for the specified domain.") + description = "The domain ID associated with the gateway. If used with the account parameter returns the " + + "gateway associated with the Account for the specified domain.") private Long domainId; @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, - description = "create site-to-site VPN customer gateway for the project", since = "4.6") + description = "Create site-to-site VPN customer gateway for the project", since = "4.6") private Long projectId; @Parameter(name = ApiConstants.SPLIT_CONNECTIONS, type = CommandType.BOOLEAN, required = false, description = "For IKEv2, whether to split multiple right subnet cidrs into multiple connection statements.", @@ -167,7 +167,7 @@ public String getIkeVersion() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { accountId = CallContext.current().getCallingAccount().getId(); } @@ -176,7 +176,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Create site-to-site VPN customer gateway for account " + getEntityOwnerId(); + return "Create site-to-site VPN customer gateway for Account " + getEntityOwnerId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java index 6f31176c4ff6..665f699c4ef3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java @@ -28,11 +28,12 @@ import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.context.CallContext; -@APICommand(name = "createVpnGateway", description = "Creates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = {Site2SiteVpnGateway.class}, +@APICommand(name = "createVpnGateway", description = "Creates site to site VPN local gateway", responseObject = Site2SiteVpnGatewayResponse.class, entityType = {Site2SiteVpnGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd { @@ -44,10 +45,17 @@ public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd { type = CommandType.UUID, entityType = VpcResponse.class, required = true, - description = "public ip address id of the vpn gateway") + description = "Public IP address id of the VPN gateway") private Long vpcId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.IP_ADDRESS_ID, + type = CommandType.UUID, + entityType = IPAddressResponse.class, + description = "the public IP address ID for which VPN gateway is being enabled. By default the source NAT IP or router IP will be used.", + since = "4.21.0") + private Long ipAddressId; + + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -58,6 +66,10 @@ public Long getVpcId() { return vpcId; } + public Long getIpAddressId() { + return ipAddressId; + } + @Deprecated public Boolean getDisplay() { return display; @@ -84,7 +96,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Create site-to-site VPN gateway for account " + getEntityOwnerId(); + return "Create site-to-site VPN gateway for Account " + getEntityOwnerId(); } @Override @@ -94,7 +106,7 @@ public String getEventType() { @Override public void execute() { - CallContext.current().setEventDetails("VPN gateway Id: " + getEntityId()); + CallContext.current().setEventDetails("VPN gateway ID: " + getEntityUuid()); Site2SiteVpnGateway result = _s2sVpnService.getVpnGateway(getEntityId()); if (result != null) { Site2SiteVpnGatewayResponse response = _responseGenerator.createSite2SiteVpnGatewayResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java index bf8d01579238..b1fc331f4c3a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java @@ -34,7 +34,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access vpn", responseObject = SuccessResponse.class, entityType = {RemoteAccessVpn.class}, +@APICommand(name = "deleteRemoteAccessVpn", description = "Destroys a l2tp/ipsec remote access VPN", responseObject = SuccessResponse.class, entityType = {RemoteAccessVpn.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd { @@ -47,7 +47,7 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, - description = "public ip address id of the vpn server") + description = "Public IP address id of the VPN server") private Long publicIpId; // unexposed parameter needed for events logging @@ -69,14 +69,14 @@ public long getEntityOwnerId() { if (vpnEntity != null) return vpnEntity.getAccountId(); - throw new InvalidParameterValueException("The specified public ip is not allocated to any account"); + throw new InvalidParameterValueException("The specified public ip is not allocated to any Account"); } return ownerId; } @Override public String getEventDescription() { - return "Delete Remote Access VPN for account " + getEntityOwnerId() + " for ip id=" + publicIpId; + return "Delete Remote Access VPN for Account " + getEntityOwnerId() + " for IP: " + getResourceUuid(ApiConstants.PUBLIC_IP_ID); } @Override @@ -87,7 +87,7 @@ public String getEventType() { @Override public void execute() throws ResourceUnavailableException { if (! _ravService.destroyRemoteAccessVpnForIp(publicIpId, CallContext.current().getCallingAccount(), false)) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete remote access vpn"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete remote access VPN"); } SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java index 2528d93a0422..b23e6c163020 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java @@ -31,7 +31,7 @@ import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "deleteVpnConnection", description = "Delete site to site vpn connection", responseObject = SuccessResponse.class, entityType = {Site2SiteVpnConnection.class}, +@APICommand(name = "deleteVpnConnection", description = "Delete site to site VPN connection", responseObject = SuccessResponse.class, entityType = {Site2SiteVpnConnection.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnConnectionCmd extends BaseAsyncCmd { @@ -39,7 +39,7 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "id of vpn connection") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "ID of VPN connection") private Long id; ///////////////////////////////////////////////////// @@ -65,7 +65,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Delete site-to-site VPN connection for account " + getEntityOwnerId(); + return "Deleting site-to-site VPN connection for Account " + getEntityOwnerId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java index 2b657fd3c088..9057620e0ddb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.user.Account; -@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site vpn customer gateway", responseObject = SuccessResponse.class, entityType = {Site2SiteCustomerGateway.class}, +@APICommand(name = "deleteVpnCustomerGateway", description = "Delete site to site VPN customer gateway", responseObject = SuccessResponse.class, entityType = {Site2SiteCustomerGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd { @@ -46,7 +46,7 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = Site2SiteCustomerGatewayResponse.class, required = true, - description = "id of customer gateway") + description = "ID of customer gateway") private Long id; ///////////////////////////////////////////////////// @@ -72,7 +72,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Delete site-to-site VPN customer gateway for account " + getEntityOwnerId(); + return "Deleting site-to-site VPN customer gateway for Account " + getEntityOwnerId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java index 27ded12dc58d..bfea59a3e6f3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java @@ -30,7 +30,7 @@ import com.cloud.network.Site2SiteVpnGateway; import com.cloud.user.Account; -@APICommand(name = "deleteVpnGateway", description = "Delete site to site vpn gateway", responseObject = SuccessResponse.class, entityType = {Site2SiteVpnGateway.class}, +@APICommand(name = "deleteVpnGateway", description = "Delete site to site VPN gateway", responseObject = SuccessResponse.class, entityType = {Site2SiteVpnGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class DeleteVpnGatewayCmd extends BaseAsyncCmd { @@ -38,7 +38,7 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, description = "id of customer gateway") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, description = "ID of customer gateway") private Long id; ///////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Delete site-to-site VPN gateway for account " + getEntityOwnerId(); + return "Delete site-to-site VPN gateway for Account " + getEntityOwnerId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java index 4efc70c84199..185d11bc29d4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.RemoteAccessVpn; import com.cloud.utils.Pair; -@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access vpns", responseObject = RemoteAccessVpnResponse.class, entityType = {RemoteAccessVpn.class}, +@APICommand(name = "listRemoteAccessVpns", description = "Lists remote access VPNs", responseObject = RemoteAccessVpnResponse.class, entityType = {RemoteAccessVpn.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -41,24 +41,24 @@ public class ListRemoteAccessVpnsCmd extends BaseListProjectAndAccountResourcesC ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "public ip address id of the vpn server") + @Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "Public ip address id of the VPN server") private Long publicIpId; @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = RemoteAccessVpnResponse.class, - description = "Lists remote access vpn rule with the specified ID", + description = "Lists remote access VPN rule with the specified ID", since = "4.3") private Long id; @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, - description = "list remote access VPNs for certain network", + description = "List remote access VPNs for certain Network", since = "4.3") private Long networkId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java index aeeae44d0046..9a37e2f786c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.Site2SiteVpnConnection; import com.cloud.utils.Pair; -@APICommand(name = "listVpnConnections", description = "Lists site to site vpn connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, +@APICommand(name = "listVpnConnections", description = "Lists site to site VPN connection gateways", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd { @@ -40,13 +40,13 @@ public class ListVpnConnectionsCmd extends BaseListProjectAndAccountResourcesCmd ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, description = "id of the vpn connection") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, description = "ID of the VPN connection") private Long id; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "ID of VPC") private Long vpcId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java index 258a8a753ebe..51e761839718 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java @@ -30,7 +30,7 @@ import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.utils.Pair; -@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site vpn customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, +@APICommand(name = "listVpnCustomerGateways", description = "Lists site to site VPN customer gateways", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnCustomerGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { @@ -39,7 +39,7 @@ public class ListVpnCustomerGatewaysCmd extends BaseListProjectAndAccountResourc //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteCustomerGatewayResponse.class, description = "id of the customer gateway") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteCustomerGatewayResponse.class, description = "ID of the customer gateway") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java index d30fbf8d32bb..3bdcf79677a0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.Site2SiteVpnGateway; import com.cloud.utils.Pair; -@APICommand(name = "listVpnGateways", description = "Lists site 2 site vpn gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = {Site2SiteVpnGateway.class}, +@APICommand(name = "listVpnGateways", description = "Lists site 2 site VPN gateways", responseObject = Site2SiteVpnGatewayResponse.class, entityType = {Site2SiteVpnGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { @@ -41,13 +41,13 @@ public class ListVpnGatewaysCmd extends BaseListProjectAndAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, description = "id of the vpn gateway") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, description = "ID of the VPN gateway") private Long id; - @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "id of vpc") + @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, description = "ID of VPC ") private Long vpcId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "List resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java index 48591765ec34..b4a621e53f91 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java @@ -30,7 +30,7 @@ import com.cloud.network.VpnUser; import com.cloud.utils.Pair; -@APICommand(name = "listVpnUsers", description = "Lists vpn users", responseObject = VpnUsersResponse.class, entityType = {VpnUser.class}, +@APICommand(name = "listVpnUsers", description = "Lists VPN Users", responseObject = VpnUsersResponse.class, entityType = {VpnUser.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd { @@ -38,10 +38,10 @@ public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpnUsersResponse.class, description = "The uuid of the Vpn user") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpnUsersResponse.class, description = "The UUID of the VPN User") private Long id; - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username of the vpn user.") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "The username of the VPN User.") private String userName; ///////////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java index 0697987b04de..a18619c89498 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java @@ -33,7 +33,7 @@ import com.cloud.network.VpnUser; import com.cloud.user.Account; -@APICommand(name = "removeVpnUser", description = "Removes vpn user", responseObject = SuccessResponse.class, entityType = {VpnUser.class}, +@APICommand(name = "removeVpnUser", description = "Removes VPN User", responseObject = SuccessResponse.class, entityType = {VpnUser.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class RemoveVpnUserCmd extends BaseAsyncCmd { @@ -41,19 +41,19 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "username for the vpn user") + @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Username for the VPN User") private String userName; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the vpn user. Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for the VPN User. Must be used with domainId.") private String accountName; - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "remove vpn user from the project") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Remove VPN User from the project") private Long projectId; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for the VPN User. If the Account parameter is used, domainId must also be used.") private Long domainId; ///////////////////////////////////////////////////// @@ -82,7 +82,7 @@ public Long getProjecId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -92,7 +92,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username= " + getUserName(); + return "Remove Remote Access VPN User for Account " + getEntityOwnerId() + " username= " + getUserName(); } @Override @@ -106,7 +106,7 @@ public void execute() { long ownerId = owner.getId(); boolean result = _ravService.removeVpnUser(owner, userName, CallContext.current().getCallingAccount()); if (!result) { - String errorMessage = String.format("Failed to remove VPN user=[%s]. VPN owner id=[%s].", userName, ownerId); + String errorMessage = String.format("Failed to remove VPN User=[%s]. VPN owner id=[%s].", userName, ownerId); logger.error(errorMessage); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMessage); } @@ -115,13 +115,13 @@ public void execute() { try { appliedVpnUsers = _ravService.applyVpnUsers(ownerId, userName, true); } catch (ResourceUnavailableException ex) { - String errorMessage = String.format("Failed to refresh VPN user=[%s] due to resource unavailable. VPN owner id=[%s].", userName, ownerId); + String errorMessage = String.format("Failed to refresh VPN User=[%s] due to resource unavailable. VPN owner id=[%s].", userName, ownerId); logger.error(errorMessage, ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMessage, ex); } if (!appliedVpnUsers) { - String errorMessage = String.format("Failed to refresh VPN user=[%s]. VPN owner id=[%s].", userName, ownerId); + String errorMessage = String.format("Failed to refresh VPN User=[%s]. VPN owner id=[%s].", userName, ownerId); logger.debug(errorMessage); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMessage); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java index 736295b4119c..f681c8cce182 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java @@ -32,7 +32,7 @@ import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "resetVpnConnection", description = "Reset site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, +@APICommand(name = "resetVpnConnection", description = "Reset site to site VPN connection", responseObject = Site2SiteVpnConnectionResponse.class, entityType = {Site2SiteVpnConnection.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ResetVpnConnectionCmd extends BaseAsyncCmd { @@ -40,16 +40,16 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "id of vpn connection") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "ID of VPN connection") private Long id; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for connection. " + "Must be used with domainId.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional Account for connection. " + "Must be used with domainId.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "an optional domainId for connection. If the account parameter is used, domainId must also be used.") + description = "An optional domainId for connection. If the Account parameter is used, domainId must also be used.") private Long domainId; ///////////////////////////////////////////////////// @@ -74,7 +74,7 @@ public Long getId() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } @@ -83,7 +83,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Reset site-to-site VPN connection for account " + getEntityOwnerId(); + return "Reset site-to-site VPN connection for Account " + getEntityOwnerId(); } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java index defde70b63ac..edf2b9e630bc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java @@ -28,7 +28,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.RemoteAccessVpn; -@APICommand(name = "updateRemoteAccessVpn", description = "Updates remote access vpn", responseObject = RemoteAccessVpnResponse.class, since = "4.4", +@APICommand(name = "updateRemoteAccessVpn", description = "Updates remote access VPN", responseObject = RemoteAccessVpnResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { @@ -37,14 +37,14 @@ public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, entityType = RemoteAccessVpnResponse.class, description = "id of the remote access vpn") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, entityType = RemoteAccessVpnResponse.class, description = "ID of the remote access VPN") private Long id; // unexposed parameter needed for events logging @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false) private Long ownerId; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -73,7 +73,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Updating remote access vpn id=" + id; + return "Updating remote access VPN id=" + id; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java index 62dd6167b753..92f6786268ad 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java @@ -27,7 +27,7 @@ import com.cloud.network.Site2SiteVpnConnection; import com.cloud.user.Account; -@APICommand(name = "updateVpnConnection", description = "Updates site to site vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, since = "4.4", +@APICommand(name = "updateVpnConnection", description = "Updates site to site VPN connection", responseObject = Site2SiteVpnConnectionResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd { @@ -35,10 +35,10 @@ public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "id of vpn connection") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnConnectionResponse.class, required = true, description = "ID of VPN connection") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -66,7 +66,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Updating site-to-site VPN connection id= " + id; + return "Updating site-to-site VPN connection ID = " + id; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java index 9f3ac2ec4367..56aa8b2cd16d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java @@ -32,7 +32,7 @@ import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; -@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site vpn customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, +@APICommand(name = "updateVpnCustomerGateway", description = "Update site to site VPN customer gateway", responseObject = Site2SiteCustomerGatewayResponse.class, entityType = {Site2SiteCustomerGateway.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @@ -44,16 +44,16 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { type = CommandType.UUID, entityType = Site2SiteCustomerGatewayResponse.class, required = true, - description = "id of customer gateway") + description = "ID of customer gateway") private Long id; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "name of this customer gateway") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "Name of this customer gateway") private String name; - @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "public ip address id of the customer gateway") + @Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "Public IP address id of the customer gateway") private String gatewayIp; - @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.STRING, required = true, description = "guest cidr of the customer gateway. Multiple entries must be separated by a single comma character (,).") + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.STRING, required = true, description = "Guest CIDR of the customer gateway. Multiple entries must be separated by a single comma character (,).") private String guestCidrList; @Parameter(name = ApiConstants.IPSEC_PSK, type = CommandType.STRING, required = true, description = "IPsec Preshared-Key of the customer gateway. Cannot contain newline or double quotes.") @@ -83,14 +83,14 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.FORCE_ENCAP, type = CommandType.BOOLEAN, required = false, description = "Force encapsulation for Nat Traversal") private Boolean encap; - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account associated with the gateway. Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "The Account associated with the gateway. Must be used with the domainId parameter.") private String accountName; @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, - description = "the domain ID associated with the gateway. If used with the account parameter returns the " - + "gateway associated with the account for the specified domain.") + description = "The domain ID associated with the gateway. If used with the account parameter returns the " + + "gateway associated with the Account for the specified domain.") private Long domainId; @Parameter(name = ApiConstants.SPLIT_CONNECTIONS, type = CommandType.BOOLEAN, required = false, description = "For IKEv2, whether to split multiple right subnet cidrs into multiple connection statements.", @@ -161,7 +161,7 @@ public String getIkeVersion() { @Override public long getEntityOwnerId() { - Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); + Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true); if (accountId == null) { accountId = CallContext.current().getCallingAccount().getId(); } diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java index 9fe5ae0480f7..25076991217f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java @@ -27,7 +27,7 @@ import com.cloud.network.Site2SiteVpnGateway; import com.cloud.user.Account; -@APICommand(name = "updateVpnGateway", description = "Updates site to site vpn local gateway", responseObject = Site2SiteVpnGatewayResponse.class, since = "4.4", +@APICommand(name = "updateVpnGateway", description = "Updates site to site VPN local gateway", responseObject = Site2SiteVpnGatewayResponse.class, since = "4.4", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { @@ -35,10 +35,10 @@ public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, description = "id of customer gateway") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = Site2SiteVpnGatewayResponse.class, required = true, description = "ID of customer gateway") private Long id; - @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "An optional field, whether to the display the VPN to the end User or not", since = "4.4", authorized = {RoleType.Admin}) private Boolean display; ///////////////////////////////////////////////////// @@ -63,7 +63,7 @@ public long getEntityOwnerId() { @Override public String getEventDescription() { - return "Update site-to-site VPN gateway id= " + id; + return "Update site-to-site VPN gateway ID = " + id; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java index d926257437e6..55f70b9edcdf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/zone/ListZonesCmd.java @@ -34,12 +34,10 @@ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ListZonesCmd extends BaseListCmd implements UserCmd { - private static final String s_name = "listzonesresponse"; - ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the zone") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The ID of the zone") private Long id; @Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ZoneResponse.class, description = "the IDs of the zones, mutually exclusive with id", since = "4.19.0") @@ -47,28 +45,33 @@ public class ListZonesCmd extends BaseListCmd implements UserCmd { @Parameter(name = ApiConstants.AVAILABLE, type = CommandType.BOOLEAN, - description = "true if you want to retrieve all available Zones. False if you only want to return the Zones" - + " from which you have at least one VM. Default is false.") + description = "True if you want to retrieve all available Zones. False if you only want to return the Zones" + + " from which you have at least one Instance. Default is false.") private Boolean available; - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the ID of the domain associated with the zone") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The ID of the domain associated with the zone") private Long domainId; - @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the zone") + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name of the zone") private String name; - @Parameter(name = ApiConstants.NETWORK_TYPE, type = CommandType.STRING, description = "the network type of the zone that the virtual machine belongs to") + @Parameter(name = ApiConstants.NETWORK_TYPE, type = CommandType.STRING, description = "The Network type of the zone that the Instance belongs to") private String networkType; - @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the zones") + @Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "Flag to display the capacity of the zones") private Boolean showCapacities; @Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List zones by resource tags (key/value pairs)", since = "4.3") private Map tags; - @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "flag to display the resource image for the zones") + @Parameter(name = ApiConstants.SHOW_RESOURCE_ICON, type = CommandType.BOOLEAN, description = "Flag to display the resource image for the zones") private Boolean showIcon; + @Parameter(name = ApiConstants.STORAGE_ACCESS_GROUP, type = CommandType.STRING, + description = "the name of the storage access group", + since = "4.21.0") + private String storageAccessGroup; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -109,15 +112,22 @@ public Boolean getShowIcon () { return showIcon != null ? showIcon : false; } + public String getStorageAccessGroup() { + return storageAccessGroup; + } + + public ListZonesCmd() { + + } + + public ListZonesCmd(String storageAccessGroup) { + this.storageAccessGroup = storageAccessGroup; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @Override - public String getCommandName() { - return s_name; - } - @Override public void execute() { ListResponse response = _queryService.listDataCenters(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/utils/OfferingUtils.java b/api/src/main/java/org/apache/cloudstack/api/command/utils/OfferingUtils.java new file mode 100644 index 000000000000..433a37c07cde --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/command/utils/OfferingUtils.java @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.utils; + +import com.cloud.offering.NetworkOffering; + +public class OfferingUtils { + + private OfferingUtils() { + } + + public static boolean isNetrisNatted(String provider, String networkMode) { + return "Netris".equalsIgnoreCase(provider) && + NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(networkMode); + } + + public static boolean isNsxWithoutLb(String provider, boolean nsxSupportsLbService) { + return "Nsx".equalsIgnoreCase(provider) && !nsxSupportsLbService; + } + + public static boolean isNetrisRouted(String provider, String networkMode) { + return "Netris".equalsIgnoreCase(provider) && NetworkOffering.NetworkMode.ROUTED.name().equalsIgnoreCase(networkMode); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java index aaad7f985fc3..93529b8a8887 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AccountResponse.java @@ -32,99 +32,99 @@ @EntityReference(value = Account.class) public class AccountResponse extends BaseResponse implements ResourceLimitAndCountResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the account") + @Param(description = "The ID of the Account") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the account") + @Param(description = "The name of the Account") private String name; @SerializedName(ApiConstants.ACCOUNT_TYPE) - @Param(description = "account type (admin, domain-admin, user)") + @Param(description = "Account type (admin, domain-admin, user)") private Integer accountType; @SerializedName(ApiConstants.ROLE_ID) - @Param(description = "the ID of the role") + @Param(description = "The ID of the role") private String roleId; @SerializedName(ApiConstants.ROLE_TYPE) - @Param(description = "the type of the role (Admin, ResourceAdmin, DomainAdmin, User)") + @Param(description = "The type of the role (Admin, ResourceAdmin, DomainAdmin, User)") private String roleType; @SerializedName(ApiConstants.ROLE_NAME) - @Param(description = "the name of the role") + @Param(description = "The name of the role") private String roleName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "id of the Domain the account belongs to") + @Param(description = "ID of the Domain the Account belongs to") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "name of the Domain the account belongs to") + @Param(description = "Name of the Domain the Account belongs to") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain the account belongs to", since = "4.13") + @Param(description = "Path of the Domain the Account belongs to", since = "4.13") private String domainPath; @SerializedName(ApiConstants.DEFAULT_ZONE_ID) - @Param(description = "the default zone of the account") + @Param(description = "The default zone of the Account") private String defaultZoneId; @SerializedName(ApiConstants.RECEIVED_BYTES) - @Param(description = "the total number of network traffic bytes received") + @Param(description = "The total number of Network traffic bytes received") private Long bytesReceived; @SerializedName(ApiConstants.SENT_BYTES) - @Param(description = "the total number of network traffic bytes sent") + @Param(description = "The total number of Network traffic bytes sent") private Long bytesSent; @SerializedName(ApiConstants.VM_LIMIT) - @Param(description = "the total number of virtual machines that can be deployed by this account") + @Param(description = "The total number of Instances that can be deployed by this Account") private String vmLimit; @SerializedName(ApiConstants.VM_TOTAL) - @Param(description = "the total number of virtual machines deployed by this account") + @Param(description = "The total number of Instances deployed by this Account") private Long vmTotal; @SerializedName(ApiConstants.VM_AVAILABLE) - @Param(description = "the total number of virtual machines available for this account to acquire") + @Param(description = "The total number of Instances available for this Account to acquire") private String vmAvailable; @SerializedName(ApiConstants.IP_LIMIT) - @Param(description = "the total number of public ip addresses this account can acquire") + @Param(description = "The total number of public IP addresses this Account can acquire") private String ipLimit; @SerializedName(ApiConstants.IP_TOTAL) - @Param(description = "the total number of public ip addresses allocated for this account") + @Param(description = "The total number of public IP addresses allocated for this Account") private Long ipTotal; @SerializedName(ApiConstants.IP_AVAILABLE) - @Param(description = "the total number of public ip addresses available for this account to acquire") + @Param(description = "The total number of public IP addresses available for this Account to acquire") private String ipAvailable; @SerializedName("volumelimit") - @Param(description = "the total volume which can be used by this account") + @Param(description = "The total volume which can be used by this Account") private String volumeLimit; @SerializedName("volumetotal") - @Param(description = "the total volume being used by this account") + @Param(description = "The total volume being used by this Account") private Long volumeTotal; @SerializedName("volumeavailable") - @Param(description = "the total volume available for this account") + @Param(description = "The total volume available for this Account") private String volumeAvailable; @SerializedName("snapshotlimit") - @Param(description = "the total number of snapshots which can be stored by this account") + @Param(description = "The total number of Snapshots which can be stored by this Account") private String snapshotLimit; @SerializedName("snapshottotal") - @Param(description = "the total number of snapshots stored by this account") + @Param(description = "The total number of Snapshots stored by this Account") private Long snapshotTotal; @SerializedName("snapshotavailable") - @Param(description = "the total number of snapshots available for this account") + @Param(description = "The total number of Snapshots available for this Account") private String snapshotAvailable; @SerializedName(ApiConstants.BACKUP_LIMIT) @@ -152,107 +152,119 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou private String backupStorageAvailable; @SerializedName("templatelimit") - @Param(description = "the total number of templates which can be created by this account") + @Param(description = "The total number of Templates which can be created by this Account") private String templateLimit; @SerializedName("templatetotal") - @Param(description = "the total number of templates which have been created by this account") + @Param(description = "The total number of Templates which have been created by this Account") private Long templateTotal; @SerializedName("templateavailable") - @Param(description = "the total number of templates available to be created by this account") + @Param(description = "The total number of Templates available to be created by this Account") private String templateAvailable; @SerializedName("vmstopped") - @Param(description = "the total number of virtual machines stopped for this account") + @Param(description = "The total number of Instances stopped for this Account") private Integer vmStopped; @SerializedName("vmrunning") - @Param(description = "the total number of virtual machines running for this account") + @Param(description = "The total number of Instances running for this Account") private Integer vmRunning; @SerializedName("projectlimit") - @Param(description = "the total number of projects the account can own", since = "3.0.1") + @Param(description = "The total number of projects the Account can own", since = "3.0.1") private String projectLimit; @SerializedName("projecttotal") - @Param(description = "the total number of projects being administrated by this account", since = "3.0.1") + @Param(description = "The total number of projects being administrated by this Account", since = "3.0.1") private Long projectTotal; @SerializedName("projectavailable") - @Param(description = "the total number of projects available for administration by this account", since = "3.0.1") + @Param(description = "The total number of projects available for administration by this Account", since = "3.0.1") private String projectAvailable; @SerializedName("networklimit") - @Param(description = "the total number of networks the account can own", since = "3.0.1") + @Param(description = "The total number of Networks the Account can own", since = "3.0.1") private String networkLimit; @SerializedName("networktotal") - @Param(description = "the total number of networks owned by account", since = "3.0.1") + @Param(description = "The total number of Networks owned by Account", since = "3.0.1") private Long networkTotal; @SerializedName("networkavailable") - @Param(description = "the total number of networks available to be created for this account", since = "3.0.1") + @Param(description = "The total number of Networks available to be created for this Account", since = "3.0.1") private String networkAvailable; @SerializedName("vpclimit") - @Param(description = "the total number of vpcs the account can own", since = "4.0.0") + @Param(description = "The total number of VPCs the Account can own", since = "4.0.0") private String vpcLimit; @SerializedName("vpctotal") - @Param(description = "the total number of vpcs owned by account", since = "4.0.0") + @Param(description = "The total number of VPCs owned by account", since = "4.0.0") private Long vpcTotal; @SerializedName("vpcavailable") - @Param(description = "the total number of vpcs available to be created for this account", since = "4.0.0") + @Param(description = "The total number of VPCs available to be created for this account", since = "4.0.0") private String vpcAvailable; @SerializedName("cpulimit") - @Param(description = "the total number of cpu cores the account can own", since = "4.2.0") + @Param(description = "The total number of CPU cores the account can own", since = "4.2.0") private String cpuLimit; @SerializedName("cputotal") - @Param(description = "the total number of cpu cores owned by account", since = "4.2.0") + @Param(description = "The total number of CPU cores owned by account", since = "4.2.0") private Long cpuTotal; @SerializedName("cpuavailable") - @Param(description = "the total number of cpu cores available to be created for this account", since = "4.2.0") + @Param(description = "The total number of CPU cores available to be created for this account", since = "4.2.0") private String cpuAvailable; @SerializedName("memorylimit") - @Param(description = "the total memory (in MB) the account can own", since = "4.2.0") + @Param(description = "The total memory (in MB) the account can own", since = "4.2.0") private String memoryLimit; @SerializedName("memorytotal") - @Param(description = "the total memory (in MB) owned by account", since = "4.2.0") + @Param(description = "The total memory (in MB) owned by account", since = "4.2.0") private Long memoryTotal; @SerializedName("memoryavailable") - @Param(description = "the total memory (in MB) available to be created for this account", since = "4.2.0") + @Param(description = "The total memory (in MB) available to be created for this account", since = "4.2.0") private String memoryAvailable; + @SerializedName("gpulimit") + @Param(description = "the total number of gpus the account can own", since = "4.21.0") + private String gpuLimit; + + @SerializedName("gputotal") + @Param(description = "the total number of gpus owned by account", since = "4.21.0") + private Long gpuTotal; + + @SerializedName("gpuavailable") + @Param(description = "the total number of gpus available to be created for this account", since = "4.21.0") + private String gpuAvailable; + @SerializedName("primarystoragelimit") - @Param(description = "the total primary storage space (in GiB) the account can own", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) the account can own", since = "4.2.0") private String primaryStorageLimit; @SerializedName("primarystoragetotal") - @Param(description = "the total primary storage space (in GiB) owned by account", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) owned by account", since = "4.2.0") private Long primaryStorageTotal; @SerializedName("primarystorageavailable") - @Param(description = "the total primary storage space (in GiB) available to be used for this account", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) available to be used for this account", since = "4.2.0") private String primaryStorageAvailable; @SerializedName("secondarystoragelimit") - @Param(description = "the total secondary storage space (in GiB) the account can own", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) the account can own", since = "4.2.0") private String secondaryStorageLimit; @SerializedName("secondarystoragetotal") - @Param(description = "the total secondary storage space (in GiB) owned by account", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) owned by account", since = "4.2.0") private float secondaryStorageTotal; @SerializedName("secondarystorageavailable") - @Param(description = "the total secondary storage space (in GiB) available to be used for this account", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) available to be used for this account", since = "4.2.0") private String secondaryStorageAvailable; @SerializedName(ApiConstants.BUCKET_LIMIT) @@ -280,35 +292,35 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou private String objectStorageAvailable; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the account") + @Param(description = "The state of the account") private String state; @SerializedName(ApiConstants.IS_CLEANUP_REQUIRED) - @Param(description = "true if the account requires cleanup") + @Param(description = "True if the account requires cleanup") private Boolean cleanupRequired; @SerializedName(ApiConstants.CREATED) - @Param(description="the date when this account was created") + @Param(description = "The date when this account was created") private Date created; @SerializedName("user") - @Param(description = "the list of users associated with account", responseObject = UserResponse.class) + @Param(description = "The list of users associated with account", responseObject = UserResponse.class) private List users; @SerializedName(ApiConstants.NETWORK_DOMAIN) - @Param(description = "the network domain") + @Param(description = "The Network domain") private String networkDomain; @SerializedName(ApiConstants.ACCOUNT_DETAILS) - @Param(description = "details for the account") + @Param(description = "Details for the account") private Map details; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if account is default, false otherwise", since = "4.2.0") + @Param(description = "True if account is default, false otherwise", since = "4.2.0") private Boolean isDefault; @SerializedName(ApiConstants.IAM_GROUPS) - @Param(description = "the list of acl groups that account belongs to", since = "4.4") + @Param(description = "The list of ACL groups that account belongs to", since = "4.4") private List groups; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -489,6 +501,21 @@ public void setVmRunning(Integer vmRunning) { this.vmRunning = vmRunning; } + @Override + public void setGpuLimit(String gpuLimit) { + this.gpuLimit = gpuLimit; + } + + @Override + public void setGpuTotal(Long gpuTotal) { + this.gpuTotal = gpuTotal; + } + + @Override + public void setGpuAvailable(String gpuAvailable) { + this.gpuAvailable = gpuAvailable; + } + public void setState(String state) { this.state = state; } @@ -542,7 +569,7 @@ public void setNetworkAvailable(String networkAvailable) { @Override public void setVpcLimit(String vpcLimit) { - this.vpcLimit = networkLimit; + this.vpcLimit = vpcLimit; } @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java index 06351a40d9db..cb0b14054775 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AcquireIPAddressResponse.java @@ -32,47 +32,47 @@ @SuppressWarnings("unused") public class AcquireIPAddressResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "public IP address id") + @Param(description = "Public IP address id") private String id; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "public IP address") + @Param(description = "Public IP address") private String ipAddress; @SerializedName("allocated") - @Param(description = "date the public IP address was acquired") + @Param(description = "Date the public IP address was acquired") private Date allocated; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the zone the public IP address belongs to") + @Param(description = "The ID of the zone the public IP address belongs to") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the public IP address belongs to") + @Param(description = "The name of the zone the public IP address belongs to") private String zoneName; @SerializedName("issourcenat") - @Param(description = "true if the IP address is a source nat address, false otherwise") + @Param(description = "True if the IP address is a source NAT address, false otherwise") private Boolean sourceNat; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account the public IP address is associated with") + @Param(description = "The Account the public IP address is associated with") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project id of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID the public IP address is associated with") + @Param(description = "The domain ID the public IP address is associated with") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain the public IP address is associated with") + @Param(description = "The domain the public IP address is associated with") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -80,78 +80,78 @@ public class AcquireIPAddressResponse extends BaseResponse implements Controlle private String domainPath; @SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK) - @Param(description = "the virtual network for the IP address") + @Param(description = "The virtual Network for the IP address") private Boolean forVirtualNetwork; @SerializedName(ApiConstants.VLAN_ID) - @Param(description = "the ID of the VLAN associated with the IP address." + " This parameter is visible to ROOT admins only") + @Param(description = "The ID of the VLAN associated with the IP address." + " This parameter is visible to ROOT admins only") private String vlanId; @SerializedName("vlanname") - @Param(description = "the VLAN associated with the IP address") + @Param(description = "The VLAN associated with the IP address") private String vlanName; @SerializedName("isstaticnat") - @Param(description = "true if this ip is for static nat, false otherwise") + @Param(description = "True if this IP is for static NAT, false otherwise") private Boolean staticNat; @SerializedName(ApiConstants.IS_SYSTEM) - @Param(description = "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)") + @Param(description = "True if this IP is system IP (was allocated as a part of deployVm or createLbRule)") private Boolean isSystem; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "virtual machine id the ip address is assigned to (not null only for static nat Ip)") + @Param(description = "Instance id the IP address is assigned to (not null only for static NAT IP)") private String virtualMachineId; @SerializedName("vmipaddress") - @Param(description = "virtual machine (dnat) ip address (not null only for static nat Ip)") + @Param(description = "Instance (DNAT) IP address (not null only for static NAT IP)") private String virtualMachineIp; @SerializedName("virtualmachinename") - @Param(description = "virtual machine name the ip address is assigned to (not null only for static nat Ip)") + @Param(description = "Instance name the IP address is assigned to (not null only for static NAT IP)") private String virtualMachineName; @SerializedName("virtualmachinedisplayname") - @Param(description = "virtual machine display name the ip address is assigned to (not null only for static nat Ip)") + @Param(description = "Instance display name the IP address is assigned to (not null only for static NAT IP)") private String virtualMachineDisplayName; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) - @Param(description = "the ID of the Network associated with the IP address") + @Param(description = "The ID of the Network associated with the IP address") private String associatedNetworkId; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) - @Param(description = "the name of the Network associated with the IP address") + @Param(description = "The name of the Network associated with the IP address") private String associatedNetworkName; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the ID of the Network where ip belongs to") + @Param(description = "The ID of the Network where IP belongs to") private String networkId; @SerializedName(ApiConstants.STATE) - @Param(description = "State of the ip address. Can be: Allocating, Allocated and Releasing") + @Param(description = "State of the IP address. Can be: Allocating, Allocated and Releasing") private String state; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.PURPOSE) - @Param(description = "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value") + @Param(description = "Purpose of the IP address. In Acton this value is not null for IPs with isSystem=true, and can have either StaticNat or LB value") private String purpose; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "VPC the ip belongs to") + @Param(description = "VPC the IP belongs to") private String vpcId; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with IP address", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.IS_PORTABLE) - @Param(description = "is public IP portable across the zones") + @Param(description = "Is public IP portable across the zones") private Boolean isPortable; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is public IP for display to the regular User", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setIpAddress(String ipAddress) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java index 2226efd063d2..fb95c5b8130c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AcquirePodIpCmdResponse.java @@ -31,7 +31,7 @@ public class AcquirePodIpCmdResponse extends BaseResponse { private String ipAddress; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the ID of the pod the IP address belongs to") + @Param(description = "The ID of the pod the IP address belongs to") private Long podId; @SerializedName(ApiConstants.GATEWAY) @@ -43,15 +43,15 @@ public class AcquirePodIpCmdResponse extends BaseResponse { private String cidrAddress; @SerializedName(ApiConstants.NIC_ID) - @Param(description = "the ID of the nic") + @Param(description = "The ID of the NIC") private Long nicId; @SerializedName(ApiConstants.HOST_MAC) - @Param(description = "MAC address of the pod the IP") + @Param(description = "MAC address of the pod the IP") private Long macAddress; @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the pod the IP address") + @Param(description = "The ID of the pod the IP address") private long id; public void setIpAddress(String ipAddress) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java index faa64b0c0909..00c94a6fd0e7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AlertResponse.java @@ -31,7 +31,7 @@ @SuppressWarnings("unused") public class AlertResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the alert") + @Param(description = "The ID of the alert") private String id; @SerializedName(ApiConstants.TYPE) @@ -46,15 +46,15 @@ public class AlertResponse extends BaseResponse { private Short alertType; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the alert", since = "4.3") + @Param(description = "The name of the alert", since = "4.3") private String alertName; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "description of the alert") + @Param(description = "Description of the alert") private String description; @SerializedName(ApiConstants.SENT) - @Param(description = "the date and time the alert was sent") + @Param(description = "The date and time the alert was sent") private Date lastSent; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AlertTypeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AlertTypeResponse.java index 3f91cde01788..e8c3cf6c4ac7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AlertTypeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AlertTypeResponse.java @@ -16,11 +16,12 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + public class AlertTypeResponse extends BaseResponse { @SerializedName("alerttypeid") @@ -31,6 +32,10 @@ public class AlertTypeResponse extends BaseResponse { @Param(description = "description of alert type") private String name; + @SerializedName(ApiConstants.REPETITION_ALLOWED) + @Param(description = "Whether repetitive alerts allowed for the alert type", since = "4.22.0") + private boolean repetitionAllowed = true; + public String getName() { return name; } @@ -47,9 +52,10 @@ public void setUsageType(short alertType) { this.alertType = alertType; } - public AlertTypeResponse(short alertType, String name) { + public AlertTypeResponse(short alertType, String name, boolean repetitionAllowed) { this.alertType = alertType; this.name = name; + this.repetitionAllowed = repetitionAllowed; setObjectName("alerttype"); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java index 86d485ac751e..62ffd6c6256d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AnnotationResponse.java @@ -32,31 +32,31 @@ @EntityReference(value = Annotation.class) public class AnnotationResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the (uu)id of the annotation") + @Param(description = "The UUID of the annotation") private String uuid; @SerializedName(ApiConstants.ENTITY_TYPE) - @Param(description = "the type of the annotated entity") + @Param(description = "The type of the annotated entity") private String entityType; @SerializedName(ApiConstants.ENTITY_ID) - @Param(description = "the (uu)id of the entity to which this annotation pertains") + @Param(description = "The UUID of the entity to which this annotation pertains") private String entityUuid; @SerializedName(ApiConstants.ENTITY_NAME) - @Param(description = "the name of the entity to which this annotation pertains") + @Param(description = "The name of the entity to which this annotation pertains") private String entityName; @SerializedName(ApiConstants.ANNOTATION) - @Param(description = "the contents of the annotation") + @Param(description = "The contents of the annotation") private String annotation; @SerializedName(ApiConstants.USER_ID) - @Param(description = "The (uu)id of the user that entered the annotation") + @Param(description = "The UUID of the User that entered the annotation") private String userUuid; @SerializedName(ApiConstants.USERNAME) - @Param(description = "The username of the user that entered the annotation") + @Param(description = "The username of the User that entered the annotation") private String username; @SerializedName(ApiConstants.ADMINS_ONLY) @@ -64,11 +64,11 @@ public class AnnotationResponse extends BaseResponse { private Boolean adminsOnly; @SerializedName(ApiConstants.CREATED) - @Param(description = "the creation timestamp for this annotation") + @Param(description = "The creation timestamp for this annotation") private Date created; @SerializedName(ApiConstants.REMOVED) - @Param(description = "the removal timestamp for this annotation") + @Param(description = "The removal timestamp for this annotation") private Date removed; public String getUuid() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ApiKeyPairResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApiKeyPairResponse.java new file mode 100644 index 000000000000..350d71b37887 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ApiKeyPairResponse.java @@ -0,0 +1,285 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.user.ApiKeyPairState; +import com.google.gson.annotations.SerializedName; + +import java.util.Date; +import java.util.List; + +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; +import org.apache.cloudstack.api.ApiConstants; + +import com.cloud.serializer.Param; +import org.apache.cloudstack.api.BaseResponseWithAnnotations; +import org.apache.cloudstack.api.EntityReference; + +@EntityReference(value = ApiKeyPair.class) +public class ApiKeyPairResponse extends BaseResponseWithAnnotations { + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the API key pair") + private String name; + + @SerializedName(ApiConstants.API_KEY) + @Param(description = "The API key of the registered user.", isSensitive = true) + private String userApiKey; + + @SerializedName(ApiConstants.SECRET_KEY) + @Param(description = "The secret key of the registered user.", isSensitive = true) + private String userSecretKey; + + @SerializedName(ApiConstants.USER_ID) + @Param(description = "ID of the user that owns the keypair.") + private String userId; + + @SerializedName(ApiConstants.USERNAME) + @Param(description = "Username of the keypair's owner.") + private String username; + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the API key pair.", isSensitive = true) + private String id; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "API key pair description.") + private String description; + + @SerializedName(ApiConstants.START_DATE) + @Param(description = "API key pair start date.") + private Date startDate; + + @SerializedName(ApiConstants.END_DATE) + @Param(description = "API key pair expiration date.") + private Date endDate; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "API key pair creation timestamp.") + private Date created; + + @SerializedName(ApiConstants.ACCOUNT_TYPE) + @Param(description = "Account type.") + private String accountType; + + @SerializedName(ApiConstants.ACCOUNT_ID) + @Param(description = "Account ID.") + private String accountId; + + @SerializedName(ApiConstants.ACCOUNT_NAME) + @Param(description = "Account name.") + private String accountName; + + @SerializedName(ApiConstants.ROLE_ID) + @Param(description = "ID of the role.") + private String roleId; + + @SerializedName(ApiConstants.ROLE_TYPE) + @Param(description = "Type of the role (Admin, ResourceAdmin, DomainAdmin, User).") + private String roleType; + + @SerializedName(ApiConstants.ROLE_NAME) + @Param(description = "Name of the role.") + private String roleName; + + @SerializedName(ApiConstants.PERMISSIONS) + @Param(description = "Permissions of the API key pair.") + private List permissions; + + @SerializedName(ApiConstants.DOMAIN_ID) + @Param(description = "ID of the domain which the account belongs to.") + private String domainId; + + @SerializedName(ApiConstants.DOMAIN) + @Param(description = "Name of the domain which the account belongs to.") + private String domainName; + + @SerializedName(ApiConstants.DOMAIN_PATH) + @Param(description = "Path of the domain which the account belongs to.") + private String domainPath; + + @SerializedName(ApiConstants.STATE) + @Param(description = "State of the API key pair.") + private ApiKeyPairState state; + + public String getApiKey() { + return userApiKey; + } + + public void setApiKey(String apiKey) { + this.userApiKey = apiKey; + } + + public String getSecretKey() { + return userSecretKey; + } + + public void setSecretKey(String secretKey) { + this.userSecretKey = secretKey; + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getRoleType() { + return roleType; + } + + public void setRoleType(String roleType) { + this.roleType = roleType; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getDomainId() { + return domainId; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public String getDomainPath() { + return domainPath; + } + + public void setDomainPath(String domainPath) { + this.domainPath = domainPath; + } + + public ApiKeyPairState getState() { + return state; + } + + public void setState(ApiKeyPairState state) { + this.state = state; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java index bdbb954df03a..2ebc25e72404 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerInstanceResponse.java @@ -32,19 +32,19 @@ public class ApplicationLoadBalancerInstanceResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the instance ID") + @Param(description = "The Instance ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the instance") + @Param(description = "The name of the Instance") private String name; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the instance") + @Param(description = "The state of the Instance") private String state; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the ip address of the instance") + @Param(description = "The IP address of the Instance") private String ipAddress; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java index 0b6485bfc142..e900bebe05f0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerResponse.java @@ -29,51 +29,51 @@ @SuppressWarnings("unused") public class ApplicationLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the Load Balancer ID") + @Param(description = "The Load Balancer ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the Load Balancer") + @Param(description = "The name of the Load Balancer") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the Load Balancer") + @Param(description = "The description of the Load Balancer") private String description; @SerializedName(ApiConstants.ALGORITHM) - @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)") + @Param(description = "The Load balancer algorithm (source, roundrobin, leastconn)") private String algorithm; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "Load Balancer network id") + @Param(description = "Load Balancer Network id") private String networkId; @SerializedName(ApiConstants.SOURCE_IP) - @Param(description = "Load Balancer source ip") + @Param(description = "Load Balancer source IP") private String sourceIp; @SerializedName(ApiConstants.SOURCE_IP_NETWORK_ID) - @Param(description = "Load Balancer source ip network id") + @Param(description = "Load Balancer source IP Network id") private String sourceIpNetworkId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the Load Balancer") + @Param(description = "The Account of the Load Balancer") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the Load Balancer") + @Param(description = "The project id of the Load Balancer") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the Load Balancer") + @Param(description = "The project name of the Load Balancer") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the Load Balancer") + @Param(description = "The domain ID of the Load Balancer") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain of the Load Balancer") + @Param(description = "The domain of the Load Balancer") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -81,19 +81,19 @@ public class ApplicationLoadBalancerResponse extends BaseResponse implements Con private String domainPath; @SerializedName("loadbalancerrule") - @Param(description = "the list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class) + @Param(description = "The list of rules associated with the Load Balancer", responseObject = ApplicationLoadBalancerRuleResponse.class) private List lbRules; @SerializedName("loadbalancerinstance") - @Param(description = "the list of instances associated with the Load Balancer", responseObject = ApplicationLoadBalancerInstanceResponse.class) + @Param(description = "The list of Instances associated with the Load Balancer", responseObject = ApplicationLoadBalancerInstanceResponse.class) private List lbInstances; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the Load Balancer", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is rule for display to the regular User", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java index 8af64276c9e1..d6d8c2f95563 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ApplicationLoadBalancerRuleResponse.java @@ -30,15 +30,15 @@ @SuppressWarnings("unused") public class ApplicationLoadBalancerRuleResponse extends BaseResponse { @SerializedName(ApiConstants.SOURCE_PORT) - @Param(description = "source port of the load balancer rule") + @Param(description = "Source port of the Load balancer rule") private Integer sourcePort; @SerializedName(ApiConstants.INSTANCE_PORT) - @Param(description = "instance port of the load balancer rule") + @Param(description = "Instance port of the Load balancer rule") private Integer instancePort; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the load balancer rule") + @Param(description = "The state of the Load balancer rule") private String state; public void setSourcePort(Integer sourcePort) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java index 5b47a7a06e4b..5be0052069ec 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AsyncJobResponse.java @@ -32,59 +32,55 @@ public class AsyncJobResponse extends BaseResponse { @SerializedName("accountid") - @Param(description = "the account id that executed the async command") + @Param(description = "The Account ID that executed the async command") private String accountId; @SerializedName("account") - @Param(description = "the account that executed the async command") + @Param(description = "The Account that executed the async command") private String account; @SerializedName("domainid") - @Param(description = "the domain id that executed the async command") + @Param(description = "The domain ID that executed the async command") private String domainid; @SerializedName("domainpath") - @Param(description = "the domain that executed the async command") + @Param(description = "The domain that executed the async command") private String domainPath; @SerializedName(ApiConstants.USER_ID) - @Param(description = "the user that executed the async command") + @Param(description = "The User that executed the async command") private String userId; @SerializedName("cmd") - @Param(description = "the async command executed") + @Param(description = "The async command executed") private String cmd; - @SerializedName("jobstatus") - @Param(description = "the current job status-should be 0 for PENDING") - private Integer jobStatus; - @SerializedName("jobprocstatus") - @Param(description = "the progress information of the PENDING job") + @Param(description = "The progress information of the PENDING job") private Integer jobProcStatus; @SerializedName("jobresultcode") - @Param(description = "the result code for the job") + @Param(description = "The result code for the job") private Integer jobResultCode; @SerializedName("jobresulttype") - @Param(description = "the result type") + @Param(description = "The result type") private String jobResultType; @SerializedName("jobresult") - @Param(description = "the result reason") + @Param(description = "The result reason") private ResponseObject jobResult; @SerializedName("jobinstancetype") - @Param(description = "the instance/entity object related to the job") + @Param(description = "The Instance/entity object related to the job") private String jobInstanceType; @SerializedName("jobinstanceid") - @Param(description = "the unique ID of the instance/entity object related to the job") + @Param(description = "The unique ID of the Instance/entity object related to the job") private String jobInstanceId; @SerializedName(ApiConstants.MANAGEMENT_SERVER_ID) - @Param(description = "the msid of the management server on which the job is running", since = "4.19") + @Param(description = "The MSID of the management server on which the job is running", since = "4.19") private String managementServerId; @SerializedName(ApiConstants.MANAGEMENT_SERVER_NAME) @@ -92,11 +88,11 @@ public class AsyncJobResponse extends BaseResponse { private String managementServerName; @SerializedName(ApiConstants.CREATED) - @Param(description = " the created date of the job") + @Param(description = "The created date of the job") private Date created; @SerializedName(ApiConstants.COMPLETED) - @Param(description = " the completed date of the job") + @Param(description = "The completed date of the job") private Date removed; public void setAccountId(String accountId) { @@ -123,11 +119,6 @@ public void setCmd(String cmd) { this.cmd = cmd; } - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } - public void setJobProcStatus(Integer jobProcStatus) { this.jobProcStatus = jobProcStatus; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java index e3f9902dec6a..d2155fb23583 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java @@ -31,47 +31,47 @@ public class AutoScalePolicyResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the autoscale policy ID") + @Param(description = "The autoscale policy ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the autoscale policy") + @Param(description = "Name of the autoscale policy") private String name; @SerializedName(ApiConstants.ACTION) - @Param(description = "the action to be executed if all the conditions evaluate to true for the specified duration.") + @Param(description = "The action to be executed if all the conditions evaluate to true for the specified duration.") private String action; @SerializedName(ApiConstants.DURATION) - @Param(description = "the duration for which the conditions have to be true before action is taken") + @Param(description = "The duration for which the conditions have to be true before action is taken") private Integer duration; @SerializedName(ApiConstants.QUIETTIME) - @Param(description = "the cool down period for which the policy should not be evaluated after the action has been taken") + @Param(description = "The cool down period for which the policy should not be evaluated after the action has been taken") private Integer quietTime; @SerializedName("conditions") - @Param(description = "the list of IDs of the conditions that are being evaluated on every interval") + @Param(description = "The list of IDs of the conditions that are being evaluated on every interval") private List conditions; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the autoscale policy") + @Param(description = "The Account owning the autoscale policy") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id autoscale policy") + @Param(description = "The project id autoscale policy") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the autoscale policy") + @Param(description = "The project name of the autoscale policy") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the autoscale policy") + @Param(description = "The domain ID of the autoscale policy") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the autoscale policy") + @Param(description = "The domain name of the autoscale policy") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java index b1389acdecb3..921e3f6166a3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java @@ -32,95 +32,95 @@ public class AutoScaleVmGroupResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the autoscale vm group ID") + @Param(description = "The autoscale Instance group ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the autoscale vm group ") + @Param(description = "The name of the autoscale Instance group ") private String name; @SerializedName(ApiConstants.LBID) - @Param(description = "the load balancer rule ID") + @Param(description = "The Load balancer rule ID") private String loadBalancerId; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) - @Param(description = "the name of the guest network the lb rule belongs to") + @Param(description = "The name of the guest Network the LB rule belongs to") private String networkName; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) - @Param(description = "the id of the guest network the lb rule belongs to") + @Param(description = "The id of the guest Network the LB rule belongs to") private String networkId; @SerializedName(ApiConstants.LB_PROVIDER) - @Param(description = "the lb provider of the guest network the lb rule belongs to") + @Param(description = "The LB provider of the guest Network the LB rule belongs to") private String lbProvider; @SerializedName(ApiConstants.PUBLIC_IP_ID) - @Param(description = "the public ip address id") + @Param(description = "The public IP address ID") private String publicIpId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public ip address") + @Param(description = "The public IP address") private String publicIp; @SerializedName(ApiConstants.PUBLIC_PORT) - @Param(description = "the public port") + @Param(description = "The public port") private String publicPort; @SerializedName(ApiConstants.PRIVATE_PORT) - @Param(description = "the private port") + @Param(description = "The private port") private String privatePort; @SerializedName(ApiConstants.VMPROFILE_ID) - @Param(description = "the autoscale profile that contains information about the vms in the vm group.") + @Param(description = "The autoscale profile that contains information about the Instances in the Instance group.") private String profileId; @SerializedName(ApiConstants.MIN_MEMBERS) - @Param(description = "the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.") + @Param(description = "The minimum number of members in the Instance Group, the number of Instances in the Instance group will be equal to or more than this number.") private int minMembers; @SerializedName(ApiConstants.MAX_MEMBERS) - @Param(description = "the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.") + @Param(description = "The maximum number of members in the Instance Group, The number of Instances in the Instance group will be equal to or less than this number.") private int maxMembers; @SerializedName(ApiConstants.AVAILABLE_VIRTUAL_MACHINE_COUNT) - @Param(description = "the number of available virtual machines (in Running, Starting, Stopping or Migrating state) in the vmgroup", since = "4.18.0") + @Param(description = "The number of available Instances (in Running, Starting, Stopping or Migrating state) in the Instance Group", since = "4.18.0") private int availableVirtualMachineCount; @SerializedName(ApiConstants.INTERVAL) - @Param(description = "the frequency at which the conditions have to be evaluated") + @Param(description = "The frequency at which the conditions have to be evaluated") private int interval; @SerializedName(ApiConstants.STATE) - @Param(description = "the current state of the AutoScale Vm Group") + @Param(description = "The current state of the AutoScale Instance Group") private String state; @SerializedName(ApiConstants.SCALEUP_POLICIES) - @Param(description = "list of scaleup autoscale policies") + @Param(description = "List of scaleup autoscale policies") private List scaleUpPolicies; @SerializedName(ApiConstants.SCALEDOWN_POLICIES) - @Param(description = "list of scaledown autoscale policies") + @Param(description = "List of scaledown autoscale policies") private List scaleDownPolicies; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the vm group") + @Param(description = "The Account owning the Instance group") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vm group") + @Param(description = "The project id of the Instance group") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vm group") + @Param(description = "The project name of the Instance group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the vm group") + @Param(description = "The domain ID of the Instance group") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the vm group") + @Param(description = "The domain name of the Instance group") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -128,11 +128,11 @@ public class AutoScaleVmGroupResponse extends BaseResponseWithAnnotations implem private String domainPath; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is group for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is group for display to the regular User", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date when this vm group was created") + @Param(description = "The date when this Instance group was created") private Date created; public AutoScaleVmGroupResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java index 22e4eb2288b2..2eda8210fcf8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java @@ -36,29 +36,29 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the autoscale vm profile ID") + @Param(description = "The autoscale Instance profile ID") private String id; /* Parameters related to deploy virtual machine */ @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the availability zone to be used while deploying a virtual machine") + @Param(description = "The availability zone to be used while deploying an Instance") private String zoneId; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) - @Param(description = "the service offering to be used while deploying a virtual machine") + @Param(description = "The service offering to be used while deploying an Instance") private String serviceOfferingId; @SerializedName(ApiConstants.TEMPLATE_ID) - @Param(description = "the template to be used while deploying a virtual machine") + @Param(description = "The Template to be used while deploying an Instance") private String templateId; @SerializedName(ApiConstants.OTHER_DEPLOY_PARAMS) - @Param(description = "parameters other than zoneId/serviceOfferringId/templateId to be used while deploying a virtual machine") + @Param(description = "Parameters other than zoneId/serviceOfferringId/templateId to be used while deploying an Instance") private Map otherDeployParams; /* Parameters related to destroying a virtual machine */ @SerializedName(ApiConstants.AUTOSCALE_EXPUNGE_VM_GRACE_PERIOD) - @Param(description = "the time allowed for existing connections to get closed before a vm is destroyed") + @Param(description = "The time allowed for existing connections to get closed before an Instance is destroyed") private Integer expungeVmGracePeriod; /* Parameters related to a running virtual machine - monitoring aspects */ @@ -69,7 +69,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll private Map counterParams; @SerializedName(ApiConstants.USER_DATA) - @Param(description = "Base64 encoded VM user data") + @Param(description = "Base64 encoded Instance user data") private String userData; @SerializedName(ApiConstants.USER_DATA_ID) @Param(description="the id of userdata used for the VM", since = "4.18.1") @@ -85,33 +85,33 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll private String userDataDetails; @SerializedName(ApiConstants.AUTOSCALE_USER_ID) - @Param(description = "the ID of the user used to launch and destroy the VMs") + @Param(description = "The ID of the User used to launch and destroy the Instances") private String autoscaleUserId; @Parameter(name = ApiConstants.CS_URL, type = CommandType.STRING, - description = "the API URL including port of the CloudStack Management Server example: http://server.cloud.com:8080/client/api?") + description = "The API URL including port of the CloudStack Management Server example: http://server.cloud.com:8080/client/api?") // leaving cloud.com reference above as it serves only as an example private String csUrl; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the instance group") + @Param(description = "The Account owning the Instance group") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id vm profile") + @Param(description = "The project id Instance profile") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vm profile") + @Param(description = "The project name of the Instance profile") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the vm profile") + @Param(description = "The domain ID of the Instance profile") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the vm profile") + @Param(description = "The domain name of the Instance profile") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -119,7 +119,7 @@ public class AutoScaleVmProfileResponse extends BaseResponse implements Controll private String domainPath; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is profile for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is profile for display to the regular User", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public AutoScaleVmProfileResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java index 480ebcfb13d3..c4f3ee31dadc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupOfferingResponse.java @@ -34,31 +34,49 @@ public class BackupOfferingResponse extends BaseResponse { private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name for the backup offering") + @Param(description = "Name for the backup offering") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "description for the backup offering") + @Param(description = "Description for the backup offering") private String description; + @SerializedName(ApiConstants.PROVIDER) + @Param(description = "provider name", since = "4.21.0") + private String provider; + @SerializedName(ApiConstants.EXTERNAL_ID) - @Param(description = "external ID on the provider side") + @Param(description = "External ID on the provider side") private String externalId; @SerializedName(ApiConstants.ALLOW_USER_DRIVEN_BACKUPS) - @Param(description = "whether offering allows user driven ad-hoc/scheduled backups") + @Param(description = "Whether the offering allows User driven ad-hoc/scheduled backups") private Boolean userDrivenBackups; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone ID") + @Param(description = "Zone ID") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "zone name") + @Param(description = "Zone name") private String zoneName; + @SerializedName(ApiConstants.DOMAIN_ID) + @Param(description = "the domain ID(s) this backup offering belongs to.", + since = "4.23.0") + private String domainId; + + @SerializedName(ApiConstants.DOMAIN) + @Param(description = "the domain name(s) this backup offering belongs to.", + since = "4.23.0") + private String domain; + + @SerializedName(ApiConstants.CROSS_ZONE_INSTANCE_CREATION) + @Param(description = "the backups with this offering can be used to create Instances on all Zones", since = "4.22.0") + private Boolean crossZoneInstanceCreation; + @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this backup offering was created") + @Param(description = "The date this backup offering was created") private Date created; public void setId(String id) { @@ -69,6 +87,10 @@ public void setExternalId(String externalId) { this.externalId = externalId; } + public void setProvider(String provider) { + this.provider = provider; + } + public void setName(String name) { this.name = name; } @@ -89,7 +111,20 @@ public void setZoneName(String zoneName) { this.zoneName = zoneName; } + public void setCrossZoneInstanceCreation(Boolean crossZoneInstanceCreation) { + this.crossZoneInstanceCreation = crossZoneInstanceCreation; + } + public void setCreated(Date created) { this.created = created; } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public void setDomain(String domain) { + this.domain = domain; + } + } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupProviderResponse.java index 5227d850887c..af74c509b109 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupProviderResponse.java @@ -28,11 +28,11 @@ @EntityReference(BackupProvider.class) public class BackupProviderResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the CA service provider name") + @Param(description = "The CA service provider name") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the CA service provider") + @Param(description = "The description of the CA service provider") private String description; public String getName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java index 0db51f040349..0d3c830950b2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupRepositoryResponse.java @@ -57,10 +57,18 @@ public class BackupRepositoryResponse extends BaseResponse { @Param(description = "backup type") private String type; + @SerializedName(ApiConstants.MOUNT_OPTIONS) + @Param(description = "mount options", since = "4.22.1") + private String mountOptions; + @SerializedName(ApiConstants.CAPACITY_BYTES) @Param(description = "capacity of the backup repository") private Long capacityBytes; + @SerializedName(ApiConstants.CROSS_ZONE_INSTANCE_CREATION) + @Param(description = "the backups in this repository can be used to create Instances on all Zones") + private Boolean crossZoneInstanceCreation; + @SerializedName("created") @Param(description = "the date and time the backup repository was added") private Date created; @@ -124,6 +132,14 @@ public void setType(String type) { this.type = type; } + public String getMountOptions() { + return mountOptions; + } + + public void setMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + } + public Long getCapacityBytes() { return capacityBytes; } @@ -132,6 +148,14 @@ public void setCapacityBytes(Long capacityBytes) { this.capacityBytes = capacityBytes; } + public Boolean getCrossZoneInstanceCreation() { + return crossZoneInstanceCreation; + } + + public void setCrossZoneInstanceCreation(Boolean crossZoneInstanceCreation) { + this.crossZoneInstanceCreation = crossZoneInstanceCreation; + } + public Date getCreated() { return created; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupResponse.java index 63419680fea3..51fcaa9836e9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupResponse.java @@ -26,82 +26,119 @@ import com.google.gson.annotations.SerializedName; import java.util.Date; +import java.util.Map; @EntityReference(value = Backup.class) public class BackupResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "ID of the VM backup") + @Param(description = "ID of the Instance backup") private String id; + @SerializedName(ApiConstants.NAME) + @Param(description = "name of the backup", since = "4.21.0") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "description for the backup", since = "4.21.0") + private String description; + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "ID of the VM") + @Param(description = "ID of the Instance") private String vmId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME) - @Param(description = "name of the VM") + @Param(description = "Name of the Instance") private String vmName; @SerializedName(ApiConstants.EXTERNAL_ID) - @Param(description = "external backup id") + @Param(description = "External backup id") private String externalId; @SerializedName(ApiConstants.TYPE) - @Param(description = "backup type") + @Param(description = "Backup type") private String type; @SerializedName(ApiConstants.CREATED) - @Param(description = "backup date") + @Param(description = "Backup date") private Date date; @SerializedName(ApiConstants.SIZE) - @Param(description = "backup size in bytes") + @Param(description = "Backup size in bytes") private Long size; @SerializedName(ApiConstants.VIRTUAL_SIZE) - @Param(description = "backup protected (virtual) size in bytes") + @Param(description = "Backup protected (virtual) size in bytes") private Long protectedSize; @SerializedName(ApiConstants.STATUS) - @Param(description = "backup status") + @Param(description = "Backup status") private Backup.Status status; @SerializedName(ApiConstants.VOLUMES) - @Param(description = "backed up volumes") + @Param(description = "Backed up volumes") private String volumes; @SerializedName(ApiConstants.BACKUP_OFFERING_ID) - @Param(description = "backup offering id") + @Param(description = "Backup offering id") private String backupOfferingId; @SerializedName(ApiConstants.BACKUP_OFFERING_NAME) - @Param(description = "backup offering name") + @Param(description = "Backup offering name") private String backupOfferingName; @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "account id") + @Param(description = "Account id") private String accountId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "account name") + @Param(description = "Account name") private String account; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "domain id") + @Param(description = "Domain ID") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "domain name") + @Param(description = "Domain name") private String domain; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id") + @Param(description = "Zone ID") private String zoneId; @SerializedName(ApiConstants.ZONE) - @Param(description = "zone name") + @Param(description = "Zone name") private String zone; + @SerializedName(ApiConstants.VM_DETAILS) + @Param(description = "Lists the vm specific details for the backup", since = "4.21.0") + private Map vmDetails; + + @SerializedName(ApiConstants.INTERVAL_TYPE) + @Param(description = "Interval type of the backup", since = "4.21.0") + private String intervalType; + + @SerializedName(ApiConstants.BACKUP_VM_OFFERING_REMOVED) + @Param(description = "The backup offering corresponding to this backup was removed from the VM", since = "4.21.0") + private Boolean vmOfferingRemoved; + + @SerializedName(ApiConstants.IS_BACKUP_VM_EXPUNGED) + @Param(description = "Indicates whether the VM from which the backup was taken is expunged or not", since = "4.22.0") + private Boolean isVmExpunged; + + @SerializedName(ApiConstants.FROM_CHECKPOINT_ID) + @Param(description = "Previous active checkpoint ID for incremental backups", since = "4.23.0") + private String fromCheckpointId; + + @SerializedName(ApiConstants.TO_CHECKPOINT_ID) + @Param(description = "Next checkpoint ID for incremental backups", since = "4.23.0") + private String toCheckpointId; + + @SerializedName(ApiConstants.HOST_ID) + @Param(description = "Host ID where the backup is running", since = "4.23.0") + private String hostId; + public String getId() { return id; } @@ -110,6 +147,22 @@ public void setId(String id) { this.id = id; } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public String getVmId() { return vmId; } @@ -245,4 +298,56 @@ public String getZone() { public void setZone(String zone) { this.zone = zone; } + + public Map getVmDetails() { + return vmDetails; + } + + public void setVmDetails(Map vmDetails) { + this.vmDetails = vmDetails; + } + + public String getIntervalType() { + return this.intervalType; + } + + public void setIntervalType(String intervalType) { + this.intervalType = intervalType; + } + + public Boolean getVmOfferingRemoved() { + return this.vmOfferingRemoved; + } + + public void setVmOfferingRemoved(Boolean vmOfferingRemoved) { + this.vmOfferingRemoved = vmOfferingRemoved; + } + + public void setVmExpunged(Boolean isVmExpunged) { + this.isVmExpunged = isVmExpunged; + } + + public void setFromCheckpointId(String fromCheckpointId) { + this.fromCheckpointId = fromCheckpointId; + } + + public String getFromCheckpointId() { + return this.fromCheckpointId; + } + + public void setToCheckpointId(String toCheckpointId) { + this.toCheckpointId = toCheckpointId; + } + + public String getToCheckpointId() { + return this.toCheckpointId; + } + + public void setHostId(String hostId) { + this.hostId = hostId; + } + + public String getHostId() { + return this.hostId; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupRestorePointResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupRestorePointResponse.java index 22bb099b1b03..e338fe6b35f9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupRestorePointResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupRestorePointResponse.java @@ -31,15 +31,15 @@ public class BackupRestorePointResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "external id of the restore point") + @Param(description = "External ID of the restore point") private String id; @SerializedName(ApiConstants.CREATED) - @Param(description = "created time") + @Param(description = "Created time") private Date created; @SerializedName(ApiConstants.TYPE) - @Param(description = "restore point type") + @Param(description = "Restore point type") private String type; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BackupScheduleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BackupScheduleResponse.java index d7c6f96add5b..13d0c5d8c562 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BackupScheduleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BackupScheduleResponse.java @@ -28,30 +28,41 @@ @EntityReference(value = BackupSchedule.class) public class BackupScheduleResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the backup schedule.", since = "4.21.0") + private String id; @SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME) - @Param(description = "name of the VM") + @Param(description = "Name of the Instance") private String vmName; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "ID of the VM") + @Param(description = "ID of the Instance") private String vmId; @SerializedName(ApiConstants.SCHEDULE) - @Param(description = "time the backup is scheduled to be taken.") + @Param(description = "The time the backup is scheduled to be taken.") private String schedule; @SerializedName(ApiConstants.INTERVAL_TYPE) - @Param(description = "the interval type of the backup schedule") + @Param(description = "The interval type of the backup schedule") private DateUtil.IntervalType intervalType; @SerializedName(ApiConstants.TIMEZONE) - @Param(description = "the time zone of the backup schedule") + @Param(description = "The time zone of the backup schedule") private String timezone; @SerializedName(ApiConstants.MAX_BACKUPS) @Param(description = "maximum number of backups retained") - private Integer maxBakups; + private Integer maxBackups; + + public void setId(String id) { + this.id = id; + } + + @SerializedName(ApiConstants.QUIESCE_VM) + @Param(description = "quiesce the instance before checkpointing the disks for backup") + private Boolean quiesceVM; public String getVmName() { return vmName; @@ -93,7 +104,11 @@ public void setTimezone(String timezone) { this.timezone = timezone; } - public void setMaxBakups(Integer maxBakups) { - this.maxBakups = maxBakups; + public void setMaxBackups(Integer maxBackups) { + this.maxBackups = maxBackups; + } + + public void setQuiesceVM(Boolean quiesceVM) { + this.quiesceVM = quiesceVM; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BaseRolePermissionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BaseRolePermissionResponse.java index c39939a20a60..ee563085704b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BaseRolePermissionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BaseRolePermissionResponse.java @@ -27,15 +27,15 @@ public class BaseRolePermissionResponse extends BaseResponse { @SerializedName(ApiConstants.RULE) - @Param(description = "the api name or wildcard rule") + @Param(description = "The api name or wildcard rule") private String rule; @SerializedName(ApiConstants.PERMISSION) - @Param(description = "the permission type of the api name or wildcard rule, allow/deny") + @Param(description = "The permission type of the api name or wildcard rule, allow/deny") private String rulePermission; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the role permission") + @Param(description = "The description of the role permission") private String ruleDescription; public String getRule() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/BaseRoleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/BaseRoleResponse.java index b1bba905bc69..68484149f012 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/BaseRoleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/BaseRoleResponse.java @@ -25,19 +25,19 @@ public class BaseRoleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the role") + @Param(description = "The ID of the role") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the role") + @Param(description = "The name of the role") private String roleName; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the role") + @Param(description = "The description of the role") private String roleDescription; @SerializedName(ApiConstants.IS_PUBLIC) - @Param(description = "Indicates whether the role will be visible to all users (public) or only to root admins (private)." + + @Param(description = "Indicates whether the role will be visible to all Users (public) or only to root admins (private)." + " If this parameter is not specified during the creation of the role its value will be defaulted to true (public).") private boolean publicRole = true; diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java index 94d5882e18ac..84d4da5e1037 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CAProviderResponse.java @@ -27,11 +27,11 @@ @EntityReference(value = CAProvider.class) public class CAProviderResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the CA service provider name") + @Param(description = "The CA service provider name") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the CA service provider") + @Param(description = "The description of the CA service provider") private String description; public String getName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java index 3861ac455ed5..7ef627ec33ce 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java @@ -16,6 +16,9 @@ // under the License. package org.apache.cloudstack.api.response; +import java.util.Map; + +import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; @@ -25,71 +28,75 @@ @SuppressWarnings("unused") public class CapabilitiesResponse extends BaseResponse { @SerializedName("securitygroupsenabled") - @Param(description = "true if security groups support is enabled, false otherwise") + @Param(description = "True if security groups support is enabled, false otherwise") private boolean securityGroupsEnabled; @SerializedName("dynamicrolesenabled") - @Param(description = "true if dynamic role-based api checker is enabled, false otherwise") + @Param(description = "True if dynamic role-based api checker is enabled, false otherwise") private boolean dynamicRolesEnabled; @SerializedName("cloudstackversion") - @Param(description = "version of the cloud stack") + @Param(description = "Version of the CloudStack") private String cloudStackVersion; @SerializedName("userpublictemplateenabled") - @Param(description = "true if user and domain admins can set templates to be shared, false otherwise") + @Param(description = "True if user and domain admins can set Templates to be shared, false otherwise") private boolean userPublicTemplateEnabled; @SerializedName("supportELB") - @Param(description = "true if region supports elastic load balancer on basic zones") + @Param(description = "True if region supports elastic Load balancer on basic zones") private String supportELB; @SerializedName(ApiConstants.PROJECT_INVITE_REQUIRED) - @Param(description = "If invitation confirmation is required when add account to project") + @Param(description = "If invitation confirmation is required when add Account to project") private Boolean projectInviteRequired; @SerializedName(ApiConstants.ALLOW_USER_CREATE_PROJECTS) - @Param(description = "true if regular user is allowed to create projects") + @Param(description = "True if regular User is allowed to create projects") private Boolean allowUsersCreateProjects; @SerializedName(ApiConstants.CUSTOM_DISK_OFF_MIN_SIZE) - @Param(description = "minimum size that can be specified when " + "create disk from disk offering with custom size") + @Param(description = "Minimum size that can be specified when " + "create disk from disk offering with custom size") private Long diskOffMinSize; @SerializedName(ApiConstants.CUSTOM_DISK_OFF_MAX_SIZE) - @Param(description = "maximum size that can be specified when " + "create disk from disk offering with custom size") + @Param(description = "Maximum size that can be specified when " + "create disk from disk offering with custom size") private Long diskOffMaxSize; @SerializedName("regionsecondaryenabled") - @Param(description = "true if region wide secondary is enabled, false otherwise") + @Param(description = "True if region wide secondary is enabled, false otherwise") private boolean regionSecondaryEnabled; @SerializedName("apilimitinterval") - @Param(description = "time interval (in seconds) to reset api count") + @Param(description = "Time interval (in seconds) to reset api count") private Integer apiLimitInterval; @SerializedName("kvmsnapshotenabled") - @Param(description = "true if snapshot is supported for KVM host, false otherwise") + @Param(description = "True if Snapshot is supported for KVM host, false otherwise") private boolean kvmSnapshotEnabled; + @SerializedName("snapshotshowchainsize") + @Param(description = "True to show the parent and chain size (sum of physical size of snapshot and all its parents) for incremental snapshots", since = "4.22.1") + private boolean snapshotShowChainSize; + @SerializedName("apilimitmax") @Param(description = "Max allowed number of api requests within the specified interval") private Integer apiLimitMax; @SerializedName("allowuserviewdestroyedvm") - @Param(description = "true if the user is allowed to view destroyed virtualmachines, false otherwise", since = "4.6.0") + @Param(description = "True if the User is allowed to view the destroyed Instances, false otherwise", since = "4.6.0") private boolean allowUserViewDestroyedVM; @SerializedName("allowuserexpungerecovervm") - @Param(description = "true if the user can recover and expunge virtualmachines, false otherwise", since = "4.6.0") + @Param(description = "True if the User can recover and expunge Instances, false otherwise", since = "4.6.0") private boolean allowUserExpungeRecoverVM; @SerializedName("allowuserexpungerecovervolume") - @Param(description = "true if the user can recover and expunge volumes, false otherwise", since = "4.14.0") + @Param(description = "True if the User can recover and expunge volumes, false otherwise", since = "4.14.0") private boolean allowUserExpungeRecoverVolume; @SerializedName("allowuserviewalldomainaccounts") - @Param(description = "true if users can see all accounts within the same domain, false otherwise") + @Param(description = "True if Users can see all Accounts within the same domain, false otherwise") private boolean allowUserViewAllDomainAccounts; @SerializedName(ApiConstants.ALLOW_USER_FORCE_STOP_VM) @@ -97,11 +104,11 @@ public class CapabilitiesResponse extends BaseResponse { private boolean allowUserForceStopVM; @SerializedName("kubernetesserviceenabled") - @Param(description = "true if Kubernetes Service plugin is enabled, false otherwise") + @Param(description = "True if Kubernetes Service plugin is enabled, false otherwise") private boolean kubernetesServiceEnabled; @SerializedName("kubernetesclusterexperimentalfeaturesenabled") - @Param(description = "true if experimental features for Kubernetes cluster such as Docker private registry are enabled, false otherwise") + @Param(description = "True if experimental features for Kubernetes cluster such as Docker private registry are enabled, false otherwise") private boolean kubernetesClusterExperimentalFeaturesEnabled; @SerializedName("customhypervisordisplayname") @@ -109,23 +116,23 @@ public class CapabilitiesResponse extends BaseResponse { private String customHypervisorDisplayName; @SerializedName("defaultuipagesize") - @Param(description = "default page size in the UI for various views, value set in the configurations", since = "4.15.2") + @Param(description = "Default page size in the UI for various views, value set in the configurations", since = "4.15.2") private Long defaultUiPageSize; @SerializedName(ApiConstants.INSTANCES_STATS_RETENTION_TIME) - @Param(description = "the retention time for Instances stats", since = "4.18.0") + @Param(description = "The retention time for Instances stats", since = "4.18.0") private Integer instancesStatsRetentionTime; @SerializedName(ApiConstants.INSTANCES_STATS_USER_ONLY) - @Param(description = "true if stats are collected only for user instances, false if system instance stats are also collected", since = "4.18.0") + @Param(description = "True if stats are collected only for User Instances, false if System VM stats are also collected", since = "4.18.0") private Boolean instancesStatsUserOnly; @SerializedName(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_ENABLED) - @Param(description = "true if stats are retained for instance disks otherwise false", since = "4.18.0") + @Param(description = "True if stats are retained for Instance disks otherwise false", since = "4.18.0") private Boolean instancesDisksStatsRetentionEnabled; @SerializedName(ApiConstants.INSTANCES_DISKS_STATS_RETENTION_TIME) - @Param(description = "the retention time for Instances disks stats", since = "4.18.0") + @Param(description = "The retention time for Instances disks stats", since = "4.18.0") private Integer instancesDisksStatsRetentionTime; @SerializedName(ApiConstants.SHAREDFSVM_MIN_CPU_COUNT) @@ -136,6 +143,26 @@ public class CapabilitiesResponse extends BaseResponse { @Param(description = "the min Ram size for the service offering used by the shared filesystem instance", since = "4.20.0") private Integer sharedFsVmMinRamSize; + @SerializedName(ApiConstants.INSTANCE_LEASE_ENABLED) + @Param(description = "true if instance lease feature is enabled", since = "4.21.0") + private Boolean instanceLeaseEnabled; + + @SerializedName(ApiConstants.EXTENSIONS_PATH) + @Param(description = "The path of the extensions directory", since = "4.21.0", authorized = {RoleType.Admin}) + private String extensionsPath; + + @SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED) + @Param(description = "true if dynamically scaling for instances is enabled", since = "4.21.0") + private Boolean dynamicScalingEnabled; + + @SerializedName(ApiConstants.ADDITONAL_CONFIG_ENABLED) + @Param(description = "true if additional configurations or extraconfig can be passed to Instances", since = "4.20.2") + private Boolean additionalConfigEnabled; + + @SerializedName(ApiConstants.VPN_CUSTOMER_GATEWAY_PARAMETERS) + @Param(description = "Excluded and obsolete VPN customer gateway cryptographic parameters") + private Map vpnCustomerGatewayParameters; + public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) { this.securityGroupsEnabled = securityGroupsEnabled; } @@ -180,6 +207,10 @@ public void setKVMSnapshotEnabled(boolean kvmSnapshotEnabled) { this.kvmSnapshotEnabled = kvmSnapshotEnabled; } + public void setSnapshotShowChainSize(boolean snapshotShowChainSize) { + this.snapshotShowChainSize = snapshotShowChainSize; + } + public void setApiLimitInterval(Integer apiLimitInterval) { this.apiLimitInterval = apiLimitInterval; } @@ -247,4 +278,24 @@ public void setSharedFsVmMinCpuCount(Integer sharedFsVmMinCpuCount) { public void setSharedFsVmMinRamSize(Integer sharedFsVmMinRamSize) { this.sharedFsVmMinRamSize = sharedFsVmMinRamSize; } + + public void setInstanceLeaseEnabled(Boolean instanceLeaseEnabled) { + this.instanceLeaseEnabled = instanceLeaseEnabled; + } + + public void setExtensionsPath(String extensionsPath) { + this.extensionsPath = extensionsPath; + } + + public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) { + this.dynamicScalingEnabled = dynamicScalingEnabled; + } + + public void setAdditionalConfigEnabled(Boolean additionalConfigEnabled) { + this.additionalConfigEnabled = additionalConfigEnabled; + } + + public void setVpnCustomerGatewayParameters(Map vpnCustomerGatewayParameters) { + this.vpnCustomerGatewayParameters = vpnCustomerGatewayParameters; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java index 6862a5541ebe..67a5b33b6a93 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CapabilityResponse.java @@ -26,15 +26,15 @@ public class CapabilityResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the capability name") + @Param(description = "The capability name") private String name; @SerializedName(ApiConstants.VALUE) - @Param(description = "the capability value") + @Param(description = "The capability value") private String value; @SerializedName(ApiConstants.CAN_CHOOSE_SERVICE_CAPABILITY) - @Param(description = "can this service capability value can be choosable while creatine network offerings") + @Param(description = "Can this service capability value can be choosable while creatine Network offerings") private boolean canChoose; public String getName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java index 2d0e21586515..e01a7323fee9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CapacityResponse.java @@ -24,51 +24,51 @@ public class CapacityResponse extends BaseResponse { @SerializedName(ApiConstants.TYPE) - @Param(description = "the capacity type") + @Param(description = "The capacity type") private Short capacityType; @SerializedName(ApiConstants.NAME) - @Param(description="the capacity name") + @Param(description = "The capacity name") private String capacityName; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID") + @Param(description = "The Zone ID") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name") + @Param(description = "The Zone name") private String zoneName; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod ID") + @Param(description = "The Pod ID") private String podId; @SerializedName("podname") - @Param(description = "the Pod name") + @Param(description = "The Pod name") private String podName; @SerializedName(ApiConstants.CLUSTER_ID) - @Param(description = "the Cluster ID") + @Param(description = "The Cluster ID") private String clusterId; @SerializedName("clustername") - @Param(description = "the Cluster name") + @Param(description = "The Cluster name") private String clusterName; @SerializedName("capacityallocated") - @Param(description="the capacity currently in allocated") + @Param(description = "The capacity currently in allocated") private Long capacityAllocated; @SerializedName("capacityused") - @Param(description = "the capacity currently in use") + @Param(description = "The capacity currently in use") private Long capacityUsed; @SerializedName("capacitytotal") - @Param(description = "the total capacity available") + @Param(description = "The total capacity available") private Long capacityTotal; @SerializedName("percentused") - @Param(description = "the percentage of capacity currently in use") + @Param(description = "The percentage of capacity currently in use") private String percentUsed; @SerializedName(ApiConstants.TAG) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CheckpointResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CheckpointResponse.java new file mode 100644 index 000000000000..2bec7711064f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/CheckpointResponse.java @@ -0,0 +1,53 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.response; + +import java.util.Date; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class CheckpointResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "the checkpoint ID") + private String id; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "the checkpoint creation time") + private Date created; + + @SerializedName(ApiConstants.IS_ACTIVE) + @Param(description = "whether this is the active checkpoint") + private Boolean isActive; + + public void setId(String id) { + this.id = id; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java index 8f5b5de29194..d757b59f0285 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ChildTemplateResponse.java @@ -28,19 +28,19 @@ @SuppressWarnings("unused") public class ChildTemplateResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the template ID") + @Param(description = "The Template ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the template name") + @Param(description = "The Template name") private String name; @SerializedName(ApiConstants.SIZE) - @Param(description = "the size of the template") + @Param(description = "The size of the Template") private Integer size; @SerializedName(ApiConstants.TEMPLATE_TYPE) - @Param(description = "the type of the template") + @Param(description = "The type of the Template") private String templateType; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java index 94520ef2f8f4..e87bdf00c316 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CloudIdentifierResponse.java @@ -26,15 +26,15 @@ public class CloudIdentifierResponse extends BaseResponse { @SerializedName(ApiConstants.USER_ID) - @Param(description = "the user ID for the cloud identifier") + @Param(description = "The User ID for the cloud identifier") private String userId; @SerializedName("cloudidentifier") - @Param(description = "the cloud identifier") + @Param(description = "The cloud identifier") private String cloudIdentifier; @SerializedName("signature") - @Param(description = "the signed response for the cloud identifier") + @Param(description = "The signed response for the cloud identifier") private String signature; public String getUserId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ClusterDrsPlanMigrationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ClusterDrsPlanMigrationResponse.java index 4114c228e265..f399c1260f77 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ClusterDrsPlanMigrationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ClusterDrsPlanMigrationResponse.java @@ -50,13 +50,13 @@ public class ClusterDrsPlanMigrationResponse extends BaseResponse { @Param(description = "Destination host for VM migration") String destHostName; - @SerializedName(ApiConstants.JOB_ID) + @SerializedName(ApiConstants.MIGRATION_JOB_ID) @Param(description = "id of VM migration async job") - private Long jobId; + private Long migrationJobId; - @SerializedName(ApiConstants.JOB_STATUS) + @SerializedName(ApiConstants.MIGRATION_JOB_STATUS) @Param(description = "Job status of VM migration async job") - private JobInfo.Status jobStatus; + private JobInfo.Status migrationJobStatus; public ClusterDrsPlanMigrationResponse(String vmId, String vmName, String srcHostId, String srcHostName, @@ -68,8 +68,8 @@ public ClusterDrsPlanMigrationResponse(String vmId, String vmName, String srcHos this.srcHostName = srcHostName; this.destHostId = destHostId; this.destHostName = destHostName; - this.jobId = jobId; - this.jobStatus = jobStatus; + this.migrationJobId = jobId; + this.migrationJobStatus = jobStatus; this.setObjectName(ApiConstants.MIGRATIONS); } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java index 1c69849239f9..e73cd3876a92 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ClusterResponse.java @@ -31,52 +31,54 @@ @EntityReference(value = Cluster.class) public class ClusterResponse extends BaseResponseWithAnnotations { + private transient long internalId; + @SerializedName(ApiConstants.ID) - @Param(description = "the cluster ID") + @Param(description = "The cluster ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the cluster name") + @Param(description = "The cluster name") private String name; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod ID of the cluster") + @Param(description = "The Pod ID of the cluster") private String podId; @SerializedName("podname") - @Param(description = "the Pod name of the cluster") + @Param(description = "The Pod name of the cluster") private String podName; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the cluster") + @Param(description = "The Zone ID of the cluster") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the cluster") + @Param(description = "The Zone name of the cluster") private String zoneName; @SerializedName("hypervisortype") - @Param(description = "the hypervisor type of the cluster") + @Param(description = "The hypervisor type of the cluster") private String hypervisorType; @SerializedName("clustertype") - @Param(description = "the type of the cluster") + @Param(description = "The type of the cluster") private String clusterType; @SerializedName("allocationstate") - @Param(description = "the allocation state of the cluster") + @Param(description = "The allocation state of the cluster") private String allocationState; @SerializedName("managedstate") - @Param(description = "whether this cluster is managed by cloudstack") + @Param(description = "Whether this cluster is managed by Cloudstack") private String managedState; @SerializedName("capacity") - @Param(description = "the capacity of the Cluster", responseObject = CapacityResponse.class) + @Param(description = "The capacity of the Cluster", responseObject = CapacityResponse.class) private List capacities; @SerializedName("cpuovercommitratio") - @Param(description = "The cpu overcommit ratio of the cluster") + @Param(description = "The CPU overcommit ratio of the cluster") private String cpuovercommitratio; @SerializedName("memoryovercommitratio") @@ -95,6 +97,34 @@ public class ClusterResponse extends BaseResponseWithAnnotations { @Param(description = "CPU Arch of the hosts in the cluster", since = "4.20") private String arch; + @SerializedName(ApiConstants.STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups for the host", since = "4.21.0") + private String storageAccessGroups; + + @SerializedName(ApiConstants.POD_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the pod", since = "4.21.0") + private String podStorageAccessGroups; + + @SerializedName(ApiConstants.ZONE_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the zone", since = "4.21.0") + private String zoneStorageAccessGroups; + + @SerializedName(ApiConstants.EXTENSION_ID) + @Param(description="The ID of extension for this cluster", since = "4.21.0") + private String extensionId; + + @SerializedName(ApiConstants.EXTENSION_NAME) + @Param(description="The name of extension for this cluster", since = "4.21.0") + private String extensionName; + + public void setInternalId(long internalId) { + this.internalId = internalId; + } + + public long getInternalId() { + return internalId; + } + public String getId() { return id; } @@ -259,4 +289,44 @@ public void setArch(String arch) { public String getArch() { return arch; } + + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + + public String getPodStorageAccessGroups() { + return podStorageAccessGroups; + } + + public void setPodStorageAccessGroups(String podStorageAccessGroups) { + this.podStorageAccessGroups = podStorageAccessGroups; + } + + public String getZoneStorageAccessGroups() { + return zoneStorageAccessGroups; + } + + public void setZoneStorageAccessGroups(String zoneStorageAccessGroups) { + this.zoneStorageAccessGroups = zoneStorageAccessGroups; + } + + public void setExtensionId(String extensionId) { + this.extensionId = extensionId; + } + + public String getExtensionId() { + return extensionId; + } + + public void setExtensionName(String extensionName) { + this.extensionName = extensionName; + } + + public String getExtensionName() { + return extensionName; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java index 1038177cb86c..d27a1cdf672c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConditionResponse.java @@ -30,7 +30,7 @@ @SuppressWarnings("unused") public class ConditionResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName("id") - @Param(description = "the id of the Condition") + @Param(description = "The ID of the Condition") private String id; @SerializedName(value = ApiConstants.THRESHOLD) @@ -42,11 +42,11 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR private String relationalOperator; @SerializedName("counterid") - @Param(description = "the Id of the Counter.") + @Param(description = "The ID of the Counter.") private String counterId; @SerializedName("countername") - @Param(description = "the Name of the Counter.") + @Param(description = "The Name of the Counter.") private String counterName; @SerializedName("counter") @@ -54,11 +54,11 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR private CounterResponse counterResponse; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the Condition owner") + @Param(description = "The domain ID of the Condition owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the owner.") + @Param(description = "The domain name of the owner.") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -66,19 +66,19 @@ public class ConditionResponse extends BaseResponse implements ControlledEntityR private String domainPath; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of counter") + @Param(description = "Zone ID of counter") private String zoneId; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the Condition.") + @Param(description = "The project ID of the Condition.") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the Condition") + @Param(description = "The project name of the Condition") private String projectName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner of the Condition.") + @Param(description = "The owner of the Condition.") private String accountName; // ///////////////////////////////////////////////// diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationGroupResponse.java index 053ee5fdc35e..32926a71d8a8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationGroupResponse.java @@ -27,19 +27,19 @@ public class ConfigurationGroupResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the configuration group") + @Param(description = "The name of the configuration group") private String groupName; @SerializedName(ApiConstants.SUBGROUP) - @Param(description = "the subgroups of the configuration group", responseObject = ConfigurationSubGroupResponse.class) + @Param(description = "The subgroups of the configuration group", responseObject = ConfigurationSubGroupResponse.class) private List subGroups; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the configuration group") + @Param(description = "The description of the configuration group") private String description; @SerializedName(ApiConstants.PRECEDENCE) - @Param(description = "the precedence of the configuration group") + @Param(description = "The precedence of the configuration group") private Long precedence; public String getGroupName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java index 1818e914a97e..416f0102d859 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationResponse.java @@ -25,63 +25,63 @@ public class ConfigurationResponse extends BaseResponse { @SerializedName(ApiConstants.CATEGORY) - @Param(description = "the category of the configuration") + @Param(description = "The category of the configuration") private String category; @SerializedName(ApiConstants.GROUP) - @Param(description = "the group of the configuration", since = "4.18.0") + @Param(description = "The group of the configuration", since = "4.18.0") private String group; @SerializedName(ApiConstants.SUBGROUP) - @Param(description = "the subgroup of the configuration", since = "4.18.0") + @Param(description = "The subgroup of the configuration", since = "4.18.0") private String subGroup; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the configuration") + @Param(description = "The name of the configuration") private String name; @SerializedName(ApiConstants.VALUE) - @Param(description = "the value of the configuration") + @Param(description = "The value of the configuration") private String value; @SerializedName(ApiConstants.DEFAULT_VALUE) - @Param(description = "the default value of the configuration", since = "4.18.0") + @Param(description = "The default value of the configuration", since = "4.18.0") private String defaultValue; @SerializedName(ApiConstants.SCOPE) - @Param(description = "scope(zone/cluster/pool/account) of the parameter that needs to be updated") + @Param(description = "Scope (zone/cluster/pool/account) of the parameter that needs to be updated") private String scope; @SerializedName(ApiConstants.ID) - @Param(description = "the value of the configuration") + @Param(description = "The value of the configuration") private Long id; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the configuration") + @Param(description = "The description of the configuration") private String description; @SerializedName(ApiConstants.IS_DYNAMIC) - @Param(description = "true if the configuration is dynamic") + @Param(description = "True if the configuration is dynamic") private boolean isDynamic; @SerializedName(ApiConstants.COMPONENT) - @Param(description = "the component of the configuration", since = "4.18.0") + @Param(description = "The component of the configuration", since = "4.18.0") private String component; @SerializedName(ApiConstants.PARENT) - @Param(description = "the name of the parent configuration", since = "4.18.0") + @Param(description = "The name of the parent configuration", since = "4.18.0") private String parent; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "the display text of the configuration", since = "4.18.0") + @Param(description = "The display text of the configuration", since = "4.18.0") private String displayText; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the configuration value", since = "4.18.0") + @Param(description = "The type of the configuration value", since = "4.18.0") private String type; @SerializedName(ApiConstants.OPTIONS) - @Param(description = "the possible options of the configuration value", since = "4.18.0") + @Param(description = "The possible options of the configuration value", since = "4.18.0") private String options; public String getCategory() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationSubGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationSubGroupResponse.java index fda8e18b361a..81f1bbd45768 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationSubGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConfigurationSubGroupResponse.java @@ -25,11 +25,11 @@ public class ConfigurationSubGroupResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the configuration subgroup") + @Param(description = "The name of the configuration subgroup") private String subGroupName; @SerializedName(ApiConstants.PRECEDENCE) - @Param(description = "the precedence of the configuration subgroup") + @Param(description = "The precedence of the configuration subgroup") private Long precedence; public String getSubGroupName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConsoleEndpointWebsocketResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConsoleEndpointWebsocketResponse.java index d98b52d08636..0cc6a53019a6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ConsoleEndpointWebsocketResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConsoleEndpointWebsocketResponse.java @@ -27,23 +27,23 @@ public ConsoleEndpointWebsocketResponse() { } @SerializedName(ApiConstants.TOKEN) - @Param(description = "the console websocket token") + @Param(description = "The console websocket token") private String token; @SerializedName("host") - @Param(description = "the console websocket host") + @Param(description = "The console websocket host") private String host; @SerializedName(ApiConstants.PORT) - @Param(description = "the console websocket port") + @Param(description = "The console websocket port") private String port; @SerializedName(ApiConstants.PATH) - @Param(description = "the console websocket path") + @Param(description = "The console websocket path") private String path; @SerializedName("extra") - @Param(description = "the console websocket extra field for validation (if enabled)") + @Param(description = "The console websocket extra field for validation (if enabled)") private String extra; public String getToken() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ConsoleSessionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ConsoleSessionResponse.java new file mode 100644 index 000000000000..85747d7c2a8f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ConsoleSessionResponse.java @@ -0,0 +1,236 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.import org.apache.cloudstack.context.CallContext; +package org.apache.cloudstack.api.response; + +import com.google.gson.annotations.SerializedName; + +import com.cloud.serializer.Param; +import org.apache.cloudstack.consoleproxy.ConsoleSession; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + +import java.util.Date; + +@EntityReference(value = ConsoleSession.class) +public class ConsoleSessionResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the console session.") + private String id; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "Date when the console session's endpoint was created.") + private Date created; + + @SerializedName(ApiConstants.DOMAIN) + @Param(description = "Domain of the account that created the console endpoint.") + private String domain; + + @SerializedName(ApiConstants.DOMAIN_PATH) + @Param(description = "Domain path of the account that created the console endpoint.") + private String domainPath; + + @SerializedName(ApiConstants.DOMAIN_ID) + @Param(description = "Domain ID of the account that created the console endpoint.") + private String domainId; + + @SerializedName(ApiConstants.ACCOUNT) + @Param(description = "Account that created the console endpoint.") + private String account; + + @SerializedName(ApiConstants.ACCOUNT_ID) + @Param(description = "ID of the account that created the console endpoint.") + private String accountId; + + @SerializedName(ApiConstants.USER) + @Param(description = "User that created the console endpoint.") + private String user; + + @SerializedName(ApiConstants.USER_ID) + @Param(description = "ID of the user that created the console endpoint.") + private String userId; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) + @Param(description = "ID of the virtual machine.") + private String vmId; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME) + @Param(description = "Name of the virtual machine.") + private String vmName; + + @SerializedName(ApiConstants.HOST_ID) + @Param(description = "ID of the host.") + private String hostId; + + @SerializedName(ApiConstants.HOST_NAME) + @Param(description = "Name of the host.") + private String hostName; + + @SerializedName(ApiConstants.ACQUIRED) + @Param(description = "Date when the console session was acquired.") + private Date acquired; + + @SerializedName(ApiConstants.REMOVED) + @Param(description = "Date when the console session was removed.") + private Date removed; + + @SerializedName(ApiConstants.CONSOLE_ENDPOINT_CREATOR_ADDRESS) + @Param(description = "IP address of the creator of the console endpoint.") + private String consoleEndpointCreatorAddress; + + @SerializedName(ApiConstants.CLIENT_ADDRESS) + @Param(description = "IP address of the client that created the console session.") + private String clientAddress; + + public void setId(String id) { + this.id = id; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public void setDomainPath(String domainPath) { + this.domainPath = domainPath; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public void setAccount(String account) { + this.account = account; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public void setUser(String user) { + this.user = user; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public void setVmId(String vmId) { + this.vmId = vmId; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + public void setHostId(String hostId) { + this.hostId = hostId; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public void setAcquired(Date acquired) { + this.acquired = acquired; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public void setConsoleEndpointCreatorAddress(String consoleEndpointCreatorAddress) { + this.consoleEndpointCreatorAddress = consoleEndpointCreatorAddress; + } + + public void setClientAddress(String clientAddress) { + this.clientAddress = clientAddress; + } + + public String getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public String getDomain() { + return domain; + } + + public String getDomainPath() { + return domainPath; + } + + public String getDomainId() { + return domainId; + } + + public String getAccount() { + return account; + } + + public String getAccountId() { + return accountId; + } + + public String getUser() { + return user; + } + + public String getUserId() { + return userId; + } + + public String getVmId() { + return vmId; + } + + public String getVmName() { + return vmName; + } + + public String getHostId() { + return hostId; + } + + public String getHostName() { + return hostName; + } + + public Date getAcquired() { + return acquired; + } + + public Date getRemoved() { + return removed; + } + + public String getConsoleEndpointCreatorAddress() { + return consoleEndpointCreatorAddress; + } + + public String getClientAddress() { + return clientAddress; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java index f013690b64cc..d4b4bed7e2bb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CounterResponse.java @@ -30,7 +30,7 @@ @EntityReference(value = Counter.class) public class CounterResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the id of the Counter") + @Param(description = "The ID of the Counter") private String id; @SerializedName(value = ApiConstants.NAME) @@ -46,7 +46,7 @@ public class CounterResponse extends BaseResponse { private String value; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of counter") + @Param(description = "Zone ID of counter") private String zoneId; @SerializedName(value = ApiConstants.PROVIDER) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CreateConsoleEndpointResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CreateConsoleEndpointResponse.java index c60917bbe7a2..557315442e4b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CreateConsoleEndpointResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CreateConsoleEndpointResponse.java @@ -26,20 +26,20 @@ public class CreateConsoleEndpointResponse extends BaseResponse { public CreateConsoleEndpointResponse() { } - @SerializedName(ApiConstants.RESULT) - @Param(description = "true if the console endpoint is generated properly") + @SerializedName(ApiConstants.SUCCESS) + @Param(description = "True if the console endpoint is generated properly") private Boolean result; @SerializedName(ApiConstants.DETAILS) - @Param(description = "details in case of an error") + @Param(description = "Details in case of an error") private String details; @SerializedName(ApiConstants.URL) - @Param(description = "the console url") + @Param(description = "The console url") private String url; @SerializedName("websocket") - @Param(description = "the console websocket options") + @Param(description = "The console websocket options") private ConsoleEndpointWebsocketResponse websocketResponse; public Boolean getResult() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java index 44b732769183..ca6e454db1e8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/CustomCertificateResponse.java @@ -25,7 +25,7 @@ public class CustomCertificateResponse extends BaseResponse { @SerializedName("message") - @Param(description = "message of the certificate upload operation") + @Param(description = "Message of the certificate upload operation") private String message; public String getResultMessage() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DataCenterGuestIpv6PrefixResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DataCenterGuestIpv6PrefixResponse.java index fd0803f1c581..db4314f5568f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DataCenterGuestIpv6PrefixResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DataCenterGuestIpv6PrefixResponse.java @@ -30,31 +30,31 @@ @EntityReference(value = DataCenterGuestIpv6Prefix.class) public class DataCenterGuestIpv6PrefixResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "id of the guest IPv6 prefix") + @Param(description = "ID of the guest IPv6 prefix") private String id; @SerializedName(ApiConstants.PREFIX) - @Param(description = "guest IPv6 prefix") + @Param(description = "Guest IPv6 prefix") private String prefix; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "id of zone to which the IPv6 prefix belongs to." ) + @Param(description = "ID of zone to which the IPv6 prefix belongs to." ) private String zoneId; @SerializedName(ApiConstants.USED_SUBNETS) - @Param(description = "count of the used IPv6 subnets for the prefix." ) + @Param(description = "Count of the used IPv6 subnets for the prefix." ) private Integer usedSubnets; @SerializedName(ApiConstants.AVAILABLE_SUBNETS) - @Param(description = "count of the available IPv6 subnets for the prefix." ) + @Param(description = "Count of the available IPv6 subnets for the prefix." ) private Integer availableSubnets; @SerializedName(ApiConstants.TOTAL_SUBNETS) - @Param(description = "count of the total IPv6 subnets for the prefix." ) + @Param(description = "Count of the total IPv6 subnets for the prefix." ) private Integer totalSubnets; @SerializedName(ApiConstants.CREATED) - @Param(description = " date when this IPv6 prefix was created." ) + @Param(description = "Date when this IPv6 prefix was created." ) private Date created; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateHostStatusResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateHostStatusResponse.java index cc9f2fc366ad..80c787a0e2aa 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateHostStatusResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateHostStatusResponse.java @@ -24,19 +24,19 @@ public class DirectDownloadCertificateHostStatusResponse extends BaseResponse { @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the host") + @Param(description = "The ID of the host") private String hostId; @SerializedName(ApiConstants.HOST_NAME) - @Param(description = "the name of the host") + @Param(description = "The name of the host") private String hostName; @SerializedName(ApiConstants.STATUS) - @Param(description = "indicates if the certificate has been revoked from the host, failed or skipped") + @Param(description = "Indicates if the certificate has been revoked from the host, failed or skipped") private String status; @SerializedName(ApiConstants.DETAILS) - @Param(description = "indicates the details in case of failure or host skipped") + @Param(description = "Indicates the details in case of failure or host skipped") private String details; public String getHostId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateResponse.java index f04cba812ba5..480d70d8f881 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DirectDownloadCertificateResponse.java @@ -29,47 +29,47 @@ public class DirectDownloadCertificateResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the direct download certificate id") + @Param(description = "The direct download certificate ID") private String id; @SerializedName(ApiConstants.ALIAS) - @Param(description = "the direct download certificate alias") + @Param(description = "The direct download certificate alias") private String alias; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone id where the certificate is uploaded") + @Param(description = "The zone ID where the certificate is uploaded") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the zone name where the certificate is uploaded") + @Param(description = "The zone name where the certificate is uploaded") private String zoneName; @SerializedName(ApiConstants.VERSION) - @Param(description = "the direct download certificate version") + @Param(description = "The direct download certificate version") private String version; @SerializedName(ApiConstants.CERTIFICATE_SUBJECT) - @Param(description = "the direct download certificate subject") + @Param(description = "The direct download certificate subject") private String subject; @SerializedName(ApiConstants.CERTIFICATE_ISSUER) - @Param(description = "the direct download certificate issuer") + @Param(description = "The direct download certificate issuer") private String issuer; @SerializedName(ApiConstants.CERTIFICATE_VALIDITY) - @Param(description = "the direct download certificate issuer") + @Param(description = "The direct download certificate issuer") private String validity; @SerializedName(ApiConstants.CERTIFICATE_SERIALNUM) - @Param(description = "the direct download certificate serial num") + @Param(description = "The direct download certificate serial num") private String serialNum; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor of the hosts where the certificate is uploaded") + @Param(description = "The hypervisor of the hosts where the certificate is uploaded") private String hypervisor; @SerializedName(ApiConstants.HOSTS_MAP) - @Param(description = "the hosts where the certificate is uploaded to", responseObject = HostResponse.class) + @Param(description = "The hosts where the certificate is uploaded to", responseObject = HostResponse.class) private List hostsMap; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java index 0fed9827ef13..528890ea5fae 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DiskOfferingResponse.java @@ -30,27 +30,27 @@ @EntityReference(value = DiskOffering.class) public class DiskOfferingResponse extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ID) - @Param(description = "unique ID of the disk offering") + @Param(description = "Unique ID of the disk offering") private String id; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domain; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zoneId; @SerializedName(ApiConstants.ZONE) - @Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zone; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the disk offering") + @Param(description = "The name of the disk offering") private String name; @SerializedName(ApiConstants.STATE) @@ -58,106 +58,106 @@ public class DiskOfferingResponse extends BaseResponseWithAnnotations { private String state; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "an alternate display text of the disk offering.") + @Param(description = "An alternate display text of the disk offering.") private String displayText; @SerializedName(ApiConstants.DISK_SIZE) - @Param(description = "the size of the disk offering in GB") + @Param(description = "The size of the disk offering in GB") private Long diskSize; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this disk offering was created") + @Param(description = "The date this disk offering was created") private Date created; @SerializedName("iscustomized") - @Param(description = "true if disk offering uses custom size, false otherwise") + @Param(description = "True if disk offering uses custom size, false otherwise") private Boolean customized; @SerializedName("iscustomizediops") - @Param(description = "true if disk offering uses custom iops, false otherwise") + @Param(description = "True if disk offering uses custom IOPS, false otherwise") private Boolean customizedIops; @SerializedName(ApiConstants.MIN_IOPS) - @Param(description = "the min iops of the disk offering") + @Param(description = "The min IOPS of the disk offering") private Long minIops; @SerializedName(ApiConstants.MAX_IOPS) - @Param(description = "the max iops of the disk offering") + @Param(description = "The max IOPS of the disk offering") private Long maxIops; @SerializedName(ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE) - @Param(description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", since = "4.4") + @Param(description = "Hypervisor Snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", since = "4.4") private Integer hypervisorSnapshotReserve; @SerializedName(ApiConstants.TAGS) - @Param(description = "the tags for the disk offering") + @Param(description = "The tags for the disk offering") private String tags; @SerializedName("storagetype") - @Param(description = "the storage type for this disk offering") + @Param(description = "The storage type for this disk offering") private String storageType; - @SerializedName("provisioningtype") @Param(description="provisioning type used to create volumes. Valid values are thin, sparse, fat.", since = "4.4.0") + @SerializedName("provisioningtype") @Param(description = "Provisioning type used to create volumes. Valid values are thin, sparse, fat.", since = "4.4.0") private String provisioningType; @SerializedName("diskBytesReadRate") - @Param(description = "bytes read rate of the disk offering") + @Param(description = "Bytes read rate of the disk offering") private Long bytesReadRate; @SerializedName("diskBytesReadRateMax") - @Param(description = "burst bytes read rate of the disk offering") + @Param(description = "Burst bytes read rate of the disk offering") private Long bytesReadRateMax; @SerializedName("diskBytesReadRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long bytesReadRateMaxLength; @SerializedName("diskBytesWriteRate") - @Param(description = "bytes write rate of the disk offering") + @Param(description = "Bytes write rate of the disk offering") private Long bytesWriteRate; @SerializedName("diskBytesWriteRateMax") - @Param(description = "burst bytes write rate of the disk offering") + @Param(description = "Burst bytes write rate of the disk offering") private Long bytesWriteRateMax; @SerializedName("diskBytesWriteRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long bytesWriteRateMaxLength; @SerializedName("diskIopsReadRate") - @Param(description = "io requests read rate of the disk offering") + @Param(description = "I/O requests read rate of the disk offering") private Long iopsReadRate; @SerializedName("diskIopsReadRateMax") - @Param(description = "burst io requests read rate of the disk offering") + @Param(description = "Burst io requests read rate of the disk offering") private Long iopsReadRateMax; @SerializedName("diskIopsReadRateMaxLength") - @Param(description = "length (in second) of the burst") + @Param(description = "Length (in second) of the burst") private Long iopsReadRateMaxLength; @SerializedName("diskIopsWriteRate") - @Param(description = "io requests write rate of the disk offering") + @Param(description = "I/O requests write rate of the disk offering") private Long iopsWriteRate; @SerializedName("diskIopsWriteRateMax") - @Param(description = "burst io requests write rate of the disk offering") + @Param(description = "Burst io requests write rate of the disk offering") private Long iopsWriteRateMax; @SerializedName("diskIopsWriteRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long iopsWriteRateMaxLength; @SerializedName("cacheMode") - @Param(description = "the cache mode to use for this disk offering. none, writeback or writethrough", since = "4.4") + @Param(description = "The cache mode to use for this disk offering. none, writeback or writethrough", since = "4.4") private String cacheMode; @SerializedName("displayoffering") - @Param(description = "whether to display the offering to the end user or not.") + @Param(description = "Whether to display the offering to the end user or not.") private Boolean displayOffering; @SerializedName("vspherestoragepolicy") - @Param(description = "the vsphere storage policy tagged to the disk offering in case of VMware", since = "4.15") + @Param(description = "The vsphere storage policy tagged to the disk offering in case of VMware", since = "4.15") private String vsphereStoragePolicy; @@ -170,7 +170,7 @@ public class DiskOfferingResponse extends BaseResponseWithAnnotations { private Boolean encrypt; @SerializedName(ApiConstants.DETAILS) - @Param(description = "additional key/value details tied with this disk offering", since = "4.17") + @Param(description = "Additional key/value details tied with this disk offering", since = "4.17") private Map details; @SerializedName(ApiConstants.SUITABLE_FOR_VM) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java index 74fa2cbb1e4c..453c6b229e97 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DomainResponse.java @@ -16,93 +16,93 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponseWithAnnotations; +import org.apache.cloudstack.api.BaseResponseWithTagInformation; import org.apache.cloudstack.api.EntityReference; import com.cloud.domain.Domain; import com.cloud.serializer.Param; - -import java.util.Date; -import java.util.List; -import java.util.Map; +import com.google.gson.annotations.SerializedName; @EntityReference(value = Domain.class) -public class DomainResponse extends BaseResponseWithAnnotations implements ResourceLimitAndCountResponse, SetResourceIconResponse { +public class DomainResponse extends BaseResponseWithTagInformation implements ResourceLimitAndCountResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the domain") + @Param(description = "The ID of the domain") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the domain") + @Param(description = "The name of the domain") private String domainName; @SerializedName(ApiConstants.LEVEL) - @Param(description = "the level of the domain") + @Param(description = "The level of the domain") private Integer level; @SerializedName("parentdomainid") - @Param(description = "the domain ID of the parent domain") + @Param(description = "The domain ID of the parent domain") private String parentDomainId; @SerializedName("parentdomainname") - @Param(description = "the domain name of the parent domain") + @Param(description = "The domain name of the parent domain") private String parentDomainName; @SerializedName("haschild") - @Param(description = "whether the domain has one or more sub-domains") + @Param(description = "Whether the domain has one or more sub-domains") private boolean hasChild; @SerializedName(ApiConstants.NETWORK_DOMAIN) - @Param(description = "the network domain") + @Param(description = "The Network domain") private String networkDomain; @SerializedName(ApiConstants.PATH) - @Param(description = "the path of the domain") + @Param(description = "The path of the domain") private String path; - @SerializedName(ApiConstants.STATE) @Param(description="the state of the domain") + @SerializedName(ApiConstants.STATE) @Param(description = "The state of the domain") private String state; - @SerializedName(ApiConstants.CREATED) @Param(description="the date when this domain was created") + @SerializedName(ApiConstants.CREATED) @Param(description = "The date when this domain was created") private Date created; - @SerializedName(ApiConstants.VM_LIMIT) @Param(description="the total number of virtual machines that can be deployed by this domain") + @SerializedName(ApiConstants.VM_LIMIT) @Param(description = "The total number of Instances that can be deployed by this domain") private String vmLimit; - @SerializedName(ApiConstants.VM_TOTAL) @Param(description="the total number of virtual machines deployed by this domain") + @SerializedName(ApiConstants.VM_TOTAL) @Param(description = "The total number of Instances deployed by this domain") private Long vmTotal; - @SerializedName(ApiConstants.VM_AVAILABLE) @Param(description="the total number of virtual machines available for this domain to acquire") + @SerializedName(ApiConstants.VM_AVAILABLE) @Param(description = "The total number of Instances available for this domain to acquire") private String vmAvailable; - @SerializedName(ApiConstants.IP_LIMIT) @Param(description="the total number of public ip addresses this domain can acquire") + @SerializedName(ApiConstants.IP_LIMIT) @Param(description = "The total number of public IP addresses this domain can acquire") private String ipLimit; - @SerializedName(ApiConstants.IP_TOTAL) @Param(description="the total number of public ip addresses allocated for this domain") + @SerializedName(ApiConstants.IP_TOTAL) @Param(description = "The total number of public IP addresses allocated for this domain") private Long ipTotal; - @SerializedName(ApiConstants.IP_AVAILABLE) @Param(description="the total number of public ip addresses available for this domain to acquire") + @SerializedName(ApiConstants.IP_AVAILABLE) @Param(description = "The total number of public IP addresses available for this domain to acquire") private String ipAvailable; - @SerializedName("volumelimit") @Param(description="the total volume which can be used by this domain") + @SerializedName("volumelimit") @Param(description = "The total volume which can be used by this domain") private String volumeLimit; - @SerializedName("volumetotal") @Param(description="the total volume being used by this domain") + @SerializedName("volumetotal") @Param(description = "The total volume being used by this domain") private Long volumeTotal; - @SerializedName("volumeavailable") @Param(description="the total volume available for this domain") + @SerializedName("volumeavailable") @Param(description = "The total volume available for this domain") private String volumeAvailable; - @SerializedName("snapshotlimit") @Param(description="the total number of snapshots which can be stored by this domain") + @SerializedName("snapshotlimit") @Param(description = "The total number of Snapshots which can be stored by this domain") private String snapshotLimit; - @SerializedName("snapshottotal") @Param(description="the total number of snapshots stored by this domain") + @SerializedName("snapshottotal") @Param(description = "The total number of Snapshots stored by this domain") private Long snapshotTotal; - @SerializedName("snapshotavailable") @Param(description="the total number of snapshots available for this domain") + @SerializedName("snapshotavailable") @Param(description = "The total number of Snapshots available for this domain") private String snapshotAvailable; @SerializedName(ApiConstants.BACKUP_LIMIT) @@ -129,76 +129,85 @@ public class DomainResponse extends BaseResponseWithAnnotations implements Resou @Param(description = "the total backup storage space (in GiB) available to the domain", since = "4.21.0") private String backupStorageAvailable; - @SerializedName("templatelimit") @Param(description="the total number of templates which can be created by this domain") + @SerializedName("templatelimit") @Param(description = "The total number of Templates which can be created by this domain") private String templateLimit; - @SerializedName("templatetotal") @Param(description="the total number of templates which have been created by this domain") + @SerializedName("templatetotal") @Param(description = "The total number of Templates which have been created by this domain") private Long templateTotal; - @SerializedName("templateavailable") @Param(description="the total number of templates available to be created by this domain") + @SerializedName("templateavailable") @Param(description = "The total number of Templates available to be created by this domain") private String templateAvailable; - @SerializedName("projectlimit") @Param(description="the total number of projects the domain can own", since="3.0.1") + @SerializedName("projectlimit") @Param(description = "The total number of projects the domain can own", since="3.0.1") private String projectLimit; - @SerializedName("projecttotal") @Param(description="the total number of projects being administrated by this domain", since="3.0.1") + @SerializedName("projecttotal") @Param(description = "The total number of projects being administrated by this domain", since="3.0.1") private Long projectTotal; - @SerializedName("projectavailable") @Param(description="the total number of projects available for administration by this domain", since="3.0.1") + @SerializedName("projectavailable") @Param(description = "The total number of projects available for administration by this domain", since="3.0.1") private String projectAvailable; - @SerializedName("networklimit") @Param(description="the total number of networks the domain can own", since="3.0.1") + @SerializedName("networklimit") @Param(description = "The total number of Networks the domain can own", since="3.0.1") private String networkLimit; - @SerializedName("networktotal") @Param(description="the total number of networks owned by domain", since="3.0.1") + @SerializedName("networktotal") @Param(description = "The total number of Networks owned by domain", since="3.0.1") private Long networkTotal; - @SerializedName("networkavailable") @Param(description="the total number of networks available to be created for this domain", since="3.0.1") + @SerializedName("networkavailable") @Param(description = "The total number of Networks available to be created for this domain", since="3.0.1") private String networkAvailable; - @SerializedName("vpclimit") @Param(description="the total number of vpcs the domain can own", since="4.0.0") + @SerializedName("vpclimit") @Param(description = "The total number of VPCs the domain can own", since="4.0.0") private String vpcLimit; - @SerializedName("vpctotal") @Param(description="the total number of vpcs owned by domain", since="4.0.0") + @SerializedName("vpctotal") @Param(description = "The total number of VPCs owned by domain", since="4.0.0") private Long vpcTotal; - @SerializedName("vpcavailable") @Param(description="the total number of vpcs available to be created for this domain", since="4.0.0") + @SerializedName("vpcavailable") @Param(description = "The total number of VPCs available to be created for this domain", since="4.0.0") private String vpcAvailable; - @SerializedName("cpulimit") @Param(description="the total number of cpu cores the domain can own", since="4.2.0") + @SerializedName("cpulimit") @Param(description = "The total number of CPU cores the domain can own", since="4.2.0") private String cpuLimit; - @SerializedName("cputotal") @Param(description="the total number of cpu cores owned by domain", since="4.2.0") + @SerializedName("cputotal") @Param(description = "The total number of CPU cores owned by domain", since="4.2.0") private Long cpuTotal; - @SerializedName("cpuavailable") @Param(description="the total number of cpu cores available to be created for this domain", since="4.2.0") + @SerializedName("cpuavailable") @Param(description = "The total number of CPU cores available to be created for this domain", since="4.2.0") private String cpuAvailable; - @SerializedName("memorylimit") @Param(description="the total memory (in MB) the domain can own", since="4.2.0") + @SerializedName("memorylimit") @Param(description = "The total memory (in MB) the domain can own", since="4.2.0") private String memoryLimit; - @SerializedName("memorytotal") @Param(description="the total memory (in MB) owned by domain", since="4.2.0") + @SerializedName("memorytotal") @Param(description = "The total memory (in MB) owned by domain", since="4.2.0") private Long memoryTotal; - @SerializedName("memoryavailable") @Param(description="the total memory (in MB) available to be created for this domain", since="4.2.0") + @SerializedName("memoryavailable") @Param(description = "The total memory (in MB) available to be created for this domain", since="4.2.0") private String memoryAvailable; - @SerializedName("primarystoragelimit") @Param(description="the total primary storage space (in GiB) the domain can own", since="4.2.0") + @SerializedName("gpulimit") @Param(description="the total number of gpus the domain can own", since="4.21.0") + private String gpuLimit; + + @SerializedName("gputotal") @Param(description="the total number of gpus owned by domain", since="4.21.0") + private Long gpuTotal; + + @SerializedName("gpuavailable") @Param(description="the total number of gpus available to be created for this domain", since="4.21.0") + private String gpuAvailable; + + @SerializedName("primarystoragelimit") @Param(description = "The total primary storage space (in GiB) the domain can own", since="4.2.0") private String primaryStorageLimit; - @SerializedName("primarystoragetotal") @Param(description="the total primary storage space (in GiB) owned by domain", since="4.2.0") + @SerializedName("primarystoragetotal") @Param(description = "The total primary storage space (in GiB) owned by domain", since="4.2.0") private Long primaryStorageTotal; - @SerializedName("primarystorageavailable") @Param(description="the total primary storage space (in GiB) available to be used for this domain", since="4.2.0") + @SerializedName("primarystorageavailable") @Param(description = "The total primary storage space (in GiB) available to be used for this domain", since="4.2.0") private String primaryStorageAvailable; - @SerializedName("secondarystoragelimit") @Param(description="the total secondary storage space (in GiB) the domain can own", since="4.2.0") + @SerializedName("secondarystoragelimit") @Param(description = "The total secondary storage space (in GiB) the domain can own", since="4.2.0") private String secondaryStorageLimit; - @SerializedName("secondarystoragetotal") @Param(description="the total secondary storage space (in GiB) owned by domain", since="4.2.0") + @SerializedName("secondarystoragetotal") @Param(description = "The total secondary storage space (in GiB) owned by domain", since="4.2.0") private float secondaryStorageTotal; - @SerializedName("secondarystorageavailable") @Param(description="the total secondary storage space (in GiB) available to be used for this domain", since="4.2.0") + @SerializedName("secondarystorageavailable") @Param(description = "The total secondary storage space (in GiB) available to be used for this domain", since="4.2.0") private String secondaryStorageAvailable; @SerializedName(ApiConstants.BUCKET_LIMIT) @@ -230,7 +239,7 @@ public class DomainResponse extends BaseResponseWithAnnotations implements Resou ResourceIconResponse icon; @SerializedName(ApiConstants.DOMAIN_DETAILS) - @Param(description = "details for the domain") + @Param(description = "Details for the domain") private Map details; @SerializedName(ApiConstants.TAGGED_RESOURCES) @@ -478,6 +487,21 @@ public void setMemoryAvailable(String memoryAvailable) { this.memoryAvailable = memoryAvailable; } + @Override + public void setGpuLimit(String gpuLimit) { + this.gpuLimit = gpuLimit; + } + + @Override + public void setGpuTotal(Long gpuTotal) { + this.gpuTotal = gpuTotal; + } + + @Override + public void setGpuAvailable(String gpuAvailable) { + this.gpuAvailable = gpuAvailable; + } + @Override public void setPrimaryStorageLimit(String primaryStorageLimit) { this.primaryStorageLimit = primaryStorageLimit; @@ -565,4 +589,8 @@ public void setDetails(Map details) { public void setTaggedResourceLimitsAndCounts(List taggedResourceLimitsAndCounts) { this.taggedResources = taggedResourceLimitsAndCounts; } + + public void setTags(Set tags) { + this.tags = tags; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java index b23d0f4b5276..6c94991e8f08 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java @@ -34,155 +34,155 @@ @SuppressWarnings("unused") public class DomainRouterResponse extends BaseResponseWithAnnotations implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the router") + @Param(description = "The ID of the router") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID for the router") + @Param(description = "The Zone ID for the router") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name for the router") + @Param(description = "The Zone name for the router") private String zoneName; @SerializedName(ApiConstants.DNS1) - @Param(description = "the first DNS for the router") + @Param(description = "The first DNS for the router") private String dns1; @SerializedName(ApiConstants.DNS2) - @Param(description = "the second DNS for the router") + @Param(description = "The second DNS for the router") private String dns2; @SerializedName(ApiConstants.IP6_DNS1) - @Param(description = "the first IPv6 DNS for the router") + @Param(description = "The first IPv6 DNS for the router") private String ip6Dns1; @SerializedName(ApiConstants.IP6_DNS2) - @Param(description = "the second IPv6 DNS for the router") + @Param(description = "The second IPv6 DNS for the router") private String ip6Dns2; @SerializedName("networkdomain") - @Param(description = "the network domain for the router") + @Param(description = "The Network domain for the router") private String networkDomain; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway for the router") + @Param(description = "The gateway for the router") private String gateway; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the router") + @Param(description = "The name of the router") private String name; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod ID for the router") + @Param(description = "The Pod ID for the router") private String podId; @SerializedName(ApiConstants.POD_NAME) - @Param(description = "the Pod name for the router", since = "4.13.2") + @Param(description = "The Pod name for the router", since = "4.13.2") private String podName; @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the host ID for the router") + @Param(description = "The host ID for the router") private String hostId; @SerializedName("hostname") - @Param(description = "the hostname for the router") + @Param(description = "The hostname for the router") private String hostName; @SerializedName(ApiConstants.HOST_CONTROL_STATE) - @Param(description = "the control state of the host for the router") + @Param(description = "The control state of the host for the router") private String hostControlState; @SerializedName("hypervisor") - @Param(description = "the hypervisor on which the template runs") + @Param(description = "The hypervisor on which the Template runs") private String hypervisor; @SerializedName(ApiConstants.LINK_LOCAL_IP) - @Param(description = "the link local IP address for the router") + @Param(description = "The Control IP address for the router") private String linkLocalIp; @SerializedName(ApiConstants.LINK_LOCAL_MAC_ADDRESS) - @Param(description = "the link local MAC address for the router") + @Param(description = "The link local MAC address for the router") private String linkLocalMacAddress; @SerializedName(ApiConstants.LINK_LOCAL_MAC_NETMASK) - @Param(description = "the link local netmask for the router") + @Param(description = "The link local netmask for the router") private String linkLocalNetmask; @SerializedName(ApiConstants.LINK_LOCAL_NETWORK_ID) - @Param(description = "the ID of the corresponding link local network") + @Param(description = "The ID of the corresponding link local Network") private String linkLocalNetworkId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public IP address for the router") + @Param(description = "The public IP address for the router") private String publicIp; @SerializedName("publicmacaddress") - @Param(description = "the public MAC address for the router") + @Param(description = "The public MAC address for the router") private String publicMacAddress; @SerializedName("publicnetmask") - @Param(description = "the public netmask for the router") + @Param(description = "The public netmask for the router") private String publicNetmask; @SerializedName("publicnetworkid") - @Param(description = "the ID of the corresponding public network") + @Param(description = "The ID of the corresponding public Network") private String publicNetworkId; @SerializedName("guestipaddress") - @Param(description = "the guest IP address for the router") + @Param(description = "The guest IP address for the router") private String guestIpAddress; @SerializedName("guestmacaddress") - @Param(description = "the guest MAC address for the router") + @Param(description = "The guest MAC address for the router") private String guestMacAddress; @SerializedName("guestnetmask") - @Param(description = "the guest netmask for the router") + @Param(description = "The guest netmask for the router") private String guestNetmask; @SerializedName("guestnetworkid") - @Param(description = "the ID of the corresponding guest network") + @Param(description = "The ID of the corresponding guest Network") private String guestNetworkId; @SerializedName("guestnetworkname") - @Param(description = "the name of the corresponding guest network") + @Param(description = "The name of the corresponding guest Network") private String guestNetworkName; @SerializedName(ApiConstants.TEMPLATE_ID) - @Param(description = "the template ID for the router") + @Param(description = "The Template ID for the router") private String templateId; @SerializedName(ApiConstants.TEMPLATE_NAME) - @Param(description = "the template name for the router", since = "4.13.2") + @Param(description = "The Template name for the router", since = "4.13.2") private String templateName; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date and time the router was created") + @Param(description = "The date and time the router was created") private Date created; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the router") + @Param(description = "The state of the router") private State state; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the router") + @Param(description = "The Account associated with the router") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project id of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID associated with the router") + @Param(description = "The domain ID associated with the router") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the router") + @Param(description = "The domain associated with the router") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -190,27 +190,27 @@ public class DomainRouterResponse extends BaseResponseWithAnnotations implements private String domainPath; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) - @Param(description = "the ID of the service offering of the virtual machine") + @Param(description = "The ID of the service offering of the Instance") private String serviceOfferingId; @SerializedName("serviceofferingname") - @Param(description = "the name of the service offering of the virtual machine") + @Param(description = "The name of the service offering of the Instance") private String serviceOfferingName; @SerializedName("isredundantrouter") - @Param(description = "if this router is an redundant virtual router") + @Param(description = "If this router is an redundant virtual router") private boolean isRedundantRouter; @SerializedName("redundantstate") - @Param(description = "the state of redundant virtual router") + @Param(description = "The state of redundant virtual router") private String redundantState; @SerializedName("version") - @Param(description = "the version of template") + @Param(description = "The version of Template") private String version; @SerializedName("scriptsversion") - @Param(description = "the version of scripts") + @Param(description = "The version of scripts") private String scriptsVersion; @SerializedName(ApiConstants.VPC_ID) @@ -218,23 +218,23 @@ public class DomainRouterResponse extends BaseResponseWithAnnotations implements private String vpcId; @SerializedName("vpcname") - @Param(description = "the name of VPC the router belongs to") + @Param(description = "The name of VPC the router belongs to") private String vpcName; @SerializedName(ApiConstants.ROLE) - @Param(description = "role of the domain router") + @Param(description = "Role of the domain router") private String role; @SerializedName("nic") - @Param(description = "the list of nics associated with the router", responseObject = NicResponse.class, since = "4.0") + @Param(description = "The list of NICs associated with the router", responseObject = NicResponse.class, since = "4.0") private Set nics; @SerializedName("requiresupgrade") - @Param(description = "true if the router template requires upgrader") + @Param(description = "True if the router Template requires upgrade") private boolean requiresUpgrade; @SerializedName(ApiConstants.HEALTHCHECK_FAILED) - @Param(description = "true if any health checks had failed") + @Param(description = "True if any health checks had failed") private boolean healthChecksFailed; @SerializedName("healthcheckresults") @@ -242,9 +242,13 @@ public class DomainRouterResponse extends BaseResponseWithAnnotations implements List healthCheckResults; @SerializedName("softwareversion") - @Param(description = "the version of the code / software in the router") + @Param(description = "The version of the code / software in the router") private String softwareVersion; + @SerializedName(ApiConstants.ARCH) + @Param(description = "CPU arch of the router", since = "4.20.1") + private String arch; + public DomainRouterResponse() { nics = new LinkedHashSet(); } @@ -518,4 +522,8 @@ public String getSoftwareVersion() { public void setSoftwareVersion(String softwareVersion) { this.softwareVersion = softwareVersion; } + + public void setArch(String arch) { + this.arch = arch; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java index 751d00922f1e..889b3c41c6b7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/EventResponse.java @@ -30,43 +30,43 @@ @SuppressWarnings("unused") public class EventResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the event") + @Param(description = "The ID of the event") private String id; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the name of the user who performed the action (can be different from the account if an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)") + @Param(description = "The name of the User who performed the action (can be different from the Account if an admin is performing an action for a User, e.g. starting/stopping a User's Instance)") private String username; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the event (see event types)") + @Param(description = "The type of the event (see event types)") private String eventType; @SerializedName(ApiConstants.LEVEL) - @Param(description = "the event level (INFO, WARN, ERROR)") + @Param(description = "The event level (INFO, WARN, ERROR)") private String level; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "a brief description of the event") + @Param(description = "A brief description of the event") private String description; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account name for the account that owns the object being acted on in the event (e.g. the owner of the virtual machine, ip address, or security group)") + @Param(description = "The Account name for the Account that owns the object being acted on in the event (e.g. the owner of the Instance, IP address, or security group)") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project ID of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the id of the account's domain") + @Param(description = "The ID of the Account's domain") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the name of the account's domain") + @Param(description = "The name of the Account's domain") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -74,31 +74,31 @@ public class EventResponse extends BaseResponse implements ControlledViewEntityR private String domainPath; @SerializedName(ApiConstants.RESOURCE_ID) - @Param(description = "the id of the resource", since = "4.17.0") + @Param(description = "The ID of the resource", since = "4.17.0") private String resourceId; @SerializedName(ApiConstants.RESOURCE_TYPE) - @Param(description = "the type of the resource", since = "4.17.0") + @Param(description = "The type of the resource", since = "4.17.0") private String resourceType; @SerializedName(ApiConstants.RESOURCE_NAME) - @Param(description = "the name of the resource", since = "4.17.0") + @Param(description = "The name of the resource", since = "4.17.0") private String resourceName; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date the event was created") + @Param(description = "The date the event was created") private Date created; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the event") + @Param(description = "The state of the event") private Event.State state; @SerializedName(ApiConstants.PARENT_ID) - @Param(description = "whether the event is parented") + @Param(description = "Whether the event is parented") private String parentId; @SerializedName(ApiConstants.ARCHIVED) - @Param(description = "whether the event has been archived or not") + @Param(description = "Whether the event has been archived or not") private Boolean archived; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java index 65d4ac333711..d475dee0620f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExceptionResponse.java @@ -29,19 +29,19 @@ public class ExceptionResponse extends BaseResponse { @SerializedName("uuidList") - @Param(description = "List of uuids associated with this error") + @Param(description = "List of UUIDs associated with this error") private List idList; @SerializedName("errorcode") - @Param(description = "numeric code associated with this error") + @Param(description = "Numeric code associated with this error") private Integer errorCode; @SerializedName("cserrorcode") - @Param(description = "cloudstack exception error code associated with this error") + @Param(description = "Cloudstack exception error code associated with this error") private Integer csErrorCode; @SerializedName("errortext") - @Param(description = "the text associated with this error") + @Param(description = "The text associated with this error") private String errorText = "Command failed due to Internal Server Error"; public ExceptionResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionParameterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionParameterResponse.java new file mode 100644 index 000000000000..d627f8077dc1 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionParameterResponse.java @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import java.util.List; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class ExtensionCustomActionParameterResponse extends BaseResponse { + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the parameter") + private String name; + + @SerializedName(ApiConstants.TYPE) + @Param(description = "Type of the parameter") + private String type; + + @SerializedName(ApiConstants.VALIDATION_FORMAT) + @Param(description = "Validation format for value of the parameter. Available for specific types") + private String validationFormat; + + @SerializedName(ApiConstants.VALUE_OPTIONS) + @Param(description = "Comma-separated list of options for value of the parameter") + private List valueOptions; + + @SerializedName(ApiConstants.REQUIRED) + @Param(description = "Whether the parameter is required or not") + private Boolean required; + + public ExtensionCustomActionParameterResponse(String name, String type, String validationFormat, List valueOptions, + boolean required) { + this.name = name; + this.type = type; + this.validationFormat = validationFormat; + this.valueOptions = valueOptions; + this.required = required; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionResponse.java new file mode 100644 index 000000000000..96edf6d2fd80 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionCustomActionResponse.java @@ -0,0 +1,184 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.extension.ExtensionCustomAction; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value = ExtensionCustomAction.class) +public class ExtensionCustomActionResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the custom action") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the custom action") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "Description of the custom action") + private String description; + + @SerializedName(ApiConstants.EXTENSION_ID) + @Param(description = "ID of the extension that this custom action belongs to") + private String extensionId; + + @SerializedName(ApiConstants.EXTENSION_NAME) + @Param(description = "Name of the extension that this custom action belongs to") + private String extensionName; + + @SerializedName(ApiConstants.RESOURCE_TYPE) + @Param(description = "Resource type for which the action is available") + private String resourceType; + + @SerializedName(ApiConstants.ALLOWED_ROLE_TYPES) + @Param(description = "List of role types allowed for the custom action") + private List allowedRoleTypes; + + @SerializedName(ApiConstants.SUCCESS_MESSAGE) + @Param(description = "Message that will be used on successful execution of the action") + private String successMessage; + + @SerializedName(ApiConstants.ERROR_MESSAGE) + @Param(description = "Message that will be used on failure during execution of the action") + private String errorMessage; + + @SerializedName(ApiConstants.TIMEOUT) + @Param(description = "Specifies the timeout in seconds to wait for the action to complete before failing") + private Integer timeout; + + @SerializedName(ApiConstants.ENABLED) + @Param(description = "Whether the custom action is enabled or not") + private Boolean enabled; + + @SerializedName(ApiConstants.DETAILS) + @Param(description = "Details of the custom action") + private Map details; + + @SerializedName(ApiConstants.PARAMETERS) + @Param(description = "List of the parameters for the action", responseObject = ExtensionCustomActionParameterResponse.class) + private List parameters; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "Creation timestamp of the custom action") + private Date created; + + public ExtensionCustomActionResponse(String id, String name, String description) { + this.id = id; + this.name = name; + this.description = description; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setExtensionId(String extensionId) { + this.extensionId = extensionId; + } + + public void setExtensionName(String extensionName) { + this.extensionName = extensionName; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public List getAllowedRoleTypes() { + return allowedRoleTypes; + } + + public void setAllowedRoleTypes(List allowedRoleTypes) { + this.allowedRoleTypes = allowedRoleTypes; + } + + public void setSuccessMessage(String successMessage) { + this.successMessage = successMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public void setTimeout(Integer timeout) { + this.timeout = timeout; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public void setParameters(List parameters) { + this.parameters = parameters; + } + + public List getParameters() { + return parameters; + } + + public void setDetails(Map details) { + this.details = details; + } + + public Map getDetails() { + return details; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResourceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResourceResponse.java new file mode 100644 index 000000000000..aa370887b748 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResourceResponse.java @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import org.apache.cloudstack.extension.ExtensionResourceMap; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + +import java.util.Date; +import java.util.Map; + +@EntityReference(value = ExtensionResourceMap.class) +public class ExtensionResourceResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the resource associated with the extension") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the resource associated with this mapping") + private String name; + + @SerializedName(ApiConstants.TYPE) + @Param(description = "Type of the resource") + private String type; + + @SerializedName(ApiConstants.DETAILS) + @Param(description = "the details of the resource map") + private Map details; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "Creation timestamp of the mapping") + private Date created; + + public ExtensionResourceResponse() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Map getDetails() { + return details; + } + + public void setDetails(Map details) { + this.details = details; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResponse.java new file mode 100644 index 000000000000..911839da405f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExtensionResponse.java @@ -0,0 +1,192 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.extension.Extension; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value = Extension.class) +public class ExtensionResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the extension") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the extension") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "Description of the extension") + private String description; + + @SerializedName(ApiConstants.TYPE) + @Param(description = "Type of the extension") + private String type; + + @SerializedName(ApiConstants.PATH) + @Param(description = "The path of the entry point fo the extension") + private String path; + + @SerializedName(ApiConstants.PATH_READY) + @Param(description = "True if the extension path is in ready state across management servers") + private Boolean pathReady; + + @SerializedName(ApiConstants.IS_USER_DEFINED) + @Param(description = "True if the extension is added by admin") + private Boolean userDefined; + + @SerializedName(ApiConstants.ORCHESTRATOR_REQUIRES_PREPARE_VM) + @Parameter(description = "Only honored when type is Orchestrator. Whether prepare VM is needed or not") + private Boolean orchestratorRequiresPrepareVm; + + @SerializedName(ApiConstants.STATE) + @Param(description = "The state of the extension") + private String state; + + @SerializedName(ApiConstants.DETAILS) + @Param(description = "The details of the extension") + private Map details; + + @SerializedName(ApiConstants.RESOURCES) + @Param(description = "List of resources to which extension is registered to", responseObject = ExtensionResourceResponse.class) + private List resources; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "Creation timestamp of the extension") + private Date created; + + @SerializedName(ApiConstants.REMOVED) + @Param(description = "Removal timestamp of the extension, if applicable") + private Date removed; + + @SerializedName(ApiConstants.RESERVED_RESOURCE_DETAILS) + @Param(description = "Resource detail names as comma separated string that should be reserved and not visible " + + "to end users", + since = "4.22.1") + protected String reservedResourceDetails; + + public ExtensionResponse(String id, String name, String description, String type) { + this.id = id; + this.name = name; + this.description = description; + this.type = type; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getType() { + return type; + } + + public String getPath() { + return path; + } + + public Boolean isPathReady() { + return pathReady; + } + + public Boolean isUserDefined() { + return userDefined; + } + + public Boolean isOrchestratorRequiresPrepareVm() { + return orchestratorRequiresPrepareVm; + } + + public String getState() { + return state; + } + + public Map getDetails() { + return details; + } + + public void setPath(String path) { + this.path = path; + } + + public void setPathReady(Boolean pathReady) { + this.pathReady = pathReady; + } + + public void setUserDefined(Boolean userDefined) { + this.userDefined = userDefined; + } + + public void setOrchestratorRequiresPrepareVm(Boolean orchestratorRequiresPrepareVm) { + this.orchestratorRequiresPrepareVm = orchestratorRequiresPrepareVm; + } + + public void setState(String state) { + this.state = state; + } + + public void setDetails(Map details) { + this.details = details; + } + + public List getResources() { + return resources; + } + + public void setResources(List resources) { + this.resources = resources; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public void setReservedResourceDetails(String reservedResourceDetails) { + this.reservedResourceDetails = reservedResourceDetails; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java index b92288ddb3ff..36e2eabadc59 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExternalFirewallResponse.java @@ -25,47 +25,47 @@ public class ExternalFirewallResponse extends NetworkDeviceResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the external firewall") + @Param(description = "The ID of the external firewall") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID of the external firewall") + @Param(description = "The zone ID of the external firewall") private String zoneId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the management IP address of the external firewall") + @Param(description = "The management IP address of the external firewall") private String ipAddress; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the username that's used to log in to the external firewall") + @Param(description = "The username that's used to log in to the external firewall") private String username; @SerializedName(ApiConstants.PUBLIC_INTERFACE) - @Param(description = "the public interface of the external firewall") + @Param(description = "The public interface of the external firewall") private String publicInterface; @SerializedName(ApiConstants.USAGE_INTERFACE) - @Param(description = "the usage interface of the external firewall") + @Param(description = "The usage interface of the external firewall") private String usageInterface; @SerializedName(ApiConstants.PRIVATE_INTERFACE) - @Param(description = "the private interface of the external firewall") + @Param(description = "The private interface of the external firewall") private String privateInterface; @SerializedName(ApiConstants.PUBLIC_ZONE) - @Param(description = "the public security zone of the external firewall") + @Param(description = "The public security zone of the external firewall") private String publicZone; @SerializedName(ApiConstants.PRIVATE_ZONE) - @Param(description = "the private security zone of the external firewall") + @Param(description = "The private security zone of the external firewall") private String privateZone; @SerializedName(ApiConstants.NUM_RETRIES) - @Param(description = "the number of times to retry requests to the external firewall") + @Param(description = "The number of times to retry requests to the external firewall") private String numRetries; @SerializedName(ApiConstants.TIMEOUT) - @Param(description = "the timeout (in seconds) for requests to the external firewall") + @Param(description = "The timeout (in seconds) for requests to the external firewall") private String timeout; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java index fe50b9774288..ae25a2cb627e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java @@ -25,31 +25,31 @@ public class ExternalLoadBalancerResponse extends NetworkDeviceResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the external load balancer") + @Param(description = "The ID of the external Load balancer") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID of the external load balancer") + @Param(description = "The zone ID of the external Load balancer") private String zoneId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the management IP address of the external load balancer") + @Param(description = "The management IP address of the external Load balancer") private String ipAddress; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the username that's used to log in to the external load balancer") + @Param(description = "The username that's used to log in to the external Load balancer") private String username; @SerializedName(ApiConstants.PUBLIC_INTERFACE) - @Param(description = "the public interface of the external load balancer") + @Param(description = "The public interface of the external Load balancer") private String publicInterface; @SerializedName(ApiConstants.PRIVATE_INTERFACE) - @Param(description = "the private interface of the external load balancer") + @Param(description = "The private interface of the external Load balancer") private String privateInterface; @SerializedName(ApiConstants.NUM_RETRIES) - @Param(description = "the number of times to retry requests to the external load balancer") + @Param(description = "The number of times to retry requests to the external Load balancer") private String numRetries; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java index 3d22dfe092ce..fc5fd6c7a55f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ExtractResponse.java @@ -27,27 +27,27 @@ public class ExtractResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of extracted object") + @Param(description = "The ID of extracted object") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the extracted object") + @Param(description = "The name of the extracted object") private String name; @SerializedName("extractId") - @Param(description = "the upload id of extracted object") + @Param(description = "The upload ID of extracted object") private String uploadId; @SerializedName("uploadpercentage") - @Param(description = "the percentage of the entity uploaded to the specified location") + @Param(description = "The percentage of the entity uploaded to the specified location") private Integer uploadPercent; @SerializedName("status") - @Param(description = "the status of the extraction") + @Param(description = "The status of the extraction") private String status; @SerializedName("accountid") - @Param(description = "the account id to which the extracted object belongs") + @Param(description = "The Account ID to which the extracted object belongs") private String accountId; @SerializedName("resultstring") @@ -55,31 +55,31 @@ public class ExtractResponse extends BaseResponse { private String resultString; @SerializedName(ApiConstants.CREATED) - @Param(description = "the time and date the object was created") + @Param(description = "The time and date the object was created") private Date createdDate; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the extracted object") + @Param(description = "The state of the extracted object") private String state; @SerializedName("storagetype") - @Param(description = "type of the storage") + @Param(description = "Type of the storage") private String storageType; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone ID the object was extracted from") + @Param(description = "Zone ID the object was extracted from") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "zone name the object was extracted from") + @Param(description = "Zone name the object was extracted from") private String zoneName; @SerializedName("extractMode") - @Param(description = "the mode of extraction - upload or download") + @Param(description = "The mode of extraction - upload or download") private String mode; @SerializedName(ApiConstants.URL) - @Param(description = "if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded") + @Param(description = "If mode = upload then URL of the uploaded entity. if mode = download the URL from which the entity can be downloaded") private String url; public ExtractResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java index a9ecdd8e3393..5986c16dc8c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/FirewallResponse.java @@ -28,63 +28,63 @@ @SuppressWarnings("unused") public class FirewallResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the firewall rule") + @Param(description = "The ID of the firewall rule") private String id; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the firewall rule") + @Param(description = "The protocol of the firewall rule") private String protocol; @SerializedName(ApiConstants.START_PORT) - @Param(description = "the starting port of firewall rule's port range") + @Param(description = "The starting port of firewall rule's port range") private Integer startPort; @SerializedName(ApiConstants.END_PORT) - @Param(description = "the ending port of firewall rule's port range") + @Param(description = "The ending port of firewall rule's port range") private Integer endPort; @SerializedName(ApiConstants.IP_ADDRESS_ID) - @Param(description = "the public ip address id for the firewall rule") + @Param(description = "The public IP address ID for the firewall rule") private String publicIpAddressId; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the network id of the firewall rule") + @Param(description = "The Network ID of the firewall rule") private String networkId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the public ip address for the firewall rule") + @Param(description = "The public IP address for the firewall rule") private String publicIpAddress; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the rule") + @Param(description = "The state of the rule") private String state; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "the cidr list to forward traffic from. Multiple entries are separated by a single comma character (,).") + @Param(description = "The CIDR list to forward traffic from. Multiple entries are separated by a single comma character (,).") private String cidrList; @SerializedName(ApiConstants.ICMP_TYPE) - @Param(description = "type of the icmp message being sent") + @Param(description = "Type of the ICMP message being sent") private Integer icmpType; @SerializedName(ApiConstants.ICMP_CODE) - @Param(description = "error code for this icmp message") + @Param(description = "Error code for this ICMP message") private Integer icmpCode; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.DEST_CIDR_LIST) - @Param(description = "the cidr list to forward traffic to. Multiple entries are separated by a single comma character (,).") + @Param(description = "The CIDR list to forward traffic to. Multiple entries are separated by a single comma character (,).") private String destCidr; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the traffic type for the firewall rule", since = "4.17.0") + @Param(description = "The traffic type for the firewall rule", since = "4.17.0") private String trafficType; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java index 1d3b665634fd..aed56a369089 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/FirewallRuleResponse.java @@ -31,71 +31,75 @@ @SuppressWarnings("unused") public class FirewallRuleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the port forwarding rule") + @Param(description = "The ID of the port forwarding rule") private String id; @SerializedName(ApiConstants.PRIVATE_START_PORT) - @Param(description = "the starting port of port forwarding rule's private port range") + @Param(description = "The starting port of port forwarding rule's private port range") private String privateStartPort; @SerializedName(ApiConstants.PRIVATE_END_PORT) - @Param(description = "the ending port of port forwarding rule's private port range") + @Param(description = "The ending port of port forwarding rule's private port range") private String privateEndPort; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the port forwarding rule") + @Param(description = "The protocol of the port forwarding rule") private String protocol; @SerializedName(ApiConstants.PUBLIC_START_PORT) - @Param(description = "the starting port of port forwarding rule's public port range") + @Param(description = "The starting port of port forwarding rule's public port range") private String publicStartPort; @SerializedName(ApiConstants.PUBLIC_END_PORT) - @Param(description = "the ending port of port forwarding rule's private port range") + @Param(description = "The ending port of port forwarding rule's private port range") private String publicEndPort; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "the VM ID for the port forwarding rule") + @Param(description = "The Instance ID for the port forwarding rule") private String virtualMachineId; @SerializedName("virtualmachinename") - @Param(description = "the VM name for the port forwarding rule") + @Param(description = "The Instance name for the port forwarding rule") private String virtualMachineName; @SerializedName("virtualmachinedisplayname") - @Param(description = "the VM display name for the port forwarding rule") + @Param(description = "The Instance display name for the port forwarding rule") private String virtualMachineDisplayName; @SerializedName(ApiConstants.IP_ADDRESS_ID) - @Param(description = "the public ip address id for the port forwarding rule") + @Param(description = "The public IP address id for the port forwarding rule") private String publicIpAddressId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the public ip address for the port forwarding rule") + @Param(description = "The public IP address for the port forwarding rule") private String publicIpAddress; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the rule") + @Param(description = "The state of the rule") private String state; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "the cidr list to forward traffic from. Multiple entries are separated by a single comma character (,).") + @Param(description = "The CIDR list to forward traffic from. Multiple entries are separated by a single comma character (,).") private String cidrList; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.VM_GUEST_IP) - @Param(description = "the vm ip address for the port forwarding rule") + @Param(description = "The Instance IP address for the port forwarding rule") private String destNatVmIp; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the id of the guest network the port forwarding rule belongs to") + @Param(description = "The ID of the guest Network the port forwarding rule belongs to") private String networkId; + @SerializedName(ApiConstants.NETWORK_NAME) + @Param(description = "The Name of the guest Network the port forwarding rule belongs to") + private String networkName; + @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is firewall for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is firewall for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public String getDestNatVmIp() { @@ -223,6 +227,10 @@ public void setNetworkId(String networkId) { this.networkId = networkId; } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + public void setForDisplay(Boolean forDisplay) { this.forDisplay = forDisplay; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java index b9be06ecc8f8..0e51aa6cd381 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GetUploadParamsResponse.java @@ -30,7 +30,7 @@ public class GetUploadParamsResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the template/volume ID") + @Param(description = "The Template/volume ID") private UUID id; @SerializedName(ApiConstants.POST_URL) @@ -38,15 +38,15 @@ public class GetUploadParamsResponse extends BaseResponse { private URL postURL; @SerializedName(ApiConstants.METADATA) - @Param(description = "encrypted data to be sent in the POST request.") + @Param(description = "Encrypted data to be sent in the POST request.") private String metadata; @SerializedName(ApiConstants.EXPIRES) - @Param(description = "the timestamp after which the signature expires") + @Param(description = "The timestamp after which the signature expires") private String expires; @SerializedName(ApiConstants.SIGNATURE) - @Param(description = "signature to be sent in the POST request.") + @Param(description = "Signature to be sent in the POST request.") private String signature; public GetUploadParamsResponse(UUID id, URL postURL, String metadata, String expires, String signature) { @@ -62,6 +62,10 @@ public GetUploadParamsResponse() { setObjectName("getuploadparams"); } + public UUID getId() { + return id; + } + public void setId(UUID id) { this.id = id; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java index 49603212edc9..9c9e41774958 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GetVMPasswordResponse.java @@ -25,7 +25,7 @@ public class GetVMPasswordResponse extends BaseResponse { @SerializedName("encryptedpassword") - @Param(description = "The base64 encoded encrypted password of the VM", isSensitive = true) + @Param(description = "The base64 encoded encrypted password of the Instance", isSensitive = true) private String encryptedPassword; public GetVMPasswordResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java index d41e4d2ab34c..b16706bb872d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GlobalLoadBalancerResponse.java @@ -31,27 +31,27 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "global load balancer rule ID") + @Param(description = "Global Load balancer rule ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the global load balancer rule") + @Param(description = "Name of the global Load balancer rule") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the global load balancer rule") + @Param(description = "The description of the global Load balancer rule") private String description; @SerializedName(ApiConstants.GSLB_SERVICE_DOMAIN_NAME) - @Param(description = "DNS domain name given for the global load balancer") + @Param(description = "DNS domain name given for the global Load balancer") private String gslbDomainName; @SerializedName(ApiConstants.GSLB_LB_METHOD) - @Param(description = "Load balancing method used for the global load balancer") + @Param(description = "Load balancing method used for the global Load balancer") private String algorithm; @SerializedName(ApiConstants.GSLB_STICKY_SESSION_METHOD) - @Param(description = "session persistence method used for the global load balancer") + @Param(description = "Session persistence method used for the global Load balancer") private String stickyMethod; @SerializedName(ApiConstants.GSLB_SERVICE_TYPE) @@ -59,27 +59,27 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements Controll private String serviceType; @SerializedName(ApiConstants.REGION_ID) - @Param(description = "Region Id in which global load balancer is created") + @Param(description = "Region ID in which global Load balancer is created") private Integer regionId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the load balancer rule") + @Param(description = "The Account of the Load balancer rule") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the load balancer") + @Param(description = "The project ID of the Load balancer") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the load balancer") + @Param(description = "The project name of the Load balancer") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the load balancer rule") + @Param(description = "The domain ID of the Load balancer rule") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain of the load balancer rule") + @Param(description = "The domain of the Load balancer rule") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -87,7 +87,7 @@ public class GlobalLoadBalancerResponse extends BaseResponse implements Controll private String domainPath; @SerializedName(ApiConstants.LOAD_BALANCER_RULE) - @Param(description = "List of load balancer rules that are part of GSLB rule", responseObject = LoadBalancerResponse.class) + @Param(description = "List of Load balancer rules that are part of GSLB rule", responseObject = LoadBalancerResponse.class) private List siteLoadBalancers; public void setRegionIdId(Integer regionId) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GpuCardResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GpuCardResponse.java new file mode 100644 index 000000000000..ad91b3490efa --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/GpuCardResponse.java @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.gpu.GpuCard; + +@EntityReference(value = GpuCard.class) +public class GpuCardResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of the GPU card") + protected String id; + + @SerializedName("deviceid") + @Param(description = "the device ID of the GPU card") + protected String deviceId; + + @SerializedName("devicename") + @Param(description = "the device name of the GPU card") + protected String deviceName; + + @SerializedName("name") + @Param(description = "the display name of the GPU card") + protected String name; + + @SerializedName("vendorname") + @Param(description = "the vendor name of the GPU card") + protected String vendorName; + + @SerializedName("vendorid") + @Param(description = "the vendor ID of the GPU card") + protected String vendorId; + + public GpuCardResponse(GpuCard gpuCard) { + super("gpucard"); + id = gpuCard.getUuid(); + deviceId = gpuCard.getDeviceId(); + deviceName = gpuCard.getDeviceName(); + name = gpuCard.getName(); + vendorName = gpuCard.getVendorName(); + vendorId = gpuCard.getVendorId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GpuDeviceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GpuDeviceResponse.java new file mode 100644 index 000000000000..09e98b54eaa5 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/GpuDeviceResponse.java @@ -0,0 +1,227 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.serializer.Param; +import com.cloud.vm.VirtualMachine; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.gpu.GpuDevice; + +@EntityReference(value = GpuDevice.class) +public class GpuDeviceResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of the GPU device") + private String id; + + @SerializedName(ApiConstants.BUS_ADDRESS) + @Param(description = "bus address of the GPU device or MDEV UUID for vGPU devices") + private String bussAddress; + + @SerializedName(ApiConstants.GPU_DEVICE_TYPE) + @Param(description = "bus address of the GPU device") + private GpuDevice.DeviceType type; + + @SerializedName(ApiConstants.HOST_ID) + @Param(description = "the host ID where the GPU device is attached") + private String hostId; + + @SerializedName(ApiConstants.HOST_NAME) + @Param(description = "the host name where the GPU device is attached") + private String hostName; + + @SerializedName(ApiConstants.GPU_CARD_ID) + @Param(description = "the GPU card ID associated with this GPU device") + private String gpuCardId; + + @SerializedName(ApiConstants.GPU_CARD_NAME) + @Param(description = "the GPU card name associated with this GPU device") + private String gpuCardName; + + @SerializedName(ApiConstants.VGPU_PROFILE_ID) + @Param(description = "the vGPU profile ID assigned to this GPU device") + private String vgpuProfileId; + + @SerializedName(ApiConstants.VGPU_PROFILE_NAME) + @Param(description = "the vGPU profile name assigned to this GPU device") + private String vgpuProfileName; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) + @Param(description = "the vGPU profile ID assigned to this GPU device") + private String vmId; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME) + @Param(description = "the vGPU profile name assigned to this GPU device") + private String vmName; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_STATE) + @Param(description = "the state of the virtual machine to which this GPU device is allocated") + private VirtualMachine.State vmState; + + @SerializedName(ApiConstants.STATE) + @Param(description = "the vGPU profile name assigned to this GPU device") + private GpuDevice.State state; + + @SerializedName(ApiConstants.MANAGED_STATE) + @Param(description = "the managed state of the GPU device (Enabled/Disabled)") + private GpuDevice.ManagedState managedState; + + @SerializedName(ApiConstants.PARENT_GPU_DEVICE_ID) + @Param(description = "the ID of the parent GPU device, if this is a vGPU") + private String parentGpuDeviceId; + + @SerializedName(ApiConstants.NUMA_NODE) + @Param(description = "the NUMA node where the GPU device is located") + private String numaNode; + + + public GpuDeviceResponse() { + // Empty constructor for serialization + super("gpudevice"); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBussAddress() { + return bussAddress; + } + + public void setBussAddress(String bussAddress) { + this.bussAddress = bussAddress; + } + + public GpuDevice.DeviceType getType() { + return type; + } + + public void setType(GpuDevice.DeviceType type) { + this.type = type; + } + + public String getHostId() { + return hostId; + } + + public void setHostId(String hostId) { + this.hostId = hostId; + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public String getGpuCardId() { + return gpuCardId; + } + + public void setGpuCardId(String gpuCardId) { + this.gpuCardId = gpuCardId; + } + + public String getGpuCardName() { + return gpuCardName; + } + + public void setGpuCardName(String gpuCardName) { + this.gpuCardName = gpuCardName; + } + + public String getVgpuProfileId() { + return vgpuProfileId; + } + + public void setVgpuProfileId(String vgpuProfileId) { + this.vgpuProfileId = vgpuProfileId; + } + + public String getVgpuProfileName() { + return vgpuProfileName; + } + + public void setVgpuProfileName(String vgpuProfileName) { + this.vgpuProfileName = vgpuProfileName; + } + + public String getVmId() { + return vmId; + } + + public void setVmId(String vmId) { + this.vmId = vmId; + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + public VirtualMachine.State getVmState() { + return vmState; + } + + public void setVmState(VirtualMachine.State vmState) { + this.vmState = vmState; + } + + public GpuDevice.State getState() { + return state; + } + + public void setState(GpuDevice.State state) { + this.state = state; + } + + public GpuDevice.ManagedState getManagedState() { + return managedState; + } + + public void setManagedState(GpuDevice.ManagedState managedState) { + this.managedState = managedState; + } + + public String getParentGpuDeviceId() { + return parentGpuDeviceId; + } + + public void setParentGpuDeviceId(String parentGpuDeviceId) { + this.parentGpuDeviceId = parentGpuDeviceId; + } + + public String getNumaNode() { + return numaNode; + } + + public void setNumaNode(String numaNode) { + this.numaNode = numaNode; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java index b655749126e7..8738c622eaf5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GpuResponse.java @@ -32,7 +32,7 @@ public class GpuResponse extends BaseResponse { private String gpuGroupName; @SerializedName(ApiConstants.VGPU) - @Param(description = "the list of enabled vGPUs", responseObject = VgpuResponse.class) + @Param(description = "The list of enabled vGPUs", responseObject = VgpuResponse.class) private List vgpu; public void setGpuGroupName(String gpuGroupName) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java index 7872bf220852..182e74200070 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java @@ -16,6 +16,8 @@ // under the License. package org.apache.cloudstack.api.response; +import java.util.Date; + import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.ApiConstants; @@ -26,15 +28,27 @@ import com.cloud.storage.GuestOsCategory; @EntityReference(value = GuestOsCategory.class) -public class GuestOSCategoryResponse extends BaseResponse { +public class GuestOSCategoryResponse extends BaseResponse implements SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the OS category") + @Param(description = "The ID of the OS category") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the OS category") + @Param(description = "The name of the OS category") private String name; + @SerializedName(ApiConstants.IS_FEATURED) + @Param(description = "Whether the OS category is featured", since = "4.21.0") + private Boolean featured; + + @SerializedName(ApiConstants.RESOURCE_ICON) + @Param(description = "Base64 string representation of the resource icon", since = "4.21.0") + private ResourceIconResponse resourceIconResponse; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "Date when the OS category was created." ) + private Date created; + public String getId() { return id; } @@ -50,4 +64,17 @@ public String getName() { public void setName(String name) { this.name = name; } + + public void setFeatured(Boolean featured) { + this.featured = featured; + } + + @Override + public void setResourceIconResponse(ResourceIconResponse resourceIconResponse) { + this.resourceIconResponse = resourceIconResponse; + } + + public void setCreated(Date created) { + this.created = created; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java index f870a2f0d942..6f8e7937d0b9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuestOSResponse.java @@ -28,19 +28,19 @@ @EntityReference(value = GuestOS.class) public class GuestOSResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the OS type") + @Param(description = "The ID of the OS type") private String id; @SerializedName(ApiConstants.OS_CATEGORY_ID) - @Param(description = "the ID of the OS category") + @Param(description = "The ID of the OS category") private String osCategoryId; @SerializedName(ApiConstants.OS_CATEGORY_NAME) - @Param(description = "the name of the OS category") + @Param(description = "The name of the OS category") private String osCategoryName; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the OS type") + @Param(description = "The name of the OS type") private String name; /** @@ -48,15 +48,15 @@ public class GuestOSResponse extends BaseResponse { */ @Deprecated(since = "4.19") @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the name/description of the OS type") + @Param(description = "The name/description of the OS type") private String description; @SerializedName(ApiConstants.IS_USER_DEFINED) - @Param(description = "is the guest OS user defined") + @Param(description = "Is the guest OS user defined") private Boolean isUserDefined; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is the guest OS visible for the users") + @Param(description = "Is the guest OS visible for the users") private Boolean forDisplay; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java index 583768d47bef..3681f182e95f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuestOsMappingResponse.java @@ -29,31 +29,31 @@ @EntityReference(value = GuestOSHypervisor.class) public class GuestOsMappingResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the Guest OS mapping") + @Param(description = "The ID of the Guest OS mapping") private String id; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor") + @Param(description = "The hypervisor") private String hypervisor; @SerializedName(ApiConstants.HYPERVISOR_VERSION) - @Param(description = "version of the hypervisor for mapping") + @Param(description = "Version of the hypervisor for mapping") private String hypervisorVersion; @SerializedName(ApiConstants.OS_TYPE_ID) - @Param(description = "the ID of the Guest OS type") + @Param(description = "The ID of the Guest OS type") private String osTypeId; @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "standard display name for the Guest OS") + @Param(description = "Standard display name for the Guest OS") private String osStdName; @SerializedName(ApiConstants.OS_NAME_FOR_HYPERVISOR) - @Param(description = "hypervisor specific name for the Guest OS") + @Param(description = "Hypervisor specific name for the Guest OS") private String osNameForHypervisor; @SerializedName(ApiConstants.IS_USER_DEFINED) - @Param(description = "is the mapping user defined") + @Param(description = "Is the mapping user defined") private String isUserDefined; public String getIsUserDefined() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java index 133338d27ae3..c67b38866989 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanRangeResponse.java @@ -29,19 +29,19 @@ @SuppressWarnings("unused") public class GuestVlanRangeResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the guest VLAN range") + @Param(description = "The ID of the guest VLAN range") private String id; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the guest VLAN range") + @Param(description = "The Account of the guest VLAN range") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the guest VLAN range") + @Param(description = "The domain ID of the guest VLAN range") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the guest VLAN range") + @Param(description = "The domain name of the guest VLAN range") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -49,23 +49,23 @@ public class GuestVlanRangeResponse extends BaseResponse implements ControlledEn private String domainPath; @SerializedName(ApiConstants.GUEST_VLAN_RANGE) - @Param(description = "the guest VLAN range") + @Param(description = "The guest VLAN range") private String guestVlanRange; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the guest vlan range") + @Param(description = "The project id of the guest VLAN range") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the guest vlan range") + @Param(description = "The project name of the guest VLAN range") private String projectName; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network of the guest vlan range") + @Param(description = "The physical Network of the guest VLAN range") private Long physicalNetworkId; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone of the guest vlan range") + @Param(description = "The zone of the guest VLAN range") private Long zoneId; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanResponse.java index 6716911ab82e..28d33e9fe659 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuestVlanResponse.java @@ -30,23 +30,23 @@ public class GuestVlanResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the guest VLAN id") + @Param(description = "The guest VLAN ID") private long id; @SerializedName(ApiConstants.VLAN) - @Param(description = "the guest VLAN") + @Param(description = "The guest VLAN") private String guestVlan; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the guest VLAN range") + @Param(description = "The Account of the guest VLAN range") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the guest VLAN range") + @Param(description = "The domain ID of the guest VLAN range") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the guest VLAN range") + @Param(description = "The domain name of the guest VLAN range") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -54,43 +54,43 @@ public class GuestVlanResponse extends BaseResponse implements ControlledEntityR private String domainPath; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the guest VLAN range") + @Param(description = "The project ID of the guest VLAN range") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the guest VLAN range") + @Param(description = "The project name of the guest VLAN range") private String projectName; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID of the guest VLAN range") + @Param(description = "The zone ID of the guest VLAN range") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the zone name of the guest VLAN range") + @Param(description = "The zone name of the guest VLAN range") private String zoneName; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network ID of the guest VLAN range") + @Param(description = "The physical Network ID of the guest VLAN range") private String physicalNetworkId; @SerializedName(ApiConstants.PHYSICAL_NETWORK_NAME) - @Param(description = "the physical network name of the guest VLAN range") + @Param(description = "The physical Network name of the guest VLAN range") private String physicalNetworkName; @SerializedName(ApiConstants.IS_DEDICATED) - @Param(description = "true if the guest VLAN is dedicated to the account") + @Param(description = "True if the guest VLAN is dedicated to the Account") private Boolean isDedicated; @SerializedName(ApiConstants.ALLOCATION_STATE) - @Param(description = "the allocation state of the guest VLAN") + @Param(description = "The allocation state of the guest VLAN") private String allocationState; @SerializedName(ApiConstants.TAKEN) - @Param(description = "date the guest VLAN was taken") + @Param(description = "Date the guest VLAN was taken") private Date taken; @SerializedName(ApiConstants.NETWORK) - @Param(description = "the list of networks who use this guest VLAN", responseObject = NetworkResponse.class) + @Param(description = "The list of Networks who use this guest VLAN", responseObject = NetworkResponse.class) private List networks; public void setId(long id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/GuiThemeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/GuiThemeResponse.java new file mode 100644 index 000000000000..fe8a85b4176e --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/GuiThemeResponse.java @@ -0,0 +1,179 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you 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 org.apache.cloudstack.api.response; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.gui.theme.GuiThemeJoin; + +import java.util.Date; + +@EntityReference(value = {GuiThemeJoin.class}) +public class GuiThemeResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the custom GUI theme.") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the GUI theme.") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "Description of the GUI theme.") + private String description; + + @SerializedName(ApiConstants.CSS) + @Param(description = "The CSS to be retrieved and imported into the GUI when matching the theme access configurations.") + private String css; + + @SerializedName(ApiConstants.JSON_CONFIGURATION) + @Param(description = "The JSON with the configurations to be retrieved and imported into the GUI when matching the theme access configurations.") + private String jsonConfiguration; + + @SerializedName(ApiConstants.COMMON_NAMES) + @Param(description = "A set of Common Names (CN) (fixed or wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.com") + private String commonNames; + + @SerializedName(ApiConstants.DOMAIN_IDS) + @Param(description = "A set of domain UUIDs (also known as ID for the end-user) separated by comma that can retrieve the theme.") + private String domainIds; + + @SerializedName(ApiConstants.RECURSIVE_DOMAINS) + @Param(description = "Whether to consider the subdomains of the informed domain IDs.") + private Boolean recursiveDomains; + + @SerializedName(ApiConstants.ACCOUNT_IDS) + @Param(description = "A set of account UUIDs (also known as ID for the end-user) separated by comma that can retrieve the theme.") + private String accountIds; + + @SerializedName(ApiConstants.IS_PUBLIC) + @Param(description = "Defines whether a theme can be retrieved by anyone when only the `commonNames` is informed. If the `domainIds` or `accountIds` is informed, it is " + + "considered as `false`.") + private Boolean isPublic; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "When the GUI theme was created.") + private Date created; + + @SerializedName(ApiConstants.REMOVED) + @Param(description = "When the GUI theme was removed.") + private Date removed; + + public GuiThemeResponse() { + super("guiThemes"); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCss() { + return css; + } + + public void setCss(String css) { + this.css = css; + } + + public String getJsonConfiguration() { + return jsonConfiguration; + } + + public void setJsonConfiguration(String jsonConfiguration) { + this.jsonConfiguration = jsonConfiguration; + } + + public String getCommonNames() { + return commonNames; + } + + public void setCommonNames(String commonNames) { + this.commonNames = commonNames; + } + + public String getDomainIds() { + return domainIds; + } + + public void setDomainIds(String domainIds) { + this.domainIds = domainIds; + } + + public String getAccountIds() { + return accountIds; + } + + public void setAccountIds(String accountIds) { + this.accountIds = accountIds; + } + + public Boolean getPublic() { + return isPublic; + } + + public void setPublic(Boolean aPublic) { + isPublic = aPublic; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getRemoved() { + return removed; + } + + public Boolean getRecursiveDomains() { + return recursiveDomains; + } + + public void setRecursiveDomains(Boolean recursiveDomains) { + this.recursiveDomains = recursiveDomains; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java index d75cbc3e1205..c1c761780084 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HAProviderResponse.java @@ -29,11 +29,11 @@ @EntityReference(value = HAConfig.class) public final class HAProviderResponse extends BaseResponse { @SerializedName(ApiConstants.HA_PROVIDER) - @Param(description = "the HA provider") + @Param(description = "The HA provider") private String provider; @SerializedName(ApiConstants.TYPE) - @Param(description = "the HA provider resource type detail") + @Param(description = "The HA provider resource type detail") private List supportedResourceTypes; public HAProviderResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java index b4de48baec46..b3853d9cc245 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HostForMigrationResponse.java @@ -26,7 +26,7 @@ public class HostForMigrationResponse extends HostResponse { @SerializedName("requiresStorageMotion") - @Param(description = "true if migrating a vm to this host requires storage motion, false otherwise") + @Param(description = "True if migrating an Instance to this host requires storage motion, false otherwise") private Boolean requiresStorageMotion; public void setRequiresStorageMotion(Boolean requiresStorageMotion) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java index a8b44bd56496..de2281dba315 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HostHAResponse.java @@ -27,23 +27,23 @@ @EntityReference(value = HAConfig.class) public final class HostHAResponse extends BaseResponse { @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the host") + @Param(description = "The ID of the host") private String id; @SerializedName(ApiConstants.HA_ENABLE) - @Param(description = "if host HA is enabled for the host") + @Param(description = "If host HA is enabled for the host") private Boolean enabled; @SerializedName(ApiConstants.HA_STATE) - @Param(description = "the HA state of the host") + @Param(description = "The HA state of the host") private HAConfig.HAState haState; @SerializedName(ApiConstants.HA_PROVIDER) - @Param(description = "the host HA provider") + @Param(description = "The host HA provider") private String provider; @SerializedName(ApiConstants.STATUS) - @Param(description = "operation status") + @Param(description = "Operation status") private Boolean status; public HostHAResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java index c9a5c47887d1..5d085d1bee05 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java @@ -36,154 +36,161 @@ @EntityReference(value = Host.class) public class HostResponse extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the host") + @Param(description = "The ID of the host") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the host") + @Param(description = "The name of the host") private String name; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the host") + @Param(description = "The state of the host") private Status state; @SerializedName("disconnected") - @Param(description = "true if the host is disconnected. False otherwise.") + @Param(description = "True if the host is disconnected. False otherwise.") private Date disconnectedOn; @SerializedName(ApiConstants.TYPE) - @Param(description = "the host type") + @Param(description = "The host type") private Host.Type hostType; @SerializedName("oscategoryid") - @Param(description = "the OS category ID of the host") + @Param(description = "The OS category ID of the host") private String osCategoryId; @SerializedName("oscategoryname") - @Param(description = "the OS category name of the host") + @Param(description = "The OS category name of the host") private String osCategoryName; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the IP address of the host") + @Param(description = "The IP address of the host") private String ipAddress; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the host") + @Param(description = "The Zone ID of the host") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the host") + @Param(description = "The Zone name of the host") private String zoneName; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod ID of the host") + @Param(description = "The Pod ID of the host") private String podId; @SerializedName("podname") - @Param(description = "the Pod name of the host") + @Param(description = "The Pod name of the host") private String podName; @SerializedName("version") - @Param(description = "the host version") + @Param(description = "The host version") private String version; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the host hypervisor") + @Param(description = "The host hypervisor") private String hypervisor; - @SerializedName("cpusockets") - @Param(description = "the number of CPU sockets on the host") + @Param(description = "The number of CPU sockets on the host") private Integer cpuSockets; @SerializedName("cpunumber") - @Param(description = "the CPU number of the host") + @Param(description = "The CPU number of the host") private Integer cpuNumber; @SerializedName("cpuspeed") - @Param(description = "the CPU speed of the host") + @Param(description = "The CPU speed of the host") private Long cpuSpeed; @Deprecated @SerializedName("cpuallocated") - @Param(description = "the amount of the host's CPU currently allocated") + @Param(description = "The amount of the host's CPU currently allocated") private String cpuAllocated; @SerializedName("cpuallocatedvalue") - @Param(description = "the amount of the host's CPU currently allocated in MHz") + @Param(description = "The amount of the host's CPU currently allocated in MHz") private Long cpuAllocatedValue; @SerializedName("cpuallocatedpercentage") - @Param(description = "the amount of the host's CPU currently allocated in percentage") + @Param(description = "The amount of the host's CPU currently allocated in percentage") private String cpuAllocatedPercentage; @SerializedName("cpuallocatedwithoverprovisioning") - @Param(description = "the amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor") + @Param(description = "The amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor") private String cpuAllocatedWithOverprovisioning; @SerializedName("cpuused") - @Param(description = "the amount of the host's CPU currently used") + @Param(description = "The amount of the host's CPU currently used") private String cpuUsed; @SerializedName("cpuwithoverprovisioning") - @Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor") + @Param(description = "The amount of the host's CPU after applying the cpu.overprovisioning.factor") private String cpuWithOverprovisioning; @SerializedName(ApiConstants.CPU_LOAD_AVERAGE) - @Param(description = "the cpu average load on the host") + @Param(description = "The average CPU load on the host") private Double cpuloadaverage; @SerializedName("networkkbsread") - @Param(description = "the incoming network traffic on the host") + @Param(description = "The incoming Network traffic on the host") private Long networkKbsRead; @SerializedName("networkkbswrite") - @Param(description = "the outgoing network traffic on the host") + @Param(description = "The outgoing Network traffic on the host") private Long networkKbsWrite; @Deprecated @SerializedName("memorytotal") - @Param(description = "the memory total of the host, this parameter is deprecated use memorywithoverprovisioning") + @Param(description = "The memory total of the host, this parameter is deprecated use memorywithoverprovisioning") private Long memoryTotal; @SerializedName("memorywithoverprovisioning") - @Param(description = "the amount of the host's memory after applying the mem.overprovisioning.factor") + @Param(description = "The amount of the host's memory after applying the mem.overprovisioning.factor") private String memWithOverprovisioning; @Deprecated @SerializedName("memoryallocated") - @Param(description = "the amount of the host's memory currently allocated") - private Long memoryAllocated; + @Param(description = "The amount of the host's memory currently allocated") + private long memoryAllocated; @SerializedName("memoryallocatedpercentage") - @Param(description = "the amount of the host's memory currently allocated in percentage") + @Param(description = "The amount of the host's memory currently allocated in percentage") private String memoryAllocatedPercentage; @SerializedName("memoryallocatedbytes") - @Param(description = "the amount of the host's memory currently allocated in bytes") + @Param(description = "The amount of the host's memory currently allocated in bytes") private Long memoryAllocatedBytes; @SerializedName("memoryused") - @Param(description = "the amount of the host's memory currently used") + @Param(description = "The amount of the host's memory currently used") private Long memoryUsed; + @SerializedName("gputotal") + @Param(description = "Total GPUs on the Host", responseObject = Long.class, since = "4.21") + private Long gpuTotal; + + @SerializedName("gpuused") + @Param(description = "Used GPUs on the Host", responseObject = Long.class, since = "4.21") + private Long gpuUsed; + @SerializedName(ApiConstants.GPUGROUP) @Param(description = "GPU cards present in the host", responseObject = GpuResponse.class, since = "4.4") private List gpuGroup; @SerializedName("disksizetotal") - @Param(description = "the total disk size of the host") + @Param(description = "The total disk size of the host") private Long diskSizeTotal; @SerializedName("disksizeallocated") - @Param(description = "the host's currently allocated disk size") + @Param(description = "The host's currently allocated disk size") private Long diskSizeAllocated; @SerializedName("capabilities") - @Param(description = "capabilities of the host") + @Param(description = "Capabilities of the host") private String capabilities; @SerializedName("lastpinged") - @Param(description = "the date and time the host was last pinged") + @Param(description = "The date and time the host was last pinged") private Date lastPinged; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @@ -191,43 +198,45 @@ public class HostResponse extends BaseResponseWithAnnotations { private String virtualMachineId; @SerializedName(ApiConstants.MANAGEMENT_SERVER_ID) - @Param(description = "the management server ID of the host") + @Param(description = "The management server ID of the host") private String managementServerId; @SerializedName(ApiConstants.MANAGEMENT_SERVER_NAME) @Param(description = "the management server name of the host", since = "4.21.0") private String managementServerName; + private transient long clusterInternalId; + @SerializedName("clusterid") - @Param(description = "the cluster ID of the host") + @Param(description = "The cluster ID of the host") private String clusterId; @SerializedName("clustername") - @Param(description = "the cluster name of the host") + @Param(description = "The cluster name of the host") private String clusterName; @SerializedName("clustertype") - @Param(description = "the cluster type of the cluster that host belongs to") + @Param(description = "The cluster type of the cluster that host belongs to") private String clusterType; @SerializedName("islocalstorageactive") - @Param(description = "true if local storage is active, false otherwise") + @Param(description = "True if local storage is active, false otherwise") private Boolean localStorageActive; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date and time the host was created") + @Param(description = "The date and time the host was created") private Date created; @SerializedName("removed") - @Param(description = "the date and time the host was removed") + @Param(description = "The date and time the host was removed") private Date removed; @SerializedName("events") - @Param(description = "events available for the host") + @Param(description = "Events available for the host") private String events; @SerializedName("hosttags") - @Param(description = "comma-separated list of tags for the host") + @Param(description = "Comma-separated list of tags for the host") private String hostTags; @SerializedName("explicithosttags") @@ -243,31 +252,31 @@ public class HostResponse extends BaseResponseWithAnnotations { private Boolean isTagARule; @SerializedName("hasenoughcapacity") - @Param(description = "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise") + @Param(description = "True if this host has enough CPU and RAM capacity to migrate an Instance to it, false otherwise") private Boolean hasEnoughCapacity; @SerializedName("suitableformigration") - @Param(description = "true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise") + @Param(description = "True if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests Instance limit etc) to migrate an Instance to it , false otherwise") private Boolean suitableForMigration; @SerializedName("hostha") - @Param(description = "the host HA information information") + @Param(description = "The host HA information information") private HostHAResponse hostHAResponse; @SerializedName("outofbandmanagement") - @Param(description = "the host out-of-band management information") + @Param(description = "The host out-of-band management information") private OutOfBandManagementResponse outOfBandManagementResponse; @SerializedName("resourcestate") - @Param(description = "the resource state of the host") + @Param(description = "The resource state of the host") private String resourceState; @SerializedName(ApiConstants.HYPERVISOR_VERSION) - @Param(description = "the hypervisor version") + @Param(description = "The hypervisor version") private String hypervisorVersion; @SerializedName(ApiConstants.HA_HOST) - @Param(description = "true if the host is Ha host (dedicated to vms started by HA process; false otherwise") + @Param(description = "True if the host is Ha host (dedicated to Instances started by HA process; false otherwise") private Boolean haHost; @SerializedName(ApiConstants.DETAILS) @@ -275,23 +284,23 @@ public class HostResponse extends BaseResponseWithAnnotations { private Map details; @SerializedName(ApiConstants.ANNOTATION) - @Param(description = "the last annotation set on this host by an admin", since = "4.11") + @Param(description = "The last annotation set on this host by an admin", since = "4.11") private String annotation; @SerializedName(ApiConstants.LAST_ANNOTATED) - @Param(description = "the last time this host was annotated", since = "4.11") + @Param(description = "The last time this host was annotated", since = "4.11") private Date lastAnnotated; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the admin that annotated this host", since = "4.11") + @Param(description = "The admin that annotated this host", since = "4.11") private String username; @SerializedName("ueficapability") - @Param(description = "true if the host has capability to support UEFI boot") + @Param(description = "True if the host has capability to support UEFI boot") private Boolean uefiCapability; @SerializedName(ApiConstants.ENCRYPTION_SUPPORTED) - @Param(description = "true if the host supports encryption", since = "4.18") + @Param(description = "True if the host supports encryption", since = "4.18") private Boolean encryptionSupported; @SerializedName(ApiConstants.INSTANCE_CONVERSION_SUPPORTED) @@ -302,6 +311,30 @@ public class HostResponse extends BaseResponseWithAnnotations { @Param(description = "CPU Arch of the host", since = "4.20") private String arch; + @SerializedName(ApiConstants.STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups for the host", since = "4.21.0") + private String storageAccessGroups; + + @SerializedName(ApiConstants.CLUSTER_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the cluster", since = "4.21.0") + private String clusterStorageAccessGroups; + + @SerializedName(ApiConstants.POD_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the pod", since = "4.21.0") + private String podStorageAccessGroups; + + @SerializedName(ApiConstants.ZONE_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the zone", since = "4.21.0") + private String zoneStorageAccessGroups; + + @SerializedName(ApiConstants.EXTENSION_ID) + @Param(description="The ID of extension for this cluster", since = "4.21.0") + private String extensionId; + + @SerializedName(ApiConstants.EXTENSION_NAME) + @Param(description="The name of extension for this cluster", since = "4.21.0") + private String extensionName; + @Override public String getObjectId() { return this.getId(); @@ -415,7 +448,7 @@ public void setMemWithOverprovisioning(String memWithOverprovisioning){ this.memWithOverprovisioning=memWithOverprovisioning; } - public void setMemoryAllocated(Long memoryAllocated) { + public void setMemoryAllocated(long memoryAllocated) { this.memoryAllocated = memoryAllocated; } @@ -423,6 +456,14 @@ public void setMemoryUsed(Long memoryUsed) { this.memoryUsed = memoryUsed; } + public void setGpuTotal(Long gpuTotal) { + this.gpuTotal = gpuTotal; + } + + public void setGpuUsed(Long gpuUsed) { + this.gpuUsed = gpuUsed; + } + public void setGpuGroup(List gpuGroup) { this.gpuGroup = gpuGroup; } @@ -455,6 +496,14 @@ public void setManagementServerName(String managementServerName) { this.managementServerName = managementServerName; } + public long getClusterInternalId() { + return clusterInternalId; + } + + public void setClusterInternalId(long clusterInternalId) { + this.clusterInternalId = clusterInternalId; + } + public void setClusterId(String clusterId) { this.clusterId = clusterId; } @@ -491,6 +540,38 @@ public void setHostTags(String hostTags) { this.hostTags = hostTags; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + + public String getClusterStorageAccessGroups() { + return clusterStorageAccessGroups; + } + + public void setClusterStorageAccessGroups(String clusterStorageAccessGroups) { + this.clusterStorageAccessGroups = clusterStorageAccessGroups; + } + + public String getPodStorageAccessGroups() { + return podStorageAccessGroups; + } + + public void setPodStorageAccessGroups(String podStorageAccessGroups) { + this.podStorageAccessGroups = podStorageAccessGroups; + } + + public String getZoneStorageAccessGroups() { + return zoneStorageAccessGroups; + } + + public void setZoneStorageAccessGroups(String zoneStorageAccessGroups) { + this.zoneStorageAccessGroups = zoneStorageAccessGroups; + } + public String getExplicitHostTags() { return explicitHostTags; } @@ -703,8 +784,8 @@ public Long getMemoryTotal() { return memoryTotal; } - public Long getMemoryAllocated() { - return memoryAllocated == null ? 0 : memoryAllocated; + public long getMemoryAllocated() { + return memoryAllocated; } public void setMemoryAllocatedPercentage(String memoryAllocatedPercentage) { @@ -855,6 +936,14 @@ public Long getMemoryAllocatedBytes() { return memoryAllocatedBytes; } + public Long getGpuTotal() { + return gpuTotal; + } + + public Long getGpuUsed() { + return gpuUsed; + } + public Boolean getTagARule() { return isTagARule; } @@ -894,4 +983,20 @@ public Boolean getEncryptionSupported() { public Boolean getInstanceConversionSupported() { return instanceConversionSupported; } + + public void setExtensionId(String extensionId) { + this.extensionId = extensionId; + } + + public String getExtensionId() { + return extensionId; + } + + public void setExtensionName(String extensionName) { + this.extensionName = extensionName; + } + + public String getExtensionName() { + return extensionName; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java index f772da6dcb66..fac30cae8c03 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HostTagResponse.java @@ -24,15 +24,15 @@ public class HostTagResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the ID of the host tag") + @Param(description = "The ID of the host tag") private String id; @SerializedName("hostid") - @Param(description = "the host ID of the host tag") + @Param(description = "The host ID of the host tag") private long hostId; @SerializedName("name") - @Param(description = "the name of the host tag") + @Param(description = "The name of the host tag") private String name; @SerializedName(ApiConstants.IS_IMPLICIT) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java index c19397e0c835..a835b2376272 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java @@ -27,39 +27,39 @@ @EntityReference(value = HypervisorCapabilities.class) public class HypervisorCapabilitiesResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the hypervisor capabilities row") + @Param(description = "The hypervisor capability ID") private String id; @SerializedName(ApiConstants.HYPERVISOR_VERSION) - @Param(description = "the hypervisor version") + @Param(description = "The hypervisor version") private String hypervisorVersion; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor type") + @Param(description = "The hypervisor type") private String hypervisor; @SerializedName(ApiConstants.MAX_GUESTS_LIMIT) - @Param(description = "the maximum number of guest vms recommended for this hypervisor") + @Param(description = "The maximum number of guest Instances recommended for this hypervisor") private Long maxGuestsLimit; @SerializedName(ApiConstants.SECURITY_GROUP_EANBLED) - @Param(description = "true if security group is supported") + @Param(description = "True if security group is supported") private boolean isSecurityGroupEnabled; @SerializedName(ApiConstants.MAX_DATA_VOLUMES_LIMIT) - @Param(description = "the maximum number of Data Volumes that can be attached for this hypervisor") + @Param(description = "The maximum number of Data Volumes that can be attached for this hypervisor") private Integer maxDataVolumesLimit; @SerializedName(ApiConstants.MAX_HOSTS_PER_CLUSTER) - @Param(description = "the maximum number of Hosts per cluster for this hypervisor") + @Param(description = "The maximum number of Hosts per cluster for this hypervisor") private Integer maxHostsPerCluster; @SerializedName(ApiConstants.STORAGE_MOTION_ENABLED) - @Param(description = "true if storage motion is supported") + @Param(description = "True if storage motion is supported") private boolean isStorageMotionSupported; @SerializedName(ApiConstants.VM_SNAPSHOT_ENABELD) - @Param(description = "true if VM snapshots are enabled for this hypervisor") + @Param(description = "True if Instance Snapshots are enabled for this hypervisor") private boolean isVmSnapshotEnabled; public HypervisorCapabilitiesResponse(){ diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsNamesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsNamesResponse.java index 52f55bf45693..e6441690083d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsNamesResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsNamesResponse.java @@ -27,19 +27,19 @@ public class HypervisorGuestOsNamesResponse extends BaseResponse { @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor") + @Param(description = "The hypervisor") private String hypervisor; @SerializedName(ApiConstants.HYPERVISOR_VERSION) - @Param(description = "version of the hypervisor for guest os names") + @Param(description = "Version of the hypervisor for guest os names") private String hypervisorVersion; @SerializedName(ApiConstants.GUEST_OS_LIST) - @Param(description = "the guest OS list of the hypervisor", responseObject = HypervisorGuestOsResponse.class) + @Param(description = "The guest OS list of the hypervisor", responseObject = HypervisorGuestOsResponse.class) private List guestOSList; @SerializedName(ApiConstants.GUEST_OS_COUNT) - @Param(description = "the guest OS count of the hypervisor") + @Param(description = "The guest OS count of the hypervisor") private Integer guestOSCount; public String getHypervisor() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsResponse.java index e9ef630e17fc..53da01a98549 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/HypervisorGuestOsResponse.java @@ -26,11 +26,11 @@ public class HypervisorGuestOsResponse extends BaseResponse { @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "standard display name for the Guest OS") + @Param(description = "Standard display name for the Guest OS") private String osStdName; @SerializedName(ApiConstants.OS_NAME_FOR_HYPERVISOR) - @Param(description = "hypervisor specific name for the Guest OS") + @Param(description = "Hypervisor specific name for the Guest OS") private String osNameForHypervisor; public String getOsStdName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java index 0018edc86388..cdc3115c8293 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/IPAddressResponse.java @@ -32,47 +32,47 @@ @SuppressWarnings("unused") public class IPAddressResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "public IP address id") + @Param(description = "Public IP address ID") private String id; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "public IP address") + @Param(description = "Public IP address") private String ipAddress; @SerializedName("allocated") - @Param(description = "date the public IP address was acquired") + @Param(description = "Date the public IP address was acquired") private Date allocated; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the zone the public IP address belongs to") + @Param(description = "The ID of the zone the public IP address belongs to") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the public IP address belongs to") + @Param(description = "The name of the zone the public IP address belongs to") private String zoneName; @SerializedName("issourcenat") - @Param(description = "true if the IP address is a source nat address, false otherwise") + @Param(description = "True if the IP address is a source NAT address, false otherwise") private Boolean sourceNat; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account the public IP address is associated with") + @Param(description = "The Account the public IP address is associated with") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project id of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID the public IP address is associated with") + @Param(description = "The domain ID the public IP address is associated with") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain the public IP address is associated with") + @Param(description = "The domain the public IP address is associated with") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -80,101 +80,105 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co private String domainPath; @SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK) - @Param(description = "the virtual network for the IP address") + @Param(description = "The virtual Network for the IP address") private Boolean forVirtualNetwork; @SerializedName(ApiConstants.VLAN_ID) - @Param(description = "the ID of the VLAN associated with the IP address." + " This parameter is visible to ROOT admins only") + @Param(description = "The ID of the VLAN associated with the IP address." + " This parameter is visible to ROOT admins only") private String vlanId; @SerializedName("vlanname") - @Param(description = "the VLAN associated with the IP address") + @Param(description = "The VLAN associated with the IP address") private String vlanName; @SerializedName("isstaticnat") - @Param(description = "true if this ip is for static nat, false otherwise") + @Param(description = "True if this IP is for static NAT, false otherwise") private Boolean staticNat; @SerializedName(ApiConstants.IS_SYSTEM) - @Param(description = "true if this ip is system ip (was allocated as a part of deployVm or createLbRule)") + @Param(description = "True if this IP is system IP (was allocated as a part of deployVm or createLbRule)") private Boolean isSystem; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "virtual machine id the ip address is assigned to") + @Param(description = "Instance id the IP address is assigned to") private String virtualMachineId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_TYPE) - @Param(description = "virtual machine type the ip address is assigned to", since = "4.19.0") + @Param(description = "Instance type the IP address is assigned to", since = "4.19.0") private String virtualMachineType; @SerializedName("vmipaddress") - @Param(description = "virtual machine (dnat) ip address (not null only for static nat Ip)") + @Param(description = "Instance (DNAT) IP address (not null only for static NAT IP)") private String virtualMachineIp; @SerializedName("virtualmachinename") - @Param(description = "virtual machine name the ip address is assigned to") + @Param(description = "Instance name the IP address is assigned to") private String virtualMachineName; @SerializedName("virtualmachinedisplayname") - @Param(description = "virtual machine display name the ip address is assigned to (not null only for static nat Ip)") + @Param(description = "Instance display name the IP address is assigned to (not null only for static NAT IP)") private String virtualMachineDisplayName; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) - @Param(description = "the ID of the Network associated with the IP address") + @Param(description = "The ID of the Network associated with the IP address") private String associatedNetworkId; @SerializedName(ApiConstants.ASSOCIATED_NETWORK_NAME) - @Param(description = "the name of the Network associated with the IP address") + @Param(description = "The name of the Network associated with the IP address") private String associatedNetworkName; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the ID of the Network where ip belongs to") + @Param(description = "The ID of the Network where IP belongs to") private String networkId; @SerializedName(ApiConstants.STATE) - @Param(description = "State of the ip address. Can be: Allocating, Allocated, Releasing, Reserved and Free") + @Param(description = "State of the IP address. Can be: Allocating, Allocated, Releasing, Reserved and Free") private String state; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.PURPOSE) - @Param(description = "purpose of the IP address. In Acton this value is not null for Ips with isSystem=true, and can have either StaticNat or LB value") + @Param(description = "Purpose of the IP address. In Acton this value is not null for IPs with isSystem=true, and can have either StaticNat or LB value") private String purpose; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "VPC id the ip belongs to") + @Param(description = "VPC ID the IP belongs to") private String vpcId; @SerializedName(ApiConstants.VPC_NAME) - @Param(description = "VPC name the ip belongs to", since = "4.13.2") + @Param(description = "VPC name the IP belongs to", since = "4.13.2") private String vpcName; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with IP address", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.IS_PORTABLE) - @Param(description = "is public IP portable across the zones") + @Param(description = "Is public IP portable across the zones") private Boolean isPortable; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is public ip for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is public IP for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.NETWORK_NAME) - @Param(description="the name of the Network where ip belongs to") + @Param(description = "The name of the Network where IP belongs to") private String networkName; @SerializedName(ApiConstants.HAS_RULES) - @Param(description="whether the ip address has Firewall/PortForwarding/LoadBalancing rules defined") + @Param(description = "Whether the IP address has Firewall/PortForwarding/LoadBalancing rules defined") private boolean hasRules; @SerializedName(ApiConstants.FOR_SYSTEM_VMS) @Param(description="true if range is dedicated for System VMs") private boolean forSystemVms; + @SerializedName(ApiConstants.FOR_PROVIDER) + @Param(description="true if range is dedicated for external network providers", since = "4.21.0") + private boolean forProvider; + public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } @@ -332,4 +336,8 @@ public void setHasRules(final boolean hasRules) { public void setForSystemVms(boolean forSystemVms) { this.forSystemVms = forSystemVms; } + + public void setForProvider(boolean forProvider) { + this.forProvider = forProvider; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java index 8863b632681d..0afef6166f8b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreDetailResponse.java @@ -24,11 +24,11 @@ public class ImageStoreDetailResponse extends BaseResponse { @SerializedName("name") - @Param(description = "detail property name of the image store") + @Param(description = "Detail property name of the image store") private String name; @SerializedName("value") - @Param(description = "detail property value of the image store") + @Param(description = "Detail property value of the image store") private String value; public ImageStoreDetailResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java index ee44b6bc4745..79f7eb295ea2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ImageStoreResponse.java @@ -28,47 +28,47 @@ @EntityReference(value = ImageStore.class) public class ImageStoreResponse extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the image store") + @Param(description = "The ID of the image store") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the image store") + @Param(description = "The Zone ID of the image store") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the image store") + @Param(description = "The Zone name of the image store") private String zoneName; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the image store") + @Param(description = "The name of the image store") private String name; @SerializedName(ApiConstants.URL) - @Param(description = "the url of the image store") + @Param(description = "The URL of the image store") private String url; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the image store") + @Param(description = "The protocol of the image store") private String protocol; @SerializedName("providername") - @Param(description = "the provider name of the image store") + @Param(description = "The provider name of the image store") private String providerName; @SerializedName(ApiConstants.SCOPE) - @Param(description = "the scope of the image store") + @Param(description = "The scope of the image store") private ScopeType scope; @SerializedName(ApiConstants.READ_ONLY) - @Param(description = "defines if store is read-only") + @Param(description = "Defines if store is read-only") private Boolean readonly; @SerializedName("disksizetotal") - @Param(description = "the total disk size of the host") + @Param(description = "The total disk size of the host") private Long diskSizeTotal; @SerializedName("disksizeused") - @Param(description = "the host's currently used disk size") + @Param(description = "The host's currently used disk size") private Long diskSizeUsed; public ImageStoreResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ImageTransferResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImageTransferResponse.java new file mode 100644 index 000000000000..15576e8f1012 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ImageTransferResponse.java @@ -0,0 +1,104 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.api.response; + +import java.util.Date; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.backup.ImageTransfer; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value = ImageTransfer.class) +public class ImageTransferResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of the image transfer") + private String id; + + @SerializedName("backupid") + @Param(description = "the backup ID") + private String backupId; + + @SerializedName("vmid") + @Param(description = "the VM ID") + private String vmId; + + @SerializedName(ApiConstants.VOLUME_ID) + @Param(description = "the disk/volume ID") + private String diskId; + + @SerializedName("devicename") + @Param(description = "the device name (vda, vdb, etc)") + private String deviceName; + + @SerializedName("transferurl") + @Param(description = "the transfer URL") + private String transferUrl; + + @SerializedName("phase") + @Param(description = "the transfer phase") + private String phase; + + @SerializedName("direction") + @Param(description = "the image transfer direction: upload / download") + private String direction; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "the date created") + private Date created; + + public void setId(String id) { + this.id = id; + } + + public void setBackupId(String backupId) { + this.backupId = backupId; + } + + public void setVmId(String vmId) { + this.vmId = vmId; + } + + public void setDiskId(String diskId) { + this.diskId = diskId; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public void setTransferUrl(String transferUrl) { + this.transferUrl = transferUrl; + } + + public void setPhase(String phase) { + this.phase = phase; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public void setCreated(Date created) { + this.created = created; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ImportVMTaskResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ImportVMTaskResponse.java new file mode 100644 index 000000000000..aa85554f5678 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/ImportVMTaskResponse.java @@ -0,0 +1,257 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import java.util.Date; + +public class ImportVMTaskResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of importing task") + private String id; + + @SerializedName(ApiConstants.ZONE_ID) + @Param(description = "the Zone ID") + private String zoneId; + + @SerializedName(ApiConstants.ZONE_NAME) + @Param(description = "the Zone name") + private String zoneName; + + @SerializedName(ApiConstants.ACCOUNT) + @Param(description = "the account name") + private String accountName; + + @SerializedName(ApiConstants.ACCOUNT_ID) + @Param(description = "the ID of account") + private String accountId; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) + @Param(description = "the ID of the imported VM (after task is completed)") + private String virtualMachineId; + + @SerializedName(ApiConstants.DISPLAY_NAME) + @Param(description = "the display name of the importing VM") + private String displayName; + + @SerializedName(ApiConstants.STATE) + @Param(description = "the state of the importing VM task") + private String state; + + @SerializedName(ApiConstants.VCENTER) + @Param(description = "the vcenter name of the importing VM task") + private String vcenter; + + @SerializedName(ApiConstants.DATACENTER_NAME) + @Param(description = "the datacenter name of the importing VM task") + private String datacenterName; + + @SerializedName("sourcevmname") + @Param(description = "the source VM name") + private String sourceVMName; + + @SerializedName("step") + @Param(description = "the current step on the importing VM task") + private String step; + + @SerializedName("stepduration") + @Param(description = "the duration of the current step") + private String stepDuration; + + @SerializedName(ApiConstants.DURATION) + @Param(description = "the total task duration") + private String duration; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "the current step description on the importing VM task") + private String description; + + @SerializedName(ApiConstants.CONVERT_INSTANCE_HOST_ID) + @Param(description = "the ID of the host on which the instance is being converted") + private String convertInstanceHostId; + + @SerializedName("convertinstancehostname") + @Param(description = "the name of the host on which the instance is being converted") + private String convertInstanceHostName; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "the create date of the importing task") + private Date created; + + @SerializedName(ApiConstants.LAST_UPDATED) + @Param(description = "the last updated date of the importing task") + private Date lastUpdated; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getVirtualMachineId() { + return virtualMachineId; + } + + public void setVirtualMachineId(String virtualMachineId) { + this.virtualMachineId = virtualMachineId; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getVcenter() { + return vcenter; + } + + public void setVcenter(String vcenter) { + this.vcenter = vcenter; + } + + public String getDatacenterName() { + return datacenterName; + } + + public void setDatacenterName(String datacenterName) { + this.datacenterName = datacenterName; + } + + public String getSourceVMName() { + return sourceVMName; + } + + public void setSourceVMName(String sourceVMName) { + this.sourceVMName = sourceVMName; + } + + public String getStep() { + return step; + } + + public void setStep(String step) { + this.step = step; + } + + public String getStepDuration() { + return stepDuration; + } + + public void setStepDuration(String stepDuration) { + this.stepDuration = stepDuration; + } + + public String getDuration() { + return duration; + } + + public void setDuration(String duration) { + this.duration = duration; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getConvertInstanceHostId() { + return convertInstanceHostId; + } + + public void setConvertInstanceHostId(String convertInstanceHostId) { + this.convertInstanceHostId = convertInstanceHostId; + } + + public String getConvertInstanceHostName() { + return convertInstanceHostName; + } + + public void setConvertInstanceHostName(String convertInstanceHostName) { + this.convertInstanceHostName = convertInstanceHostName; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Date lastUpdated) { + this.lastUpdated = lastUpdated; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java index 9c7a4fc09a17..f15ccf611965 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/InstanceGroupResponse.java @@ -32,35 +32,35 @@ public class InstanceGroupResponse extends BaseResponseWithAnnotations implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the instance group") + @Param(description = "The ID of the Instance group") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the instance group") + @Param(description = "The name of the Instance group") private String name; @SerializedName(ApiConstants.CREATED) - @Param(description = "time and date the instance group was created") + @Param(description = "Time and date the Instance group was created") private Date created; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the instance group") + @Param(description = "The Account owning the Instance group") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project ID of the instance group") + @Param(description = "The project ID of the Instance group") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the instance group") + @Param(description = "The project name of the Instance group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the instance group") + @Param(description = "The domain ID of the Instance group") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the instance group") + @Param(description = "The domain name of the Instance group") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java index 15b17d88851c..59726e1c3fbf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/InternalLoadBalancerElementResponse.java @@ -29,11 +29,11 @@ @SuppressWarnings("unused") public class InternalLoadBalancerElementResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the internal load balancer element") + @Param(description = "The ID of the internal Load balancer element") private String id; @SerializedName(ApiConstants.NSP_ID) - @Param(description = "the physical network service provider id of the element") + @Param(description = "The physical Network service provider ID of the element") private String nspId; @SerializedName(ApiConstants.ENABLED) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java index e9856c7af1a7..ba3a0ae3edb8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java @@ -25,43 +25,43 @@ public class IpForwardingRuleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the port forwarding rule") + @Param(description = "The ID of the port forwarding rule") private String id; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the port forwarding rule") + @Param(description = "The protocol of the port forwarding rule") private String protocol; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "the VM ID for the port forwarding rule") + @Param(description = "The Instance ID for the port forwarding rule") private String virtualMachineId; @SerializedName("virtualmachinename") - @Param(description = "the VM name for the port forwarding rule") + @Param(description = "The Instance name for the port forwarding rule") private String virtualMachineName; @SerializedName("virtualmachinedisplayname") - @Param(description = "the VM display name for the port forwarding rule") + @Param(description = "The Instance display name for the port forwarding rule") private String virtualMachineDisplayName; @SerializedName(ApiConstants.IP_ADDRESS_ID) - @Param(description = "the public ip address id for the port forwarding rule") + @Param(description = "The public IP address id for the port forwarding rule") private Long publicIpAddressId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the public ip address for the port forwarding rule") + @Param(description = "The public IP address for the port forwarding rule") private String publicIpAddress; @SerializedName(ApiConstants.START_PORT) - @Param(description = "the start port of the rule") + @Param(description = "The start port of the rule") private Integer startPort; @SerializedName(ApiConstants.END_PORT) - @Param(description = "the end port of the rule") + @Param(description = "The end port of the rule") private Integer endPort; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the ip forwarding rule") + @Param(description = "State of the IP forwarding rule") private String state; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/IpRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IpRangeResponse.java index 364c19f2df0b..5c93287ad07a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/IpRangeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/IpRangeResponse.java @@ -26,27 +26,27 @@ public class IpRangeResponse extends BaseResponse { @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway for the range") + @Param(description = "The gateway for the range") private String gateway; @SerializedName(ApiConstants.CIDR) - @Param(description = "the CIDR for the range") + @Param(description = "The CIDR for the range") private String cidr; @SerializedName(ApiConstants.START_IP) - @Param(description = "the starting IP for the range") + @Param(description = "The starting IP for the range") private String startIp; @SerializedName(ApiConstants.END_IP) - @Param(description = "the ending IP for the range") + @Param(description = "The ending IP for the range") private String endIp; @SerializedName(ApiConstants.FOR_SYSTEM_VMS) - @Param(description = "indicates if range is dedicated for CPVM and SSVM") + @Param(description = "Indicates if range is dedicated for CPVM and SSVM") private String forSystemVms; @SerializedName(ApiConstants.VLAN_ID) - @Param(description = "indicates Vlan ID for the range") + @Param(description = "Indicates VLAN ID for the range") private String vlanId; public String getGateway() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/Ipv6RouteResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/Ipv6RouteResponse.java index 4111ed94d5b8..68f05cdd6ce9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/Ipv6RouteResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/Ipv6RouteResponse.java @@ -26,11 +26,11 @@ public class Ipv6RouteResponse extends BaseResponse { @SerializedName(ApiConstants.SUBNET) - @Param(description = "the guest IPv6 cidr for route") + @Param(description = "The guest IPv6 CIDR for route") private String subnet; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the outbound IPv6 gateway") + @Param(description = "The outbound IPv6 gateway") private String gateway; public Ipv6RouteResponse(String subnet, String gateway) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/IsAccountAllowedToCreateOfferingsWithTagsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IsAccountAllowedToCreateOfferingsWithTagsResponse.java index 5c763c2058a7..ed7f3b57a9d1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/IsAccountAllowedToCreateOfferingsWithTagsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/IsAccountAllowedToCreateOfferingsWithTagsResponse.java @@ -23,7 +23,7 @@ public class IsAccountAllowedToCreateOfferingsWithTagsResponse extends BaseResponse { @SerializedName("isallowed") - @Param(description = "is domain admin allowed to create offerings with tags") + @Param(description = "Is domain admin allowed to create offerings with tags") private Boolean isAllowed; diff --git a/api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java index 27f286dfca5d..1b4b90d4dc4b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/IsoVmResponse.java @@ -28,47 +28,47 @@ @SuppressWarnings("unused") public class IsoVmResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the ISO ID") + @Param(description = "The ISO ID") private String id; @SerializedName("name") - @Param(description = "the ISO name") + @Param(description = "The ISO name") private String name; @SerializedName("displaytext") - @Param(description = "the ISO display text") + @Param(description = "The ISO display text") private String displayText; @SerializedName("bootable") - @Param(description = "true if the ISO is bootable, false otherwise") + @Param(description = "True if the ISO is bootable, false otherwise") private Boolean bootable; @SerializedName("isfeatured") - @Param(description = "true if this template is a featured template, false otherwise") + @Param(description = "True if this Template is a featured Template, false otherwise") private Boolean featured; @SerializedName("ostypeid") - @Param(description = "the ID of the OS type for this template.") + @Param(description = "The ID of the OS type for this Template.") private String osTypeId; @SerializedName("ostypename") - @Param(description = "the name of the OS type for this template.") + @Param(description = "The name of the OS type for this Template.") private String osTypeName; @SerializedName("virtualmachineid") - @Param(description = "id of the virtual machine") + @Param(description = "ID of the Instance") private String virtualMachineId; @SerializedName("vmname") - @Param(description = "name of the virtual machine") + @Param(description = "Name of the Instance") private String virtualMachineName; @SerializedName("vmdisplayname") - @Param(description = "display name of the virtual machine") + @Param(description = "Display name of the Instance") private String virtualMachineDisplayName; @SerializedName("vmstate") - @Param(description = "state of the virtual machine") + @Param(description = "State of the Instance") private String virtualMachineState; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/KubernetesUserVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/KubernetesUserVmResponse.java new file mode 100644 index 000000000000..cef5cdae2f45 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/KubernetesUserVmResponse.java @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.network.router.VirtualRouter; +import com.cloud.serializer.Param; +import com.cloud.uservm.UserVm; +import com.cloud.vm.VirtualMachine; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.EntityReference; + +@EntityReference(value = {VirtualMachine.class, UserVm.class, VirtualRouter.class}) +public class KubernetesUserVmResponse extends UserVmResponse { + @SerializedName(ApiConstants.IS_EXTERNAL_NODE) + @Param(description = "If the VM is an externally added node") + private boolean isExternalNode; + + @SerializedName(ApiConstants.IS_ETCD_NODE) + @Param(description = "If the VM is an etcd node") + private boolean isEtcdNode; + + @SerializedName(ApiConstants.KUBERNETES_NODE_VERSION) + @Param(description = "Kubernetes version of the node") + private String nodeVersion; + + + public void setExternalNode(boolean externalNode) { + isExternalNode = externalNode; + } + + public void setEtcdNode(boolean etcdNode) { + isEtcdNode = etcdNode; + } + + public void setNodeVersion(String nodeVersion) { this.nodeVersion = nodeVersion;} +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java index df3a7a0fb7b9..6355b03b18da 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckPolicyResponse.java @@ -26,19 +26,19 @@ public class LBHealthCheckPolicyResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the LB HealthCheck policy ID") + @Param(description = "The LB HealthCheck policy ID") private String id; @SerializedName("pingpath") - @Param(description = "the pingpath of the healthcheck policy") + @Param(description = "The pingpath of the healthcheck policy") private String pingpath; @SerializedName("description") - @Param(description = "the description of the healthcheck policy") + @Param(description = "The description of the healthcheck policy") private String description; @SerializedName("state") - @Param(description = "the state of the policy") + @Param(description = "The state of the policy") private String state; @SerializedName("responsetime") @@ -50,15 +50,15 @@ public class LBHealthCheckPolicyResponse extends BaseResponse { private int healthcheckInterval; @SerializedName("healthcheckthresshold") - @Param(description = "Number of consecutive health check success before declaring an instance healthy") + @Param(description = "Number of consecutive health check success before declaring an Instance healthy") private int healthcheckthresshold; @SerializedName("unhealthcheckthresshold") - @Param(description = "Number of consecutive health check failures before declaring an instance unhealthy.") + @Param(description = "Number of consecutive health check failures before declaring an Instance unhealthy.") private int unhealthcheckthresshold; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java index cbd953d34a30..f796a1c4d6c5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LBHealthCheckResponse.java @@ -30,27 +30,27 @@ @EntityReference(value = HealthCheckPolicy.class) public class LBHealthCheckResponse extends BaseResponse { @SerializedName("lbruleid") - @Param(description = "the LB rule ID") + @Param(description = "The LB rule ID") private String lbRuleId; @SerializedName("account") - @Param(description = "the account of the HealthCheck policy") + @Param(description = "The Account of the HealthCheck policy") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the HealthCheck policy") + @Param(description = "The domain ID of the HealthCheck policy") private String domainId; @SerializedName("domain") - @Param(description = "the domain of the HealthCheck policy") + @Param(description = "The domain of the HealthCheck policy") private String domainName; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the id of the zone the HealthCheck policy belongs to") + @Param(description = "The ID of the zone the HealthCheck policy belongs to") private String zoneId; @SerializedName("healthcheckpolicy") - @Param(description = "the list of healthcheckpolicies", responseObject = LBHealthCheckPolicyResponse.class) + @Param(description = "The list of healthcheckpolicies", responseObject = LBHealthCheckPolicyResponse.class) private List healthCheckPolicies; public void setlbRuleId(String lbRuleId) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java index 82078b483622..db0a908dc72a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java @@ -32,27 +32,27 @@ public class LBStickinessPolicyResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the LB Stickiness policy ID") + @Param(description = "The LB Stickiness policy ID") private String id; @SerializedName("name") - @Param(description = "the name of the Stickiness policy") + @Param(description = "The name of the Stickiness policy") private String name; @SerializedName("methodname") - @Param(description = "the method name of the Stickiness policy") + @Param(description = "The method name of the Stickiness policy") private String methodName; @SerializedName("description") - @Param(description = "the description of the Stickiness policy") + @Param(description = "The description of the Stickiness policy") private String description;; @SerializedName("state") - @Param(description = "the state of the policy") + @Param(description = "The state of the policy") private String state; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; // FIXME : if params with the same name exist more than once then values are concatenated with ":" as delimiter . @@ -60,7 +60,7 @@ public class LBStickinessPolicyResponse extends BaseResponse { // Example: {indirect=null, name=testcookie, nocache=null, domain=www.yahoo.com:www.google.com, postonly=null} // in the above there are two domains with values www.yahoo.com and www.google.com @SerializedName("params") - @Param(description = "the params of the policy") + @Param(description = "The params of the policy") private Map params; public Map getParams() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java index 75c00acfab04..7abcf307cedf 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LBStickinessResponse.java @@ -30,39 +30,39 @@ @EntityReference(value = StickinessPolicy.class) public class LBStickinessResponse extends BaseResponse { @SerializedName("lbruleid") - @Param(description = "the LB rule ID") + @Param(description = "The LB rule ID") private String lbRuleId; @SerializedName("name") - @Param(description = "the name of the Stickiness policy") + @Param(description = "The name of the Stickiness policy") private String name; @SerializedName("description") - @Param(description = "the description of the Stickiness policy") + @Param(description = "The description of the Stickiness policy") private String description;; @SerializedName("account") - @Param(description = "the account of the Stickiness policy") + @Param(description = "The Account of the Stickiness policy") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the Stickiness policy") + @Param(description = "The domain ID of the Stickiness policy") private String domainId; @SerializedName("domain") - @Param(description = "the domain of the Stickiness policy") + @Param(description = "The domain of the Stickiness policy") private String domainName; @SerializedName("state") - @Param(description = "the state of the policy") + @Param(description = "The state of the policy") private String state; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the id of the zone the Stickiness policy belongs to") + @Param(description = "The ID of the zone the Stickiness policy belongs to") private String zoneId; @SerializedName("stickinesspolicy") - @Param(description = "the list of stickinesspolicies", responseObject = LBStickinessPolicyResponse.class) + @Param(description = "The list of stickinesspolicies", responseObject = LBStickinessPolicyResponse.class) private List stickinessPolicies; public void setlbRuleId(String lbRuleId) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java index e520dec09e7a..c57323d439dd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerResponse.java @@ -28,63 +28,63 @@ @SuppressWarnings("unused") public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the load balancer rule ID") + @Param(description = "The Load balancer rule ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the load balancer") + @Param(description = "The name of the Load balancer") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the load balancer") + @Param(description = "The description of the Load balancer") private String description; @SerializedName(ApiConstants.PUBLIC_IP_ID) - @Param(description = "the public ip address id") + @Param(description = "The public IP address ID") private String publicIpId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public ip address") + @Param(description = "The public IP address") private String publicIp; @SerializedName(ApiConstants.PUBLIC_PORT) - @Param(description = "the public port") + @Param(description = "The public port") private String publicPort; @SerializedName(ApiConstants.PRIVATE_PORT) - @Param(description = "the private port") + @Param(description = "The private port") private String privatePort; @SerializedName(ApiConstants.ALGORITHM) - @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)") + @Param(description = "The Load balancer algorithm (source, roundrobin, leastconn)") private String algorithm; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the id of the guest network the lb rule belongs to") + @Param(description = "The ID of the guest Network the LB rule belongs to") private String networkId; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "the CIDR list to allow traffic, all other CIDRs will be blocked. Multiple entries must be separated by a single comma character (,).") + @Param(description = "The CIDR list to allow traffic, all other CIDRs will be blocked. Multiple entries must be separated by a single comma character (,).") private String cidrList; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the load balancer rule") + @Param(description = "The Account of the Load balancer rule") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the load balancer") + @Param(description = "The project ID of the Load balancer") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the load balancer") + @Param(description = "The project name of the Load balancer") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the load balancer rule") + @Param(description = "The domain ID of the Load balancer rule") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain of the load balancer rule") + @Param(description = "The domain of the Load balancer rule") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -92,27 +92,27 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti private String domainPath; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the rule") + @Param(description = "The state of the rule") private String state; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the id of the zone the rule belongs to") + @Param(description = "The ID of the zone the rule belongs to") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the load balancer rule belongs to", since = "4.11") + @Param(description = "The name of the zone the Load balancer rule belongs to", since = "4.11") private String zoneName; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the loadbalanacer rule") + @Param(description = "The protocol of the Load Balancer rule") private String lbProtocol; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with Load balancer", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java index 57c45e643242..497339938bb0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LoadBalancerRuleVmMapResponse.java @@ -34,11 +34,11 @@ public class LoadBalancerRuleVmMapResponse extends BaseResponse { @SerializedName("loadbalancerruleinstance") - @Param(description = "the user vm set for lb rule") + @Param(description = "The user Instance set for LB rule") private UserVmResponse UserVmResponse; @SerializedName("lbvmipaddresses") - @Param(description = "IP addresses of the vm set of lb rule") + @Param(description = "IP addresses of the Instance set of LB rule") private List ipAddr; public void setIpAddr(List ipAddr) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java index 43f92db84cb5..6e3ef4678d28 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java @@ -35,31 +35,31 @@ public class LoginCmdResponse extends AuthenticationCmdResponse { private String domainId; @SerializedName(value = ApiConstants.TIMEOUT) - @Param(description = "the time period before the session has expired") + @Param(description = "The time period before the session has expired") private Integer timeout; @SerializedName(value = ApiConstants.ACCOUNT) - @Param(description = "the account name the user belongs to") + @Param(description = "The Account name the User belongs to") private String account; @SerializedName(value = ApiConstants.FIRSTNAME) - @Param(description = "first name of the user") + @Param(description = "First name of the user") private String firstName; @SerializedName(value = ApiConstants.LASTNAME) - @Param(description = "last name of the user") + @Param(description = "Last name of the user") private String lastName; @SerializedName(value = ApiConstants.TYPE) - @Param(description = "the account type (admin, domain-admin, read-only-admin, user)") + @Param(description = "The Account type (admin, domain-admin, read-only-admin, user)") private String type; @SerializedName(value = ApiConstants.TIMEZONE) - @Param(description = "user time zone") + @Param(description = "User time zone") private String timeZone; @SerializedName(value = ApiConstants.TIMEZONEOFFSET) - @Param(description = "user time zoneoffset") + @Param(description = "User time zoneoffset") private String timeZoneOffset; @SerializedName(value = ApiConstants.REGISTERED) @@ -90,6 +90,10 @@ public class LoginCmdResponse extends AuthenticationCmdResponse { @Param(description = "Management Server ID that the user logged to", since = "4.21.0.0") private String managementServerId; + @SerializedName(value = ApiConstants.PASSWORD_CHANGE_REQUIRED) + @Param(description = "Indicates whether the User is required to change password on next login.", since = "4.23.0") + private Boolean passwordChangeRequired; + public String getUsername() { return username; } @@ -223,4 +227,12 @@ public String getManagementServerId() { public void setManagementServerId(String managementServerId) { this.managementServerId = managementServerId; } + + public Boolean getPasswordChangeRequired() { + return passwordChangeRequired; + } + + public void setPasswordChangeRequired(Boolean passwordChangeRequired) { + this.passwordChangeRequired = passwordChangeRequired; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java index e6cad482fe56..c1f24c63230d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java @@ -31,49 +31,54 @@ @EntityReference(value = ManagementServerHost.class) public class ManagementServerResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the management server") + @Param(description = "The ID of the management server") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the management server") + @Param(description = "The name of the management server") private String name; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the management server") + @Param(description = "The state of the management server") private State state; @SerializedName(ApiConstants.VERSION) - @Param(description = "the version of the management server") + @Param(description = "The version of the management server") private String version; @SerializedName(ApiConstants.JAVA_DISTRIBUTION) - @Param(description = "the java distribution name running the management server process") + @Param(description = "The java distribution name running the management server process") private String javaDistribution; @SerializedName(ApiConstants.JAVA_VERSION) - @Param(description = "the version of the java distribution running the management server process") + @Param(description = "The version of the java distribution running the management server process") private String javaVersion; @SerializedName(ApiConstants.OS_DISTRIBUTION) - @Param(description = "the name of the OS distribution running on the management server") + @Param(description = "The name of the OS distribution running on the management server") private String osDistribution; @SerializedName(ApiConstants.LAST_SERVER_START) - @Param(description = "the last time this Management Server was started") + @Param(description = "The last time this Management Server was started") private Date lastServerStart; @SerializedName(ApiConstants.LAST_SERVER_STOP) - @Param(description = "the last time this Management Server was stopped") + @Param(description = "The last time this Management Server was stopped") private Date lastServerStop; @SerializedName(ApiConstants.LAST_BOOT) - @Param(description = "the last time the host on which this Management Server runs was booted") + @Param(description = "The last time the host on which this Management Server runs was booted") private Date lastBoot; @SerializedName(ApiConstants.KERNEL_VERSION) - @Param(description = "the running OS kernel version for this Management Server") + @Param(description = "The running OS kernel version for this Management Server") private String kernelVersion; + @Deprecated + @SerializedName(ApiConstants.SERVICE_IP) + @Param(description = "The IP Address for this Management Server. This is deprecated, please use 'ipaddress' instead.") + private String serviceIp; + @SerializedName(ApiConstants.IP_ADDRESS) @Param(description = "the IP Address for this Management Server") private String ipAddress; @@ -138,6 +143,10 @@ public Date getLastBoot() { return lastBoot; } + public String getServiceIp() { + return serviceIp; + } + public String getIpAddress() { return ipAddress; } @@ -202,6 +211,10 @@ public void setKernelVersion(String kernelVersion) { this.kernelVersion = kernelVersion; } + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } + public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/MigrationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/MigrationResponse.java index c67b1d2d13ee..62934151b38b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/MigrationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/MigrationResponse.java @@ -35,7 +35,7 @@ public class MigrationResponse extends BaseResponse { private String migrationType; @SerializedName("success") - @Param(description = "true if operation is executed successfully") + @Param(description = "True if operation is executed successfully") private boolean success; MigrationResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java index f63cbbf4cb51..7af7ea2610b6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLItemResponse.java @@ -30,51 +30,51 @@ @EntityReference(value = NetworkACLItem.class) public class NetworkACLItemResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the ACL Item") + @Param(description = "The ID of the ACL Item") private String id; @SerializedName(ApiConstants.PROTOCOL) - @Param(description = "the protocol of the ACL") + @Param(description = "The protocol of the ACL") private String protocol; @SerializedName(ApiConstants.START_PORT) - @Param(description = "the starting port of ACL's port range") + @Param(description = "The starting port of ACL's port range") private String startPort; @SerializedName(ApiConstants.END_PORT) - @Param(description = "the ending port of ACL's port range") + @Param(description = "The ending port of ACL's port range") private String endPort; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the traffic type for the ACL") + @Param(description = "The traffic type for the ACL") private String trafficType; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the rule") + @Param(description = "The state of the rule") private String state; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "the cidr list to forward traffic from. Multiple entries are separated by a single comma character (,).") + @Param(description = "The CIDR list to forward traffic from. Multiple entries are separated by a single comma character (,).") private String cidrList; @SerializedName(ApiConstants.ICMP_TYPE) - @Param(description = "type of the icmp message being sent") + @Param(description = "Type of the icmp message being sent") private Integer icmpType; @SerializedName(ApiConstants.ICMP_CODE) - @Param(description = "error code for this icmp message") + @Param(description = "Error code for this icmp message") private Integer icmpCode; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the network ACLs", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the Network ACLs", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.ACL_ID) - @Param(description = "the ID of the ACL this item belongs to") + @Param(description = "The ID of the ACL this item belongs to") private String aclId; @SerializedName(ApiConstants.ACL_NAME) - @Param(description = "the name of the ACL this item belongs to") + @Param(description = "The name of the ACL this item belongs to") private String aclName; @SerializedName(ApiConstants.NUMBER) @@ -86,11 +86,11 @@ public class NetworkACLItemResponse extends BaseResponse { private String action; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is rule for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.ACL_REASON) - @Param(description = "an explanation on why this ACL rule is being applied", since = "4.12") + @Param(description = "An explanation on why this ACL rule is being applied", since = "4.12") private String reason; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java index 72ee80a2b0a0..7c120c59c810 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkACLResponse.java @@ -28,11 +28,11 @@ @EntityReference(value = NetworkACL.class) public class NetworkACLResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the ACL") + @Param(description = "The ID of the ACL") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the Name of the ACL") + @Param(description = "The Name of the ACL") private String name; @SerializedName(ApiConstants.DESCRIPTION) @@ -48,7 +48,7 @@ public class NetworkACLResponse extends BaseResponse { private String vpcName; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is ACL for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is ACL for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java index a991c7ae2b05..0d6f7be45575 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkDeviceResponse.java @@ -25,7 +25,7 @@ public class NetworkDeviceResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the network device") + @Param(description = "The ID of the Network device") private String id; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java index 81a8129ecb76..87f960590283 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkOfferingResponse.java @@ -32,71 +32,71 @@ @SuppressWarnings("unused") public class NetworkOfferingResponse extends BaseResponseWithAnnotations { @SerializedName("id") - @Param(description = "the id of the network offering") + @Param(description = "The ID of the Network offering") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the network offering") + @Param(description = "The name of the Network offering") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "an alternate display text of the network offering.") + @Param(description = "An alternate display text of the Network offering.") private String displayText; @SerializedName(ApiConstants.TAGS) - @Param(description = "the tags for the network offering") + @Param(description = "The tags for the Network offering") private String tags; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this network offering was created") + @Param(description = "The date this Network offering was created") private Date created; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.") + @Param(description = "The traffic type for the Network offering, supported types are Public, Management, Control, Guest, VLAN or Storage.") private String trafficType; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if network offering is default, false otherwise") + @Param(description = "True if Network offering is default, false otherwise") private Boolean isDefault; @SerializedName(ApiConstants.SPECIFY_VLAN) - @Param(description = "true if network offering supports vlans, false otherwise") + @Param(description = "True if Network offering supports VLANs, false otherwise") private Boolean specifyVlan; @SerializedName(ApiConstants.CONSERVE_MODE) - @Param(description = "true if network offering is ip conserve mode enabled") + @Param(description = "True if Network offering is IP conserve mode enabled") private Boolean conserveMode; @SerializedName(ApiConstants.SPECIFY_IP_RANGES) - @Param(description = "true if network offering supports specifying ip ranges, false otherwise") + @Param(description = "True if Network offering supports specifying IP ranges, false otherwise") private Boolean specifyIpRanges; @SerializedName(ApiConstants.AVAILABILITY) - @Param(description = "availability of the network offering") + @Param(description = "Availability of the Network offering") private String availability; @SerializedName(ApiConstants.NETWORKRATE) - @Param(description = "data transfer rate in megabits per second allowed.") + @Param(description = "Data transfer rate in megabits per second allowed.") private Integer networkRate; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the network offering. Can be Disabled/Enabled/Inactive") + @Param(description = "State of the Network offering. Can be Disabled/Enabled/Inactive") private String state; @SerializedName(ApiConstants.GUEST_IP_TYPE) - @Param(description = "guest type of the network offering, can be Shared or Isolated") + @Param(description = "Guest type of the Network offering, can be Shared or Isolated") private String guestIpType; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) - @Param(description = "the ID of the service offering used by virtual router provider") + @Param(description = "The ID of the service offering used by virtual router provider") private String serviceOfferingId; @SerializedName(ApiConstants.SERVICE) - @Param(description = "the list of supported services", responseObject = ServiceResponse.class) + @Param(description = "The list of supported services", responseObject = ServiceResponse.class) private List services; @SerializedName(ApiConstants.FOR_VPC) - @Param(description = "true if network offering can be used by VPC networks only") + @Param(description = "True if Network offering can be used by VPC Networks only") private Boolean forVpc; @SerializedName(ApiConstants.FOR_NSX) @@ -104,7 +104,7 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations { private Boolean forNsx; @SerializedName(ApiConstants.FOR_TUNGSTEN) - @Param(description = "true if network offering can be used by Tungsten-Fabric networks only") + @Param(description = "True if Network offering can be used by Tungsten-Fabric Networks only") private Boolean forTungsten; @SerializedName(ApiConstants.NETWORK_MODE) @@ -112,27 +112,27 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations { private String networkMode; @SerializedName(ApiConstants.IS_PERSISTENT) - @Param(description = "true if network offering supports persistent networks, false otherwise") + @Param(description = "True if Network offering supports persistent networks, false otherwise") private Boolean isPersistent; @SerializedName(ApiConstants.DETAILS) - @Param(description = "additional key/value details tied with network offering", since = "4.2.0") + @Param(description = "Additional key/value details tied with network offering", since = "4.2.0") private Map details; @SerializedName(ApiConstants.EGRESS_DEFAULT_POLICY) - @Param(description = "true if guest network default egress policy is allow; false if default egress policy is deny") + @Param(description = "True if guest network default egress policy is allow; false if default egress policy is deny") private Boolean egressDefaultPolicy; @SerializedName(ApiConstants.MAX_CONNECTIONS) - @Param(description = "maximum number of concurrents connections to be handled by lb") + @Param(description = "Maximum number of concurrent connections to be handled by LB") private Integer concurrentConnections; @SerializedName(ApiConstants.SUPPORTS_STRECHED_L2_SUBNET) - @Param(description = "true if network offering supports network that span multiple zones", since = "4.4") + @Param(description = "True if network offering supports network that span multiple zones", since = "4.4") private Boolean supportsStrechedL2Subnet; @SerializedName(ApiConstants.SUPPORTS_PUBLIC_ACCESS) - @Param(description = "true if network offering supports public access for guest networks", since = "4.10.0") + @Param(description = "True if network offering supports public access for guest networks", since = "4.10.0") private Boolean supportsPublicAccess; @SerializedName(ApiConstants.SUPPORTS_INTERNAL_LB) @@ -140,23 +140,23 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations { private Boolean supportsInternalLb; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domain; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zoneId; @SerializedName(ApiConstants.ZONE) - @Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zone; @SerializedName(ApiConstants.INTERNET_PROTOCOL) - @Param(description = "the internet protocol of the network offering") + @Param(description = "The internet protocol of the network offering") private String internetProtocol; @SerializedName(ApiConstants.SPECIFY_AS_NUMBER) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkPermissionsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkPermissionsResponse.java index fcecd14e2820..27be4a51514d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkPermissionsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkPermissionsResponse.java @@ -29,31 +29,31 @@ @SuppressWarnings("unused") public class NetworkPermissionsResponse extends BaseResponse { @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the network ID") + @Param(description = "The Network ID") private String networkId; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain to which the network belongs") + @Param(description = "The ID of the domain to which the Network belongs") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the name of the domain to which the network belongs") + @Param(description = "The name of the domain to which the Network belongs") private String domainName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account the network is available for") + @Param(description = "The Account the Network is available for") private String accountName; @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "the ID of account the network is available for") + @Param(description = "The ID of Account the Network is available for") private String accountId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project the network is available for") + @Param(description = "The project the Network is available for") private String projectName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the ID of project the network is available for") + @Param(description = "The ID of project the Network is available for") private String projectId; diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java index db811ffbe2d3..3a3663af2551 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java @@ -28,112 +28,111 @@ import org.apache.cloudstack.api.EntityReference; import com.cloud.network.Network; -import com.cloud.projects.ProjectAccount; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") -@EntityReference(value = {Network.class, ProjectAccount.class}) +@EntityReference(value = {Network.class}) public class NetworkResponse extends BaseResponseWithAssociatedNetwork implements ControlledEntityResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the network") + @Param(description = "The ID of the Network") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the network") + @Param(description = "The name of the Network") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "the displaytext of the network") + @Param(description = "The displaytext of the Network") private String displaytext; @SerializedName("broadcastdomaintype") - @Param(description = "Broadcast domain type of the network") + @Param(description = "Broadcast domain type of the Network") private String broadcastDomainType; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the traffic type of the network") + @Param(description = "The traffic type of the Network") private String trafficType; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the network's gateway") + @Param(description = "The Network's gateway") private String gateway; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the network's netmask") + @Param(description = "The Network's netmask") private String netmask; @SerializedName(ApiConstants.CIDR) - @Param(description = "Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR") + @Param(description = "CloudStack managed address space, all CloudStack managed Instances get IP address from CIDR") private String cidr; @SerializedName(ApiConstants.NETWORK_CIDR) - @Param(description = "the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE") + @Param(description = "The Network CIDR of the guest Network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE") private String networkCidr; @SerializedName(ApiConstants.RESERVED_IP_RANGE) - @Param(description = "the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes") + @Param(description = "The Network's IP range not to be used by CloudStack guest Instances and can be used for non CloudStack purposes") private String reservedIpRange; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of the network") + @Param(description = "Zone ID of the Network") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the network belongs to") + @Param(description = "The name of the zone the Network belongs to") private String zoneName; @SerializedName("networkofferingid") - @Param(description = "network offering id the network is created from") + @Param(description = "Network offering ID the Network is created from") private String networkOfferingId; @SerializedName("networkofferingname") - @Param(description = "name of the network offering the network is created from") + @Param(description = "Name of the Network offering the Network is created from") private String networkOfferingName; @SerializedName("networkofferingdisplaytext") - @Param(description = "display text of the network offering the network is created from") + @Param(description = "Display text of the Network offering the Network is created from") private String networkOfferingDisplayText; @SerializedName("networkofferingconservemode") - @Param(description = "true if network offering is ip conserve mode enabled") + @Param(description = "True if Network offering is IP conserve mode enabled") private Boolean networkOfferingConserveMode; @SerializedName("networkofferingavailability") - @Param(description = "availability of the network offering the network is created from") + @Param(description = "Availability of the Network offering the Network is created from") private String networkOfferingAvailability; @SerializedName(ApiConstants.IS_SYSTEM) - @Param(description = "true if network is system, false otherwise") + @Param(description = "True if Network is system, false otherwise") private Boolean isSystem; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the network") + @Param(description = "State of the Network") private String state; @SerializedName("related") - @Param(description = "related to what other network configuration") + @Param(description = "Related to what other Network configuration") private String related; @SerializedName("broadcasturi") - @Param(description = "broadcast uri of the network. This parameter is visible to ROOT admins only") + @Param(description = "Broadcast URI of the Network. This parameter is visible to ROOT admins only") private String broadcastUri; @SerializedName(ApiConstants.DNS1) - @Param(description = "the first IPv4 DNS for the network") + @Param(description = "The first IPv4 DNS for the Network") private String dns1; @SerializedName(ApiConstants.DNS2) - @Param(description = "the second IPv4 DNS for the network") + @Param(description = "The second IPv4 DNS for the Network") private String dns2; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the network") + @Param(description = "The type of the Network") private String type; @SerializedName(ApiConstants.VLAN) - @Param(description = "The vlan of the network. This parameter is visible to ROOT admins only") + @Param(description = "The VLAN of the Network. This parameter is visible to ROOT admins only") private String vlan; @SerializedName(ApiConstants.AS_NUMBER_ID) @@ -145,139 +144,131 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement private Long asNumber; @SerializedName(ApiConstants.ACL_TYPE) - @Param(description = "acl type - access type to the network") + @Param(description = "ACL type - access type to the Network") private String aclType; @SerializedName(ApiConstants.SUBDOMAIN_ACCESS) - @Param(description = "true if users from subdomains can access the domain level network") + @Param(description = "True if users from subdomains can access the domain level Network") private Boolean subdomainAccess; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner of the network") + @Param(description = "The owner of the Network") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project ID of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the network owner") + @Param(description = "The domain ID of the Network owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the network owner") + @Param(description = "The domain name of the Network owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain the network belongs to", since = "4.19.0.0") + @Param(description = "Path of the Domain the network belongs to", since = "4.19.0.0") private String domainPath; @SerializedName("isdefault") - @Param(description = "true if network is default, false otherwise") + @Param(description = "True if Network is default, false otherwise") private Boolean isDefault; @SerializedName("service") - @Param(description = "the list of services", responseObject = ServiceResponse.class) + @Param(description = "The list of services", responseObject = ServiceResponse.class) private List services; @SerializedName(ApiConstants.NETWORK_DOMAIN) - @Param(description = "the network domain") + @Param(description = "The Network domain") private String networkDomain; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network id") + @Param(description = "The physical Network id") private String physicalNetworkId; @SerializedName(ApiConstants.RESTART_REQUIRED) - @Param(description = "true network requires restart") + @Param(description = "True if Network requires restart") private Boolean restartRequired; @SerializedName(ApiConstants.SPECIFY_VLAN) - @Param(description = "true if network supports specifying vlan, false otherwise") + @Param(description = "True if network supports specifying vlan, false otherwise") private Boolean specifyVlan; @SerializedName(ApiConstants.SPECIFY_IP_RANGES) - @Param(description = "true if network supports specifying ip ranges, false otherwise") + @Param(description = "True if Network supports specifying IP ranges, false otherwise") private Boolean specifyIpRanges; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "VPC the network belongs to") + @Param(description = "VPC the Network belongs to") private String vpcId; @SerializedName(ApiConstants.VPC_NAME) - @Param(description = "Name of the VPC to which this network belongs", since = "4.15") + @Param(description = "Name of the VPC to which this Network belongs", since = "4.15") private String vpcName; - @SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID) - @Param(description = "the ID of the Network associated with this network") - private String associatedNetworkId; - - @SerializedName(ApiConstants.ASSOCIATED_NETWORK) - @Param(description = "the name of the Network associated with this network") - private String associatedNetworkName; - @SerializedName(ApiConstants.TUNGSTEN_VIRTUAL_ROUTER_UUID) - @Param(description = "Tungsten-Fabric virtual router the network belongs to") + @Param(description = "Tungsten-Fabric virtual router the Network belongs to") private String tungstenVirtualRouterUuid; @SerializedName(ApiConstants.CAN_USE_FOR_DEPLOY) - @Param(description = "list networks available for vm deployment") + @Param(description = "List Networks available for Instance deployment") private Boolean canUseForDeploy; @SerializedName(ApiConstants.IS_PERSISTENT) - @Param(description = "list networks that are persistent") + @Param(description = "List Networks that are persistent") private Boolean isPersistent; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with network", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with Network", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.DETAILS) - @Param(description = "the details of the network") + @Param(description = "The details of the Network") private Map details; @SerializedName(ApiConstants.IP6_GATEWAY) - @Param(description = "the gateway of IPv6 network") + @Param(description = "The gateway of IPv6 Network") private String ip6Gateway; @SerializedName(ApiConstants.IP6_CIDR) - @Param(description = "the cidr of IPv6 network") + @Param(description = "The CIDR of IPv6 Network") private String ip6Cidr; @SerializedName(ApiConstants.DISPLAY_NETWORK) - @Param(description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin}) + @Param(description = "An optional field, whether to the display the Network to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayNetwork; @SerializedName(ApiConstants.ACL_ID) - @Param(description = "ACL Id associated with the VPC network") + @Param(description = "ACL ID associated with the VPC Network") private String aclId; @SerializedName(ApiConstants.ACL_NAME) - @Param(description = "ACL name associated with the VPC network") + @Param(description = "ACL name associated with the VPC Network") private String aclName; @SerializedName(ApiConstants.STRECHED_L2_SUBNET) - @Param(description = "true if network can span multiple zones", since = "4.4") + @Param(description = "True if Network can span multiple zones", since = "4.4") private Boolean strechedL2Subnet; @SerializedName(ApiConstants.NETWORK_SPANNED_ZONES) - @Param(description = "If a network is enabled for 'streched l2 subnet' then represents zones on which network currently spans", since = "4.4") + @Param(description = "If a Network is enabled for 'stretched L2 subnet' then represents zones on which Network currently spans", since = "4.4") private Set networkSpannedZones; @SerializedName(ApiConstants.EXTERNAL_ID) - @Param(description = "The external id of the network", since = "4.11") + @Param(description = "The external ID of the Network", since = "4.11") private String externalId; @SerializedName(ApiConstants.REDUNDANT_ROUTER) - @Param(description = "If the network has redundant routers enabled", since = "4.11.1") + @Param(description = "If the Network has redundant routers enabled", since = "4.11.1") private Boolean redundantRouter; @SerializedName(ApiConstants.SUPPORTS_VM_AUTOSCALING) - @Param(description = "if network offering supports vm autoscaling feature", since = "4.18.0") + @Param(description = "If Network offering supports Instance autoscaling feature", since = "4.18.0") private Boolean supportsVmAutoScaling; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -285,35 +276,35 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement ResourceIconResponse icon; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this network was created", since = "4.16.0") + @Param(description = "The date this Network was created", since = "4.16.0") private Date created; @SerializedName(ApiConstants.RECEIVED_BYTES) - @Param(description = "the total number of network traffic bytes received") + @Param(description = "The total number of Network traffic bytes received") private Long bytesReceived; @SerializedName(ApiConstants.SENT_BYTES) - @Param(description = "the total number of network traffic bytes sent") + @Param(description = "The total number of Network traffic bytes sent") private Long bytesSent; @SerializedName((ApiConstants.EGRESS_DEFAULT_POLICY)) - @Param(description = "true if guest network default egress policy is allow; false if default egress policy is deny") + @Param(description = "True if guest Network default egress policy is allow; false if default egress policy is deny") private Boolean egressDefaultPolicy; @SerializedName(ApiConstants.INTERNET_PROTOCOL) - @Param(description = "The internet protocol of network offering") + @Param(description = "The internet protocol of Network offering") private String internetProtocol; @SerializedName(ApiConstants.IPV6_ROUTING) - @Param(description = "The Ipv6 routing type of network offering", since = "4.17.0") + @Param(description = "The IPv6 routing type of network offering", since = "4.17.0") private String ipv6Routing; @SerializedName(ApiConstants.IPV6_ROUTES) - @Param(description = "The routes for the network to ease adding route in upstream router", since = "4.17.0") + @Param(description = "The routes for the Network to ease adding route in upstream router", since = "4.17.0") private Set ipv6Routes; @SerializedName(ApiConstants.PUBLIC_MTU) - @Param(description = "MTU configured on the network VR's public facing interfaces") + @Param(description = "MTU configured on the Network VR's public facing interfaces") private Integer publicMtu; @SerializedName(ApiConstants.PRIVATE_MTU) @@ -321,11 +312,11 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement private Integer privateMtu; @SerializedName(ApiConstants.IP6_DNS1) - @Param(description = "the first IPv6 DNS for the network", since = "4.18.0") + @Param(description = "The first IPv6 DNS for the network", since = "4.18.0") private String ipv6Dns1; @SerializedName(ApiConstants.IP6_DNS2) - @Param(description = "the second IPv6 DNS for the network", since = "4.18.0") + @Param(description = "The second IPv6 DNS for the network", since = "4.18.0") private String ipv6Dns2; @SerializedName(ApiConstants.IPV4_ROUTING) @@ -340,6 +331,10 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement @Param(description = "The BGP peers for the network", since = "4.20.0") private Set bgpPeers; + @SerializedName(ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC) + @Param(description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, since = "4.23.0") + private Boolean keepMacAddressOnPublicNic; + public NetworkResponse() {} public Boolean getDisplayNetwork() { @@ -620,14 +615,6 @@ public void setVpcName(String vpcName) { this.vpcName = vpcName; } - public void setAssociatedNetworkId(String associatedNetworkId) { - this.associatedNetworkId = associatedNetworkId; - } - - public void setAssociatedNetworkName(String associatedNetworkName) { - this.associatedNetworkName = associatedNetworkName; - } - @Override public void setResourceIconResponse(ResourceIconResponse icon) { this.icon = icon; @@ -719,4 +706,8 @@ public void setIpv6Dns1(String ipv6Dns1) { public void setIpv6Dns2(String ipv6Dns2) { this.ipv6Dns2 = ipv6Dns2; } + + public void setKeepMacAddressOnPublicNic(Boolean keepMacAddressOnPublicNic) { + this.keepMacAddressOnPublicNic = keepMacAddressOnPublicNic; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java index 4af89a37d8dd..7d0007373681 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NicExtraDhcpOptionResponse.java @@ -28,23 +28,23 @@ public class NicExtraDhcpOptionResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the extra dhcp option") + @Param(description = "The ID of the extra DHCP option") private String id; @SerializedName(ApiConstants.NIC_ID) - @Param(description = "the ID of the nic") + @Param(description = "The ID of the NIC") private String nicId; @SerializedName(ApiConstants.EXTRA_DHCP_OPTION_NAME) - @Param(description = "the name of the extra DHCP option") + @Param(description = "The name of the extra DHCP option") private String codeName; @SerializedName(ApiConstants.EXTRA_DHCP_OPTION_CODE) - @Param(description = "the extra DHCP option code") + @Param(description = "The extra DHCP option code") private int code; @SerializedName(ApiConstants.EXTRA_DHCP_OPTION_VALUE) - @Param(description = "the extra DHCP option value") + @Param(description = "The extra DHCP option value") private String value; public NicExtraDhcpOptionResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java index 65e126de545f..92f25e370fb4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NicResponse.java @@ -31,79 +31,79 @@ public class NicResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the nic") + @Param(description = "The ID of the NIC") private String id; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the ID of the corresponding network") + @Param(description = "The ID of the corresponding Network") private String networkId; @SerializedName(ApiConstants.NETWORK_NAME) - @Param(description = "the name of the corresponding network") + @Param(description = "The name of the corresponding Network") private String networkName; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the netmask of the nic") + @Param(description = "The netmask of the NIC") private String netmask; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway of the nic") + @Param(description = "The gateway of the NIC") private String gateway; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the ip address of the nic") + @Param(description = "The IP address of the NIC") private String ipaddress; @SerializedName(ApiConstants.ISOLATION_URI) - @Param(description = "the isolation uri of the nic") + @Param(description = "The isolation URI of the NIC") private String isolationUri; @SerializedName(ApiConstants.BROADCAST_URI) - @Param(description = "the broadcast uri of the nic") + @Param(description = "The broadcast URI of the NIC") private String broadcastUri; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the traffic type of the nic") + @Param(description = "The traffic type of the NIC") private String trafficType; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the nic") + @Param(description = "The type of the NIC") private String type; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if nic is default, false otherwise") + @Param(description = "True if NIC is default, false otherwise") private Boolean isDefault; @SerializedName(ApiConstants.MAC_ADDRESS) - @Param(description = "true if nic is default, false otherwise") + @Param(description = "True if NIC is default, false otherwise") private String macAddress; @SerializedName(ApiConstants.IP6_GATEWAY) - @Param(description = "the gateway of IPv6 network") + @Param(description = "The gateway of IPv6 Network") private String ip6Gateway; @SerializedName(ApiConstants.IP6_CIDR) - @Param(description = "the cidr of IPv6 network") + @Param(description = "The CIDR of IPv6 Network") private String ip6Cidr; @SerializedName(ApiConstants.IP6_ADDRESS) - @Param(description = "the IPv6 address of network") + @Param(description = "The IPv6 address of Network") private String ip6Address; @SerializedName(ApiConstants.SECONDARY_IP) - @Param(description = "the Secondary ipv4 addr of nic") + @Param(description = "The Secondary IPv4 addr of NIC") private List secondaryIps; @SerializedName(ApiConstants.EXTRA_DHCP_OPTION) - @Param(description = "the extra dhcp options on the nic", since = "4.11.0") + @Param(description = "The extra DHCP options on the NIC", since = "4.11.0") private List extraDhcpOptions; @SerializedName(ApiConstants.DEVICE_ID) - @Param(description = "device id for the network when plugged into the virtual machine", since = "4.4") + @Param(description = "Device ID for the Network when plugged into the Instance", since = "4.4") private String deviceId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "Id of the vm to which the nic belongs") + @Param(description = "Id of the Instance to which the NIC belongs") private String vmId; @SerializedName(ApiConstants.NSX_LOGICAL_SWITCH) @@ -119,11 +119,11 @@ public class NicResponse extends BaseResponse { private Integer vlanId; @SerializedName(ApiConstants.ISOLATED_PVLAN) - @Param(description = "the isolated private VLAN if available", since="4.14.0") + @Param(description = "The isolated private VLAN if available", since="4.14.0") private Integer isolatedPvlanId; @SerializedName(ApiConstants.ISOLATED_PVLAN_TYPE) - @Param(description = "the isolated private VLAN type if available", since="4.14.0") + @Param(description = "The isolated private VLAN type if available", since="4.14.0") private String isolatedPvlanType; @SerializedName(ApiConstants.ADAPTER_TYPE) @@ -131,7 +131,7 @@ public class NicResponse extends BaseResponse { private String adapterType; @SerializedName(ApiConstants.IP_ADDRESSES) - @Param(description = "IP addresses associated with NIC found for unmanaged VM", since="4.14.0") + @Param(description = "IP addresses associated with NIC found for unmanaged Instance", since="4.14.0") private List ipAddresses; @SerializedName(ApiConstants.MTU) @@ -139,13 +139,17 @@ public class NicResponse extends BaseResponse { private Integer mtu; @SerializedName(ApiConstants.PUBLIC_IP_ID) - @Param(description = "public IP address id associated with this nic via Static nat rule") + @Param(description = "Public IP address ID associated with this NIC via Static NAT rule") private String publicIpId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "public IP address associated with this nic via Static nat rule") + @Param(description = "Public IP address associated with this NIC via Static NAT rule") private String publicIp; + @SerializedName(ApiConstants.ENABLED) + @Param(description = "whether the NIC is enabled or not") + private Boolean isEnabled; + public void setVmId(String vmId) { this.vmId = vmId; } @@ -223,11 +227,11 @@ public void setExtraDhcpOptions(List extraDhcpOption } @SerializedName(ApiConstants.VPC_ID) - @Param(description = "Id of the vpc to which the nic belongs") + @Param(description = "ID of the VPC to which the NIC belongs") private String vpcId; @SerializedName(ApiConstants.VPC_NAME) - @Param(description = "name of the vpc to which the nic belongs") + @Param(description = "Name of the VPC to which the NIC belongs") private String vpcName; @Override @@ -416,4 +420,12 @@ public void setPublicIpId(String publicIpId) { public void setPublicIp(String publicIp) { this.publicIp = publicIp; } + + public Boolean getEnabled() { + return isEnabled; + } + + public void setEnabled(Boolean enabled) { + isEnabled = enabled; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java index 467a1c9e987a..eba00da25cfe 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java @@ -30,11 +30,11 @@ public class NicSecondaryIpResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the secondary private IP addr") + @Param(description = "The ID of the secondary private IP addr") private String id; @SerializedName("secondaryip") - @Param(description = "the list of Secondary ipv4 addr of nic") + @Param(description = "The list of Secondary IPv4 addr of NIC") private List secondaryIpsList; @SerializedName(ApiConstants.IP_ADDRESS) @@ -42,15 +42,15 @@ public class NicSecondaryIpResponse extends BaseResponse { private String ipAddr; @SerializedName(ApiConstants.NIC_ID) - @Param(description = "the ID of the nic") + @Param(description = "The ID of the NIC") private String nicId; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the ID of the network") + @Param(description = "The ID of the Network") private String nwId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "the ID of the vm") + @Param(description = "The ID of the Instance") private String vmId; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ObjectStoreResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ObjectStoreResponse.java index e4030799aa79..dcb93aaaf1d2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ObjectStoreResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ObjectStoreResponse.java @@ -17,6 +17,8 @@ package org.apache.cloudstack.api.response; import com.cloud.serializer.Param; + +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.storage.object.ObjectStore; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponseWithAnnotations; @@ -24,15 +26,15 @@ @EntityReference(value = ObjectStore.class) public class ObjectStoreResponse extends BaseResponseWithAnnotations { - @SerializedName("id") + @SerializedName(ApiConstants.ID) @Param(description = "the ID of the object store") private String id; - @SerializedName("name") + @SerializedName(ApiConstants.NAME) @Param(description = "the name of the object store") private String name; - @SerializedName("url") + @SerializedName(ApiConstants.URL) @Param(description = "the url of the object store") private String url; @@ -44,6 +46,10 @@ public class ObjectStoreResponse extends BaseResponseWithAnnotations { @Param(description = "the total size of the object store") private Long storageTotal; + @SerializedName("storageallocated") + @Param(description = "the allocated size of the object store") + private Long storageAllocated; + @SerializedName("storageused") @Param(description = "the object store currently used size") private Long storageUsed; @@ -96,6 +102,14 @@ public void setStorageTotal(Long storageTotal) { this.storageTotal = storageTotal; } + public Long getStorageAllocated() { + return storageAllocated; + } + + public void setStorageAllocated(Long storageAllocated) { + this.storageAllocated = storageAllocated; + } + public Long getStorageUsed() { return storageUsed; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java index 3a8f5fb55ab1..5ce75e44efa6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/OutOfBandManagementResponse.java @@ -28,47 +28,47 @@ @EntityReference(value = Host.class) public class OutOfBandManagementResponse extends BaseResponse { @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the host") + @Param(description = "The ID of the host") private String id; @SerializedName(ApiConstants.POWER_STATE) - @Param(description = "the out-of-band management interface powerState of the host") + @Param(description = "The out-of-band management interface powerState of the host") private OutOfBandManagement.PowerState powerState; @SerializedName(ApiConstants.ENABLED) - @Param(description = "true if out-of-band management is enabled for the host") + @Param(description = "True if out-of-band management is enabled for the host") private Boolean enabled; @SerializedName(ApiConstants.DRIVER) - @Param(description = "the out-of-band management driver for the host") + @Param(description = "The out-of-band management driver for the host") private String driver; @SerializedName(ApiConstants.ADDRESS) - @Param(description = "the out-of-band management interface address") + @Param(description = "The out-of-band management interface address") private String ipAddress; @SerializedName(ApiConstants.PORT) - @Param(description = "the out-of-band management interface port") + @Param(description = "The out-of-band management interface port") private String port; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the out-of-band management interface username") + @Param(description = "The out-of-band management interface username") private String username; @SerializedName(ApiConstants.PASSWORD) - @Param(description = "the out-of-band management interface password") + @Param(description = "The out-of-band management interface password") private String password; @SerializedName(ApiConstants.ACTION) - @Param(description = "the out-of-band management action (if issued)") + @Param(description = "The out-of-band management action (if issued)") private String outOfBandManagementAction; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the operation result description") + @Param(description = "The operation result description") private String resultDescription; @SerializedName(ApiConstants.STATUS) - @Param(description = "the operation result") + @Param(description = "The operation result") private Boolean success; public OutOfBandManagementResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java index 2b67e1618dc2..9ed7247e403e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/OvsProviderResponse.java @@ -29,33 +29,33 @@ public class OvsProviderResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the ovs") + @Param(description = "The ID of the ovs") private String id; @SerializedName(ApiConstants.NSP_ID) - @Param(description = "the physical network service provider id of the provider") + @Param(description = "The physical Network service provider id of the provider") private String nspId; @SerializedName(ApiConstants.ENABLED) @Param(description = "Enabled/Disabled the service provider") private Boolean enabled; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the provider") + @Param(description = "The Account associated with the provider") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project ID of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID associated with the provider") + @Param(description = "The domain ID associated with the provider") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the provider") + @Param(description = "The domain associated with the provider") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the provider belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the provider belongs", since = "4.19.2.0") private String domainPath; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java index f5116829305a..46cf233e279b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java @@ -32,47 +32,47 @@ public class PhysicalNetworkResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the uuid of the physical network") + @Param(description = "The UUID of the physical Network") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the physical network") + @Param(description = "Name of the physical Network") private String name; @SerializedName(ApiConstants.BROADCAST_DOMAIN_RANGE) - @Param(description = "Broadcast domain range of the physical network") + @Param(description = "Broadcast domain range of the physical Network") private String broadcastDomainRange; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of the physical network") + @Param(description = "Zone ID of the physical Network") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "zone name of the physical network") + @Param(description = "Zone name of the physical Network") private String zoneName; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the physical network") + @Param(description = "State of the physical Network") private String state; @SerializedName(ApiConstants.VLAN) - @Param(description = "the vlan of the physical network") + @Param(description = "The VLAN of the physical Network") private String vlan; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the physical network owner") + @Param(description = "The domain ID of the physical Network owner") private String domainId; @SerializedName(ApiConstants.TAGS) - @Param(description = "comma separated tag") + @Param(description = "Comma separated tag") private String tags; @SerializedName(ApiConstants.ISOLATION_METHODS) - @Param(description = "isolation methods") + @Param(description = "Isolation methods") private String isolationMethods; @SerializedName(ApiConstants.NETWORK_SPEED) - @Param(description = "the speed of the physical network") + @Param(description = "The speed of the physical Network") private String networkSpeed; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java index 587fabfae8db..51cad6381f73 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/PodResponse.java @@ -30,61 +30,69 @@ @EntityReference(value = Pod.class) public class PodResponse extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the Pod") + @Param(description = "The ID of the Pod") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the Pod") + @Param(description = "The name of the Pod") private String name; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the Pod") + @Param(description = "The Zone ID of the Pod") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the Pod") + @Param(description = "The Zone name of the Pod") private String zoneName; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway of the Pod") + @Param(description = "The gateway of the Pod") private String gateway; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the netmask of the Pod") + @Param(description = "The netmask of the Pod") private String netmask; @SerializedName(ApiConstants.IP_RANGES) - @Param(description = "the IP ranges for the Pod", responseObject = IpRangeResponse.class, since = "4.16.0") + @Param(description = "The IP ranges for the Pod", responseObject = IpRangeResponse.class, since = "4.16.0") private List ipRanges; @Deprecated(since = "4.16") @SerializedName(ApiConstants.START_IP) - @Param(description = "the starting IP for the Pod. This parameter is deprecated, please use 'startip' from ipranges parameter.") + @Param(description = "The starting IP for the Pod. This parameter is deprecated, please use 'startip' from ipranges parameter.") private List startIp; @Deprecated(since = "4.16") @SerializedName(ApiConstants.END_IP) - @Param(description = "the ending IP for the Pod. This parameter is deprecated, please use 'endip' from ipranges parameter.") + @Param(description = "The ending IP for the Pod. This parameter is deprecated, please use 'endip' from ipranges parameter.") private List endIp; @Deprecated(since = "4.16") @SerializedName(ApiConstants.FOR_SYSTEM_VMS) - @Param(description = "indicates if range is dedicated for CPVM and SSVM. This parameter is deprecated, please use 'forsystemvms' from ipranges parameter.") + @Param(description = "Indicates if range is dedicated for CPVM and SSVM. This parameter is deprecated, please use 'forsystemvms' from ipranges parameter.") private List forSystemVms; @Deprecated(since = "4.16") @SerializedName(ApiConstants.VLAN_ID) - @Param(description = "indicates Vlan ID for the range. This parameter is deprecated, please use 'vlanid' from ipranges parameter.") + @Param(description = "Indicates VLAN ID for the range. This parameter is deprecated, please use 'vlanid' from ipranges parameter.") private List vlanId; @SerializedName(ApiConstants.ALLOCATION_STATE) - @Param(description = "the allocation state of the Pod") + @Param(description = "The allocation state of the Pod") private String allocationState; @SerializedName(ApiConstants.CAPACITY) - @Param(description = "the capacity of the Pod", responseObject = CapacityResponse.class) + @Param(description = "The capacity of the Pod", responseObject = CapacityResponse.class) private List capacities; + @SerializedName(ApiConstants.STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups for the pod", since = "4.21.0") + private String storageAccessGroups; + + @SerializedName(ApiConstants.ZONE_STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups on the zone", since = "4.21.0") + private String zoneStorageAccessGroups; + public String getId() { return id; } @@ -184,4 +192,20 @@ public List getCapacities() { public void setCapacities(List capacities) { this.capacities = capacities; } + + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + + public String getZoneStorageAccessGroups() { + return zoneStorageAccessGroups; + } + + public void setZoneStorageAccessGroups(String zoneStorageAccessGroups) { + this.zoneStorageAccessGroups = zoneStorageAccessGroups; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java index ddb2f9052d87..45316c8b642f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpRangeResponse.java @@ -32,31 +32,31 @@ public class PortableIpRangeResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "portable IP range ID") + @Param(description = "Portable IP range ID") private String id; @SerializedName(ApiConstants.REGION_ID) - @Param(description = "Region Id in which portable ip range is provisioned") + @Param(description = "Region ID in which portable IP range is provisioned") private Integer regionId; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway of the VLAN IP range") + @Param(description = "The gateway of the VLAN IP range") private String gateway; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the netmask of the VLAN IP range") + @Param(description = "The netmask of the VLAN IP range") private String netmask; @SerializedName(ApiConstants.VLAN) - @Param(description = "the ID or VID of the VLAN.") + @Param(description = "The ID or VID of the VLAN.") private String vlan; @SerializedName(ApiConstants.START_IP) - @Param(description = "the start ip of the portable IP range") + @Param(description = "The start IP of the portable IP range") private String startIp; @SerializedName(ApiConstants.END_IP) - @Param(description = "the end ip of the portable IP range") + @Param(description = "The end IP of the portable IP range") private String endIp; @SerializedName(ApiConstants.PORTABLE_IP_ADDRESS) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java index e477b1115616..98279aaa1c57 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/PortableIpResponse.java @@ -32,43 +32,43 @@ public class PortableIpResponse extends BaseResponse { @SerializedName(ApiConstants.REGION_ID) - @Param(description = "Region Id in which global load balancer is created") + @Param(description = "Region ID in which global Load balancer is created") private Integer regionId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "public IP address") + @Param(description = "Public IP address") private String ipAddress; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the zone the public IP address belongs to") + @Param(description = "The ID of the zone the public IP address belongs to") private String zoneId; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the ID of the Network where ip belongs to") + @Param(description = "The ID of the Network where IP belongs to") private String networkId; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "VPC the ip belongs to") + @Param(description = "VPC the IP belongs to") private String vpcId; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "the account ID the portable IP address is associated with") + @Param(description = "The Account ID the portable IP address is associated with") private String accountId; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID the portable IP address is associated with") + @Param(description = "The domain ID the portable IP address is associated with") private String domainId; @SerializedName("allocated") - @Param(description = "date the portal IP address was acquired") + @Param(description = "Date the portal IP address was acquired") private Date allocated; @SerializedName(ApiConstants.STATE) - @Param(description = "State of the ip address. Can be: Allocating, Allocated, Releasing and Free") + @Param(description = "State of the IP address. Can be: Allocating, Allocated, Releasing and Free") private String state; public void setRegionId(Integer regionId) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java index 414aed94bad3..7a6d443c14ad 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/PrivateGatewayResponse.java @@ -30,35 +30,35 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the private gateway") + @Param(description = "The ID of the private gateway") private String id; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway") + @Param(description = "The gateway") private String gateway; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the private gateway's netmask") + @Param(description = "The private gateway's netmask") private String netmask; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the private gateway's ip address") + @Param(description = "The private gateway's IP address") private String address; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of the private gateway") + @Param(description = "Zone ID of the private gateway") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the private gateway belongs to") + @Param(description = "The name of the zone the private gateway belongs to") private String zoneName; @SerializedName(ApiConstants.VLAN) - @Param(description = "the network implementation uri for the private gateway") + @Param(description = "The Network implementation uri for the private gateway") private String broadcastUri; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "VPC id the private gateway belongs to") + @Param(description = "VPC ID the private gateway belongs to") private String vpcId; @SerializedName(ApiConstants.VPC_NAME) @@ -66,31 +66,31 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im private String vpcName; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network id") + @Param(description = "The physical Network id") private String physicalNetworkId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the private gateway") + @Param(description = "The Account associated with the private gateway") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the private gateway") + @Param(description = "The project ID of the private gateway") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the private gateway") + @Param(description = "The project name of the private gateway") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain associated with the private gateway") + @Param(description = "The ID of the domain associated with the private gateway") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the private gateway") + @Param(description = "The domain associated with the private gateway") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the private gateway belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the private gateway belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.STATE) @@ -102,7 +102,7 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im private Boolean sourceNat; @SerializedName(ApiConstants.ACL_ID) - @Param(description = "ACL Id set for private gateway") + @Param(description = "ACL ID set for private gateway") private String aclId; @SerializedName(ApiConstants.ACL_NAME) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java index d035622f65f1..89e0c38a48e8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectAccountResponse.java @@ -30,19 +30,19 @@ @SuppressWarnings("unused") public class ProjectAccountResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "project id") + @Param(description = "Project ID") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "project name") + @Param(description = "Project name") private String projectName; @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "the id of the account") + @Param(description = "The ID of the Account") private String accountId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the name of the account") + @Param(description = "The name of the Account") private String accountName; @SerializedName(ApiConstants.USERNAME) @@ -50,35 +50,35 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledVi private String username; @SerializedName(ApiConstants.ACCOUNT_TYPE) - @Param(description = "account type (admin, domain-admin, user)") + @Param(description = "Account type (admin, domain-admin, user)") private Integer accountType; @SerializedName(ApiConstants.USER_ID) - @Param(description = "Id of the user") + @Param(description = "ID of the user") private String userId; @SerializedName(ApiConstants.PROJECT_ROLE_ID) - @Param(description = "Id of the project role associated with the account/user") + @Param(description = "ID of the project role associated with the Account/User") private String projectRoleId; @SerializedName(ApiConstants.ROLE) - @Param(description = "account role in the project (regular,owner)") + @Param(description = "Account role in the project (regular, owner)") private String role; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "id of the Domain the account belongs too") + @Param(description = "ID of the Domain the Account belongs too") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "name of the Domain the account belongs too") + @Param(description = "Name of the Domain the Account belongs too") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain the account belongs to", since = "4.19.2.0") + @Param(description = "Path of the Domain the Account belongs to", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.USER) - @Param(description = "the list of users associated with account", responseObject = UserResponse.class) + @Param(description = "The list of users associated with Account", responseObject = UserResponse.class) private List users; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java index ad3f99f6b3ff..c99e3edf6db1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectInvitationResponse.java @@ -28,43 +28,43 @@ @SuppressWarnings("unused") public class ProjectInvitationResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the invitation") + @Param(description = "The ID of the invitation") private String id; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the id of the project") + @Param(description = "The ID of the project") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the name of the project") + @Param(description = "The name of the project") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id the project belongs to") + @Param(description = "The domain ID the project belongs to") private String domainId; @SerializedName(ApiConstants.USER_ID) - @Param(description = "the User ID") + @Param(description = "The User ID") private String userId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name where the project belongs to") + @Param(description = "The domain name where the project belongs to") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain the project belongs to", since = "4.19.2.0") + @Param(description = "Path of the Domain the project belongs to", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account name of the project's owner") + @Param(description = "The Account name of the project's owner") private String accountName; @SerializedName(ApiConstants.EMAIL) - @Param(description = "the email the invitation was sent to") + @Param(description = "The email the invitation was sent to") private String email; @SerializedName(ApiConstants.STATE) - @Param(description = "the invitation state") + @Param(description = "The invitation state") private String invitationState; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java index 8bdf042add08..40f9405d0fc5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java @@ -33,111 +33,123 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCountResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the project") + @Param(description = "The ID of the project") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the project") + @Param(description = "The name of the project") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "the displaytext of the project") + @Param(description = "The displaytext of the project") private String displaytext; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id the project belongs to") + @Param(description = "The domain ID the project belongs to") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name where the project belongs to") + @Param(description = "The domain name where the project belongs to") private String domain; @SerializedName(ApiConstants.OWNER) - @Param(description = "the account name of the project's owners") + @Param(description = "The Account name of the project's owners") private List> owners; @SerializedName("projectaccountname") - @Param(description="the project account name of the project") + @Param(description = "The project Account name of the project") private String projectAccountName; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the project") + @Param(description = "The state of the project") private String state; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with vm", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with Instance", responseObject = ResourceTagResponse.class) private List tags = new ArrayList(); @SerializedName("networklimit") - @Param(description = "the total number of networks the project can own", since = "4.2.0") + @Param(description = "The total number of Networks the project can own", since = "4.2.0") private String networkLimit; @SerializedName("networktotal") - @Param(description = "the total number of networks owned by project", since = "4.2.0") + @Param(description = "The total number of Networks owned by project", since = "4.2.0") private Long networkTotal; @SerializedName("networkavailable") - @Param(description = "the total number of networks available to be created for this project", since = "4.2.0") + @Param(description = "The total number of Networks available to be created for this project", since = "4.2.0") private String networkAvailable; @SerializedName("vpclimit") - @Param(description = "the total number of vpcs the project can own", since = "4.2.0") + @Param(description = "The total number of VPCs the project can own", since = "4.2.0") private String vpcLimit; @SerializedName("vpctotal") - @Param(description = "the total number of vpcs owned by project", since = "4.2.0") + @Param(description = "The total number of VPCs owned by project", since = "4.2.0") private Long vpcTotal; @SerializedName("vpcavailable") - @Param(description = "the total number of vpcs available to be created for this project", since = "4.2.0") + @Param(description = "The total number of VPCs available to be created for this project", since = "4.2.0") private String vpcAvailable; @SerializedName("cpulimit") - @Param(description = "the total number of cpu cores the project can own", since = "4.2.0") + @Param(description = "The total number of CPU cores the project can own", since = "4.2.0") private String cpuLimit; @SerializedName("cputotal") - @Param(description = "the total number of cpu cores owned by project", since = "4.2.0") + @Param(description = "The total number of CPU cores owned by project", since = "4.2.0") private Long cpuTotal; @SerializedName("cpuavailable") - @Param(description = "the total number of cpu cores available to be created for this project", since = "4.2.0") + @Param(description = "The total number of CPU cores available to be created for this project", since = "4.2.0") private String cpuAvailable; @SerializedName("memorylimit") - @Param(description = "the total memory (in MB) the project can own", since = "4.2.0") + @Param(description = "The total memory (in MB) the project can own", since = "4.2.0") private String memoryLimit; @SerializedName("memorytotal") - @Param(description = "the total memory (in MB) owned by project", since = "4.2.0") + @Param(description = "The total memory (in MB) owned by project", since = "4.2.0") private Long memoryTotal; @SerializedName("memoryavailable") - @Param(description = "the total memory (in MB) available to be created for this project", since = "4.2.0") + @Param(description = "The total memory (in MB) available to be created for this project", since = "4.2.0") private String memoryAvailable; + @SerializedName("gpulimit") + @Param(description = "the total number of gpus the project can own", since = "4.21.0") + private String gpuLimit; + + @SerializedName("gputotal") + @Param(description = "the total number of gpus owned by project", since = "4.21.0") + private Long gpuTotal; + + @SerializedName("gpuavailable") + @Param(description = "the total number of gpus available to be created for this project", since = "4.21.0") + private String gpuAvailable; + @SerializedName("primarystoragelimit") - @Param(description = "the total primary storage space (in GiB) the project can own", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) the project can own", since = "4.2.0") private String primaryStorageLimit; @SerializedName("primarystoragetotal") - @Param(description = "the total primary storage space (in GiB) owned by project", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) owned by project", since = "4.2.0") private Long primaryStorageTotal; @SerializedName("primarystorageavailable") - @Param(description = "the total primary storage space (in GiB) available to be used for this project", since = "4.2.0") + @Param(description = "The total primary storage space (in GiB) available to be used for this project", since = "4.2.0") private String primaryStorageAvailable; @SerializedName("secondarystoragelimit") - @Param(description = "the total secondary storage space (in GiB) the project can own", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) the project can own", since = "4.2.0") private String secondaryStorageLimit; @SerializedName("secondarystoragetotal") - @Param(description = "the total secondary storage space (in GiB) owned by project", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) owned by project", since = "4.2.0") private float secondaryStorageTotal; @SerializedName("secondarystorageavailable") - @Param(description = "the total secondary storage space (in GiB) available to be used for this project", since = "4.2.0") + @Param(description = "The total secondary storage space (in GiB) available to be used for this project", since = "4.2.0") private String secondaryStorageAvailable; @SerializedName(ApiConstants.BUCKET_LIMIT) @@ -165,51 +177,51 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou private String objectStorageAvailable; @SerializedName(ApiConstants.VM_LIMIT) - @Param(description = "the total number of virtual machines that can be deployed by this project", since = "4.2.0") + @Param(description = "The total number of Instances that can be deployed by this project", since = "4.2.0") private String vmLimit; @SerializedName(ApiConstants.VM_TOTAL) - @Param(description = "the total number of virtual machines deployed by this project", since = "4.2.0") + @Param(description = "The total number of Instances deployed by this project", since = "4.2.0") private Long vmTotal; @SerializedName(ApiConstants.VM_AVAILABLE) - @Param(description = "the total number of virtual machines available for this project to acquire", since = "4.2.0") + @Param(description = "The total number of Instances available for this project to acquire", since = "4.2.0") private String vmAvailable; @SerializedName(ApiConstants.IP_LIMIT) - @Param(description = "the total number of public ip addresses this project can acquire", since = "4.2.0") + @Param(description = "The total number of public IP addresses this project can acquire", since = "4.2.0") private String ipLimit; @SerializedName(ApiConstants.IP_TOTAL) - @Param(description = "the total number of public ip addresses allocated for this project", since = "4.2.0") + @Param(description = "The total number of public IP addresses allocated for this project", since = "4.2.0") private Long ipTotal; @SerializedName(ApiConstants.IP_AVAILABLE) - @Param(description = "the total number of public ip addresses available for this project to acquire", since = "4.2.0") + @Param(description = "The total number of public IP addresses available for this project to acquire", since = "4.2.0") private String ipAvailable; @SerializedName("volumelimit") - @Param(description = "the total volume which can be used by this project", since = "4.2.0") + @Param(description = "The total volume which can be used by this project", since = "4.2.0") private String volumeLimit; @SerializedName("volumetotal") - @Param(description = "the total volume being used by this project", since = "4.2.0") + @Param(description = "The total volume being used by this project", since = "4.2.0") private Long volumeTotal; @SerializedName("volumeavailable") - @Param(description = "the total volume available for this project", since = "4.2.0") + @Param(description = "The total volume available for this project", since = "4.2.0") private String volumeAvailable; @SerializedName("snapshotlimit") - @Param(description = "the total number of snapshots which can be stored by this project", since = "4.2.0") + @Param(description = "The total number of Snapshots which can be stored by this project", since = "4.2.0") private String snapshotLimit; @SerializedName("snapshottotal") - @Param(description = "the total number of snapshots stored by this project", since = "4.2.0") + @Param(description = "The total number of Snapshots stored by this project", since = "4.2.0") private Long snapshotTotal; @SerializedName("snapshotavailable") - @Param(description = "the total number of snapshots available for this project", since = "4.2.0") + @Param(description = "The total number of Snapshots available for this project", since = "4.2.0") private String snapshotAvailable; @SerializedName(ApiConstants.BACKUP_LIMIT) @@ -237,23 +249,23 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou private String backupStorageAvailable; @SerializedName("templatelimit") - @Param(description = "the total number of templates which can be created by this project", since = "4.2.0") + @Param(description = "The total number of Templates which can be created by this project", since = "4.2.0") private String templateLimit; @SerializedName("templatetotal") - @Param(description = "the total number of templates which have been created by this project", since = "4.2.0") + @Param(description = "The total number of Templates which have been created by this project", since = "4.2.0") private Long templateTotal; @SerializedName("templateavailable") - @Param(description = "the total number of templates available to be created by this project", since = "4.2.0") + @Param(description = "The total number of Templates available to be created by this project", since = "4.2.0") private String templateAvailable; @SerializedName("vmstopped") - @Param(description = "the total number of virtual machines stopped for this project", since = "4.2.0") + @Param(description = "The total number of Instances stopped for this project", since = "4.2.0") private Integer vmStopped; @SerializedName("vmrunning") - @Param(description = "the total number of virtual machines running for this project", since = "4.2.0") + @Param(description = "The total number of Instances running for this project", since = "4.2.0") private Integer vmRunning; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -261,7 +273,7 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou ResourceIconResponse icon; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this project was created", since = "4.16.0") + @Param(description = "The date this project was created", since = "4.16.0") private Date created; @SerializedName(ApiConstants.TAGGED_RESOURCES) @@ -483,6 +495,21 @@ public void setMemoryAvailable(String memoryAvailable) { this.memoryAvailable = memoryAvailable; } + @Override + public void setGpuLimit(String gpuLimit) { + this.gpuLimit = gpuLimit; + } + + @Override + public void setGpuTotal(Long gpuTotal) { + this.gpuTotal = gpuTotal; + } + + @Override + public void setGpuAvailable(String gpuAvailable) { + this.gpuAvailable = gpuAvailable; + } + @Override public void setPrimaryStorageLimit(String primaryStorageLimit) { this.primaryStorageLimit = primaryStorageLimit; diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProjectRolePermissionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectRolePermissionResponse.java index 91b2036d3e61..55abd80c59b4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectRolePermissionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectRolePermissionResponse.java @@ -27,19 +27,19 @@ @EntityReference(value = ProjectRolePermission.class) public class ProjectRolePermissionResponse extends BaseRolePermissionResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the project role permission") + @Param(description = "The ID of the project role permission") private String id; @SerializedName(ApiConstants.PROJECT_ROLE_ID) - @Param(description = "the ID of the project role to which the role permission belongs") + @Param(description = "The ID of the project role to which the role permission belongs") private String projectRoleId; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the ID of the project") + @Param(description = "The ID of the project") private String projectId; @SerializedName(ApiConstants.PROJECT_ROLE_NAME) - @Param(description = "the name of the project role to which the role permission belongs") + @Param(description = "The name of the project role to which the role permission belongs") private String projectRoleName; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProjectRoleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProjectRoleResponse.java index 230329f0ee13..05df8d635ae6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectRoleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectRoleResponse.java @@ -27,7 +27,7 @@ @EntityReference(value = ProjectRole.class) public class ProjectRoleResponse extends BaseRoleResponse { @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the id of the project") + @Param(description = "The ID of the project") private String projectId; public String getProjectId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java index 4d410837476e..7f08ee88a7df 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ProviderResponse.java @@ -31,31 +31,31 @@ public class ProviderResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the provider name") + @Param(description = "The provider name") private String name; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.DEST_PHYSICAL_NETWORK_ID) - @Param(description = "the destination physical network") + @Param(description = "The destination physical Network") private String destinationPhysicalNetworkId; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the network provider") + @Param(description = "State of the Network provider") private String state; @SerializedName(ApiConstants.ID) - @Param(description = "uuid of the network provider") + @Param(description = "UUID of the Network provider") private String id; @SerializedName(ApiConstants.SERVICE_LIST) - @Param(description = "services for this provider") + @Param(description = "Services for this provider") private List services; @SerializedName(ApiConstants.CAN_ENABLE_INDIVIDUAL_SERVICE) - @Param(description = "true if individual services can be enabled/disabled") + @Param(description = "True if individual services can be enabled/disabled") private Boolean canEnableIndividualServices; public void setName(String name) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java index 6c74fa623ce0..785bd1f6c238 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RegionResponse.java @@ -28,23 +28,23 @@ @EntityReference(value = Region.class) public class RegionResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the region") + @Param(description = "The ID of the region") private Integer id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the region") + @Param(description = "The name of the region") private String name; @SerializedName(ApiConstants.END_POINT) - @Param(description = "the end point of the region") + @Param(description = "The end point of the region") private String endPoint; @SerializedName("gslbserviceenabled") - @Param(description = "true if GSLB service is enabled in the region, false otherwise") + @Param(description = "True if GSLB service is enabled in the region, false otherwise") private boolean gslbServiceEnabled; @SerializedName("portableipserviceenabled") - @Param(description = "true if security groups support is enabled, false otherwise") + @Param(description = "True if security groups support is enabled, false otherwise") private boolean portableipServiceEnabled; public Integer getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RegisterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RegisterUserKeyResponse.java similarity index 87% rename from api/src/main/java/org/apache/cloudstack/api/response/RegisterResponse.java rename to api/src/main/java/org/apache/cloudstack/api/response/RegisterUserKeyResponse.java index dd17cc5cc8af..4a5fb6b222e6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RegisterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RegisterUserKeyResponse.java @@ -23,17 +23,17 @@ import com.cloud.serializer.Param; -public class RegisterResponse extends BaseResponse { +public class RegisterUserKeyResponse extends BaseResponse { @SerializedName(ApiConstants.API_KEY) - @Param(description = "the api key of the registered user", isSensitive = true) + @Param(description = "The API key of the registered user", isSensitive = true) private String apiKey; @SerializedName(ApiConstants.SECRET_KEY) - @Param(description = "the secret key of the registered user", isSensitive = true) + @Param(description = "The secret key of the registered user", isSensitive = true) private String secretKey; @SerializedName(ApiConstants.API_KEY_ACCESS) - @Param(description = "whether api key access is allowed or not", isSensitive = true) + @Param(description = "Whether API key access is allowed or not", isSensitive = true) private Boolean apiKeyAccess; public String getApiKey() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java index 54164e3ac34a..9fe5052b39d9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java @@ -30,55 +30,55 @@ public class RemoteAccessVpnResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.PUBLIC_IP_ID) - @Param(description = "the public ip address of the vpn server") + @Param(description = "The public IP address of the VPN server") private String publicIpId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public ip address of the vpn server") + @Param(description = "The public IP address of the VPN server") private String publicIp; @SerializedName("iprange") - @Param(description = "the range of ips to allocate to the clients") + @Param(description = "The range of IPs to allocate to the clients") private String ipRange; @SerializedName("presharedkey") - @Param(description = "the ipsec preshared key", isSensitive = true) + @Param(description = "The IPSec preshared key", isSensitive = true) private String presharedKey; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the remote access vpn") + @Param(description = "The Account of the remote access VPN") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vpn") + @Param(description = "The project ID of the VPN") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vpn") + @Param(description = "The project name of the VPN") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the account of the remote access vpn") + @Param(description = "The domain ID of the Account of the remote access VPN") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the account of the remote access vpn") + @Param(description = "The domain name of the Account of the remote access VPN") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the remote access vpn belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the remote access VPN belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the rule") + @Param(description = "The state of the rule") private String state; @SerializedName(ApiConstants.ID) - @Param(description = "the id of the remote access vpn") + @Param(description = "The ID of the remote access VPN") private String id; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is vpn for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is VPN for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setPublicIp(String publicIp) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java index 74511a0f7430..d44e6c8fef5d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceCountResponse.java @@ -26,35 +26,35 @@ @SuppressWarnings("unused") public class ResourceCountResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account for which resource count's are updated") + @Param(description = "The Account for which resource count's are updated") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id for which resource count's are updated") + @Param(description = "The project ID for which resource count's are updated") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name for which resource count's are updated") + @Param(description = "The project name for which resource count's are updated") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID for which resource count's are updated") + @Param(description = "The domain ID for which resource count's are updated") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name for which resource count's are updated") + @Param(description = "The domain name for which resource count's are updated") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the resource counts are updated", since = "4.19.2.0") + @Param(description = "Path of the domain to which the resource counts are updated", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.RESOURCE_TYPE) - @Param(description = "resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.") + @Param(description = "Resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.") private String resourceType; @SerializedName(ApiConstants.RESOURCE_TYPE_NAME) - @Param(description = "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.") + @Param(description = "Resource type name. Values include user_vm, public_ip, volume, Snapshot, Template, project, Network, VPC, CPU, memory, primary_storage, secondary_storage.") private String resourceTypeName; @SerializedName(ApiConstants.RESOURCE_COUNT) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java index 3ebb9c737ec4..bf5031a03ea4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceDetailResponse.java @@ -34,15 +34,15 @@ public class ResourceDetailResponse extends BaseResponse { private String resourceType; @SerializedName(ApiConstants.KEY) - @Param(description = "key of the resource detail") + @Param(description = "Key of the resource detail") private String name; @SerializedName(ApiConstants.VALUE) - @Param(description = "value of the resource detail") + @Param(description = "Value of the resource detail") private String value; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "if detail is returned to the regular user", since = "4.3") + @Param(description = "If detail is returned to the regular user", since = "4.3") private boolean forDisplay; public String getResourceId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceIconResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceIconResponse.java index 403a91c88945..1b2055483887 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceIconResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceIconResponse.java @@ -24,15 +24,15 @@ public class ResourceIconResponse extends BaseResponse { @SerializedName(ApiConstants.RESOURCE_TYPE) - @Param(description = "resource type") + @Param(description = "Resource type") private ResourceTag.ResourceObjectType resourceType; @SerializedName(ApiConstants.RESOURCE_ID) - @Param(description = "id of the resource") + @Param(description = "ID of the resource") private String resourceId; @SerializedName(ApiConstants.BASE64_IMAGE) - @Param(description = "base64 representation of resource icon") + @Param(description = "Base64 representation of resource icon") private String image; public ResourceTag.ResourceObjectType getResourceType() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java index b86723b36c41..66de71dd7634 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitAndCountResponse.java @@ -48,6 +48,12 @@ public interface ResourceLimitAndCountResponse { public void setMemoryAvailable(String memoryAvailable); + public void setGpuLimit(String gpuLimit); + + public void setGpuTotal(Long gpuTotal); + + public void setGpuAvailable(String gpuAvailable); + public void setPrimaryStorageLimit(String primaryStorageLimit); public void setPrimaryStorageTotal(Long primaryStorageTotal); diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java index b5b03873f3f1..7b4a23444e5e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceLimitResponse.java @@ -29,39 +29,39 @@ @SuppressWarnings("unused") public class ResourceLimitResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the resource limit") + @Param(description = "The Account of the resource limit") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the resource limit") + @Param(description = "The domain ID of the resource limit") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the resource limit") + @Param(description = "The domain name of the resource limit") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the resource limit belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the resource limit belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.RESOURCE_TYPE) - @Param(description = "resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.") + @Param(description = "Resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.") private String resourceType; @SerializedName(ApiConstants.RESOURCE_TYPE_NAME) - @Param(description = "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.") + @Param(description = "Resource type name. Values include user_vm, public_ip, volume, Snapshot, Template, project, Network, VPC, CPU, memory, primary_storage, secondary_storage.") private String resourceTypeName; @SerializedName("max") - @Param(description = "the maximum number of the resource. A -1 means the resource currently has no limit.") + @Param(description = "The maximum number of the resource. A -1 means the resource currently has no limit.") private Long max; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the resource limit") + @Param(description = "The project ID of the resource limit") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the resource limit") + @Param(description = "The project name of the resource limit") private String projectName; @SerializedName(ApiConstants.TAG) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java index 26e4d19cdba7..af90d68dd66c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ResourceTagResponse.java @@ -26,47 +26,47 @@ @SuppressWarnings("unused") public class ResourceTagResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.KEY) - @Param(description = "tag key name") + @Param(description = "Tag key name") private String key; @SerializedName(ApiConstants.VALUE) - @Param(description = "tag value") + @Param(description = "Tag value") private String value; @SerializedName(ApiConstants.RESOURCE_TYPE) - @Param(description = "resource type") + @Param(description = "Resource type") private String resourceType; @SerializedName(ApiConstants.RESOURCE_ID) - @Param(description = "id of the resource") + @Param(description = "ID of the resource") private String resourceId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the tag") + @Param(description = "The Account associated with the tag") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id the tag belongs to") + @Param(description = "The project ID the tag belongs to") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name where tag belongs to") + @Param(description = "The project name where tag belongs to") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain associated with the tag") + @Param(description = "The ID of the domain associated with the tag") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the tag") + @Param(description = "The domain associated with the tag") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain associated with the tag", since = "4.19.2.0") + @Param(description = "Path of the Domain associated with the tag", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.CUSTOMER) - @Param(description = "customer associated with the tag") + @Param(description = "Customer associated with the tag") private String customer; public void setKey(String key) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java index 7bff8764cbe7..6b47cae45734 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RolePermissionResponse.java @@ -27,15 +27,15 @@ @EntityReference(value = RolePermission.class) public class RolePermissionResponse extends BaseRolePermissionResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the role permission") + @Param(description = "The ID of the role permission") private String id; @SerializedName(ApiConstants.ROLE_ID) - @Param(description = "the ID of the role to which the role permission belongs") + @Param(description = "The ID of the role to which the role permission belongs") private String roleId; @SerializedName(ApiConstants.ROLE_NAME) - @Param(description = "the name of the role to which the role permission belongs") + @Param(description = "The name of the role to which the role permission belongs") private String roleName; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java index 92e3b46139f3..b394e83dca53 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RoleResponse.java @@ -29,11 +29,11 @@ public class RoleResponse extends BaseRoleResponse { @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the role") + @Param(description = "The type of the role") private String roleType; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if role is default, false otherwise") + @Param(description = "True if role is default, false otherwise") private Boolean isDefault; @SerializedName(ApiConstants.STATE) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostSkippedResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostSkippedResponse.java index 8d304543fb97..0071498f4270 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostSkippedResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostSkippedResponse.java @@ -24,15 +24,15 @@ public class RollingMaintenanceHostSkippedResponse extends BaseResponse { @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the skipped host") + @Param(description = "The ID of the skipped host") private String hostId; @SerializedName(ApiConstants.HOST_NAME) - @Param(description = "the name of the skipped host") + @Param(description = "The name of the skipped host") private String hostName; @SerializedName(ApiConstants.ACL_REASON) - @Param(description = "the reason to skip the host") + @Param(description = "The reason to skip the host") private String reason; public String getHostId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostUpdatedResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostUpdatedResponse.java index 821257d4e076..a1670831af23 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostUpdatedResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceHostUpdatedResponse.java @@ -24,23 +24,23 @@ public class RollingMaintenanceHostUpdatedResponse extends BaseResponse { @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the updated host") + @Param(description = "The ID of the updated host") private String hostId; @SerializedName(ApiConstants.HOST_NAME) - @Param(description = "the name of the updated host") + @Param(description = "The name of the updated host") private String hostName; @SerializedName(ApiConstants.START_DATE) - @Param(description = "start date of the update on the host") + @Param(description = "Start date of the update on the host") private String startDate; @SerializedName(ApiConstants.END_DATE) - @Param(description = "end date of the update on the host") + @Param(description = "End date of the update on the host") private String endDate; @SerializedName(ApiConstants.OUTPUT) - @Param(description = "output of the maintenance script on the host") + @Param(description = "Output of the maintenance script on the host") private String output; public String getHostId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceResponse.java index 89b838c2843f..56427d7eaca9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RollingMaintenanceResponse.java @@ -25,19 +25,19 @@ public class RollingMaintenanceResponse extends BaseResponse { @SerializedName("success") - @Param(description = "indicates if the rolling maintenance operation was successful") + @Param(description = "Indicates if the rolling maintenance operation was successful") private Boolean success; @SerializedName("details") - @Param(description = "in case of failure, details are displayed") + @Param(description = "In case of failure, details are displayed") private String details; @SerializedName("hostsupdated") - @Param(description = "the hosts updated", responseObject = RollingMaintenanceHostUpdatedResponse.class) + @Param(description = "The hosts updated", responseObject = RollingMaintenanceHostUpdatedResponse.class) private List updatedHosts; @SerializedName("hostsskipped") - @Param(description = "the hosts skipped", responseObject = RollingMaintenanceHostSkippedResponse.class) + @Param(description = "The hosts skipped", responseObject = RollingMaintenanceHostSkippedResponse.class) private List skippedHosts; public RollingMaintenanceResponse(Boolean success, String details) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultResponse.java index f98cf0acd5dd..9716c564634e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultResponse.java @@ -19,6 +19,7 @@ import java.util.Date; +import com.cloud.network.VirtualNetworkApplianceService.RouterHealthStatus; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; @@ -27,23 +28,27 @@ public class RouterHealthCheckResultResponse extends BaseResponse { @SerializedName(ApiConstants.ROUTER_CHECK_NAME) - @Param(description = "the name of the health check on the router") + @Param(description = "The name of the health check on the router") private String checkName; @SerializedName(ApiConstants.ROUTER_CHECK_TYPE) - @Param(description = "the type of the health check - basic or advanced") + @Param(description = "The type of the health check - basic or advanced") private String checkType; - @SerializedName(ApiConstants.RESULT) - @Param(description = "result of the health check") + @SerializedName(ApiConstants.SUCCESS) + @Param(description = "The result of the health check if available") private boolean result; + @SerializedName(ApiConstants.STATUS) + @Param(description = "the result of the health check in enum form: {SUCCESS, FAILURE, WARNING, UNKNOWN}") + private RouterHealthStatus state; + @SerializedName(ApiConstants.LAST_UPDATED) - @Param(description = "the date this VPC was created") + @Param(description = "The date this VPC was created") private Date lastUpdated; @SerializedName(ApiConstants.DETAILS) - @Param(description = "detailed response generated on running health check") + @Param(description = "Detailed response generated on running health check") private String details; public String getCheckName() { @@ -54,10 +59,14 @@ public String getCheckType() { return checkType; } - public boolean getResult() { + public Boolean getResult() { return result; } + public RouterHealthStatus getState() { + return state; + } + public Date getLastUpdated() { return lastUpdated; } @@ -74,10 +83,14 @@ public void setCheckType(String checkType) { this.checkType = checkType; } - public void setResult(boolean result) { + public void setResult(Boolean result) { this.result = result; } + public void setState(RouterHealthStatus state) { + this.state = state; + } + public void setLastUpdated(Date lastUpdated) { this.lastUpdated = lastUpdated; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultsListResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultsListResponse.java index e56f70d2c59c..0d2d6cf88825 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultsListResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RouterHealthCheckResultsListResponse.java @@ -27,11 +27,11 @@ public class RouterHealthCheckResultsListResponse extends BaseResponse { @SerializedName(ApiConstants.ROUTER_ID) - @Param(description = "the id of the router") + @Param(description = "The ID of the router") private String routerId; @SerializedName(ApiConstants.ROUTER_HEALTH_CHECKS) - @Param(description = "the id of the router") + @Param(description = "The ID of the router") private List healthChecks; public String getRouterId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/RunDiagnosticsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/RunDiagnosticsResponse.java index 4c8a923613ab..0583020c7da8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/RunDiagnosticsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/RunDiagnosticsResponse.java @@ -29,15 +29,15 @@ @EntityReference(value = VirtualMachine.class) public class RunDiagnosticsResponse extends BaseResponse { @SerializedName(ApiConstants.STDOUT) - @Param(description = "the standard output from the command execution") + @Param(description = "The standard output from the command execution") private String stdout; @SerializedName(ApiConstants.STDERR) - @Param(description = "the standard error output from the command execution") + @Param(description = "The standard error output from the command execution") private String stderr; @SerializedName(ApiConstants.EXITCODE) - @Param(description = "the command execution return code") + @Param(description = "The command execution return code") private String exitCode; public String getStdout() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SSHKeyPairResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SSHKeyPairResponse.java index 65e5c5b74131..a2b9788f9f04 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SSHKeyPairResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SSHKeyPairResponse.java @@ -30,28 +30,28 @@ public class SSHKeyPairResponse extends BaseResponseWithAnnotations { @SerializedName(ApiConstants.ID) - @Param(description = "ID of the ssh keypair") + @Param(description = "ID of the SSH keypair") private String id; @SerializedName(ApiConstants.NAME) @Param(description = "Name of the keypair") private String name; - @SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the keypair") + @SerializedName(ApiConstants.ACCOUNT) @Param(description = "The owner of the keypair") private String accountName; - @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the keypair owner") + @SerializedName(ApiConstants.DOMAIN_ID) @Param(description = "The domain id of the keypair owner") private String domainId; - @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the keypair owner") + @SerializedName(ApiConstants.DOMAIN) @Param(description = "The domain name of the keypair owner") private String domain; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the keypair owner") + @Param(description = "The project id of the keypair owner") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the keypair owner") + @Param(description = "The project name of the keypair owner") private String projectName; @SerializedName("fingerprint") diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupResponse.java index de486b5a3746..2085e6089737 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupResponse.java @@ -32,35 +32,35 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the security group") + @Param(description = "The ID of the security group") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the security group") + @Param(description = "The name of the security group") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the security group") + @Param(description = "The description of the security group") private String description; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account owning the security group") + @Param(description = "The Account owning the security group") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the group") + @Param(description = "The project id of the group") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the group") + @Param(description = "The project name of the group") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the security group") + @Param(description = "The domain ID of the security group") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the security group") + @Param(description = "The domain name of the security group") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -68,23 +68,23 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledVie private String domainPath; @SerializedName("ingressrule") - @Param(description = "the list of ingress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class) + @Param(description = "The list of ingress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class) private Set ingressRules; @SerializedName("egressrule") - @Param(description = "the list of egress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class) + @Param(description = "The list of egress rules associated with the security group", responseObject = SecurityGroupRuleResponse.class) private Set egressRules; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) private Set tags; @SerializedName(ApiConstants.VIRTUAL_MACHINE_COUNT) - @Param(description = "the number of virtualmachines associated with this securitygroup", since = "4.6.0") + @Param(description = "The number of Instances associated with this Security Group", since = "4.6.0") private Integer virtualMachineCount; @SerializedName(ApiConstants.VIRTUAL_MACHINE_IDS) - @Param(description = "the list of virtualmachine ids associated with this securitygroup", since = "4.6.0") + @Param(description = "The list of Instance IDs associated with this Security Group", since = "4.6.0") private Set virtualMachineIds; public SecurityGroupResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java index 9e553aa32ccb..734fa50acb16 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java @@ -30,43 +30,43 @@ @EntityReference(value = SecurityRule.class) public class SecurityGroupRuleResponse extends BaseResponse { @SerializedName("ruleid") - @Param(description = "the id of the security group rule") + @Param(description = "The ID of the security group rule") private String ruleId; @SerializedName("protocol") - @Param(description = "the protocol of the security group rule") + @Param(description = "The protocol of the security group rule") private String protocol; @SerializedName(ApiConstants.ICMP_TYPE) - @Param(description = "the type of the ICMP message response") + @Param(description = "The type of the ICMP message response") private Integer icmpType; @SerializedName(ApiConstants.ICMP_CODE) - @Param(description = "the code for the ICMP message response") + @Param(description = "The code for the ICMP message response") private Integer icmpCode; @SerializedName(ApiConstants.START_PORT) - @Param(description = "the starting IP of the security group rule") + @Param(description = "The starting IP of the security group rule") private Integer startPort; @SerializedName(ApiConstants.END_PORT) - @Param(description = "the ending IP of the security group rule ") + @Param(description = "The ending IP of the security group rule ") private Integer endPort; @SerializedName(ApiConstants.SECURITY_GROUP_NAME) - @Param(description = "security group name") + @Param(description = "Security group name") private String securityGroupName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "account owning the security group rule") + @Param(description = "Account owning the security group rule") private String accountName; @SerializedName(ApiConstants.CIDR) - @Param(description = "the CIDR notation for the base IP address of the security group rule") + @Param(description = "The CIDR notation for the base IP address of the security group rule") private String cidr; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the rule", responseObject = ResourceTagResponse.class) private java.util.Set tags; public String getRuleId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java index 0622b936f6e0..99c50829f048 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ServiceOfferingResponse.java @@ -30,178 +30,178 @@ @EntityReference(value = ServiceOffering.class) public class ServiceOfferingResponse extends BaseResponseWithAnnotations { @SerializedName("id") - @Param(description = "the id of the service offering") + @Param(description = "The ID of the service offering") private String id; @SerializedName("name") - @Param(description = "the name of the service offering") + @Param(description = "The name of the service offering") private String name; @SerializedName("state") - @Param(description = "state of the service offering") + @Param(description = "State of the service offering") private String state; @SerializedName("displaytext") - @Param(description = "an alternate display text of the service offering.") + @Param(description = "An alternate display text of the service offering.") private String displayText; @SerializedName("cpunumber") - @Param(description = "the number of CPU") + @Param(description = "The number of CPU") private Integer cpuNumber; @SerializedName("cpuspeed") - @Param(description = "the clock rate CPU speed in Mhz") + @Param(description = "The clock rate CPU speed in Mhz") private Integer cpuSpeed; @SerializedName("memory") - @Param(description = "the memory in MB") + @Param(description = "The memory in MB") private Integer memory; @SerializedName("created") - @Param(description = "the date this service offering was created") + @Param(description = "The date this service offering was created") private Date created; @SerializedName("storagetype") - @Param(description = "the storage type for this service offering") + @Param(description = "The storage type for this service offering") private String storageType; - @SerializedName("provisioningtype") @Param(description="provisioning type used to create volumes. Valid values are thin, sparse, fat.", since = "4.4.0") + @SerializedName("provisioningtype") @Param(description = "Provisioning type used to create volumes. Valid values are thin, sparse, fat.", since = "4.4.0") private String provisioningType; @SerializedName("offerha") - @Param(description = "the ha support in the service offering") + @Param(description = "The HA support in the service offering") private Boolean offerHa; @SerializedName("limitcpuuse") - @Param(description = "restrict the CPU usage to committed service offering") + @Param(description = "Restrict the CPU usage to committed service offering") private Boolean limitCpuUse; @SerializedName("isvolatile") - @Param(description = "true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk") + @Param(description = "True if the Instance needs to be volatile, i.e., on every reboot of Instance from API root disk is discarded and creates a new root disk") private Boolean isVolatile; - @SerializedName("storagetags") - @Param(description = "the tags for the service offering") + @SerializedName(ApiConstants.STORAGE_TAGS) + @Param(description = "The tags for the service offering") private String tags; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domain; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zoneId; @SerializedName(ApiConstants.ZONE) - @Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zone; @SerializedName(ApiConstants.HOST_TAGS) - @Param(description = "the host tag for the service offering") + @Param(description = "The host tag for the service offering") private String hostTag; @SerializedName(ApiConstants.IS_SYSTEM_OFFERING) - @Param(description = "is this a system vm offering") + @Param(description = "Is this a System VM offering") private Boolean isSystem; @SerializedName(ApiConstants.IS_DEFAULT_USE) - @Param(description = "is this a default system vm offering") + @Param(description = "Is this a default System VM offering") private Boolean defaultUse; @SerializedName(ApiConstants.SYSTEM_VM_TYPE) - @Param(description = "is this a the systemvm type for system vm offering") + @Param(description = "Is this a the System VM type for System VM offering") private String vmType; @SerializedName(ApiConstants.NETWORKRATE) - @Param(description = "data transfer rate in megabits per second allowed.") + @Param(description = "Data transfer rate in megabits per second allowed.") private Integer networkRate; @SerializedName("iscustomizediops") - @Param(description = "true if disk offering uses custom iops, false otherwise", since = "4.4") + @Param(description = "True if disk offering uses custom IOPS, false otherwise", since = "4.4") private Boolean customizedIops; @SerializedName(ApiConstants.MIN_IOPS) - @Param(description = "the min iops of the disk offering", since = "4.4") + @Param(description = "The min IOPS of the disk offering", since = "4.4") private Long minIops; @SerializedName(ApiConstants.MAX_IOPS) - @Param(description = "the max iops of the disk offering", since = "4.4") + @Param(description = "The max IOPS of the disk offering", since = "4.4") private Long maxIops; @SerializedName(ApiConstants.HYPERVISOR_SNAPSHOT_RESERVE) - @Param(description = "Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", since = "4.4") + @Param(description = "Hypervisor Snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)", since = "4.4") private Integer hypervisorSnapshotReserve; @SerializedName("diskBytesReadRate") - @Param(description = "bytes read rate of the service offering") + @Param(description = "Bytes read rate of the service offering") private Long bytesReadRate; @SerializedName("diskBytesReadRateMax") - @Param(description = "burst bytes read rate of the disk offering") + @Param(description = "Burst bytes read rate of the disk offering") private Long bytesReadRateMax; @SerializedName("diskBytesReadRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long bytesReadRateMaxLength; @SerializedName("diskBytesWriteRate") - @Param(description = "bytes write rate of the service offering") + @Param(description = "Bytes write rate of the service offering") private Long bytesWriteRate; @SerializedName("diskBytesWriteRateMax") - @Param(description = "burst bytes write rate of the disk offering") + @Param(description = "Burst bytes write rate of the disk offering") private Long bytesWriteRateMax; @SerializedName("diskBytesWriteRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long bytesWriteRateMaxLength; @SerializedName("diskIopsReadRate") - @Param(description = "io requests read rate of the service offering") + @Param(description = "I/O requests read rate of the service offering") private Long iopsReadRate; @SerializedName("diskIopsReadRateMax") - @Param(description = "burst io requests read rate of the disk offering") + @Param(description = "Burst io requests read rate of the disk offering") private Long iopsReadRateMax; @SerializedName("diskIopsReadRateMaxLength") - @Param(description = "length (in second) of the burst") + @Param(description = "Length (in second) of the burst") private Long iopsReadRateMaxLength; @SerializedName("diskIopsWriteRate") - @Param(description = "io requests write rate of the service offering") + @Param(description = "I/O requests write rate of the service offering") private Long iopsWriteRate; @SerializedName("diskIopsWriteRateMax") - @Param(description = "burst io requests write rate of the disk offering") + @Param(description = "Burst I/O requests write rate of the disk offering") private Long iopsWriteRateMax; @SerializedName("diskIopsWriteRateMaxLength") - @Param(description = "length (in seconds) of the burst") + @Param(description = "Length (in seconds) of the burst") private Long iopsWriteRateMaxLength; @SerializedName(ApiConstants.DEPLOYMENT_PLANNER) - @Param(description = "deployment strategy used to deploy VM.") + @Param(description = "Deployment strategy used to deploy Instance.") private String deploymentPlanner; @SerializedName(ApiConstants.SERVICE_OFFERING_DETAILS) - @Param(description = "additional key/value details tied with this service offering", since = "4.2.0") + @Param(description = "Additional key/value details tied with this service offering", since = "4.2.0") private Map details; @SerializedName("iscustomized") - @Param(description = "is true if the offering is customized", since = "4.3.0") + @Param(description = "Is true if the offering is customized", since = "4.3.0") private Boolean isCustomized; @SerializedName("cacheMode") - @Param(description = "the cache mode to use for this disk offering. none, writeback or writethrough", since = "4.14") + @Param(description = "The cache mode to use for this disk offering. none, writeback, writethrough or hypervisor default", since = "4.14") private String cacheMode; @SerializedName("vspherestoragepolicy") - @Param(description = "the vsphere storage policy tagged to the service offering in case of VMware", since = "4.15") + @Param(description = "The vsphere storage policy tagged to the service offering in case of VMware", since = "4.15") private String vsphereStoragePolicy; @SerializedName(ApiConstants.ROOT_DISK_SIZE) @@ -209,35 +209,83 @@ public class ServiceOfferingResponse extends BaseResponseWithAnnotations { private Long rootDiskSize; @SerializedName(ApiConstants.DYNAMIC_SCALING_ENABLED) - @Param(description = "true if virtual machine needs to be dynamically scalable of cpu or memory", since = "4.16") + @Param(description = "True if Instance needs to be dynamically scalable of CPU or memory", since = "4.16") private Boolean dynamicScalingEnabled; @SerializedName(ApiConstants.DISK_OFFERING_STRICTNESS) @Param(description = "True/False to indicate the strictness of the disk offering association with the compute offering. " + - "When set to true, override of disk offering is not allowed when VM is deployed and " + - "change disk offering is not allowed for the ROOT disk after the VM is deployed", since = "4.17") + "When set to true, override of disk offering is not allowed when Instance is deployed and " + + "change disk offering is not allowed for the ROOT disk after the Instance is deployed", since = "4.17") private Boolean diskOfferingStrictness; @SerializedName(ApiConstants.DISK_OFFERING_ID) - @Param(description = "the ID of the disk offering to which service offering is linked", since = "4.17") + @Param(description = "The ID of the disk offering to which service offering is linked", since = "4.17") private String diskOfferingId; @SerializedName("diskofferingname") - @Param(description = "name of the disk offering", since = "4.17") + @Param(description = "Name of the disk offering", since = "4.17") private String diskOfferingName; @SerializedName("diskofferingdisplaytext") - @Param(description = "the display text of the disk offering", since = "4.17") + @Param(description = "The display text of the disk offering", since = "4.17") private String diskOfferingDisplayText; @SerializedName(ApiConstants.ENCRYPT_ROOT) - @Param(description = "true if virtual machine root disk will be encrypted on storage", since = "4.18") + @Param(description = "True if Instance root disk will be encrypted on storage", since = "4.18") private Boolean encryptRoot; + @SerializedName(ApiConstants.GPU_CARD_ID) + @Param(description = "the ID of the gpu card to which service offering is linked", since = "4.21") + private String gpuCardId; + + @SerializedName(ApiConstants.GPU_CARD_NAME) + @Param(description = "the name of the gpu card to which service offering is linked", since = "4.21") + private String gpuCardName; + + @SerializedName(ApiConstants.VGPU_PROFILE_ID) + @Param(description = "the ID of the vgpu profile to which service offering is linked", since = "4.21") + private String vgpuProfileId; + + @SerializedName(ApiConstants.VGPU_PROFILE_NAME) + @Param(description = "the name of the vgpu profile to which service offering is linked", since = "4.21") + private String vgpuProfileName; + + @SerializedName(ApiConstants.VIDEORAM) + @Param(description = "the video RAM size in MB") + private Long videoRam; + + @SerializedName(ApiConstants.MAXHEADS) + @Param(description = "the maximum number of display heads") + private Long maxHeads; + + @SerializedName(ApiConstants.MAXRESOLUTIONX) + @Param(description = "the maximum X resolution") + private Long maxResolutionX; + + @SerializedName(ApiConstants.MAXRESOLUTIONY) + @Param(description = "the maximum Y resolution") + private Long maxResolutionY; + + @SerializedName(ApiConstants.GPU_COUNT) + @Param(description = "the count of GPUs to attach ", since = "4.21") + private Integer gpuCount; + + @SerializedName(ApiConstants.GPU_DISPLAY) + @Param(description = "whether GPU device is used for display or not ", since = "4.21") + private Boolean gpuDisplay; + @SerializedName(ApiConstants.PURGE_RESOURCES) @Param(description = "Whether to cleanup VM and its associated resource upon expunge", since = "4.20") private Boolean purgeResources; + @SerializedName(ApiConstants.INSTANCE_LEASE_DURATION) + @Param(description = "Instance lease duration (in days) for service offering", since = "4.21.0") + private Integer leaseDuration; + + @SerializedName(ApiConstants.INSTANCE_LEASE_EXPIRY_ACTION) + @Param(description = "Action to be taken once lease is over", since = "4.21.0") + private String leaseExpiryAction; + public ServiceOfferingResponse() { } @@ -505,6 +553,22 @@ public void setCacheMode(String cacheMode) { this.cacheMode = cacheMode; } + public Integer getLeaseDuration() { + return leaseDuration; + } + + public void setLeaseDuration(Integer leaseDuration) { + this.leaseDuration = leaseDuration; + } + + public String getLeaseExpiryAction() { + return leaseExpiryAction; + } + + public void setLeaseExpiryAction(String leaseExpiryAction) { + this.leaseExpiryAction = leaseExpiryAction; + } + public String getVsphereStoragePolicy() { return vsphereStoragePolicy; } @@ -560,6 +624,86 @@ public String getDiskOfferingDisplayText() { public void setEncryptRoot(Boolean encrypt) { this.encryptRoot = encrypt; } + public String getVgpuProfileName() { + return vgpuProfileName; + } + + public void setVgpuProfileName(String vgpuProfileName) { + this.vgpuProfileName = vgpuProfileName; + } + + public Long getVideoRam() { + return videoRam; + } + + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; + } + + public Long getMaxHeads() { + return maxHeads; + } + + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; + } + + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + + public Long getMaxResolutionY() { + return maxResolutionY; + } + + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } + + public String getVgpuProfileId() { + return vgpuProfileId; + } + + public void setVgpuProfileId(String vgpuProfileId) { + this.vgpuProfileId = vgpuProfileId; + } + + public String getGpuCardName() { + return gpuCardName; + } + + public void setGpuCardName(String gpuCardName) { + this.gpuCardName = gpuCardName; + } + + public String getGpuCardId() { + return gpuCardId; + } + + public void setGpuCardId(String gpuCardId) { + this.gpuCardId = gpuCardId; + } + + public Integer getGpuCount() { + return gpuCount; + } + + public void setGpuCount(Integer gpuCount) { + this.gpuCount = gpuCount; + } + + public Boolean getGpuDisplay() { + return gpuDisplay; + } + + public void setGpuDisplay(Boolean gpuDisplay) { + this.gpuDisplay = gpuDisplay; + } + public void setPurgeResources(Boolean purgeResources) { this.purgeResources = purgeResources; } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ServiceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ServiceResponse.java index 9f5acc13f8bb..9d1470b64d70 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ServiceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ServiceResponse.java @@ -29,15 +29,15 @@ public class ServiceResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the service name") + @Param(description = "The service name") private String name; @SerializedName(ApiConstants.PROVIDER) - @Param(description = "the service provider name", responseObject = ProviderResponse.class) + @Param(description = "The service provider name", responseObject = ProviderResponse.class) private List providers; @SerializedName("capability") - @Param(description = "the list of capabilities", responseObject = CapabilityResponse.class) + @Param(description = "The list of capabilities", responseObject = CapabilityResponse.class) private List capabilities; public void setName(String name) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java index 4ae140ec573d..b121ef7ce61e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java @@ -31,23 +31,23 @@ @SuppressWarnings("unused") public class Site2SiteCustomerGatewayResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the vpn gateway ID") + @Param(description = "The VPN gateway ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the customer gateway") + @Param(description = "Name of the customer gateway") private String name; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "public ip address id of the customer gateway") + @Param(description = "Public IP address ID of the customer gateway") private String gatewayIp; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "guest ip of the customer gateway") + @Param(description = "Guest IP of the customer gateway") private String guestIp; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "guest cidr list of the customer gateway. Multiple entries are separated by a single comma character (,).") + @Param(description = "Guest CIDR list of the customer gateway. Multiple entries are separated by a single comma character (,).") private String guestCidrList; @SerializedName(ApiConstants.IPSEC_PSK) @@ -71,49 +71,57 @@ public class Site2SiteCustomerGatewayResponse extends BaseResponseWithAnnotation private Long espLifetime; @SerializedName(ApiConstants.DPD) - @Param(description = "if DPD is enabled for customer gateway") + @Param(description = "If DPD is enabled for customer gateway") private Boolean dpd; @SerializedName(ApiConstants.FORCE_ENCAP) - @Param(description = "if Force NAT Encapsulation is enabled for customer gateway") + @Param(description = "If Force NAT Encapsulation is enabled for customer gateway") private Boolean encap; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner") + @Param(description = "The owner") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id") + @Param(description = "The project ID") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name") + @Param(description = "The project name") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the owner") + @Param(description = "The domain ID of the owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the owner") + @Param(description = "The domain name of the owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "the domain path of the owner", since = "4.19.2.0") + @Param(description = "The domain path of the owner", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.REMOVED) - @Param(description = "the date and time the host was removed") + @Param(description = "The date and time the host was removed") private Date removed; @SerializedName(ApiConstants.SPLIT_CONNECTIONS) - @Param(description = "For IKEv2, whether to split multiple right subnet cidrs into multiple connection statements.") + @Param(description = "For IKEv2, whether to split multiple right subnet CIDRs into multiple connection statements.") private Boolean splitConnections; @SerializedName(ApiConstants.IKE_VERSION) - @Param(description = "Which IKE Version to use, one of ike (autoselect), ikev1, or ikev2. Defaults to ike") + @Param(description = "Which IKE Version to use, one of ike (autoselect), IKEv1, or IKEv2. Defaults to ike") private String ikeVersion; + @SerializedName(ApiConstants.OBSOLETE_PARAMETERS) + @Param(description = "Contains the list of obsolete/insecure cryptographic parameters that the vpn customer gateway is using.", since = "4.23.0") + private String obsoleteParameters; + + @SerializedName(ApiConstants.EXCLUDED_PARAMETERS) + @Param(description = "Contains the list of excluded/not allowed cryptographic parameters that the vpn customer gateway is using.", since = "4.23.0") + private String excludedParameters; + public void setId(String id) { this.id = id; } @@ -202,4 +210,12 @@ public void setDomainPath(String domainPath) { this.domainPath = domainPath; } + public void setContainsObsoleteParameters(String obsoleteParameters) { + this.obsoleteParameters = obsoleteParameters; + } + + public void setContainsExcludedParameters(String excludedParameters) { + this.excludedParameters = excludedParameters; + } + } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java index a9fd0f9703cc..e668b7d948fd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java @@ -31,29 +31,29 @@ @SuppressWarnings("unused") public class Site2SiteVpnConnectionResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the connection ID") + @Param(description = "The connection ID") private String id; @SerializedName(ApiConstants.S2S_VPN_GATEWAY_ID) - @Param(description = "the vpn gateway ID") + @Param(description = "The VPN gateway ID") private String vpnGatewayId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public IP address") + @Param(description = "The public IP address") //from VpnGateway private String ip; @SerializedName(ApiConstants.S2S_CUSTOMER_GATEWAY_ID) - @Param(description = "the customer gateway ID") + @Param(description = "The customer gateway ID") private String customerGatewayId; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "public ip address id of the customer gateway") + @Param(description = "Public IP address id of the customer gateway") //from CustomerGateway private String gatewayIp; @SerializedName(ApiConstants.CIDR_LIST) - @Param(description = "guest cidr list of the customer gateway. Multiple entries are separated by a single comma character (,).") + @Param(description = "Guest CIDR list of the customer gateway. Multiple entries are separated by a single comma character (,).") //from CustomerGateway private String guestCidrList; @@ -83,41 +83,41 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont private Long espLifetime; @SerializedName(ApiConstants.DPD) - @Param(description = "if DPD is enabled for customer gateway") + @Param(description = "If DPD is enabled for customer gateway") //from CustomerGateway private Boolean dpd; @SerializedName(ApiConstants.FORCE_ENCAP) - @Param(description = "if Force NAT Encapsulation is enabled for customer gateway") + @Param(description = "If Force NAT Encapsulation is enabled for customer gateway") //from CustomerGateway private Boolean encap; @SerializedName(ApiConstants.STATE) - @Param(description = "State of vpn connection") + @Param(description = "State of VPN connection") private String state; @SerializedName(ApiConstants.PASSIVE) - @Param(description = "State of vpn connection") + @Param(description = "State of VPN connection") private boolean passive; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner") + @Param(description = "The owner") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id") + @Param(description = "The project id") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name") + @Param(description = "The project name") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the owner") + @Param(description = "The domain id of the owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the owner") + @Param(description = "The domain name of the owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -125,23 +125,23 @@ public class Site2SiteVpnConnectionResponse extends BaseResponse implements Cont private String domainPath; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date and time the host was created") + @Param(description = "The date and time the host was created") private Date created; @SerializedName(ApiConstants.REMOVED) - @Param(description = "the date and time the host was removed") + @Param(description = "The date and time the host was removed") private Date removed; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is connection for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is connection for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.SPLIT_CONNECTIONS) - @Param(description = "Split multiple remote networks into multiple phase 2 SAs. Often used with Cisco some products.") + @Param(description = "Split multiple remote Networks into multiple phase 2 SAs. Often used with Cisco some products.") private Boolean splitConnections; @SerializedName(ApiConstants.IKE_VERSION) - @Param(description = "Which IKE Version to use, one of ike (autoselect), ikev1, or ikev2. Defaults to ike") + @Param(description = "Which IKE Version to use, one of ike (autoselect), IKEv1, or IKEv2. Defaults to ike") private String ikeVersion; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java index 1e63ba896c7b..9f997ca5bb7b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java @@ -31,39 +31,39 @@ @SuppressWarnings("unused") public class Site2SiteVpnGatewayResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the vpn gateway ID") + @Param(description = "The VPN gateway ID") private String id; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "the public IP address") + @Param(description = "The public IP address") private String ip; @SerializedName(ApiConstants.VPC_ID) - @Param(description = "the vpc id of this gateway") + @Param(description = "The VPC id of this gateway") private String vpcId; @SerializedName(ApiConstants.VPC_NAME) - @Param(description = "the vpc name of this gateway", since = "4.13.2") + @Param(description = "The VPC name of this gateway", since = "4.13.2") private String vpcName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner") + @Param(description = "The owner") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id") + @Param(description = "The project id") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name") + @Param(description = "The project name") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the owner") + @Param(description = "The domain id of the owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the owner") + @Param(description = "The domain name of the owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -71,11 +71,11 @@ public class Site2SiteVpnGatewayResponse extends BaseResponse implements Control private String domainPath; @SerializedName(ApiConstants.REMOVED) - @Param(description = "the date and time the host was removed") + @Param(description = "The date and time the host was removed") private Date removed; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is vpn gateway for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is VPN gateway for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java index bfa1cca1ca08..3a40f3dfa982 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java @@ -16,55 +16,63 @@ // under the License. package org.apache.cloudstack.api.response; -import java.util.LinkedHashSet; -import java.util.Set; - +import com.cloud.serializer.Param; +import com.cloud.storage.snapshot.SnapshotPolicy; +import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponseWithTagInformation; import org.apache.cloudstack.api.EntityReference; -import com.cloud.serializer.Param; -import com.cloud.storage.snapshot.SnapshotPolicy; -import com.google.gson.annotations.SerializedName; +import java.util.LinkedHashSet; +import java.util.Set; @EntityReference(value = SnapshotPolicy.class) public class SnapshotPolicyResponse extends BaseResponseWithTagInformation { @SerializedName("id") - @Param(description = "the ID of the snapshot policy") + @Param(description = "The ID of the Snapshot policy") private String id; @SerializedName("volumeid") - @Param(description = "the ID of the disk volume") + @Param(description = "The ID of the disk volume") private String volumeId; + @SerializedName("volumename") + @Param(description = "the name of the disk volume") + private String volumeName; + @SerializedName("schedule") - @Param(description = "time the snapshot is scheduled to be taken.") + @Param(description = "Time the Snapshot is scheduled to be taken.") private String schedule; @SerializedName("intervaltype") - @Param(description = "the interval type of the snapshot policy") + @Param(description = "The interval type of the Snapshot policy") private short intervalType; @SerializedName("maxsnaps") - @Param(description = "maximum number of snapshots retained") + @Param(description = "Maximum number of Snapshots retained") private int maxSnaps; @SerializedName("timezone") - @Param(description = "the time zone of the snapshot policy") + @Param(description = "The time zone of the Snapshot policy") private String timezone; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is this policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is this policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.ZONE) @Param(description = "The list of zones in which snapshot backup is scheduled", responseObject = ZoneResponse.class, since = "4.19.0") protected Set zones; + @SerializedName(ApiConstants.STORAGE) + @Param(description = "The list of pools in which snapshot backup is scheduled", responseObject = StoragePoolResponse.class, since = "4.21.0") + protected Set storagePools; + public SnapshotPolicyResponse() { tags = new LinkedHashSet(); zones = new LinkedHashSet<>(); + storagePools = new LinkedHashSet<>(); } public String getId() { @@ -83,6 +91,10 @@ public void setVolumeId(String volumeId) { this.volumeId = volumeId; } + public void setVolumeName(String volumeName) { + this.volumeName = volumeName; + } + public String getSchedule() { return schedule; } @@ -130,4 +142,6 @@ public void setTags(Set tags) { public void setZones(Set zones) { this.zones = zones; } + + public void setStoragePools(Set pools) { this.storagePools = pools; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java index 9f7a7f42dec9..3db6fd87ed59 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java @@ -32,19 +32,19 @@ @EntityReference(value = Snapshot.class) public class SnapshotResponse extends BaseResponseWithTagInformation implements ControlledViewEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "ID of the snapshot") + @Param(description = "ID of the Snapshot") private String id; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the snapshot") + @Param(description = "The Account associated with the Snapshot") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the snapshot's account") + @Param(description = "The domain ID of the Snapshot's Account") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the snapshot's account") + @Param(description = "The domain name of the Snapshot's Account") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -52,15 +52,15 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements private String domainPath; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the snapshot") + @Param(description = "The project id of the Snapshot") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the snapshot") + @Param(description = "The project name of the Snapshot") private String projectName; @SerializedName(ApiConstants.SNAPSHOT_TYPE) - @Param(description = "the type of the snapshot") + @Param(description = "The type of the Snapshot") private String snapshotType; @SerializedName(ApiConstants.VOLUME_ID) @@ -68,11 +68,11 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements private String volumeId; @SerializedName(ApiConstants.VOLUME_NAME) - @Param(description = "name of the disk volume") + @Param(description = "Name of the disk volume") private String volumeName; @SerializedName("volumetype") - @Param(description = "type of the disk volume") + @Param(description = "Type of the disk volume") private String volumeType; @SerializedName(ApiConstants.VOLUME_STATE) @@ -80,23 +80,23 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements private String volumeState; @SerializedName(ApiConstants.CREATED) - @Param(description = " the date the snapshot was created") + @Param(description = "The date the Snapshot was created") private Date created; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the snapshot") + @Param(description = "Name of the Snapshot") private String name; @SerializedName(ApiConstants.INTERVAL_TYPE) - @Param(description = "valid types are hourly, daily, weekly, monthy, template, and none.") + @Param(description = "Valid types are hourly, daily, weekly, monthy, Template, and none.") private String intervalType; @SerializedName(ApiConstants.LOCATION_TYPE) - @Param(description = "valid location types are primary and secondary.") + @Param(description = "Valid location types are primary and secondary.") private String locationType; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage") + @Param(description = "The state of the Snapshot. BackedUp means that Snapshot is ready to be used; Creating - the Snapshot is being allocated on the primary storage; BackingUp - the Snapshot is being backed up on secondary storage") private Snapshot.State state; @SerializedName(ApiConstants.STATUS) @@ -104,11 +104,15 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements private String status; @SerializedName(ApiConstants.PHYSICAL_SIZE) - @Param(description = "physical size of backedup snapshot on image store") + @Param(description = "Physical size of backed up Snapshot on image store") private long physicalSize; + @SerializedName(ApiConstants.CHAIN_SIZE) + @Param(description = "chain size of snapshot including all parent snapshots. Shown only for incremental snapshots if snapshot.show.chain.size setting is set to true", since = "4.21.0") + private Long chainSize; + @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "id of the availability zone") + @Param(description = "ID of the availability zone") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) @@ -116,19 +120,19 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements private String zoneName; @SerializedName(ApiConstants.REVERTABLE) - @Param(description = "indicates whether the underlying storage supports reverting the volume to this snapshot") + @Param(description = "Indicates whether the underlying storage supports reverting the volume to this Snapshot") private boolean revertable; @SerializedName(ApiConstants.OS_TYPE_ID) - @Param(description = "id of the os on volume", since = "4.10") + @Param(description = "ID of the os on volume", since = "4.10") private String osTypeId; @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "display name of the os on volume") + @Param(description = "Display name of the os on volume") private String osDisplayName; @SerializedName(ApiConstants.VIRTUAL_SIZE) - @Param(description = "virtual size of backedup snapshot on image store") + @Param(description = "Virtual size of backedup Snapshot on image store") private long virtualSize; @SerializedName(ApiConstants.DATASTORE_ID) @@ -151,6 +155,14 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements @Param(description = "download progress of a snapshot", since = "4.19.0") private Map downloadDetails; + @SerializedName("parent") + @Param(description = "The parent ID of the Snapshot", since = "4.22.1") + private String parent; + + @SerializedName("parentname") + @Param(description = "The parent name of the Snapshot", since = "4.22.1") + private String parentName; + public SnapshotResponse() { tags = new LinkedHashSet(); } @@ -244,6 +256,10 @@ public void setPhysicalSize(long physicalSize) { this.physicalSize = physicalSize; } + public void setChainSize(long chainSize) { + this.chainSize = chainSize; + } + @Override public void setProjectId(String projectId) { this.projectId = projectId; @@ -305,4 +321,12 @@ public void setDatastoreType(String datastoreType) { public void setDownloadDetails(Map downloadDetails) { this.downloadDetails = downloadDetails; } + + public void setParent(String parent) { + this.parent = parent; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java index 7bc8ee8cba26..d8ce673d335f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java @@ -26,19 +26,19 @@ public class SnapshotScheduleResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the ID of the snapshot schedule") + @Param(description = "The ID of the Snapshot schedule") private String id; @SerializedName("volumeid") - @Param(description = "the volume ID the snapshot schedule applied for") + @Param(description = "The volume ID the Snapshot schedule applied for") private String volumeId; @SerializedName("snapshotpolicyid") - @Param(description = "the snapshot policy ID used by the snapshot schedule") + @Param(description = "The Snapshot policy ID used by the Snapshot schedule") private String snapshotPolicyId; @SerializedName("scheduled") - @Param(description = "time the snapshot is scheduled to be taken") + @Param(description = "Time the Snapshot is scheduled to be taken") private Date scheduled; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java index aa729f123b44..d4add82f666c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SslCertResponse.java @@ -27,8 +27,6 @@ import org.apache.cloudstack.network.tls.SslCert; import com.cloud.serializer.Param; -//import org.apache.cloudstack.api.EntityReference; - @EntityReference(value = SslCert.class) public class SslCertResponse extends BaseResponse { @@ -37,35 +35,35 @@ public class SslCertResponse extends BaseResponse { private String id; @SerializedName(ApiConstants.CERTIFICATE) - @Param(description = "certificate") + @Param(description = "Certificate") private String certificate; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "account for the certificate") + @Param(description = "Account for the certificate") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the certificate") + @Param(description = "The project id of the certificate") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the certificate") + @Param(description = "The project name of the certificate") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the network owner") + @Param(description = "The domain id of the Network owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the network owner") + @Param(description = "The domain name of the Network owner") private String domain; @SerializedName(ApiConstants.CERTIFICATE_CHAIN) - @Param(description = "certificate chain") + @Param(description = "Certificate chain") private String certchain; @SerializedName(ApiConstants.CERTIFICATE_FINGERPRINT) - @Param(description = "certificate fingerprint") + @Param(description = "Certificate fingerprint") private String fingerprint; @SerializedName(ApiConstants.LOAD_BALANCER_RULE_LIST) @@ -73,7 +71,7 @@ public class SslCertResponse extends BaseResponse { List lbIds; @SerializedName(ApiConstants.NAME) - @Param(description = "name") + @Param(description = "Name") private String name; public SslCertResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StaticRouteResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StaticRouteResponse.java index 51f8a1303832..ed0e050b9652 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StaticRouteResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StaticRouteResponse.java @@ -31,43 +31,51 @@ @SuppressWarnings("unused") public class StaticRouteResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of static route") + @Param(description = "The ID of static route") private String id; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the static route") + @Param(description = "The state of the static route") private String state; @SerializedName(ApiConstants.VPC_ID) @Param(description = "VPC the static route belongs to") private String vpcId; - @SerializedName(ApiConstants.GATEWAY_ID) + @SerializedName(ApiConstants.VPC_GATEWAY_ID) @Param(description = "VPC gateway the route is created for") - private String gatewayId; + private String vpcGatewayId; + + @SerializedName(ApiConstants.VPC_GATEWAY_IP) + @Param(description = "IP of VPC gateway the route is created for", since = "4.21.0") + private String vpcGatewayIp; + + @SerializedName(ApiConstants.NEXT_HOP) + @Param(description = "Next hop of the static route", since = "4.21.0") + private String nextHop; @SerializedName(ApiConstants.CIDR) - @Param(description = "static route CIDR") + @Param(description = "Static route CIDR") private String cidr; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the static route") + @Param(description = "The Account associated with the static route") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the static route") + @Param(description = "The project ID of the static route") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the static route") + @Param(description = "The project name of the static route") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain associated with the static route") + @Param(description = "The ID of the domain associated with the static route") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the static route") + @Param(description = "The domain associated with the static route") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -75,7 +83,7 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit private String domainPath; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with static route", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with static route", responseObject = ResourceTagResponse.class) private List tags; @Override @@ -95,8 +103,16 @@ public void setVpcId(String vpcId) { this.vpcId = vpcId; } - public void setGatewayId(String gatewayId) { - this.gatewayId = gatewayId; + public void setVpcGatewayId(String vpcGatewayId) { + this.vpcGatewayId = vpcGatewayId; + } + + public void setVpcGatewayIp(String vpcGatewayIp) { + this.vpcGatewayIp = vpcGatewayIp; + } + + public void setNextHop(String nextHop) { + this.nextHop = nextHop; } public void setCidr(String cidr) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java index 5dd76fa5eef6..232daa4f4a9a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StatsResponse.java @@ -27,59 +27,59 @@ public class StatsResponse extends BaseResponse { @SerializedName("timestamp") - @Param(description = "the time when the VM stats were collected. The format is \"yyyy-MM-dd hh:mm:ss\"") + @Param(description = "The time when the Instance stats were collected. The format is 'yyyy-MM-dd hh:mm:ss'") private Date timestamp; @SerializedName("cpuused") - @Param(description = "the amount (percentage) of the VM's CPU currently used") + @Param(description = "The amount (percentage) of the Instance's CPU currently used") private String cpuUsed; @SerializedName(ApiConstants.DISK_IO_READ) - @Param(description = "the VM's disk number of read requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration") + @Param(description = "The Instance's disk number of read requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration") protected Long diskIORead; @SerializedName(ApiConstants.DISK_IO_WRITE) - @Param(description = "the VM's disk number of write requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration") + @Param(description = "The Instance's disk number of write requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration") protected Long diskIOWrite; @SerializedName(ApiConstants.DISK_IO_PSTOTAL) - @Param(description = "the total disk iops since the last stats retrieval") + @Param(description = "The total disk IOPS since the last stats retrieval") protected Long diskIopsTotal = 0L; @SerializedName(ApiConstants.DISK_KBS_READ) - @Param(description = "the VM's disk read in KiB") + @Param(description = "The Instance's disk read in KiB") private Long diskKbsRead; @SerializedName(ApiConstants.DISK_KBS_WRITE) - @Param(description = "the VM's disk write in KiB") + @Param(description = "The Instance's disk write in KiB") private Long diskKbsWrite; @SerializedName("memoryintfreekbs") - @Param(description = "the VM's free memory in KB or -1 if it cannot be gathered") + @Param(description = "The Instance's free memory in KB or -1 if it cannot be gathered") private Long memoryIntFreeKBs; @SerializedName("memorykbs") - @Param(description = "the memory used by the VM in KB") + @Param(description = "The memory used by the Instance in KB") private Long memoryKBs; @SerializedName("memorytargetkbs") - @Param(description = "the target memory in VM (KB)") + @Param(description = "The target memory in Instance (KB)") private Long memoryTargetKBs; @SerializedName("networkkbsread") - @Param(description = "the incoming network traffic on the VM in KiB") + @Param(description = "The incoming Network traffic on the Instance in KiB") protected Long networkKbsRead; @SerializedName("networkkbswrite") - @Param(description = "the outgoing network traffic on the host in KiB") + @Param(description = "The outgoing Network traffic on the host in KiB") protected Long networkKbsWrite; @SerializedName("networkread") - @Param(description = "the amount of downloaded data by the VM in MiB") + @Param(description = "The amount of downloaded data by the Instance in MiB") protected String networkRead; @SerializedName("networkwrite") - @Param(description = "the amount of uploaded data by the VM in MiB") + @Param(description = "The amount of uploaded data by the Instance in MiB") protected String networkWrite; public void setTimestamp(Date timestamp) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StorageAccessGroupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StorageAccessGroupResponse.java new file mode 100644 index 000000000000..a6324dd62a9f --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/StorageAccessGroupResponse.java @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import com.cloud.serializer.Param; + +public class StorageAccessGroupResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of the storage access group") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "the name of the storage access group") + private String name; + + @SerializedName("hosts") + @Param(description = "List of Hosts in the Storage Access Group") + private ListResponse hostResponseList; + + @SerializedName("clusters") + @Param(description = "List of Clusters in the Storage Access Group") + private ListResponse clusterResponseList; + + @SerializedName("pods") + @Param(description = "List of Pods in the Storage Access Group") + private ListResponse podResponseList; + + @SerializedName("zones") + @Param(description = "List of Zones in the Storage Access Group") + private ListResponse zoneResponseList; + + @SerializedName("storagepools") + @Param(description = "List of Storage Pools in the Storage Access Group") + private ListResponse storagePoolResponseList; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ListResponse getHostResponseList() { + return hostResponseList; + } + + public void setHostResponseList(ListResponse hostResponseList) { + this.hostResponseList = hostResponseList; + } + + public ListResponse getClusterResponseList() { + return clusterResponseList; + } + + public void setClusterResponseList(ListResponse clusterResponseList) { + this.clusterResponseList = clusterResponseList; + } + + public ListResponse getPodResponseList() { + return podResponseList; + } + + public void setPodResponseList(ListResponse podResponseList) { + this.podResponseList = podResponseList; + } + + public ListResponse getZoneResponseList() { + return zoneResponseList; + } + + public void setZoneResponseList(ListResponse zoneResponseList) { + this.zoneResponseList = zoneResponseList; + } + + public ListResponse getStoragePoolResponseList() { + return storagePoolResponseList; + } + + public void setStoragePoolResponseList(ListResponse storagePoolResponseList) { + this.storagePoolResponseList = storagePoolResponseList; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java index 1dc60ce67f39..963d4d18ba60 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java @@ -28,39 +28,39 @@ @EntityReference(value = StorageNetworkIpRange.class) public class StorageNetworkIpRangeResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the uuid of storage network IP range.") + @Param(description = "The UUID of storage Network IP range.") private String uuid; @SerializedName(ApiConstants.VLAN) - @Param(description = "the ID or VID of the VLAN.") + @Param(description = "The ID or VID of the VLAN.") private Integer vlan; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod uuid for the storage network IP range") + @Param(description = "The Pod UUID for the storage Network IP range") private String podUuid; @SerializedName(ApiConstants.START_IP) - @Param(description = "the start ip of the storage network IP range") + @Param(description = "The start IP of the storage Network IP range") private String startIp; @SerializedName(ApiConstants.END_IP) - @Param(description = "the end ip of the storage network IP range") + @Param(description = "The end IP of the storage Network IP range") private String endIp; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway of the storage network IP range") + @Param(description = "The gateway of the storage Network IP range") private String gateway; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the network uuid of storage network IP range") + @Param(description = "The Network UUID of storage Network IP range") private String networkUuid; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone uuid of the storage network IP range") + @Param(description = "The Zone UUID of the storage Network IP range") private String zoneUuid; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the netmask of the storage network IP range") + @Param(description = "The netmask of the storage Network IP range") private String netmask; public void setUuid(String uuid) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StoragePoolResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StoragePoolResponse.java index 676803ea86b6..25e67115ab4a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StoragePoolResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StoragePoolResponse.java @@ -30,71 +30,76 @@ @EntityReference(value = StoragePool.class) public class StoragePoolResponse extends BaseResponseWithAnnotations { @SerializedName("id") - @Param(description = "the ID of the storage pool") + @Param(description = "The ID of the storage pool") private String id; @SerializedName("zoneid") - @Param(description = "the Zone ID of the storage pool") + @Param(description = "The Zone ID of the storage pool") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the storage pool") + @Param(description = "The Zone name of the storage pool") private String zoneName; @SerializedName("podid") - @Param(description = "the Pod ID of the storage pool") + @Param(description = "The Pod ID of the storage pool") private String podId; @SerializedName("podname") - @Param(description = "the Pod name of the storage pool") + @Param(description = "The Pod name of the storage pool") private String podName; @SerializedName("name") - @Param(description = "the name of the storage pool") + @Param(description = "The name of the storage pool") private String name; @SerializedName("ipaddress") - @Param(description = "the IP address of the storage pool") + @Param(description = "The IP address of the storage pool") private String ipAddress; @SerializedName("path") - @Param(description = "the storage pool path") + @Param(description = "The storage pool path") private String path; @SerializedName("created") - @Param(description = "the date and time the storage pool was created") + @Param(description = "The date and time the storage pool was created") private Date created; @SerializedName("type") - @Param(description = "the storage pool type") + @Param(description = "The storage pool type") private String type; @SerializedName("clusterid") - @Param(description = "the ID of the cluster for the storage pool") + @Param(description = "The ID of the cluster for the storage pool") private String clusterId; @SerializedName("clustername") - @Param(description = "the name of the cluster for the storage pool") + @Param(description = "The name of the cluster for the storage pool") private String clusterName; + @SerializedName(ApiConstants.CAPACITY_BYTES) + @Param(description = "bytes CloudStack can provision from this storage pool", since = "4.22.0") + private Long capacityBytes; + + @Deprecated(since = "4.22.0") @SerializedName("disksizetotal") - @Param(description = "the total disk size of the storage pool") + @Param(description = "The total disk size of the storage pool") private Long diskSizeTotal; @SerializedName("disksizeallocated") - @Param(description = "the host's currently allocated disk size") + @Param(description = "The pool's currently allocated disk size") private Long diskSizeAllocated; @SerializedName("disksizeused") - @Param(description = "the host's currently used disk size") + @Param(description = "The pool's currently used disk size") private Long diskSizeUsed; - @SerializedName("capacityiops") + @SerializedName(ApiConstants.CAPACITY_IOPS) @Param(description = "IOPS CloudStack can provision from this storage pool") private Long capacityIops; @SerializedName("allocatediops") - @Param(description = "total min IOPS currently in use by volumes") + @Param(description = "Total min IOPS currently in use by volumes") private Long allocatedIops; @SerializedName(ApiConstants.USED_IOPS) @@ -106,9 +111,13 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations { private Map customStats; @SerializedName("tags") - @Param(description = "the tags for the storage pool") + @Param(description = "The tags for the storage pool") private String tags; + @SerializedName(ApiConstants.STORAGE_ACCESS_GROUPS) + @Param(description = "the storage access groups for the storage pool", since = "4.21.0") + private String storageAccessGroups; + @SerializedName(ApiConstants.NFS_MOUNT_OPTIONS) @Param(description = "the nfs mount options for the storage pool", since = "4.19.1") private String nfsMountOpts; @@ -118,23 +127,23 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations { private Boolean isTagARule; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the storage pool") + @Param(description = "The state of the storage pool") private StoragePoolStatus state; @SerializedName(ApiConstants.SCOPE) - @Param(description = "the scope of the storage pool") + @Param(description = "The scope of the storage pool") private String scope; @SerializedName("overprovisionfactor") - @Param(description = "the overprovisionfactor for the storage pool", since = "4.4") + @Param(description = "The overprovisionfactor for the storage pool", since = "4.4") private String overProvisionFactor; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor type of the storage pool") + @Param(description = "The hypervisor type of the storage pool") private String hypervisor; @SerializedName("suitableformigration") - @Param(description = "true if this pool is suitable to migrate a volume," + " false otherwise") + @Param(description = "True if this pool is suitable to migrate a volume," + " false otherwise") private Boolean suitableForMigration; @SerializedName("provider") @@ -142,13 +151,17 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations { private String provider; @SerializedName(ApiConstants.STORAGE_CAPABILITIES) - @Param(description = "the storage pool capabilities") + @Param(description = "The storage pool capabilities") private Map caps; @SerializedName(ApiConstants.MANAGED) @Param(description = "whether this pool is managed or not") private Boolean managed; + @SerializedName(ApiConstants.DETAILS) + @Param(description = "the storage pool details") + private Map details; + public Map getCaps() { return caps; } @@ -280,6 +293,14 @@ public void setClusterName(String clusterName) { this.clusterName = clusterName; } + public Long getCapacityBytes() { + return capacityBytes; + } + + public void setCapacityBytes(Long capacityBytes) { + this.capacityBytes = capacityBytes; + } + public Long getDiskSizeTotal() { return diskSizeTotal; } @@ -340,6 +361,14 @@ public void setTags(String tags) { this.tags = tags; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + public Boolean getIsTagARule() { return isTagARule; } @@ -407,4 +436,12 @@ public Boolean getManaged() { public void setManaged(Boolean managed) { this.managed = managed; } + + public Map getDetails() { + return details; + } + + public void setDetails(Map details) { + this.details = details; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StorageProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StorageProviderResponse.java index d68979a5bcde..e063b88335a5 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StorageProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StorageProviderResponse.java @@ -26,11 +26,11 @@ public class StorageProviderResponse extends BaseResponse { @SerializedName("name") - @Param(description = "the name of the storage provider") + @Param(description = "The name of the storage provider") private String name; @SerializedName("type") - @Param(description = "the type of the storage provider: primary or image provider") + @Param(description = "The type of the storage provider: primary or image provider") private String type; /** diff --git a/api/src/main/java/org/apache/cloudstack/api/response/StorageTagResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/StorageTagResponse.java index 7d8db39b4e92..fc6527f7e4c8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/StorageTagResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/StorageTagResponse.java @@ -22,15 +22,15 @@ public class StorageTagResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the ID of the storage tag") + @Param(description = "The ID of the storage tag") private String id; @SerializedName("poolid") - @Param(description = "the pool ID of the storage tag") + @Param(description = "The pool ID of the storage tag") private long poolId; @SerializedName("name") - @Param(description = "the name of the storage tag") + @Param(description = "The name of the storage tag") private String name; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SuccessResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SuccessResponse.java index 0dde6d0e4230..3c03fb7b3bc4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SuccessResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SuccessResponse.java @@ -24,11 +24,11 @@ public class SuccessResponse extends BaseResponse { @SerializedName("success") - @Param(description = "true if operation is executed successfully") + @Param(description = "True if operation is executed successfully") private Boolean success = true; @SerializedName("displaytext") - @Param(description = "any text associated with the success or failure") + @Param(description = "Any text associated with the success or failure") private String displayText; public Boolean getSuccess() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java index 5e0638080b9e..5f94537d4dbd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java @@ -27,27 +27,27 @@ */ public class SystemVmInstanceResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the ID of the system VM") + @Param(description = "The ID of the System VM") private String id; @SerializedName("systemvmtype") - @Param(description = "the system VM type") + @Param(description = "The System VM type") private String systemVmType; @SerializedName("name") - @Param(description = "the name of the system VM") + @Param(description = "The name of the System VM") private String name; @SerializedName("hostid") - @Param(description = "the host ID for the system VM") + @Param(description = "The host ID for the System VM") private String hostId; @SerializedName("state") - @Param(description = "the state of the system VM") + @Param(description = "The state of the System VM") private String state; @SerializedName("role") - @Param(description = "the role of the system VM") + @Param(description = "The role of the System VM") private String role; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java index 31a8b731491c..a3ed88c27356 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java @@ -31,151 +31,147 @@ @EntityReference(value = VirtualMachine.class) public class SystemVmResponse extends BaseResponseWithAnnotations { @SerializedName("id") - @Param(description = "the ID of the system VM") + @Param(description = "The ID of the System VM") private String id; @SerializedName("systemvmtype") - @Param(description = "the system VM type") + @Param(description = "The System VM type") private String systemVmType; - @SerializedName("jobid") - @Param(description = "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.") - private String jobId; - - @SerializedName("jobstatus") - @Param(description = "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.") - private Integer jobStatus; - @SerializedName("zoneid") - @Param(description = "the Zone ID for the system VM") + @Param(description = "The Zone ID for the System VM") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name for the system VM") + @Param(description = "The Zone name for the System VM") private String zoneName; @SerializedName("dns1") - @Param(description = "the first DNS for the system VM") + @Param(description = "The first DNS for the System VM") private String dns1; @SerializedName("dns2") - @Param(description = "the second DNS for the system VM") + @Param(description = "The second DNS for the System VM") private String dns2; @SerializedName("networkdomain") - @Param(description = "the network domain for the system VM") + @Param(description = "The Network domain for the System VM") private String networkDomain; @SerializedName("gateway") - @Param(description = "the gateway for the system VM") + @Param(description = "The gateway for the System VM") private String gateway; @SerializedName("name") - @Param(description = "the name of the system VM") + @Param(description = "The name of the System VM") private String name; @SerializedName("podid") - @Param(description = "the Pod ID for the system VM") + @Param(description = "The Pod ID for the System VM") private String podId; @SerializedName("podname") - @Param(description = "the Pod name for the system VM", since = "4.13.2") + @Param(description = "The Pod name for the System VM", since = "4.13.2") private String podName; @SerializedName("hostid") - @Param(description = "the host ID for the system VM") + @Param(description = "The host ID for the System VM") private String hostId; @SerializedName("hostname") - @Param(description = "the hostname for the system VM") + @Param(description = "The hostname for the System VM") private String hostName; @SerializedName(ApiConstants.HOST_CONTROL_STATE) - @Param(description = "the control state of the host for the system VM") + @Param(description = "The control state of the host for the System VM") private String hostControlState; @SerializedName("hypervisor") - @Param(description = "the hypervisor on which the template runs") + @Param(description = "The hypervisor on which the Template runs") private String hypervisor; @SerializedName(ApiConstants.PRIVATE_IP) - @Param(description = "the private IP address for the system VM") + @Param(description = "The private IP address for the System VM") private String privateIp; @SerializedName(ApiConstants.PRIVATE_MAC_ADDRESS) - @Param(description = "the private MAC address for the system VM") + @Param(description = "The private MAC address for the System VM") private String privateMacAddress; @SerializedName(ApiConstants.PRIVATE_NETMASK) - @Param(description = "the private netmask for the system VM") + @Param(description = "The private netmask for the System VM") private String privateNetmask; @SerializedName(ApiConstants.LINK_LOCAL_IP) - @Param(description = "the link local IP address for the system vm") + @Param(description = "The Control IP address for the System VM") private String linkLocalIp; @SerializedName(ApiConstants.LINK_LOCAL_MAC_ADDRESS) - @Param(description = "the link local MAC address for the system vm") + @Param(description = "The link local MAC address for the System VM") private String linkLocalMacAddress; @SerializedName(ApiConstants.LINK_LOCAL_MAC_NETMASK) - @Param(description = "the link local netmask for the system vm") + @Param(description = "The link local netmask for the System VM") private String linkLocalNetmask; @SerializedName("publicip") - @Param(description = "the public IP address for the system VM") + @Param(description = "The public IP address for the System VM") private String publicIp; @SerializedName("publicmacaddress") - @Param(description = "the public MAC address for the system VM") + @Param(description = "The public MAC address for the System VM") private String publicMacAddress; @SerializedName("publicnetmask") - @Param(description = "the public netmask for the system VM") + @Param(description = "The public netmask for the System VM") private String publicNetmask; + @SerializedName("storageip") + @Param(description = "the ip address for the system VM on the storage network") + private String storageIp; + @SerializedName("templateid") - @Param(description = "the template ID for the system VM") + @Param(description = "The Template ID for the System VM") private String templateId; @SerializedName("templatename") - @Param(description = "the template name for the system VM", since = "4.13.2") + @Param(description = "The Template name for the System VM", since = "4.13.2") private String templateName; @SerializedName("created") - @Param(description = "the date and time the system VM was created") + @Param(description = "The date and time the System VM was created") private Date created; @SerializedName("state") - @Param(description = "the state of the system VM") + @Param(description = "The state of the System VM") private String state; @SerializedName("agentstate") - @Param(description = "the agent state of the system VM", since = "4.13.1") + @Param(description = "The agent state of the System VM", since = "4.13.1") private String agentState; @SerializedName("activeviewersessions") - @Param(description = "the number of active console sessions for the console proxy system vm") + @Param(description = "The number of active console sessions for the console proxy System VM") private Integer activeViewerSessions; @SerializedName("guestvlan") - @Param(description = "guest vlan range") + @Param(description = "Guest VLAN range") private String guestVlan; @SerializedName("publicvlan") - @Param(description = "public vlan range") + @Param(description = "Public VLAN range") private List publicVlan; @SerializedName("disconnected") - @Param(description = "the last disconnected date of host", since = "4.13.1") + @Param(description = "The last disconnected date of host", since = "4.13.1") private Date disconnectedOn; @SerializedName("version") - @Param(description = "the systemvm agent version", since = "4.13.1") + @Param(description = "The systemvm agent version", since = "4.13.1") private String version; @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) - @Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.") + @Param(description = "True if the Instance contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory.") private Boolean isDynamicallyScalable; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) @@ -186,6 +182,10 @@ public class SystemVmResponse extends BaseResponseWithAnnotations { @Param(description = "the name of the service offering of the system virtual machine.") private String serviceOfferingName; + @SerializedName(ApiConstants.ARCH) + @Param(description = "CPU arch of the system VM", since = "4.20.1") + private String arch; + @Override public String getObjectId() { return this.getId(); @@ -359,6 +359,14 @@ public void setPublicNetmask(String publicNetmask) { this.publicNetmask = publicNetmask; } + public String getStorageIp() { + return storageIp; + } + + public void setStorageIp(String storageIp) { + this.storageIp = storageIp; + } + public String getTemplateId() { return templateId; } @@ -490,4 +498,8 @@ public String getServiceOfferingName() { public void setServiceOfferingName(String serviceOfferingName) { this.serviceOfferingName = serviceOfferingName; } + + public void setArch(String arch) { + this.arch = arch; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TemplateOVFPropertyResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TemplateOVFPropertyResponse.java index ebe0d1cfd0db..715d0e980ef4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TemplateOVFPropertyResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TemplateOVFPropertyResponse.java @@ -27,43 +27,43 @@ public class TemplateOVFPropertyResponse extends BaseResponse { @SerializedName(ApiConstants.KEY) - @Param(description = "the ovf property key") + @Param(description = "The ovf property key") private String key; @SerializedName(ApiConstants.TYPE) - @Param(description = "the ovf property type") + @Param(description = "The ovf property type") private String type; @SerializedName(ApiConstants.VALUE) - @Param(description = "the ovf property value") + @Param(description = "The ovf property value") private String value; @SerializedName(ApiConstants.PASSWORD) - @Param(description = "is the ovf property a password") + @Param(description = "Is the ovf property a password") private Boolean password; @SerializedName(ApiConstants.QUALIFIERS) - @Param(description = "the ovf property qualifiers") + @Param(description = "The ovf property qualifiers") private String qualifiers; @SerializedName(ApiConstants.USER_CONFIGURABLE) - @Param(description = "is the ovf property user configurable") + @Param(description = "Is the ovf property user configurable") private Boolean userConfigurable; @SerializedName(ApiConstants.LABEL) - @Param(description = "the ovf property label") + @Param(description = "The ovf property label") private String label; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the ovf property label") + @Param(description = "The ovf property label") private String description; @SerializedName(ApiConstants.INDEX) - @Param(description = "the ovf property index") + @Param(description = "The ovf property index") private Integer index; @SerializedName(ApiConstants.CATEGORY) - @Param(description = "the ovf property category") + @Param(description = "The ovf property category") private String category; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java index 5f0b9a58c7c8..c489deaffe5b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java @@ -31,23 +31,23 @@ @SuppressWarnings("unused") public class TemplatePermissionsResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the template ID") + @Param(description = "The Template ID") private String id; @SerializedName(ApiConstants.IS_PUBLIC) - @Param(description = "true if this template is a public template, false otherwise") + @Param(description = "True if this Template is a public Template, false otherwise") private Boolean publicTemplate; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain to which the template belongs") + @Param(description = "The ID of the domain to which the Template belongs") private String domainId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the list of accounts the template is available for") + @Param(description = "The list of Accounts the Template is available for") private List accountNames; @SerializedName(ApiConstants.PROJECT_IDS) - @Param(description = "the list of projects the template is available for") + @Param(description = "The list of projects the Template is available for") private List projectIds; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TemplateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TemplateResponse.java index 98e96091d8c7..2e706586f01d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TemplateResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TemplateResponse.java @@ -36,151 +36,153 @@ @SuppressWarnings("unused") public class TemplateResponse extends BaseResponseWithTagInformation implements ControlledViewEntityResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the template ID") + @Param(description = "The Template ID") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the template name") + @Param(description = "The Template name") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "the template display text") + @Param(description = "The Template display text") private String displayText; @SerializedName(ApiConstants.IS_PUBLIC) // propName="public" (FIXME: this used to be part of Param annotation, do we need it?) - @Param(description = "true if this template is a public template, false otherwise") + @Param(description = "True if this Template is a public Template, false otherwise") private boolean isPublic; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this template was created") + @Param(description = "The date this Template was created") private Date created; @SerializedName(ApiConstants.REMOVED) - @Param(description = "the date this template was removed") + @Param(description = "The date this Template was removed") private Date removed; @SerializedName(ApiConstants.IS_READY) // propName="ready" (FIXME: this used to be part of Param annotation, do we need it?) - @Param(description = "true if the template is ready to be deployed from, false otherwise.") + @Param(description = "True if the Template is ready to be deployed from, false otherwise.") private boolean isReady; @SerializedName(ApiConstants.PASSWORD_ENABLED) - @Param(description = "true if the reset password feature is enabled, false otherwise") + @Param(description = "True if the reset password feature is enabled, false otherwise") private Boolean passwordEnabled; @SerializedName(ApiConstants.FORMAT) - @Param(description = "the format of the template.") + @Param(description = "The format of the Template.") private ImageFormat format; @SerializedName(ApiConstants.BOOTABLE) - @Param(description = "true if the ISO is bootable, false otherwise") + @Param(description = "True if the ISO is bootable, false otherwise") private Boolean bootable; @SerializedName(ApiConstants.IS_FEATURED) - @Param(description = "true if this template is a featured template, false otherwise") + @Param(description = "True if this Template is a featured Template, false otherwise") private boolean featured; @SerializedName(ApiConstants.CROSS_ZONES) - @Param(description = "true if the template is managed across all Zones, false otherwise") + @Param(description = "True if the Template is managed across all Zones, false otherwise") private boolean crossZones; @SerializedName(ApiConstants.OS_TYPE_ID) - @Param(description = "the ID of the OS type for this template.") + @Param(description = "The ID of the OS type for this Template.") private String osTypeId; @SerializedName("ostypename") - @Param(description = "the name of the OS type for this template.") + @Param(description = "The name of the OS type for this Template.") private String osTypeName; + private transient Long osTypeCategoryId; + @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "the account id to which the template belongs") + @Param(description = "The Account id to which the Template belongs") private String accountId; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account name to which the template belongs") + @Param(description = "The Account name to which the Template belongs") private String account; //TODO: since a template can be associated to more than one zones, this model is not accurate. For backward-compatibility, keep these fields // here, but add a zones field to capture multiple zones. @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the zone for this template") + @Param(description = "The ID of the zone for this Template") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone for this template") + @Param(description = "The name of the zone for this Template") private String zoneName; @SerializedName(ApiConstants.STATUS) - @Param(description = "the status of the template") + @Param(description = "The status of the Template") private String status; @SerializedName(ApiConstants.SIZE) - @Param(description = "the size of the template") + @Param(description = "The size of the Template") private Long size; @SerializedName(ApiConstants.PHYSICAL_SIZE) - @Param(description = "the physical size of the template") + @Param(description = "The physical size of the Template") private Long physicalSize; @SerializedName(ApiConstants.TEMPLATE_TYPE) - @Param(description = "the type of the template") + @Param(description = "The type of the Template") private String templateType; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the hypervisor on which the template runs") + @Param(description = "The hypervisor on which the Template runs") private String hypervisor; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the name of the domain to which the template belongs") + @Param(description = "The name of the domain to which the Template belongs") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the Domain the template belongs to", since = "4.19.2.0") + @Param(description = "Path of the Domain the template belongs to", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain to which the template belongs") + @Param(description = "The ID of the domain to which the Template belongs") private String domainId; @SerializedName(ApiConstants.IS_EXTRACTABLE) - @Param(description = "true if the template is extractable, false otherwise") + @Param(description = "True if the Template is extractable, false otherwise") private Boolean extractable; @SerializedName(ApiConstants.CHECKSUM) - @Param(description = "checksum of the template") + @Param(description = "Checksum of the Template") private String checksum; @SerializedName(ApiConstants.SOURCETEMPLATEID) - @Param(description = "the template ID of the parent template if present") + @Param(description = "The Template ID of the parent Template if present") private String sourcetemplateId; @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the secondary storage host for the template") + @Param(description = "The ID of the secondary storage host for the Template") private String hostId; @SerializedName(ApiConstants.HOST_NAME) - @Param(description = "the name of the secondary storage host for the template") + @Param(description = "The name of the secondary storage host for the Template") private String hostName; @SerializedName(ApiConstants.TEMPLATE_TAG) - @Param(description = "the tag of this template") + @Param(description = "The tag of this Template") private String templateTag; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the template") + @Param(description = "The project ID of the Template") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the template") + @Param(description = "The project name of the Template") private String projectName; @SerializedName(ApiConstants.DETAILS) - @Param(description = "additional key/value details tied with template") + @Param(description = "Additional key/value details tied with Template") private Map details; @SerializedName(ApiConstants.DOWNLOAD_DETAILS) - @Param(description = "Lists the download progress of a template across all secondary storages") + @Param(description = "Lists the download progress of a Template across all secondary storages") private List> downloadDetails; @SerializedName(ApiConstants.ARCH) @@ -188,65 +190,76 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements private String arch; @SerializedName(ApiConstants.BITS) - @Param(description = "the processor bit size", since = "4.10") + @Param(description = "The processor bit size", since = "4.10") private int bits; @SerializedName(ApiConstants.SSHKEY_ENABLED) - @Param(description = "true if template is sshkey enabled, false otherwise") + @Param(description = "True if Template is sshkey enabled, false otherwise") private Boolean sshKeyEnabled; @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) - @Param(description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory") + @Param(description = "True if Template contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory") private Boolean isDynamicallyScalable; @SerializedName(ApiConstants.DIRECT_DOWNLOAD) - @Param(description = "KVM Only: true if template is directly downloaded to Primary Storage bypassing Secondary Storage") + @Param(description = "KVM Only: true if Template is directly downloaded to Primary Storage bypassing Secondary Storage") private Boolean directDownload; @SerializedName(ApiConstants.DEPLOY_AS_IS) - @Param(description = "VMware only: true if template is deployed without orchestrating disks and networks but \"as-is\" defined in the template.", + @Param(description = "VMware only: true if Template is deployed without orchestrating disks and Networks but \"as-is\" defined in the Template.", since = "4.15") private Boolean deployAsIs; + @SerializedName(ApiConstants.FOR_CKS) + @Param(description = "If true it indicates that the template can be used for CKS cluster deployments", + since = "4.21.0") + private Boolean forCks; + @SerializedName(ApiConstants.DEPLOY_AS_IS_DETAILS) - @Param(description = "VMware only: additional key/value details tied with deploy-as-is template", + @Param(description = "VMware only: additional key/value details tied with deploy-as-is Template", since = "4.15") private Map deployAsIsDetails; @SerializedName("parenttemplateid") - @Param(description = "if Datadisk template, then id of the root disk template this template belongs to") + @Param(description = "If Datadisk Template, then id of the root disk Template this Template belongs to") @Deprecated(since = "4.15") private String parentTemplateId; @SerializedName("childtemplates") - @Param(description = "if root disk template, then ids of the datas disk templates this template owns") + @Param(description = "If root disk Template, then IDs of the datas disk Templates this Template owns") @Deprecated(since = "4.15") private Set childTemplates; @SerializedName(ApiConstants.REQUIRES_HVM) - @Param(description = "true if template requires HVM enabled, false otherwise") + @Param(description = "True if Template requires HVM enabled, false otherwise") private Boolean requiresHvm; @SerializedName(ApiConstants.URL) - @Param(description = "the URL which the template/iso is registered from") + @Param(description = "The URL which the Template/ISO is registered from") private String url; @SerializedName(ApiConstants.RESOURCE_ICON) @Param(description = "Base64 string representation of the resource icon", since = "4.16.0.0") ResourceIconResponse icon; - @SerializedName(ApiConstants.USER_DATA_ID) @Param(description="the id of userdata linked to this template", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_ID) @Param(description = "The id of userdata linked to this Template", since = "4.18.0") private String userDataId; - @SerializedName(ApiConstants.USER_DATA_NAME) @Param(description="the name of userdata linked to this template", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_NAME) @Param(description = "The name of userdata linked to this Template", since = "4.18.0") private String userDataName; - @SerializedName(ApiConstants.USER_DATA_POLICY) @Param(description="the userdata override policy with the userdata provided while deploying VM", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_POLICY) @Param(description = "The userdata override policy with the userdata provided while deploying Instance", since = "4.18.0") private String userDataPolicy; - @SerializedName(ApiConstants.USER_DATA_PARAMS) @Param(description="list of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in userdata", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_PARAMS) @Param(description = "List of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in userdata", since = "4.18.0") private String userDataParams; + @SerializedName(ApiConstants.EXTENSION_ID) @Param(description="The ID of extension linked to this template", since = "4.21.0") + private String extensionId; + + @SerializedName(ApiConstants.EXTENSION_NAME) @Param(description="The name of extension linked to this template", since = "4.21.0") + private String extensionName; + public TemplateResponse() { tags = new LinkedHashSet<>(); } @@ -285,6 +298,14 @@ public void setOsTypeName(String osTypeName) { this.osTypeName = osTypeName; } + public Long getOsTypeCategoryId() { + return osTypeCategoryId; + } + + public void setOsTypeCategoryId(Long osTypeCategoryId) { + this.osTypeCategoryId = osTypeCategoryId; + } + public void setId(String id) { this.id = id; } @@ -453,6 +474,10 @@ public void setDeployAsIs(Boolean deployAsIs) { this.deployAsIs = deployAsIs; } + public void setForCks(Boolean forCks) { + this.forCks = forCks; + } + public void setParentTemplateId(String parentTemplateId) { this.parentTemplateId = parentTemplateId; } @@ -528,4 +553,20 @@ public void setUserDataParams(String userDataParams) { public void setArch(String arch) { this.arch = arch; } + + public String getExtensionId() { + return extensionId; + } + + public void setExtensionId(String extensionId) { + this.extensionId = extensionId; + } + + public String getExtensionName() { + return extensionName; + } + + public void setExtensionName(String extensionName) { + this.extensionName = extensionName; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TrafficMonitorResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TrafficMonitorResponse.java index b19c422a5af0..0251b2ab4550 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TrafficMonitorResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TrafficMonitorResponse.java @@ -26,23 +26,23 @@ public class TrafficMonitorResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the external firewall") + @Param(description = "The ID of the external firewall") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID of the external firewall") + @Param(description = "The zone ID of the external firewall") private String zoneId; @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the management IP address of the external firewall") + @Param(description = "The management IP address of the external firewall") private String ipAddress; @SerializedName(ApiConstants.NUM_RETRIES) - @Param(description = "the number of times to retry requests to the external firewall") + @Param(description = "The number of times to retry requests to the external firewall") private String numRetries; @SerializedName(ApiConstants.TIMEOUT) - @Param(description = "the timeout (in seconds) for requests to the external firewall") + @Param(description = "The timeout (in seconds) for requests to the external firewall") private String timeout; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java index ebcd7c9a0d4b..29512c2cdd5d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java @@ -25,11 +25,11 @@ public class TrafficTypeImplementorResponse extends BaseResponse { @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "network traffic type") + @Param(description = "Network traffic type") private String trafficType; @SerializedName(ApiConstants.TRAFFIC_TYPE_IMPLEMENTOR) - @Param(description = "implementor of network traffic type") + @Param(description = "Implementor of Network traffic type") private String implementor; public void setTrafficType(String type) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeResponse.java index 9a79b0724658..2b8af97f160e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/TrafficTypeResponse.java @@ -29,35 +29,43 @@ public class TrafficTypeResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "id of the network provider") + @Param(description = "ID of the Network provider") private String id; @SerializedName(ApiConstants.TRAFFIC_TYPE) - @Param(description = "the trafficType to be added to the physical network") + @Param(description = "The trafficType to be added to the physical Network") private String trafficType; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.XENSERVER_NETWORK_LABEL) - @Param(description = "The network name label of the physical device dedicated to this traffic on a XenServer host") + @Param(description = "The Network name label of the physical device dedicated to this traffic on a XenServer host") private String xenNetworkLabel; @SerializedName(ApiConstants.KVM_NETWORK_LABEL) - @Param(description = "The network name label of the physical device dedicated to this traffic on a KVM host") + @Param(description = "The Network name label of the physical device dedicated to this traffic on a KVM host") private String kvmNetworkLabel; @SerializedName(ApiConstants.VMWARE_NETWORK_LABEL) - @Param(description = "The network name label of the physical device dedicated to this traffic on a VMware host") + @Param(description = "The Network name label of the physical device dedicated to this traffic on a VMware host") private String vmwareNetworkLabel; @SerializedName(ApiConstants.HYPERV_NETWORK_LABEL) - @Param(description = "The network name label of the physical device dedicated to this traffic on a HyperV host") + @Param(description = "The Network name label of the physical device dedicated to this traffic on a HyperV host") private String hypervNetworkLabel; + @SerializedName(ApiConstants.VLAN) + @Param(description = "The VLAN id to be used for Management traffic by VMware host") + private String vlan; + + @SerializedName(ApiConstants.ISOLATION_METHODS) + @Param(description = "isolation methods for the physical network traffic") + private String isolationMethods; + @SerializedName(ApiConstants.OVM3_NETWORK_LABEL) - @Param(description = "The network name of the physical device dedicated to this traffic on an OVM3 host") + @Param(description = "The Network name of the physical device dedicated to this traffic on an OVM3 host") private String ovm3NetworkLabel; @Override @@ -128,4 +136,20 @@ public String getOvm3Label() { public void setOvm3Label(String ovm3Label) { this.ovm3NetworkLabel = ovm3Label; } + + public String getIsolationMethods() { + return isolationMethods; + } + + public void setIsolationMethods(String isolationMethods) { + this.isolationMethods = isolationMethods; + } + + public String getVlan() { + return vlan; + } + + public void setVlan(String vlan) { + this.vlan = vlan; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UnmanageVMInstanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UnmanageVMInstanceResponse.java index cec70f20cff7..5b3f15b0ddce 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UnmanageVMInstanceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UnmanageVMInstanceResponse.java @@ -24,14 +24,18 @@ public class UnmanageVMInstanceResponse extends BaseResponse { - @SerializedName(ApiConstants.RESULT) - @Param(description = "result of the unmanage VM operation") + @SerializedName(ApiConstants.SUCCESS) + @Param(description = "Result of the unmanage Instance operation") private boolean success; @SerializedName(ApiConstants.DETAILS) - @Param(description = "details of the unmanage VM operation") + @Param(description = "Details of the unmanage Instance operation") private String details; + @SerializedName(ApiConstants.HOST_ID) + @Param(description = "The ID of the host used for unmanaged Instance") + private String hostId; + public UnmanageVMInstanceResponse() { } @@ -55,4 +59,12 @@ public String getDetails() { public void setDetails(String details) { this.details = details; } + + public String getHostId() { + return hostId; + } + + public void setHostId(String hostId) { + this.hostId = hostId; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceDiskResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceDiskResponse.java index 083c83fbf85a..4367164722b7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceDiskResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceDiskResponse.java @@ -26,47 +26,47 @@ public class UnmanagedInstanceDiskResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the disk") + @Param(description = "The ID of the disk") private String diskId; @SerializedName(ApiConstants.LABEL) - @Param(description = "the label of the disk") + @Param(description = "The label of the disk") private String label; @SerializedName(ApiConstants.CAPACITY) - @Param(description = "the capacity of the disk in bytes") + @Param(description = "The capacity of the disk in bytes") private Long capacity; @SerializedName(ApiConstants.IMAGE_PATH) - @Param(description = "the file path of the disk image") + @Param(description = "The file path of the disk image") private String imagePath; @SerializedName(ApiConstants.CONTROLLER) - @Param(description = "the controller of the disk") + @Param(description = "The controller of the disk") private String controller; @SerializedName(ApiConstants.CONTROLLER_UNIT) - @Param(description = "the controller unit of the disk") + @Param(description = "The controller unit of the disk") private Integer controllerUnit; @SerializedName(ApiConstants.POSITION) - @Param(description = "the position of the disk") + @Param(description = "The position of the disk") private Integer position; @SerializedName(ApiConstants.DATASTORE_NAME) - @Param(description = "the controller of the disk") + @Param(description = "The controller of the disk") private String datastoreName; @SerializedName(ApiConstants.DATASTORE_HOST) - @Param(description = "the controller of the disk") + @Param(description = "The controller of the disk") private String datastoreHost; @SerializedName(ApiConstants.DATASTORE_PATH) - @Param(description = "the controller of the disk") + @Param(description = "The controller of the disk") private String datastorePath; @SerializedName(ApiConstants.DATASTORE_TYPE) - @Param(description = "the controller of the disk") + @Param(description = "The controller of the disk") private String datastoreType; public String getDiskId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceResponse.java index 7a26b1785919..3f2dc045e87c 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UnmanagedInstanceResponse.java @@ -32,11 +32,11 @@ public class UnmanagedInstanceResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the virtual machine") + @Param(description = "The name of the Instance") private String name; @SerializedName(ApiConstants.CLUSTER_ID) - @Param(description = "the ID of the cluster to which virtual machine belongs") + @Param(description = "The ID of the cluster to which Instance belongs") private String clusterId; @SerializedName(ApiConstants.CLUSTER_NAME) @@ -44,47 +44,63 @@ public class UnmanagedInstanceResponse extends BaseResponse { private String clusterName; @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the host to which virtual machine belongs") + @Param(description = "The ID of the host to which Instance belongs") private String hostId; @SerializedName(ApiConstants.HOST_NAME) - @Param(description = "the name of the host to which virtual machine belongs") + @Param(description = "The name of the host to which Instance belongs") private String hostName; + @SerializedName(ApiConstants.HYPERVISOR) + @Param(description = "The hypervisor to which Instance belongs") + private String hypervisor; + + @SerializedName(ApiConstants.HYPERVISOR_VERSION) + @Param(description = "The hypervisor version of the host to which Instance belongs") + private String hypervisorVersion; + @SerializedName(ApiConstants.POWER_STATE) - @Param(description = "the power state of the virtual machine") + @Param(description = "The power state of the Instance") private String powerState; @SerializedName(ApiConstants.CPU_NUMBER) - @Param(description = "the CPU cores of the virtual machine") + @Param(description = "The CPU cores of the Instance") private Integer cpuCores; @SerializedName(ApiConstants.CPU_CORE_PER_SOCKET) - @Param(description = "the CPU cores per socket for the virtual machine. VMware specific") + @Param(description = "The CPU cores per socket for the Instance. VMware specific") private Integer cpuCoresPerSocket; @SerializedName(ApiConstants.CPU_SPEED) - @Param(description = "the CPU speed of the virtual machine") + @Param(description = "The CPU speed of the Instance") private Integer cpuSpeed; @SerializedName(ApiConstants.MEMORY) - @Param(description = "the memory of the virtual machine in MB") + @Param(description = "The memory of the Instance in MB") private Integer memory; @SerializedName(ApiConstants.OS_ID) - @Param(description = "the operating system ID of the virtual machine") + @Param(description = "The operating system ID of the Instance") private String operatingSystemId; @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "the operating system of the virtual machine") + @Param(description = "The operating system of the Instance") private String operatingSystem; + @SerializedName(ApiConstants.BOOT_MODE) + @Param(description = "indicates the boot mode") + private String bootMode; + + @SerializedName(ApiConstants.BOOT_TYPE) + @Param(description = "indicates the boot type") + private String bootType; + @SerializedName(ApiConstants.DISK) - @Param(description = "the list of disks associated with the virtual machine", responseObject = UnmanagedInstanceDiskResponse.class) + @Param(description = "The list of disks associated with the Instance", responseObject = UnmanagedInstanceDiskResponse.class) private Set disks; @SerializedName(ApiConstants.NIC) - @Param(description = "the list of nics associated with the virtual machine", responseObject = NicResponse.class) + @Param(description = "The list of NICs associated with the Instance", responseObject = NicResponse.class) private Set nics; public UnmanagedInstanceResponse() { @@ -132,6 +148,22 @@ public void setHostName(String hostName) { this.hostName = hostName; } + public String getHypervisor() { + return hypervisor; + } + + public void setHypervisor(String hypervisor) { + this.hypervisor = hypervisor; + } + + public String getHypervisorVersion() { + return hypervisorVersion; + } + + public void setHypervisorVersion(String hypervisorVersion) { + this.hypervisorVersion = hypervisorVersion; + } + public String getPowerState() { return powerState; } @@ -211,4 +243,20 @@ public void setNics(Set nics) { public void addNic(NicResponse nic) { this.nics.add(nic); } + + public String getBootMode() { + return bootMode; + } + + public void setBootMode(String bootMode) { + this.bootMode = bootMode; + } + + public String getBootType() { + return bootType; + } + + public void setBootType(String bootType) { + this.bootType = bootType; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UpgradeRouterTemplateResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UpgradeRouterTemplateResponse.java index d89631ae4287..dbe990c6dbd3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UpgradeRouterTemplateResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UpgradeRouterTemplateResponse.java @@ -16,27 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.jobs.JobInfo; -import com.cloud.serializer.Param; - @EntityReference(value = JobInfo.class) -@SuppressWarnings("unused") public class UpgradeRouterTemplateResponse extends BaseResponse { - @SerializedName(ApiConstants.JOB_ID) - @Param(description = "the id of AsyncJob") - private String asyncJobId; - - public String getAsyncJobId() { - return asyncJobId; - } - - public void setAsyncJobId(String asyncJobId) { - this.asyncJobId = asyncJobId; - } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UsageRecordResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UsageRecordResponse.java index 4aeded642871..21b421e66bfd 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UsageRecordResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UsageRecordResponse.java @@ -29,119 +29,119 @@ @SuppressWarnings("unused") public class UsageRecordResponse extends BaseResponseWithTagInformation implements ControlledEntityResponse { @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the user account name") + @Param(description = "The user Account name") private String accountName; @SerializedName(ApiConstants.ACCOUNT_ID) - @Param(description = "the user account Id") + @Param(description = "The user Account ID") private String accountId; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the resource") + @Param(description = "The project ID of the resource") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the resource") + @Param(description = "The project name of the resource") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID") + @Param(description = "The domain ID") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain the resource is associated with") + @Param(description = "The domain the resource is associated with") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the usage reocrd belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the usage reocrd belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID") + @Param(description = "The zone ID") private String zoneId; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "description of the usage record") + @Param(description = "Description of the usage record") private String description; @SerializedName("usage") - @Param(description = "usage in hours") + @Param(description = "Usage in hours") private String usage; @SerializedName("usagetype") - @Param(description = "usage type ID") + @Param(description = "Usage type ID") private Integer usageType; @SerializedName("rawusage") - @Param(description = "raw usage in hours") + @Param(description = "Raw usage in hours") private String rawUsage; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "virtual machine ID") + @Param(description = "Instance ID") private String virtualMachineId; @SerializedName(ApiConstants.NAME) - @Param(description = "resource or virtual machine name") + @Param(description = "Resource or Instance name") private String resourceName; @SerializedName("offeringid") - @Param(description = "offering ID") + @Param(description = "Offering ID") private String offeringId; @SerializedName(ApiConstants.TEMPLATE_ID) - @Param(description = "template ID") + @Param(description = "Template ID") private String templateId; @SerializedName(ApiConstants.OS_TYPE_ID) - @Param(description = "virtual machine os type ID") + @Param(description = "Instance os type ID") private String osTypeId; @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "virtual machine os display name") + @Param(description = "Instance os display name") private String osDisplayName; @SerializedName(ApiConstants.OS_CATEGORY_ID) - @Param(description = "virtual machine guest os category ID") + @Param(description = "Instance guest os category ID") private String osCategoryId; @SerializedName(ApiConstants.OS_CATEGORY_NAME) - @Param(description = "virtual machine os category name") + @Param(description = "Instance os category name") private String osCategoryName; @SerializedName("usageid") - @Param(description = "id of the resource") + @Param(description = "ID of the resource") private String usageId; @SerializedName(ApiConstants.TYPE) - @Param(description = "resource type") + @Param(description = "Resource type") private String type; @SerializedName(ApiConstants.SIZE) - @Param(description = "resource size") + @Param(description = "Resource size") private Long size; @SerializedName("virtualsize") - @Param(description = "virtual size of resource") + @Param(description = "Virtual size of resource") private Long virtualSize; @SerializedName(ApiConstants.CPU_NUMBER) - @Param(description = "number of cpu of resource") + @Param(description = "Number of CPU of resource") private Long cpuNumber; @SerializedName(ApiConstants.CPU_SPEED) - @Param(description = "speed of each cpu of resource") + @Param(description = "Speed of each CPU of resource") private Long cpuSpeed; @SerializedName(ApiConstants.MEMORY) - @Param(description = "memory allocated for the resource") + @Param(description = "Memory allocated for the resource") private Long memory; @SerializedName(ApiConstants.START_DATE) - @Param(description = "start date of the usage record") + @Param(description = "Start date of the usage record") private Date startDate; @SerializedName(ApiConstants.END_DATE) - @Param(description = "end date of the usage record") + @Param(description = "End date of the usage record") private Date endDate; @SerializedName("issourcenat") @@ -149,11 +149,11 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen private Boolean isSourceNat; @SerializedName(ApiConstants.IS_SYSTEM) - @Param(description = "True if the IPAddress is system IP - allocated during vm deploy or lb rule create") + @Param(description = "True if the IPAddress is system IP - allocated during Instance deploy or LB rule create") private Boolean isSystem; @SerializedName("networkid") - @Param(description = "id of the network") + @Param(description = "ID of the Network") private String networkId; @SerializedName("isdefault") @@ -161,7 +161,7 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen private Boolean isDefault; @SerializedName("vpcid") - @Param(description = "id of the vpc") + @Param(description = "ID of the VPC") private String vpcId; public UsageRecordResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserDataResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserDataResponse.java index 2dfc66fa7d51..5871ae6ee7a2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserDataResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserDataResponse.java @@ -27,41 +27,41 @@ public class UserDataResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "ID of the ssh keypair") + @Param(description = "ID of the User Data") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "Name of the userdata") + @Param(description = "Name of the User Data") private String name; - @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the owner id of the userdata") + @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="The owner id of the User Data") private String accountId; - @SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the userdata") + @SerializedName(ApiConstants.ACCOUNT) @Param(description="The owner of the User Data") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the userdata", since = "4.19.1") + @Param(description = "The project id of the User Data", since = "4.19.1") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the userdata", since = "4.19.1") + @Param(description = "The project name of the User Data", since = "4.19.1") private String projectName; - @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the userdata owner") + @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="The domain id of the User Data owner") private String domainId; - @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the userdata owner") + @SerializedName(ApiConstants.DOMAIN) @Param(description="The domain name of the User Data owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the userdata owner belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the User Data owner belongs", since = "4.19.2.0") private String domainPath; - @SerializedName(ApiConstants.USER_DATA) @Param(description="base64 encoded userdata content") + @SerializedName(ApiConstants.USER_DATA) @Param(description="Base64 encoded User Data content") private String userData; - @SerializedName(ApiConstants.PARAMS) @Param(description="list of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in userdata") + @SerializedName(ApiConstants.PARAMS) @Param(description="List of parameters which contains the list of keys or string parameters that are needed to be passed for any variables declared in the User Data") private String params; public UserDataResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java index 5e4e6e1f3c8b..61b025b206eb 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java @@ -32,88 +32,88 @@ @EntityReference(value = User.class) public class UserResponse extends BaseResponse implements SetResourceIconResponse { @SerializedName("id") - @Param(description = "the user ID") + @Param(description = "The user ID") private String id; @SerializedName("username") - @Param(description = "the user name") + @Param(description = "The user name") private String username; @SerializedName("firstname") - @Param(description = "the user firstname") + @Param(description = "The user firstname") private String firstname; @SerializedName("lastname") - @Param(description = "the user lastname") + @Param(description = "The user lastname") private String lastname; @SerializedName("email") - @Param(description = "the user email address") + @Param(description = "The user email address") private String email; @SerializedName("created") - @Param(description = "the date and time the user account was created") + @Param(description = "The date and time the user Account was created") private Date created; @SerializedName("state") - @Param(description = "the user state") + @Param(description = "The user state") private String state; @SerializedName("account") - @Param(description = "the account name of the user") + @Param(description = "The Account name of the user") private String accountName; @SerializedName("accounttype") - @Param(description = "the account type of the user") + @Param(description = "The Account type of the user") private Integer accountType; @SerializedName(ApiConstants.USER_SOURCE) - @Param(description = "the source type of the user in lowercase, such as native, ldap, saml2") + @Param(description = "The source type of the user in lowercase, such as native, ldap, saml2") private String userSource; @SerializedName(ApiConstants.ROLE_ID) - @Param(description = "the ID of the role") + @Param(description = "The ID of the role") private String roleId; @SerializedName(ApiConstants.ROLE_TYPE) - @Param(description = "the type of the role") + @Param(description = "The type of the role") private String roleType; @SerializedName(ApiConstants.ROLE_NAME) - @Param(description = "the name of the role") + @Param(description = "The name of the role") private String roleName; @SerializedName("domainid") - @Param(description = "the domain ID of the user") + @Param(description = "The domain ID of the user") private String domainId; @SerializedName("domain") - @Param(description = "the domain name of the user") + @Param(description = "The domain name of the user") private String domainName; @SerializedName("timezone") - @Param(description = "the timezone user was created in") + @Param(description = "The timezone user was created in") private String timezone; - @SerializedName("apikey") - @Param(description = "the api key of the user", isSensitive = true) + @SerializedName(ApiConstants.API_KEY) + @Param(description = "The API key of the user", isSensitive = true) private String apiKey; @Deprecated - @SerializedName("secretkey") - @Param(description = "the secret key of the user", isSensitive = true) + @SerializedName(ApiConstants.SECRET_KEY) + @Param(description = "The secret key of the user", isSensitive = true) private String secretKey; @SerializedName("accountid") - @Param(description = "the account ID of the user") + @Param(description = "The Account ID of the user") private String accountId; @SerializedName("iscallerchilddomain") - @Param(description = "the boolean value representing if the updating target is in caller's child domain") + @Param(description = "The boolean value representing if the updating target is in caller's child domain") private boolean isCallerChildDomain; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if user is default, false otherwise", since = "4.2.0") + @Param(description = "True if user is default, false otherwise", since = "4.2.0") private Boolean isDefault; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -121,15 +121,15 @@ public class UserResponse extends BaseResponse implements SetResourceIconRespons ResourceIconResponse icon; @SerializedName(ApiConstants.IS_2FA_ENABLED) - @Param(description = "true if user has two factor authentication enabled", since = "4.18.0.0") + @Param(description = "True if user has two factor authentication enabled", since = "4.18.0.0") private Boolean is2FAenabled; @SerializedName(ApiConstants.IS_2FA_MANDATED) - @Param(description = "true if user has two factor authentication is mandated", since = "4.18.0.0") + @Param(description = "True if user has two factor authentication is mandated", since = "4.18.0.0") private Boolean is2FAmandated; @SerializedName(ApiConstants.API_KEY_ACCESS) - @Param(description = "whether api key access is Enabled, Disabled or set to Inherit (it inherits the value from the parent)", since = "4.20.1.0") + @Param(description = "Whether api key access is Enabled, Disabled or set to Inherit (it inherits the value from the parent)", since = "4.20.1.0") ApiConstants.ApiKeyAccess apiKeyAccess; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticationSetupResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticationSetupResponse.java index 35beefde4031..43118a4c474b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticationSetupResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticationSetupResponse.java @@ -26,19 +26,19 @@ public class UserTwoFactorAuthenticationSetupResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the user ID") + @Param(description = "The user ID") private String id; @SerializedName("username") - @Param(description = "the user name") + @Param(description = "The user name") private String username; @SerializedName("accountid") - @Param(description = "the account ID of the user") + @Param(description = "The Account ID of the user") private String accountId; @SerializedName(ApiConstants.SECRET_CODE) - @Param(description = "secret code that needs to be registered with authenticator") + @Param(description = "Secret code that needs to be registered with authenticator") private String secretCode; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticatorProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticatorProviderResponse.java index 4101dc375ed1..7b0057d66ea6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticatorProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserTwoFactorAuthenticatorProviderResponse.java @@ -27,11 +27,11 @@ public class UserTwoFactorAuthenticatorProviderResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) - @Param(description = "the user two factor authenticator provider name") + @Param(description = "The user two factor authenticator provider name") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the user two factor authenticator provider") + @Param(description = "The description of the user two factor authenticator provider") private String description; public String getName() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java index 1f4b493fba2f..a7f6dff96f88 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java @@ -31,251 +31,287 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponseWithTagInformation; import org.apache.cloudstack.api.EntityReference; +import org.apache.commons.collections.CollectionUtils; import com.cloud.network.router.VirtualRouter; import com.cloud.serializer.Param; import com.cloud.uservm.UserVm; import com.cloud.vm.VirtualMachine; import com.google.gson.annotations.SerializedName; -import org.apache.commons.collections.CollectionUtils; @SuppressWarnings("unused") @EntityReference(value = {VirtualMachine.class, UserVm.class, VirtualRouter.class}) -public class UserVmResponse extends BaseResponseWithTagInformation implements ControlledEntityResponse, SetResourceIconResponse { +public class UserVmResponse extends BaseResponseWithTagInformation implements ControlledViewEntityResponse, SetResourceIconResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the virtual machine") + @Param(description = "The ID of the Instance") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the virtual machine") + @Param(description = "The name of the Instance") private String name; @SerializedName("displayname") - @Param(description = "user generated name. The name of the virtual machine is returned if no displayname exists.") + @Param(description = "User generated name. The name of the Instance is returned if no displayname exists.") private String displayName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the virtual machine") + @Param(description = "The Account associated with the Instance") private String accountName; @SerializedName(ApiConstants.USER_ID) - @Param(description = "the user's ID who deployed the virtual machine") + @Param(description = "The User's ID who deployed the Instance") private String userId; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the user's name who deployed the virtual machine") + @Param(description = "The User's name who deployed the Instance") private String userName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vm") + @Param(description = "The project ID of the Instance") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vm") + @Param(description = "The project name of the Instance") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain in which the virtual machine exists") + @Param(description = "The ID of the domain in which the Instance exists") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the name of the domain in which the virtual machine exists") + @Param(description = "The name of the domain in which the Instance exists") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain in which the virtual machine exists", since = "4.19.2.0") + @Param(description = "Path of the domain in which the virtual machine exists", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date when this virtual machine was created") + @Param(description = "The date when this Instance was created") private Date created; @SerializedName("lastupdated") - @Param(description="the date when this virtual machine was updated last time", since="4.16.0") + @Param(description = "The date when this Instance was updated last time", since="4.16.0") private Date lastUpdated; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the virtual machine") + @Param(description = "The state of the Instance") private String state; @SerializedName(ApiConstants.HA_ENABLE) - @Param(description = "true if high-availability is enabled, false otherwise") + @Param(description = "True if high-availability is enabled, false otherwise") private Boolean haEnable; @SerializedName(ApiConstants.GROUP_ID) - @Param(description = "the group ID of the virtual machine") + @Param(description = "The group ID of the Instance") private String groupId; @SerializedName(ApiConstants.GROUP) - @Param(description = "the group name of the virtual machine") + @Param(description = "The group name of the Instance") private String group; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the availability zone for the virtual machine") + @Param(description = "The ID of the availability zone for the Instance") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the availability zone for the virtual machine") + @Param(description = "The name of the availability zone for the Instance") private String zoneName; @SerializedName(ApiConstants.HOST_ID) - @Param(description = "the ID of the host for the virtual machine") + @Param(description = "The ID of the host for the Instance") private String hostId; @SerializedName("hostname") - @Param(description = "the name of the host for the virtual machine") + @Param(description = "The name of the host for the Instance") private String hostName; @SerializedName(ApiConstants.HOST_CONTROL_STATE) - @Param(description = "the control state of the host for the virtual machine") + @Param(description = "The control state of the host for the Instance") private String hostControlState; @SerializedName(ApiConstants.TEMPLATE_ID) - @Param(description = "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") + @Param(description = "The ID of the Template for the Instance. A -1 is returned if the Instance was created from an ISO file.") private String templateId; @SerializedName("templatename") - @Param(description = "the name of the template for the virtual machine") + @Param(description = "The name of the Template for the Instance") private String templateName; @SerializedName(ApiConstants.TEMPLATE_TYPE) - @Param(description = "the type of the template for the virtual machine", since = "4.19.0") + @Param(description = "The type of the template for the virtual machine", since = "4.19.0") private String templateType; @SerializedName(ApiConstants.TEMPLATE_FORMAT) - @Param(description = "the format of the template for the virtual machine", since = "4.19.1") + @Param(description = "The format of the template for the virtual machine", since = "4.19.1") private String templateFormat; @SerializedName("templatedisplaytext") - @Param(description = " an alternate display text of the template for the virtual machine") + @Param(description = "An alternate display text of the Template for the Instance") private String templateDisplayText; @SerializedName(ApiConstants.PASSWORD_ENABLED) - @Param(description = "true if the password rest feature is enabled, false otherwise") + @Param(description = "True if the password rest feature is enabled, false otherwise") private Boolean passwordEnabled; @SerializedName("isoid") - @Param(description = "the ID of the ISO attached to the virtual machine") + @Param(description = "The ID of the ISO attached to the Instance") private String isoId; @SerializedName("isoname") - @Param(description = "the name of the ISO attached to the virtual machine") + @Param(description = "The name of the ISO attached to the Instance") private String isoName; @SerializedName("isodisplaytext") - @Param(description = "an alternate display text of the ISO attached to the virtual machine") + @Param(description = "An alternate display text of the ISO attached to the Instance") private String isoDisplayText; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) - @Param(description = "the ID of the service offering of the virtual machine") + @Param(description = "The ID of the service offering of the Instance") private String serviceOfferingId; @SerializedName("serviceofferingname") - @Param(description = "the name of the service offering of the virtual machine") + @Param(description = "The name of the service offering of the Instance") private String serviceOfferingName; @SerializedName(ApiConstants.DISK_OFFERING_ID) - @Param(description = "the ID of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4") + @Param(description = "The ID of the disk offering of the Instance. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4") private String diskOfferingId; @SerializedName("diskofferingname") - @Param(description = "the name of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4") + @Param(description = "The name of the disk offering of the Instance. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4") private String diskOfferingName; + @SerializedName(ApiConstants.GPU_CARD_ID) + @Param(description = "the ID of the gpu card to which service offering is linked", since = "4.21") + private String gpuCardId; + + @SerializedName(ApiConstants.GPU_CARD_NAME) + @Param(description = "the name of the gpu card to which service offering is linked", since = "4.21") + private String gpuCardName; + + @SerializedName(ApiConstants.VGPU_PROFILE_ID) + @Param(description = "the ID of the vgpu profile to which service offering is linked", since = "4.21") + private String vgpuProfileId; + + @SerializedName(ApiConstants.VGPU_PROFILE_NAME) + @Param(description = "the name of the vgpu profile to which service offering is linked", since = "4.21") + private String vgpuProfileName; + + @SerializedName(ApiConstants.VIDEORAM) + @Param(description = "the video RAM size in MB") + private Long videoRam; + + @SerializedName(ApiConstants.MAXHEADS) + @Param(description = "the maximum number of display heads") + private Long maxHeads; + + @SerializedName(ApiConstants.MAXRESOLUTIONX) + @Param(description = "the maximum X resolution") + private Long maxResolutionX; + + @SerializedName(ApiConstants.MAXRESOLUTIONY) + @Param(description = "the maximum Y resolution") + private Long maxResolutionY; + + @SerializedName(ApiConstants.GPU_COUNT) + @Param(description = "the count of GPUs on the virtual machine", since = "4.21") + private Integer gpuCount; + @SerializedName(ApiConstants.BACKUP_OFFERING_ID) - @Param(description = "the ID of the backup offering of the virtual machine", since = "4.14") + @Param(description = "The ID of the backup offering of the Instance", since = "4.14") private String backupOfferingId; @SerializedName(ApiConstants.BACKUP_OFFERING_NAME) - @Param(description = "the name of the backup offering of the virtual machine", since = "4.14") + @Param(description = "The name of the backup offering of the Instance", since = "4.14") private String backupOfferingName; @SerializedName("forvirtualnetwork") - @Param(description = "the virtual network for the service offering") + @Param(description = "The virtual Network for the service offering") private Boolean forVirtualNetwork; @SerializedName(ApiConstants.CPU_NUMBER) - @Param(description = "the number of vCPUs this virtual machine is using") + @Param(description = "The number of vCPUs this Instance is using") private Integer cpuNumber; @SerializedName(ApiConstants.CPU_SPEED) - @Param(description = "the speed of each vCPU") + @Param(description = "The speed of each vCPU") private Integer cpuSpeed; @SerializedName(ApiConstants.MEMORY) - @Param(description = "the memory allocated for the virtual machine") + @Param(description = "The memory allocated for the Instance") private Integer memory; @SerializedName(ApiConstants.VGPU) - @Param(description = "the vGPU type used by the virtual machine", since = "4.4") + @Param(description = "The vGPU type used by the Instance", since = "4.4") private String vgpu; @SerializedName("cpuused") - @Param(description = "the amount of the vm's CPU currently used") + @Param(description = "The amount of the Instance's CPU currently used") private String cpuUsed; @SerializedName("networkkbsread") - @Param(description = "the incoming network traffic on the VM in KiB") + @Param(description = "The incoming Network traffic on the Instance in KiB") private Long networkKbsRead; @SerializedName("networkkbswrite") - @Param(description = "the outgoing network traffic on the host in KiB") + @Param(description = "The outgoing Network traffic on the host in KiB") private Long networkKbsWrite; @SerializedName(ApiConstants.DISK_KBS_READ) - @Param(description = "the VM's disk read in KiB") + @Param(description = "The Instance's disk read in KiB") private Long diskKbsRead; @SerializedName(ApiConstants.DISK_KBS_WRITE) - @Param(description = "the VM's disk write in KiB") + @Param(description = "The Instance's disk write in KiB") private Long diskKbsWrite; @SerializedName("memorykbs") - @Param(description = "the memory used by the VM in KiB") + @Param(description = "The memory used by the Instance in KiB") private Long memoryKBs; @SerializedName("memoryintfreekbs") - @Param(description = "the internal memory (KiB) that's free in VM or zero if it can not be calculated") + @Param(description = "The internal memory (KiB) that's free in Instance or zero if it can not be calculated") private Long memoryIntFreeKBs; @SerializedName("memorytargetkbs") - @Param(description = "the target memory in VM (KiB)") + @Param(description = "The target memory in Instance (KiB)") private Long memoryTargetKBs; @SerializedName(ApiConstants.DISK_IO_READ) - @Param(description = "the read (IO) of disk on the VM") + @Param(description = "The read (IO) of disk on the Instance") private Long diskIORead; @SerializedName(ApiConstants.DISK_IO_WRITE) - @Param(description = "the write (IO) of disk on the VM") + @Param(description = "The write (IO) of disk on the Instance") private Long diskIOWrite; @SerializedName("guestosid") - @Param(description = "Os type ID of the virtual machine") + @Param(description = "OS type ID of the Instance") private String guestOsId; @SerializedName("rootdeviceid") - @Param(description = "device ID of the root volume") + @Param(description = "Device ID of the root volume") private Long rootDeviceId; @SerializedName("rootdevicetype") - @Param(description = "device type of the root volume") + @Param(description = "Device type of the root volume") private String rootDeviceType; @SerializedName("securitygroup") - @Param(description = "list of security groups associated with the virtual machine", responseObject = SecurityGroupResponse.class) + @Param(description = "List of security groups associated with the Instance", responseObject = SecurityGroupResponse.class) private Set securityGroupList; @SerializedName(ApiConstants.PASSWORD) - @Param(description = "the password (if exists) of the virtual machine", isSensitive = true) + @Param(description = "The password (if exists) of the Instance", isSensitive = true) private String password; @SerializedName("nic") - @Param(description = "the list of nics associated with vm", responseObject = NicResponse.class) + @Param(description = "The list of NICs associated with Instance", responseObject = NicResponse.class) private Set nics; @SerializedName("hypervisor") - @Param(description = "the hypervisor on which the template runs") + @Param(description = "The hypervisor on which the Template runs") private String hypervisor; @SerializedName(ApiConstants.IP_ADDRESS) @@ -283,41 +319,45 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co private String ipAddress; @SerializedName(ApiConstants.PUBLIC_IP_ID) - @Param(description = "public IP address id associated with vm via Static nat rule") + @Param(description = "Public IP address id associated with Instance via Static NAT rule") private String publicIpId; @SerializedName(ApiConstants.PUBLIC_IP) - @Param(description = "public IP address id associated with vm via Static nat rule") + @Param(description = "Public IP address id associated with Instance via Static NAT rule") private String publicIp; @SerializedName(ApiConstants.INSTANCE_NAME) - @Param(description = "instance name of the user vm; this parameter is returned to the ROOT admin only", since = "3.0.1") + @Param(description = "Instance name of the user Instance; this parameter is returned to the ROOT admin only", since = "3.0.1") private String instanceName; transient Set tagIds; @SerializedName(ApiConstants.DETAILS) - @Param(description = "Vm details in key/value pairs.", since = "4.2.1") + @Param(description = "Instance details in key/value pairs.", since = "4.2.1") private Map details; @SerializedName("readonlydetails") - @Param(description = "List of read-only Vm details as comma separated string.", since = "4.16.0") + @Param(description = "List of read-only Instance details as comma separated string.", since = "4.16.0") private String readOnlyDetails; + @SerializedName("alloweddetails") + @Param(description = "List of allowed Vm details as comma separated string if VM instance settings are read from OVA.", since = "4.22.1") + private String allowedDetails; + @SerializedName(ApiConstants.SSH_KEYPAIRS) - @Param(description = "ssh key-pairs") + @Param(description = "SSH key-pairs") private String keyPairNames; @SerializedName("affinitygroup") - @Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class) + @Param(description = "List of Affinity groups associated with the Instance", responseObject = AffinityGroupResponse.class) private Set affinityGroupList; @SerializedName(ApiConstants.DISPLAY_VM) - @Param(description = "an optional field whether to the display the vm to the end user or not.", authorized = {RoleType.Admin}) + @Param(description = "An optional field whether to the display the Instance to the end user or not.", authorized = {RoleType.Admin}) private Boolean displayVm; @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) - @Param(description = "true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.") + @Param(description = "True if Instance contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory.") private Boolean isDynamicallyScalable; @SerializedName(ApiConstants.DELETE_PROTECTION) @@ -329,31 +369,31 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co private String serviceState; @SerializedName(ApiConstants.OS_TYPE_ID) - @Param(description = "OS type id of the vm", since = "4.4") + @Param(description = "OS type id of the Instance", since = "4.4") private String osTypeId; @SerializedName(ApiConstants.OS_DISPLAY_NAME) - @Param(description = "OS name of the vm", since = "4.13.2") + @Param(description = "OS name of the Instance", since = "4.13.2") private String osDisplayName; @SerializedName(ApiConstants.BOOT_MODE) - @Param(description = "Guest vm Boot Mode") + @Param(description = "Guest Instance Boot Mode") private String bootMode; @SerializedName(ApiConstants.BOOT_TYPE) - @Param(description = "Guest vm Boot Type") + @Param(description = "Guest Instance Boot Type") private String bootType; @SerializedName(ApiConstants.POOL_TYPE) - @Param(description = "the pool type of the virtual machine", since = "4.16") + @Param(description = "The pool type of the Instance", since = "4.16") private String poolType; @SerializedName(ApiConstants.RECEIVED_BYTES) - @Param(description = "the total number of network traffic bytes received") + @Param(description = "The total number of Network traffic bytes received") private Long bytesReceived; @SerializedName(ApiConstants.SENT_BYTES) - @Param(description = "the total number of network traffic bytes sent") + @Param(description = "The total number of Network traffic bytes sent") private Long bytesSent; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -361,27 +401,27 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co ResourceIconResponse resourceIconResponse; @SerializedName(ApiConstants.AUTOSCALE_VMGROUP_ID) - @Param(description = "ID of AutoScale VM group", since = "4.18.0") + @Param(description = "ID of AutoScale Instance group", since = "4.18.0") String autoScaleVmGroupId; @SerializedName(ApiConstants.AUTOSCALE_VMGROUP_NAME) - @Param(description = "Name of AutoScale VM group", since = "4.18.0") + @Param(description = "Name of AutoScale Instance group", since = "4.18.0") String autoScaleVmGroupName; @SerializedName(ApiConstants.USER_DATA) @Param(description = "Base64 string containing the user data", since = "4.18.0.0") private String userData; - @SerializedName(ApiConstants.USER_DATA_ID) @Param(description="the id of userdata used for the VM", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_ID) @Param(description = "The ID of userdata used for the Instance", since = "4.18.0") private String userDataId; - @SerializedName(ApiConstants.USER_DATA_NAME) @Param(description="the name of userdata used for the VM", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_NAME) @Param(description = "The name of userdata used for the Instance", since = "4.18.0") private String userDataName; - @SerializedName(ApiConstants.USER_DATA_POLICY) @Param(description="the userdata override policy with the userdata provided while deploying VM", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_POLICY) @Param(description = "The userdata override policy with the userdata provided while deploying Instance", since = "4.18.0") private String userDataPolicy; - @SerializedName(ApiConstants.USER_DATA_DETAILS) @Param(description="list of variables and values for the variables declared in userdata", since = "4.18.0") + @SerializedName(ApiConstants.USER_DATA_DETAILS) @Param(description = "List of variables and values for the variables declared in userdata", since = "4.18.0") private String userDataDetails; @SerializedName(ApiConstants.VNF_NICS) @@ -392,10 +432,26 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co @Param(description = "VNF details", since = "4.19.0") private Map vnfDetails; - @SerializedName((ApiConstants.VM_TYPE)) + @SerializedName(ApiConstants.VM_TYPE) @Param(description = "User VM type", since = "4.20.0") private String vmType; + @SerializedName(ApiConstants.ARCH) + @Param(description = "CPU arch of the VM", since = "4.20.1") + private String arch; + + @SerializedName(ApiConstants.INSTANCE_LEASE_DURATION) + @Param(description = "Instance lease duration in days", since = "4.21.0") + private Integer leaseDuration; + + @SerializedName(ApiConstants.INSTANCE_LEASE_EXPIRY_DATE) + @Param(description = "Instance lease expiry date", since = "4.21.0") + private Date leaseExpiryDate; + + @SerializedName(ApiConstants.INSTANCE_LEASE_EXPIRY_ACTION) + @Param(description = "Instance lease expiry action", since = "4.21.0") + private String leaseExpiryAction; + public UserVmResponse() { securityGroupList = new LinkedHashSet<>(); nics = new TreeSet<>(Comparator.comparingInt(x -> Integer.parseInt(x.getDeviceId()))); @@ -549,6 +605,42 @@ public String getDiskOfferingName() { return diskOfferingName; } + public String getGpuCardId() { + return gpuCardId; + } + + public String getGpuCardName() { + return gpuCardName; + } + + public String getVgpuProfileId() { + return vgpuProfileId; + } + + public String getVgpuProfileName() { + return vgpuProfileName; + } + + public Long getVideoRam() { + return videoRam; + } + + public Long getMaxHeads() { + return maxHeads; + } + + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public Long getMaxResolutionY() { + return maxResolutionY; + } + + public Integer getGpuCount() { + return gpuCount; + } + public String getBackupOfferingId() { return backupOfferingId; } @@ -831,6 +923,42 @@ public void setDiskOfferingName(String diskOfferingName) { this.diskOfferingName = diskOfferingName; } + public void setGpuCardId(String gpuCardId) { + this.gpuCardId = gpuCardId; + } + + public void setGpuCardName(String gpuCardName) { + this.gpuCardName = gpuCardName; + } + + public void setVgpuProfileId(String vgpuProfileId) { + this.vgpuProfileId = vgpuProfileId; + } + + public void setVgpuProfileName(String vgpuProfileName) { + this.vgpuProfileName = vgpuProfileName; + } + + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; + } + + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; + } + + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } + + public void setGpuCount(Integer gpuCount) { + this.gpuCount = gpuCount; + } + public void setBackupOfferingId(String backupOfferingId) { this.backupOfferingId = backupOfferingId; } @@ -967,6 +1095,10 @@ public void setReadOnlyDetails(String readOnlyDetails) { this.readOnlyDetails = readOnlyDetails; } + public void setAllowedDetails(String allowedDetails) { + this.allowedDetails = allowedDetails; + } + public void setOsTypeId(String osTypeId) { this.osTypeId = osTypeId; } @@ -991,6 +1123,10 @@ public String getReadOnlyDetails() { return readOnlyDetails; } + public String getAllowedDetails() { + return allowedDetails; + } + public Boolean getDynamicallyScalable() { return isDynamicallyScalable; } @@ -1169,4 +1305,37 @@ public String getVmType() { public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } + + public String getArch() { + return arch; + } + + public void setArch(String arch) { + this.arch = arch; + } + + public Integer getLeaseDuration() { + return leaseDuration; + } + + public void setLeaseDuration(Integer leaseDuration) { + this.leaseDuration = leaseDuration; + } + + public String getLeaseExpiryAction() { + return leaseExpiryAction; + } + + public void setLeaseExpiryAction(String leaseExpiryAction) { + this.leaseExpiryAction = leaseExpiryAction; + } + + public Date getLeaseExpiryDate() { + return leaseExpiryDate; + } + + public void setLeaseExpiryDate(Date leaseExpiryDate) { + this.leaseExpiryDate = leaseExpiryDate; + } + } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VMScheduleResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VMScheduleResponse.java index 813a48e572c5..6800c25b0234 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VMScheduleResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VMScheduleResponse.java @@ -30,19 +30,19 @@ @EntityReference(value = VMSchedule.class) public class VMScheduleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of VM schedule") + @Param(description = "The ID of Instance schedule") private String id; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "ID of virtual machine") + @Param(description = "ID of Instance") private String vmId; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "Description of VM schedule") + @Param(description = "Description of Instance schedule") private String description; @SerializedName(ApiConstants.SCHEDULE) - @Param(description = "Cron formatted VM schedule") + @Param(description = "Cron formatted Instance schedule") private String schedule; @SerializedName(ApiConstants.TIMEZONE) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VMSnapshotResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VMSnapshotResponse.java index 703f27b537c2..46d5c548eb0f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VMSnapshotResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VMSnapshotResponse.java @@ -33,87 +33,87 @@ public class VMSnapshotResponse extends BaseResponseWithTagInformation implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the vm snapshot") + @Param(description = "The ID of the Instance Snapshot") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the vm snapshot") + @Param(description = "The name of the Instance Snapshot") private String name; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the vm snapshot") + @Param(description = "The state of the Instance Snapshot") private VMSnapshot.State state; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the vm snapshot") + @Param(description = "The description of the Instance Snapshot") private String description; @SerializedName(ApiConstants.DISPLAY_NAME) - @Param(description = "the display name of the vm snapshot") + @Param(description = "The display name of the Instance Snapshot") private String displayName; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the vm snapshot") + @Param(description = "The Zone ID of the Instance Snapshot") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the Zone name of the vm snapshot", since = "4.15.1") + @Param(description = "The Zone name of the Instance Snapshot", since = "4.15.1") private String zoneName; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "the vm ID of the vm snapshot") + @Param(description = "The Instance ID of the Instance Snapshot") private String virtualMachineId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_NAME) - @Param(description = "the vm name of the vm snapshot", since = "4.15.1") + @Param(description = "The Instance name of the Instance Snapshot", since = "4.15.1") private String virtualMachineName; @SerializedName("parent") - @Param(description = "the parent ID of the vm snapshot") + @Param(description = "The parent ID of the Instance Snapshot") private String parent; @SerializedName("parentName") - @Param(description = "the parent displayName of the vm snapshot") + @Param(description = "The parent displayName of the Instance Snapshot") private String parentName; @SerializedName("current") - @Param(description = "indicates if this is current snapshot") + @Param(description = "Indicates if this is current Snapshot") private Boolean current; @SerializedName("type") - @Param(description = "VM Snapshot type") + @Param(description = "Instance Snapshot type") private String type; @SerializedName(ApiConstants.CREATED) - @Param(description = "the create date of the vm snapshot") + @Param(description = "The create date of the Instance Snapshot") private Date created; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the disk volume") + @Param(description = "The Account associated with the disk volume") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vpn") + @Param(description = "The project ID of the VPN") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vpn") + @Param(description = "The project name of the VPN") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain associated with the disk volume") + @Param(description = "The ID of the domain associated with the disk volume") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the disk volume") + @Param(description = "The domain associated with the disk volume") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the disk volume belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the disk volume belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.HYPERVISOR) - @Param(description = "the type of hypervisor on which snapshot is stored") + @Param(description = "The type of hypervisor on which Snapshot is stored") private String hypervisor; public VMSnapshotResponse() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VMUserDataResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VMUserDataResponse.java index cf819491c2c0..4ff7891a8e27 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VMUserDataResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VMUserDataResponse.java @@ -26,11 +26,11 @@ public class VMUserDataResponse extends BaseResponse { @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "the ID of the virtual machine") + @Param(description = "The ID of the Instance") private String vmId; @SerializedName(ApiConstants.USER_DATA) - @Param(description = "Base64 encoded VM user data") + @Param(description = "Base64 encoded Instance User Data") private String userData; public void setUserData(String userData) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VgpuProfileResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VgpuProfileResponse.java new file mode 100644 index 000000000000..382b391ef592 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/api/response/VgpuProfileResponse.java @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.gpu.GpuCard; +import org.apache.cloudstack.gpu.VgpuProfile; + +@EntityReference(value = VgpuProfile.class) +public class VgpuProfileResponse extends GpuCardResponse { + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "the description of the vGPU profile") + private String description; + + @SerializedName(ApiConstants.GPU_CARD_ID) + @Param(description = "the ID of the GPU card associated with this vGPU profile") + private String gpuCardId; + + @SerializedName(ApiConstants.GPU_CARD_NAME) + @Param(description = "the name of the vGPU profile") + private String gpuCardName; + + @SerializedName(ApiConstants.MAX_VGPU_PER_PHYSICAL_GPU) + @Param(description = "the maximum number of vGPUs per physical GPU") + private Long maxVgpuPerPgpu; + + @SerializedName(ApiConstants.VIDEORAM) + @Param(description = "the video RAM size in MB") + private Long videoRam; + + @SerializedName(ApiConstants.MAXHEADS) + @Param(description = "the maximum number of display heads") + private Long maxHeads; + + @SerializedName(ApiConstants.MAXRESOLUTIONX) + @Param(description = "the maximum X resolution") + private Long maxResolutionX; + + @SerializedName(ApiConstants.MAXRESOLUTIONY) + @Param(description = "the maximum Y resolution") + private Long maxResolutionY; + + public VgpuProfileResponse(VgpuProfile vgpuProfile, GpuCard gpuCard) { + super(gpuCard); + id = vgpuProfile.getUuid(); + name = vgpuProfile.getName(); + description = vgpuProfile.getDescription(); + gpuCardId = gpuCard.getUuid(); + gpuCardName = gpuCard.getName(); + maxVgpuPerPgpu = vgpuProfile.getMaxVgpuPerPgpu(); + videoRam = vgpuProfile.getVideoRam(); + maxHeads = vgpuProfile.getMaxHeads(); + maxResolutionX = vgpuProfile.getMaxResolutionX(); + maxResolutionY = vgpuProfile.getMaxResolutionY(); + setObjectName("vgpuprofile"); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public String getGpuCardId() { + return gpuCardId; + } + + public String getGpuCardName() { + return gpuCardName; + } + + public Long getMaxVgpuPerPgpu() { + return maxVgpuPerPgpu; + } + + public void setDescription(String description) { + this.description = description; + } + + public Long getVideoRam() { + return videoRam; + } + + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; + } + + public Long getMaxHeads() { + return maxHeads; + } + + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; + } + + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + + public Long getMaxResolutionY() { + return maxResolutionY; + } + + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VgpuResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VgpuResponse.java index c51dc8d0f667..bf0968dd9bf1 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VgpuResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VgpuResponse.java @@ -46,15 +46,15 @@ public class VgpuResponse extends BaseResponse { private Long maxResolutionY; @SerializedName(ApiConstants.MAXVGPUPERPGPU) - @Param(description = "Maximum no. of vgpu per gpu card (pgpu)") + @Param(description = "Maximum no. of vGPU per GPU card (pgpu)") private Long maxVgpuPerPgpu; @SerializedName(ApiConstants.REMAININGCAPACITY) - @Param(description = "Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type") + @Param(description = "Remaining capacity in terms of no. of more Instances that can be deployed with this vGPU type") private Long remainingCapacity; @SerializedName(ApiConstants.MAXCAPACITY) - @Param(description = "Maximum vgpu can be created with this vgpu type on the given gpu group") + @Param(description = "Maximum vGPU can be created with this vGPU type on the given GPU group") private Long maxCapacity; public void setName(String name) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java index b9d18e238104..6d6be1677e45 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java @@ -29,11 +29,11 @@ @SuppressWarnings("unused") public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the id of the router") + @Param(description = "The ID of the router") private String id; @SerializedName(ApiConstants.NSP_ID) - @Param(description = "the physical network service provider id of the provider") + @Param(description = "The physical Network service provider ID of the provider") private String nspId; @SerializedName(ApiConstants.ENABLED) @@ -41,27 +41,27 @@ public class VirtualRouterProviderResponse extends BaseResponse implements Contr private Boolean enabled; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the provider") + @Param(description = "The Account associated with the provider") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the ipaddress") + @Param(description = "The project ID of the IP address") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the address") + @Param(description = "The project name of the address") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID associated with the provider") + @Param(description = "The domain ID associated with the provider") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the provider") + @Param(description = "The domain associated with the provider") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the provider belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the provider belongs", since = "4.19.2.0") private String domainPath; @Override diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VlanIpRangeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VlanIpRangeResponse.java index 1492c23e882a..9a171ef96ffc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VlanIpRangeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VlanIpRangeResponse.java @@ -28,108 +28,108 @@ @SuppressWarnings("unused") public class VlanIpRangeResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the VLAN IP range") + @Param(description = "The ID of the VLAN IP range") private String id; @SerializedName("forvirtualnetwork") - @Param(description = "the virtual network for the VLAN IP range") + @Param(description = "The virtual Network for the VLAN IP range") private Boolean forVirtualNetwork; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID of the VLAN IP range") + @Param(description = "The Zone ID of the VLAN IP range") private String zoneId; @SerializedName(ApiConstants.VLAN) - @Param(description = "the ID or VID of the VLAN.") + @Param(description = "The ID or VID of the VLAN.") private String vlan; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the VLAN IP range") + @Param(description = "The Account of the VLAN IP range") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID of the VLAN IP range") + @Param(description = "The domain ID of the VLAN IP range") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the VLAN IP range") + @Param(description = "The domain name of the VLAN IP range") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the VLAN IP range belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the VLAN IP range belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.POD_ID) - @Param(description = "the Pod ID for the VLAN IP range") + @Param(description = "The Pod ID for the VLAN IP range") private String podId; @SerializedName("podname") - @Param(description = "the Pod name for the VLAN IP range") + @Param(description = "The Pod name for the VLAN IP range") private String podName; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the VLAN IP range") + @Param(description = "The description of the VLAN IP range") private String description; @SerializedName(ApiConstants.GATEWAY) - @Param(description = "the gateway of the VLAN IP range") + @Param(description = "The gateway of the VLAN IP range") private String gateway; @SerializedName(ApiConstants.NETMASK) - @Param(description = "the netmask of the VLAN IP range") + @Param(description = "The netmask of the VLAN IP range") private String netmask; @SerializedName(ApiConstants.CIDR) - @Param(description = "the cidr of the VLAN IP range") + @Param(description = "The CIDR of the VLAN IP range") private String cidr; @SerializedName(ApiConstants.START_IP) - @Param(description = "the start ip of the VLAN IP range") + @Param(description = "The start IP of the VLAN IP range") private String startIp; @SerializedName(ApiConstants.END_IP) - @Param(description = "the end ip of the VLAN IP range") + @Param(description = "The end IP of the VLAN IP range") private String endIp; @SerializedName(ApiConstants.NETWORK_ID) - @Param(description = "the network id of vlan range") + @Param(description = "The Network ID of VLAN range") private String networkId; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vlan range") + @Param(description = "The project ID of the VLAN range") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vlan range") + @Param(description = "The project name of the VLAN range") private String projectName; @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) - @Param(description = "the physical network this belongs to") + @Param(description = "The physical Network this belongs to") private String physicalNetworkId; @SerializedName(ApiConstants.START_IPV6) - @Param(description = "the start ipv6 of the VLAN IP range") + @Param(description = "The start IPv6 of the VLAN IP range") private String startIpv6; @SerializedName(ApiConstants.END_IPV6) - @Param(description = "the end ipv6 of the VLAN IP range") + @Param(description = "The end IPv6 of the VLAN IP range") private String endIpv6; @SerializedName(ApiConstants.IP6_GATEWAY) - @Param(description = "the gateway of IPv6 network") + @Param(description = "The gateway of IPv6 Network") private String ip6Gateway; @SerializedName(ApiConstants.IP6_CIDR) - @Param(description = "the cidr of IPv6 network") + @Param(description = "The CIDR of IPv6 Network") private String ip6Cidr; @SerializedName(ApiConstants.FOR_SYSTEM_VMS) - @Param(description = "indicates whether VLAN IP range is dedicated to system vms or not") + @Param(description = "Indicates whether VLAN IP range is dedicated to System VMs or not") private Boolean forSystemVms; - @SerializedName(ApiConstants.FOR_NSX) - @Param(description = "indicates whether IP range is dedicated to NSX resources or not") - private Boolean forNsx; + @SerializedName(ApiConstants.PROVIDER) + @Param(description = "indicates to which provider the IP range is dedicated to", since = "4.21.0") + private String provider; public void setId(String id) { this.id = id; @@ -249,7 +249,7 @@ public void setIp6Cidr(String ip6Cidr) { this.ip6Cidr = ip6Cidr; } - public void setForNsx(Boolean forNsx) { - this.forNsx = forNsx; + public void setProvider(String provider) { + this.provider = provider; } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java index 3cf06f382428..3bfe61db5ff4 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java @@ -33,7 +33,7 @@ public class VmwareDatacenterResponse extends BaseResponse { private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the Zone ID associated with this VMware Datacenter") + @Param(description = "The Zone ID associated with this VMware Datacenter") private Long zoneId; @SerializedName(ApiConstants.NAME) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java index 209ca57c50d2..058ea50f991e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VolumeResponse.java @@ -38,7 +38,7 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "name of the disk volume") + @Param(description = "Name of the disk volume") private String name; @SerializedName(ApiConstants.ZONE_ID) @@ -46,103 +46,103 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "name of the availability zone") + @Param(description = "Name of the availability zone") private String zoneName; @SerializedName(ApiConstants.TYPE) - @Param(description = "type of the disk volume (ROOT or DATADISK)") + @Param(description = "Type of the disk volume (ROOT or DATADISK)") private String volumeType; @SerializedName(ApiConstants.DEVICE_ID) - @Param(description = "the ID of the device on user vm the volume is attahed to. This tag is not returned when the volume is detached.") + @Param(description = "The ID of the device on User Instance the volume is attached to. This tag is not returned when the volume is detached.") private Long deviceId; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) - @Param(description = "id of the virtual machine") + @Param(description = "ID of the Instance") private String virtualMachineId; @SerializedName("isoid") - @Param(description = "the ID of the ISO attached to the virtual machine") + @Param(description = "The ID of the ISO attached to the Instance") private String isoId; @SerializedName("isoname") - @Param(description = "the name of the ISO attached to the virtual machine") + @Param(description = "The name of the ISO attached to the Instance") private String isoName; @SerializedName("isodisplaytext") - @Param(description = "an alternate display text of the ISO attached to the virtual machine") + @Param(description = "An alternate display text of the ISO attached to the Instance") private String isoDisplayText; @SerializedName(ApiConstants.TEMPLATE_ID) - @Param(description = "the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") + @Param(description = "The ID of the Template for the Instance. A -1 is returned if the Instance was created from an ISO file.") private String templateId; @SerializedName("templatename") - @Param(description = "the name of the template for the virtual machine") + @Param(description = "The name of the Template for the Instance") private String templateName; @SerializedName("templatedisplaytext") - @Param(description = " an alternate display text of the template for the virtual machine") + @Param(description = "An alternate display text of the Template for the Instance") private String templateDisplayText; @SerializedName("vmname") - @Param(description = "name of the virtual machine") + @Param(description = "Name of the Instance") private String virtualMachineName; @SerializedName("vmdisplayname") - @Param(description = "display name of the virtual machine") + @Param(description = "Display name of the Instance") private String virtualMachineDisplayName; @SerializedName(ApiConstants.VIRTUAL_MACHINE_STATE) - @Param(description = "state of the virtual machine") + @Param(description = "State of the Instance") private String virtualMachineState; @SerializedName(ApiConstants.VM_TYPE) - @Param(description = "type of the virtual machine") + @Param(description = "Type of the Instance") private String vmType; @SerializedName(ApiConstants.PROVISIONINGTYPE) - @Param(description = "provisioning type used to create volumes.") + @Param(description = "Provisioning type used to create volumes.") private String provisioningType; @SerializedName(ApiConstants.SIZE) - @Param(description = "size of the disk volume") + @Param(description = "Size of the disk volume") private Long size; @SerializedName(ApiConstants.MIN_IOPS) - @Param(description = "min iops of the disk volume") + @Param(description = "Min IOPS of the disk volume") private Long minIops; @SerializedName(ApiConstants.MAX_IOPS) - @Param(description = "max iops of the disk volume") + @Param(description = "Max IOPS of the disk volume") private Long maxIops; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date the disk volume was created") + @Param(description = "The date the disk volume was created") private Date created; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the disk volume") + @Param(description = "The state of the disk volume") private String state; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account associated with the disk volume") + @Param(description = "The Account associated with the disk volume") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vpn") + @Param(description = "The project id of the VPN") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vpn") + @Param(description = "The project name of the VPN") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the ID of the domain associated with the disk volume") + @Param(description = "The ID of the domain associated with the disk volume") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain associated with the disk volume") + @Param(description = "The domain associated with the disk volume") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) @@ -150,15 +150,15 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String domainPath; @SerializedName("storagetype") - @Param(description = "shared or local storage") + @Param(description = "Shared or local storage") private String storageType; @SerializedName("diskBytesReadRate") - @Param(description = "bytes read rate of the disk volume") + @Param(description = "Bytes read rate of the disk volume") private Long bytesReadRate; @SerializedName("diskBytesWriteRate") - @Param(description = "bytes write rate of the disk volume") + @Param(description = "Bytes write rate of the disk volume") private Long bytesWriteRate; @SerializedName("diskIopsReadRate") @@ -170,19 +170,19 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private Long iopsWriteRate; @SerializedName(ApiConstants.DISK_KBS_READ) - @Param(description = "the VM's disk read in KiB") + @Param(description = "The Instance's disk read in KiB") private Long diskKbsRead; @SerializedName(ApiConstants.DISK_KBS_WRITE) - @Param(description = "the VM's disk write in KiB") + @Param(description = "The Instance's disk write in KiB") private Long diskKbsWrite; @SerializedName(ApiConstants.DISK_IO_READ) - @Param(description = "the read (IO) of disk on the vm") + @Param(description = "The read (IO) of disk on the Instance") private Long diskIORead; @SerializedName(ApiConstants.DISK_IO_WRITE) - @Param(description = "the write (IO) of disk on the vm") + @Param(description = "The write (IO) of disk on the Instance") private Long diskIOWrite; @SerializedName(ApiConstants.HYPERVISOR) @@ -194,27 +194,27 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String diskOfferingId; @SerializedName("diskofferingname") - @Param(description = "name of the disk offering") + @Param(description = "Name of the disk offering") private String diskOfferingName; @SerializedName("diskofferingdisplaytext") - @Param(description = "the display text of the disk offering") + @Param(description = "The display text of the disk offering") private String diskOfferingDisplayText; @SerializedName("storage") - @Param(description = "name of the primary storage hosting the disk volume") + @Param(description = "Name of the primary storage hosting the disk volume") private String storagePoolName; @SerializedName(ApiConstants.SNAPSHOT_ID) - @Param(description = "ID of the snapshot from which this volume was created") + @Param(description = "ID of the Snapshot from which this volume was created") private String snapshotId; @SerializedName("attached") - @Param(description = "the date the volume was attached to a VM instance") + @Param(description = "The date the volume was attached to an Instance") private Date attached; @SerializedName("destroyed") - @Param(description = "the boolean state of whether the volume is destroyed or not") + @Param(description = "The boolean state of whether the volume is destroyed or not") private boolean destroyed; @SerializedName(ApiConstants.SERVICE_OFFERING_ID) @@ -222,43 +222,43 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private String serviceOfferingId; @SerializedName("serviceofferingname") - @Param(description = "name of the service offering for root disk") + @Param(description = "Name of the service offering for root disk") private String serviceOfferingName; @SerializedName("serviceofferingdisplaytext") - @Param(description = "the display text of the service offering for root disk") + @Param(description = "The display text of the service offering for root disk") private String serviceOfferingDisplayText; @SerializedName("isextractable") - @Param(description = "true if the volume is extractable, false otherwise") + @Param(description = "True if the volume is extractable, false otherwise") private boolean extractable; @SerializedName(ApiConstants.STATUS) - @Param(description = "the status of the volume") + @Param(description = "The status of the volume") private String status; @SerializedName(ApiConstants.DISPLAY_VOLUME) - @Param(description = "an optional field whether to the display the volume to the end user or not.", authorized = {RoleType.Admin}) + @Param(description = "An optional field whether to the display the volume to the end User or not.", authorized = {RoleType.Admin}) private boolean displayVolume; @SerializedName(ApiConstants.PATH) - @Param(description = "the path of the volume") + @Param(description = "The path of the volume") private String path; @SerializedName(ApiConstants.STORAGE_ID) - @Param(description = "id of the primary storage hosting the disk volume; returned to admin user only", since = "4.3") + @Param(description = "ID of the primary storage hosting the disk volume; returned to admin User only", since = "4.3") private String storagePoolId; @SerializedName(ApiConstants.CHAIN_INFO) - @Param(description = "the chain info of the volume", since = "4.4") + @Param(description = "The chain info of the volume", since = "4.4") String chainInfo; @SerializedName(ApiConstants.SNAPSHOT_QUIESCEVM) - @Param(description = "need quiesce vm or not when taking snapshot", since = "4.3") + @Param(description = "Need quiesce Instance or not when taking Snapshot", since = "4.3") private boolean needQuiescevm; @SerializedName(ApiConstants.SUPPORTS_STORAGE_SNAPSHOT) - @Param(description = "true if storage snapshot is supported for the volume, false otherwise", since = "4.16") + @Param(description = "True if storage Snapshot is supported for the volume, false otherwise", since = "4.16") private boolean supportsStorageSnapshot; @SerializedName(ApiConstants.DELETE_PROTECTION) @@ -266,35 +266,35 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co private boolean deleteProtection; @SerializedName(ApiConstants.PHYSICAL_SIZE) - @Param(description = "the bytes actually consumed on disk") + @Param(description = "The bytes actually consumed on disk") private Long physicalsize; @SerializedName(ApiConstants.VIRTUAL_SIZE) - @Param(description = "the bytes allocated") + @Param(description = "The bytes allocated") private Long virtualsize; @SerializedName(ApiConstants.UTILIZATION) - @Param(description = "the disk utilization") + @Param(description = "The disk utilization") private String utilization; @SerializedName(ApiConstants.CLUSTER_ID) - @Param(description = "cluster id of the volume") + @Param(description = "Cluster id of the volume") private String clusterId; @SerializedName(ApiConstants.CLUSTER_NAME) - @Param(description = "cluster name where the volume is allocated") + @Param(description = "Cluster name where the volume is allocated") private String clusterName; @SerializedName(ApiConstants.POD_ID) - @Param(description = "pod id of the volume") + @Param(description = "Pod id of the volume") private String podId; @SerializedName(ApiConstants.POD_NAME) - @Param(description = "pod name of the volume") + @Param(description = "Pod name of the volume") private String podName; @SerializedName(ApiConstants.EXTERNAL_UUID) - @Param(description = "volume uuid that is given by virtualisation provider (only for VMware)") + @Param(description = "Volume UUID that is given by virtualisation provider (only for VMware)") private String externalUuid; @SerializedName(ApiConstants.VOLUME_CHECK_RESULT) diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VpcOfferingResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VpcOfferingResponse.java index b11764da7d98..2e821dae52de 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VpcOfferingResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VpcOfferingResponse.java @@ -31,43 +31,43 @@ @SuppressWarnings("unused") public class VpcOfferingResponse extends BaseResponse { @SerializedName("id") - @Param(description = "the id of the vpc offering") + @Param(description = "The ID of the VPC offering") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the vpc offering") + @Param(description = "The name of the VPC offering") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "an alternate display text of the vpc offering.") + @Param(description = "An alternate display text of the VPC offering.") private String displayText; @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this vpc offering was created") + @Param(description = "The date this VPC offering was created") private Date created; @SerializedName(ApiConstants.IS_DEFAULT) - @Param(description = "true if vpc offering is default, false otherwise") + @Param(description = "True if VPC offering is default, false otherwise") private Boolean isDefault; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the vpc offering. Can be Disabled/Enabled") + @Param(description = "State of the VPC offering. Can be Disabled/Enabled") private String state; @SerializedName(ApiConstants.SERVICE) - @Param(description = "the list of supported services", responseObject = ServiceResponse.class) + @Param(description = "The list of supported services", responseObject = ServiceResponse.class) private List services; @SerializedName(ApiConstants.DISTRIBUTED_VPC_ROUTER) - @Param(description = " indicates if the vpc offering supports distributed router for one-hop forwarding", since = "4.4") + @Param(description = "Indicates if the VPC offering supports distributed router for one-hop forwarding", since = "4.4") private Boolean supportsDistributedRouter; @SerializedName((ApiConstants.SUPPORTS_REGION_LEVEL_VPC)) - @Param(description = "indicated if the offering can support region level vpc", since = "4.4") + @Param(description = "Indicated if the offering can support region level VPC", since = "4.4") private Boolean supportsRegionLevelVpc; @SerializedName(ApiConstants.FOR_NSX) - @Param(description = "true if vpc offering can be used by NSX networks only") + @Param(description = "True if VPC offering can be used by NSX networks only") private Boolean forNsx; @SerializedName(ApiConstants.NETWORK_MODE) @@ -75,33 +75,37 @@ public class VpcOfferingResponse extends BaseResponse { private String networkMode; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") + @Param(description = "The domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.") private String domain; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zoneId; @SerializedName(ApiConstants.ZONE) - @Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") + @Param(description = "The zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0") private String zone; @SerializedName(ApiConstants.INTERNET_PROTOCOL) - @Param(description = "the internet protocol of the vpc offering") + @Param(description = "The internet protocol of the VPC offering") private String internetProtocol; @SerializedName(ApiConstants.SPECIFY_AS_NUMBER) - @Param(description = "true if network offering supports choosing AS numbers") + @Param(description = "True if network offering supports choosing AS numbers") private Boolean specifyAsNumber; @SerializedName(ApiConstants.ROUTING_MODE) - @Param(description = "the routing mode for the network offering, supported types are Static or Dynamic.") + @Param(description = "The routing mode for the network offering, supported types are Static or Dynamic.") private String routingMode; + @SerializedName(ApiConstants.CONSERVE_MODE) + @Param(description = "True if the VPC offering is IP conserve mode enabled, allowing public IP services to be used across multiple VPC tiers.", since = "4.23.0") + private Boolean conserveMode; + public void setId(String id) { this.id = id; } @@ -201,4 +205,12 @@ public String getRoutingMode() { public void setRoutingMode(String routingMode) { this.routingMode = routingMode; } + + public Boolean getConserveMode() { + return conserveMode; + } + + public void setConserveMode(Boolean conserveMode) { + this.conserveMode = conserveMode; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java index 56479506686a..34d50d5b9f92 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java @@ -34,103 +34,107 @@ @SuppressWarnings("unused") public class VpcResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse, SetResourceIconResponse { @SerializedName("id") - @Param(description = "the id of the VPC") + @Param(description = "The ID of the VPC") private String id; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the VPC") + @Param(description = "The name of the VPC") private String name; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "an alternate display text of the VPC.") + @Param(description = "An alternate display text of the VPC.") private String displayText; @SerializedName(ApiConstants.STATE) - @Param(description = "state of the VPC. Can be Inactive/Enabled") + @Param(description = "State of the VPC. Can be Inactive/Enabled") private String state; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "zone id of the vpc") + @Param(description = "Zone ID of the VPC") private String zoneId; @SerializedName(ApiConstants.ZONE_NAME) - @Param(description = "the name of the zone the VPC belongs to") + @Param(description = "The name of the zone the VPC belongs to") private String zoneName; @SerializedName(ApiConstants.SERVICE) - @Param(description = "the list of supported services", responseObject = ServiceResponse.class) + @Param(description = "The list of supported services", responseObject = ServiceResponse.class) private List services; @SerializedName(ApiConstants.CIDR) - @Param(description = "the cidr the VPC") + @Param(description = "The CIDR the VPC") private String cidr; @SerializedName(ApiConstants.VPC_OFF_ID) - @Param(description = "vpc offering id the VPC is created from") + @Param(description = "VPC offering ID the VPC is created from") private String vpcOfferingId; @SerializedName(ApiConstants.VPC_OFF_NAME) - @Param(description = "vpc offering name the VPC is created from", since = "4.13.2") + @Param(description = "VPC offering name the VPC is created from", since = "4.13.2") private String vpcOfferingName; + @SerializedName(ApiConstants.VPC_OFFERING_CONSERVE_MODE) + @Param(description = "true if VPC offering is ip conserve mode enabled", since = "4.23") + private Boolean vpcOfferingConserveMode; + @SerializedName(ApiConstants.CREATED) - @Param(description = "the date this VPC was created") + @Param(description = "The date this VPC was created") private Date created; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the owner of the VPC") + @Param(description = "The owner of the VPC") private String accountName; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the VPC") + @Param(description = "The project ID of the VPC") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the VPC") + @Param(description = "The project name of the VPC") private String projectName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the VPC owner") + @Param(description = "The domain ID of the VPC owner") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the owner") + @Param(description = "The domain name of the owner") private String domain; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "the domain path of the owner", since = "4.19.2.0") + @Param(description = "The domain path of the owner", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.NETWORK) - @Param(description = "the list of networks belongign to the VPC", responseObject = NetworkResponse.class) + @Param(description = "The list of Networks belonging to the VPC", responseObject = NetworkResponse.class) private List networks; @SerializedName(ApiConstants.RESTART_REQUIRED) - @Param(description = "true VPC requires restart") + @Param(description = "True VPC requires restart") private Boolean restartRequired; @SerializedName(ApiConstants.NETWORK_DOMAIN) - @Param(description = "the network domain of the VPC") + @Param(description = "The Network domain of the VPC") private String networkDomain; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with the project", responseObject = ResourceTagResponse.class) + @Param(description = "The list of resource tags associated with the project", responseObject = ResourceTagResponse.class) private List tags; @SerializedName(ApiConstants.FOR_DISPLAY) - @Param(description = "is vpc for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + @Param(description = "Is VPC for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) private Boolean forDisplay; @SerializedName(ApiConstants.DISTRIBUTED_VPC_ROUTER) - @Param(description = "is VPC uses distributed router for one hop forwarding and host based network ACL's", since = "4.4") + @Param(description = "Does VPC use distributed router for one hop forwarding and host based Network ACL's", since = "4.4") private boolean usesDistributedRouter; @SerializedName(ApiConstants.REGION_LEVEL_VPC) - @Param(description = "true if VPC is region level", since = "4.4") + @Param(description = "True if VPC is region level", since = "4.4") private Boolean regionLevelVpc; @SerializedName(ApiConstants.REDUNDANT_VPC_ROUTER) - @Param(description = "if this VPC has redundant router", since = "4.6") + @Param(description = "If this VPC has redundant router", since = "4.6") private boolean redundantRouter; @SerializedName(ApiConstants.RESOURCE_ICON) @@ -138,7 +142,7 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll ResourceIconResponse icon; @SerializedName(ApiConstants.IPV6_ROUTES) - @Param(description = "The routes for the network to ease adding route in upstream router", since = "4.17.0") + @Param(description = "The routes for the Network to ease adding route in upstream router", since = "4.17.0") private Set ipv6Routes; @SerializedName(ApiConstants.PUBLIC_MTU) @@ -146,19 +150,19 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll private Integer publicMtu; @SerializedName(ApiConstants.DNS1) - @Param(description = "the first IPv4 DNS for the VPC") + @Param(description = "The first IPv4 DNS for the VPC") private String dns1; @SerializedName(ApiConstants.DNS2) - @Param(description = "the second IPv4 DNS for the VPC") + @Param(description = "The second IPv4 DNS for the VPC") private String dns2; @SerializedName(ApiConstants.IP6_DNS1) - @Param(description = "the first IPv6 DNS for the VPC", since = "4.18.0") + @Param(description = "The first IPv6 DNS for the VPC", since = "4.18.0") private String ipv6Dns1; @SerializedName(ApiConstants.IP6_DNS2) - @Param(description = "the second IPv6 DNS for the VPC", since = "4.18.0") + @Param(description = "The second IPv6 DNS for the VPC", since = "4.18.0") private String ipv6Dns2; @SerializedName(ApiConstants.IPV4_ROUTING) @@ -181,6 +185,10 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll @Param(description = "The BGP peers for the VPC", since = "4.20.0") private Set bgpPeers; + @SerializedName(ApiConstants.KEEP_MAC_ADDRESS_ON_PUBLIC_NIC) + @Param(description = ApiConstants.PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC, since = "4.23.0") + private Boolean keepMacAddressOnPublicNic; + public void setId(final String id) { this.id = id; } @@ -197,6 +205,10 @@ public void setDisplayText(final String displayText) { this.displayText = displayText; } + public void setVpcOfferingConserveMode(Boolean vpcOfferingConserveMode) { + this.vpcOfferingConserveMode = vpcOfferingConserveMode; + } + public void setCreated(final Date created) { this.created = created; } @@ -358,4 +370,8 @@ public void addBgpPeer(BgpPeerResponse bgpPeer) { } this.bgpPeers.add(bgpPeer); } + + public void setKeepMacAddressOnPublicNic(Boolean keepMacAddressOnPublicNic) { + this.keepMacAddressOnPublicNic = keepMacAddressOnPublicNic; + } } diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VpnUsersResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VpnUsersResponse.java index 3247f534133c..cdf4dbe32b81 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VpnUsersResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VpnUsersResponse.java @@ -29,39 +29,39 @@ @SuppressWarnings("unused") public class VpnUsersResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the vpn userID") + @Param(description = "The VPN user ID") private String id; @SerializedName(ApiConstants.USERNAME) - @Param(description = "the username of the vpn user") + @Param(description = "The username of the VPN user") private String userName; @SerializedName(ApiConstants.ACCOUNT) - @Param(description = "the account of the remote access vpn") + @Param(description = "The Account of the remote access VPN") private String accountName; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the domain id of the account of the remote access vpn") + @Param(description = "The domain ID of the Account of the remote access VPN") private String domainId; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "the domain name of the account of the remote access vpn") + @Param(description = "The domain name of the Account of the remote access VPN") private String domainName; @SerializedName(ApiConstants.DOMAIN_PATH) - @Param(description = "path of the domain to which the remote access vpn belongs", since = "4.19.2.0") + @Param(description = "Path of the domain to which the remote access VPN belongs", since = "4.19.2.0") private String domainPath; @SerializedName(ApiConstants.PROJECT_ID) - @Param(description = "the project id of the vpn") + @Param(description = "The project ID of the VPN") private String projectId; @SerializedName(ApiConstants.PROJECT) - @Param(description = "the project name of the vpn") + @Param(description = "The project name of the VPN") private String projectName; @SerializedName(ApiConstants.STATE) - @Param(description = "the state of the Vpn User, can be 'Add', 'Revoke' or 'Active'.") + @Param(description = "The state of the VPN User, can be 'Add', 'Revoke' or 'Active'.") private String state; public void setId(String id) { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/VsphereStoragePoliciesResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/VsphereStoragePoliciesResponse.java index 63c49f148790..3d1518a1cae3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/VsphereStoragePoliciesResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/VsphereStoragePoliciesResponse.java @@ -28,23 +28,23 @@ public class VsphereStoragePoliciesResponse extends BaseResponse { @SerializedName(ApiConstants.ID) - @Param(description = "the ID of the Storage Policy") + @Param(description = "The ID of the Storage Policy") private String id; @SerializedName(ApiConstants.ZONE_ID) - @Param(description = "the ID of the Zone") + @Param(description = "The ID of the Zone") private String zoneId; @SerializedName(ApiConstants.POLICY_ID) - @Param(description = "the identifier of the Storage Policy in vSphere DataCenter") + @Param(description = "The identifier of the Storage Policy in vSphere DataCenter") private String policyId; @SerializedName(ApiConstants.NAME) - @Param(description = "the name of the Storage Policy") + @Param(description = "The name of the Storage Policy") private String name; @SerializedName(ApiConstants.DESCRIPTION) - @Param(description = "the description of the Storage Policy") + @Param(description = "The description of the Storage Policy") private String description; public String getId() { diff --git a/api/src/main/java/org/apache/cloudstack/api/response/ZoneResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/ZoneResponse.java index 4a5279753a10..a05ee925ac09 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/ZoneResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/ZoneResponse.java @@ -46,59 +46,67 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso private String description; @SerializedName(ApiConstants.DNS1) - @Param(description = "the first DNS for the Zone") + @Param(description = "The first DNS for the Zone") private String dns1; @SerializedName(ApiConstants.DNS2) - @Param(description = "the second DNS for the Zone") + @Param(description = "The second DNS for the Zone") private String dns2; @SerializedName(ApiConstants.IP6_DNS1) - @Param(description = "the first IPv6 DNS for the Zone") + @Param(description = "The first IPv6 DNS for the Zone") private String ip6Dns1; @SerializedName(ApiConstants.IP6_DNS2) - @Param(description = "the second IPv6 DNS for the Zone") + @Param(description = "The second IPv6 DNS for the Zone") private String ip6Dns2; @SerializedName(ApiConstants.INTERNAL_DNS1) - @Param(description = "the first internal DNS for the Zone") + @Param(description = "The first internal DNS for the Zone") private String internalDns1; @SerializedName(ApiConstants.INTERNAL_DNS2) - @Param(description = "the second internal DNS for the Zone") + @Param(description = "The second internal DNS for the Zone") private String internalDns2; @SerializedName(ApiConstants.GUEST_CIDR_ADDRESS) - @Param(description = "the guest CIDR address for the Zone") + @Param(description = "The guest CIDR address for the Zone") private String guestCidrAddress; @SerializedName(ApiConstants.DISPLAY_TEXT) - @Param(description = "the display text of the zone") + @Param(description = "The display text of the zone") private String displayText; @SerializedName(ApiConstants.DOMAIN) - @Param(description = "Network domain name for the networks in the zone") + @Param(description = "Network domain name for the Networks in the zone") private String domain; @SerializedName(ApiConstants.DOMAIN_ID) - @Param(description = "the UUID of the containing domain, null for public zones") + @Param(description = "The UUID of the containing domain, null for public zones") private String domainId; @SerializedName("domainname") - @Param(description = "the name of the containing domain, null for public zones") + @Param(description = "The name of the containing domain, null for public zones") private String domainName; @SerializedName(ApiConstants.NETWORK_TYPE) - @Param(description = "the network type of the zone; can be Basic or Advanced") + @Param(description = "The Network type of the zone; can be Basic or Advanced") private String networkType; @SerializedName("securitygroupsenabled") - @Param(description = "true if security groups support is enabled, false otherwise") - private boolean securityGroupsEnabled; + @Param(description = "True if security groups support is enabled, false otherwise") + private Boolean securityGroupsEnabled; + + @SerializedName("gputotal") + @Param(description = "Total GPUs in the Zone", responseObject = Long.class, since = "4.21") + private Long gpuTotal; + + @SerializedName("gpuused") + @Param(description = "Used GPUs in the Zone", responseObject = Long.class, since = "4.21") + private Long gpuUsed; @SerializedName("allocationstate") - @Param(description = "the allocation state of the cluster") + @Param(description = "The allocation state of the cluster") private String allocationState; @SerializedName(ApiConstants.ZONE_TOKEN) @@ -106,19 +114,19 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso private String zoneToken; @SerializedName(ApiConstants.DHCP_PROVIDER) - @Param(description = "the dhcp Provider for the Zone") + @Param(description = "The DHCP Provider for the Zone") private String dhcpProvider; @SerializedName("capacity") - @Param(description = "the capacity of the Zone", responseObject = CapacityResponse.class) + @Param(description = "The capacity of the Zone", responseObject = CapacityResponse.class) private List capacities; @SerializedName(ApiConstants.LOCAL_STORAGE_ENABLED) - @Param(description = "true if local storage offering enabled, false otherwise") - private boolean localStorageEnabled; + @Param(description = "True if local storage offering enabled, false otherwise") + private Boolean localStorageEnabled; @SerializedName(ApiConstants.TAGS) - @Param(description = "the list of resource tags associated with zone.", responseObject = ResourceTagResponse.class, since = "4.3") + @Param(description = "The list of resource tags associated with zone.", responseObject = ResourceTagResponse.class, since = "4.3") private Set tags; @SerializedName(ApiConstants.RESOURCE_DETAILS) @@ -142,15 +150,20 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso private Integer routerPublicInterfaceMaxMtu; @SerializedName(ApiConstants.TYPE) - @Param(description = "the type of the zone - core or edge", since = "4.18.0") + @Param(description = "The type of the zone - core or edge", since = "4.18.0") String type; + @Deprecated(since = "4.21.0") @SerializedName(ApiConstants.NSX_ENABLED) - @Param(description = "true, if zone is NSX enabled", since = "4.20.0") + @Param(description = "True, if zone is NSX enabled", since = "4.20.0") private boolean nsxEnabled = false; + @SerializedName(ApiConstants.PROVIDER) + @Param(description = "External network provider if any", since = "4.21.0") + private String provider = null; + @SerializedName(ApiConstants.MULTI_ARCH) - @Param(description = "true, if zone contains clusters and hosts from different CPU architectures", since = "4.20") + @Param(description = "True, if zone contains clusters and hosts from different CPU architectures", since = "4.20") private boolean multiArch; @SerializedName(ApiConstants.ASN_RANGE) @@ -158,14 +171,22 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso private String asnRange; @SerializedName(ApiConstants.ROUTED_MODE_ENABLED) - @Param(description = "true, if routed network/vpc is enabled", since = "4.20.1") + @Param(description = "True, if routed Network/VPC is enabled", since = "4.20.1") private boolean routedModeEnabled = false; + @SerializedName(ApiConstants.STORAGE_ACCESS_GROUPS) + @Param(description = "comma-separated list of storage access groups for the zone", since = "4.21.0") + private String storageAccessGroups; + public ZoneResponse() { tags = new LinkedHashSet(); } + public ZoneResponse(Set tags) { + this.tags = tags; + } + public void setId(String id) { this.id = id; } @@ -218,6 +239,14 @@ public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) { this.securityGroupsEnabled = securityGroupsEnabled; } + public void setGpuTotal(Long gpuTotal) { + this.gpuTotal = gpuTotal; + } + + public void setGpuUsed(Long gpuUsed) { + this.gpuUsed = gpuUsed; + } + public void setAllocationState(String allocationState) { this.allocationState = allocationState; } @@ -353,6 +382,14 @@ public boolean isSecurityGroupsEnabled() { return securityGroupsEnabled; } + public Long getGpuUsed() { + return gpuUsed; + } + + public Long getGpuTotal() { + return gpuTotal; + } + public boolean isLocalStorageEnabled() { return localStorageEnabled; } @@ -373,6 +410,14 @@ public boolean isNsxEnabled() { return nsxEnabled; } + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + @Override public void setResourceIconResponse(ResourceIconResponse resourceIconResponse) { this.resourceIconResponse = resourceIconResponse; @@ -402,6 +447,14 @@ public String getType() { return type; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + public void setNsxEnabled(boolean nsxEnabled) { this.nsxEnabled = nsxEnabled; } diff --git a/api/src/main/java/org/apache/cloudstack/backup/Backup.java b/api/src/main/java/org/apache/cloudstack/backup/Backup.java index dffe8a032134..2d68f18b953f 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/Backup.java +++ b/api/src/main/java/org/apache/cloudstack/backup/Backup.java @@ -19,6 +19,7 @@ import java.util.Date; import java.util.List; +import java.util.Map; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; @@ -29,30 +30,16 @@ public interface Backup extends ControlledEntity, InternalIdentity, Identity { - enum Status { - Allocated, Queued, BackingUp, BackedUp, Error, Failed, Restoring, Removed, Expunged - } + String getFromCheckpointId(); - public enum Type { - MANUAL, HOURLY, DAILY, WEEKLY, MONTHLY; - private int max = 8; + String getToCheckpointId(); - public void setMax(int max) { - this.max = max; - } - - public int getMax() { - return max; - } + Long getCheckpointCreateTime(); - @Override - public String toString() { - return this.name(); - } + Long getHostId(); - public boolean equals(String snapshotType) { - return this.toString().equalsIgnoreCase(snapshotType); - } + enum Status { + Allocated, Queued, BackingUp, ReadyForImageTransfer, FinalizingImageTransfer, BackedUp, Error, Failed, Restoring, Removed, Expunged } class Metric { @@ -85,6 +72,8 @@ class RestorePoint { private String id; private Date created; private String type; + private Long backupSize = 0L; + private Long dataSize = 0L; public RestorePoint(String id, Date created, String type) { this.id = id; @@ -92,6 +81,12 @@ public RestorePoint(String id, Date created, String type) { this.type = type; } + public RestorePoint(String id, Date created, String type, Long backupSize, Long dataSize) { + this(id, created, type); + this.backupSize = backupSize; + this.dataSize = dataSize; + } + public String getId() { return id; } @@ -115,6 +110,22 @@ public String getType() { public void setType(String type) { this.type = type; } + + public Long getBackupSize() { + return backupSize; + } + + public void setBackupSize(Long backupSize) { + this.backupSize = backupSize; + } + + public Long getDataSize() { + return dataSize; + } + + public void setDataSize(Long dataSize) { + this.dataSize = dataSize; + } } class VolumeInfo { @@ -122,12 +133,20 @@ class VolumeInfo { private Volume.Type type; private Long size; private String path; + private Long deviceId; + private String diskOfferingId; + private Long minIops; + private Long maxIops; - public VolumeInfo(String uuid, String path, Volume.Type type, Long size) { + public VolumeInfo(String uuid, String path, Volume.Type type, Long size, Long deviceId, String diskOfferingId, Long minIops, Long maxIops) { this.uuid = uuid; this.type = type; this.size = size; this.path = path; + this.deviceId = deviceId; + this.diskOfferingId = diskOfferingId; + this.minIops = minIops; + this.maxIops = maxIops; } public String getUuid() { @@ -150,13 +169,29 @@ public Long getSize() { return size; } + public Long getDeviceId() { + return deviceId; + } + + public String getDiskOfferingId() { + return diskOfferingId; + } + + public Long getMinIops() { + return minIops; + } + + public Long getMaxIops() { + return maxIops; + } + @Override public String toString() { - return StringUtils.join(":", uuid, path, type, size); + return StringUtils.join(":", uuid, path, type, size, deviceId, diskOfferingId, minIops, maxIops); } } - long getVmId(); + Long getVmId(); long getBackupOfferingId(); String getExternalId(); String getType(); @@ -164,6 +199,12 @@ public String toString() { Backup.Status getStatus(); Long getSize(); Long getProtectedSize(); + void setName(String name); + String getDescription(); + void setDescription(String description); List getBackedUpVolumes(); long getZoneId(); + Map getDetails(); + String getDetail(String name); + Long getBackupScheduleId(); } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java b/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java index eebad3af0674..0da11bbd651a 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupManager.java @@ -18,20 +18,32 @@ package org.apache.cloudstack.backup; import java.util.List; +import java.util.Map; +import com.cloud.capacity.Capacity; import com.cloud.exception.ResourceAllocationException; +import org.apache.cloudstack.api.command.admin.backup.CloneBackupOfferingCmd; import org.apache.cloudstack.api.command.admin.backup.ImportBackupOfferingCmd; import org.apache.cloudstack.api.command.admin.backup.UpdateBackupOfferingCmd; +import org.apache.cloudstack.api.command.user.backup.CreateBackupCmd; import org.apache.cloudstack.api.command.user.backup.CreateBackupScheduleCmd; import org.apache.cloudstack.api.command.user.backup.DeleteBackupScheduleCmd; import org.apache.cloudstack.api.command.user.backup.ListBackupOfferingsCmd; +import org.apache.cloudstack.api.command.user.backup.ListBackupScheduleCmd; import org.apache.cloudstack.api.command.user.backup.ListBackupsCmd; +import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.ValidatedConfigKey; import org.apache.cloudstack.framework.config.Configurable; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.storage.Volume; import com.cloud.utils.Pair; import com.cloud.utils.component.Manager; import com.cloud.utils.component.PluggableService; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VmDiskInfo; /** * Backup and Recover Manager Interface @@ -43,10 +55,11 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer "false", "Is backup and recovery framework enabled.", false, ConfigKey.Scope.Zone); - ConfigKey BackupProviderPlugin = new ConfigKey<>("Advanced", String.class, + ConfigKey BackupProviderPlugin = new ValidatedConfigKey<>("Advanced", String.class, "backup.framework.provider.plugin", "dummy", - "The backup and recovery provider plugin.", true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key()); + "The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker and nas", + true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key(), value -> validateBackupProviderConfig((String)value)); ConfigKey BackupSyncPollingInterval = new ConfigKey<>("Advanced", Long.class, "backup.framework.sync.interval", @@ -58,38 +71,6 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer "false", "Enable volume attach/detach operations for VMs that are assigned to Backup Offerings.", true); - ConfigKey BackupHourlyMax = new ConfigKey("Advanced", Integer.class, - "backup.max.hourly", - "8", - "Maximum recurring hourly backups to be retained for an instance. If the limit is reached, early backups from the start of the hour are deleted so that newer ones can be saved. This limit does not apply to manual backups. If set to 0, recurring hourly backups can not be scheduled.", - false, - ConfigKey.Scope.Global, - null); - - ConfigKey BackupDailyMax = new ConfigKey("Advanced", Integer.class, - "backup.max.daily", - "8", - "Maximum recurring daily backups to be retained for an instance. If the limit is reached, backups from the start of the day are deleted so that newer ones can be saved. This limit does not apply to manual backups. If set to 0, recurring daily backups can not be scheduled.", - false, - ConfigKey.Scope.Global, - null); - - ConfigKey BackupWeeklyMax = new ConfigKey("Advanced", Integer.class, - "backup.max.weekly", - "8", - "Maximum recurring weekly backups to be retained for an instance. If the limit is reached, backups from the beginning of the week are deleted so that newer ones can be saved. This limit does not apply to manual backups. If set to 0, recurring weekly backups can not be scheduled.", - false, - ConfigKey.Scope.Global, - null); - - ConfigKey BackupMonthlyMax = new ConfigKey("Advanced", Integer.class, - "backup.max.monthly", - "8", - "Maximum recurring monthly backups to be retained for an instance. If the limit is reached, backups from the beginning of the month are deleted so that newer ones can be saved. This limit does not apply to manual backups. If set to 0, recurring monthly backups can not be scheduled.", - false, - ConfigKey.Scope.Global, - null); - ConfigKey DefaultMaxAccountBackups = new ConfigKey("Account Defaults", Long.class, "max.account.backups", "20", @@ -138,6 +119,14 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer ConfigKey.Scope.Global, null); + ConfigKey BackupStorageCapacityThreshold = new ConfigKey<>("Alert", Float.class, + "zone.backupStorage.capacity.notificationthreshold", + "0.75", + "Percentage (as a value between 0 and 1) of backup storage utilization above which alerts will be sent about low storage available.", + true, + ConfigKey.Scope.Zone, + null); + /** * List backup provider offerings * @param zoneId zone id @@ -150,6 +139,14 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer */ BackupOffering importBackupOffering(final ImportBackupOfferingCmd cmd); + List getBackupOfferingDomains(final Long offeringId); + + /** + * Clone an existing backup offering with updated values + * @param cmd clone backup offering cmd + */ + BackupOffering cloneBackupOffering(final CloneBackupOfferingCmd cmd); + /** * List backup offerings * @param ListBackupOfferingsCmd API cmd @@ -189,7 +186,7 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer * @param vmId * @return */ - List listBackupSchedule(Long vmId); + List listBackupSchedules(ListBackupScheduleCmd cmd); /** * Deletes VM backup schedule for a VM @@ -200,11 +197,11 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer /** * Creates backup of a VM - * @param vmId Virtual Machine ID - * @param scheduleId Virtual Machine Backup Schedule ID + * @param cmd CreateBackupCmd + * @param job The async job associated with the backup retention * @return returns operation success */ - boolean createBackup(final Long vmId, final Long scheduleId) throws ResourceAllocationException; + boolean createBackup(CreateBackupCmd cmd, Object job) throws ResourceAllocationException; /** * List existing backups for a VM @@ -216,6 +213,17 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer */ boolean restoreBackup(final Long backupId); + Map getIpToNetworkMapFromBackup(Backup backup, boolean preserveIps, List networkIds); + + Boolean canCreateInstanceFromBackup(Long backupId); + + Boolean canCreateInstanceFromBackupAcrossZones(Long backupId); + + /** + * Restore a backup to a new Instance + */ + boolean restoreBackupToVM(Long backupId, Long vmId) throws ResourceUnavailableException; + /** * Restore a backed up volume and attach it to a VM */ @@ -227,7 +235,37 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer * @param forced Indicates if backup will be force removed or not * @return returns operation success */ - boolean deleteBackup(final Long backupId, final Boolean forced); + boolean deleteBackup(final Long backupId, final Boolean forced) throws ResourceAllocationException; + + void validateBackupForZone(Long zoneId); BackupOffering updateBackupOffering(UpdateBackupOfferingCmd updateBackupOfferingCmd); + + VmDiskInfo getRootDiskInfoFromBackup(Backup backup); + + List getDataDiskInfoListFromBackup(Backup backup); + + void checkVmDisksSizeAgainstBackup(List vmDiskInfoList, Backup backup); + + Map getBackupDetailsFromVM(VirtualMachine vm); + + String createVolumeInfoFromVolumes(List vmVolumes); + + String getBackupNameFromVM(VirtualMachine vm); + + BackupResponse createBackupResponse(Backup backup, Boolean listVmDetails); + + Capacity getBackupStorageUsedStats(Long zoneId); + + void checkAndRemoveBackupOfferingBeforeExpunge(VirtualMachine vm); + + static void validateBackupProviderConfig(String value) { + if (value != null && (value.contains(",") || value.trim().contains(" "))) { + throw new IllegalArgumentException("Multiple backup provider plugins are not supported. Please provide a single plugin value."); + } + List validPlugins = List.of("dummy", "veeam", "networker", "nas"); + if (value != null && !validPlugins.contains(value)) { + throw new IllegalArgumentException("Invalid backup provider plugin: " + value + ". Valid plugin values are: " + String.join(", ", validPlugins)); + } + } } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupProvider.java b/api/src/main/java/org/apache/cloudstack/backup/BackupProvider.java index 39582b0e423c..23b8092425d9 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupProvider.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupProvider.java @@ -17,13 +17,14 @@ package org.apache.cloudstack.backup; import java.util.List; -import java.util.Map; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine; public interface BackupProvider { + Boolean crossZoneInstanceCreationEnabled(BackupOffering backupOffering); + /** * Returns the unique name of the provider * @return returns provider name @@ -71,10 +72,12 @@ public interface BackupProvider { /** * Starts and creates an adhoc backup process * for a previously registered VM backup - * @param vm the machine to make a backup of + * + * @param vm the machine to make a backup of + * @param quiesceVM instance will be quiesced for checkpointing for backup. Applicable only to NAS plugin. * @return the result and {code}Backup{code} {code}Object{code} */ - Pair takeBackup(VirtualMachine vm); + Pair takeBackup(VirtualMachine vm, Boolean quiesceVM); /** * Delete an existing backup @@ -84,6 +87,8 @@ public interface BackupProvider { */ boolean deleteBackup(Backup backup, boolean forced); + Pair restoreBackupToVM(VirtualMachine vm, Backup backup, String hostIp, String dataStoreUuid); + /** * Restore VM from backup */ @@ -92,27 +97,48 @@ public interface BackupProvider { /** * Restore a volume from a backup */ - Pair restoreBackedUpVolume(Backup backup, String volumeUuid, String hostIp, String dataStoreUuid, Pair vmNameAndState); + Pair restoreBackedUpVolume(Backup backup, Backup.VolumeInfo backupVolumeInfo, String hostIp, String dataStoreUuid, Pair vmNameAndState); /** - * Returns backup metrics for a list of VMs in a zone + * Syncs backup metrics (backup size, protected size) from the plugin and stores it within the provider * @param zoneId the zone for which to return metrics - * @param vms a list of machines to get measurements for - * @return a map of machine -> backup metrics */ - Map getBackupMetrics(Long zoneId, List vms); + void syncBackupMetrics(Long zoneId); /** - * This method should TODO - * @param vm the machine to get restore point for + * Returns a list of Backup.RestorePoint + * @param vm the machine to get the restore points for */ List listRestorePoints(VirtualMachine vm); /** - * This method should TODO + * Creates and returns an entry in the backups table by getting the information from restorePoint and vm. + * * @param restorePoint the restore point to create a backup for - * @param vm The machine for which to create a backup - * @param metric the metric object to update with the new backup data + * @param vm The machine for which to create a backup + */ + Backup createNewBackupEntryForRestorePoint(Backup.RestorePoint restorePoint, VirtualMachine vm); + + /** + * Returns if the backup provider supports creating new instance from backup */ - Backup createNewBackupEntryForRestorePoint(Backup.RestorePoint restorePoint, VirtualMachine vm, Backup.Metric metric); + boolean supportsInstanceFromBackup(); + + default boolean supportsMemoryVmSnapshot() { + return true; + } + + /** + * Returns the backup storage usage (Used, Total) for a backup provider + * @param zoneId the zone for which to return metrics + * @return a pair of Used size and Total size for the backup storage + */ + Pair getBackupStorageStats(Long zoneId); + + /** + * Gets the backup storage usage (Used, Total) from the plugin and stores it in db + * @param zoneId the zone for which to return metrics + */ + void syncBackupStorageStats(Long zoneId); + } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupRepository.java b/api/src/main/java/org/apache/cloudstack/backup/BackupRepository.java index 8e5c9740e690..886d13c13f93 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupRepository.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupRepository.java @@ -28,7 +28,12 @@ public interface BackupRepository extends InternalIdentity, Identity { String getType(); String getAddress(); String getMountOptions(); + void setMountOptions(String mountOptions); + void setUsedBytes(Long usedBytes); Long getCapacityBytes(); Long getUsedBytes(); + void setCapacityBytes(Long capacityBytes); + Boolean crossZoneInstanceCreationEnabled(); + void setCrossZoneInstanceCreation(Boolean crossZoneInstanceCreation); Date getCreated(); } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java b/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java index ae71053e400d..cc8144ebe403 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupRepositoryService.java @@ -23,12 +23,13 @@ import org.apache.cloudstack.api.command.user.backup.repository.AddBackupRepositoryCmd; import org.apache.cloudstack.api.command.user.backup.repository.DeleteBackupRepositoryCmd; import org.apache.cloudstack.api.command.user.backup.repository.ListBackupRepositoriesCmd; +import org.apache.cloudstack.api.command.user.backup.repository.UpdateBackupRepositoryCmd; import java.util.List; public interface BackupRepositoryService { BackupRepository addBackupRepository(AddBackupRepositoryCmd cmd); + BackupRepository updateBackupRepository(UpdateBackupRepositoryCmd cmd); boolean deleteBackupRepository(DeleteBackupRepositoryCmd cmd); Pair, Integer> listBackupRepositories(ListBackupRepositoriesCmd cmd); - } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupSchedule.java b/api/src/main/java/org/apache/cloudstack/backup/BackupSchedule.java index 4ff946be9cd4..44fdf70c4c15 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupSchedule.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupSchedule.java @@ -19,16 +19,19 @@ import java.util.Date; +import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.InternalIdentity; import com.cloud.utils.DateUtil; -public interface BackupSchedule extends InternalIdentity { +public interface BackupSchedule extends ControlledEntity, InternalIdentity { Long getVmId(); DateUtil.IntervalType getScheduleType(); String getSchedule(); String getTimezone(); Date getScheduledTimestamp(); Long getAsyncJobId(); - Integer getMaxBackups(); + Boolean getQuiesceVM(); + int getMaxBackups(); + String getUuid(); } diff --git a/api/src/main/java/org/apache/cloudstack/backup/BackupService.java b/api/src/main/java/org/apache/cloudstack/backup/BackupService.java index d4beb629fe0f..3ba2978c0fa5 100644 --- a/api/src/main/java/org/apache/cloudstack/backup/BackupService.java +++ b/api/src/main/java/org/apache/cloudstack/backup/BackupService.java @@ -34,4 +34,11 @@ public interface BackupService { * @return backup provider */ BackupProvider getBackupProvider(final Long zoneId); + + /** + * Find backup provider by name + * @param name backup provider name + * @return backup provider + */ + BackupProvider getBackupProvider(final String name); } diff --git a/api/src/main/java/org/apache/cloudstack/backup/ImageTransfer.java b/api/src/main/java/org/apache/cloudstack/backup/ImageTransfer.java new file mode 100644 index 000000000000..e1153be3ae02 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/backup/ImageTransfer.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup; + +import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface ImageTransfer extends ControlledEntity, InternalIdentity { + long getDataCenterId(); + + public enum Direction { + upload, download + } + + public enum Format { + raw, + cow + } + + public enum Backend { + nbd, + file + } + + public enum Phase { + initializing, transferring, finished, failed + } + + String getUuid(); + + Long getBackupId(); + + long getVolumeId(); + + long getHostId(); + + String getTransferUrl(); + + Phase getPhase(); + + Direction getDirection(); + + Backend getBackend(); + + String getSignedTicketId(); +} diff --git a/api/src/main/java/org/apache/cloudstack/backup/KVMBackupExportService.java b/api/src/main/java/org/apache/cloudstack/backup/KVMBackupExportService.java new file mode 100644 index 000000000000..e1affb311ec6 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/backup/KVMBackupExportService.java @@ -0,0 +1,106 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import java.util.List; + +import org.apache.cloudstack.api.command.admin.backup.CreateImageTransferCmd; +import org.apache.cloudstack.api.command.admin.backup.DeleteVmCheckpointCmd; +import org.apache.cloudstack.api.command.admin.backup.FinalizeBackupCmd; +import org.apache.cloudstack.api.command.admin.backup.FinalizeImageTransferCmd; +import org.apache.cloudstack.api.command.admin.backup.ListImageTransfersCmd; +import org.apache.cloudstack.api.command.admin.backup.ListVmCheckpointsCmd; +import org.apache.cloudstack.api.command.admin.backup.StartBackupCmd; +import org.apache.cloudstack.api.response.CheckpointResponse; +import org.apache.cloudstack.api.response.ImageTransferResponse; +import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.Configurable; + +import com.cloud.utils.component.PluggableService; + +/** + * Service for Creating Backups and ImageTransfer sessions which will be consumed by an external orchestrator. + */ +public interface KVMBackupExportService extends Configurable, PluggableService { + + ConfigKey ImageTransferIdleTimeoutSeconds = new ConfigKey<>("Advanced", Integer.class, + "image.transfer.idle.timeout.seconds", + "600", + "Seconds since last completed HTTP request to an image transfer before the image server unregisters it (idle timeout).", + true, ConfigKey.Scope.Zone); + + ConfigKey ExposeKVMBackupExportServiceApis = new ConfigKey<>("Advanced", Boolean.class, + "expose.kvm.backup.export.service.apis", + "false", + "Enable to expose APIs for testing the KVM Backup Export Service.", + false, ConfigKey.Scope.Global); + /** + * Creates a backup session for a VM + */ + Backup createBackup(StartBackupCmd cmd); + + /** + * Start a backup session for a VM + * Creates a new checkpoint and starts NBD server for pull-mode backup + */ + Backup startBackup(StartBackupCmd cmd); + + /** + * Finalize a backup session + * Stops NBD server, updates checkpoint tracking, deletes old checkpoints + */ + Backup finalizeBackup(FinalizeBackupCmd cmd); + + /** + * Create an image transfer object for a disk + * Registers NBD endpoint with ImageIO (stubbed for POC) + */ + ImageTransferResponse createImageTransfer(CreateImageTransferCmd cmd); + + ImageTransfer createImageTransfer(long volumeId, Long backupId, ImageTransfer.Direction direction, ImageTransfer.Format format); + + boolean cancelImageTransfer(long imageTransferId); + + /** + * Finalize an image transfer + * Marks transfer as complete (NBD is closed globally in finalize backup) + */ + boolean finalizeImageTransfer(FinalizeImageTransferCmd cmd); + + boolean finalizeImageTransfer(long imageTransferId); + + /** + * List image transfers for a backup + */ + List listImageTransfers(ListImageTransfersCmd cmd); + + /** + * List checkpoints for a VM + */ + List listVmCheckpoints(ListVmCheckpointsCmd cmd); + + /** + * Delete a VM checkpoint (no-op for normal flow, kept for API parity) + */ + boolean deleteVmCheckpoint(DeleteVmCheckpointCmd cmd); + + /** + * List Compatible Data Center Ids for the service + */ + List listCompatibleDataCenterIds(); +} diff --git a/api/src/main/java/org/apache/cloudstack/ca/CAManager.java b/api/src/main/java/org/apache/cloudstack/ca/CAManager.java index b0fb1ac73c21..d2ebdc25f1bd 100644 --- a/api/src/main/java/org/apache/cloudstack/ca/CAManager.java +++ b/api/src/main/java/org/apache/cloudstack/ca/CAManager.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Map; +import com.trilead.ssh2.Connection; + import org.apache.cloudstack.framework.ca.CAProvider; import org.apache.cloudstack.framework.ca.CAService; import org.apache.cloudstack.framework.ca.Certificate; @@ -39,7 +41,10 @@ public interface CAManager extends CAService, Configurable, PluggableService { ConfigKey CAProviderPlugin = new ConfigKey<>("Advanced", String.class, "ca.framework.provider.plugin", "root", - "The CA provider plugin that is used for secure CloudStack management server-agent communication for encryption and authentication. Restart management server(s) when changed.", true); + "The CA provider plugin used for CloudStack internal certificate management (MS-agent encryption and authentication). " + + "The default 'root' provider auto-generates a CA on first startup, but also supports user-provided custom CA material " + + "via the ca.plugin.root.private.key, ca.plugin.root.public.key, and ca.plugin.root.ca.certificate settings. " + + "Restart management server(s) when changed.", false); ConfigKey CertKeySize = new ConfigKey<>("Advanced", Integer.class, "ca.framework.cert.keysize", @@ -85,6 +90,12 @@ public interface CAManager extends CAService, Configurable, PluggableService { "The actual implementation will depend on the configured CA provider.", false); + ConfigKey CaInjectDefaultTruststore = new ConfigKey<>("Advanced", Boolean.class, + "ca.framework.inject.default.truststore", "true", + "When true, injects the CA provider's certificate into the JVM default truststore on management server startup. " + + "This allows outgoing HTTPS connections from the management server to trust servers with certificates signed by the configured CA. " + + "Restart management server(s) when changed.", false); + /** * Returns a list of available CA provider plugins * @return returns list of CAProvider @@ -130,12 +141,26 @@ public interface CAManager extends CAService, Configurable, PluggableService { boolean revokeCertificate(final BigInteger certSerial, final String certCn, final String provider); /** - * Provisions certificate for given active and connected agent host + * Provisions certificate for given agent host. + * When forced=true, uses SSH to re-provision bypassing the NIO agent connection (for disconnected agents). * @param host + * @param reconnect * @param provider + * @param forced when true, provisions via SSH instead of NIO; supports KVM hosts and SystemVMs * @return returns success/failure as boolean */ - boolean provisionCertificate(final Host host, final Boolean reconnect, final String provider); + boolean provisionCertificate(final Host host, final Boolean reconnect, final String provider, final boolean forced); + + /** + * Provisions certificate for a KVM host using an existing SSH connection. + * Runs keystore-setup to generate a CSR, issues a certificate, then runs keystore-cert-import. + * Used during host discovery and for forced re-provisioning when the NIO agent is unreachable. + * @param sshConnection active SSH connection to the KVM host + * @param agentIp IP address of the KVM host agent + * @param agentHostname hostname of the KVM host agent + * @param caProvider optional CA provider plugin name (null uses default) + */ + void provisionCertificateViaSsh(Connection sshConnection, String agentIp, String agentHostname, String caProvider); /** * Setups up a new keystore and generates CSR for a host diff --git a/api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java b/api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java index 665f95842b0d..368487c2b9b0 100644 --- a/api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java +++ b/api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java @@ -22,10 +22,10 @@ import com.cloud.host.Host; import com.cloud.offering.ServiceOffering; import com.cloud.org.Cluster; -import com.cloud.utils.Pair; import com.cloud.utils.Ternary; import com.cloud.utils.component.Adapter; import com.cloud.vm.VirtualMachine; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.math3.stat.descriptive.moment.Mean; import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation; @@ -40,6 +40,9 @@ public interface ClusterDrsAlgorithm extends Adapter { + Mean MEAN_CALCULATOR = new Mean(); + StandardDeviation STDDEV_CALCULATOR = new StandardDeviation(false); + /** * Determines whether a DRS operation is needed for a given cluster and host-VM * mapping. @@ -59,79 +62,121 @@ public interface ClusterDrsAlgorithm extends Adapter { boolean needsDrs(Cluster cluster, List> cpuList, List> memoryList) throws ConfigurationException; - /** - * Determines the metrics for a given virtual machine and destination host in a DRS cluster. - * - * @param clusterId - * the ID of the cluster to check - * @param vm - * the virtual machine to check - * @param serviceOffering - * the service offering for the virtual machine - * @param destHost - * the destination host for the virtual machine - * @param hostCpuMap - * a map of host IDs to the Ternary of used, reserved and total CPU on each host - * @param hostMemoryMap - * a map of host IDs to the Ternary of used, reserved and total memory on each host - * @param requiresStorageMotion - * whether storage motion is required for the virtual machine + * Calculates the metrics (improvement, cost, benefit) for migrating a VM to a destination host. Improvement is + * calculated based on the change in cluster imbalance before and after the migration. * + * @param cluster the cluster to check + * @param vm the virtual machine to check + * @param serviceOffering the service offering for the virtual machine + * @param destHost the destination host for the virtual machine + * @param hostCpuMap a map of host IDs to the Ternary of used, reserved and total CPU on each host + * @param hostMemoryMap a map of host IDs to the Ternary of used, reserved and total memory on each host + * @param requiresStorageMotion whether storage motion is required for the virtual machine + * @param preImbalance the pre-calculated cluster imbalance before migration (null to calculate it) + * @param baseMetricsArray pre-calculated array of all host metrics before migration + * @param hostIdToIndexMap mapping from host ID to index in the metrics array * @return a ternary containing improvement, cost, benefit */ Ternary getMetrics(Cluster cluster, VirtualMachine vm, ServiceOffering serviceOffering, Host destHost, Map> hostCpuMap, Map> hostMemoryMap, - Boolean requiresStorageMotion) throws ConfigurationException; + Boolean requiresStorageMotion, Double preImbalance, + double[] baseMetricsArray, Map hostIdToIndexMap) throws ConfigurationException; /** - * Calculates the imbalance of the cluster after a virtual machine migration. + * Calculates the cluster imbalance after migrating a VM to a destination host. * - * @param serviceOffering - * the service offering for the virtual machine - * @param vm - * the virtual machine being migrated - * @param destHost - * the destination host for the virtual machine - * @param hostCpuMap - * a map of host IDs to the Ternary of used, reserved and total CPU on each host - * @param hostMemoryMap - * a map of host IDs to the Ternary of used, reserved and total memory on each host + * @param vm the virtual machine being migrated + * @param destHost the destination host for the virtual machine + * @param clusterId the cluster ID + * @param vmMetric the VM's resource consumption metric + * @param baseMetricsArray pre-calculated array of all host metrics before migration + * @param hostIdToIndexMap mapping from host ID to index in the metrics array + * @return the cluster imbalance after migration + */ + default Double getImbalancePostMigration(VirtualMachine vm, + Host destHost, Long clusterId, long vmMetric, double[] baseMetricsArray, + Map hostIdToIndexMap, Map> hostCpuMap, + Map> hostMemoryMap) { + // Create a copy of the base array and adjust only the two affected hosts + double[] adjustedMetrics = new double[baseMetricsArray.length]; + System.arraycopy(baseMetricsArray, 0, adjustedMetrics, 0, baseMetricsArray.length); + + long destHostId = destHost.getId(); + long vmHostId = vm.getHostId(); + + // Adjust source host (remove VM resources) + Integer sourceIndex = hostIdToIndexMap.get(vmHostId); + if (sourceIndex != null && sourceIndex < adjustedMetrics.length) { + Map> sourceMetricsMap = getClusterDrsMetric(clusterId).equals("cpu") ? hostCpuMap : hostMemoryMap; + Ternary sourceMetrics = sourceMetricsMap.get(vmHostId); + if (sourceMetrics != null) { + adjustedMetrics[sourceIndex] = getMetricValuePostMigration(clusterId, sourceMetrics, vmMetric, vmHostId, destHostId, vmHostId); + } + } + + // Adjust destination host (add VM resources) + Integer destIndex = hostIdToIndexMap.get(destHostId); + if (destIndex != null && destIndex < adjustedMetrics.length) { + Map> destMetricsMap = getClusterDrsMetric(clusterId).equals("cpu") ? hostCpuMap : hostMemoryMap; + Ternary destMetrics = destMetricsMap.get(destHostId); + if (destMetrics != null) { + adjustedMetrics[destIndex] = getMetricValuePostMigration(clusterId, destMetrics, vmMetric, destHostId, destHostId, vmHostId); + } + } + + return calculateImbalance(adjustedMetrics); + } + + /** + * Calculate imbalance from an array of metric values. + * Imbalance is defined as standard deviation divided by mean. * - * @return a pair containing the CPU and memory imbalance of the cluster after the migration + * Uses reusable stateless calculator objects to avoid object creation overhead. + * @param values array of metric values + * @return calculated imbalance */ - default Double getImbalancePostMigration(ServiceOffering serviceOffering, VirtualMachine vm, - Host destHost, Map> hostCpuMap, - Map> hostMemoryMap) throws ConfigurationException { - Pair>> pair = getHostMetricsMapAndType(destHost.getClusterId(), serviceOffering, hostCpuMap, hostMemoryMap); - long vmMetric = pair.first(); - Map> hostMetricsMap = pair.second(); + private static double calculateImbalance(double[] values) { + if (values == null || values.length == 0) { + return 0.0; + } - List list = new ArrayList<>(); - for (Long hostId : hostMetricsMap.keySet()) { - list.add(getMetricValuePostMigration(destHost.getClusterId(), hostMetricsMap.get(hostId), vmMetric, hostId, destHost.getId(), vm.getHostId())); + double mean = MEAN_CALCULATOR.evaluate(values); + if (mean == 0.0) { + return 0.0; // Avoid division by zero } - return getImbalance(list); + double stdDev = STDDEV_CALCULATOR.evaluate(values, mean); + return stdDev / mean; } - private Pair>> getHostMetricsMapAndType(Long clusterId, - ServiceOffering serviceOffering, Map> hostCpuMap, - Map> hostMemoryMap) throws ConfigurationException { + /** + * Helper method to get VM metric based on cluster configuration. + */ + static long getVmMetric(ServiceOffering serviceOffering, Long clusterId) throws ConfigurationException { String metric = getClusterDrsMetric(clusterId); - Pair>> pair; switch (metric) { case "cpu": - pair = new Pair<>((long) serviceOffering.getCpu() * serviceOffering.getSpeed(), hostCpuMap); - break; + return (long) serviceOffering.getCpu() * serviceOffering.getSpeed(); case "memory": - pair = new Pair<>(serviceOffering.getRamSize() * 1024L * 1024L, hostMemoryMap); - break; + return serviceOffering.getRamSize() * 1024L * 1024L; default: throw new ConfigurationException( String.format("Invalid metric: %s for cluster: %d", metric, clusterId)); } - return pair; + } + + /** + * Helper method to calculate metrics from pre and post imbalance values. + */ + default Ternary calculateMetricsFromImbalances(Double preImbalance, Double postImbalance) { + // This needs more research to determine the cost and benefit of a migration + // TODO: Cost should be a factor of the VM size and the host capacity + // TODO: Benefit should be a factor of the VM size and the host capacity and the number of VMs on the host + final double improvement = preImbalance - postImbalance; + final double cost = 0.0; + final double benefit = 1.0; + return new Ternary<>(improvement, cost, benefit); } private Double getMetricValuePostMigration(Long clusterId, Ternary metrics, long vmMetric, @@ -151,9 +196,26 @@ private Double getMetricValuePostMigration(Long clusterId, Ternary metricList) { - Double clusterMeanMetric = getClusterMeanMetric(metricList); - Double clusterStandardDeviation = getClusterStandardDeviation(metricList, clusterMeanMetric); - return clusterStandardDeviation / clusterMeanMetric; + if (CollectionUtils.isEmpty(metricList)) { + return 0.0; + } + // Convert List to double[] once, avoiding repeated conversions + double[] values = new double[metricList.size()]; + int index = 0; + for (Double value : metricList) { + if (value != null) { + values[index++] = value; + } + } + + // Trim array if some values were null + if (index < values.length) { + double[] trimmed = new double[index]; + System.arraycopy(values, 0, trimmed, 0, index); + values = trimmed; + } + + return calculateImbalance(values); } static String getClusterDrsMetric(long clusterId) { @@ -181,36 +243,6 @@ static Double getMetricValue(long clusterId, long used, long free, long total, F return null; } - /** - * Mean is the average of a collection or set of metrics. In context of a DRS - * cluster, the cluster metrics defined as the average metrics value for some - * metric (such as CPU, memory etc.) for every resource such as host. - * Cluster Mean Metric, mavg = (∑mi) / N, where mi is a measurable metric for a - * resource ‘i’ in a cluster with total N number of resources. - */ - static Double getClusterMeanMetric(List metricList) { - return new Mean().evaluate(metricList.stream().mapToDouble(i -> i).toArray()); - } - - /** - * Standard deviation is defined as the square root of the absolute squared sum - * of difference of a metric from its mean for every resource divided by the - * total number of resources. In context of the DRS, the cluster standard - * deviation is the standard deviation based on a metric of resources in a - * cluster such as for the allocation or utilisation CPU/memory metric of hosts - * in a cluster. - * Cluster Standard Deviation, σc = sqrt((∑∣mi−mavg∣^2) / N), where mavg is the - * mean metric value and mi is a measurable metric for some resource ‘i’ in the - * cluster with total N number of resources. - */ - static Double getClusterStandardDeviation(List metricList, Double mean) { - if (mean != null) { - return new StandardDeviation(false).evaluate(metricList.stream().mapToDouble(i -> i).toArray(), mean); - } else { - return new StandardDeviation(false).evaluate(metricList.stream().mapToDouble(i -> i).toArray()); - } - } - static boolean getDrsMetricUseRatio(long clusterId) { return ClusterDrsMetricUseRatio.valueIn(clusterId); } diff --git a/api/src/main/java/org/apache/cloudstack/command/ReconcileCommandService.java b/api/src/main/java/org/apache/cloudstack/command/ReconcileCommandService.java new file mode 100644 index 000000000000..89ab97990df7 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/command/ReconcileCommandService.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.hypervisor.Hypervisor; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.framework.config.ConfigKey; + +import java.util.Arrays; +import java.util.List; + +public interface ReconcileCommandService { + + ConfigKey ReconcileCommandsEnabled = new ConfigKey<>("Advanced", Boolean.class, + "reconcile.commands.enabled", "false", + "Indicates whether the background task to reconcile the commands is enabled or not", + false); + + ConfigKey ReconcileCommandsInterval = new ConfigKey<>("Advanced", Integer.class, + "reconcile.commands.interval", "60", + "Interval (in seconds) for the background task to reconcile the commands", + false); + ConfigKey ReconcileCommandsMaxAttempts = new ConfigKey<>("Advanced", Integer.class, + "reconcile.commands.max.attempts", "30", + "The maximum number of attempts to reconcile the commands", + true); + + ConfigKey ReconcileCommandsWorkers = new ConfigKey<>("Advanced", Integer.class, + "reconcile.commands.workers", "100", + "The Number of worker threads to reconcile the commands", + false); + + List SupportedHypervisorTypes = Arrays.asList(Hypervisor.HypervisorType.KVM); + + void persistReconcileCommands(Long hostId, Long requestSequence, Command[] cmd); + + boolean updateReconcileCommand(long requestSeq, Command command, Answer answer, Command.State newStateByManagement, Command.State newStateByAgent); + + void processCommand(Command pingCommand, Answer pingAnswer); + + void processAnswers(long requestSeq, Command[] commands, Answer[] answers); + + void updateReconcileCommandToInterruptedByManagementServerId(long managementServerId); + + void updateReconcileCommandToInterruptedByHostId(long hostId); + + boolean isReconcileResourceNeeded(long resourceId, ApiCommandResourceType resourceType); +} diff --git a/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java b/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java index a4aa860487f3..113b97f43c8f 100644 --- a/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java +++ b/api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java @@ -16,10 +16,15 @@ // under the License. package org.apache.cloudstack.config; +import com.cloud.exception.InvalidParameterValueException; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class ApiServiceConfiguration implements Configurable { + protected static Logger LOGGER = LogManager.getLogger(ApiServiceConfiguration.class); public static final ConfigKey ManagementServerAddresses = new ConfigKey<>(String.class, "host", "Advanced", "localhost", "The ip address of management server. This can also accept comma separated addresses.", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null); public static final ConfigKey ApiServletPath = new ConfigKey("Advanced", String.class, "endpoint.url", "http://localhost:8080/client/api", "API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", true); @@ -29,6 +34,20 @@ public class ApiServiceConfiguration implements Configurable { "true", "Are the source checks on API calls enabled (true) or not (false)? See api.allowed.source.cidr.list", true, ConfigKey.Scope.Global); public static final ConfigKey ApiAllowedSourceCidrList = new ConfigKey<>(String.class, "api.allowed.source.cidr.list", "Advanced", "0.0.0.0/0,::/0", "Comma separated list of IPv4/IPv6 CIDRs from which API calls can be performed. Can be set on Global and Account levels.", true, ConfigKey.Scope.Account, null, null, null, null, null, ConfigKey.Kind.CSV, null); + + + public static void validateEndpointUrl() { + String csUrl = getApiServletPathValue(); + if (StringUtils.isBlank(csUrl) || StringUtils.containsAny(csUrl, "localhost", "127.0.0.1", "[::1]")) { + LOGGER.error("Global setting [{}] cannot contain localhost or be blank. Current value: {}", ApiServletPath.key(), csUrl); + throw new InvalidParameterValueException("Unable to complete this operation. Contact your cloud admin."); + } + } + + public static String getApiServletPathValue() { + return ApiServletPath.value(); + } + @Override public String getConfigComponentName() { return ApiServiceConfiguration.class.getSimpleName(); diff --git a/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManager.java b/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManager.java index 23b571e7fae1..655b8faf443a 100644 --- a/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManager.java +++ b/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManager.java @@ -18,6 +18,9 @@ import com.cloud.utils.component.Manager; import org.apache.cloudstack.api.command.user.consoleproxy.ConsoleEndpoint; +import org.apache.cloudstack.api.command.user.consoleproxy.ListConsoleSessionsCmd; +import org.apache.cloudstack.api.response.ConsoleSessionResponse; +import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import java.util.Date; @@ -48,4 +51,8 @@ public interface ConsoleAccessManager extends Manager, Configurable { String genAccessTicket(String host, String port, String sid, String tag, String sessionUuid); String genAccessTicket(String host, String port, String sid, String tag, Date normalizedHashTime, String sessionUuid); + + ListResponse listConsoleSessions(ListConsoleSessionsCmd cmd); + + ConsoleSession listConsoleSessionById(long id); } diff --git a/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleSession.java b/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleSession.java new file mode 100644 index 000000000000..6cbdd31fd943 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleSession.java @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.consoleproxy; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +public interface ConsoleSession extends InternalIdentity, Identity { + + Date getCreated(); + + long getDomainId(); + + long getAccountId(); + + long getUserId(); + + long getInstanceId(); + + long getHostId(); + + Date getRemoved(); + + Date getAcquired(); + + String getConsoleEndpointCreatorAddress(); + + String getClientAddress(); +} diff --git a/api/src/main/java/org/apache/cloudstack/context/CallContext.java b/api/src/main/java/org/apache/cloudstack/context/CallContext.java index 69376e4f6d7d..fcfb5b6b1e00 100644 --- a/api/src/main/java/org/apache/cloudstack/context/CallContext.java +++ b/api/src/main/java/org/apache/cloudstack/context/CallContext.java @@ -63,6 +63,7 @@ protected Stack initialValue() { private User user; private long userId; private final Map context = new HashMap(); + private final Map apiResourcesUuids = new HashMap<>(); private Project project; private String apiName; @@ -180,9 +181,7 @@ protected static CallContext register(User callingUser, Account callingAccount, } s_currentContext.set(callingContext); ThreadContext.push("ctx-" + UuidUtils.first(contextId)); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Registered: " + callingContext); - } + LOGGER.trace("Registered: {}", callingContext); s_currentContextStack.get().push(callingContext); @@ -279,9 +278,7 @@ public static CallContext unregister() { return null; } s_currentContext.remove(); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Unregistered: " + context); - } + LOGGER.trace("Unregistered: {}", context); String contextId = context.getContextId(); String sessionIdOnStack = null; String sessionIdPushedToNDC = "ctx-" + UuidUtils.first(contextId); @@ -289,9 +286,7 @@ public static CallContext unregister() { if (sessionIdOnStack.isEmpty() || sessionIdPushedToNDC.equals(sessionIdOnStack)) { break; } - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Popping from NDC: " + contextId); - } + LOGGER.trace("Popping from NDC: {}", contextId); } Stack stack = s_currentContextStack.get(); @@ -394,6 +389,14 @@ public void setEventDisplayEnabled(boolean eventDisplayEnabled) { isEventDisplayEnabled = eventDisplayEnabled; } + public String getApiResourceUuid(String paramName) { + return apiResourcesUuids.get(paramName); + } + + public void putApiResourceUuid(String paramName, String uuid) { + apiResourcesUuids.put(paramName, uuid); + } + public Map getContextParameters() { return context; } diff --git a/api/src/main/java/org/apache/cloudstack/context/LogContext.java b/api/src/main/java/org/apache/cloudstack/context/LogContext.java index c367975aba3b..24b92090e7f8 100644 --- a/api/src/main/java/org/apache/cloudstack/context/LogContext.java +++ b/api/src/main/java/org/apache/cloudstack/context/LogContext.java @@ -136,9 +136,7 @@ protected static LogContext register(User callingUser, Account callingAccount, L } s_currentContext.set(callingContext); ThreadContext.put("logcontextid", UuidUtils.first(contextId)); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Registered for log: " + callingContext); - } + LOGGER.trace("Registered for log: {}", callingContext); return callingContext; } @@ -207,9 +205,7 @@ public static void unregister() { LogContext context = s_currentContext.get(); if (context != null) { s_currentContext.remove(); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Unregistered: " + context); - } + LOGGER.trace("Unregistered: {}", context); } ThreadContext.clearMap(); } diff --git a/api/src/main/java/org/apache/cloudstack/extension/CustomActionResultResponse.java b/api/src/main/java/org/apache/cloudstack/extension/CustomActionResultResponse.java new file mode 100644 index 000000000000..33ff70fcace5 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/extension/CustomActionResultResponse.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.extension; + +import java.util.Map; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class CustomActionResultResponse extends BaseResponse { + + @SerializedName(ApiConstants.ID) + @Param(description = "ID of the action") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "Name of the action") + private String name; + + @SerializedName(ApiConstants.SUCCESS) + @Param(description = "Whether custom action succeed or not") + private Boolean success; + + @SerializedName(ApiConstants.RESULT) + @Param(description = "Result of the action execution") + private Map result; + + public void setId(String id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public Boolean getSuccess() { + return success; + } + + public void setResult(Map result) { + this.result = result; + } +} diff --git a/api/src/main/java/org/apache/cloudstack/extension/Extension.java b/api/src/main/java/org/apache/cloudstack/extension/Extension.java new file mode 100644 index 000000000000..3068612ed6fe --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/extension/Extension.java @@ -0,0 +1,44 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you 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 org.apache.cloudstack.extension; + +import java.util.Date; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface Extension extends InternalIdentity, Identity { + enum Type { + Orchestrator + } + enum State { + Enabled, Disabled; + }; + String getName(); + String getDescription(); + Type getType(); + String getRelativePath(); + boolean isPathReady(); + boolean isUserDefined(); + State getState(); + Date getCreated(); + + static String getDirectoryName(String name) { + return name.replaceAll("[^a-zA-Z0-9._-]", "_").toLowerCase(); + } +} diff --git a/api/src/main/java/org/apache/cloudstack/extension/ExtensionCustomAction.java b/api/src/main/java/org/apache/cloudstack/extension/ExtensionCustomAction.java new file mode 100644 index 000000000000..776b42f671b7 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/extension/ExtensionCustomAction.java @@ -0,0 +1,386 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you 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 org.apache.cloudstack.extension; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.utils.DateUtil; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.reflect.TypeToken; + +public interface ExtensionCustomAction extends InternalIdentity, Identity { + enum ResourceType { + VirtualMachine(com.cloud.vm.VirtualMachine.class); + + private final Class clazz; + + ResourceType(Class clazz) { + this.clazz = clazz; + } + + public Class getAssociatedClass() { + return this.clazz; + } + } + + String getName(); + + String getDescription(); + + long getExtensionId(); + + ResourceType getResourceType(); + + Integer getAllowedRoleTypes(); + + String getSuccessMessage(); + + String getErrorMessage(); + + int getTimeout(); + + boolean isEnabled(); + + Date getCreated(); + + + class Parameter { + + public enum Type { + STRING(true), + NUMBER(true), + BOOLEAN(false), + DATE(false); + + private final boolean supportsOptions; + + Type(boolean supportsOptions) { + this.supportsOptions = supportsOptions; + } + + public boolean canSupportsOptions() { + return supportsOptions; + } + } + + public enum ValidationFormat { + // Universal default format + NONE(null), + + // String formats + UUID(Type.STRING), + EMAIL(Type.STRING), + PASSWORD(Type.STRING), + URL(Type.STRING), + + // Number formats + DECIMAL(Type.NUMBER); + + private final Type baseType; + + ValidationFormat(Type baseType) { + this.baseType = baseType; + } + + public Type getBaseType() { + return baseType; + } + } + + private static final Gson gson = new GsonBuilder() + .registerTypeAdapter(Parameter.class, new ParameterDeserializer()) + .setPrettyPrinting() + .create(); + + private final String name; + private final Type type; + private final ValidationFormat validationformat; + private final List valueoptions; + private final boolean required; + + public Parameter(String name, Type type, ValidationFormat validationformat, List valueoptions, boolean required) { + this.name = name; + this.type = type; + this.validationformat = validationformat; + this.valueoptions = valueoptions; + this.required = required; + } + + /** + * Parses a CSV string into a list of validated options. + */ + private static List parseValueOptions(String name, String csv, Type parsedType, ValidationFormat parsedFormat) { + if (StringUtils.isBlank(csv)) { + return null; + } + List values = Arrays.stream(csv.split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toList()); + switch (parsedType) { + case STRING: + if (parsedFormat != null && parsedFormat != ValidationFormat.NONE) { + for (String value : values) { + if (!isValidStringValue(value, parsedFormat)) { + throw new InvalidParameterValueException(String.format("Invalid value options with validation format: %s for parameter: %s", parsedFormat.name(), name)); + } + } + } + return new ArrayList<>(values); + case NUMBER: + try { + return values.stream() + .map(v -> parseNumber(v, parsedFormat)) + .collect(Collectors.toList()); + } catch (NumberFormatException ignored) { + throw new InvalidParameterValueException(String.format("Invalid value options with validation format: %s for parameter: %s", parsedFormat.name(), name)); + } + default: + throw new InvalidParameterValueException(String.format("Options not supported for type: %s for parameter: %s", parsedType, name)); + } + } + + private static Object parseNumber(String value, ValidationFormat parsedFormat) { + if (parsedFormat == ValidationFormat.DECIMAL) { + return Float.parseFloat(value); + } + return Integer.parseInt(value); + } + + private static boolean isValidStringValue(String value, ValidationFormat validationFormat ) { + switch (validationFormat) { + case NONE: + return true; + case UUID: + try { + UUID.fromString(value); + return true; + } catch (Exception ignored) { + return false; + } + case EMAIL: + return value.matches("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$"); + case PASSWORD: + return !value.trim().isEmpty(); + case URL: + try { + new java.net.URL(value); + return true; + } catch (Exception ignored) { + return false; + } + default: + return false; + } + } + + public static Parameter fromMap(Map map) throws InvalidParameterValueException { + final String name = map.get(ApiConstants.NAME); + final String typeStr = map.get(ApiConstants.TYPE); + final String validationFormatStr = map.get(ApiConstants.VALIDATION_FORMAT); + final String required = map.get(ApiConstants.REQUIRED); + final String valueOptionsStr = map.get(ApiConstants.VALUE_OPTIONS); + if (StringUtils.isBlank(name)) { + throw new InvalidParameterValueException("Invalid parameter specified with empty name"); + } + if (StringUtils.isBlank(typeStr)) { + throw new InvalidParameterValueException(String.format("No type specified for parameter: %s", name)); + } + Type parsedType = EnumUtils.getEnumIgnoreCase(Type.class, typeStr); + if (parsedType == null) { + throw new InvalidParameterValueException(String.format("Invalid type: %s specified for parameter: %s", + typeStr, name)); + } + ValidationFormat parsedFormat = StringUtils.isBlank(validationFormatStr) ? + ValidationFormat.NONE : EnumUtils.getEnumIgnoreCase(ValidationFormat.class, validationFormatStr); + if (parsedFormat == null || (!ValidationFormat.NONE.equals(parsedFormat) && + parsedFormat.getBaseType() != parsedType)) { + throw new InvalidParameterValueException( + String.format("Invalid validation format: %s specified for type: %s", + parsedFormat, parsedType.name())); + } + List valueOptions = parseValueOptions(name, valueOptionsStr, parsedType, parsedFormat); + return new Parameter(name, parsedType, parsedFormat, valueOptions, Boolean.parseBoolean(required)); + } + + public String getName() { + return name; + } + + public Type getType() { + return type; + } + + public ValidationFormat getValidationFormat() { + return validationformat; + } + + public List getValueOptions() { + return valueoptions; + } + + public boolean isRequired() { + return required; + } + + @Override + public String toString() { + return String.format("Parameter %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, + ApiConstants.NAME, ApiConstants.TYPE, ApiConstants.REQUIRED)); + } + + public static String toJsonFromList(List parameters) { + return gson.toJson(parameters); + } + + public static List toListFromJson(String json) { + java.lang.reflect.Type listType = new TypeToken>() {}.getType(); + return gson.fromJson(json, listType); + } + + private void validateValueInOptions(Object value) { + if (CollectionUtils.isNotEmpty(valueoptions) && !valueoptions.contains(value)) { + throw new InvalidParameterValueException("Invalid value for parameter '" + name + "': " + value + + ". Valid options are: " + valueoptions.stream().map(Object::toString).collect(Collectors.joining(", "))); + } + } + + public Object validatedValue(String value) { + if (StringUtils.isBlank(value)) { + throw new InvalidParameterValueException("Empty value for parameter '" + name + "': " + value); + } + try { + switch (type) { + case BOOLEAN: + if (!Arrays.asList("true", "false").contains(value)) { + throw new IllegalArgumentException(); + } + return Boolean.parseBoolean(value); + case DATE: + return DateUtil.parseTZDateString(value); + case NUMBER: + Object obj = parseNumber(value, validationformat); + validateValueInOptions(obj); + return obj; + default: + if (!isValidStringValue(value, validationformat)) { + throw new IllegalArgumentException(); + } + validateValueInOptions(value); + return value; + } + } catch (Exception e) { + throw new InvalidParameterValueException("Invalid value for parameter '" + name + "': " + value); + } + } + + public static Map validateParameterValues(List parameterDefinitions, + Map suppliedValues) throws InvalidParameterValueException { + if (suppliedValues == null) { + suppliedValues = new HashMap<>(); + } + for (Parameter param : parameterDefinitions) { + String value = suppliedValues.get(param.getName()); + if (param.isRequired()) { + if (value == null || value.trim().isEmpty()) { + throw new InvalidParameterValueException("Missing or empty required parameter: " + param.getName()); + } + } + } + Map validatedParams = new HashMap<>(); + for (Map.Entry entry : suppliedValues.entrySet()) { + String name = entry.getKey(); + String value = entry.getValue(); + Parameter param = parameterDefinitions.stream() + .filter(p -> p.getName().equals(name)) + .findFirst() + .orElse(null); + if (param != null) { + validatedParams.put(name, param.validatedValue(value)); + } else { + validatedParams.put(name, value); + } + } + return validatedParams; + } + + static class ParameterDeserializer implements JsonDeserializer { + + @Override + public Parameter deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + JsonObject obj = json.getAsJsonObject(); + String name = obj.get(ApiConstants.NAME).getAsString(); + String typeStr = obj.get(ApiConstants.TYPE).getAsString(); + String validationFormatStr = obj.has(ApiConstants.VALIDATION_FORMAT) ? obj.get(ApiConstants.VALIDATION_FORMAT).getAsString() : null; + boolean required = obj.has(ApiConstants.REQUIRED) && obj.get(ApiConstants.REQUIRED).getAsBoolean(); + + Parameter.Type typeEnum = Parameter.Type.valueOf(typeStr); + Parameter.ValidationFormat validationFormatEnum = (validationFormatStr != null) + ? Parameter.ValidationFormat.valueOf(validationFormatStr) + : Parameter.ValidationFormat.NONE; + + List valueOptions = null; + if (obj.has(ApiConstants.VALUE_OPTIONS) && obj.get(ApiConstants.VALUE_OPTIONS).isJsonArray()) { + JsonArray valueOptionsArray = obj.getAsJsonArray(ApiConstants.VALUE_OPTIONS); + valueOptions = new ArrayList<>(); + for (JsonElement el : valueOptionsArray) { + switch (typeEnum) { + case STRING: + valueOptions.add(el.getAsString()); + break; + case NUMBER: + if (validationFormatEnum == Parameter.ValidationFormat.DECIMAL) { + valueOptions.add(el.getAsFloat()); + } else { + valueOptions.add(el.getAsInt()); + } + break; + default: + throw new JsonParseException("Unsupported type for value options"); + } + } + } + + return new Parameter(name, typeEnum, validationFormatEnum, valueOptions, required); + } + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/extension/ExtensionHelper.java b/api/src/main/java/org/apache/cloudstack/extension/ExtensionHelper.java new file mode 100644 index 000000000000..a01131278a76 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/extension/ExtensionHelper.java @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.extension; + +import java.util.List; + +public interface ExtensionHelper { + Long getExtensionIdForCluster(long clusterId); + Extension getExtension(long id); + Extension getExtensionForCluster(long clusterId); + List getExtensionReservedResourceDetails(long extensionId); +} diff --git a/api/src/main/java/org/apache/cloudstack/extension/ExtensionResourceMap.java b/api/src/main/java/org/apache/cloudstack/extension/ExtensionResourceMap.java new file mode 100644 index 000000000000..40ebc19eb5e3 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/extension/ExtensionResourceMap.java @@ -0,0 +1,34 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you 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 org.apache.cloudstack.extension; + +import java.util.Date; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface ExtensionResourceMap extends InternalIdentity, Identity { + enum ResourceType { + Cluster + } + + long getExtensionId(); + long getResourceId(); + ResourceType getResourceType(); + Date getCreated(); +} diff --git a/api/src/main/java/org/apache/cloudstack/gpu/GpuCard.java b/api/src/main/java/org/apache/cloudstack/gpu/GpuCard.java new file mode 100644 index 000000000000..2c02a0e30c26 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gpu/GpuCard.java @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gpu; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +/** + * GPU card interface representing a physical GPU card model + */ +public interface GpuCard extends InternalIdentity, Identity { + /** + * @return the UUID of the GPU card + */ + String getUuid(); + + /** + * @return the device ID of the GPU card + */ + String getDeviceId(); + + /** + * @return the device name of the GPU card + */ + String getDeviceName(); + + /** + * @return the name of the GPU card + */ + String getName(); + + /** + * @return the vendor name of the GPU card + */ + String getVendorName(); + + /** + * @return the vendor ID of the GPU card + */ + String getVendorId(); + + /** + * @return the date when the GPU card was created + */ + Date getCreated(); + + + /** + * @return the group name of the GPU card based on how the XenServer expects it. + */ + String getGroupName(); + +} diff --git a/api/src/main/java/org/apache/cloudstack/gpu/GpuDevice.java b/api/src/main/java/org/apache/cloudstack/gpu/GpuDevice.java new file mode 100644 index 000000000000..22adda464779 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gpu/GpuDevice.java @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gpu; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +/** + * GPU device interface representing a physical GPU device + */ +public interface GpuDevice extends InternalIdentity, Identity { + + enum State { + Allocated, Free, Error, PartiallyAllocated, + } + + enum ManagedState { + Managed, Unmanaged, + } + + enum DeviceType { + PCI, MDEV, VGPUOnly, + } + + long getHostId(); + + State getState(); +} diff --git a/api/src/main/java/org/apache/cloudstack/gpu/GpuService.java b/api/src/main/java/org/apache/cloudstack/gpu/GpuService.java new file mode 100644 index 000000000000..1e7928a319f6 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gpu/GpuService.java @@ -0,0 +1,157 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gpu; + +import com.cloud.agent.api.VgpuTypesInfo; +import com.cloud.agent.api.to.GPUDeviceTO; +import com.cloud.host.Host; +import com.cloud.utils.component.Manager; +import com.cloud.vm.VirtualMachine; +import org.apache.cloudstack.api.command.admin.gpu.CreateGpuCardCmd; +import org.apache.cloudstack.api.command.admin.gpu.CreateGpuDeviceCmd; +import org.apache.cloudstack.api.command.admin.gpu.CreateVgpuProfileCmd; +import org.apache.cloudstack.api.command.admin.gpu.DeleteGpuCardCmd; +import org.apache.cloudstack.api.command.admin.gpu.DeleteGpuDeviceCmd; +import org.apache.cloudstack.api.command.admin.gpu.DeleteVgpuProfileCmd; +import org.apache.cloudstack.api.command.admin.gpu.UnmanageGpuDeviceCmd; +import org.apache.cloudstack.api.command.admin.gpu.DiscoverGpuDevicesCmd; +import org.apache.cloudstack.api.command.admin.gpu.ManageGpuDeviceCmd; +import org.apache.cloudstack.api.command.user.gpu.ListGpuDevicesCmd; +import org.apache.cloudstack.api.command.admin.gpu.UpdateGpuCardCmd; +import org.apache.cloudstack.api.command.admin.gpu.UpdateGpuDeviceCmd; +import org.apache.cloudstack.api.command.admin.gpu.UpdateVgpuProfileCmd; +import org.apache.cloudstack.api.command.user.gpu.ListGpuCardsCmd; +import org.apache.cloudstack.api.command.user.gpu.ListVgpuProfilesCmd; +import org.apache.cloudstack.api.response.GpuCardResponse; +import org.apache.cloudstack.api.response.GpuDeviceResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.VgpuProfileResponse; +import org.apache.cloudstack.framework.config.ConfigKey; + +import java.util.HashMap; +import java.util.List; + +public interface GpuService extends Manager { + + ConfigKey GpuDetachOnStop = new ConfigKey<>(Boolean.class, "gpu.detach.on.stop", "Advanced", "false", + "Whether to detach GPU devices from VM on stop or keep them allocated", true, ConfigKey.Scope.Domain, null); + + GpuCard createGpuCard(CreateGpuCardCmd cmd); + + GpuCard updateGpuCard(UpdateGpuCardCmd cmd); + + boolean deleteGpuCard(DeleteGpuCardCmd cmd); + + VgpuProfileResponse createVgpuProfile(CreateVgpuProfileCmd cmd); + + VgpuProfileResponse updateVgpuProfile(UpdateVgpuProfileCmd cmd); + + boolean deleteVgpuProfile(DeleteVgpuProfileCmd cmd); + + ListResponse listGpuCards(ListGpuCardsCmd cmd); + + ListResponse listVgpuProfiles(ListVgpuProfilesCmd cmd); + + GpuDeviceResponse createGpuDevice(CreateGpuDeviceCmd cmd); + + GpuDeviceResponse updateGpuDevice(UpdateGpuDeviceCmd cmd); + + ListResponse listGpuDevices(ListGpuDevicesCmd cmd); + + boolean disableGpuDevice(UnmanageGpuDeviceCmd cmd); + + boolean enableGpuDevice(ManageGpuDeviceCmd cmd); + + /** + * Deallocate GPU devices for a VM on a host. + * + * @param vmId The ID of the VM to deallocate GPU devices for. + */ + void deallocateAllGpuDevicesForVm(long vmId); + + + /** + * Deallocate GPU devices for a VM on a host. + * + * @param vmId The ID of the VM to deallocate GPU devices for. + */ + void deallocateGpuDevicesForVmOnHost(long vmId, long hostId); + + /** + * Deallocate existing GPU devices for a VM on a host and allocate new GPU devices to the VM. + * + * @param vmId The ID of the VM to allocate GPU devices to. + * @param hostId The ID of the host to allocate GPU devices to. + * @param gpuDevices The list of GPU devices to allocate to the VM. + */ + void allocateGpuDevicesToVmOnHost(long vmId, long hostId, List gpuDevices); + + /** + * Discover GPU devices on a host by using the getGPUStatistics command and updating the GPU details for the host. + * + * @param cmd The command to discover GPU devices. + * @return The list of GPU devices. + */ + ListResponse discoverGpuDevices(DiscoverGpuDevicesCmd cmd); + + /** + * Check if GPU devices are available for a VM on a host by checking the number of available GPU devices for the + * vGPU profile. + * + * @param host The host to check GPU devices for. + * @param vmId The ID of the VM to check GPU devices for. + * @param vgpuProfile The vGPU profile to check GPU devices for. + * @param gpuCount The number of GPU devices to check for. + * @return True if GPU devices are available, false otherwise. + */ + boolean isGPUDeviceAvailable(Host host, Long vmId, VgpuProfile vgpuProfile, int gpuCount); + + /** + * Get GPU devices for a VM on a host by checking the number of available GPU devices for the vGPU profile. + * If the VM already has GPU devices assigned, deallocate them and allocate new GPU devices to the VM. + * The new GPU devices are allocated optimally to the VM. + * + * @param vm The VM to get GPU devices for. + * @param vgpuProfile The vGPU profile to get GPU devices for. + * @param gpuCount The number of GPU devices to get. + * @return The GPU devices. + */ + GPUDeviceTO getGPUDevice(VirtualMachine vm, long hostId, VgpuProfile vgpuProfile, int gpuCount); + + /** + * Gets the GPU group details from the GPU devices on a host. + * This fetches the GPU devices from the host and prepares the GPU group details for the host. + * The GPU group details are a map of GPU group name (Card's device name) to a map of vGPU profile name to + * VgpuTypesInfo. + * The VgpuTypesInfo contains the information about the GPU device. + * + * @param hostId The host ID to get GPU group details for. + * @return The GPU group details. + */ + HashMap> getGpuGroupDetailsFromGpuDevicesOnHost(long hostId); + + /** + * This method is used to add the GPU devices to the host when the host is discovered or when the GPU devices are + * updated. + * + * @param host The host to add the GPU devices to. + * @param newGpuDevicesInfo The list of GPU devices to add to the host. + */ + void addGpuDevicesToHost(Host host, List newGpuDevicesInfo); + + boolean deleteGpuDevices(DeleteGpuDeviceCmd deleteGpuDeviceCmd); +} diff --git a/api/src/main/java/org/apache/cloudstack/gpu/VgpuProfile.java b/api/src/main/java/org/apache/cloudstack/gpu/VgpuProfile.java new file mode 100644 index 000000000000..8cfac2a20de8 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gpu/VgpuProfile.java @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gpu; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +/** + * vGPU profile interface representing a virtualized GPU profile + */ +public interface VgpuProfile extends InternalIdentity, Identity { + /** + * @return the UUID of the vGPU profile + */ + String getUuid(); + + /** + * @return the name of the vGPU profile + */ + String getName(); + + /** + * @return the description of the vGPU profile + */ + String getDescription(); + + /** + * @return the date when the vGPU profile was created + */ + Date getCreated(); + + Long getCardId(); + + /** + * @return the maximum number of vGPUs per physical GPU + */ + Long getMaxVgpuPerPgpu(); + + /** + * @return the video RAM size in MB + */ + Long getVideoRam(); + + /** + * @return the maximum number of display heads + */ + Long getMaxHeads(); + + /** + * @return the maximum X resolution + */ + Long getMaxResolutionX(); + + /** + * @return the maximum Y resolution + */ + Long getMaxResolutionY(); +} diff --git a/api/src/main/java/org/apache/cloudstack/gui/theme/GuiTheme.java b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiTheme.java new file mode 100644 index 000000000000..0cca8bc2d7db --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiTheme.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +public interface GuiTheme extends InternalIdentity, Identity { + + String getName(); + + String getDescription(); + + String getCss(); + + String getJsonConfiguration(); + + Date getCreated(); + + Date getRemoved(); + + boolean getIsPublic(); + + void setId(Long id); + + void setUuid(String uuid); + + void setName(String name); + + void setDescription(String description); + + void setCss(String css); + + void setJsonConfiguration(String jsonConfiguration); + + void setCreated(Date created); + + void setRemoved(Date removed); + + void setIsPublic(boolean isPublic); + + boolean isRecursiveDomains(); + + void setRecursiveDomains(boolean recursiveDomains); +} diff --git a/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetails.java b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetails.java new file mode 100644 index 000000000000..164535033d98 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetails.java @@ -0,0 +1,36 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import org.apache.cloudstack.api.InternalIdentity; + +public interface GuiThemeDetails extends InternalIdentity { + + void setId(Long id); + + Long getGuiThemeId(); + + void setGuiThemeId(Long guiThemeId); + + String getType(); + + void setType(String type); + + String getValue(); + + void setValue(String value); +} diff --git a/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoin.java b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoin.java new file mode 100644 index 000000000000..e54d53138ef6 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoin.java @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +public interface GuiThemeJoin extends InternalIdentity, Identity { + + String getName(); + + String getDescription(); + + String getCss(); + + String getJsonConfiguration(); + + String getCommonNames(); + + String getDomains(); + + String getAccounts(); + + boolean isRecursiveDomains(); + + boolean getIsPublic(); + + Date getCreated(); + + Date getRemoved(); +} diff --git a/plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/VmwareRequestResponse.java b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeService.java similarity index 56% rename from plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/VmwareRequestResponse.java rename to api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeService.java index 81c58ef27baf..8a066d3ffeca 100644 --- a/plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/VmwareRequestResponse.java +++ b/api/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeService.java @@ -14,25 +14,22 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +package org.apache.cloudstack.gui.theme; -package org.apache.cloudstack.api.command.admin.zone; - -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ResponseObject; +import org.apache.cloudstack.api.command.user.gui.theme.CreateGuiThemeCmd; +import org.apache.cloudstack.api.command.user.gui.theme.ListGuiThemesCmd; +import org.apache.cloudstack.api.command.user.gui.theme.RemoveGuiThemeCmd; +import org.apache.cloudstack.api.command.user.gui.theme.UpdateGuiThemeCmd; +import org.apache.cloudstack.api.response.GuiThemeResponse; import org.apache.cloudstack.api.response.ListResponse; -public class VmwareRequestResponse extends ListResponse { - @SerializedName(ApiConstants.TOKEN) - @Param(description = "The Vmware API token to use for retrieving further responses with") - private String token; +public interface GuiThemeService { + + ListResponse listGuiThemes(ListGuiThemesCmd cmd); + + GuiThemeJoin createGuiTheme(CreateGuiThemeCmd cmd); - public String getToken() { - return token; - } + GuiThemeJoin updateGuiTheme(UpdateGuiThemeCmd cmd); - public void setToken(String token) { - this.token = token; - } + void removeGuiTheme(RemoveGuiThemeCmd cmd); } diff --git a/api/src/main/java/org/apache/cloudstack/network/RoutedIpv4Manager.java b/api/src/main/java/org/apache/cloudstack/network/RoutedIpv4Manager.java index 221a550ad630..9285331f41aa 100644 --- a/api/src/main/java/org/apache/cloudstack/network/RoutedIpv4Manager.java +++ b/api/src/main/java/org/apache/cloudstack/network/RoutedIpv4Manager.java @@ -158,7 +158,7 @@ public interface RoutedIpv4Manager extends PluggableService, Configurable { boolean isRoutedVpc(Vpc vpc); - boolean isVpcVirtualRouterGateway(VpcOffering vpcOffering); + boolean isValidGateway(VpcOffering vpcOffering); BgpPeer createBgpPeer(CreateBgpPeerCmd createBgpPeerCmd); diff --git a/api/src/main/java/org/apache/cloudstack/query/QueryService.java b/api/src/main/java/org/apache/cloudstack/query/QueryService.java index 88081494320c..5b053aafd84b 100644 --- a/api/src/main/java/org/apache/cloudstack/query/QueryService.java +++ b/api/src/main/java/org/apache/cloudstack/query/QueryService.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.query; +import java.util.Arrays; import java.util.List; import org.apache.cloudstack.affinity.AffinityGroupResponse; @@ -31,6 +32,7 @@ import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListObjectStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStorageAccessGroupsCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd; import org.apache.cloudstack.api.command.admin.storage.heuristics.ListSecondaryStorageSelectorsCmd; @@ -86,6 +88,7 @@ import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.response.StorageAccessGroupResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.StorageTagResponse; import org.apache.cloudstack.api.response.TemplateResponse; @@ -97,6 +100,7 @@ import org.apache.cloudstack.framework.config.ConfigKey; import com.cloud.exception.PermissionDeniedException; +import com.cloud.vm.VmDetailConstants; /** * Service used for list api query. @@ -104,37 +108,45 @@ */ public interface QueryService { + List RootAdminOnlyVmSettings = Arrays.asList(VmDetailConstants.GUEST_CPU_MODE, VmDetailConstants.GUEST_CPU_MODEL); + // Config keys ConfigKey AllowUserViewDestroyedVM = new ConfigKey<>("Advanced", Boolean.class, "allow.user.view.destroyed.vm", "false", "Determines whether users can view their destroyed or expunging vm ", true, ConfigKey.Scope.Account); - static final ConfigKey UserVMDeniedDetails = new ConfigKey<>(String.class, + ConfigKey UserVMDeniedDetails = new ConfigKey<>(String.class, "user.vm.denied.details", "Advanced", "rootdisksize, cpuOvercommitRatio, memoryOvercommitRatio, Message.ReservedCapacityFreed.Flag", "Determines whether users can view certain VM settings. When set to empty, default value used is: rootdisksize, cpuOvercommitRatio, memoryOvercommitRatio, Message.ReservedCapacityFreed.Flag.", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null); - static final ConfigKey UserVMReadOnlyDetails = new ConfigKey<>(String.class, + ConfigKey UserVMReadOnlyDetails = new ConfigKey<>(String.class, "user.vm.readonly.details", "Advanced", "dataDiskController, rootDiskController", - "List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null); + "List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null, ""); ConfigKey SortKeyAscending = new ConfigKey<>("Advanced", Boolean.class, "sortkey.algorithm", "true", "Sort algorithm - ascending or descending - to use. For entities that use sort key(template, disk offering, service offering, " + "network offering, zones), we use the flag to determine if the entities should be sorted ascending (when flag is true) " + "or descending (when flag is false). Within the scope of the config all users see the same result.", true, ConfigKey.Scope.Global); - public static final ConfigKey AllowUserViewAllDomainAccounts = new ConfigKey<>("Advanced", Boolean.class, + ConfigKey AllowUserViewAllDomainAccounts = new ConfigKey<>("Advanced", Boolean.class, "allow.user.view.all.domain.accounts", "false", "Determines whether users can view all user accounts within the same domain", true, ConfigKey.Scope.Domain); - static final ConfigKey SharePublicTemplatesWithOtherDomains = new ConfigKey<>("Advanced", Boolean.class, "share.public.templates.with.other.domains", "true", - "If false, templates of this domain will not show up in the list templates of other domains.", true, ConfigKey.Scope.Domain); + ConfigKey AllowUserViewAllDataCenters = new ConfigKey<>("Advanced", Boolean.class, "allow.user.view.all.zones", "true", + "Determines whether for Instance a Resource Admin can view zones that are not dedicated to them.", true, ConfigKey.Scope.Domain); + + ConfigKey SharePublicTemplatesWithOtherDomains = new ConfigKey<>("Advanced", Boolean.class, "share.public.templates.with.other.domains", "true", + "If false, Templates of this domain will not show up in the list Templates of other domains.", true, ConfigKey.Scope.Domain); ConfigKey ReturnVmStatsOnVmList = new ConfigKey<>("Advanced", Boolean.class, "list.vm.default.details.stats", "true", "Determines whether VM stats should be returned when details are not explicitly specified in listVirtualMachines API request. When false, details default to [group, nics, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp]. When true, all details are returned including 'stats'.", true, ConfigKey.Scope.Global); + ListResponse searchForUsers(ResponseObject.ResponseView responseView, ListUsersCmd cmd) throws PermissionDeniedException; ListResponse searchForUsers(Long domainId, boolean recursive) throws PermissionDeniedException; + List searchForAccessibleUsers(); + ListResponse searchForEvents(ListEventsCmd cmd); ListResponse listTags(ListTagsCmd cmd); @@ -193,6 +205,8 @@ public interface QueryService { ListResponse searchForStorageTags(ListStorageTagsCmd cmd); + ListResponse searchForStorageAccessGroups(ListStorageAccessGroupsCmd cmd); + ListResponse searchForHostTags(ListHostTagsCmd cmd); ListResponse listManagementServers(ListMgmtsCmd cmd); diff --git a/api/src/main/java/org/apache/cloudstack/resourcelimit/Reserver.java b/api/src/main/java/org/apache/cloudstack/resourcelimit/Reserver.java new file mode 100644 index 000000000000..6b3f57b6aa5e --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/resourcelimit/Reserver.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.resourcelimit; + +/** + * Interface implemented by CheckedReservation. + *

+ * This is defined in cloud-api to allow methods declared in modules that do not depend on cloud-server + * to receive CheckedReservations as parameters. + */ +public interface Reserver extends AutoCloseable { + + void close(); + +} diff --git a/api/src/main/java/org/apache/cloudstack/storage/object/BucketApiService.java b/api/src/main/java/org/apache/cloudstack/storage/object/BucketApiService.java index e27ef308d7f2..8c164133db88 100644 --- a/api/src/main/java/org/apache/cloudstack/storage/object/BucketApiService.java +++ b/api/src/main/java/org/apache/cloudstack/storage/object/BucketApiService.java @@ -95,7 +95,7 @@ public interface BucketApiService { */ Bucket createBucket(CreateBucketCmd cmd); - boolean deleteBucket(long bucketId, Account caller); + boolean deleteBucket(long bucketId, Account caller) throws ResourceAllocationException; boolean updateBucket(UpdateBucketCmd cmd, Account caller) throws ResourceAllocationException; diff --git a/api/src/main/java/org/apache/cloudstack/storage/sharedfs/SharedFSService.java b/api/src/main/java/org/apache/cloudstack/storage/sharedfs/SharedFSService.java index 21184de27a26..3e349cf0bd39 100644 --- a/api/src/main/java/org/apache/cloudstack/storage/sharedfs/SharedFSService.java +++ b/api/src/main/java/org/apache/cloudstack/storage/sharedfs/SharedFSService.java @@ -23,6 +23,10 @@ import org.apache.cloudstack.api.command.user.storage.sharedfs.ChangeSharedFSServiceOfferingCmd; import org.apache.cloudstack.api.command.user.storage.sharedfs.CreateSharedFSCmd; import org.apache.cloudstack.api.command.user.storage.sharedfs.DestroySharedFSCmd; +import org.apache.cloudstack.api.command.user.storage.sharedfs.ListSharedFSCmd; +import org.apache.cloudstack.api.command.user.storage.sharedfs.UpdateSharedFSCmd; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.SharedFSResponse; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ManagementServerException; @@ -31,11 +35,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.VirtualMachineMigrationException; -import org.apache.cloudstack.api.command.user.storage.sharedfs.ListSharedFSCmd; -import org.apache.cloudstack.api.command.user.storage.sharedfs.UpdateSharedFSCmd; -import org.apache.cloudstack.api.response.SharedFSResponse; -import org.apache.cloudstack.api.response.ListResponse; - public interface SharedFSService { List getSharedFSProviders(); @@ -69,4 +68,10 @@ public interface SharedFSService { SharedFS recoverSharedFS(Long sharedFSId); void deleteSharedFS(Long sharedFSId); + + SharedFS getSharedFSByUuid(String uuid); + + SharedFS getSharedFSForVmId(long vmId); + + SharedFS updateSharedFSPostRestore(long sharedFsId, long volumeId); } diff --git a/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateManager.java b/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateManager.java index 6571346ad654..3df59811561b 100644 --- a/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateManager.java +++ b/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateManager.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.command.user.vm.DeployVnfApplianceCmd; import org.apache.cloudstack.framework.config.ConfigKey; import java.util.List; +import java.util.Map; public interface VnfTemplateManager { @@ -42,11 +43,12 @@ public interface VnfTemplateManager { void updateVnfTemplate(long templateId, UpdateVnfTemplateCmd cmd); - void validateVnfApplianceNics(VirtualMachineTemplate template, List networkIds); + void validateVnfApplianceNics(VirtualMachineTemplate template, List networkIds, Map vmNetworkMap); SecurityGroup createSecurityGroupForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner, DeployVnfApplianceCmd cmd); void createIsolatedNetworkRulesForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner, UserVm vm, DeployVnfApplianceCmd cmd) throws InsufficientAddressCapacityException, ResourceAllocationException, ResourceUnavailableException; + } diff --git a/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java b/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java index e997a50cec03..16ff2abb564a 100644 --- a/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java +++ b/api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.storage.template; +import com.cloud.agent.api.to.deployasis.OVFNetworkTO; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.VNF; import com.cloud.storage.Storage; @@ -124,6 +125,9 @@ public static void validateVnfNics(List nicsList) { public static void validateApiCommandParams(BaseCmd cmd, VirtualMachineTemplate template) { if (cmd instanceof RegisterVnfTemplateCmd) { RegisterVnfTemplateCmd registerCmd = (RegisterVnfTemplateCmd) cmd; + if (registerCmd.isDeployAsIs() && CollectionUtils.isNotEmpty(registerCmd.getVnfNics())) { + throw new InvalidParameterValueException("VNF nics cannot be specified when register a deploy-as-is Template. Please wait until Template settings are read from OVA."); + } validateApiCommandParams(registerCmd.getVnfDetails(), registerCmd.getVnfNics(), registerCmd.getTemplateType()); } else if (cmd instanceof UpdateVnfTemplateCmd) { UpdateVnfTemplateCmd updateCmd = (UpdateVnfTemplateCmd) cmd; @@ -149,4 +153,18 @@ public static void validateVnfCidrList(List cidrList) { } } } + + public static void validateDeployAsIsTemplateVnfNics(List ovfNetworks, List vnfNics) { + if (CollectionUtils.isEmpty(vnfNics)) { + return; + } + if (CollectionUtils.isEmpty(ovfNetworks)) { + throw new InvalidParameterValueException("The list of networks read from OVA is empty. Please wait until the template is fully downloaded and processed."); + } + for (VNF.VnfNic vnfNic : vnfNics) { + if (vnfNic.getDeviceId() < ovfNetworks.size() && !vnfNic.isRequired()) { + throw new InvalidParameterValueException(String.format("The VNF nic [device ID: %s ] is required as it is defined in the OVA template.", vnfNic.getDeviceId())); + } + } + } } diff --git a/api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java b/api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java index 5f69f3e46e73..13f01b4944ad 100644 --- a/api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java +++ b/api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java @@ -25,17 +25,28 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.VolumeForImportResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.Configurable; import java.util.Arrays; import java.util.List; -public interface VolumeImportUnmanageService extends PluggableService { +public interface VolumeImportUnmanageService extends PluggableService, Configurable { List SUPPORTED_HYPERVISORS = Arrays.asList(Hypervisor.HypervisorType.KVM, Hypervisor.HypervisorType.VMware); List SUPPORTED_STORAGE_POOL_TYPES_FOR_KVM = Arrays.asList(Storage.StoragePoolType.NetworkFilesystem, - Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD); + Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD, Storage.StoragePoolType.SharedMountPoint); + + ConfigKey AllowImportVolumeWithBackingFile = new ConfigKey<>(Boolean.class, + "allow.import.volume.with.backing.file", + "Advanced", + "false", + "If enabled, allows QCOW2 volumes with backing files to be imported or unmanaged", + true, + ConfigKey.Scope.Global, + null); ListResponse listVolumesForImport(ListVolumesForImportCmd cmd); diff --git a/api/src/main/java/org/apache/cloudstack/userdata/UserDataManager.java b/api/src/main/java/org/apache/cloudstack/userdata/UserDataManager.java index b4bede248907..7e718413118e 100644 --- a/api/src/main/java/org/apache/cloudstack/userdata/UserDataManager.java +++ b/api/src/main/java/org/apache/cloudstack/userdata/UserDataManager.java @@ -22,6 +22,8 @@ import com.cloud.utils.component.Manager; +import java.io.IOException; + public interface UserDataManager extends Manager, Configurable { String VM_USERDATA_MAX_LENGTH_STRING = "vm.userdata.max.length"; ConfigKey VM_USERDATA_MAX_LENGTH = new ConfigKey<>("Advanced", Integer.class, VM_USERDATA_MAX_LENGTH_STRING, "32768", @@ -29,4 +31,14 @@ public interface UserDataManager extends Manager, Configurable { String concatenateUserData(String userdata1, String userdata2, String userdataProvider); String validateUserData(String userData, BaseCmd.HTTPMethod httpmethod); + + /** + * This method validates the user data uuid for system VMs and returns the user data + * after compression and base64 encoding for the system VM to consume. + * + * @param userDataUuid + * @return a String containing the user data after compression and base64 encoding + * @throws IOException + */ + String validateAndGetUserDataForSystemVM(String userDataUuid) throws IOException; } diff --git a/api/src/main/java/org/apache/cloudstack/vm/ImportVmTask.java b/api/src/main/java/org/apache/cloudstack/vm/ImportVmTask.java new file mode 100644 index 000000000000..5bb51dfcbcb9 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/vm/ImportVmTask.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.vm; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface ImportVmTask extends Identity, InternalIdentity { + enum Step { + Prepare, CloningInstance, ConvertingInstance, Importing, Completed + } + + enum TaskState { + Running, Completed, Failed; + + public static TaskState getValue(String state) { + for (TaskState s : TaskState.values()) { + if (s.name().equalsIgnoreCase(state)) { + return s; + } + } + throw new IllegalArgumentException("Invalid task state: " + state); + } + } +} diff --git a/api/src/main/java/org/apache/cloudstack/vm/ImportVmTasksManager.java b/api/src/main/java/org/apache/cloudstack/vm/ImportVmTasksManager.java new file mode 100644 index 000000000000..233511fbce8d --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/vm/ImportVmTasksManager.java @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.vm; + +import com.cloud.dc.DataCenter; +import com.cloud.host.Host; +import com.cloud.user.Account; +import org.apache.cloudstack.api.command.admin.vm.ListImportVMTasksCmd; +import org.apache.cloudstack.api.response.ImportVMTaskResponse; +import org.apache.cloudstack.api.response.ListResponse; + +public interface ImportVmTasksManager { + + ListResponse listImportVMTasks(ListImportVMTasksCmd cmd); + + ImportVmTask createImportVMTaskRecord(DataCenter zone, Account owner, long userId, String displayName, + String vcenter, String datacenterName, String sourceVMName, + Host convertHost, Host importHost); + + void updateImportVMTaskStep(ImportVmTask importVMTaskVO, DataCenter zone, Account owner, Host convertHost, + Host importHost, Long vmId, ImportVmTask.Step step); + + void updateImportVMTaskErrorState(ImportVmTask importVMTaskVO, ImportVmTask.TaskState state, String errorMsg); +} diff --git a/api/src/main/java/org/apache/cloudstack/vm/UnmanageVMService.java b/api/src/main/java/org/apache/cloudstack/vm/UnmanageVMService.java index 2315e5f2e95f..70d8795f3058 100644 --- a/api/src/main/java/org/apache/cloudstack/vm/UnmanageVMService.java +++ b/api/src/main/java/org/apache/cloudstack/vm/UnmanageVMService.java @@ -17,11 +17,14 @@ package org.apache.cloudstack.vm; +import com.cloud.utils.Pair; + public interface UnmanageVMService { /** * Unmanage a guest VM from CloudStack - * @return true if the VM is successfully unmanaged, false if not. + * + * @return (true if successful, false if not, hostUuid) if the VM is successfully unmanaged. */ - boolean unmanageVMInstance(long vmId); + Pair unmanageVMInstance(long vmId, Long paramHostId, boolean isForced); } diff --git a/api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java b/api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java index 3d5646f68c9d..cbb7c4de698a 100644 --- a/api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java +++ b/api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java @@ -55,12 +55,18 @@ public enum PowerState { private String hostName; + private String hypervisorType; + private String hostHypervisorVersion; + private List disks; private List nics; private String vncPassword; + private String bootType; + private String bootMode; + public String getName() { return name; } @@ -165,6 +171,22 @@ public void setHostName(String hostName) { this.hostName = hostName; } + public String getHypervisorType() { + return hypervisorType; + } + + public void setHypervisorType(String hypervisorType) { + this.hypervisorType = hypervisorType; + } + + public String getHostHypervisorVersion() { + return hostHypervisorVersion; + } + + public void setHostHypervisorVersion(String hostHypervisorVersion) { + this.hostHypervisorVersion = hostHypervisorVersion; + } + public List getDisks() { return disks; } @@ -196,6 +218,22 @@ public String toString() { this, "name", "internalCSName", "hostName", "clusterName")); } + public String getBootType() { + return bootType; + } + + public void setBootType(String bootType) { + this.bootType = bootType; + } + + public String getBootMode() { + return bootMode; + } + + public void setBootMode(String bootMode) { + this.bootMode = bootMode; + } + public static class Disk { private String diskId; diff --git a/api/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManager.java b/api/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManager.java index b6233b9c2704..e1963313eb6f 100644 --- a/api/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManager.java +++ b/api/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManager.java @@ -26,6 +26,8 @@ public interface UnmanagedVMsManager extends VmImportService, UnmanageVMService, PluggableService, Configurable { + String VM_IMPORT_DEFAULT_TEMPLATE_NAME = "system-default-vm-import-dummy-template.iso"; + String KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME = "kvm-default-vm-import-dummy-template"; ConfigKey UnmanageVMPreserveNic = new ConfigKey<>("Advanced", Boolean.class, "unmanage.vm.preserve.nics", "false", "If set to true, do not remove VM nics (and its MAC addresses) when unmanaging a VM, leaving them allocated but not reserved. " + "If set to false, nics are removed and MAC addresses can be reassigned", true, ConfigKey.Scope.Zone); diff --git a/api/src/main/java/org/apache/cloudstack/vm/lease/VMLeaseManager.java b/api/src/main/java/org/apache/cloudstack/vm/lease/VMLeaseManager.java new file mode 100644 index 000000000000..b67026953059 --- /dev/null +++ b/api/src/main/java/org/apache/cloudstack/vm/lease/VMLeaseManager.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.vm.lease; + +import com.cloud.utils.component.Manager; +import org.apache.cloudstack.framework.config.ConfigKey; + +import java.util.List; + +public interface VMLeaseManager extends Manager { + + int MAX_LEASE_DURATION_DAYS = 365_00; // 100 years + + enum ExpiryAction { + STOP, + DESTROY + } + + enum LeaseActionExecution { + PENDING, + DISABLED, + DONE, + CANCELLED + } + + ConfigKey InstanceLeaseEnabled = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Boolean.class, + "instance.lease.enabled", "false", "Indicates whether to enable the Instance lease," + + " will be applicable only on instances created after lease is enabled. Disabling the feature cancels lease on existing instances with lease." + + " Re-enabling feature will not cause lease expiry actions on grandfathered instances", + true, List.of(ConfigKey.Scope.Global)); + + ConfigKey InstanceLeaseSchedulerInterval = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "instance.lease.scheduler.interval", "3600", "VM Lease Scheduler interval in seconds", + false, List.of(ConfigKey.Scope.Global)); + + ConfigKey InstanceLeaseExpiryEventSchedulerInterval = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "instance.lease.eventscheduler.interval", "86400", "Lease expiry event Scheduler interval in seconds", + false, List.of(ConfigKey.Scope.Global)); + + ConfigKey InstanceLeaseExpiryEventDaysBefore = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "instance.lease.expiryevent.daysbefore", "7", "Indicates how many days in advance, expiry events will be created before expiry.", + true, List.of(ConfigKey.Scope.Global)); + + void onLeaseFeatureToggle(); +} diff --git a/api/src/test/java/com/cloud/agent/api/storage/OVFHelperTest.java b/api/src/test/java/com/cloud/agent/api/storage/OVFHelperTest.java index c8f7ef3ec9ba..5192f182a524 100644 --- a/api/src/test/java/com/cloud/agent/api/storage/OVFHelperTest.java +++ b/api/src/test/java/com/cloud/agent/api/storage/OVFHelperTest.java @@ -40,7 +40,7 @@ public class OVFHelperTest { "This will enable the SSHD service and configure the specified public key" + "" + "" + - "" + + "" + "This allows to pass any text to the appliance. The value should be encoded in base64" + "" + ""; @@ -576,15 +576,15 @@ public class OVFHelperTest { " SSO Configuration\n" + " \n" + " \n" + - " For the first instance of the identity domain, this is the username with Administrator privileges. Otherwise, this is the username of the replication partner.\n" + + " For the first Instance of the identity domain, this is the username with Administrator privileges. Otherwise, this is the username of the replication partner.\n" + " \n" + " \n" + " \n" + - " For the first instance of the identity domain, this is the password given to the Administrator account. Otherwise, this is the password of the Administrator account of the replication partner.\n" + + " For the first Instance of the identity domain, this is the password given to the Administrator account. Otherwise, this is the password of the Administrator account of the replication partner.\n" + " \n" + " \n" + " \n" + - " For the first instance of the identity domain, this is the name of the newly created domain.\n" + + " For the first Instance of the identity domain, this is the name of the newly created domain.\n" + " \n" + " \n" + " \n" + @@ -592,11 +592,11 @@ public class OVFHelperTest { " \n" + " \n" + " \n" + - " If this parameter is set to True, the VMware directory instance is setup as the first instance of a new identity domain. Otherwise, the instance is setup as a replication partner.\n" + + " If this parameter is set to True, the VMware directory Instance is setup as the first Instance of a new identity domain. Otherwise, the Instance is setup as a replication partner.\n" + " \n" + " \n" + " \n" + - " The hostname of the VMware directory replication partner. This value is ignored for the first instance of the identity domain.\n" + + " The hostname of the VMware directory replication partner. This value is ignored for the first Instance of the identity domain.\n" + " \n" + " Database Configuration\n" + " \n" + @@ -625,7 +625,7 @@ public class OVFHelperTest { " \n" + " \n" + " \n" + - " String describing the external database instance. Values could be anything depending on what the database instance name the DBA creates in the external db. (ignored when the db.type is 'embedded').\n" + + " String describing the external database Instance. Values could be anything depending on what the database Instance name the DBA creates in the external db. (ignored when the db.type is 'embedded').\n" + " \n" + " System Configuration\n" + " \n" + diff --git a/api/src/test/java/com/cloud/cpu/CPUTest.java b/api/src/test/java/com/cloud/cpu/CPUTest.java new file mode 100644 index 000000000000..0a059cf9a90a --- /dev/null +++ b/api/src/test/java/com/cloud/cpu/CPUTest.java @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.cpu; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class CPUTest { + @Test + public void testCPUArchGetType() { + assertEquals("i686", CPU.CPUArch.x86.getType()); + assertEquals("x86_64", CPU.CPUArch.amd64.getType()); + assertEquals("aarch64", CPU.CPUArch.arm64.getType()); + assertEquals("s390x", CPU.CPUArch.s390x.getType()); + } + + @Test + public void testCPUArchGetBits() { + assertEquals(32, CPU.CPUArch.x86.getBits()); + assertEquals(64, CPU.CPUArch.amd64.getBits()); + assertEquals(64, CPU.CPUArch.arm64.getBits()); + assertEquals(64, CPU.CPUArch.s390x.getBits()); + } + + @Test + public void testCPUArchFromTypeWithValidValues() { + assertEquals(CPU.CPUArch.x86, CPU.CPUArch.fromType("i686")); + assertEquals(CPU.CPUArch.amd64, CPU.CPUArch.fromType("x86_64")); + assertEquals(CPU.CPUArch.arm64, CPU.CPUArch.fromType("aarch64")); + assertEquals(CPU.CPUArch.s390x, CPU.CPUArch.fromType("s390x")); + } + + @Test + public void testCPUArchFromTypeWithDefaultForBlankOrNull() { + assertEquals(CPU.CPUArch.amd64, CPU.CPUArch.fromType("")); + assertEquals(CPU.CPUArch.amd64, CPU.CPUArch.fromType(" ")); + assertEquals(CPU.CPUArch.amd64, CPU.CPUArch.fromType(null)); + } + + @Test + public void testCPUArchFromTypeWithInvalidValue() { + Exception exception = assertThrows(IllegalArgumentException.class, () -> { + CPU.CPUArch.fromType("unsupported"); + }); + assertTrue(exception.getMessage().contains("Unsupported arch type: unsupported")); + } + + @Test + public void testCPUArchGetTypesAsCSV() { + String expectedCSV = "i686,x86_64,aarch64,s390x"; + assertEquals(expectedCSV, CPU.CPUArch.getTypesAsCSV()); + } +} diff --git a/api/src/test/java/com/cloud/network/NetworksTest.java b/api/src/test/java/com/cloud/network/NetworksTest.java index ef5829243421..6f0f3fbd1efe 100644 --- a/api/src/test/java/com/cloud/network/NetworksTest.java +++ b/api/src/test/java/com/cloud/network/NetworksTest.java @@ -37,6 +37,24 @@ public class NetworksTest { public void setUp() { } + @Test + public void nullBroadcastDomainTypeTest() throws URISyntaxException { + BroadcastDomainType type = BroadcastDomainType.getTypeOf(null); + Assert.assertEquals("a null uri should mean a broadcasttype of undecided", BroadcastDomainType.UnDecided, type); + } + + @Test + public void nullBroadcastDomainTypeValueTest() { + URI uri = null; + Assert.assertNull(BroadcastDomainType.getValue(uri)); + } + + @Test + public void nullBroadcastDomainTypeStringValueTest() throws URISyntaxException { + String uriString = null; + Assert.assertNull(BroadcastDomainType.getValue(uriString)); + } + @Test public void emptyBroadcastDomainTypeTest() throws URISyntaxException { BroadcastDomainType type = BroadcastDomainType.getTypeOf(""); diff --git a/api/src/test/java/org/apache/cloudstack/acl/RuleTest.java b/api/src/test/java/org/apache/cloudstack/acl/RuleTest.java index 79e6127d29ad..b99ba48c66dc 100644 --- a/api/src/test/java/org/apache/cloudstack/acl/RuleTest.java +++ b/api/src/test/java/org/apache/cloudstack/acl/RuleTest.java @@ -17,13 +17,46 @@ package org.apache.cloudstack.acl; import com.cloud.exception.InvalidParameterValueException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; +import org.apache.cloudstack.api.APICommand; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; import java.util.Arrays; +import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.core.type.filter.AnnotationTypeFilter; public class RuleTest { + private static List apiNames; + private static List apiRules; + private static ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); + + @BeforeClass + public static void setup() { + provider.addIncludeFilter(new AnnotationTypeFilter(APICommand.class)); + Set beanDefinitions = provider.findCandidateComponents("org.apache.cloudstack.api"); + + apiNames = new ArrayList<>(); + apiRules = new ArrayList<>(); + for(BeanDefinition bd : beanDefinitions) { + if (bd instanceof AnnotatedBeanDefinition) { + Map annotationAttributeMap = ((AnnotatedBeanDefinition) bd).getMetadata() + .getAnnotationAttributes(APICommand.class.getName()); + String apiName = annotationAttributeMap.get("name").toString(); + apiNames.add(apiName); + apiRules.add(new Rule(apiName)); + } + } + } + @Test public void testToString() throws Exception { Rule rule = new Rule("someString"); @@ -31,21 +64,89 @@ public void testToString() throws Exception { } @Test - public void testMatchesEmpty() throws Exception { - Rule rule = new Rule("someString"); - Assert.assertFalse(rule.matches("")); + public void ruleMatchesTestNoMatchesOnEmptyString() throws Exception { + String testCmd = ""; + List matches = new ArrayList<>(); + for (Rule rule : apiRules) { + if (rule.matches(testCmd)) { + matches.add(rule.getRuleString()); + } + } + + Assert.assertEquals(matches.size(), 0); } @Test - public void testMatchesNull() throws Exception { - Rule rule = new Rule("someString"); - Assert.assertFalse(rule.matches(null)); + public void ruleMatchesTestNoMatchesOnNull() throws Exception { + List matches = new ArrayList<>(); + for (Rule rule : apiRules) { + if (rule.matches(null)) { + matches.add(rule.getRuleString()); + } + } + + Assert.assertTrue(matches.isEmpty()); } @Test - public void testMatchesSpace() throws Exception { - Rule rule = new Rule("someString"); - Assert.assertFalse(rule.matches(" ")); + public void ruleMatchesTestNoMatchesOnSpaceCharacter() throws Exception { + String testCmd = " "; + List matches = new ArrayList<>(); + for (Rule rule : apiRules) { + if (rule.matches(testCmd)) { + matches.add(rule.getRuleString()); + } + } + + Assert.assertTrue(matches.isEmpty()); + } + + @Test + public void ruleMatchesTestWildCardOnEndWorksAsNormalRegex() { + setup(); + Pattern regexPattern = Pattern.compile("list.*"); + Rule acsRegexRule = new Rule("list*"); + + List nonMatches = new ArrayList<>(); + for (String apiName : apiNames) { + if (acsRegexRule.matches(apiName) != regexPattern.matcher(apiName).matches()) { + nonMatches.add(apiName); + } + } + + Assert.assertTrue(nonMatches.isEmpty()); + } + + @Test + public void ruleMatchesTestWildCardOnMiddleWorksAsNormalRegex() { + setup(); + Pattern regexPattern = Pattern.compile("list.*s"); + Rule acsRegexRule = new Rule("list*s"); + + List nonMatches = new ArrayList<>(); + for (String apiName : apiNames) { + if (acsRegexRule.matches(apiName) != regexPattern.matcher(apiName).matches()) { + nonMatches.add(apiName); + } + } + + Assert.assertTrue(nonMatches.isEmpty()); + } + + @Test + public void ruleMatchesTestWildCardOnStartWorksAsNormalRegex() { + setup(); + Pattern regexPattern = Pattern.compile(".*User"); + Rule acsRegexRule = new Rule("*User"); + + List nonMatches = new ArrayList<>(); + for (String apiName : apiNames) { + if (acsRegexRule.matches(apiName) != regexPattern.matcher(apiName).matches()) { + nonMatches.add(apiName); + } + } + + Assert.assertTrue(nonMatches.isEmpty()); } @Test @@ -73,7 +174,25 @@ public void testMatchesWildcardMiddle() throws Exception { } @Test - public void testValidateRuleWithValidData() throws Exception { + public void ruleMatchesTestWildcardOnRuleAndCommand() throws Exception { + Rule rule = new Rule("*"); + Assert.assertTrue(rule.matches("list*")); + } + + @Test + public void ruleMatchesTestWildcardOnRuleAndCommandNotAllowed() throws Exception { + Rule rule = new Rule("list*"); + Assert.assertFalse(rule.matches("*")); + } + + @Test + public void ruleMatchesTestWithMultipleStars() throws Exception { + Rule rule = new Rule("list***"); + Assert.assertFalse(rule.matches("api")); + } + + @Test + public void testRuleToStringWithValidStrings() throws Exception { for (String rule : Arrays.asList("a", "1", "someApi", "someApi321", "123SomeApi", "prefix*", "*middle*", "*Suffix", "*", "**", "f***", "m0nk3yMa**g1c*")) { @@ -82,7 +201,7 @@ public void testValidateRuleWithValidData() throws Exception { } @Test - public void testValidateRuleWithInvalidData() throws Exception { + public void testRuleToStringWithInvalidStrings() throws Exception { for (String rule : Arrays.asList(null, "", " ", " ", "\n", "\t", "\r", "\"", "\'", "^someApi$", "^someApi", "some$", "some-Api;", "some,Api", "^", "$", "^$", ".*", "\\w+", "r**l3rd0@Kr3", "j@s1n|+|0ȷ", diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmdTest.java new file mode 100644 index 000000000000..a1412d5a76a7 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmdTest.java @@ -0,0 +1,301 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.backup; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.BackupOfferingResponse; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.BackupOffering; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class CloneBackupOfferingCmdTest { + + private CloneBackupOfferingCmd cloneBackupOfferingCmd; + + @Mock + private BackupManager backupManager; + + @Mock + private ResponseGenerator responseGenerator; + + @Mock + private BackupOffering mockBackupOffering; + + @Mock + private BackupOfferingResponse mockBackupOfferingResponse; + + @Before + public void setUp() { + cloneBackupOfferingCmd = new CloneBackupOfferingCmd(); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "backupManager", backupManager); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "_responseGenerator", responseGenerator); + } + + @Test + public void testGetSourceOfferingId() { + Long sourceOfferingId = 999L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", sourceOfferingId); + assertEquals(sourceOfferingId, cloneBackupOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testGetName() { + String name = "ClonedBackupOffering"; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", name); + assertEquals(name, cloneBackupOfferingCmd.getName()); + } + + @Test + public void testGetDescription() { + String description = "Cloned Backup Offering Description"; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", description); + assertEquals(description, cloneBackupOfferingCmd.getDescription()); + } + + @Test + public void testGetZoneId() { + Long zoneId = 123L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "zoneId", zoneId); + assertEquals(zoneId, cloneBackupOfferingCmd.getZoneId()); + } + + @Test + public void testGetExternalId() { + String externalId = "external-backup-123"; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "externalId", externalId); + assertEquals(externalId, cloneBackupOfferingCmd.getExternalId()); + } + + @Test + public void testGetAllowUserDrivenBackups() { + Boolean allowUserDrivenBackups = true; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", allowUserDrivenBackups); + assertEquals(allowUserDrivenBackups, cloneBackupOfferingCmd.getUserDrivenBackups()); + } + + @Test + public void testAllowUserDrivenBackupsDefaultTrue() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", null); + Boolean result = cloneBackupOfferingCmd.getUserDrivenBackups(); + assertTrue(result == null || result); + } + + @Test + public void testAllowUserDrivenBackupsFalse() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", false); + assertEquals(Boolean.FALSE, cloneBackupOfferingCmd.getUserDrivenBackups()); + } + + @Test + public void testExecuteSuccess() throws Exception { + Long sourceOfferingId = 999L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", sourceOfferingId); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + + when(backupManager.cloneBackupOffering(any(CloneBackupOfferingCmd.class))).thenReturn(mockBackupOffering); + when(responseGenerator.createBackupOfferingResponse(mockBackupOffering)).thenReturn(mockBackupOfferingResponse); + + cloneBackupOfferingCmd.execute(); + + assertNotNull(cloneBackupOfferingCmd.getResponseObject()); + assertEquals(mockBackupOfferingResponse, cloneBackupOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteFailure() throws Exception { + Long sourceOfferingId = 999L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(backupManager.cloneBackupOffering(any(CloneBackupOfferingCmd.class))).thenReturn(null); + + try { + cloneBackupOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Failed to clone backup offering", e.getMessage()); + } + } + + @Test + public void testExecuteWithInvalidParameterException() throws Exception { + Long sourceOfferingId = 999L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(backupManager.cloneBackupOffering(any(CloneBackupOfferingCmd.class))) + .thenThrow(new InvalidParameterValueException("Invalid source offering ID")); + + try { + cloneBackupOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode()); + assertEquals("Invalid source offering ID", e.getMessage()); + } + } + + @Test + public void testExecuteWithCloudRuntimeException() throws Exception { + Long sourceOfferingId = 999L; + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(backupManager.cloneBackupOffering(any(CloneBackupOfferingCmd.class))) + .thenThrow(new CloudRuntimeException("Runtime error during clone")); + + try { + cloneBackupOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Runtime error during clone", e.getMessage()); + } + } + + @Test + public void testExecuteSuccessWithAllParameters() throws Exception { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Test Description"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "zoneId", 123L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "externalId", "ext-123"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", true); + + when(backupManager.cloneBackupOffering(any(CloneBackupOfferingCmd.class))).thenReturn(mockBackupOffering); + when(responseGenerator.createBackupOfferingResponse(mockBackupOffering)).thenReturn(mockBackupOfferingResponse); + + cloneBackupOfferingCmd.execute(); + + assertNotNull(cloneBackupOfferingCmd.getResponseObject()); + assertEquals(mockBackupOfferingResponse, cloneBackupOfferingCmd.getResponseObject()); + } + + @Test + public void testCloneWithAllParameters() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Cloned backup offering for testing"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "zoneId", 123L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "externalId", "external-backup-123"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", true); + + assertEquals(Long.valueOf(999L), cloneBackupOfferingCmd.getSourceOfferingId()); + assertEquals("ClonedBackupOffering", cloneBackupOfferingCmd.getName()); + assertEquals("Cloned backup offering for testing", cloneBackupOfferingCmd.getDescription()); + assertEquals(Long.valueOf(123L), cloneBackupOfferingCmd.getZoneId()); + assertEquals("external-backup-123", cloneBackupOfferingCmd.getExternalId()); + assertEquals(Boolean.TRUE, cloneBackupOfferingCmd.getUserDrivenBackups()); + } + + @Test + public void testCloneWithMinimalParameters() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Description"); + + assertEquals(Long.valueOf(999L), cloneBackupOfferingCmd.getSourceOfferingId()); + assertEquals("ClonedBackupOffering", cloneBackupOfferingCmd.getName()); + assertEquals("Description", cloneBackupOfferingCmd.getDescription()); + + assertNull(cloneBackupOfferingCmd.getZoneId()); + assertNull(cloneBackupOfferingCmd.getExternalId()); + } + + @Test + public void testSourceOfferingIdNullByDefault() { + assertNull(cloneBackupOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testNameNullByDefault() { + assertNull(cloneBackupOfferingCmd.getName()); + } + + @Test + public void testDescriptionNullByDefault() { + assertNull(cloneBackupOfferingCmd.getDescription()); + } + + @Test + public void testZoneIdNullByDefault() { + assertNull(cloneBackupOfferingCmd.getZoneId()); + } + + @Test + public void testExternalIdNullByDefault() { + assertNull(cloneBackupOfferingCmd.getExternalId()); + } + + @Test + public void testCloneBackupOfferingInheritingZone() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Clone with inherited zone"); + + assertEquals(Long.valueOf(999L), cloneBackupOfferingCmd.getSourceOfferingId()); + assertNull(cloneBackupOfferingCmd.getZoneId()); + } + + @Test + public void testCloneBackupOfferingInheritingExternalId() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Clone with inherited external ID"); + + assertEquals(Long.valueOf(999L), cloneBackupOfferingCmd.getSourceOfferingId()); + assertNull(cloneBackupOfferingCmd.getExternalId()); + } + + @Test + public void testCloneBackupOfferingOverridingZone() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Clone with new zone"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "zoneId", 456L); + + assertEquals(Long.valueOf(999L), cloneBackupOfferingCmd.getSourceOfferingId()); + assertEquals(Long.valueOf(456L), cloneBackupOfferingCmd.getZoneId()); + } + + @Test + public void testCloneBackupOfferingDisallowUserDrivenBackups() { + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "sourceOfferingId", 999L); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "name", "ClonedBackupOffering"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "description", "Clone without user-driven backups"); + ReflectionTestUtils.setField(cloneBackupOfferingCmd, "userDrivenBackups", false); + + assertEquals(Boolean.FALSE, cloneBackupOfferingCmd.getUserDrivenBackups()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmdTest.java new file mode 100644 index 000000000000..af53a539e670 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmdTest.java @@ -0,0 +1,83 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.cluster; + +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.extension.Extension; +import org.apache.cloudstack.extension.ExtensionHelper; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +import com.cloud.hypervisor.Hypervisor; + +@RunWith(MockitoJUnitRunner.class) +public class ListClustersCmdTest { + + ExtensionHelper extensionHelper; + ListClustersCmd listClustersCmd = new ListClustersCmd(); + + @Before + public void setUp() { + extensionHelper = mock(ExtensionHelper.class); + listClustersCmd.extensionHelper = extensionHelper; + } + + @Test + public void updateClustersExtensions_emptyList_noAction() { + listClustersCmd.updateClustersExtensions(Collections.emptyList()); + // No exception, nothing to verify + } + + @Test + public void updateClustersExtensions_nullList_noAction() { + listClustersCmd.updateClustersExtensions(null); + // No exception, nothing to verify + } + + @Test + public void updateClustersExtensions_withClusterResponses_setsExtension() { + ClusterResponse cluster1 = mock(ClusterResponse.class); + ClusterResponse cluster2 = mock(ClusterResponse.class); + when(cluster1.getInternalId()).thenReturn(1L); + when(cluster1.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.External.name()); + when(cluster2.getInternalId()).thenReturn(2L); + when(cluster2.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.External.name()); + Extension ext1 = mock(Extension.class); + when(ext1.getUuid()).thenReturn("a"); + Extension ext2 = mock(Extension.class); + when(ext2.getUuid()).thenReturn("b"); + when(extensionHelper.getExtensionIdForCluster(anyLong())).thenAnswer(invocation -> invocation.getArguments()[0]); + when(extensionHelper.getExtension(1L)).thenReturn(ext1); + when(extensionHelper.getExtension(2L)).thenReturn(ext2); + List clusters = Arrays.asList(cluster1, cluster2); + listClustersCmd.updateClustersExtensions(clusters); + verify(cluster1).setExtensionId("a"); + verify(cluster2).setExtensionId("b"); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmdTest.java new file mode 100644 index 000000000000..51b1cd9e14b7 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmdTest.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.config; + +import org.apache.cloudstack.api.response.ConfigurationResponse; +import org.apache.cloudstack.config.Configuration; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +import com.cloud.utils.crypt.DBEncryptionUtil; + +@RunWith(MockitoJUnitRunner.class) +public class UpdateCfgCmdTest { + + private UpdateCfgCmd updateCfgCmd; + + private MockedStatic mockedStatic; + + @Before + public void setUp() { + updateCfgCmd = new UpdateCfgCmd(); + mockedStatic = Mockito.mockStatic(DBEncryptionUtil.class); + } + + @After + public void tearDown() { + mockedStatic.close(); + } + + @Test + public void setResponseValueSetsEncryptedValueWhenConfigurationIsEncrypted() { + ConfigurationResponse response = new ConfigurationResponse(); + Configuration cfg = Mockito.mock(Configuration.class); + Mockito.when(cfg.isEncrypted()).thenReturn(true); + Mockito.when(cfg.getValue()).thenReturn("testValue"); + Mockito.when(DBEncryptionUtil.encrypt("testValue")).thenReturn("encryptedValue"); + updateCfgCmd.setResponseValue(response, cfg); + Assert.assertEquals("encryptedValue", response.getValue()); + } + + @Test + public void setResponseValueSetsPlainValueWhenConfigurationIsNotEncrypted() { + ConfigurationResponse response = new ConfigurationResponse(); + Configuration cfg = Mockito.mock(Configuration.class); + Mockito.when(cfg.isEncrypted()).thenReturn(false); + Mockito.when(cfg.getValue()).thenReturn("testValue"); + updateCfgCmd.setResponseValue(response, cfg); + Assert.assertEquals("testValue", response.getValue()); + } + + @Test + public void setResponseValueHandlesNullConfigurationValueGracefully() { + ConfigurationResponse response = new ConfigurationResponse(); + Configuration cfg = Mockito.mock(Configuration.class); + Mockito.when(cfg.isEncrypted()).thenReturn(false); + Mockito.when(cfg.getValue()).thenReturn(null); + updateCfgCmd.setResponseValue(response, cfg); + Assert.assertNull(response.getValue()); + } + +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmdTest.java new file mode 100644 index 000000000000..be21384109c2 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuCardCmdTest.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CreateGpuCardCmdTest { + + @Test + public void getDeviceId() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getDeviceId()); + String deviceId = "0000:00:1f.6"; + ReflectionTestUtils.setField(cmd, "deviceId", deviceId); + assertEquals(deviceId, cmd.getDeviceId()); + } + + @Test + public void getDeviceName() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getDeviceName()); + String deviceName = "NVIDIA GeForce GTX 1080"; + ReflectionTestUtils.setField(cmd, "deviceName", deviceName); + assertEquals(deviceName, cmd.getDeviceName()); + } + + @Test + public void getName() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getName()); + String name = "Test GPU Card"; + ReflectionTestUtils.setField(cmd, "name", name); + assertEquals(name, cmd.getName()); + } + + @Test + public void getVendorName() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getVendorName()); + String vendorName = "NVIDIA"; + ReflectionTestUtils.setField(cmd, "vendorName", vendorName); + assertEquals(vendorName, cmd.getVendorName()); + } + + @Test + public void getVendorId() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getVendorId()); + String vendorId = "10de"; // NVIDIA vendor ID + ReflectionTestUtils.setField(cmd, "vendorId", vendorId); + assertEquals(vendorId, cmd.getVendorId()); + } + + @Test + public void getVideoRam() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertNull(cmd.getVideoRam()); + Long videoRam = 8192L; // 8 GB + ReflectionTestUtils.setField(cmd, "videoRam", videoRam); + assertEquals(videoRam, cmd.getVideoRam()); + } + + @Test + public void getEntityOwnerId() { + CreateGpuCardCmd cmd = new CreateGpuCardCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmdTest.java new file mode 100644 index 000000000000..fd5c568d5bc5 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateGpuDeviceCmdTest.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.gpu.GpuDevice; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CreateGpuDeviceCmdTest { + + @Test + public void getHostId() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertNull(cmd.getHostId()); + Long hostId = 1L; + ReflectionTestUtils.setField(cmd, "hostId", hostId); + assertEquals(hostId, cmd.getHostId()); + } + + @Test + public void getBusAddress() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertNull(cmd.getBusAddress()); + String busAddress = "0000:00:1f.6"; + ReflectionTestUtils.setField(cmd, "busAddress", busAddress); + assertEquals(busAddress, cmd.getBusAddress()); + } + + @Test + public void getGpuCardId() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertNull(cmd.getGpuCardId()); + Long gpuCardId = 1L; + ReflectionTestUtils.setField(cmd, "gpuCardId", gpuCardId); + assertEquals(gpuCardId, cmd.getGpuCardId()); + } + + @Test + public void getVgpuProfileId() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertNull(cmd.getVgpuProfileId()); + Long vgpuProfileId = 1L; + ReflectionTestUtils.setField(cmd, "vgpuProfileId", vgpuProfileId); + assertEquals(vgpuProfileId, cmd.getVgpuProfileId()); + } + + @Test + public void getType() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertEquals(GpuDevice.DeviceType.PCI, cmd.getType()); + String type = "MDEV"; + ReflectionTestUtils.setField(cmd, "type", type); + assertEquals(GpuDevice.DeviceType.MDEV, cmd.getType()); + } + + @Test + public void getParentGpuDeviceId() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertNull(cmd.getParentGpuDeviceId()); + Long parentGpuDeviceId = 1L; + ReflectionTestUtils.setField(cmd, "parentGpuDeviceId", parentGpuDeviceId); + assertEquals(parentGpuDeviceId, cmd.getParentGpuDeviceId()); + } + + @Test + public void getNumaNode() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertEquals("-1", cmd.getNumaNode()); + String numaNode = "0"; + ReflectionTestUtils.setField(cmd, "numaNode", numaNode); + assertEquals(numaNode, cmd.getNumaNode()); + } + + @Test + public void getEntityOwnerId() { + CreateGpuDeviceCmd cmd = new CreateGpuDeviceCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmdTest.java new file mode 100644 index 000000000000..c71286bda652 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/CreateVgpuProfileCmdTest.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CreateVgpuProfileCmdTest { + + @Test + public void getName() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getName()); + String name = "Test VGPU Profile"; + ReflectionTestUtils.setField(cmd, "name", name); + assertEquals(name, cmd.getName()); + } + + @Test + public void getDescription() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getDescription()); + String description = "Test VGPU Profile Description"; + ReflectionTestUtils.setField(cmd, "description", description); + assertEquals(description, cmd.getDescription()); + } + + @Test + public void getCardId() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getCardId()); + Long cardId = 1L; + ReflectionTestUtils.setField(cmd, "cardId", cardId); + assertEquals(cardId, cmd.getCardId()); + } + + @Test + public void getMaxVgpuPerPgpu() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getMaxVgpuPerPgpu()); + Long maxVgpuPerPgpu = 8L; + ReflectionTestUtils.setField(cmd, "maxVgpuPerPgpu", maxVgpuPerPgpu); + assertEquals(maxVgpuPerPgpu, cmd.getMaxVgpuPerPgpu()); + } + + @Test + public void getVideoRam() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getVideoRam()); + Long videoRam = 8192L; // 8 GB + ReflectionTestUtils.setField(cmd, "videoRam", videoRam); + assertEquals(videoRam, cmd.getVideoRam()); + } + + @Test + public void getMaxHeads() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getMaxHeads()); + Long maxHeads = 2L; + ReflectionTestUtils.setField(cmd, "maxHeads", maxHeads); + assertEquals(maxHeads, cmd.getMaxHeads()); + } + + @Test + public void getMaxResolutionX() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getMaxResolutionX()); + Long maxResolutionX = 1920L; // 1920 pixels + ReflectionTestUtils.setField(cmd, "maxResolutionX", maxResolutionX); + assertEquals(maxResolutionX, cmd.getMaxResolutionX()); + } + + @Test + public void getMaxResolutionY() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertNull(cmd.getMaxResolutionY()); + Long maxResolutionY = 1080L; // 1080 pixels + ReflectionTestUtils.setField(cmd, "maxResolutionY", maxResolutionY); + assertEquals(maxResolutionY, cmd.getMaxResolutionY()); + } + + @Test + public void getEntityOwnerId() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmdTest.java new file mode 100644 index 000000000000..21df915b4209 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuCardCmdTest.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class DeleteGpuCardCmdTest { + + @Test + public void getId() { + DeleteGpuCardCmd cmd = new DeleteGpuCardCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getEntityOwnerId() { + CreateVgpuProfileCmd cmd = new CreateVgpuProfileCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmdTest.java new file mode 100644 index 000000000000..02b04dd307a8 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteGpuDeviceCmdTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class DeleteGpuDeviceCmdTest { + + @Test + public void getIds() { + DeleteGpuDeviceCmd cmd = new DeleteGpuDeviceCmd(); + assertNull(cmd.getIds()); + List ids = List.of(1L, 2L, 3L); + ReflectionTestUtils.setField(cmd, "ids", ids); + assertEquals(ids, cmd.getIds()); + } + + @Test + public void getEntityOwnerId() { + DeleteGpuDeviceCmd cmd = new DeleteGpuDeviceCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmdTest.java new file mode 100644 index 000000000000..ecd43810e65c --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DeleteVgpuProfileCmdTest.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class DeleteVgpuProfileCmdTest { + + @Test + public void getId() { + DeleteVgpuProfileCmd cmd = new DeleteVgpuProfileCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getEntityOwnerId() { + DeleteVgpuProfileCmd cmd = new DeleteVgpuProfileCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmdTest.java new file mode 100644 index 000000000000..8295e06e0d55 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/DiscoverGpuDevicesCmdTest.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class DiscoverGpuDevicesCmdTest { + + @Test + public void getId() { + DiscoverGpuDevicesCmd cmd = new DiscoverGpuDevicesCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdminTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdminTest.java new file mode 100644 index 000000000000..200bce769336 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ListGpuDevicesCmdByAdminTest.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ListGpuDevicesCmdByAdminTest { + + @Test + public void getId() { + ListGpuDevicesCmdByAdmin cmd = new ListGpuDevicesCmdByAdmin(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getHostId() { + ListGpuDevicesCmdByAdmin cmd = new ListGpuDevicesCmdByAdmin(); + assertNull(cmd.getHostId()); + Long hostId = 1L; + ReflectionTestUtils.setField(cmd, "hostId", hostId); + assertEquals(hostId, cmd.getHostId()); + } + + @Test + public void getGpuCardId() { + ListGpuDevicesCmdByAdmin cmd = new ListGpuDevicesCmdByAdmin(); + assertNull(cmd.getGpuCardId()); + Long gpuCardId = 1L; + ReflectionTestUtils.setField(cmd, "gpuCardId", gpuCardId); + assertEquals(gpuCardId, cmd.getGpuCardId()); + } + + @Test + public void getVgpuProfileId() { + ListGpuDevicesCmdByAdmin cmd = new ListGpuDevicesCmdByAdmin(); + assertNull(cmd.getVgpuProfileId()); + Long vgpuProfileId = 1L; + ReflectionTestUtils.setField(cmd, "vgpuProfileId", vgpuProfileId); + assertEquals(vgpuProfileId, cmd.getVgpuProfileId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmdTest.java new file mode 100644 index 000000000000..ee862409a939 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/ManageGpuDeviceCmdTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ManageGpuDeviceCmdTest { + + @Test + public void getIds() { + ManageGpuDeviceCmd cmd = new ManageGpuDeviceCmd(); + assertNull(cmd.getIds()); + List ids = List.of(1L, 2L, 3L); + ReflectionTestUtils.setField(cmd, "ids", ids); + assertEquals(ids, cmd.getIds()); + } + + @Test + public void getEntityOwnerId() { + ManageGpuDeviceCmd cmd = new ManageGpuDeviceCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmdTest.java new file mode 100644 index 000000000000..63700d9e908d --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UnmanageGpuDeviceCmdTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class UnmanageGpuDeviceCmdTest { + + @Test + public void getIds() { + UnmanageGpuDeviceCmd cmd = new UnmanageGpuDeviceCmd(); + assertNull(cmd.getIds()); + List ids = List.of(1L, 2L, 3L); + ReflectionTestUtils.setField(cmd, "ids", ids); + assertEquals(ids, cmd.getIds()); + } + + @Test + public void getEntityOwnerId() { + UnmanageGpuDeviceCmd cmd = new UnmanageGpuDeviceCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmdTest.java new file mode 100644 index 000000000000..ead7ab9d3d30 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuCardCmdTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class UpdateGpuCardCmdTest { + + @Test + public void getId() { + UpdateGpuCardCmd cmd = new UpdateGpuCardCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getDeviceName() { + UpdateGpuCardCmd cmd = new UpdateGpuCardCmd(); + assertNull(cmd.getDeviceName()); + String deviceName = "GPU-1234"; + ReflectionTestUtils.setField(cmd, "deviceName", deviceName); + assertEquals(deviceName, cmd.getDeviceName()); + } + + @Test + public void getName() { + UpdateGpuCardCmd cmd = new UpdateGpuCardCmd(); + assertNull(cmd.getName()); + String name = "Test GPU Card"; + ReflectionTestUtils.setField(cmd, "name", name); + assertEquals(name, cmd.getName()); + } + + @Test + public void getVendorName() { + UpdateGpuCardCmd cmd = new UpdateGpuCardCmd(); + assertNull(cmd.getVendorName()); + String vendorName = "NVIDIA"; + ReflectionTestUtils.setField(cmd, "vendorName", vendorName); + assertEquals(vendorName, cmd.getVendorName()); + } + + @Test + public void getEntityOwnerId() { + UpdateGpuCardCmd cmd = new UpdateGpuCardCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmdTest.java new file mode 100644 index 000000000000..6ebec48aa003 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateGpuDeviceCmdTest.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.apache.cloudstack.gpu.GpuDevice; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class UpdateGpuDeviceCmdTest { + + @Test + public void getId() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getGpuCardId() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getGpuCardId()); + Long gpuCardId = 1L; + ReflectionTestUtils.setField(cmd, "gpuCardId", gpuCardId); + assertEquals(gpuCardId, cmd.getGpuCardId()); + } + + @Test + public void getVgpuProfileId() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getVgpuProfileId()); + Long vgpuProfileId = 1L; + ReflectionTestUtils.setField(cmd, "vgpuProfileId", vgpuProfileId); + assertEquals(vgpuProfileId, cmd.getVgpuProfileId()); + } + + @Test + public void getType() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getType()); + String type = "MDEV"; + ReflectionTestUtils.setField(cmd, "type", type); + assertEquals(GpuDevice.DeviceType.MDEV, cmd.getType()); + } + + @Test + public void getParentGpuDeviceId() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getParentGpuDeviceId()); + Long parentGpuDeviceId = 1L; + ReflectionTestUtils.setField(cmd, "parentGpuDeviceId", parentGpuDeviceId); + assertEquals(parentGpuDeviceId, cmd.getParentGpuDeviceId()); + } + + @Test + public void getNumaNode() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertNull(cmd.getNumaNode()); + String numaNode = "0"; + ReflectionTestUtils.setField(cmd, "numaNode", numaNode); + assertEquals(numaNode, cmd.getNumaNode()); + } + + @Test + public void getEntityOwnerId() { + UpdateGpuDeviceCmd cmd = new UpdateGpuDeviceCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmdTest.java new file mode 100644 index 000000000000..95acd71096e9 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/gpu/UpdateVgpuProfileCmdTest.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.gpu; + +import com.cloud.user.Account; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class UpdateVgpuProfileCmdTest { + + @Test + public void getId() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + assertEquals(id, cmd.getId()); + } + + @Test + public void getProfileName() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getProfileName()); + String profileName = "Test VGPU Profile"; + ReflectionTestUtils.setField(cmd, "profileName", profileName); + assertEquals(profileName, cmd.getProfileName()); + } + + @Test + public void getDescription() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getDescription()); + String description = "Test VGPU Profile Description"; + ReflectionTestUtils.setField(cmd, "description", description); + assertEquals(description, cmd.getDescription()); + } + + @Test + public void getMaxVgpuPerPgpu() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getMaxVgpuPerPgpu()); + Long maxVgpuPerPgpu = 8L; + ReflectionTestUtils.setField(cmd, "maxVgpuPerPgpu", maxVgpuPerPgpu); + assertEquals(maxVgpuPerPgpu, cmd.getMaxVgpuPerPgpu()); + } + + @Test + public void getVideoRam() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getVideoRam()); + Long videoRam = 8192L; // 8 GB + ReflectionTestUtils.setField(cmd, "videoRam", videoRam); + assertEquals(videoRam, cmd.getVideoRam()); + } + + @Test + public void getMaxHeads() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getMaxHeads()); + Long maxHeads = 2L; + ReflectionTestUtils.setField(cmd, "maxHeads", maxHeads); + assertEquals(maxHeads, cmd.getMaxHeads()); + } + + @Test + public void getMaxResolutionX() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getMaxResolutionX()); + Long maxResolutionX = 1920L; // Example resolution + ReflectionTestUtils.setField(cmd, "maxResolutionX", maxResolutionX); + assertEquals(maxResolutionX, cmd.getMaxResolutionX()); + } + + @Test + public void getMaxResolutionY() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertNull(cmd.getMaxResolutionY()); + Long maxResolutionY = 1080L; // Example resolution + ReflectionTestUtils.setField(cmd, "maxResolutionY", maxResolutionY); + assertEquals(maxResolutionY, cmd.getMaxResolutionY()); + } + + @Test + public void getEntityOwnerId() { + UpdateVgpuProfileCmd cmd = new UpdateVgpuProfileCmd(); + assertEquals(Account.ACCOUNT_ID_SYSTEM, cmd.getEntityOwnerId()); + } +} diff --git a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/StorageTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmdTest.java similarity index 55% rename from framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/StorageTest.java rename to api/src/test/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmdTest.java index f36d5c49581d..32230056b6aa 100644 --- a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/StorageTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/AddGuestOsCategoryCmdTest.java @@ -14,28 +14,33 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -package org.apache.cloudstack.quota.activationrule.presetvariables; +package org.apache.cloudstack.api.command.admin.guest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; @RunWith(MockitoJUnitRunner.class) -public class StorageTest { +public class AddGuestOsCategoryCmdTest { @Test - public void setTagsTestAddFieldTagsToCollection() { - Storage variable = new Storage(); - variable.setTags(null); - Assert.assertTrue(variable.fieldNamesToIncludeInToString.contains("tags")); + public void testGetArch() { + AddGuestOsCategoryCmd cmd = new AddGuestOsCategoryCmd(); + Assert.assertNull(cmd.getName()); + String name = "Name"; + ReflectionTestUtils.setField(cmd, "name", name); + Assert.assertEquals(name, cmd.getName()); } @Test - public void setScopeTestAddFieldScopeToCollection() { - Storage variable = new Storage(); - variable.setScope(null);; - Assert.assertTrue(variable.fieldNamesToIncludeInToString.contains("scope")); + public void testIsFeatured() { + AddGuestOsCategoryCmd cmd = new AddGuestOsCategoryCmd(); + Assert.assertFalse(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", false); + Assert.assertFalse(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", true); + Assert.assertTrue(cmd.isFeatured()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmdTest.java new file mode 100644 index 000000000000..3f6a943b3fe9 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCategoryCmdTest.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.guest; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +@RunWith(MockitoJUnitRunner.class) +public class UpdateGuestOsCategoryCmdTest { + + @Test + public void testGetArch() { + UpdateGuestOsCategoryCmd cmd = new UpdateGuestOsCategoryCmd(); + Assert.assertNull(cmd.getName()); + String name = "Name"; + ReflectionTestUtils.setField(cmd, "name", name); + Assert.assertEquals(name, cmd.getName()); + } + + @Test + public void testIsFeatured() { + UpdateGuestOsCategoryCmd cmd = new UpdateGuestOsCategoryCmd(); + Assert.assertNull(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", false); + Assert.assertFalse(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", true); + Assert.assertTrue(cmd.isFeatured()); + } + + @Test + public void testGetSortKey() { + UpdateGuestOsCategoryCmd cmd = new UpdateGuestOsCategoryCmd(); + Assert.assertNull(cmd.getSortKey()); + Integer sortKey = 100; + ReflectionTestUtils.setField(cmd, "sortKey", sortKey); + Assert.assertEquals(sortKey, cmd.getSortKey()); + } +} diff --git a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/DomainTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmdTest.java similarity index 68% rename from framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/DomainTest.java rename to api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmdTest.java index f245b4637e6a..f03a791776ed 100644 --- a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/DomainTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/guest/UpdateGuestOsCmdTest.java @@ -14,22 +14,24 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -package org.apache.cloudstack.quota.activationrule.presetvariables; +package org.apache.cloudstack.api.command.admin.guest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; @RunWith(MockitoJUnitRunner.class) -public class DomainTest { +public class UpdateGuestOsCmdTest { + @Test - public void setPathTestAddFieldPathToCollection() { - Domain variable = new Domain(); - variable.setPath("test path"); - Assert.assertTrue(variable.fieldNamesToIncludeInToString.contains("path")); + public void testGetZoneId() { + UpdateGuestOsCmd cmd = new UpdateGuestOsCmd(); + Assert.assertNull(cmd.getOsCategoryId()); + Long osCategoryId = 100L; + ReflectionTestUtils.setField(cmd, "osCategoryId", osCategoryId); + Assert.assertEquals(osCategoryId, cmd.getOsCategoryId()); } - } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmdTest.java new file mode 100644 index 000000000000..096395b1359e --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CloneNetworkOfferingCmdTest.java @@ -0,0 +1,324 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.network; + +import com.cloud.offering.NetworkOffering; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NetworkOfferingResponse; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class CloneNetworkOfferingCmdTest { + + private CloneNetworkOfferingCmd cloneNetworkOfferingCmd; + + @Mock + private com.cloud.configuration.ConfigurationService configService; + + @Mock + private ResponseGenerator responseGenerator; + + @Mock + private NetworkOffering mockNetworkOffering; + + @Mock + private NetworkOfferingResponse mockNetworkOfferingResponse; + + @Before + public void setUp() { + cloneNetworkOfferingCmd = new CloneNetworkOfferingCmd(); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "_configService", configService); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "_responseGenerator", responseGenerator); + } + + @Test + public void testGetSourceOfferingId() { + Long sourceOfferingId = 123L; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "sourceOfferingId", sourceOfferingId); + assertEquals(sourceOfferingId, cloneNetworkOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testGetAddServices() { + List addServices = Arrays.asList("Dhcp", "Dns"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "addServices", addServices); + assertEquals(addServices, cloneNetworkOfferingCmd.getAddServices()); + } + + @Test + public void testGetDropServices() { + List dropServices = Arrays.asList("Firewall", "Vpn"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "dropServices", dropServices); + assertEquals(dropServices, cloneNetworkOfferingCmd.getDropServices()); + } + + @Test + public void testGetGuestIpType() { + String guestIpType = "Isolated"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "guestIptype", guestIpType); + assertEquals(guestIpType, cloneNetworkOfferingCmd.getGuestIpType()); + } + + @Test + public void testGetTraffictype() { + String trafficType = "GUEST"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "traffictype", trafficType); + assertEquals(trafficType, cloneNetworkOfferingCmd.getTraffictype()); + } + + @Test + public void testGetName() { + String name = "ClonedNetworkOffering"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "networkOfferingName", name); + assertEquals(name, cloneNetworkOfferingCmd.getNetworkOfferingName()); + } + + @Test + public void testGetDisplayText() { + String displayText = "Cloned Network Offering Display Text"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "displayText", displayText); + assertEquals(displayText, cloneNetworkOfferingCmd.getDisplayText()); + } + + @Test + public void testGetDisplayTextDefaultsToName() { + String name = "ClonedNetworkOffering"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "networkOfferingName", name); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "displayText", null); + assertEquals(name, cloneNetworkOfferingCmd.getDisplayText()); + } + + @Test + public void testGetAvailability() { + String availability = "Required"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "availability", availability); + assertEquals(availability, cloneNetworkOfferingCmd.getAvailability()); + } + + @Test + public void testGetTags() { + String tags = "tag1,tag2,tag3"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "tags", tags); + assertEquals(tags, cloneNetworkOfferingCmd.getTags()); + } + + @Test + public void testExecuteSuccess() { + Long sourceOfferingId = 123L; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneNetworkOffering(any(CloneNetworkOfferingCmd.class))).thenReturn(mockNetworkOffering); + when(responseGenerator.createNetworkOfferingResponse(mockNetworkOffering)).thenReturn(mockNetworkOfferingResponse); + + cloneNetworkOfferingCmd.execute(); + + assertNotNull(cloneNetworkOfferingCmd.getResponseObject()); + assertEquals(mockNetworkOfferingResponse, cloneNetworkOfferingCmd.getResponseObject()); + } + + @Test(expected = ServerApiException.class) + public void testExecuteFailure() { + Long sourceOfferingId = 123L; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneNetworkOffering(any(CloneNetworkOfferingCmd.class))).thenReturn(null); + + try { + cloneNetworkOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Failed to clone network offering", e.getMessage()); + throw e; + } + } + + @Test + public void testGetConserveMode() { + Boolean conserveMode = true; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "conserveMode", conserveMode); + assertEquals(conserveMode, cloneNetworkOfferingCmd.getConserveMode()); + } + + @Test + public void testGetSpecifyVlan() { + Boolean specifyVlan = false; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "specifyVlan", specifyVlan); + assertEquals(specifyVlan, cloneNetworkOfferingCmd.getSpecifyVlan()); + } + + @Test + public void testGetSpecifyIpRanges() { + Boolean specifyIpRanges = true; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "specifyIpRanges", specifyIpRanges); + assertEquals(specifyIpRanges, cloneNetworkOfferingCmd.getSpecifyIpRanges()); + } + + @Test + public void testGetIsPersistent() { + Boolean isPersistent = true; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "isPersistent", isPersistent); + assertEquals(isPersistent, cloneNetworkOfferingCmd.getIsPersistent()); + } + + @Test + public void testGetEgressDefaultPolicy() { + Boolean egressDefaultPolicy = false; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "egressDefaultPolicy", egressDefaultPolicy); + assertEquals(egressDefaultPolicy, cloneNetworkOfferingCmd.getEgressDefaultPolicy()); + } + + @Test + public void testGetServiceOfferingId() { + Long serviceOfferingId = 456L; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "serviceOfferingId", serviceOfferingId); + assertEquals(serviceOfferingId, cloneNetworkOfferingCmd.getServiceOfferingId()); + } + + @Test + public void testGetForVpc() { + Boolean forVpc = true; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "forVpc", forVpc); + assertEquals(forVpc, cloneNetworkOfferingCmd.getForVpc()); + } + + @Test + public void testGetMaxConnections() { + Integer maxConnections = 1000; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "maxConnections", maxConnections); + assertEquals(maxConnections, cloneNetworkOfferingCmd.getMaxconnections()); + } + + @Test + public void testGetNetworkRate() { + Integer networkRate = 200; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "networkRate", networkRate); + assertEquals(networkRate, cloneNetworkOfferingCmd.getNetworkRate()); + } + + @Test + public void testGetInternetProtocol() { + String internetProtocol = "ipv4"; + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "internetProtocol", internetProtocol); + assertEquals(internetProtocol, cloneNetworkOfferingCmd.getInternetProtocol()); + } + + @Test + public void testAddServicesNullByDefault() { + assertNull(cloneNetworkOfferingCmd.getAddServices()); + } + + @Test + public void testDropServicesNullByDefault() { + assertNull(cloneNetworkOfferingCmd.getDropServices()); + } + + @Test + public void testSupportedServicesParameter() { + List supportedServices = Arrays.asList("Dhcp", "Dns", "SourceNat"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "supportedServices", supportedServices); + assertEquals(supportedServices, cloneNetworkOfferingCmd.getSupportedServices()); + } + + @Test + public void testServiceProviderListParameter() { + Map> serviceProviderList = new HashMap<>(); + + HashMap dhcpProvider = new HashMap<>(); + dhcpProvider.put("service", "Dhcp"); + dhcpProvider.put("provider", "VirtualRouter"); + + HashMap dnsProvider = new HashMap<>(); + dnsProvider.put("service", "Dns"); + dnsProvider.put("provider", "VirtualRouter"); + + serviceProviderList.put("0", dhcpProvider); + serviceProviderList.put("1", dnsProvider); + + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "serviceProviderList", serviceProviderList); + + Map> result = cloneNetworkOfferingCmd.getServiceProviders(); + assertNotNull(result); + assertEquals(2, result.size()); + assertNotNull(result.get("Dhcp")); + assertNotNull(result.get("Dns")); + assertEquals("VirtualRouter", result.get("Dhcp").get(0)); + assertEquals("VirtualRouter", result.get("Dns").get(0)); + } + + @Test + public void testCloneWithAllParameters() { + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "sourceOfferingId", 123L); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "networkOfferingName", "ClonedOffering"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "displayText", "Cloned Offering Display"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "availability", "Optional"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "guestIptype", "Isolated"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "traffictype", "GUEST"); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "conserveMode", true); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "specifyVlan", false); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "isPersistent", true); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "egressDefaultPolicy", false); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "networkRate", 200); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "serviceOfferingId", 456L); + + assertEquals(Long.valueOf(123L), cloneNetworkOfferingCmd.getSourceOfferingId()); + assertEquals("ClonedOffering", cloneNetworkOfferingCmd.getNetworkOfferingName()); + assertEquals("Cloned Offering Display", cloneNetworkOfferingCmd.getDisplayText()); + assertEquals("Optional", cloneNetworkOfferingCmd.getAvailability()); + assertEquals("Isolated", cloneNetworkOfferingCmd.getGuestIpType()); + assertEquals("GUEST", cloneNetworkOfferingCmd.getTraffictype()); + assertEquals(Boolean.TRUE, cloneNetworkOfferingCmd.getConserveMode()); + assertEquals(Boolean.FALSE, cloneNetworkOfferingCmd.getSpecifyVlan()); + assertEquals(Boolean.TRUE, cloneNetworkOfferingCmd.getIsPersistent()); + assertEquals(Boolean.FALSE, cloneNetworkOfferingCmd.getEgressDefaultPolicy()); + assertEquals(Integer.valueOf(200), cloneNetworkOfferingCmd.getNetworkRate()); + assertEquals(Long.valueOf(456L), cloneNetworkOfferingCmd.getServiceOfferingId()); + } + + @Test + public void testCloneWithAddAndDropServices() { + List addServices = Arrays.asList("StaticNat", "PortForwarding"); + List dropServices = Arrays.asList("Vpn"); + + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "sourceOfferingId", 123L); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "addServices", addServices); + ReflectionTestUtils.setField(cloneNetworkOfferingCmd, "dropServices", dropServices); + + assertEquals(addServices, cloneNetworkOfferingCmd.getAddServices()); + assertEquals(dropServices, cloneNetworkOfferingCmd.getDropServices()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmdTest.java index e1393e316993..38d0df2e8b82 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForGuestNetworkCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.Ipv4SubnetForGuestNetworkResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.Ipv4GuestSubnetNetworkMap; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -29,6 +30,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class CreateIpv4SubnetForGuestNetworkCmdTest { @@ -37,6 +40,7 @@ public class CreateIpv4SubnetForGuestNetworkCmdTest { @Test public void testCreateIpv4SubnetForGuestNetworkCmd() { Long parentId = 1L; + String parentUuid = UUID.randomUUID().toString(); String subnet = "192.168.1.0/24"; Integer cidrSize = 26; @@ -46,12 +50,14 @@ public void testCreateIpv4SubnetForGuestNetworkCmd() { ReflectionTestUtils.setField(cmd, "cidrSize", cidrSize); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("parentid", parentUuid); + Assert.assertEquals(parentId, cmd.getParentId()); Assert.assertEquals(subnet, cmd.getSubnet()); Assert.assertEquals(cidrSize, cmd.getCidrSize()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_IP4_GUEST_SUBNET_CREATE, cmd.getEventType()); - Assert.assertEquals(String.format("Creating guest IPv4 subnet %s in zone subnet=%s", subnet, parentId), cmd.getEventDescription()); + Assert.assertEquals(String.format("Creating guest IPv4 subnet %s in zone subnet: %s", subnet, parentUuid), cmd.getEventDescription()); Ipv4GuestSubnetNetworkMap ipv4GuestSubnetNetworkMap = Mockito.mock(Ipv4GuestSubnetNetworkMap.class); Mockito.when(routedIpv4Manager.createIpv4SubnetForGuestNetwork(cmd)).thenReturn(ipv4GuestSubnetNetworkMap); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmdTest.java index 51c1eb986c47..560ecdc3b296 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/CreateIpv4SubnetForZoneCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.DataCenterIpv4SubnetResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -29,6 +30,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class CreateIpv4SubnetForZoneCmdTest { @@ -37,6 +40,7 @@ public class CreateIpv4SubnetForZoneCmdTest { @Test public void testCreateIpv4SubnetForZoneCmd() { Long zoneId = 1L; + String zoneUuid = UUID.randomUUID().toString(); String subnet = "192.168.1.0/24"; String accountName = "user"; Long projectId = 10L; @@ -50,6 +54,8 @@ public void testCreateIpv4SubnetForZoneCmd() { ReflectionTestUtils.setField(cmd,"domainId", domainId); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("zoneid", zoneUuid); + Assert.assertEquals(zoneId, cmd.getZoneId()); Assert.assertEquals(subnet, cmd.getSubnet()); Assert.assertEquals(accountName, cmd.getAccountName()); @@ -57,7 +63,7 @@ public void testCreateIpv4SubnetForZoneCmd() { Assert.assertEquals(domainId, cmd.getDomainId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_ZONE_IP4_SUBNET_CREATE, cmd.getEventType()); - Assert.assertEquals(String.format("Creating guest IPv4 subnet %s for zone=%s", subnet, zoneId), cmd.getEventDescription()); + Assert.assertEquals(String.format("Creating guest IPv4 subnet %s for zone: %s", subnet, zoneUuid), cmd.getEventDescription()); DataCenterIpv4GuestSubnet zoneSubnet = Mockito.mock(DataCenterIpv4GuestSubnet.class); Mockito.when(routedIpv4Manager.createDataCenterIpv4GuestSubnet(cmd)).thenReturn(zoneSubnet); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmdTest.java index 7db77098b233..4640510ccdab 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DedicateIpv4SubnetForZoneCmdTest.java @@ -19,6 +19,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.DataCenterIpv4SubnetResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class DedicateIpv4SubnetForZoneCmdTest { @@ -36,6 +39,7 @@ public class DedicateIpv4SubnetForZoneCmdTest { @Test public void testDedicateIpv4SubnetForZoneCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); String accountName = "user"; Long projectId = 10L; Long domainId = 11L; @@ -47,6 +51,8 @@ public void testDedicateIpv4SubnetForZoneCmd() { ReflectionTestUtils.setField(cmd,"domainId", domainId); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(accountName, cmd.getAccountName()); Assert.assertEquals(projectId, cmd.getProjectId()); @@ -54,7 +60,7 @@ public void testDedicateIpv4SubnetForZoneCmd() { Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_ZONE_IP4_SUBNET_DEDICATE, cmd.getEventType()); - Assert.assertEquals(String.format("Dedicating zone IPv4 subnet %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Dedicating zone's IPv4 subnet with ID: %s", uuid), cmd.getEventDescription()); DataCenterIpv4GuestSubnet zoneSubnet = Mockito.mock(DataCenterIpv4GuestSubnet.class); Mockito.when(routedIpv4Manager.dedicateDataCenterIpv4GuestSubnet(cmd)).thenReturn(zoneSubnet); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmdTest.java index a4af5ddf748f..cd25d8d24014 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForGuestNetworkCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class DeleteIpv4SubnetForGuestNetworkCmdTest { @@ -36,15 +39,18 @@ public class DeleteIpv4SubnetForGuestNetworkCmdTest { @Test public void testDeleteIpv4SubnetForGuestNetworkCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); DeleteIpv4SubnetForGuestNetworkCmd cmd = new DeleteIpv4SubnetForGuestNetworkCmd(); ReflectionTestUtils.setField(cmd, "id", id); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_IP4_GUEST_SUBNET_DELETE, cmd.getEventType()); - Assert.assertEquals(String.format("Deleting guest IPv4 subnet %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Deleting guest IPv4 subnet with ID: %s", uuid), cmd.getEventDescription()); Mockito.when(routedIpv4Manager.deleteIpv4SubnetForGuestNetwork(cmd)).thenReturn(true); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmdTest.java index 7af173f09d96..269fb3f3c192 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/DeleteIpv4SubnetForZoneCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class DeleteIpv4SubnetForZoneCmdTest { @@ -36,15 +39,18 @@ public class DeleteIpv4SubnetForZoneCmdTest { @Test public void testDeleteIpv4SubnetForZoneCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); DeleteIpv4SubnetForZoneCmd cmd = new DeleteIpv4SubnetForZoneCmd(); ReflectionTestUtils.setField(cmd, "id", id); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_ZONE_IP4_SUBNET_DELETE, cmd.getEventType()); - Assert.assertEquals(String.format("Deleting zone IPv4 subnet %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Deleting zone IPv4 subnet with ID: %s", uuid), cmd.getEventDescription()); Mockito.when(routedIpv4Manager.deleteDataCenterIpv4GuestSubnet(cmd)).thenReturn(true); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmdTest.java index 9ce9a4f9464f..6e5d2a95f3ab 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/ReleaseDedicatedIpv4SubnetForZoneCmdTest.java @@ -19,6 +19,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.DataCenterIpv4SubnetResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class ReleaseDedicatedIpv4SubnetForZoneCmdTest { @@ -36,15 +39,18 @@ public class ReleaseDedicatedIpv4SubnetForZoneCmdTest { @Test public void testReleaseDedicatedIpv4SubnetForZoneCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); ReleaseDedicatedIpv4SubnetForZoneCmd cmd = new ReleaseDedicatedIpv4SubnetForZoneCmd(); ReflectionTestUtils.setField(cmd, "id", id); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_ZONE_IP4_SUBNET_RELEASE, cmd.getEventType()); - Assert.assertEquals(String.format("Releasing a dedicated zone IPv4 subnet %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Releasing dedicated zone IPv4 subnet with ID: %s", uuid), cmd.getEventDescription()); DataCenterIpv4GuestSubnet zoneSubnet = Mockito.mock(DataCenterIpv4GuestSubnet.class); Mockito.when(routedIpv4Manager.releaseDedicatedDataCenterIpv4GuestSubnet(cmd)).thenReturn(zoneSubnet); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmdTest.java index cdb9cce22d83..af37006eafd2 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/UpdateIpv4SubnetForZoneCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.DataCenterIpv4SubnetResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -29,6 +30,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class UpdateIpv4SubnetForZoneCmdTest { @@ -37,6 +40,7 @@ public class UpdateIpv4SubnetForZoneCmdTest { @Test public void testUpdateIpv4SubnetForZoneCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); String subnet = "192.168.1.0/24"; UpdateIpv4SubnetForZoneCmd cmd = new UpdateIpv4SubnetForZoneCmd(); @@ -44,11 +48,13 @@ public void testUpdateIpv4SubnetForZoneCmd() { ReflectionTestUtils.setField(cmd, "subnet", subnet); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(subnet, cmd.getSubnet()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_ZONE_IP4_SUBNET_UPDATE, cmd.getEventType()); - Assert.assertEquals(String.format("Updating zone IPv4 subnet %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Updating zone IPv4 subnet with ID: %s", uuid), cmd.getEventDescription()); DataCenterIpv4GuestSubnet zoneSubnet = Mockito.mock(DataCenterIpv4GuestSubnet.class); Mockito.when(routedIpv4Manager.updateDataCenterIpv4GuestSubnet(cmd)).thenReturn(zoneSubnet); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmdTest.java index 28ddad17afe5..3db1fab466f6 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForNetworkCmdTest.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -33,6 +34,7 @@ import java.util.Arrays; import java.util.List; +import java.util.UUID; @RunWith(MockitoJUnitRunner.class) public class ChangeBgpPeersForNetworkCmdTest { @@ -44,6 +46,7 @@ public class ChangeBgpPeersForNetworkCmdTest { @Test public void testChangeBgpPeersForNetworkCmd() { Long networkId = 10L; + String networkUuid = UUID.randomUUID().toString(); List bgpPeerIds = Arrays.asList(20L, 21L); ChangeBgpPeersForNetworkCmd cmd = new ChangeBgpPeersForNetworkCmd(); @@ -52,11 +55,13 @@ public void testChangeBgpPeersForNetworkCmd() { ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); ReflectionTestUtils.setField(cmd,"_responseGenerator", _responseGenerator); + CallContext.current().putApiResourceUuid("networkid", networkUuid); + Assert.assertEquals(networkId, cmd.getNetworkId()); Assert.assertEquals(bgpPeerIds, cmd.getBgpPeerIds()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_NETWORK_BGP_PEER_UPDATE, cmd.getEventType()); - Assert.assertEquals(String.format("Changing Bgp Peers for network %s", networkId), cmd.getEventDescription()); + Assert.assertEquals(String.format("Changing BGP Peers for Network with ID: %s", networkUuid), cmd.getEventDescription()); Network network = Mockito.mock(Network.class); Mockito.when(routedIpv4Manager.changeBgpPeersForNetwork(cmd)).thenReturn(network); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmdTest.java index 96eb1f020de2..fb85f7060684 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ChangeBgpPeersForVpcCmdTest.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -33,6 +34,7 @@ import java.util.Arrays; import java.util.List; +import java.util.UUID; @RunWith(MockitoJUnitRunner.class) public class ChangeBgpPeersForVpcCmdTest { @@ -44,6 +46,7 @@ public class ChangeBgpPeersForVpcCmdTest { @Test public void testChangeBgpPeersForVpcCmd() { Long VpcId = 10L; + String vpcUuid = UUID.randomUUID().toString(); List bgpPeerIds = Arrays.asList(20L, 21L); ChangeBgpPeersForVpcCmd cmd = new ChangeBgpPeersForVpcCmd(); @@ -52,11 +55,13 @@ public void testChangeBgpPeersForVpcCmd() { ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); ReflectionTestUtils.setField(cmd,"_responseGenerator", _responseGenerator); + CallContext.current().putApiResourceUuid("vpcid", vpcUuid); + Assert.assertEquals(VpcId, cmd.getVpcId()); Assert.assertEquals(bgpPeerIds, cmd.getBgpPeerIds()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_VPC_BGP_PEER_UPDATE, cmd.getEventType()); - Assert.assertEquals(String.format("Changing Bgp Peers for VPC %s", VpcId), cmd.getEventDescription()); + Assert.assertEquals(String.format("Changing BGP Peers for VPC with ID: %s", vpcUuid), cmd.getEventDescription()); Vpc Vpc = Mockito.mock(Vpc.class); Mockito.when(routedIpv4Manager.changeBgpPeersForVpc(cmd)).thenReturn(Vpc); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmdTest.java index 0d802bf36199..3abc5f57d017 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/CreateBgpPeerCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.BgpPeerResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.BgpPeer; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -29,6 +30,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class CreateBgpPeerCmdTest { @@ -37,6 +40,7 @@ public class CreateBgpPeerCmdTest { @Test public void testCreateBgpPeerCmd() { Long zoneId = 1L; + String zoneUuid = UUID.randomUUID().toString(); String accountName = "user"; Long projectId = 10L; Long domainId = 11L; @@ -56,6 +60,8 @@ public void testCreateBgpPeerCmd() { ReflectionTestUtils.setField(cmd,"domainId", domainId); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("zoneid", zoneUuid); + Assert.assertEquals(zoneId, cmd.getZoneId()); Assert.assertEquals(ip4Address, cmd.getIp4Address()); Assert.assertEquals(ip6Address, cmd.getIp6Address()); @@ -67,7 +73,7 @@ public void testCreateBgpPeerCmd() { Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_BGP_PEER_CREATE, cmd.getEventType()); - Assert.assertEquals(String.format("Creating Bgp Peer %s for zone=%s", peerAsNumber, zoneId), cmd.getEventDescription()); + Assert.assertEquals(String.format("Creating BGP Peer %s for zone with ID: %s", peerAsNumber, zoneUuid), cmd.getEventDescription()); BgpPeer bgpPeer = Mockito.mock(BgpPeer.class); Mockito.when(routedIpv4Manager.createBgpPeer(cmd)).thenReturn(bgpPeer); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmdTest.java index f3ae007da285..c5edb1b8f53f 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DedicateBgpPeerCmdTest.java @@ -19,6 +19,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.BgpPeerResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.BgpPeer; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class DedicateBgpPeerCmdTest { @@ -36,6 +39,7 @@ public class DedicateBgpPeerCmdTest { @Test public void testDedicateBgpPeerCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); String accountName = "user"; Long projectId = 10L; Long domainId = 11L; @@ -47,6 +51,8 @@ public void testDedicateBgpPeerCmd() { ReflectionTestUtils.setField(cmd,"domainId", domainId); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(accountName, cmd.getAccountName()); Assert.assertEquals(projectId, cmd.getProjectId()); @@ -54,7 +60,7 @@ public void testDedicateBgpPeerCmd() { Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_BGP_PEER_DEDICATE, cmd.getEventType()); - Assert.assertEquals(String.format("Dedicating Bgp Peer %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Dedicating BGP Peer with ID: %s", uuid), cmd.getEventDescription()); BgpPeer bgpPeer = Mockito.mock(BgpPeer.class); Mockito.when(routedIpv4Manager.dedicateBgpPeer(cmd)).thenReturn(bgpPeer); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmdTest.java index 5e747188fda3..5228a63dc92d 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/DeleteBgpPeerCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class DeleteBgpPeerCmdTest { @@ -36,15 +39,18 @@ public class DeleteBgpPeerCmdTest { @Test public void testDeleteBgpPeerCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); DeleteBgpPeerCmd cmd = new DeleteBgpPeerCmd(); ReflectionTestUtils.setField(cmd, "id", id); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_BGP_PEER_DELETE, cmd.getEventType()); - Assert.assertEquals(String.format("Deleting Bgp Peer %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Deleting BGP Peer with ID: %s", uuid), cmd.getEventDescription()); Mockito.when(routedIpv4Manager.deleteBgpPeer(cmd)).thenReturn(true); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmdTest.java index 8c55c4a73479..60a814d63050 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/ReleaseDedicatedBgpPeerCmdTest.java @@ -19,6 +19,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.BgpPeerResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.BgpPeer; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -28,6 +29,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class ReleaseDedicatedBgpPeerCmdTest { @@ -36,15 +39,18 @@ public class ReleaseDedicatedBgpPeerCmdTest { @Test public void testReleaseDedicatedBgpPeerCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); ReleaseDedicatedBgpPeerCmd cmd = new ReleaseDedicatedBgpPeerCmd(); ReflectionTestUtils.setField(cmd, "id", id); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_BGP_PEER_RELEASE, cmd.getEventType()); - Assert.assertEquals(String.format("Releasing a dedicated Bgp Peer %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Releasing dedicated BGP Peer with ID: %s", uuid), cmd.getEventDescription()); BgpPeer bgpPeer = Mockito.mock(BgpPeer.class); Mockito.when(routedIpv4Manager.releaseDedicatedBgpPeer(cmd)).thenReturn(bgpPeer); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmdTest.java index 003944c61474..d594bc5718b7 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/network/bgp/UpdateBgpPeerCmdTest.java @@ -20,6 +20,7 @@ import com.cloud.event.EventTypes; import org.apache.cloudstack.api.response.BgpPeerResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.BgpPeer; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; @@ -29,6 +30,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class UpdateBgpPeerCmdTest { @@ -37,6 +40,7 @@ public class UpdateBgpPeerCmdTest { @Test public void testUpdateBgpPeerCmd() { Long id = 1L; + String uuid = UUID.randomUUID().toString(); String ip4Address = "ip4-address"; String ip6Address = "ip6-address"; Long peerAsNumber = 15000L; @@ -50,6 +54,8 @@ public void testUpdateBgpPeerCmd() { ReflectionTestUtils.setField(cmd, "password", peerPassword); ReflectionTestUtils.setField(cmd,"routedIpv4Manager", routedIpv4Manager); + CallContext.current().putApiResourceUuid("id", uuid); + Assert.assertEquals(id, cmd.getId()); Assert.assertEquals(ip4Address, cmd.getIp4Address()); Assert.assertEquals(ip6Address, cmd.getIp6Address()); @@ -57,7 +63,7 @@ public void testUpdateBgpPeerCmd() { Assert.assertEquals(peerPassword, cmd.getPassword()); Assert.assertEquals(1L, cmd.getEntityOwnerId()); Assert.assertEquals(EventTypes.EVENT_BGP_PEER_UPDATE, cmd.getEventType()); - Assert.assertEquals(String.format("Updating Bgp Peer %s", id), cmd.getEventDescription()); + Assert.assertEquals(String.format("Updating BGP Peer with ID: %s", uuid), cmd.getEventDescription()); BgpPeer bgpPeer = Mockito.mock(BgpPeer.class); Mockito.when(routedIpv4Manager.updateBgpPeer(cmd)).thenReturn(bgpPeer); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmdTest.java new file mode 100644 index 000000000000..b4f7c55bd1fa --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CloneServiceOfferingCmdTest.java @@ -0,0 +1,669 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.offering; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.offering.ServiceOffering; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.vm.lease.VMLeaseManager; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class CloneServiceOfferingCmdTest { + + private CloneServiceOfferingCmd cloneServiceOfferingCmd; + + @Mock + private com.cloud.configuration.ConfigurationService configService; + + @Mock + private ResponseGenerator responseGenerator; + + @Mock + private ServiceOffering mockServiceOffering; + + @Mock + private ServiceOfferingResponse mockServiceOfferingResponse; + + @Before + public void setUp() { + cloneServiceOfferingCmd = new CloneServiceOfferingCmd(); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "_configService", configService); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "_responseGenerator", responseGenerator); + } + + @Test + public void testGetSourceOfferingId() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + assertEquals(sourceOfferingId, cloneServiceOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testGetServiceOfferingName() { + String name = "ClonedServiceOffering"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", name); + assertEquals(name, cloneServiceOfferingCmd.getServiceOfferingName()); + } + + @Test + public void testGetDisplayText() { + String displayText = "Cloned Service Offering Display Text"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "displayText", displayText); + assertEquals(displayText, cloneServiceOfferingCmd.getDisplayText()); + } + + @Test + public void testGetDisplayTextDefaultsToName() { + String name = "ClonedServiceOffering"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", name); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "displayText", null); + assertEquals(name, cloneServiceOfferingCmd.getDisplayText()); + } + + @Test + public void testGetCpu() { + Integer cpu = 4; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuNumber", cpu); + assertEquals(cpu, cloneServiceOfferingCmd.getCpuNumber()); + } + + @Test + public void testGetMemory() { + Integer memory = 8192; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "memory", memory); + assertEquals(memory, cloneServiceOfferingCmd.getMemory()); + } + + @Test + public void testGetCpuSpeed() { + Integer cpuSpeed = 2000; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuSpeed", cpuSpeed); + assertEquals(cpuSpeed, cloneServiceOfferingCmd.getCpuSpeed()); + } + + @Test + public void testGetOfferHa() { + Boolean offerHa = true; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "offerHa", offerHa); + assertEquals(offerHa, cloneServiceOfferingCmd.isOfferHa()); + } + + @Test + public void testGetLimitCpuUse() { + Boolean limitCpuUse = false; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "limitCpuUse", limitCpuUse); + assertEquals(limitCpuUse, cloneServiceOfferingCmd.isLimitCpuUse()); + } + + @Test + public void testGetVolatileVm() { + Boolean volatileVm = true; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "isVolatile", volatileVm); + assertEquals(volatileVm, cloneServiceOfferingCmd.isVolatileVm()); + } + + @Test + public void testGetStorageType() { + String storageType = "local"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "storageType", storageType); + assertEquals(storageType, cloneServiceOfferingCmd.getStorageType()); + } + + @Test + public void testGetTags() { + String tags = "ssd,premium,dedicated"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "tags", tags); + assertEquals(tags, cloneServiceOfferingCmd.getTags()); + } + + @Test + public void testGetHostTag() { + String hostTag = "gpu-enabled"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "hostTag", hostTag); + assertEquals(hostTag, cloneServiceOfferingCmd.getHostTag()); + } + + @Test + public void testGetNetworkRate() { + Integer networkRate = 1000; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "networkRate", networkRate); + assertEquals(networkRate, cloneServiceOfferingCmd.getNetworkRate()); + } + + @Test + public void testGetDeploymentPlanner() { + String deploymentPlanner = "UserDispersingPlanner"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "deploymentPlanner", deploymentPlanner); + assertEquals(deploymentPlanner, cloneServiceOfferingCmd.getDeploymentPlanner()); + } + + @Test + public void testGetDetails() { + Map> details = new HashMap<>(); + + HashMap cpuOvercommit = new HashMap<>(); + cpuOvercommit.put("key", "cpuOvercommitRatio"); + cpuOvercommit.put("value", "2.0"); + + HashMap memoryOvercommit = new HashMap<>(); + memoryOvercommit.put("key", "memoryOvercommitRatio"); + memoryOvercommit.put("value", "1.5"); + + details.put("0", cpuOvercommit); + details.put("1", memoryOvercommit); + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "details", details); + + Map result = cloneServiceOfferingCmd.getDetails(); + assertNotNull(result); + assertEquals("2.0", result.get("cpuOvercommitRatio")); + assertEquals("1.5", result.get("memoryOvercommitRatio")); + } + + @Test + public void testIsPurgeResources() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "purgeResources", true); + assertTrue(cloneServiceOfferingCmd.isPurgeResources()); + } + + @Test + public void testIsPurgeResourcesFalse() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "purgeResources", false); + assertFalse(cloneServiceOfferingCmd.isPurgeResources()); + } + + @Test + public void testIsPurgeResourcesDefaultFalse() { + assertFalse(cloneServiceOfferingCmd.isPurgeResources()); + } + + @Test + public void testGetLeaseDuration() { + Integer leaseDuration = 3600; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseDuration", leaseDuration); + assertEquals(leaseDuration, cloneServiceOfferingCmd.getLeaseDuration()); + } + + @Test + public void testGetLeaseExpiryAction() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseExpiryAction", "stop"); + assertEquals(VMLeaseManager.ExpiryAction.STOP, cloneServiceOfferingCmd.getLeaseExpiryAction()); + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseExpiryAction", "DESTROY"); + assertEquals(VMLeaseManager.ExpiryAction.DESTROY, cloneServiceOfferingCmd.getLeaseExpiryAction()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testGetLeaseExpiryActionInvalidValue() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseExpiryAction", "InvalidAction"); + cloneServiceOfferingCmd.getLeaseExpiryAction(); + } + + @Test + public void testGetVgpuProfileId() { + Long vgpuProfileId = 10L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "vgpuProfileId", vgpuProfileId); + assertEquals(vgpuProfileId, cloneServiceOfferingCmd.getVgpuProfileId()); + } + + @Test + public void testGetGpuCount() { + Integer gpuCount = 2; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuCount", gpuCount); + assertEquals(gpuCount, cloneServiceOfferingCmd.getGpuCount()); + } + + @Test + public void testGetGpuDisplay() { + Boolean gpuDisplay = true; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuDisplay", gpuDisplay); + assertEquals(gpuDisplay, cloneServiceOfferingCmd.getGpuDisplay()); + } + + @Test + public void testExecuteSuccess() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteFailure() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(null); + + try { + cloneServiceOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Failed to clone service offering", e.getMessage()); + } + } + + @Test + public void testExecuteSuccessWithAllParameters() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", 555L); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", "ClonedOffering"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "displayText", "Test Display"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuNumber", 4); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "memory", 8192); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuSpeed", 2000); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithInvalidParameterException() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))) + .thenThrow(new InvalidParameterValueException("Invalid source offering ID")); + + try { + cloneServiceOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.PARAM_ERROR, e.getErrorCode()); + assertEquals("Invalid source offering ID", e.getMessage()); + } + } + + @Test + public void testExecuteWithCloudRuntimeException() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))) + .thenThrow(new com.cloud.utils.exception.CloudRuntimeException("Runtime error during clone")); + + try { + cloneServiceOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Runtime error during clone", e.getMessage()); + } + } + + @Test + public void testExecuteResponseNameIsSet() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + // Verify that response name would be set (actual verification would require accessing the response object's internal state) + } + + @Test + public void testCloneWithAllParameters() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", 555L); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", "ClonedServiceOffering"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "displayText", "Cloned Service Offering"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuNumber", 4); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "memory", 8192); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuSpeed", 2000); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "offerHa", true); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "limitCpuUse", false); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "isVolatile", true); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "storageType", "local"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "tags", "premium"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "hostTag", "gpu-enabled"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "networkRate", 1000); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "deploymentPlanner", "UserDispersingPlanner"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "purgeResources", true); + + assertEquals(Long.valueOf(555L), cloneServiceOfferingCmd.getSourceOfferingId()); + assertEquals("ClonedServiceOffering", cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals("Cloned Service Offering", cloneServiceOfferingCmd.getDisplayText()); + assertEquals(Integer.valueOf(4), cloneServiceOfferingCmd.getCpuNumber()); + assertEquals(Integer.valueOf(8192), cloneServiceOfferingCmd.getMemory()); + assertEquals(Integer.valueOf(2000), cloneServiceOfferingCmd.getCpuSpeed()); + assertEquals(Boolean.TRUE, cloneServiceOfferingCmd.isOfferHa()); + assertEquals(Boolean.FALSE, cloneServiceOfferingCmd.isLimitCpuUse()); + assertEquals(Boolean.TRUE, cloneServiceOfferingCmd.isVolatileVm()); + assertEquals("local", cloneServiceOfferingCmd.getStorageType()); + assertEquals("premium", cloneServiceOfferingCmd.getTags()); + assertEquals("gpu-enabled", cloneServiceOfferingCmd.getHostTag()); + assertEquals(Integer.valueOf(1000), cloneServiceOfferingCmd.getNetworkRate()); + assertEquals("UserDispersingPlanner", cloneServiceOfferingCmd.getDeploymentPlanner()); + assertTrue(cloneServiceOfferingCmd.isPurgeResources()); + } + + @Test + public void testSourceOfferingIdNullByDefault() { + assertNull(cloneServiceOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testGetSystemVmType() { + String systemVmType = "domainrouter"; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "systemVmType", systemVmType); + assertEquals(systemVmType, cloneServiceOfferingCmd.getSystemVmType()); + } + + @Test + public void testGetBytesReadRate() { + Long bytesReadRate = 1000000L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "bytesReadRate", bytesReadRate); + assertEquals(bytesReadRate, cloneServiceOfferingCmd.getBytesReadRate()); + } + + @Test + public void testGetBytesWriteRate() { + Long bytesWriteRate = 1000000L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "bytesWriteRate", bytesWriteRate); + assertEquals(bytesWriteRate, cloneServiceOfferingCmd.getBytesWriteRate()); + } + + @Test + public void testGetIopsReadRate() { + Long iopsReadRate = 1000L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "iopsReadRate", iopsReadRate); + assertEquals(iopsReadRate, cloneServiceOfferingCmd.getIopsReadRate()); + } + + @Test + public void testGetIopsWriteRate() { + Long iopsWriteRate = 1000L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "iopsWriteRate", iopsWriteRate); + assertEquals(iopsWriteRate, cloneServiceOfferingCmd.getIopsWriteRate()); + } + + @Test + public void testCloneServiceOfferingWithGpuProfile() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", 555L); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", "GPU-Offering-Clone"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "vgpuProfileId", 10L); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuCount", 2); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuDisplay", true); + + assertEquals(Long.valueOf(10L), cloneServiceOfferingCmd.getVgpuProfileId()); + assertEquals(Integer.valueOf(2), cloneServiceOfferingCmd.getGpuCount()); + assertTrue(cloneServiceOfferingCmd.getGpuDisplay()); + } + + @Test + public void testCloneServiceOfferingWithLease() { + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", 555L); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", "Lease-Offering-Clone"); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseDuration", 7200); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseExpiryAction", "destroy"); + + assertEquals(Integer.valueOf(7200), cloneServiceOfferingCmd.getLeaseDuration()); + assertEquals(VMLeaseManager.ExpiryAction.DESTROY, cloneServiceOfferingCmd.getLeaseExpiryAction()); + } + + @Test + public void testExecuteWithOverriddenParameters() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + String newName = "ClonedOffering-Override"; + String newDisplayText = "Overridden Display Text"; + Integer newCpu = 8; + Integer newMemory = 16384; + Integer newCpuSpeed = 3000; + Boolean newOfferHa = true; + Boolean newLimitCpuUse = true; + String newStorageType = "shared"; + String newTags = "premium,gpu"; + String newHostTag = "compute-optimized"; + Integer newNetworkRate = 2000; + String newDeploymentPlanner = "FirstFitPlanner"; + Boolean newPurgeResources = true; + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "displayText", newDisplayText); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuNumber", newCpu); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "memory", newMemory); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuSpeed", newCpuSpeed); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "offerHa", newOfferHa); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "limitCpuUse", newLimitCpuUse); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "storageType", newStorageType); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "tags", newTags); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "hostTag", newHostTag); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "networkRate", newNetworkRate); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "deploymentPlanner", newDeploymentPlanner); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "purgeResources", newPurgeResources); + + assertEquals(sourceOfferingId, cloneServiceOfferingCmd.getSourceOfferingId()); + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals(newDisplayText, cloneServiceOfferingCmd.getDisplayText()); + assertEquals(newCpu, cloneServiceOfferingCmd.getCpuNumber()); + assertEquals(newMemory, cloneServiceOfferingCmd.getMemory()); + assertEquals(newCpuSpeed, cloneServiceOfferingCmd.getCpuSpeed()); + assertEquals(newOfferHa, cloneServiceOfferingCmd.isOfferHa()); + assertEquals(newLimitCpuUse, cloneServiceOfferingCmd.isLimitCpuUse()); + assertEquals(newStorageType, cloneServiceOfferingCmd.getStorageType()); + assertEquals(newTags, cloneServiceOfferingCmd.getTags()); + assertEquals(newHostTag, cloneServiceOfferingCmd.getHostTag()); + assertEquals(newNetworkRate, cloneServiceOfferingCmd.getNetworkRate()); + assertEquals(newDeploymentPlanner, cloneServiceOfferingCmd.getDeploymentPlanner()); + assertTrue(cloneServiceOfferingCmd.isPurgeResources()); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithPartialOverrides() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + String newName = "PartialOverride"; + Integer newCpu = 6; + Integer newMemory = 12288; + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "cpuNumber", newCpu); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "memory", newMemory); + + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals(newCpu, cloneServiceOfferingCmd.getCpuNumber()); + assertEquals(newMemory, cloneServiceOfferingCmd.getMemory()); + + assertNull(cloneServiceOfferingCmd.getCpuSpeed()); + assertFalse(cloneServiceOfferingCmd.isOfferHa()); + assertNull(cloneServiceOfferingCmd.getStorageType()); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithGpuOverrides() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + String newName = "GPU-Clone-Override"; + Long vgpuProfileId = 15L; + Integer gpuCount = 4; + Boolean gpuDisplay = false; + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "vgpuProfileId", vgpuProfileId); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuCount", gpuCount); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "gpuDisplay", gpuDisplay); + + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals(vgpuProfileId, cloneServiceOfferingCmd.getVgpuProfileId()); + assertEquals(gpuCount, cloneServiceOfferingCmd.getGpuCount()); + assertEquals(gpuDisplay, cloneServiceOfferingCmd.getGpuDisplay()); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithLeaseOverrides() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + String newName = "Lease-Clone-Override"; + Integer leaseDuration = 14400; // 4 hours + String leaseExpiryAction = "stop"; + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseDuration", leaseDuration); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "leaseExpiryAction", leaseExpiryAction); + + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals(leaseDuration, cloneServiceOfferingCmd.getLeaseDuration()); + assertEquals(VMLeaseManager.ExpiryAction.STOP, cloneServiceOfferingCmd.getLeaseExpiryAction()); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithStorageOverrides() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + String newName = "Storage-Clone-Override"; + Long bytesReadRate = 2000000L; + Long bytesWriteRate = 1500000L; + Long iopsReadRate = 2000L; + Long iopsWriteRate = 1500L; + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "bytesReadRate", bytesReadRate); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "bytesWriteRate", bytesWriteRate); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "iopsReadRate", iopsReadRate); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "iopsWriteRate", iopsWriteRate); + + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + assertEquals(bytesReadRate, cloneServiceOfferingCmd.getBytesReadRate()); + assertEquals(bytesWriteRate, cloneServiceOfferingCmd.getBytesWriteRate()); + assertEquals(iopsReadRate, cloneServiceOfferingCmd.getIopsReadRate()); + assertEquals(iopsWriteRate, cloneServiceOfferingCmd.getIopsWriteRate()); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } + + @Test + public void testExecuteWithDetailsOverride() { + Long sourceOfferingId = 555L; + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "sourceOfferingId", sourceOfferingId); + + String newName = "Details-Clone-Override"; + Map> details = new HashMap<>(); + + HashMap cpuOvercommit = new HashMap<>(); + cpuOvercommit.put("key", "cpuOvercommitRatio"); + cpuOvercommit.put("value", "3.0"); + + HashMap memoryOvercommit = new HashMap<>(); + memoryOvercommit.put("key", "memoryOvercommitRatio"); + memoryOvercommit.put("value", "2.5"); + + HashMap customDetail = new HashMap<>(); + customDetail.put("key", "customParameter"); + customDetail.put("value", "customValue"); + + details.put("0", cpuOvercommit); + details.put("1", memoryOvercommit); + details.put("2", customDetail); + + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "serviceOfferingName", newName); + ReflectionTestUtils.setField(cloneServiceOfferingCmd, "details", details); + + assertEquals(newName, cloneServiceOfferingCmd.getServiceOfferingName()); + Map result = cloneServiceOfferingCmd.getDetails(); + assertNotNull(result); + assertEquals("3.0", result.get("cpuOvercommitRatio")); + assertEquals("2.5", result.get("memoryOvercommitRatio")); + assertEquals("customValue", result.get("customParameter")); + + when(configService.cloneServiceOffering(any(CloneServiceOfferingCmd.class))).thenReturn(mockServiceOffering); + when(responseGenerator.createServiceOfferingResponse(mockServiceOffering)).thenReturn(mockServiceOfferingResponse); + + cloneServiceOfferingCmd.execute(); + + assertNotNull(cloneServiceOfferingCmd.getResponseObject()); + assertEquals(mockServiceOfferingResponse, cloneServiceOfferingCmd.getResponseObject()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmdTest.java index 6daa5de07cbf..bc7f65b07561 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmdTest.java @@ -17,6 +17,8 @@ package org.apache.cloudstack.api.command.admin.offering; +import com.cloud.exception.InvalidParameterValueException; +import org.apache.cloudstack.vm.lease.VMLeaseManager; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -55,4 +57,44 @@ public void testIsPurgeResourcesTrue() { ReflectionTestUtils.setField(createServiceOfferingCmd, "purgeResources", true); Assert.assertTrue(createServiceOfferingCmd.isPurgeResources()); } + + @Test + public void testGetLeaseDuration() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "leaseDuration", 10); + Assert.assertEquals(10, createServiceOfferingCmd.getLeaseDuration().longValue()); + } + + @Test + public void testGetLeaseExpiryAction() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "leaseExpiryAction", "stop"); + Assert.assertEquals(VMLeaseManager.ExpiryAction.STOP, createServiceOfferingCmd.getLeaseExpiryAction()); + + ReflectionTestUtils.setField(createServiceOfferingCmd, "leaseExpiryAction", "DESTROY"); + Assert.assertEquals(VMLeaseManager.ExpiryAction.DESTROY, createServiceOfferingCmd.getLeaseExpiryAction()); + } + + @Test(expected = InvalidParameterValueException.class) + public void testGetLeaseExpiryActionInvalidValue() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "leaseExpiryAction", "Unknown"); + Assert.assertEquals(null, createServiceOfferingCmd.getLeaseExpiryAction()); + } + + @Test + public void testGetVgpuProfileId() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "vgpuProfileId", 10L); + Assert.assertEquals(10L, createServiceOfferingCmd.getVgpuProfileId().longValue()); + } + + @Test + public void testGetGpuCount() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "gpuCount", 2); + Assert.assertEquals(2, createServiceOfferingCmd.getGpuCount().intValue()); + } + + @Test + public void testGetGpuDisplay() { + ReflectionTestUtils.setField(createServiceOfferingCmd, "gpuDisplay", true); + Assert.assertTrue(createServiceOfferingCmd.getGpuDisplay()); + } + } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/resource/PurgeExpungedResourcesCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/resource/PurgeExpungedResourcesCmdTest.java index a628f13275c5..c8ca1c2afe30 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/resource/PurgeExpungedResourcesCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/resource/PurgeExpungedResourcesCmdTest.java @@ -44,7 +44,7 @@ public class PurgeExpungedResourcesCmdTest { @Spy @InjectMocks - PurgeExpungedResourcesCmd spyCmd = Mockito.spy(new PurgeExpungedResourcesCmd()); + PurgeExpungedResourcesCmd spyCmd; @Test public void testGetResourceType() { diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmdTest.java index a69a7a858ce0..c7aeb8ba99bf 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmdTest.java @@ -61,6 +61,8 @@ public class AddObjectStoragePoolCmdTest { String provider = "Simulator"; + Long size = 10L; + Map details; private AutoCloseable closeable; @@ -74,6 +76,7 @@ public void setUp() throws Exception { ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "url", url); ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "providerName", provider); ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "details", details); + ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "size", size); addObjectStoragePoolCmdSpy._storageService = storageService; addObjectStoragePoolCmdSpy._responseGenerator = responseGenerator; } @@ -87,12 +90,12 @@ public void tearDown() throws Exception { @Test public void testAddObjectStore() throws DiscoveryException { Mockito.doReturn(objectStore).when(storageService).discoverObjectStore(Mockito.anyString(), - Mockito.anyString(), Mockito.anyString(), any()); + Mockito.anyString(), Mockito.anyLong(), Mockito.anyString(), any()); ObjectStoreResponse objectStoreResponse = new ObjectStoreResponse(); Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(any()); addObjectStoragePoolCmdSpy.execute(); Mockito.verify(storageService, Mockito.times(1)) - .discoverObjectStore(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); + .discoverObjectStore(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmdTest.java index 98435bf6e38a..8d2771c969b7 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmdTest.java @@ -19,20 +19,19 @@ import com.cloud.utils.Pair; import org.apache.cloudstack.api.response.ExtractResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.storage.browser.StorageBrowser; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import java.util.List; +import java.util.UUID; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -48,18 +47,6 @@ public class DownloadImageStoreObjectCmdTest { @Spy private DownloadImageStoreObjectCmd cmd; - private AutoCloseable closeable; - - @Before - public void setUp() { - closeable = MockitoAnnotations.openMocks(this); - } - - @After - public void tearDown() throws Exception { - closeable.close(); - } - @Test public void testExecute() throws Exception { ReflectionTestUtils.setField(cmd, "storeId", 1L); @@ -110,10 +97,13 @@ public void testGetEventType() { @Test public void testGetEventDescription() { + String uuid = UUID.randomUUID().toString(); + ReflectionTestUtils.setField(cmd, "storeId", 1L); ReflectionTestUtils.setField(cmd, "path", "path/to/object"); + CallContext.current().putApiResourceUuid("id", uuid); String eventDescription = cmd.getEventDescription(); - Assert.assertEquals("Downloading object at path path/to/object on image store 1", eventDescription); + Assert.assertEquals(String.format("Downloading object at path path/to/object on image store %s", uuid), eventDescription); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmdTest.java index 8a57ac3eb22c..397723dd6069 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/user/CreateUserCmdTest.java @@ -69,7 +69,7 @@ public void testExecuteWithNotBlankPassword() { } catch (ServerApiException e) { Assert.assertTrue("Received exception as the mock accountService createUser returns null user", true); } - Mockito.verify(accountService, Mockito.times(1)).createUser(null, "Test", null, null, null, null, null, null, null); + Mockito.verify(accountService, Mockito.times(1)).createUser(null, "Test", null, null, null, null, null, null, null, false); } @Test @@ -82,7 +82,7 @@ public void testExecuteWithNullPassword() { Assert.assertEquals(ApiErrorCode.PARAM_ERROR,e.getErrorCode()); Assert.assertEquals("Empty passwords are not allowed", e.getMessage()); } - Mockito.verify(accountService, Mockito.never()).createUser(null, null, null, null, null, null, null, null, null); + Mockito.verify(accountService, Mockito.never()).createUser(null, null, null, null, null, null, null, null, null, false); } @Test @@ -95,6 +95,6 @@ public void testExecuteWithEmptyPassword() { Assert.assertEquals(ApiErrorCode.PARAM_ERROR,e.getErrorCode()); Assert.assertEquals("Empty passwords are not allowed", e.getMessage()); } - Mockito.verify(accountService, Mockito.never()).createUser(null, null, null, null, null, null, null, null, null); + Mockito.verify(accountService, Mockito.never()).createUser(null, null, null, null, null, null, null, null, null, true); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmdTest.java new file mode 100644 index 000000000000..f86e51adb5ab --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmdTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.admin.user; + +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +@RunWith(MockitoJUnitRunner.class) +public class UpdateUserCmdTest { + @InjectMocks + private UpdateUserCmd cmd; + + @Test + public void testGetApiResourceId() { + Long userId = 99L; + cmd.setId(userId); + Assert.assertEquals(userId, cmd.getApiResourceId()); + } + + @Test + public void testGetApiResourceType() { + Assert.assertEquals(ApiCommandResourceType.User, cmd.getApiResourceType()); + } + + @Test + public void testIsPasswordChangeRequired_True() { + ReflectionTestUtils.setField(cmd, "passwordChangeRequired", Boolean.TRUE); + Assert.assertTrue(cmd.isPasswordChangeRequired()); + } + + @Test + public void testIsPasswordChangeRequired_False() { + ReflectionTestUtils.setField(cmd, "passwordChangeRequired", Boolean.FALSE); + Assert.assertFalse(cmd.isPasswordChangeRequired()); + } + + @Test + public void testIsPasswordChangeRequired_Null() { + ReflectionTestUtils.setField(cmd, "passwordChangeRequired", null); + Assert.assertFalse(cmd.isPasswordChangeRequired()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmdTest.java index c1bf6b151f7f..f2c23edbc7fe 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vlan/UpdateVlanIpRangeCmdTest.java @@ -71,7 +71,7 @@ public void testUpdateFailure() throws ResourceAllocationException, ResourceUnav try { updateVlanIpRangeCmd.execute(); } catch (ServerApiException ex) { - assertEquals("Failed to Update vlan ip range", ex.getMessage()); + assertEquals("Failed to Update VLAN IP range", ex.getMessage()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmdTest.java new file mode 100644 index 000000000000..27bc4614e1b5 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/AssignVMCmdTest.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vm; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +public class AssignVMCmdTest { + + @Test + public void test_setSkipNetwork_default() { + AssignVMCmd assignVMCmd = new AssignVMCmd(); + Object value = ReflectionTestUtils.getField(assignVMCmd, "skipNetwork"); + Assert.assertTrue(value instanceof Boolean); + Assert.assertFalse((Boolean) value); + } + + @Test + public void test_setSkipNetwork_set() { + AssignVMCmd assignVMCmd = new AssignVMCmd(); + assignVMCmd.setSkipNetwork(true); + Object value = ReflectionTestUtils.getField(assignVMCmd, "skipNetwork"); + Assert.assertTrue(value instanceof Boolean); + Assert.assertTrue((Boolean) value); + } + + @Test + public void test_isSkipNetwork_default() { + AssignVMCmd assignVMCmd = new AssignVMCmd(); + Assert.assertFalse(assignVMCmd.isSkipNetwork()); + } + + @Test + public void test_isSkipNetwork_set() { + AssignVMCmd assignVMCmd = new AssignVMCmd(); + ReflectionTestUtils.setField(assignVMCmd, "skipNetwork", true); + Assert.assertTrue(assignVMCmd.isSkipNetwork()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdminTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdminTest.java new file mode 100644 index 000000000000..d82dc9f766f9 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/DeployVMCmdByAdminTest.java @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vm; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +@RunWith(MockitoJUnitRunner.class) +public class DeployVMCmdByAdminTest { + + @InjectMocks + private DeployVMCmdByAdmin cmd; + + @Test + public void testIsBlankInstance_default() { + assertFalse(cmd.isBlankInstance()); + } + + @Test + public void testIsBlankInstance_true() { + ReflectionTestUtils.setField(cmd, "blankInstance", true); + assertTrue(cmd.isBlankInstance()); + } + + @Test + public void testIsBlankInstance_false() { + ReflectionTestUtils.setField(cmd, "blankInstance", false); + assertFalse(cmd.isBlankInstance()); + } + + @Test + public void testSetBlankInstance_default() { + Object obj = ReflectionTestUtils.getField(cmd, "blankInstance"); + assertNull(obj); + } + + @Test + public void testSetBlankInstance_true() { + cmd.setBlankInstance(true); + Object obj = ReflectionTestUtils.getField(cmd, "blankInstance"); + assertNotNull(obj); + assertTrue((boolean)obj); + } + + @Test + public void testSetBlankInstance_false() { + cmd.setBlankInstance(false); + Object obj = ReflectionTestUtils.getField(cmd, "blankInstance"); + assertNotNull(obj); + assertFalse((boolean)obj); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmdTest.java index 61a3c8fb9e65..c0e3b1aba321 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmdTest.java @@ -68,6 +68,12 @@ public class MigrateVirtualMachineWithVolumeCmdTest { @Mock Host hostMock; + @Mock + private Object job; + + @Mock + private Object _responseObject; + @Spy @InjectMocks MigrateVirtualMachineWithVolumeCmd cmdSpy; @@ -97,7 +103,7 @@ public void executeTestRequiredArgsNullThrowsInvalidParameterValueException() { cmdSpy.execute(); } catch (Exception e) { Assert.assertEquals(InvalidParameterValueException.class, e.getClass()); - String expected = String.format("Either %s or %s must be passed or %s must be true for migrating the VM.", ApiConstants.HOST_ID, ApiConstants.MIGRATE_TO, ApiConstants.AUTO_SELECT); + String expected = String.format("Either %s or %s must be passed or %s must be true for migrating the Instance.", ApiConstants.HOST_ID, ApiConstants.MIGRATE_TO, ApiConstants.AUTO_SELECT); Assert.assertEquals(expected , e.getMessage()); } } @@ -155,7 +161,7 @@ public void executeTestHostIdIsNullThrowsInvalidParameterValueException() { cmdSpy.execute(); } catch (Exception e) { Assert.assertEquals(InvalidParameterValueException.class, e.getClass()); - String expected = "Unable to find the specified host to migrate the VM."; + String expected = "Unable to find the specified host to migrate the Instance."; Assert.assertEquals(expected , e.getMessage()); } } @@ -181,7 +187,7 @@ public void executeTestHostIsNotNullMigratedVMIsNullThrowsServerApiException() t cmdSpy.execute(); } catch (Exception e) { Assert.assertEquals(ServerApiException.class, e.getClass()); - String expected = "Failed to migrate vm"; + String expected = "Failed to migrate Instance"; Assert.assertEquals(expected , e.getMessage()); } } @@ -199,7 +205,7 @@ public void executeTestHostIsNullMigratedVMIsNullThrowsServerApiException() { cmdSpy.execute(); } catch (Exception e) { Assert.assertEquals(ServerApiException.class, e.getClass()); - String expected = "Failed to migrate vm"; + String expected = "Failed to migrate Instance"; Assert.assertEquals(expected , e.getMessage()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmdTest.java index a7c41b9271b1..235acb15eeab 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/ImportVolumeCmdTest.java @@ -46,7 +46,7 @@ public void testImportVolumeCmd() { Long projectId = 5L; long accountId = 6L; - Mockito.when(accountService.finalyzeAccountId(accountName, domainId, projectId, true)).thenReturn(accountId); + Mockito.when(accountService.finalizeAccountId(accountName, domainId, projectId, true)).thenReturn(accountId); ImportVolumeCmd cmd = new ImportVolumeCmd(); ReflectionTestUtils.setField(cmd, "path", path); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmdTest.java index ba7e351a8a8e..59a61806e867 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/volume/UnmanageVolumeCmdTest.java @@ -22,6 +22,7 @@ import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.storage.volume.VolumeImportUnmanageService; import org.junit.Assert; import org.junit.Test; @@ -31,6 +32,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + @RunWith(MockitoJUnitRunner.class) public class UnmanageVolumeCmdTest { @@ -41,6 +44,7 @@ public class UnmanageVolumeCmdTest { public void testUnmanageVolumeCmd() { long accountId = 2L; Long volumeId = 3L; + String volumeUuid = UUID.randomUUID().toString(); Volume volume = Mockito.mock(Volume.class); Mockito.when(responseGenerator.findVolumeById(volumeId)).thenReturn(volume); @@ -51,12 +55,14 @@ public void testUnmanageVolumeCmd() { ReflectionTestUtils.setField(cmd,"volumeImportService", volumeImportService); ReflectionTestUtils.setField(cmd,"_responseGenerator", responseGenerator); + CallContext.current().putApiResourceUuid("id", volumeUuid); + Assert.assertEquals(volumeId, cmd.getVolumeId()); Assert.assertEquals(accountId, cmd.getEntityOwnerId()); Assert.assertEquals(volumeId, cmd.getApiResourceId()); Assert.assertEquals(ApiCommandResourceType.Volume, cmd.getApiResourceType()); Assert.assertEquals(EventTypes.EVENT_VOLUME_UNMANAGE, cmd.getEventType()); - Assert.assertEquals("Unmanaging Volume with ID " + volumeId, cmd.getEventDescription()); + Assert.assertEquals("Unmanaging Volume with ID: " + volumeUuid, cmd.getEventDescription()); Mockito.when(volumeImportService.unmanageVolume(volumeId)).thenReturn(true); try { diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CloneVpcOfferingCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CloneVpcOfferingCmdTest.java new file mode 100644 index 000000000000..1e6d6c9e0969 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CloneVpcOfferingCmdTest.java @@ -0,0 +1,299 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.admin.vpc; + +import com.cloud.network.vpc.VpcOffering; +import com.cloud.network.vpc.VpcProvisioningService; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class CloneVpcOfferingCmdTest { + + private CloneVPCOfferingCmd cloneVpcOfferingCmd; + + @Mock + private VpcProvisioningService vpcService; + + @Mock + private ResponseGenerator responseGenerator; + + @Mock + private VpcOffering mockVpcOffering; + + @Mock + private VpcOfferingResponse mockVpcOfferingResponse; + + @Before + public void setUp() { + cloneVpcOfferingCmd = new CloneVPCOfferingCmd(); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "_vpcProvSvc", vpcService); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "_responseGenerator", responseGenerator); + } + + @Test + public void testGetSourceOfferingId() { + Long sourceOfferingId = 789L; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", sourceOfferingId); + assertEquals(sourceOfferingId, cloneVpcOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testGetName() { + String name = "ClonedVpcOffering"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "vpcOfferingName", name); + assertEquals(name, cloneVpcOfferingCmd.getVpcOfferingName()); + } + + @Test + public void testGetDisplayText() { + String displayText = "Cloned VPC Offering Display Text"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "displayText", displayText); + assertEquals(displayText, cloneVpcOfferingCmd.getDisplayText()); + } + + @Test + public void testGetDisplayTextDefaultsToName() { + String name = "ClonedVpcOffering"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "vpcOfferingName", name); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "displayText", null); + assertEquals(name, cloneVpcOfferingCmd.getDisplayText()); + } + + @Test + public void testGetServiceOfferingId() { + Long serviceOfferingId = 456L; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "serviceOfferingId", serviceOfferingId); + assertEquals(serviceOfferingId, cloneVpcOfferingCmd.getServiceOfferingId()); + } + + @Test + public void testGetInternetProtocol() { + String internetProtocol = "dualstack"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "internetProtocol", internetProtocol); + assertEquals(internetProtocol, cloneVpcOfferingCmd.getInternetProtocol()); + } + + @Test + public void testGetProvider() { + String provider = "NSX"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "provider", provider); + assertEquals(provider, cloneVpcOfferingCmd.getProvider()); + } + + @Test + public void testGetNetworkMode() { + String networkMode = "ROUTED"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "networkMode", networkMode); + assertEquals(networkMode, cloneVpcOfferingCmd.getNetworkMode()); + } + + @Test + public void testGetRoutingMode() { + String routingMode = "dynamic"; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "routingMode", routingMode); + assertEquals(routingMode, cloneVpcOfferingCmd.getRoutingMode()); + } + + @Test + public void testGetNsxSupportLb() { + Boolean nsxSupportLb = true; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "nsxSupportsLbService", nsxSupportLb); + assertEquals(nsxSupportLb, cloneVpcOfferingCmd.getNsxSupportsLbService()); + } + + @Test + public void testGetSpecifyAsnumber() { + Boolean specifyAsnumber = false; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "specifyAsNumber", specifyAsnumber); + assertEquals(specifyAsnumber, cloneVpcOfferingCmd.getSpecifyAsNumber()); + } + + @Test + public void testExecuteSuccess() { + Long sourceOfferingId = 789L; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(vpcService.cloneVPCOffering(any(CloneVPCOfferingCmd.class))).thenReturn(mockVpcOffering); + when(responseGenerator.createVpcOfferingResponse(mockVpcOffering)).thenReturn(mockVpcOfferingResponse); + + cloneVpcOfferingCmd.execute(); + + assertNotNull(cloneVpcOfferingCmd.getResponseObject()); + assertEquals(mockVpcOfferingResponse, cloneVpcOfferingCmd.getResponseObject()); + } + + @Test(expected = ServerApiException.class) + public void testExecuteFailure() { + Long sourceOfferingId = 789L; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", sourceOfferingId); + + when(vpcService.cloneVPCOffering(any(CloneVPCOfferingCmd.class))).thenReturn(null); + + try { + cloneVpcOfferingCmd.execute(); + fail("Expected ServerApiException to be thrown"); + } catch (ServerApiException e) { + assertEquals(ApiErrorCode.INTERNAL_ERROR, e.getErrorCode()); + assertEquals("Failed to clone VPC offering", e.getMessage()); + throw e; + } + } + + @Test + public void testGetSupportedServices() { + List supportedServices = Arrays.asList("Dhcp", "Dns", "SourceNat", "NetworkACL"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "supportedServices", supportedServices); + assertEquals(supportedServices, cloneVpcOfferingCmd.getSupportedServices()); + } + + @Test + public void testGetServiceProviders() { + Map> serviceProviderList = new HashMap<>(); + + HashMap dhcpProvider = new HashMap<>(); + dhcpProvider.put("service", "Dhcp"); + dhcpProvider.put("provider", "VpcVirtualRouter"); + + HashMap dnsProvider = new HashMap<>(); + dnsProvider.put("service", "Dns"); + dnsProvider.put("provider", "VpcVirtualRouter"); + + HashMap aclProvider = new HashMap<>(); + aclProvider.put("service", "NetworkACL"); + aclProvider.put("provider", "VpcVirtualRouter"); + + serviceProviderList.put("0", dhcpProvider); + serviceProviderList.put("1", dnsProvider); + serviceProviderList.put("2", aclProvider); + + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "serviceProviderList", serviceProviderList); + + Map> result = cloneVpcOfferingCmd.getServiceProviders(); + assertNotNull(result); + assertEquals(3, result.size()); + assertNotNull(result.get("Dhcp")); + assertNotNull(result.get("Dns")); + assertNotNull(result.get("NetworkACL")); + assertEquals("VpcVirtualRouter", result.get("Dhcp").get(0)); + assertEquals("VpcVirtualRouter", result.get("Dns").get(0)); + assertEquals("VpcVirtualRouter", result.get("NetworkACL").get(0)); + } + + @Test + public void testGetEnable() { + Boolean enable = true; + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "enable", enable); + assertEquals(enable, cloneVpcOfferingCmd.getEnable()); + } + + @Test + public void testCloneWithAllParameters() { + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", 789L); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "vpcOfferingName", "ClonedVpcOffering"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "displayText", "Cloned VPC Offering"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "serviceOfferingId", 456L); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "internetProtocol", "ipv4"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "provider", "NSX"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "networkMode", "NATTED"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "routingMode", "static"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "nsxSupportsLbService", true); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "specifyAsNumber", false); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "enable", true); + + assertEquals(Long.valueOf(789L), cloneVpcOfferingCmd.getSourceOfferingId()); + assertEquals("ClonedVpcOffering", cloneVpcOfferingCmd.getVpcOfferingName()); + assertEquals("Cloned VPC Offering", cloneVpcOfferingCmd.getDisplayText()); + assertEquals(Long.valueOf(456L), cloneVpcOfferingCmd.getServiceOfferingId()); + assertEquals("ipv4", cloneVpcOfferingCmd.getInternetProtocol()); + assertEquals("NSX", cloneVpcOfferingCmd.getProvider()); + assertEquals("NATTED", cloneVpcOfferingCmd.getNetworkMode()); + assertEquals("static", cloneVpcOfferingCmd.getRoutingMode()); + assertEquals(Boolean.TRUE, cloneVpcOfferingCmd.getNsxSupportsLbService()); + assertEquals(Boolean.FALSE, cloneVpcOfferingCmd.getSpecifyAsNumber()); + assertEquals(Boolean.TRUE, cloneVpcOfferingCmd.getEnable()); + } + + @Test + public void testSourceOfferingIdNullByDefault() { + assertNull(cloneVpcOfferingCmd.getSourceOfferingId()); + } + + @Test + public void testProviderNullByDefault() { + assertNull(cloneVpcOfferingCmd.getProvider()); + } + + @Test + public void testServiceCapabilityList() { + Map> serviceCapabilityList = new HashMap<>(); + serviceCapabilityList.put("Connectivity", Arrays.asList("RegionLevelVpc:true", "DistributedRouter:true")); + serviceCapabilityList.put("SourceNat", Arrays.asList("RedundantRouter:true")); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "serviceCapabilityList", serviceCapabilityList); + + Map> result = cloneVpcOfferingCmd.getServiceCapabilityList(); + assertNotNull(result); + assertEquals(serviceCapabilityList, result); + } + + @Test + public void testCloneVpcOfferingWithNsxProvider() { + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", 789L); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "provider", "NSX"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "nsxSupportsLbService", true); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "networkMode", "ROUTED"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "routingMode", "dynamic"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "specifyAsNumber", true); + + assertEquals("NSX", cloneVpcOfferingCmd.getProvider()); + assertEquals(Boolean.TRUE, cloneVpcOfferingCmd.getNsxSupportsLbService()); + assertEquals("ROUTED", cloneVpcOfferingCmd.getNetworkMode()); + assertEquals("dynamic", cloneVpcOfferingCmd.getRoutingMode()); + assertEquals(Boolean.TRUE, cloneVpcOfferingCmd.getSpecifyAsNumber()); + } + + @Test + public void testCloneVpcOfferingWithNetrisProvider() { + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "sourceOfferingId", 789L); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "provider", "Netris"); + ReflectionTestUtils.setField(cloneVpcOfferingCmd, "networkMode", "NATTED"); + + assertEquals("Netris", cloneVpcOfferingCmd.getProvider()); + assertEquals("NATTED", cloneVpcOfferingCmd.getNetworkMode()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdminTest.java b/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdminTest.java index c4e21bb948b2..aaa65e10ff4e 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdminTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdminTest.java @@ -20,7 +20,6 @@ import com.cloud.network.vpc.VpcService; import com.cloud.user.AccountService; import com.cloud.utils.db.EntityManager; -import junit.framework.TestCase; import org.apache.cloudstack.api.ResponseGenerator; import org.junit.Assert; import org.junit.Test; @@ -34,7 +33,7 @@ import java.util.List; @RunWith(MockitoJUnitRunner.class) -public class CreateVPCCmdByAdminTest extends TestCase { +public class CreateVPCCmdByAdminTest { @Mock public VpcService _vpcService; @@ -43,8 +42,10 @@ public class CreateVPCCmdByAdminTest extends TestCase { @Mock public AccountService _accountService; private ResponseGenerator responseGenerator; + @Mock + public Object job; @InjectMocks - CreateVPCCmdByAdmin cmd = new CreateVPCCmdByAdmin(); + CreateVPCCmdByAdmin cmd; @Test public void testBgpPeerIds() { diff --git a/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java b/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java new file mode 100644 index 000000000000..e679bbf2d1f1 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/offering/DomainAndZoneIdResolverTest.java @@ -0,0 +1,149 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.offering; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.LongFunction; + +import com.cloud.dc.DataCenter; +import com.cloud.domain.Domain; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.utils.db.EntityManager; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.ServerApiException; +import org.junit.Assert; +import org.junit.Test; + +public class DomainAndZoneIdResolverTest { + static class TestCmd extends BaseCmd implements DomainAndZoneIdResolver { + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { + // No implementation needed for tests + } + + @Override + public String getCommandName() { + return "test"; + } + + @Override + public long getEntityOwnerId() { + return 1L; + } + } + + private void setEntityMgr(final BaseCmd cmd, final EntityManager entityMgr) throws Exception { + Field f = BaseCmd.class.getDeclaredField("_entityMgr"); + f.setAccessible(true); + f.set(cmd, entityMgr); + } + + @Test + public void resolveDomainIds_usesDefaultProviderWhenEmpty() { + TestCmd cmd = new TestCmd(); + + final LongFunction> defaultsProvider = id -> Arrays.asList(100L, 200L); + + List result = cmd.resolveDomainIds("", 42L, defaultsProvider, "offering"); + Assert.assertEquals(Arrays.asList(100L, 200L), result); + } + + @Test + public void resolveDomainIds_resolvesValidUuids() throws Exception { + TestCmd cmd = new TestCmd(); + + EntityManager em = mock(EntityManager.class); + setEntityMgr(cmd, em); + + Domain d1 = mock(Domain.class); + when(d1.getId()).thenReturn(10L); + Domain d2 = mock(Domain.class); + when(d2.getId()).thenReturn(20L); + + when(em.findByUuid(Domain.class, "uuid1")).thenReturn(d1); + when(em.findByUuid(Domain.class, "uuid2")).thenReturn(d2); + + List ids = cmd.resolveDomainIds("uuid1, public, uuid2", null, null, "template"); + Assert.assertEquals(Arrays.asList(10L, 20L), ids); + } + + @Test + public void resolveDomainIds_invalidUuid_throws() throws Exception { + TestCmd cmd = new TestCmd(); + + EntityManager em = mock(EntityManager.class); + setEntityMgr(cmd, em); + + when(em.findByUuid(Domain.class, "bad-uuid")).thenReturn(null); + + Assert.assertThrows(InvalidParameterValueException.class, + () -> cmd.resolveDomainIds("bad-uuid", null, null, "offering")); + } + + @Test + public void resolveZoneIds_usesDefaultProviderWhenEmpty() { + TestCmd cmd = new TestCmd(); + + final LongFunction> defaultsProvider = id -> Collections.singletonList(300L); + + List result = cmd.resolveZoneIds("", 99L, defaultsProvider, "offering"); + Assert.assertEquals(Collections.singletonList(300L), result); + } + + @Test + public void resolveZoneIds_resolvesValidUuids() throws Exception { + TestCmd cmd = new TestCmd(); + + EntityManager em = mock(EntityManager.class); + setEntityMgr(cmd, em); + + DataCenter z1 = mock(DataCenter.class); + when(z1.getId()).thenReturn(30L); + DataCenter z2 = mock(DataCenter.class); + when(z2.getId()).thenReturn(40L); + + when(em.findByUuid(DataCenter.class, "zone-1")).thenReturn(z1); + when(em.findByUuid(DataCenter.class, "zone-2")).thenReturn(z2); + + List ids = cmd.resolveZoneIds("zone-1, all, zone-2", null, null, "service"); + Assert.assertEquals(Arrays.asList(30L, 40L), ids); + } + + @Test + public void resolveZoneIds_invalidUuid_throws() throws Exception { + TestCmd cmd = new TestCmd(); + + EntityManager em = mock(EntityManager.class); + setEntityMgr(cmd, em); + + when(em.findByUuid(DataCenter.class, "bad-zone")).thenReturn(null); + + Assert.assertThrows(InvalidParameterValueException.class, + () -> cmd.resolveZoneIds("bad-zone", null, null, "offering")); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java index f100822b8c77..cd0390aa2689 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.test; +import com.cloud.exception.ResourceAllocationException; import junit.framework.Assert; import junit.framework.TestCase; @@ -149,6 +150,8 @@ public void testExecuteForNullAccountNameEmail() { addAccountToProjectCmd.execute(); } catch (InvalidParameterValueException exception) { Assert.assertEquals("Either accountName or email is required", exception.getLocalizedMessage()); + } catch (ResourceAllocationException exception) { + Assert.fail(); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java index 8b933534cea2..89693f0d0675 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java @@ -111,7 +111,7 @@ public void testCreateFailure() { try { addVpnUserCmd.create(); } catch (ServerApiException exception) { - Assert.assertEquals("Failed to add vpn user", exception.getDescription()); + Assert.assertEquals("Failed to add VPN User", exception.getDescription()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java index b459b1a358cc..8e48cb16a3b4 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateAutoScaleVmProfileCmdTest.java @@ -122,7 +122,7 @@ public void verifyCreateAutoScaleVmProfileCmd() { Assert.assertEquals("autoscalevmprofileresponse", createAutoScaleVmProfileCmd.getCommandName()); Assert.assertEquals("autoscalevmprofile", CreateAutoScaleVmProfileCmd.getResultObjectName()); Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_CREATE, createAutoScaleVmProfileCmd.getEventType()); - Assert.assertEquals("creating AutoScale Vm Profile", createAutoScaleVmProfileCmd.getEventDescription()); + Assert.assertEquals("Creating AutoScale Instance Profile", createAutoScaleVmProfileCmd.getEventDescription()); Assert.assertEquals(ApiCommandResourceType.AutoScaleVmProfile, createAutoScaleVmProfileCmd.getApiResourceType()); } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/CreateSnapshotCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateSnapshotCmdTest.java index 34baebe52574..032dca8d8007 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/CreateSnapshotCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/CreateSnapshotCmdTest.java @@ -25,11 +25,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotCmd; import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.context.CallContext; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -73,11 +75,6 @@ public Long getVolumeId(){ public long getEntityOwnerId(){ return 1L; } - - @Override - protected String getVolumeUuid() { - return "123"; - } }; } @@ -93,7 +90,7 @@ public void testCreateSuccess() { Snapshot snapshot = Mockito.mock(Snapshot.class); try { Mockito.when(volumeApiService.takeSnapshot(nullable(Long.class), nullable(Long.class), isNull(), - nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), nullable(Map.class), nullable(List.class))).thenReturn(snapshot); + nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), nullable(Map.class), nullable(List.class), nullable(List.class), Mockito.anyBoolean())).thenReturn(snapshot); } catch (Exception e) { Assert.fail("Received exception when success expected " + e.getMessage()); @@ -121,12 +118,15 @@ public void testCreateFailure() { AccountService accountService = Mockito.mock(AccountService.class); Account account = Mockito.mock(Account.class); Mockito.when(accountService.getAccount(anyLong())).thenReturn(account); + String volumeUuid = UUID.randomUUID().toString(); + + CallContext.current().putApiResourceUuid("volumeid", volumeUuid); VolumeApiService volumeApiService = Mockito.mock(VolumeApiService.class); try { Mockito.when(volumeApiService.takeSnapshot(nullable(Long.class), nullable(Long.class), nullable(Long.class), - nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), any(), Mockito.anyList())).thenReturn(null); + nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), any(), Mockito.anyList(), Mockito.anyList(), Mockito.anyBoolean())).thenReturn(null); } catch (Exception e) { Assert.fail("Received exception when success expected " + e.getMessage()); } @@ -137,7 +137,7 @@ public void testCreateFailure() { try { createSnapshotCmd.execute(); } catch (ServerApiException exception) { - Assert.assertEquals("Failed to create snapshot due to an internal error creating snapshot for volume 123", exception.getDescription()); + Assert.assertEquals("Failed to create Snapshot due to an internal error creating Snapshot for volume " + volumeUuid, exception.getDescription()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java index 3ed1d9389d42..1150c40ba488 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java @@ -78,10 +78,6 @@ public void testCreateSuccess() { scaleVMCmd._responseGenerator = responseGenerator; UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class); - //List list = Mockito.mock(UserVmResponse.class); - //list.add(userVmResponse); - //LinkedList mockedList = Mockito.mock(LinkedList.class); - //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse); List list = new LinkedList(); list.add(userVmResponse); @@ -111,7 +107,7 @@ public void testCreateFailure() { try { scaleVMCmd.execute(); } catch (ServerApiException exception) { - Assert.assertEquals("Failed to scale vm", exception.getDescription()); + Assert.assertEquals("Failed to scale Instance", exception.getDescription()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java index bf387e8216e8..3409ce053a9f 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateAutoScaleVmProfileCmdTest.java @@ -100,7 +100,7 @@ public void verifyUpdateAutoScaleVmProfileCmd() { Assert.assertEquals("updateautoscalevmprofileresponse", updateAutoScaleVmProfileCmd.getCommandName()); Assert.assertEquals(EventTypes.EVENT_AUTOSCALEVMPROFILE_UPDATE, updateAutoScaleVmProfileCmd.getEventType()); - Assert.assertEquals("Updating AutoScale Vm Profile. Vm Profile Id: " + profileId, updateAutoScaleVmProfileCmd.getEventDescription()); + Assert.assertEquals("Updating AutoScale Instance Profile with ID: " + profileId, updateAutoScaleVmProfileCmd.getEventDescription()); } @Test diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java index 7d6f8dc35b7e..c78dbe9b56bc 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateConditionCmdTest.java @@ -31,12 +31,15 @@ import org.apache.cloudstack.api.command.user.autoscale.UpdateConditionCmd; import org.apache.cloudstack.api.response.ConditionResponse; +import org.apache.cloudstack.context.CallContext; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + import static org.mockito.Mockito.when; public class UpdateConditionCmdTest { @@ -53,6 +56,7 @@ public class UpdateConditionCmdTest { private static final Long threshold = 100L; private static final long accountId = 5L; + private static final String conditionUuid = UUID.randomUUID().toString(); @Before public void setUp() { @@ -71,6 +75,8 @@ public void setUp() { ReflectionTestUtils.setField(updateConditionCmd,"relationalOperator", relationalOperator); ReflectionTestUtils.setField(updateConditionCmd,"threshold", threshold); + CallContext.current().putApiResourceUuid("id", conditionUuid); + condition = Mockito.mock(Condition.class); } @@ -83,7 +89,7 @@ public void verifyUpdateConditionCmd() { Assert.assertEquals(ApiCommandResourceType.Condition, updateConditionCmd.getApiResourceType()); Assert.assertEquals("updateconditionresponse", updateConditionCmd.getCommandName()); Assert.assertEquals(EventTypes.EVENT_CONDITION_UPDATE, updateConditionCmd.getEventType()); - Assert.assertEquals("Updating a condition.", updateConditionCmd.getEventDescription()); + Assert.assertEquals("Updating Instance AutoScale condition with ID: " + conditionUuid, updateConditionCmd.getEventDescription()); when(entityMgr.findById(Condition.class, conditionId)).thenReturn(condition); when(condition.getAccountId()).thenReturn(accountId); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateVmNicIpTest.java b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateVmNicIpTest.java index 9a42aa1fbc00..8727bab6f105 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateVmNicIpTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/test/UpdateVmNicIpTest.java @@ -84,7 +84,7 @@ public void testFailure() throws ResourceAllocationException, ResourceUnavailabl try { updateVmNicIpCmd.execute(); } catch (ServerApiException exception) { - Assert.assertEquals("Failed to update ip address on vm NIC. Refer to server logs for details.", exception.getDescription()); + Assert.assertEquals("Failed to update IP address on Instance NIC. Refer to server logs for details.", exception.getDescription()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmdTest.java new file mode 100644 index 000000000000..a0d88bbc84e9 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmdTest.java @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.backup; + +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.response.BackupScheduleResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.BackupSchedule; +import org.apache.cloudstack.context.CallContext; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.ArrayList; +import java.util.List; + +@RunWith(MockitoJUnitRunner.class) +public class ListBackupScheduleCmdTest { + + @Mock + private BackupManager backupManager; + + @Mock + private ResponseGenerator responseGenerator; + + private ListBackupScheduleCmd cmd; + + @Before + public void setUp() { + cmd = new ListBackupScheduleCmd(); + cmd.backupManager = backupManager; + cmd._responseGenerator = responseGenerator; + } + + @Test + public void testExecuteWithSchedules() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, NetworkRuleConflictException { + BackupSchedule schedule = Mockito.mock(BackupSchedule.class); + BackupScheduleResponse scheduleResponse = Mockito.mock(BackupScheduleResponse.class); + List schedules = new ArrayList<>(); + schedules.add(schedule); + + Mockito.when(backupManager.listBackupSchedules(cmd)).thenReturn(schedules); + Mockito.when(responseGenerator.createBackupScheduleResponse(schedule)).thenReturn(scheduleResponse); + + Account mockAccount = Mockito.mock(Account.class); + CallContext callContext = Mockito.mock(CallContext.class); + try (org.mockito.MockedStatic mocked = Mockito.mockStatic(CallContext.class)) { + cmd.execute(); + } + + ListResponse response = (ListResponse) cmd.getResponseObject(); + Assert.assertNotNull(response); + Assert.assertEquals(1, response.getResponses().size()); + Assert.assertEquals(scheduleResponse, response.getResponses().get(0)); + } + + @Test + public void testExecuteWithNoSchedules() { + Mockito.when(backupManager.listBackupSchedules(cmd)).thenReturn(new ArrayList<>()); + CallContext callContext = Mockito.mock(CallContext.class); + + try (org.mockito.MockedStatic mocked = Mockito.mockStatic(CallContext.class)) { + mocked.when(CallContext::current).thenReturn(callContext); + cmd.execute(); + } catch (ResourceUnavailableException | InsufficientCapacityException | ResourceAllocationException | + NetworkRuleConflictException e) { + throw new RuntimeException(e); + } + + ListResponse response = (ListResponse) cmd.getResponseObject(); + Assert.assertNotNull(response); + Assert.assertEquals(0, response.getResponses().size()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmdTest.java new file mode 100644 index 000000000000..47bef14bb615 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmdTest.java @@ -0,0 +1,124 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.import org.apache.cloudstack.context.CallContext; +package org.apache.cloudstack.api.command.user.consoleproxy; + +import org.apache.cloudstack.consoleproxy.ConsoleSession; +import com.cloud.user.AccountService; + +import com.cloud.user.UserAccount; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.consoleproxy.ConsoleAccessManager; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class ListConsoleSessionsCmdTest { + @Mock + private AccountService accountServiceMock; + + @Mock + private ConsoleAccessManager consoleAccessManagerMock; + + @Spy + @InjectMocks + private ListConsoleSessionsCmd listConsoleSessionsCmdSpy; + + @Test + public void executeTestApiExecutionShouldCallServiceLayer() { + Mockito.when(consoleAccessManagerMock.listConsoleSessions(listConsoleSessionsCmdSpy)).thenReturn(new ListResponse<>()); + listConsoleSessionsCmdSpy.execute(); + Mockito.verify(consoleAccessManagerMock).listConsoleSessions(listConsoleSessionsCmdSpy); + } + + @Test + public void getEntityOwnerIdTestReturnConsoleSessionIdIfProvided() { + ConsoleSession consoleSessionMock = Mockito.mock(ConsoleSession.class); + long consoleSessionId = 2L; + long accountId = 2L; + + Mockito.when(listConsoleSessionsCmdSpy.getId()).thenReturn(consoleSessionId); + Mockito.when(consoleAccessManagerMock.listConsoleSessionById(consoleSessionId)).thenReturn(consoleSessionMock); + Mockito.when(consoleSessionMock.getAccountId()).thenReturn(accountId); + + Assert.assertEquals(accountId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } + + @Test + public void getEntityOwnerIdTestReturnAccountIdWhenNoConsoleSessionIdIsProvided() { + long accountId = 2L; + + Mockito.when(listConsoleSessionsCmdSpy.getId()).thenReturn(null); + Mockito.when(listConsoleSessionsCmdSpy.getAccountId()).thenReturn(accountId); + + Assert.assertEquals(accountId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } + + @Test + public void getEntityOwnerIdTestReturnUserIdWhenNoConsoleSessionIdAndAccountIdAreProvided() { + UserAccount userAccountMock = Mockito.mock(UserAccount.class); + long userId = 2L; + + Mockito.when(listConsoleSessionsCmdSpy.getId()).thenReturn(null); + Mockito.when(listConsoleSessionsCmdSpy.getAccountId()).thenReturn(null); + Mockito.when(listConsoleSessionsCmdSpy.getUserId()).thenReturn(userId); + Mockito.when(accountServiceMock.getUserAccountById(userId)).thenReturn(userAccountMock); + Mockito.when(userAccountMock.getAccountId()).thenReturn(userId); + + Assert.assertEquals(userId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } + + @Test + public void getEntityOwnerIdTestReturnSystemAccountIdWhenNoConsoleSessionIdAndAccountIdAndUserIdAreProvided() { + long systemAccountId = 1L; + + Mockito.when(listConsoleSessionsCmdSpy.getId()).thenReturn(null); + Mockito.when(listConsoleSessionsCmdSpy.getAccountId()).thenReturn(null); + Mockito.when(listConsoleSessionsCmdSpy.getUserId()).thenReturn(null); + + Assert.assertEquals(systemAccountId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } + + @Test + public void getEntityOwnerIdTestReturnSystemAccountIdWhenConsoleSessionDoesNotExist() { + long consoleSessionId = 2L; + long systemAccountId = 1L; + + Mockito.when(listConsoleSessionsCmdSpy.getId()).thenReturn(consoleSessionId); + Mockito.when(consoleAccessManagerMock.listConsoleSessionById(consoleSessionId)).thenReturn(null); + + Assert.assertEquals(systemAccountId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } + + @Test + public void getEntityOwnerIdTestReturnSystemAccountIdWhenUserAccountDoesNotExist() { + long userId = 2L; + long systemAccountId = 1L; + + Mockito.when(listConsoleSessionsCmdSpy.getUserId()).thenReturn(userId); + Mockito.when(accountServiceMock.getUserAccountById(userId)).thenReturn(null); + + Assert.assertEquals(systemAccountId, listConsoleSessionsCmdSpy.getEntityOwnerId()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmdTest.java new file mode 100644 index 000000000000..54e726eadbe0 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuCardsCmdTest.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.user.gpu; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + + +public class ListGpuCardsCmdTest { + + @Test + public void getId() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + Assert.assertEquals(id, cmd.getId()); + } + + @Test + public void getVendorName() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertNull(cmd.getVendorName()); + String vendorName = "vendor name"; + ReflectionTestUtils.setField(cmd, "vendorName", vendorName); + Assert.assertEquals(vendorName, cmd.getVendorName()); + } + + @Test + public void getVendorId() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertNull(cmd.getVendorId()); + String vendorId = "vendor id"; + ReflectionTestUtils.setField(cmd, "vendorId", vendorId); + Assert.assertEquals(vendorId, cmd.getVendorId()); + } + + @Test + public void getDeviceId() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertNull(cmd.getDeviceId()); + String deviceId = "device id"; + ReflectionTestUtils.setField(cmd, "deviceId", deviceId); + Assert.assertEquals(deviceId, cmd.getDeviceId()); + } + + @Test + public void getDeviceName() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertNull(cmd.getDeviceName()); + String deviceName = "device name"; + ReflectionTestUtils.setField(cmd, "deviceName", deviceName); + Assert.assertEquals(deviceName, cmd.getDeviceName()); + } + + @Test + public void getActiveOnly() { + ListGpuCardsCmd cmd = new ListGpuCardsCmd(); + Assert.assertFalse(cmd.getActiveOnly()); + Boolean activeOnly = true; + ReflectionTestUtils.setField(cmd, "activeOnly", activeOnly); + Assert.assertEquals(activeOnly, cmd.getActiveOnly()); + } +} diff --git a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/BackupOfferingTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmdTest.java similarity index 63% rename from framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/BackupOfferingTest.java rename to api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmdTest.java index 57c18f936f2d..e1a65ee0ece3 100644 --- a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/BackupOfferingTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListGpuDevicesCmdTest.java @@ -17,20 +17,20 @@ * under the License. */ -package org.apache.cloudstack.quota.activationrule.presetvariables; +package org.apache.cloudstack.api.command.user.gpu; import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +public class ListGpuDevicesCmdTest { -@RunWith(MockitoJUnitRunner.class) -public class BackupOfferingTest { @Test - public void setExternalIdTestAddFieldExternalIdToCollection() { - BackupOffering backupOffering = new BackupOffering(); - backupOffering.setExternalId("any-external-id"); - Assert.assertTrue(backupOffering.fieldNamesToIncludeInToString.contains("externalId")); + public void getVmId() { + ListGpuDevicesCmd cmd = new ListGpuDevicesCmd(); + Assert.assertNull(cmd.getVmId()); + Long vmId = 1L; + ReflectionTestUtils.setField(cmd, "vmId", vmId); + Assert.assertEquals(vmId, cmd.getVmId()); } - } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmdTest.java new file mode 100644 index 000000000000..7616abd1f8d5 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/gpu/ListVgpuProfilesCmdTest.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cloudstack.api.command.user.gpu; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.test.util.ReflectionTestUtils; + +public class ListVgpuProfilesCmdTest { + + @Test + public void getId() { + ListVgpuProfilesCmd cmd = new ListVgpuProfilesCmd(); + Assert.assertNull(cmd.getId()); + Long id = 1L; + ReflectionTestUtils.setField(cmd, "id", id); + Assert.assertEquals(id, cmd.getId()); + } + + @Test + public void getName() { + ListVgpuProfilesCmd cmd = new ListVgpuProfilesCmd(); + Assert.assertNull(cmd.getName()); + String name = "Test VGPU Profile"; + ReflectionTestUtils.setField(cmd, "name", name); + Assert.assertEquals(name, cmd.getName()); + } + + @Test + public void getCardId() { + ListVgpuProfilesCmd cmd = new ListVgpuProfilesCmd(); + Assert.assertNull(cmd.getCardId()); + Long cardId = 1L; + ReflectionTestUtils.setField(cmd, "cardId", cardId); + Assert.assertEquals(cardId, cmd.getCardId()); + } + + @Test + public void getActiveOnly() { + ListVgpuProfilesCmd cmd = new ListVgpuProfilesCmd(); + Assert.assertFalse(cmd.getActiveOnly()); + Boolean activeOnly = true; + ReflectionTestUtils.setField(cmd, "activeOnly", activeOnly); + Assert.assertEquals(activeOnly, cmd.getActiveOnly()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmdTest.java new file mode 100644 index 000000000000..f417dc5f876c --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmdTest.java @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.guest; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import com.cloud.cpu.CPU; + +@RunWith(MockitoJUnitRunner.class) +public class ListGuestOsCategoriesCmdTest { + + @Test + public void testIsFeatured() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertNull(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", false); + Assert.assertFalse(cmd.isFeatured()); + ReflectionTestUtils.setField(cmd, "featured", true); + Assert.assertTrue(cmd.isFeatured()); + } + + @Test + public void testIsIso() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertNull(cmd.isIso()); + ReflectionTestUtils.setField(cmd, "iso", false); + Assert.assertFalse(cmd.isIso()); + ReflectionTestUtils.setField(cmd, "iso", true); + Assert.assertTrue(cmd.isIso()); + } + + @Test + public void testIsVnf() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertNull(cmd.isVnf()); + ReflectionTestUtils.setField(cmd, "vnf", false); + Assert.assertFalse(cmd.isVnf()); + ReflectionTestUtils.setField(cmd, "vnf", true); + Assert.assertTrue(cmd.isVnf()); + } + + @Test + public void testGetZoneId() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertNull(cmd.getZoneId()); + Long zoneId = 100L; + ReflectionTestUtils.setField(cmd, "zoneId", zoneId); + Assert.assertEquals(zoneId, cmd.getZoneId()); + } + + @Test + public void testGetArch() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertNull(cmd.getArch()); + CPU.CPUArch arch = CPU.CPUArch.getDefault(); + ReflectionTestUtils.setField(cmd, "arch", arch.getType()); + Assert.assertEquals(arch, cmd.getArch()); + } + + @Test + public void testIsShowIcon() { + ListGuestOsCategoriesCmd cmd = new ListGuestOsCategoriesCmd(); + Assert.assertFalse(cmd.isShowIcon()); + ReflectionTestUtils.setField(cmd, "showIcon", false); + Assert.assertFalse(cmd.isShowIcon()); + ReflectionTestUtils.setField(cmd, "showIcon", true); + Assert.assertTrue(cmd.isShowIcon()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmdTest.java index 415ee01ba168..c42a7882c545 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmdTest.java @@ -41,7 +41,10 @@ public class UpdateNetworkCmdTest { NetworkService networkService; @Mock public EntityManager _entityMgr; - private ResponseGenerator responseGenerator; + @Mock + private ResponseGenerator _responseGenerator; + @Mock + private Object job; @InjectMocks UpdateNetworkCmd cmd = new UpdateNetworkCmd(); @@ -176,15 +179,13 @@ public void testExecute() throws InsufficientCapacityException { ReflectionTestUtils.setField(cmd, "id", networkId); ReflectionTestUtils.setField(cmd, "publicMtu", publicmtu); Network network = Mockito.mock(Network.class); - responseGenerator = Mockito.mock(ResponseGenerator.class); NetworkResponse response = Mockito.mock(NetworkResponse.class); response.setPublicMtu(publicmtu); Mockito.when(networkService.getNetwork(networkId)).thenReturn(network); Mockito.when(networkService.updateGuestNetwork(cmd)).thenReturn(network); - cmd._responseGenerator = responseGenerator; - Mockito.when(responseGenerator.createNetworkResponse(ResponseObject.ResponseView.Restricted, network)).thenReturn(response); + Mockito.when(_responseGenerator.createNetworkResponse(ResponseObject.ResponseView.Restricted, network)).thenReturn(response); cmd.execute(); - Mockito.verify(responseGenerator).createNetworkResponse(Mockito.any(ResponseObject.ResponseView.class), Mockito.any(Network.class)); + Mockito.verify(_responseGenerator).createNetworkResponse(Mockito.any(ResponseObject.ResponseView.class), Mockito.any(Network.class)); NetworkResponse actualResponse = (NetworkResponse) cmd.getResponseObject(); Assert.assertEquals(response, actualResponse); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmdTest.java index 2b55d4c6a58d..dbe7669431d8 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/network/routing/DeleteRoutingFirewallRuleCmdTest.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.junit.Assert; import org.junit.Test; @@ -31,6 +32,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; +import java.util.UUID; + import static org.junit.Assert.assertEquals; @RunWith(MockitoJUnitRunner.class) @@ -46,6 +49,7 @@ public void testProperties() { ReflectionTestUtils.setField(cmd, "_firewallService", _firewallService); long id = 1L; + String uuid = UUID.randomUUID().toString(); long accountId = 2L; long networkId = 3L; @@ -55,12 +59,14 @@ public void testProperties() { Mockito.when(_firewallService.getFirewallRule(id)).thenReturn(firewallRule); ReflectionTestUtils.setField(cmd, "id", id); + CallContext.current().putApiResourceUuid("id", uuid); + assertEquals(id, (long) cmd.getId()); assertEquals(accountId, cmd.getEntityOwnerId()); assertEquals(networkId, (long) cmd.getApiResourceId()); assertEquals(ApiCommandResourceType.Network, cmd.getApiResourceType()); assertEquals(EventTypes.EVENT_ROUTING_IPV4_FIREWALL_RULE_DELETE, cmd.getEventType()); - assertEquals(String.format("Deleting ipv4 routing firewall rule ID=%s", id), cmd.getEventDescription()); + assertEquals(String.format("Deleting IPv4 routing firewall rule with ID: %s", uuid), cmd.getEventDescription()); } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmdTest.java index 632496ad2151..db27cc76ec9f 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/CopySnapshotCmdTest.java @@ -87,7 +87,12 @@ public void testGetDestZoneIdWithBothParams() { @Test (expected = ServerApiException.class) public void testExecuteWrongNoParams() { + UUIDManager uuidManager = Mockito.mock(UUIDManager.class); + SnapshotApiService snapshotApiService = Mockito.mock(SnapshotApiService.class); final CopySnapshotCmd cmd = new CopySnapshotCmd(); + cmd._uuidMgr = uuidManager; + cmd._snapshotService = snapshotApiService; + try { cmd.execute(); } catch (ResourceUnavailableException e) { diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmdTest.java new file mode 100644 index 000000000000..36cfcf5cb9a5 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmdTest.java @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.snapshot; + +import com.cloud.storage.snapshot.SnapshotApiService; +import com.cloud.storage.snapshot.SnapshotPolicy; +import com.cloud.utils.Pair; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.SnapshotPolicyResponse; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.ArrayList; +import java.util.List; + +public class ListSnapshotPoliciesCmdTest { + private ListSnapshotPoliciesCmd cmd; + private SnapshotApiService snapshotService; + private ResponseGenerator responseGenerator; + + @Before + public void setUp() { + cmd = new ListSnapshotPoliciesCmd(); + snapshotService = Mockito.mock(SnapshotApiService.class); + responseGenerator = Mockito.mock(ResponseGenerator.class); + + cmd._snapshotService = snapshotService; + cmd._responseGenerator = responseGenerator; + } + + @Test + public void testExecuteWithPolicies() { + SnapshotPolicy policy = Mockito.mock(SnapshotPolicy.class); + SnapshotPolicyResponse policyResponse = Mockito.mock(SnapshotPolicyResponse.class); + List policies = new ArrayList<>(); + policies.add(policy); + + Mockito.when(snapshotService.listSnapshotPolicies(cmd)) + .thenReturn(new Pair<>(policies, 1)); + Mockito.when(responseGenerator.createSnapshotPolicyResponse(policy)) + .thenReturn(policyResponse); + + cmd.execute(); + + ListResponse response = (ListResponse) cmd.getResponseObject(); + Assert.assertNotNull(response); + Assert.assertEquals(1, response.getResponses().size()); + Assert.assertEquals(policyResponse, response.getResponses().get(0)); + } + + @Test + public void testExecuteWithNoPolicies() { + Mockito.when(snapshotService.listSnapshotPolicies(cmd)) + .thenReturn(new Pair<>(new ArrayList<>(), 0)); + + cmd.execute(); + + ListResponse response = (ListResponse) cmd.getResponseObject(); + Assert.assertNotNull(response); + Assert.assertTrue(response.getResponses().isEmpty()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmdTest.java index 3f47a078445c..8b7db2924629 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/ListUserDataCmdTest.java @@ -68,7 +68,7 @@ public void testListSuccess() { Pair, Integer> result = new Pair, Integer>(userDataList, 1); UserDataResponse userDataResponse = Mockito.mock(UserDataResponse.class); - Mockito.when(_mgr.listUserDatas(cmd)).thenReturn(result); + Mockito.when(_mgr.listUserDatas(cmd, false)).thenReturn(result); Mockito.when(_responseGenerator.createUserDataResponse(userData)).thenReturn(userDataResponse); cmd.execute(); @@ -82,7 +82,7 @@ public void testEmptyList() { List userDataList = new ArrayList(); Pair, Integer> result = new Pair, Integer>(userDataList, 0); - Mockito.when(_mgr.listUserDatas(cmd)).thenReturn(result); + Mockito.when(_mgr.listUserDatas(cmd, false)).thenReturn(result); cmd.execute(); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmdTest.java index e9605526f86f..8fac32d8f92f 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/userdata/RegisterUserDataCmdTest.java @@ -97,7 +97,7 @@ public void validateArgsCmd() { ReflectionTestUtils.setField(cmd, "name", "testUserdataName"); ReflectionTestUtils.setField(cmd, "userData", "testUserdata"); - when(_accountService.finalyzeAccountId(ACCOUNT_NAME, DOMAIN_ID, PROJECT_ID, true)).thenReturn(200L); + when(_accountService.finalizeAccountId(ACCOUNT_NAME, DOMAIN_ID, PROJECT_ID, true)).thenReturn(200L); Assert.assertEquals("testUserdataName", cmd.getName()); Assert.assertEquals("testUserdata", cmd.getUserData()); diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmdTest.java new file mode 100644 index 000000000000..09d396e40237 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmdTest.java @@ -0,0 +1,627 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.vm; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiConstants.BootMode; +import org.apache.cloudstack.api.ApiConstants.BootType; +import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy; +import org.apache.cloudstack.vm.lease.VMLeaseManager; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.test.util.ReflectionTestUtils; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.NetworkService; +import com.cloud.utils.db.EntityManager; +import com.cloud.vm.VmDetailConstants; +import com.cloud.network.Network; +import com.cloud.template.VirtualMachineTemplate; +import com.cloud.offering.DiskOffering; +import com.cloud.network.Network.IpAddresses; +import com.cloud.vm.VmDiskInfo; + +@RunWith(MockitoJUnitRunner.class) +public class DeployVMCmdTest { + + @Spy + private DeployVMCmd cmd = new DeployVMCmd(); + + @Test + public void testGetBootType_ValidUEFI() { + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + + BootType result = cmd.getBootType(); + + assertEquals(BootType.UEFI, result); + } + + @Test + public void testGetBootTypeValidBIOS() { + ReflectionTestUtils.setField(cmd, "bootType", "BIOS"); + + BootType result = cmd.getBootType(); + + assertEquals(BootType.BIOS, result); + } + + @Test + public void testGetBootTypeInvalidValue() { + ReflectionTestUtils.setField(cmd, "bootType", "INVALID"); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getBootType(); + }); + assertTrue(thrownException.getMessage().contains("Invalid bootType INVALID")); + } + + @Test + public void testGetBootTypeNullValue() { + ReflectionTestUtils.setField(cmd, "bootType", null); + + BootType result = cmd.getBootType(); + + assertNull(result); + } + + @Test + public void testGetBootModeValidSecure() { + ReflectionTestUtils.setField(cmd, "bootMode", "SECURE"); + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + + BootMode result = cmd.getBootMode(); + + assertEquals(BootMode.SECURE, result); + } + + @Test + public void testGetBootModeValidLegacy() { + ReflectionTestUtils.setField(cmd, "bootMode", "LEGACY"); + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + + BootMode result = cmd.getBootMode(); + + assertEquals(BootMode.LEGACY, result); + } + + @Test + public void testGetBootModeInvalidValue() { + ReflectionTestUtils.setField(cmd, "bootMode", "INVALID"); + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getBootMode(); + }); + assertTrue(thrownException.getMessage().contains("Invalid bootmode: INVALID specified for VM: null. Valid values are: [LEGACY, SECURE]")); + } + + @Test + public void testGetBootModeUEFIWithoutBootMode() { + ReflectionTestUtils.setField(cmd, "bootMode", null); + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getBootMode(); + }); + assertTrue(thrownException.getMessage().contains("bootmode must be specified for the VM with boot type: UEFI. Valid values are: [LEGACY, SECURE]")); + } + + @Test + public void testGetDetails() { + ReflectionTestUtils.setField(cmd, "bootType", "UEFI"); + ReflectionTestUtils.setField(cmd, "bootMode", "SECURE"); + ReflectionTestUtils.setField(cmd, "rootdisksize", 100L); + ReflectionTestUtils.setField(cmd, "ioDriverPolicy", "native"); + ReflectionTestUtils.setField(cmd, "iothreadsEnabled", true); + ReflectionTestUtils.setField(cmd, "nicMultiqueueNumber", null); + ReflectionTestUtils.setField(cmd, "nicPackedVirtQueues", null); + ReflectionTestUtils.setField(cmd, "details", new HashMap<>()); + + Map result = cmd.getDetails(); + + assertEquals("SECURE", result.get("UEFI")); + assertEquals("100", result.get(VmDetailConstants.ROOT_DISK_SIZE)); + assertEquals("native", result.get(VmDetailConstants.IO_POLICY)); + assertEquals("true", result.get(VmDetailConstants.IOTHREADS)); + } + + @Test + public void testGetLeaseExpiryActionValidStop() { + ReflectionTestUtils.setField(cmd, "leaseExpiryAction", "STOP"); + + VMLeaseManager.ExpiryAction result = cmd.getLeaseExpiryAction(); + + assertEquals(VMLeaseManager.ExpiryAction.STOP, result); + } + + @Test + public void testGetLeaseExpiryActionValidDestroy() { + ReflectionTestUtils.setField(cmd, "leaseExpiryAction", "DESTROY"); + + VMLeaseManager.ExpiryAction result = cmd.getLeaseExpiryAction(); + + assertEquals(VMLeaseManager.ExpiryAction.DESTROY, result); + } + + @Test + public void testGetLeaseExpiryActionInvalidValue() { + ReflectionTestUtils.setField(cmd, "leaseExpiryAction", "INVALID"); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getLeaseExpiryAction(); + }); + assertTrue(thrownException.getMessage().contains("Invalid value configured for leaseexpiryaction")); + } + + @Test + public void testGetLeaseExpiryActionNullValue() { + ReflectionTestUtils.setField(cmd, "leaseExpiryAction", null); + + VMLeaseManager.ExpiryAction result = cmd.getLeaseExpiryAction(); + + assertNull(result); + } + + @Test + public void testGetIoDriverPolicyValidThrottle() { + ReflectionTestUtils.setField(cmd, "ioDriverPolicy", "native"); + + IoDriverPolicy result = cmd.getIoDriverPolicy(); + + assertEquals(IoDriverPolicy.valueOf("NATIVE"), result); + } + + @Test + public void testGetIoDriverPolicyInvalidValue() { + ReflectionTestUtils.setField(cmd, "ioDriverPolicy", "INVALID"); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getIoDriverPolicy(); + }); + assertTrue(thrownException.getMessage().contains("Invalid io policy INVALID")); + } + + @Test + public void testGetNetworkIds() { + List networkIds = Arrays.asList(1L, 2L, 3L); + ReflectionTestUtils.setField(cmd, "networkIds", networkIds); + ReflectionTestUtils.setField(cmd, "vAppNetworks", null); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", null); + + List result = cmd.getNetworkIds(); + + assertEquals(networkIds, result); + } + + @Test + public void testGetNetworkIdsVAppNetworks() { + Map vAppNetworks = new HashMap<>(); + vAppNetworks.put("network1", new HashMap()); + ReflectionTestUtils.setField(cmd, "vAppNetworks", vAppNetworks); + ReflectionTestUtils.setField(cmd, "networkIds", null); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", null); + ReflectionTestUtils.setField(cmd, "ipAddress", null); + ReflectionTestUtils.setField(cmd, "ip6Address", null); + + List result = cmd.getNetworkIds(); + + assertTrue(result.isEmpty()); + } + + @Test + public void testGetNetworkIdsVAppNetworksAndNetworkIds() { + Map vAppNetworks = new HashMap<>(); + vAppNetworks.put("network1", new HashMap()); + ReflectionTestUtils.setField(cmd, "vAppNetworks", vAppNetworks); + ReflectionTestUtils.setField(cmd, "networkIds", Arrays.asList(1L, 2L)); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getNetworkIds(); + }); + assertTrue(thrownException.getMessage().contains("nicnetworklist can't be specified along with networkids")); + } + + @Test + public void testGetNetworkIdsIpToNetworkListAndNetworkIds() { + Map ipToNetworkList = new HashMap<>(); + ipToNetworkList.put("0", new HashMap()); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", ipToNetworkList); + ReflectionTestUtils.setField(cmd, "networkIds", Arrays.asList(1L, 2L)); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getNetworkIds(); + }); + assertTrue(thrownException.getMessage().contains("ipToNetworkMap can't be specified along with networkIds or ipAddress")); + } + + @Test + public void testGetIpToNetworkMap_WithNetworkIds() { + ReflectionTestUtils.setField(cmd, "networkIds", Arrays.asList(1L, 2L)); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", new HashMap<>()); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getIpToNetworkMap(); + }); + assertTrue(thrownException.getMessage().contains("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter")); + } + + @Test + public void testGetIpToNetworkMap_WithIpAddress() { + ReflectionTestUtils.setField(cmd, "ipAddress", "192.168.1.1"); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", new HashMap<>()); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getIpToNetworkMap(); + }); + assertTrue(thrownException.getMessage().contains("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter")); + } + + @Test + public void testGetIpToNetworkMap_WithEmptyIpToNetworkList() { + ReflectionTestUtils.setField(cmd, "networkIds", null); + ReflectionTestUtils.setField(cmd, "ipAddress", null); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", new HashMap<>()); + + Map result = cmd.getIpToNetworkMap(); + + assertNull(result); + } + + @Test + public void testGetIpToNetworkMap_WithNullIpToNetworkList() { + ReflectionTestUtils.setField(cmd, "networkIds", null); + ReflectionTestUtils.setField(cmd, "ipAddress", null); + ReflectionTestUtils.setField(cmd, "ipToNetworkList", null); + + Map result = cmd.getIpToNetworkMap(); + + assertNull(result); + } + + @Test + public void testGetDataDiskInfoList() { + Map dataDisksDetails = new HashMap<>(); + Map dataDisk = new HashMap<>(); + dataDisk.put(ApiConstants.DISK_OFFERING_ID, "offering-uuid"); + dataDisk.put(ApiConstants.DEVICE_ID, "0"); + dataDisk.put(ApiConstants.MIN_IOPS, "1000"); + dataDisk.put(ApiConstants.MAX_IOPS, "2000"); + dataDisksDetails.put("0", dataDisk); + + ReflectionTestUtils.setField(cmd, "dataDisksDetails", dataDisksDetails); + + EntityManager entityMgr = mock(EntityManager.class); + ReflectionTestUtils.setField(cmd, "_entityMgr", entityMgr); + DiskOffering diskOffering = mock(DiskOffering.class); + when(diskOffering.getDiskSize()).thenReturn(1024 * 1024 * 1024L); + when(diskOffering.isCustomizedIops()).thenReturn(true); + when(entityMgr.findByUuid(DiskOffering.class, "offering-uuid")).thenReturn(diskOffering); + + List result = cmd.getDataDiskInfoList(); + + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(diskOffering, result.get(0).getDiskOffering()); + assertEquals(1L, result.get(0).getSize().longValue()); + assertEquals(1000L, result.get(0).getMinIops().longValue()); + assertEquals(2000L, result.get(0).getMaxIops().longValue()); + } + + @Test + public void testGetIpAddressesFromIpMap() { + Map ipToNetworkList = new HashMap<>(); + Map ipMap = new HashMap<>(); + ipMap.put("ip", "192.168.1.100"); + ipMap.put("mac", "00:11:22:33:44:55"); + ipMap.put("networkid", "1"); + ipToNetworkList.put("0", ipMap); + + ReflectionTestUtils.setField(cmd, "ipToNetworkList", ipToNetworkList); + ReflectionTestUtils.setField(cmd, "networkIds", null); + ReflectionTestUtils.setField(cmd, "ipAddress", null); + + Network mockNetwork = mock(Network.class); + NetworkService networkServiceMock = mock(NetworkService.class); + ReflectionTestUtils.setField(cmd, "_networkService", networkServiceMock); + + Map result = cmd.getIpToNetworkMap(); + + assertNotNull(result); + assertTrue(result.containsKey(1L)); + assertEquals(result.get(1L).getIp4Address(), "192.168.1.100"); + assertEquals(result.get(1L).getMacAddress(), "00:11:22:33:44:55"); + } + + @Test + public void testGetIpAddressesFromIpMapInvalidMac() { + Map ipToNetworkList = new HashMap<>(); + Map ipMap = new HashMap<>(); + ipMap.put("ip", "192.168.1.100"); + ipMap.put("mac", "invalid-mac"); + ipMap.put("networkid", "1"); + ipToNetworkList.put("0", ipMap); + + ReflectionTestUtils.setField(cmd, "ipToNetworkList", ipToNetworkList); + ReflectionTestUtils.setField(cmd, "networkIds", null); + ReflectionTestUtils.setField(cmd, "ipAddress", null); + + Network mockNetwork = mock(Network.class); + NetworkService networkServiceMock = mock(NetworkService.class); + ReflectionTestUtils.setField(cmd, "_networkService", networkServiceMock); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getIpToNetworkMap(); + }); + assertTrue(thrownException.getMessage().contains("Mac address is not valid")); + } + + @Test + public void testGetDhcpOptionsMap() { + Map dhcpOptionsNetworkList = new HashMap<>(); + Map dhcpOptions = new HashMap<>(); + dhcpOptions.put("networkid", "network-1"); + dhcpOptions.put("dhcp:114", "url-value"); + dhcpOptions.put("dhcp:66", "www.test.com"); + dhcpOptionsNetworkList.put("0", dhcpOptions); + + ReflectionTestUtils.setField(cmd, "dhcpOptionsNetworkList", dhcpOptionsNetworkList); + + Map> result = cmd.getDhcpOptionsMap(); + + assertNotNull(result); + assertTrue(result.containsKey("network-1")); + Map networkOptions = result.get("network-1"); + assertEquals("url-value", networkOptions.get(114)); + assertEquals("www.test.com", networkOptions.get(66)); + } + + @Test + public void testGetDhcpOptionsMap_WithMissingNetworkId() { + Map dhcpOptionsNetworkList = new HashMap<>(); + Map dhcpOptions = new HashMap<>(); + dhcpOptions.put("dhcp:114", "url-value"); + dhcpOptionsNetworkList.put("0", dhcpOptions); + + ReflectionTestUtils.setField(cmd, "dhcpOptionsNetworkList", dhcpOptionsNetworkList); + + IllegalArgumentException thrownException = assertThrows(IllegalArgumentException.class, () -> { + cmd.getDhcpOptionsMap(); + }); + assertTrue(thrownException.getMessage().contains("No networkid specified when providing extra dhcp options")); + } + + @Test + public void testGetDataDiskTemplateToDiskOfferingMap() { + ReflectionTestUtils.setField(cmd, "diskOfferingId", null); + + Map dataDiskTemplateToDiskOfferingList = new HashMap<>(); + Map dataDiskTemplate = new HashMap<>(); + dataDiskTemplate.put("datadisktemplateid", "template-uuid"); + dataDiskTemplate.put("diskofferingid", "offering-uuid"); + dataDiskTemplateToDiskOfferingList.put("0", dataDiskTemplate); + + ReflectionTestUtils.setField(cmd, "dataDiskTemplateToDiskOfferingList", dataDiskTemplateToDiskOfferingList); + + VirtualMachineTemplate mockTemplate = mock(VirtualMachineTemplate.class); + when(mockTemplate.getId()).thenReturn(1L); + + DiskOffering mockOffering = mock(DiskOffering.class); + + EntityManager entityMgr = mock(EntityManager.class); + ReflectionTestUtils.setField(cmd, "_entityMgr", entityMgr); + when(entityMgr.findByUuid(VirtualMachineTemplate.class, "template-uuid")).thenReturn(mockTemplate); + when(entityMgr.findByUuid(DiskOffering.class, "offering-uuid")).thenReturn(mockOffering); + + Map result = cmd.getDataDiskTemplateToDiskOfferingMap(); + + assertNotNull(result); + assertEquals(mockOffering, result.get(1L)); + } + + @Test + public void testGetDataDiskTemplateToDiskOfferingMapWithDiskOfferingId() { + ReflectionTestUtils.setField(cmd, "diskOfferingId", 1L); + ReflectionTestUtils.setField(cmd, "dataDiskTemplateToDiskOfferingList", new HashMap<>()); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getDataDiskTemplateToDiskOfferingMap(); + }); + assertTrue(thrownException.getMessage().contains("diskofferingid parameter can't be specified along with datadisktemplatetodiskofferinglist parameter")); + } + + @Test + public void testGetDataDiskTemplateToDiskOfferingMapInvalidTemplateId() { + ReflectionTestUtils.setField(cmd, "diskOfferingId", null); + + Map dataDiskTemplateToDiskOfferingList = new HashMap<>(); + Map dataDiskTemplate = new HashMap<>(); + dataDiskTemplate.put("datadisktemplateid", "invalid-template"); + dataDiskTemplate.put("diskofferingid", "offering-uuid"); + dataDiskTemplateToDiskOfferingList.put("0", dataDiskTemplate); + + ReflectionTestUtils.setField(cmd, "dataDiskTemplateToDiskOfferingList", dataDiskTemplateToDiskOfferingList); + + EntityManager entityMgr = mock(EntityManager.class); + ReflectionTestUtils.setField(cmd, "_entityMgr", entityMgr); + when(entityMgr.findByUuid(VirtualMachineTemplate.class, "invalid-template")).thenReturn(null); + when(entityMgr.findById(VirtualMachineTemplate.class, "invalid-template")).thenReturn(null); + + InvalidParameterValueException thrownException = assertThrows(InvalidParameterValueException.class, () -> { + cmd.getDataDiskTemplateToDiskOfferingMap(); + }); + assertTrue(thrownException.getMessage().contains("Unable to translate and find entity with datadisktemplateid")); + } + + @Test + public void testSetServiceOfferingId() { + cmd.setServiceOfferingId(101L); + assertEquals(Long.valueOf(101L), cmd.getServiceOfferingId()); + } + + @Test + public void testSetTemplateId() { + cmd.setTemplateId(102L); + assertEquals(Long.valueOf(102L), cmd.getTemplateId()); + } + + @Test + public void testSetVolumeId() { + cmd.setVolumeId(103L); + assertEquals(Long.valueOf(103L), cmd.getVolumeId()); + } + + @Test + public void testSetSnapshotId() { + cmd.setSnapshotId(104L); + assertEquals(Long.valueOf(104L), cmd.getSnapshotId()); + } + + @Test + public void testSetZoneId() { + cmd.setZoneId(105L); + assertEquals(Long.valueOf(105L), cmd.getZoneId()); + } + + @Test + public void testSetName() { + cmd.setName("vm-name"); + assertEquals("vm-name", cmd.getName()); + } + + @Test + public void testSetDisplayName() { + cmd.setDisplayName("vm-display-name"); + assertEquals("vm-display-name", cmd.getDisplayName()); + } + + @Test + public void testSetAccountName() { + cmd.setAccountName("account-name"); + assertEquals("account-name", cmd.getAccountName()); + } + + @Test + public void testSetDomainId() { + cmd.setDomainId(106L); + assertEquals(Long.valueOf(106L), cmd.getDomainId()); + } + + @Test + public void testSetNetworkIds() { + List networkIds = Arrays.asList(11L, 12L); + cmd.setNetworkIds(networkIds); + assertEquals(networkIds, cmd.getNetworkIds()); + } + + @Test + public void testSetBootType() { + cmd.setBootType("UEFI"); + assertEquals(BootType.UEFI, cmd.getBootType()); + } + + @Test + public void testSetBootMode() { + cmd.setBootType("UEFI"); + cmd.setBootMode("SECURE"); + assertEquals(BootMode.SECURE, cmd.getBootMode()); + } + + @Test + public void testSetHypervisor() { + cmd.setHypervisor("KVM"); + assertEquals(HypervisorType.KVM, cmd.getHypervisor()); + } + + @Test + public void testSetUserData() { + cmd.setUserData("dXNlci1kYXRh"); + assertEquals("dXNlci1kYXRh", cmd.getUserData()); + } + + @Test + public void testSetKeyboard() { + cmd.setKeyboard("us"); + assertEquals("us", cmd.getKeyboard()); + } + + @Test + public void testSetProjectId() { + cmd.setProjectId(107L); + assertEquals(Long.valueOf(107L), ReflectionTestUtils.getField(cmd, "projectId")); + } + + @Test + public void testSetDisplayVm() { + cmd.setDisplayVm(Boolean.FALSE); + assertEquals(Boolean.FALSE, cmd.isDisplayVm()); + } + + @Test + public void testSetUserDataId() { + cmd.setUserDataId(108L); + assertEquals(Long.valueOf(108L), cmd.getUserdataId()); + } + + @Test + public void testSetAffinityGroupIds() { + List affinityGroupIds = Arrays.asList(21L, 22L); + cmd.setAffinityGroupIds(affinityGroupIds); + assertEquals(affinityGroupIds, cmd.getAffinityGroupIdList()); + } + + @Test + public void testSetDetails() { + Map details = new HashMap<>(); + details.put("key", "value"); + cmd.setDetails(details); + assertEquals(details, ReflectionTestUtils.getField(cmd, "details")); + } + + @Test + public void testSetExtraConfig() { + cmd.setExtraConfig("cpu-mode=host-passthrough"); + assertEquals("cpu-mode=host-passthrough", cmd.getExtraConfig()); + } + + @Test + public void testSetDynamicScalingEnabled() { + cmd.setDynamicScalingEnabled(Boolean.FALSE); + assertFalse(cmd.isDynamicScalingEnabled()); + } + + @Test + public void testIsBlankInstance() { + assertFalse(cmd.isBlankInstance()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmdTest.java new file mode 100644 index 000000000000..48b41a47fff3 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmdTest.java @@ -0,0 +1,223 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.command.user.vm; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.anyList; +import static org.mockito.Mockito.anySet; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.response.ResourceIconResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import com.cloud.server.ResourceIcon; +import com.cloud.server.ResourceIconManager; +import com.cloud.server.ResourceTag; +import com.cloud.storage.GuestOS; +import com.cloud.utils.db.EntityManager; + +public class ListVMsCmdTest { + + EntityManager _entityMgr; + ResourceIconManager resourceIconManager; + ResponseGenerator _responseGenerator; + + ListVMsCmd cmd; + + @Before + public void setup() { + _entityMgr = mock(EntityManager.class); + resourceIconManager = mock(ResourceIconManager.class); + _responseGenerator = mock(ResponseGenerator.class); + cmd = spy(ListVMsCmd.class); + cmd._entityMgr = _entityMgr; + cmd.resourceIconManager = resourceIconManager; + cmd._responseGenerator = _responseGenerator; + } + + @Test + public void testUpdateVMResponse_withMixedIcons() { + String vm1Uuid = UUID.randomUUID().toString(); + UserVmResponse vm1 = mock(UserVmResponse.class); + when(vm1.getId()).thenReturn(vm1Uuid); + String vm2Uuid = UUID.randomUUID().toString(); + UserVmResponse vm2 = mock(UserVmResponse.class); + when(vm2.getId()).thenReturn(vm2Uuid); + List responses = Arrays.asList(vm1, vm2); + ResourceIcon icon1 = mock(ResourceIcon.class); + ResourceIcon icon2 = mock(ResourceIcon.class); + Map initialIcons = new HashMap<>(); + initialIcons.put(vm1Uuid, icon1); + when(resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.UserVm, Set.of(vm1Uuid, vm2Uuid))) + .thenReturn(initialIcons); + Map fallbackIcons = Map.of(vm2Uuid, icon2); + doReturn(fallbackIcons).when(cmd).getResourceIconsForUsingTemplateIso(anyList()); + ResourceIconResponse iconResponse1 = new ResourceIconResponse(); + ResourceIconResponse iconResponse2 = new ResourceIconResponse(); + when(_responseGenerator.createResourceIconResponse(icon1)).thenReturn(iconResponse1); + when(_responseGenerator.createResourceIconResponse(icon2)).thenReturn(iconResponse2); + cmd.updateVMResponse(responses); + verify(vm1).setResourceIconResponse(iconResponse1); + verify(vm2).setResourceIconResponse(iconResponse2); + } + + @Test + public void testUpdateVMResponse_withEmptyList() { + cmd.updateVMResponse(Collections.emptyList()); + verify(resourceIconManager, never()).getByResourceTypeAndIds(Mockito.any(), Mockito.anyCollection()); + } + + @Test + public void testGetResourceIconsForUsingTemplateIso_withValidData() { + String vm1Uuid = UUID.randomUUID().toString(); + String template1Uuid = UUID.randomUUID().toString(); + UserVmResponse vm1 = mock(UserVmResponse.class); + when(vm1.getId()).thenReturn(vm1Uuid); + when(vm1.getTemplateId()).thenReturn(template1Uuid); + when(vm1.getIsoId()).thenReturn(null); + String vm2Uuid = UUID.randomUUID().toString(); + String iso2Uuid = UUID.randomUUID().toString(); + UserVmResponse vm2 = mock(UserVmResponse.class); + when(vm2.getId()).thenReturn(vm2Uuid); + when(vm2.getTemplateId()).thenReturn(null); + when(vm2.getIsoId()).thenReturn(iso2Uuid); + List responses = Arrays.asList(vm1, vm2); + Map templateIcons = new HashMap<>(); + templateIcons.put(template1Uuid, mock(ResourceIcon.class)); + Map isoIcons = new HashMap<>(); + isoIcons.put(iso2Uuid, mock(ResourceIcon.class)); + when(resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.Template, Set.of(template1Uuid))) + .thenReturn(templateIcons); + when(resourceIconManager.getByResourceTypeAndUuids(ResourceTag.ResourceObjectType.ISO, Set.of(iso2Uuid))) + .thenReturn(isoIcons); + doReturn(Collections.emptyMap()).when(cmd).getResourceIconsUsingOsCategory(anyList()); + Map result = cmd.getResourceIconsForUsingTemplateIso(responses); + assertEquals(2, result.size()); + assertTrue(result.containsKey(vm1Uuid)); + assertTrue(result.containsKey(vm2Uuid)); + assertEquals(templateIcons.get(template1Uuid), result.get(vm1Uuid)); + assertEquals(isoIcons.get(iso2Uuid), result.get(vm2Uuid)); + } + + @Test + public void testGetResourceIconsForUsingTemplateIso_withMissingIcons() { + String vm1Uuid = UUID.randomUUID().toString(); + String template1Uuid = UUID.randomUUID().toString(); + UserVmResponse vm1 = mock(UserVmResponse.class); + when(vm1.getId()).thenReturn(vm1Uuid); + when(vm1.getTemplateId()).thenReturn(template1Uuid); + when(vm1.getIsoId()).thenReturn(null); + List responses = List.of(vm1); + when(resourceIconManager.getByResourceTypeAndUuids(eq(ResourceTag.ResourceObjectType.Template), anySet())) + .thenReturn(Collections.emptyMap()); + when(resourceIconManager.getByResourceTypeAndUuids(eq(ResourceTag.ResourceObjectType.ISO), anySet())) + .thenReturn(Collections.emptyMap()); + Map fallbackIcons = Map.of(vm1Uuid, mock(ResourceIcon.class)); + doReturn(fallbackIcons).when(cmd).getResourceIconsUsingOsCategory(anyList()); + Map result = cmd.getResourceIconsForUsingTemplateIso(responses); + assertEquals(1, result.size()); + assertEquals(fallbackIcons.get("vm1"), result.get("vm1")); + } + + @Test + public void testGetResourceIconsUsingOsCategory_withValidData() { + String vm1Uuid = UUID.randomUUID().toString(); + String os1Uuid = UUID.randomUUID().toString(); + UserVmResponse vm1 = mock(UserVmResponse.class); + when(vm1.getGuestOsId()).thenReturn(os1Uuid); + when(vm1.getId()).thenReturn(vm1Uuid); + String vm2Uuid = UUID.randomUUID().toString(); + String os2Uuid = UUID.randomUUID().toString(); + UserVmResponse vm2 = mock(UserVmResponse.class); + when(vm2.getGuestOsId()).thenReturn(os2Uuid); + when(vm2.getId()).thenReturn(vm2Uuid); + List responses = Arrays.asList(vm1, vm2); + GuestOS guestOS1 = mock(GuestOS.class); + when(guestOS1.getUuid()).thenReturn(os1Uuid); + when(guestOS1.getCategoryId()).thenReturn(10L); + GuestOS guestOS2 = mock(GuestOS.class); + when(guestOS2.getUuid()).thenReturn(os2Uuid); + when(guestOS2.getCategoryId()).thenReturn(20L); + when(_entityMgr.listByUuids(eq(GuestOS.class), anySet())) + .thenReturn(Arrays.asList(guestOS1, guestOS2)); + ResourceIcon icon1 = mock(ResourceIcon.class); + ResourceIcon icon2 = mock(ResourceIcon.class); + Map categoryIcons = new HashMap<>(); + categoryIcons.put(10L, icon1); + categoryIcons.put(20L, icon2); + when(resourceIconManager.getByResourceTypeAndIds(eq(ResourceTag.ResourceObjectType.GuestOsCategory), anySet())) + .thenReturn(categoryIcons); + Map result = cmd.getResourceIconsUsingOsCategory(responses); + assertEquals(2, result.size()); + assertEquals(icon1, result.get(vm1Uuid)); + assertEquals(icon2, result.get(vm2Uuid)); + } + + @Test + public void testGetResourceIconsUsingOsCategory_missingGuestOS() { + String vm1Uuid = UUID.randomUUID().toString(); + String os1Uuid = UUID.randomUUID().toString(); + UserVmResponse vm1 = mock(UserVmResponse.class); + when(vm1.getGuestOsId()).thenReturn(vm1Uuid); + when(vm1.getId()).thenReturn(os1Uuid); + List responses = Collections.singletonList(vm1); + when(_entityMgr.listByUuids(eq(GuestOS.class), anySet())) + .thenReturn(Collections.emptyList()); + Map result = cmd.getResourceIconsUsingOsCategory(responses); + assertTrue(result.isEmpty()); + } + + @Test + public void testGetResourceIconsUsingOsCategory_missingIcon() { + UserVmResponse vm1 = mock(UserVmResponse.class); + String vmUuid = UUID.randomUUID().toString(); + String osUuid = UUID.randomUUID().toString(); + when(vm1.getGuestOsId()).thenReturn(osUuid); + when(vm1.getId()).thenReturn(vmUuid); + List responses = Collections.singletonList(vm1); + GuestOS guestOS1 = mock(GuestOS.class); + when(guestOS1.getCategoryId()).thenReturn(10L); + when(guestOS1.getUuid()).thenReturn(osUuid); + when(_entityMgr.listByUuids(eq(GuestOS.class), anySet())) + .thenReturn(Collections.singletonList(guestOS1)); + when(resourceIconManager.getByResourceTypeAndIds(eq(ResourceTag.ResourceObjectType.GuestOsCategory), anySet())) + .thenReturn(Collections.emptyMap()); + Map result = cmd.getResourceIconsUsingOsCategory(responses); + assertTrue(result.containsKey(vmUuid)); + assertNull(result.get(vmUuid)); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmdTest.java index 2505c67e87db..18c03f8f4bb6 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmdTest.java @@ -25,7 +25,6 @@ import com.cloud.network.vpc.VpcService; import com.cloud.user.AccountService; import com.cloud.utils.db.EntityManager; -import junit.framework.TestCase; import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.response.VpcResponse; @@ -39,7 +38,7 @@ import org.springframework.test.util.ReflectionTestUtils; @RunWith(MockitoJUnitRunner.class) -public class CreateVPCCmdTest extends TestCase { +public class CreateVPCCmdTest { @Mock public VpcService _vpcService; @@ -47,9 +46,13 @@ public class CreateVPCCmdTest extends TestCase { public EntityManager _entityMgr; @Mock public AccountService _accountService; - private ResponseGenerator responseGenerator; + @Mock + private ResponseGenerator _responseGenerator; + @Mock + private Object job; + @InjectMocks - CreateVPCCmd cmd = new CreateVPCCmd(); + CreateVPCCmd cmd; @Test public void testGetAccountName() { @@ -185,11 +188,9 @@ public void testExecute() throws ResourceUnavailableException, InsufficientCapac VpcResponse response = Mockito.mock(VpcResponse.class); ReflectionTestUtils.setField(cmd, "id", 1L); - responseGenerator = Mockito.mock(ResponseGenerator.class); Mockito.doNothing().when(_vpcService).startVpc(cmd); Mockito.when(_entityMgr.findById(Mockito.eq(Vpc.class), Mockito.any(Long.class))).thenReturn(vpc); - cmd._responseGenerator = responseGenerator; - Mockito.when(responseGenerator.createVpcResponse(ResponseObject.ResponseView.Restricted, vpc)).thenReturn(response); + Mockito.when(_responseGenerator.createVpcResponse(ResponseObject.ResponseView.Restricted, vpc)).thenReturn(response); cmd.execute(); Mockito.verify(_vpcService, Mockito.times(1)).startVpc(cmd); } diff --git a/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmdTest.java b/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmdTest.java index acb2dc685976..9d56cffd6718 100644 --- a/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmdTest.java +++ b/api/src/test/java/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmdTest.java @@ -93,7 +93,7 @@ public void testExecute() throws ResourceUnavailableException, InsufficientCapac responseGenerator = Mockito.mock(ResponseGenerator.class); cmd._responseGenerator = responseGenerator; Mockito.verify(_vpcService, Mockito.times(0)).updateVpc(Mockito.anyLong(), Mockito.anyString(), Mockito.anyString(), - Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyInt(), Mockito.anyString()); + Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyInt(), Mockito.anyString(), Mockito.anyBoolean()); } } diff --git a/api/src/test/java/org/apache/cloudstack/api/response/LoginCmdResponseTest.java b/api/src/test/java/org/apache/cloudstack/api/response/LoginCmdResponseTest.java new file mode 100644 index 000000000000..7811138fffe1 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/api/response/LoginCmdResponseTest.java @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.api.response; + + +import org.junit.Assert; +import org.junit.Test; + +public class LoginCmdResponseTest { + + @Test + public void testAllGettersAndSetters() { + LoginCmdResponse response = new LoginCmdResponse(); + + response.setUsername("user1"); + response.setUserId("100"); + response.setDomainId("200"); + response.setTimeout(3600); + response.setAccount("account1"); + response.setFirstName("John"); + response.setLastName("Doe"); + response.setType("admin"); + response.setTimeZone("UTC"); + response.setTimeZoneOffset("+00:00"); + response.setRegistered("true"); + response.setSessionKey("session-key"); + response.set2FAenabled("true"); + response.set2FAverfied("false"); + response.setProviderFor2FA("totp"); + response.setIssuerFor2FA("cloudstack"); + response.setManagementServerId("ms-1"); + + Assert.assertEquals("user1", response.getUsername()); + Assert.assertEquals("100", response.getUserId()); + Assert.assertEquals("200", response.getDomainId()); + Assert.assertEquals(Integer.valueOf(3600), response.getTimeout()); + Assert.assertEquals("account1", response.getAccount()); + Assert.assertEquals("John", response.getFirstName()); + Assert.assertEquals("Doe", response.getLastName()); + Assert.assertEquals("admin", response.getType()); + Assert.assertEquals("UTC", response.getTimeZone()); + Assert.assertEquals("+00:00", response.getTimeZoneOffset()); + Assert.assertEquals("true", response.getRegistered()); + Assert.assertEquals("session-key", response.getSessionKey()); + Assert.assertEquals("true", response.is2FAenabled()); + Assert.assertEquals("false", response.is2FAverfied()); + Assert.assertEquals("totp", response.getProviderFor2FA()); + Assert.assertEquals("cloudstack", response.getIssuerFor2FA()); + Assert.assertEquals("ms-1", response.getManagementServerId()); + } + + @Test + public void testPasswordChangeRequired_True() { + LoginCmdResponse response = new LoginCmdResponse(); + response.setPasswordChangeRequired(true); + Assert.assertTrue(response.getPasswordChangeRequired()); + } + + @Test + public void testPasswordChangeRequired_False() { + LoginCmdResponse response = new LoginCmdResponse(); + response.setPasswordChangeRequired(false); + Assert.assertFalse(response.getPasswordChangeRequired()); + } + + @Test + public void testPasswordChangeRequired_Null() { + LoginCmdResponse response = new LoginCmdResponse(); + response.setPasswordChangeRequired(null); + Assert.assertNull("Boolean.parseBoolean(null) should return null", response.getPasswordChangeRequired()); + } +} diff --git a/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java b/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java new file mode 100644 index 000000000000..4e96af3ead41 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/config/ApiServiceConfigurationTest.java @@ -0,0 +1,95 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.config; + +import com.cloud.exception.InvalidParameterValueException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class ApiServiceConfigurationTest { + + private static final String LOCALHOST = "http://localhost"; + + private static final String ENDPOINT_URL = "https://acs.clouds.com/client/api"; + + private static final String WHITE_SPACE = " "; + + private static final String BLANK_STRING = ""; + + private static final String NULL_STRING = null; + + private static final String LOCALHOST_IP = "127.0.0.1"; + + @Test(expected = InvalidParameterValueException.class) + public void validateEndpointUrlTestIfEndpointUrlContainLocalhostShouldThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(LOCALHOST); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } + + @Test + public void validateEndpointUrlTestIfEndpointUrlContainLocalhostShouldNotThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(ENDPOINT_URL); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } + + @Test(expected = InvalidParameterValueException.class) + public void validateEndpointUrlTestIfEndpointUrlIsNullShouldThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(NULL_STRING); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } + + @Test(expected = InvalidParameterValueException.class) + public void validateEndpointUrlTestIfEndpointUrlIsBlankShouldThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(BLANK_STRING); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } + + @Test(expected = InvalidParameterValueException.class) + public void validateEndpointUrlTestIfEndpointUrlIsWhiteSpaceShouldThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(WHITE_SPACE); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } + + @Test(expected = InvalidParameterValueException.class) + public void validateEndpointUrlTestIfEndpointUrlContainLocalhostIpShouldThrowInvalidParameterValueException() { + try (MockedStatic apiServiceConfigurationMockedStatic = Mockito.mockStatic(ApiServiceConfiguration.class)) { + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::getApiServletPathValue).thenReturn(LOCALHOST_IP); + apiServiceConfigurationMockedStatic.when(ApiServiceConfiguration::validateEndpointUrl).thenCallRealMethod(); + ApiServiceConfiguration.validateEndpointUrl(); + } + } +} diff --git a/api/src/test/java/org/apache/cloudstack/extension/ExtensionCustomActionTest.java b/api/src/test/java/org/apache/cloudstack/extension/ExtensionCustomActionTest.java new file mode 100644 index 000000000000..ae4314aa11a8 --- /dev/null +++ b/api/src/test/java/org/apache/cloudstack/extension/ExtensionCustomActionTest.java @@ -0,0 +1,484 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you 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 org.apache.cloudstack.extension; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.ApiConstants; +import org.junit.Test; + +import com.cloud.exception.InvalidParameterValueException; + +public class ExtensionCustomActionTest { + + @Test + public void testResourceType() { + ExtensionCustomAction.ResourceType vmType = ExtensionCustomAction.ResourceType.VirtualMachine; + assertEquals(com.cloud.vm.VirtualMachine.class, vmType.getAssociatedClass()); + } + + @Test + public void testParameterTypeSupportsOptions() { + assertTrue(ExtensionCustomAction.Parameter.Type.STRING.canSupportsOptions()); + assertTrue(ExtensionCustomAction.Parameter.Type.NUMBER.canSupportsOptions()); + assertFalse(ExtensionCustomAction.Parameter.Type.BOOLEAN.canSupportsOptions()); + assertFalse(ExtensionCustomAction.Parameter.Type.DATE.canSupportsOptions()); + } + + @Test + public void testValidationFormatBaseType() { + assertEquals(ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.UUID.getBaseType()); + assertEquals(ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.EMAIL.getBaseType()); + assertEquals(ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.PASSWORD.getBaseType()); + assertEquals(ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.URL.getBaseType()); + assertEquals(ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.DECIMAL.getBaseType()); + assertNull(ExtensionCustomAction.Parameter.ValidationFormat.NONE.getBaseType()); + } + + @Test + public void testParameterFromMapValid() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "STRING"); + map.put(ApiConstants.VALIDATION_FORMAT, "EMAIL"); + map.put(ApiConstants.REQUIRED, "true"); + map.put(ApiConstants.VALUE_OPTIONS, "test@example.com,another@test.com"); + + ExtensionCustomAction.Parameter param = ExtensionCustomAction.Parameter.fromMap(map); + + assertEquals("testParam", param.getName()); + assertEquals(ExtensionCustomAction.Parameter.Type.STRING, param.getType()); + assertEquals(ExtensionCustomAction.Parameter.ValidationFormat.EMAIL, param.getValidationFormat()); + assertTrue(param.isRequired()); + assertEquals(2, param.getValueOptions().size()); + assertTrue(param.getValueOptions().contains("test@example.com")); + assertTrue(param.getValueOptions().contains("another@test.com")); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapEmptyName() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, ""); + map.put(ApiConstants.TYPE, "STRING"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapNoType() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapInvalidType() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "INVALID_TYPE"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapInvalidValidationFormat() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "STRING"); + map.put(ApiConstants.VALIDATION_FORMAT, "INVALID_FORMAT"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapMismatchedTypeAndFormat() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "STRING"); + map.put(ApiConstants.VALIDATION_FORMAT, "DECIMAL"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test + public void testParameterFromMapWithNumberOptions() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "NUMBER"); + map.put(ApiConstants.VALIDATION_FORMAT, "DECIMAL"); + map.put(ApiConstants.VALUE_OPTIONS, "1.5,2.7,3.0"); + + ExtensionCustomAction.Parameter param = ExtensionCustomAction.Parameter.fromMap(map); + + assertEquals(ExtensionCustomAction.Parameter.Type.NUMBER, param.getType()); + assertEquals(ExtensionCustomAction.Parameter.ValidationFormat.DECIMAL, param.getValidationFormat()); + assertEquals(3, param.getValueOptions().size()); + assertTrue(param.getValueOptions().contains(1.5f)); + assertTrue(param.getValueOptions().contains(2.7f)); + assertTrue(param.getValueOptions().contains(3.0f)); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapInvalidNumberOptions() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "NUMBER"); + map.put(ApiConstants.VALUE_OPTIONS, "1.5,invalid,3.0"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test(expected = InvalidParameterValueException.class) + public void testParameterFromMapInvalidEmailOptions() { + Map map = new HashMap<>(); + map.put(ApiConstants.NAME, "testParam"); + map.put(ApiConstants.TYPE, "STRING"); + map.put(ApiConstants.VALIDATION_FORMAT, "EMAIL"); + map.put(ApiConstants.VALUE_OPTIONS, "valid@email.com,invalid-email"); + + ExtensionCustomAction.Parameter.fromMap(map); + } + + @Test + public void testValidatedValueString() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.EMAIL, + null, + false + ); + + Object result = param.validatedValue("test@example.com"); + assertEquals("test@example.com", result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueInvalidEmail() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.EMAIL, + null, + false + ); + + param.validatedValue("invalid-email"); + } + + @Test + public void testValidatedValueUUID() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.UUID, + null, + false + ); + + String validUUID = "550e8400-e29b-41d4-a716-446655440000"; + Object result = param.validatedValue(validUUID); + assertEquals(validUUID, result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueInvalidUUID() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.UUID, + null, + false + ); + + param.validatedValue("invalid-uuid"); + } + + @Test + public void testValidatedValueURL() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.URL, + null, + false + ); + + Object result = param.validatedValue("https://example.com"); + assertEquals("https://example.com", result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueInvalidURL() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.URL, + null, + false + ); + + param.validatedValue("not-a-url"); + } + + @Test + public void testValidatedValuePassword() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.PASSWORD, + null, + false + ); + + Object result = param.validatedValue("mypassword"); + assertEquals("mypassword", result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueEmptyPassword() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.PASSWORD, + null, + false + ); + + param.validatedValue(" "); + } + + @Test + public void testValidatedValueNumber() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + null, + false + ); + + Object result = param.validatedValue("42"); + assertEquals(42, result); + } + + @Test + public void testValidatedValueDecimal() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.DECIMAL, + null, + false + ); + + Object result = param.validatedValue("3.14"); + assertEquals(3.14f, result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueInvalidNumber() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + null, + false + ); + + param.validatedValue("not-a-number"); + } + + @Test + public void testValidatedValueBoolean() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.BOOLEAN, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + null, + false + ); + + Object result = param.validatedValue("true"); + assertEquals(true, result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueInvalidBoolean() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.BOOLEAN, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + null, + false + ); + + Object result = param.validatedValue("maybe"); + } + + @Test + public void testValidatedValueWithOptions() { + List options = Arrays.asList("option1", "option2", "option3"); + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + options, + false + ); + + Object result = param.validatedValue("option2"); + assertEquals("option2", result); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueNotInOptions() { + List options = Arrays.asList("option1", "option2", "option3"); + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + options, + false + ); + + param.validatedValue("option4"); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidatedValueEmpty() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, + null, + false + ); + + param.validatedValue(""); + } + + @Test + public void testValidateParameterValues() { + List paramDefs = Arrays.asList( + new ExtensionCustomAction.Parameter("required1", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, true), + new ExtensionCustomAction.Parameter("required2", ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, true), + new ExtensionCustomAction.Parameter("optional", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, false) + ); + + Map suppliedValues = new HashMap<>(); + suppliedValues.put("required1", "value1"); + suppliedValues.put("required2", "42"); + suppliedValues.put("optional", "optionalValue"); + + Map result = ExtensionCustomAction.Parameter.validateParameterValues(paramDefs, suppliedValues); + + assertEquals("value1", result.get("required1")); + assertEquals(42, result.get("required2")); + assertEquals("optionalValue", result.get("optional")); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateParameterValuesMissingRequired() { + List paramDefs = Arrays.asList( + new ExtensionCustomAction.Parameter("required1", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, true) + ); + + Map suppliedValues = new HashMap<>(); + + ExtensionCustomAction.Parameter.validateParameterValues(paramDefs, suppliedValues); + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateParameterValuesEmptyRequired() { + List paramDefs = Arrays.asList( + new ExtensionCustomAction.Parameter("required1", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, true) + ); + + Map suppliedValues = new HashMap<>(); + suppliedValues.put("required1", " "); + + ExtensionCustomAction.Parameter.validateParameterValues(paramDefs, suppliedValues); + } + + @Test + public void testValidateParameterValuesNullSupplied() { + List paramDefs = Arrays.asList( + new ExtensionCustomAction.Parameter("optional", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.NONE, null, false) + ); + + Map result = ExtensionCustomAction.Parameter.validateParameterValues(paramDefs, null); + assertTrue(result.isEmpty()); + } + + @Test + public void testJsonSerializationDeserialization() { + List originalParams = Arrays.asList( + new ExtensionCustomAction.Parameter("param1", ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.EMAIL, Arrays.asList("test@example.com"), true), + new ExtensionCustomAction.Parameter("param2", ExtensionCustomAction.Parameter.Type.NUMBER, + ExtensionCustomAction.Parameter.ValidationFormat.DECIMAL, Arrays.asList(1.5f, 2.7f), false) + ); + + String json = ExtensionCustomAction.Parameter.toJsonFromList(originalParams); + List deserializedParams = ExtensionCustomAction.Parameter.toListFromJson(json); + + assertEquals(originalParams.size(), deserializedParams.size()); + assertEquals(originalParams.get(0).getName(), deserializedParams.get(0).getName()); + assertEquals(originalParams.get(0).getType(), deserializedParams.get(0).getType()); + assertEquals(originalParams.get(0).getValidationFormat(), deserializedParams.get(0).getValidationFormat()); + assertEquals(originalParams.get(0).isRequired(), deserializedParams.get(0).isRequired()); + assertEquals(originalParams.get(0).getValueOptions(), deserializedParams.get(0).getValueOptions()); + } + + @Test + public void testToString() { + ExtensionCustomAction.Parameter param = new ExtensionCustomAction.Parameter( + "testParam", + ExtensionCustomAction.Parameter.Type.STRING, + ExtensionCustomAction.Parameter.ValidationFormat.EMAIL, + null, + true + ); + + String result = param.toString(); + assertTrue(result.contains("testParam")); + assertTrue(result.contains("STRING")); + assertTrue(result.contains("true")); + } +} diff --git a/build/replace.properties b/build/replace.properties index ce38727b80a7..8c3812eb7d29 100644 --- a/build/replace.properties +++ b/build/replace.properties @@ -28,3 +28,4 @@ MSMNTDIR=/mnt COMPONENTS-SPEC=components.xml REMOTEHOST=localhost COMMONLIBDIR=client/target/common/ +EXTENSIONSDEPLOYMENTMODE=developer diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in index 70e727b40b29..b4fe76cc8d8a 100755 --- a/client/bindir/cloud-setup-management.in +++ b/client/bindir/cloud-setup-management.in @@ -16,13 +16,127 @@ # specific language governing permissions and limitations # under the License. +import os import sys +# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ---- +# ---- We do this so cloud_utils can be looked up in the following order: +# ---- 1) Sources directory +# ---- 2) waf configured PYTHONDIR +# ---- 3) System Python path +for pythonpath in ( + "@PYTHONDIR@", + os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), + ): + if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) +# ---- End snippet of code ---- + from cloudutils.syscfg import sysConfigFactory from cloudutils.utilities import initLoging, UnknownSystemException from cloudutils.cloudException import CloudRuntimeException, CloudInternalException from cloudutils.globalEnv import globalEnv from cloudutils.serviceConfigServer import cloudManagementConfig from optparse import OptionParser +import urllib.request +import configparser +import hashlib + +SYSTEMVM_TEMPLATES_PATH = "/usr/share/cloudstack-management/templates/systemvm" +SYSTEMVM_TEMPLATES_METADATA_FILE = SYSTEMVM_TEMPLATES_PATH + "/metadata.ini" + +def verify_sha512_checksum(file_path, expected_checksum): + sha512 = hashlib.sha512() + try: + with open(file_path, "rb") as f: + for chunk in iter(lambda: f.read(8192), b""): + sha512.update(chunk) + return sha512.hexdigest().lower() == expected_checksum.lower() + except Exception as e: + print(f"Failed to verify checksum for {file_path}: {e}") + return False + +def download_file(url, dest_path, chunk_size=8 * 1024 * 1024): + """ + Downloads a file from the given URL to the specified destination path in chunks. + """ + try: + with urllib.request.urlopen(url) as response: + total_size = response.length if response.length else None + downloaded = 0 + try: + with open(dest_path, 'wb') as out_file: + while True: + chunk = response.read(chunk_size) + if not chunk: + break + out_file.write(chunk) + downloaded += len(chunk) + if total_size: + print(f"Downloaded {downloaded / (1024 * 1024):.2f}MB of {total_size / (1024 * 1024):.2f}MB", end='\r') + except PermissionError as pe: + print(f"Permission denied: {dest_path}") + raise + print(f"\nDownloaded file from {url} to {dest_path}") + except Exception as e: + print(f"Failed to download file: {e}") + raise + +def download_template_if_needed(template, url, filename, checksum): + dest_path = os.path.join(SYSTEMVM_TEMPLATES_PATH, filename) + if os.path.exists(dest_path): + if checksum and verify_sha512_checksum(dest_path, checksum): + print(f"{template} System VM template already exists at {dest_path} with valid checksum, skipping download.") + return + else: + print(f"{template} System VM template at {dest_path} has invalid or missing checksum, re-downloading...") + else: + print(f"Downloading {template} System VM template from {url} to {dest_path}...") + try: + download_file(url, dest_path) + #After download, verify checksum if provided + if checksum: + if verify_sha512_checksum(dest_path, checksum): + print(f"{template} System VM template downloaded and verified successfully.") + else: + print(f"ERROR: Checksum verification failed for {template} System VM template after download.") + except Exception as e: + print(f"ERROR: Failed to download {template} System VM template: {e}") + +def collect_template_metadata(selected_templates, options): + template_metadata_list = [] + if not os.path.exists(SYSTEMVM_TEMPLATES_METADATA_FILE): + print(f"ERROR: System VM templates metadata file not found at {SYSTEMVM_TEMPLATES_METADATA_FILE}, cannot download templates.") + sys.exit(1) + config = configparser.ConfigParser() + config.read(SYSTEMVM_TEMPLATES_METADATA_FILE) + template_repo_url = None + if options.systemvm_templates_repository: + if "default" in config and "downloadrepository" in config["default"]: + template_repo_url = config["default"]["downloadrepository"].strip() + if not template_repo_url: + print("ERROR: downloadrepository value is empty in metadata file, cannot use --systemvm-template-repository option.") + sys.exit(1) + for template in selected_templates: + if template in config: + url = config[template].get("downloadurl") + filename = config[template].get("filename") + checksum = config[template].get("checksum") + if url and filename: + if template_repo_url: + url = url.replace(template_repo_url, options.systemvm_templates_repository) + template_metadata_list.append({ + "template": template, + "url": url, + "filename": filename, + "checksum": checksum + }) + else: + print(f"ERROR: URL or filename not found for {template} System VM template in metadata.") + sys.exit(1) + else: + print(f"ERROR: No metadata found for {template} System VM template.") + sys.exit(1) + return template_metadata_list + if __name__ == '__main__': initLoging("@MSLOGDIR@/setupManagement.log") glbEnv = globalEnv() @@ -31,6 +145,16 @@ if __name__ == '__main__': parser.add_option("--https", action="store_true", dest="https", help="Enable HTTPs connection of management server") parser.add_option("--tomcat7", action="store_true", dest="tomcat7", help="Depreciated option, don't use it") parser.add_option("--no-start", action="store_true", dest="nostart", help="Do not start management server after successful configuration") + parser.add_option( + "--systemvm-templates", + dest="systemvm_templates", + help="Specify System VM templates to download: all, kvm-aarch64, kvm-x86_64, xenserver, vmware or comma-separated list of hypervisor combinations (e.g., kvm-x86_64,xenserver). Default is kvm-x86_64.", + ) + parser.add_option( + "--systemvm-templates-repository", + dest="systemvm_templates_repository", + help="Specify the URL to download System VM templates from." + ) (options, args) = parser.parse_args() if options.https: glbEnv.svrMode = "HttpsServer" @@ -39,6 +163,34 @@ if __name__ == '__main__': if options.nostart: glbEnv.noStart = True + available_templates = ["kvm-aarch64", "kvm-x86_64", "xenserver", "vmware"] + templates_arg = options.systemvm_templates + + selected_templates = ["kvm-x86_64"] + if templates_arg: + templates_list = [t.strip().lower() for t in templates_arg.split(",")] + if "all" in templates_list: + if len(templates_list) > 1: + print("WARNING: 'all' specified for System VM templates, ignoring other specified templates.") + selected_templates = available_templates + else: + invalid_templates = [] + for t in templates_list: + if t in available_templates: + if t not in selected_templates: + selected_templates.append(t) + else: + if t not in invalid_templates: + invalid_templates.append(t) + if invalid_templates: + print(f"ERROR: Invalid System VM template names provided: {', '.join(invalid_templates)}") + sys.exit(1) + print(f"Selected systemvm templates to download: {', '.join(selected_templates) if selected_templates else 'None'}") + + template_metadata_list = [] + if selected_templates: + template_metadata_list = collect_template_metadata(selected_templates, options) + glbEnv.mode = "Server" print("Starting to configure CloudStack Management Server:") @@ -60,3 +212,6 @@ if __name__ == '__main__': syscfg.restore() except: pass + + for meta in template_metadata_list: + download_template_if_needed(meta["template"], meta["url"], meta["filename"], meta["checksum"]) diff --git a/client/bindir/cloud-update-xenserver-licenses.in b/client/bindir/cloud-update-xenserver-licenses.in index 2be3a083f973..fca48f9eafbb 100755 --- a/client/bindir/cloud-update-xenserver-licenses.in +++ b/client/bindir/cloud-update-xenserver-licenses.in @@ -34,16 +34,19 @@ from threading import Thread # ---- 2) waf configured PYTHONDIR # ---- 3) System Python path for pythonpath in ( - "@PYTHONDIR@", - os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"), - ): - if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath) + "@PYTHONDIR@", + os.path.join( + os.path.dirname(__file__), os.path.pardir, os.path.pardir, "python", "lib" + ), +): + if os.path.isdir(pythonpath): + sys.path.insert(0, pythonpath) # ---- End snippet of code ---- from cloud_utils import check_call, CalledProcessError, read_properties cfg = "@MSCONF@/db.properties" -#---------------------- option parsing and command line checks ------------------------ +# ---------------------- option parsing and command line checks ------------------------ usage = """%prog <-a | host names / IP addresses...> @@ -51,132 +54,171 @@ usage = """%prog <-a | host names / IP addresses...> This command deploys the license file specified in the command line into a specific XenServer host or all XenServer hosts known to the management server.""" parser = OptionParser(usage=usage) -parser.add_option("-a", "--all", action="store_true", dest="all", default=False, - help="deploy to all known hosts rather that a single host") - -#------------------ functions -------------------- - -def e(msg): parser.error(msg) - -def getknownhosts(host,username,password): - conn = mysql.connector.connect(host=host, user=username, password=password) - cur = conn.cursor() - cur.execute("SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'username' and setup = 1") - usernames = dict(cur.fetchall()) - cur.execute("SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'password' and setup = 1") - passwords = dict(cur.fetchall()) - creds = dict( [ [x,(usernames[x],passwords[x])] for x in list(usernames.keys()) ] ) - cur.close() - conn.close() - return creds - -def splitlast(string,splitter): - splitted = string.split(splitter) - first,last = splitter.join(splitted[:-1]),splitted[-1] - return first,last +parser.add_option( + "-a", + "--all", + action="store_true", + dest="all", + default=False, + help="deploy to all known hosts rather that a single host", +) + +# ------------------ functions -------------------- + + +def e(msg): + parser.error(msg) + + +def getknownhosts(host, username, password): + conn = mysql.connector.connect(host=host, user=username, password=password) + cur = conn.cursor() + cur.execute( + "SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'username' and setup = 1" + ) + usernames = dict(cur.fetchall()) + cur.execute( + "SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'password' and setup = 1" + ) + passwords = dict(cur.fetchall()) + creds = dict([[x, (usernames[x], passwords[x])] for x in list(usernames.keys())]) + cur.close() + conn.close() + return creds + + +def splitlast(string, splitter): + splitted = string.split(splitter) + first, last = splitter.join(splitted[:-1]), splitted[-1] + return first, last + def parseuserpwfromhosts(hosts): - creds = {} - for host in hosts: - user = "root" - password = "" - if "@" in host: - user,host = splitlast(host,"@") - if ":" in user: - user,password = splitlast(user,":") - creds[host] = (user,password) - return creds + creds = {} + for host in hosts: + user = "root" + password = "" + if "@" in host: + user, host = splitlast(host, "@") + if ":" in user: + user, password = splitlast(user, ":") + creds[host] = (user, password) + return creds + class XenServerConfigurator(Thread): - def __init__(self,host,user,password,keyfiledata): - Thread.__init__(self) - self.host = host - self.user = user - self.password = password - self.keyfiledata = keyfiledata - self.retval = None # means all's good - self.stdout = "" - self.stderr = "" - self.state = 'initialized' - - def run(self): - try: - self.state = 'running' - c = paramiko.SSHClient() - c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - c.connect(self.host,username=self.user,password=self.password) - sftp = c.open_sftp() - sftp.chdir("/tmp") - f = sftp.open("xen-license","w") - f.write(self.keyfiledata) - f.close() - sftp.close() - stdin,stdout,stderr = c.exec_command("xe host-license-add license-file=/tmp/xen-license") - c.exec_command("false") - self.stdout = stdout.read(-1) - self.stderr = stderr.read(-1) - self.retval = stdin.channel.recv_exit_status() - c.close() - if self.retval != 0: self.state = 'failed' - else: self.state = 'finished' - - except Exception as e: - self.state = 'failed' - self.retval = e - #raise - - def __str__(self): - if self.state == 'failed': - return "<%s XenServerConfigurator on %s@%s: %s>"%(self.state,self.user,self.host,str(self.retval)) - else: - return "<%s XenServerConfigurator on %s@%s>"%(self.state,self.user,self.host) - -#------------- actual code -------------------- + def __init__(self, host, user, password, keyfiledata): + Thread.__init__(self) + self.host = host + self.user = user + self.password = password + self.keyfiledata = keyfiledata + self.retval = None # means all's good + self.stdout = "" + self.stderr = "" + self.state = "initialized" + + def run(self): + try: + self.state = "running" + c = paramiko.SSHClient() + c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + c.connect(self.host, username=self.user, password=self.password) + sftp = c.open_sftp() + sftp.chdir("/tmp") + f = sftp.open("xen-license", "w") + f.write(self.keyfiledata) + f.close() + sftp.close() + stdin, stdout, stderr = c.exec_command( + "xe host-license-add license-file=/tmp/xen-license" + ) + c.exec_command("false") + self.stdout = stdout.read(-1) + self.stderr = stderr.read(-1) + self.retval = stdin.channel.recv_exit_status() + c.close() + if self.retval != 0: + self.state = "failed" + else: + self.state = "finished" + + except Exception as e: + self.state = "failed" + self.retval = e + # raise + + def __str__(self): + if self.state == "failed": + return "<%s XenServerConfigurator on %s@%s: %s>" % ( + self.state, + self.user, + self.host, + str(self.retval), + ) + else: + return "<%s XenServerConfigurator on %s@%s>" % ( + self.state, + self.user, + self.host, + ) + + +# ------------- actual code -------------------- (options, args) = parser.parse_args() try: - licensefile,args = args[0],args[1:] -except IndexError: e("The first argument must be the license file to use") + licensefile, args = args[0], args[1:] +except IndexError: + e("The first argument must be the license file to use") if options.all: - if len(args) != 0: e("IP addresses cannot be specified if -a is specified") - config = read_properties(cfg) - creds = getknownhosts(config["db.cloud.host"],config["db.cloud.username"],config["db.cloud.password"]) - hosts = list(creds.keys()) + if len(args) != 0: + e("IP addresses cannot be specified if -a is specified") + config = read_properties(cfg) + creds = getknownhosts( + config["db.cloud.host"], + config["db.cloud.username"], + config["db.cloud.password"], + ) + hosts = list(creds.keys()) else: - if not args: e("You must specify at least one IP address, or -a") - hosts = args - creds = parseuserpwfromhosts(hosts) + if not args: + e("You must specify at least one IP address, or -a") + hosts = args + creds = parseuserpwfromhosts(hosts) try: - keyfiledata = file(licensefile).read(-1) + keyfiledata = file(licensefile).read(-1) except OSError as e: - sys.stderr.write("The file %s cannot be opened"%licensefile) - sys.exit(1) + sys.stderr.write("The file %s cannot be opened" % licensefile) + sys.exit(1) configurators = [] -for host,(user,password) in list(creds.items()): - configurators.append ( XenServerConfigurator(host,user,password,keyfiledata ) ) +for host, (user, password) in list(creds.items()): + configurators.append(XenServerConfigurator(host, user, password, keyfiledata)) -for c in configurators: c.start() +for c in configurators: + c.start() for c in configurators: - print(c.host + "...", end=' ') - c.join() - if c.state == 'failed': - if c.retval: - msg = "failed with return code %s: %s%s"%(c.retval,c.stdout,c.stderr) - msg = msg.strip() - print(msg) - else: print("failed: %s"%c.retval) - else: - print("done") - -successes = len( [ a for a in configurators if not a.state == 'failed' ] ) -failures = len( [ a for a in configurators if a.state == 'failed' ] ) - -print("%3s successes"%successes) -print("%3s failures"%failures) + print(c.host + "...", end=" ") + c.join() + if c.state == "failed": + if c.retval: + msg = "failed with return code %s: %s%s" % (c.retval, c.stdout, c.stderr) + msg = msg.strip() + print(msg) + else: + print("failed: %s" % c.retval) + else: + print("done") + +successes = len([a for a in configurators if not a.state == "failed"]) +failures = len([a for a in configurators if a.state == "failed"]) + +print("%3s successes" % successes) +print("%3s failures" % failures) diff --git a/client/conf/server.properties.in b/client/conf/server.properties.in index 0a6078048d36..7c5e3f925b08 100644 --- a/client/conf/server.properties.in +++ b/client/conf/server.properties.in @@ -55,3 +55,15 @@ webapp.dir=/usr/share/cloudstack-management/webapp # The path to access log file access.log=/var/log/cloudstack/management/access.log + +# The deployment mode for the extensions +extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@ + +# Thread pool configuration +#threads.min=10 +#threads.max=500 + +# The URL prefix for the system VM templates repository. When downloading system VM templates, the server replaces the +# `downloadrepository` key value from the metadata file in template URLs. If not specified, the original template URL +# will be used for download. +# system.vm.templates.download.repository=http://download.cloudstack.org/systemvm/ diff --git a/client/pom.xml b/client/pom.xml index 2b673d7750e9..7d37225dbbb3 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT @@ -121,6 +121,11 @@ cloud-plugin-storage-volume-adaptive ${project.version} + + org.apache.cloudstack + cloud-plugin-storage-volume-ontap + ${project.version} + org.apache.cloudstack cloud-plugin-storage-volume-solidfire @@ -321,16 +326,6 @@ cloud-plugin-hypervisor-ucs ${project.version} - - org.apache.cloudstack - cloud-plugin-hypervisor-ovm - ${project.version} - - - org.apache.cloudstack - cloud-plugin-hypervisor-ovm3 - ${project.version} - org.apache.cloudstack cloud-plugin-hypervisor-kvm @@ -347,6 +342,11 @@ cloud-plugin-hypervisor-hyperv ${project.version} + + org.apache.cloudstack + cloud-plugin-hypervisor-external + ${project.version} + org.apache.cloudstack cloud-plugin-storage-allocator-random @@ -377,11 +377,6 @@ cloud-plugin-explicit-dedication ${project.version} - - org.apache.cloudstack - cloud-plugin-host-allocator-random - ${project.version} - org.apache.cloudstack cloud-plugin-outofbandmanagement-driver-ipmitool @@ -617,6 +612,11 @@ cloud-plugin-backup-nas ${project.version} + + org.apache.cloudstack + cloud-plugin-integrations-veeam-control-service + ${project.version} + org.apache.cloudstack cloud-plugin-integrations-kubernetes-service @@ -671,16 +671,22 @@ - ru.concerteza.buildnumber - maven-jgit-buildnumber-plugin - 1.2.6 + org.codehaus.mojo + buildnumber-maven-plugin + 3.2.0 git-buildnumber - extract-buildnumber + create prepare-package + + false + false + true + unknown + @@ -693,11 +699,11 @@ org.apache.cloudstack.ServerDaemon - ${git.branch} - ${git.tag} - ${git.revision} - ${git.revision} - ${git.branch} + ${scmBranch} + ${project.version} + ${buildNumber} + ${buildNumber} + ${scmBranch} @@ -715,17 +721,17 @@ org.bouncycastle - bcprov-jdk15on + bcprov-jdk18on ${cs.bcprov.version} org.bouncycastle - bcpkix-jdk15on + bcpkix-jdk18on ${cs.bcprov.version} org.bouncycastle - bctls-jdk15on + bctls-jdk18on ${cs.bcprov.version} @@ -905,13 +911,13 @@ org.bouncycastle - bcprov-jdk15on + bcprov-jdk18on false ${project.build.directory}/lib org.bouncycastle - bcpkix-jdk15on + bcpkix-jdk18on false ${project.build.directory}/lib @@ -935,7 +941,7 @@ org.bouncycastle - bctls-jdk15on + bctls-jdk18on false ${project.build.directory}/lib @@ -970,9 +976,9 @@ org.apache.tomcat.embed:tomcat-embed-core org.apache.geronimo.specs:geronimo-servlet_3.0_spec org.apache.geronimo.specs:geronimo-javamail_1.4_spec - org.bouncycastle:bcprov-jdk15on - org.bouncycastle:bcpkix-jdk15on - org.bouncycastle:bctls-jdk15on + org.bouncycastle:bcprov-jdk18on + org.bouncycastle:bcpkix-jdk18on + org.bouncycastle:bctls-jdk18on com.mysql:mysql-connector-j org.apache.cloudstack:cloud-plugin-storage-volume-storpool org.apache.cloudstack:cloud-plugin-storage-volume-linstor @@ -1102,6 +1108,11 @@ cloud-plugin-network-nsx ${project.version} + + org.apache.cloudstack + cloud-plugin-network-netris + ${project.version} + org.apache.cloudstack cloud-plugin-network-tungsten diff --git a/client/src/main/java/org/apache/cloudstack/ACSRequestLog.java b/client/src/main/java/org/apache/cloudstack/ACSRequestLog.java new file mode 100644 index 000000000000..249451120f1c --- /dev/null +++ b/client/src/main/java/org/apache/cloudstack/ACSRequestLog.java @@ -0,0 +1,85 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack; + +import com.cloud.api.ApiServlet; +import com.cloud.utils.StringUtils; +import org.eclipse.jetty.server.NCSARequestLog; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Response; +import org.eclipse.jetty.util.DateCache; +import org.eclipse.jetty.util.component.LifeCycle; + +import java.net.InetAddress; +import java.util.Locale; +import java.util.TimeZone; + +import static org.apache.commons.configuration.DataConfiguration.DEFAULT_DATE_FORMAT; + +public class ACSRequestLog extends NCSARequestLog { + private static final ThreadLocal buffers = + ThreadLocal.withInitial(() -> new StringBuilder(256)); + + private final DateCache dateCache; + + public ACSRequestLog() { + super(); + + TimeZone timeZone = TimeZone.getTimeZone("GMT"); + Locale locale = Locale.getDefault(); + dateCache = new DateCache(DEFAULT_DATE_FORMAT, locale, timeZone); + } + + @Override + public void log(Request request, Response response) { + String requestURI = StringUtils.cleanString(request.getOriginalURI()); + try { + StringBuilder sb = buffers.get(); + sb.setLength(0); + + InetAddress remoteAddress = ApiServlet.getClientAddress(request); + sb.append(remoteAddress.getHostAddress()) + .append(" - - [") + .append(dateCache.format(request.getTimeStamp())) + .append("] \"") + .append(request.getMethod()) + .append(" ") + .append(requestURI) + .append(" ") + .append(request.getProtocol()) + .append("\" ") + .append(response.getStatus()) + .append(" ") + .append(response.getHttpChannel().getBytesWritten()) // apply filter here? + .append(" \"-\" \"") + .append(request.getHeader("User-Agent")) + .append("\""); + + write(sb.toString()); + } catch (Exception e) { + LOG.warn("Unable to log request", e); + } + } + + @Override + protected void stop(LifeCycle lifeCycle) throws Exception { + buffers.remove(); + super.stop(lifeCycle); + } +} diff --git a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java index c6fd2ff24dc8..06477fff8986 100644 --- a/client/src/main/java/org/apache/cloudstack/ServerDaemon.java +++ b/client/src/main/java/org/apache/cloudstack/ServerDaemon.java @@ -32,7 +32,6 @@ import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; -import org.eclipse.jetty.server.NCSARequestLog; import org.eclipse.jetty.server.RequestLog; import org.eclipse.jetty.server.SecureRequestCustomizer; import org.eclipse.jetty.server.Server; @@ -72,11 +71,6 @@ public class ServerDaemon implements Daemon { private static final String BIND_INTERFACE = "bind.interface"; private static final String CONTEXT_PATH = "context.path"; private static final String SESSION_TIMEOUT = "session.timeout"; - private static final String HTTP_ENABLE = "http.enable"; - private static final String HTTP_PORT = "http.port"; - private static final String HTTPS_ENABLE = "https.enable"; - private static final String HTTPS_PORT = "https.port"; - private static final String KEYSTORE_FILE = "https.keystore"; private static final String KEYSTORE_PASSWORD = "https.keystore.password"; private static final String WEBAPP_DIR = "webapp.dir"; private static final String ACCESS_LOG = "access.log"; @@ -84,6 +78,8 @@ public class ServerDaemon implements Daemon { private static final int DEFAULT_REQUEST_CONTENT_SIZE = 1048576; private static final String REQUEST_MAX_FORM_KEYS_KEY = "request.max.form.keys"; private static final int DEFAULT_REQUEST_MAX_FORM_KEYS = 5000; + private static final String THREADS_MIN = "threads.min"; + private static final String THREADS_MAX = "threads.max"; //////////////////////////////////////////////////////// /////////////// Server Configuration /////////////////// @@ -104,6 +100,8 @@ public class ServerDaemon implements Daemon { private String keystoreFile; private String keystorePassword; private String webAppLocation; + private int minThreads; + private int maxThreads; ////////////////////////////////////////////////// /////////////// Public methods /////////////////// @@ -134,17 +132,19 @@ public void init(final DaemonContext context) { } setBindInterface(properties.getProperty(BIND_INTERFACE, null)); setContextPath(properties.getProperty(CONTEXT_PATH, "/client")); - setHttpEnable(Boolean.valueOf(properties.getProperty(HTTP_ENABLE, "true"))); - setHttpPort(Integer.valueOf(properties.getProperty(HTTP_PORT, "8080"))); - setHttpsEnable(Boolean.valueOf(properties.getProperty(HTTPS_ENABLE, "false"))); - setHttpsPort(Integer.valueOf(properties.getProperty(HTTPS_PORT, "8443"))); - setKeystoreFile(properties.getProperty(KEYSTORE_FILE)); + setHttpEnable(Boolean.valueOf(properties.getProperty(ServerProperties.HTTP_ENABLE, "true"))); + setHttpPort(Integer.valueOf(properties.getProperty(ServerProperties.HTTP_PORT, "8080"))); + setHttpsEnable(Boolean.valueOf(properties.getProperty(ServerProperties.HTTPS_ENABLE, "false"))); + setHttpsPort(Integer.valueOf(properties.getProperty(ServerProperties.HTTPS_PORT, "8443"))); + setKeystoreFile(properties.getProperty(ServerProperties.KEYSTORE_FILE)); setKeystorePassword(properties.getProperty(KEYSTORE_PASSWORD)); setWebAppLocation(properties.getProperty(WEBAPP_DIR)); setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log")); setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30"))); setMaxFormContentSize(Integer.valueOf(properties.getProperty(REQUEST_CONTENT_SIZE_KEY, String.valueOf(DEFAULT_REQUEST_CONTENT_SIZE)))); setMaxFormKeys(Integer.valueOf(properties.getProperty(REQUEST_MAX_FORM_KEYS_KEY, String.valueOf(DEFAULT_REQUEST_MAX_FORM_KEYS)))); + setMinThreads(Integer.valueOf(properties.getProperty(THREADS_MIN, "10"))); + setMaxThreads(Integer.valueOf(properties.getProperty(THREADS_MAX, "500"))); } catch (final IOException e) { logger.warn("Failed to read configuration from server.properties file", e); } finally { @@ -162,8 +162,8 @@ public void init(final DaemonContext context) { public void start() throws Exception { // Thread pool final QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setMinThreads(10); - threadPool.setMaxThreads(500); + threadPool.setMinThreads(minThreads); + threadPool.setMaxThreads(maxThreads); // Jetty Server server = new Server(threadPool); @@ -299,7 +299,7 @@ private Pair createHandlers() { } private RequestLog createRequestLog() { - final NCSARequestLog log = new NCSARequestLog(); + final ACSRequestLog log = new ACSRequestLog(); final File logPath = new File(accessLogFile); final File parentFile = logPath.getParentFile(); if (parentFile != null) { @@ -376,4 +376,12 @@ public void setMaxFormContentSize(int maxFormContentSize) { public void setMaxFormKeys(int maxFormKeys) { this.maxFormKeys = maxFormKeys; } + + public void setMinThreads(int minThreads) { + this.minThreads = minThreads; + } + + public void setMaxThreads(int maxThreads) { + this.maxThreads = maxThreads; + } } diff --git a/cloud-cli/bindir/cloud-tool b/cloud-cli/bindir/cloud-tool index 410681a0dd5d..0f0815307a13 100755 --- a/cloud-cli/bindir/cloud-tool +++ b/cloud-cli/bindir/cloud-tool @@ -7,9 +7,9 @@ # to you 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 @@ -25,4 +25,5 @@ sys.path.append(os.path.dirname(os.path.dirname(__file__))) import cloudtool ret = cloudtool.main() -if ret: sys.exit(ret) +if ret: + sys.exit(ret) diff --git a/core/pom.xml b/core/pom.xml index 25ac46518b33..f91a330b7ba9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT diff --git a/core/src/main/java/com/cloud/agent/api/CheckConvertInstanceCommand.java b/core/src/main/java/com/cloud/agent/api/CheckConvertInstanceCommand.java index fc066e5c5899..c46fb697a3c1 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckConvertInstanceCommand.java +++ b/core/src/main/java/com/cloud/agent/api/CheckConvertInstanceCommand.java @@ -18,6 +18,8 @@ public class CheckConvertInstanceCommand extends Command { boolean checkWindowsGuestConversionSupport = false; + boolean useVddk = false; + String vddkLibDir; public CheckConvertInstanceCommand() { } @@ -26,6 +28,11 @@ public CheckConvertInstanceCommand(boolean checkWindowsGuestConversionSupport) { this.checkWindowsGuestConversionSupport = checkWindowsGuestConversionSupport; } + public CheckConvertInstanceCommand(boolean checkWindowsGuestConversionSupport, boolean useVddk) { + this.checkWindowsGuestConversionSupport = checkWindowsGuestConversionSupport; + this.useVddk = useVddk; + } + @Override public boolean executeInSequence() { return false; @@ -34,4 +41,20 @@ public boolean executeInSequence() { public boolean getCheckWindowsGuestConversionSupport() { return checkWindowsGuestConversionSupport; } + + public boolean isUseVddk() { + return useVddk; + } + + public void setUseVddk(boolean useVddk) { + this.useVddk = useVddk; + } + + public String getVddkLibDir() { + return vddkLibDir; + } + + public void setVddkLibDir(String vddkLibDir) { + this.vddkLibDir = vddkLibDir; + } } diff --git a/core/src/main/java/com/cloud/agent/api/CheckOnHostAnswer.java b/core/src/main/java/com/cloud/agent/api/CheckOnHostAnswer.java index 5a26b22ec6a5..41e266784db8 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckOnHostAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/CheckOnHostAnswer.java @@ -38,6 +38,8 @@ public CheckOnHostAnswer(CheckOnHostCommand cmd, Boolean alive, String details) public CheckOnHostAnswer(CheckOnHostCommand cmd, String details) { super(cmd, false, details); + determined = false; + alive = false; } public boolean isDetermined() { @@ -47,5 +49,4 @@ public boolean isDetermined() { public boolean isAlive() { return alive; } - } diff --git a/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java b/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java index 94239f2900ef..72b5217604dc 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java +++ b/core/src/main/java/com/cloud/agent/api/CheckOnHostCommand.java @@ -24,7 +24,7 @@ public class CheckOnHostCommand extends Command { HostTO host; - boolean reportCheckFailureIfOneStorageIsDown; + boolean reportIfHeartBeatFailedForOneStoragePool; protected CheckOnHostCommand() { } @@ -34,17 +34,17 @@ public CheckOnHostCommand(Host host) { setWait(20); } - public CheckOnHostCommand(Host host, boolean reportCheckFailureIfOneStorageIsDown) { + public CheckOnHostCommand(Host host, boolean reportIfHeartBeatFailedForOneStoragePool) { this(host); - this.reportCheckFailureIfOneStorageIsDown = reportCheckFailureIfOneStorageIsDown; + this.reportIfHeartBeatFailedForOneStoragePool = reportIfHeartBeatFailedForOneStoragePool; } public HostTO getHost() { return host; } - public boolean isCheckFailedOnOneStorage() { - return reportCheckFailureIfOneStorageIsDown; + public boolean shouldReportIfHeartBeatFailedForOneStoragePool() { + return reportIfHeartBeatFailedForOneStoragePool; } @Override diff --git a/core/src/main/java/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java b/core/src/main/java/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java index b299c602dde5..351702a048ca 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/CheckS2SVpnConnectionsAnswer.java @@ -25,7 +25,6 @@ public class CheckS2SVpnConnectionsAnswer extends Answer { Map ipToConnected; Map ipToDetail; - String details; protected CheckS2SVpnConnectionsAnswer() { ipToConnected = new HashMap(); diff --git a/core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java b/core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java index 5a32ab59a7a2..07b7e102df96 100644 --- a/core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/CheckVolumeAnswer.java @@ -17,22 +17,33 @@ package com.cloud.agent.api; +import org.apache.cloudstack.storage.volume.VolumeOnStorageTO; + +import java.util.Map; + public class CheckVolumeAnswer extends Answer { private long size; + private Map volumeDetails; CheckVolumeAnswer() { } - public CheckVolumeAnswer(CheckVolumeCommand cmd, String details, long size) { - super(cmd, true, details); + public CheckVolumeAnswer(CheckVolumeCommand cmd, final boolean success, String details, long size, + Map volumeDetails) { + super(cmd, success, details); this.size = size; + this.volumeDetails = volumeDetails; } public long getSize() { return size; } + public Map getVolumeDetails() { + return volumeDetails; + } + public String getString() { return "CheckVolumeAnswer [size=" + size + "]"; } diff --git a/core/src/main/java/com/cloud/agent/api/ConvertInstanceAnswer.java b/core/src/main/java/com/cloud/agent/api/ConvertInstanceAnswer.java index 174348f4f180..8092ab9b43f5 100644 --- a/core/src/main/java/com/cloud/agent/api/ConvertInstanceAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/ConvertInstanceAnswer.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.agent.api; -import org.apache.cloudstack.vm.UnmanagedInstanceTO; - public class ConvertInstanceAnswer extends Answer { private String temporaryConvertUuid; @@ -25,16 +23,6 @@ public class ConvertInstanceAnswer extends Answer { public ConvertInstanceAnswer() { super(); } - private UnmanagedInstanceTO convertedInstance; - - public ConvertInstanceAnswer(Command command, boolean success, String details) { - super(command, success, details); - } - - public ConvertInstanceAnswer(Command command, UnmanagedInstanceTO convertedInstance) { - super(command, true, ""); - this.convertedInstance = convertedInstance; - } public ConvertInstanceAnswer(Command command, String temporaryConvertUuid) { super(command, true, ""); @@ -44,8 +32,4 @@ public ConvertInstanceAnswer(Command command, String temporaryConvertUuid) { public String getTemporaryConvertUuid() { return temporaryConvertUuid; } - - public UnmanagedInstanceTO getConvertedInstance() { - return convertedInstance; - } } diff --git a/core/src/main/java/com/cloud/agent/api/ConvertInstanceCommand.java b/core/src/main/java/com/cloud/agent/api/ConvertInstanceCommand.java index b8250903f858..38e0dca7736c 100644 --- a/core/src/main/java/com/cloud/agent/api/ConvertInstanceCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ConvertInstanceCommand.java @@ -20,44 +20,46 @@ import com.cloud.agent.api.to.RemoteInstanceTO; import com.cloud.hypervisor.Hypervisor; -import java.util.List; - public class ConvertInstanceCommand extends Command { private RemoteInstanceTO sourceInstance; + private String originalVMName; private Hypervisor.HypervisorType destinationHypervisorType; - private List destinationStoragePools; private DataStoreTO conversionTemporaryLocation; private String templateDirOnConversionLocation; private boolean checkConversionSupport; private boolean exportOvfToConversionLocation; private int threadsCountToExportOvf = 0; + private String extraParams; + private boolean useVddk; + private String vddkLibDir; + private String vddkTransports; + private String vddkThumbprint; public ConvertInstanceCommand() { } - public ConvertInstanceCommand(RemoteInstanceTO sourceInstance, Hypervisor.HypervisorType destinationHypervisorType, - List destinationStoragePools, DataStoreTO conversionTemporaryLocation, - String templateDirOnConversionLocation, boolean checkConversionSupport, boolean exportOvfToConversionLocation) { + public ConvertInstanceCommand(RemoteInstanceTO sourceInstance, Hypervisor.HypervisorType destinationHypervisorType, DataStoreTO conversionTemporaryLocation, + String templateDirOnConversionLocation, boolean checkConversionSupport, boolean exportOvfToConversionLocation, String sourceVMName) { this.sourceInstance = sourceInstance; this.destinationHypervisorType = destinationHypervisorType; - this.destinationStoragePools = destinationStoragePools; this.conversionTemporaryLocation = conversionTemporaryLocation; this.templateDirOnConversionLocation = templateDirOnConversionLocation; this.checkConversionSupport = checkConversionSupport; this.exportOvfToConversionLocation = exportOvfToConversionLocation; + this.originalVMName = sourceVMName; } public RemoteInstanceTO getSourceInstance() { return sourceInstance; } - public Hypervisor.HypervisorType getDestinationHypervisorType() { - return destinationHypervisorType; + public String getOriginalVMName() { + return originalVMName; } - public List getDestinationStoragePools() { - return destinationStoragePools; + public Hypervisor.HypervisorType getDestinationHypervisorType() { + return destinationHypervisorType; } public DataStoreTO getConversionTemporaryLocation() { @@ -84,6 +86,46 @@ public void setThreadsCountToExportOvf(int threadsCountToExportOvf) { this.threadsCountToExportOvf = threadsCountToExportOvf; } + public String getExtraParams() { + return extraParams; + } + + public void setExtraParams(String extraParams) { + this.extraParams = extraParams; + } + + public boolean isUseVddk() { + return useVddk; + } + + public void setUseVddk(boolean useVddk) { + this.useVddk = useVddk; + } + + public String getVddkLibDir() { + return vddkLibDir; + } + + public void setVddkLibDir(String vddkLibDir) { + this.vddkLibDir = vddkLibDir; + } + + public String getVddkTransports() { + return vddkTransports; + } + + public void setVddkTransports(String vddkTransports) { + this.vddkTransports = vddkTransports; + } + + public String getVddkThumbprint() { + return vddkThumbprint; + } + + public void setVddkThumbprint(String vddkThumbprint) { + this.vddkThumbprint = vddkThumbprint; + } + @Override public boolean executeInSequence() { return false; diff --git a/core/src/main/java/com/cloud/agent/api/ConvertSnapshotAnswer.java b/core/src/main/java/com/cloud/agent/api/ConvertSnapshotAnswer.java new file mode 100644 index 000000000000..c19a061f736c --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/ConvertSnapshotAnswer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api; + +import org.apache.cloudstack.storage.to.SnapshotObjectTO; + +public class ConvertSnapshotAnswer extends Answer { + + private SnapshotObjectTO snapshotObjectTO; + + public ConvertSnapshotAnswer(SnapshotObjectTO snapshotObjectTO) { + super(null); + this.snapshotObjectTO = snapshotObjectTO; + } + + public SnapshotObjectTO getSnapshotObjectTO() { + return snapshotObjectTO; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/ConvertSnapshotCommand.java b/core/src/main/java/com/cloud/agent/api/ConvertSnapshotCommand.java new file mode 100644 index 000000000000..e456d4b6b122 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/ConvertSnapshotCommand.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api; + +import org.apache.cloudstack.storage.to.SnapshotObjectTO; + +public class ConvertSnapshotCommand extends Command { + + public static final String TEMP_SNAPSHOT_NAME = "_temp"; + + SnapshotObjectTO snapshotObjectTO; + + public SnapshotObjectTO getSnapshotObjectTO() { + return snapshotObjectTO; + } + + public ConvertSnapshotCommand(SnapshotObjectTO snapshotObjectTO) { + this.snapshotObjectTO = snapshotObjectTO; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/CopyRemoteVolumeAnswer.java b/core/src/main/java/com/cloud/agent/api/CopyRemoteVolumeAnswer.java index e79005be71b9..4aec0b26581b 100644 --- a/core/src/main/java/com/cloud/agent/api/CopyRemoteVolumeAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/CopyRemoteVolumeAnswer.java @@ -17,21 +17,28 @@ package com.cloud.agent.api; +import org.apache.cloudstack.storage.volume.VolumeOnStorageTO; + +import java.util.Map; + public class CopyRemoteVolumeAnswer extends Answer { private String remoteIp; private String filename; private long size; + private Map volumeDetails; CopyRemoteVolumeAnswer() { } - public CopyRemoteVolumeAnswer(CopyRemoteVolumeCommand cmd, String details, String filename, long size) { - super(cmd, true, details); + public CopyRemoteVolumeAnswer(CopyRemoteVolumeCommand cmd, final boolean success, String details, String filename, long size, + Map volumeDetails) { + super(cmd, success, details); this.remoteIp = cmd.getRemoteIp(); this.filename = filename; this.size = size; + this.volumeDetails = volumeDetails; } public String getRemoteIp() { @@ -54,6 +61,10 @@ public long getSize() { return size; } + public Map getVolumeDetails() { + return volumeDetails; + } + public String getString() { return "CopyRemoteVolumeAnswer [remoteIp=" + remoteIp + "]"; } diff --git a/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java b/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java index 969dd2eb801c..84ca39f15464 100644 --- a/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java +++ b/core/src/main/java/com/cloud/agent/api/DeleteStoragePoolCommand.java @@ -21,10 +21,10 @@ import java.io.File; import java.util.Map; -import java.util.UUID; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.storage.StoragePool; +import com.cloud.utils.UuidUtils; public class DeleteStoragePoolCommand extends Command { public static final String DATASTORE_NAME = "datastoreName"; @@ -49,7 +49,7 @@ public DeleteStoragePoolCommand(StoragePool pool, String localPath) { } public DeleteStoragePoolCommand(StoragePool pool) { - this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); + this(pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); } public void setPool(StoragePool pool) { diff --git a/core/src/main/java/com/cloud/agent/api/GetExternalConsoleAnswer.java b/core/src/main/java/com/cloud/agent/api/GetExternalConsoleAnswer.java new file mode 100644 index 000000000000..e913d6f0d3a1 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/GetExternalConsoleAnswer.java @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +public class GetExternalConsoleAnswer extends Answer { + + private String url; + private String host; + private Integer port; + @LogLevel(LogLevel.Log4jLevel.Off) + private String password; + private String protocol; + private boolean passwordOneTimeUseOnly; + + public GetExternalConsoleAnswer(Command command, String details) { + super(command, false, details); + } + + public GetExternalConsoleAnswer(Command command, String url, String host, Integer port, String password, + boolean passwordOneTimeUseOnly, String protocol) { + super(command, true, ""); + this.url = url; + this.host = host; + this.port = port; + this.password = password; + this.passwordOneTimeUseOnly = passwordOneTimeUseOnly; + this.protocol = protocol; + } + + public String getUrl() { + return url; + } + + public String getHost() { + return host; + } + + public Integer getPort() { + return port; + } + + public String getPassword() { + return password; + } + + public String getProtocol() { + return protocol; + } + + public boolean isPasswordOneTimeUseOnly() { + return passwordOneTimeUseOnly; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/GetExternalConsoleCommand.java b/core/src/main/java/com/cloud/agent/api/GetExternalConsoleCommand.java new file mode 100644 index 000000000000..fc2134f631fb --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/GetExternalConsoleCommand.java @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import com.cloud.agent.api.to.VirtualMachineTO; + +public class GetExternalConsoleCommand extends Command { + String vmName; + VirtualMachineTO vm; + protected boolean executeInSequence; + + public GetExternalConsoleCommand(String vmName, VirtualMachineTO vm) { + this.vmName = vmName; + this.vm = vm; + this.executeInSequence = false; + } + + public String getVmName() { + return this.vmName; + } + + public void setVirtualMachine(VirtualMachineTO vm) { + this.vm = vm; + } + + public VirtualMachineTO getVirtualMachine() { + return vm; + } + + @Override + public boolean executeInSequence() { + return executeInSequence; + } + + public void setExecuteInSequence(boolean executeInSequence) { + this.executeInSequence = executeInSequence; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/GetGPUStatsAnswer.java b/core/src/main/java/com/cloud/agent/api/GetGPUStatsAnswer.java index 8b3cd44e207f..5bf70ed086f6 100644 --- a/core/src/main/java/com/cloud/agent/api/GetGPUStatsAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/GetGPUStatsAnswer.java @@ -19,7 +19,9 @@ package com.cloud.agent.api; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import com.cloud.agent.api.LogLevel.Log4jLevel; @@ -27,6 +29,7 @@ public class GetGPUStatsAnswer extends Answer { private HashMap> groupDetails; + private List gpuDevices = new ArrayList<>(); public GetGPUStatsAnswer(final GetGPUStatsCommand cmd, final HashMap> groupDetails) { super(cmd); @@ -37,7 +40,21 @@ public GetGPUStatsAnswer(final GetGPUStatsCommand cmd, final boolean success, fi super(cmd, success, details); } + public GetGPUStatsAnswer(final GetGPUStatsCommand cmd, final List gpuDevices) { + super(cmd); + this.gpuDevices = gpuDevices; + } + + public HashMap> getGroupDetails() { return groupDetails; } + + public List getGpuDevices() { + return gpuDevices; + } + + public void setGpuDevices(List gpuDevices) { + this.gpuDevices = gpuDevices; + } } diff --git a/core/src/main/java/com/cloud/agent/api/GetVmIpAddressCommand.java b/core/src/main/java/com/cloud/agent/api/GetVmIpAddressCommand.java index a9c7413b9f07..4efc0781f919 100644 --- a/core/src/main/java/com/cloud/agent/api/GetVmIpAddressCommand.java +++ b/core/src/main/java/com/cloud/agent/api/GetVmIpAddressCommand.java @@ -24,11 +24,13 @@ public class GetVmIpAddressCommand extends Command { String vmName; String vmNetworkCidr; boolean windows = false; + String macAddress; - public GetVmIpAddressCommand(String vmName, String vmNetworkCidr, boolean windows) { + public GetVmIpAddressCommand(String vmName, String vmNetworkCidr, boolean windows, String macAddress) { this.vmName = vmName; this.windows = windows; this.vmNetworkCidr = vmNetworkCidr; + this.macAddress = macAddress; } @Override @@ -47,4 +49,8 @@ public boolean isWindows(){ public String getVmNetworkCidr() { return vmNetworkCidr; } + + public String getMacAddress() { + return macAddress; + } } diff --git a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/RoleTest.java b/core/src/main/java/com/cloud/agent/api/HandleCksIsoCommand.java similarity index 63% rename from framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/RoleTest.java rename to core/src/main/java/com/cloud/agent/api/HandleCksIsoCommand.java index 88265ee4e551..16942bb05d44 100644 --- a/framework/quota/src/test/java/org/apache/cloudstack/quota/activationrule/presetvariables/RoleTest.java +++ b/core/src/main/java/com/cloud/agent/api/HandleCksIsoCommand.java @@ -1,3 +1,4 @@ +// // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information @@ -14,21 +15,20 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +// +package com.cloud.agent.api; -package org.apache.cloudstack.quota.activationrule.presetvariables; +import com.cloud.agent.api.routing.NetworkElementCommand; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +public class HandleCksIsoCommand extends NetworkElementCommand { -@RunWith(MockitoJUnitRunner.class) -public class RoleTest { + private boolean mountCksIso; + + public HandleCksIsoCommand(boolean mountCksIso) { + this.mountCksIso = mountCksIso; + } - @Test - public void setTagsTestAddFieldTagsToCollection() { - Role variable = new Role(); - variable.setType(null); - Assert.assertTrue(variable.fieldNamesToIncludeInToString.contains("type")); + public boolean isMountCksIso() { + return mountCksIso; } } diff --git a/core/src/main/java/com/cloud/agent/api/ImportConvertedInstanceCommand.java b/core/src/main/java/com/cloud/agent/api/ImportConvertedInstanceCommand.java index 9d50e852ced4..eadfa6556f86 100644 --- a/core/src/main/java/com/cloud/agent/api/ImportConvertedInstanceCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ImportConvertedInstanceCommand.java @@ -27,17 +27,20 @@ public class ImportConvertedInstanceCommand extends Command { private List destinationStoragePools; private DataStoreTO conversionTemporaryLocation; private String temporaryConvertUuid; + private boolean forceConvertToPool; public ImportConvertedInstanceCommand() { } public ImportConvertedInstanceCommand(RemoteInstanceTO sourceInstance, List destinationStoragePools, - DataStoreTO conversionTemporaryLocation, String temporaryConvertUuid) { + DataStoreTO conversionTemporaryLocation, String temporaryConvertUuid, + boolean forceConvertToPool) { this.sourceInstance = sourceInstance; this.destinationStoragePools = destinationStoragePools; this.conversionTemporaryLocation = conversionTemporaryLocation; this.temporaryConvertUuid = temporaryConvertUuid; + this.forceConvertToPool = forceConvertToPool; } public RemoteInstanceTO getSourceInstance() { @@ -56,6 +59,10 @@ public String getTemporaryConvertUuid() { return temporaryConvertUuid; } + public boolean isForceConvertToPool() { + return forceConvertToPool; + } + @Override public boolean executeInSequence() { return false; diff --git a/core/src/main/java/com/cloud/agent/api/MigrateCommand.java b/core/src/main/java/com/cloud/agent/api/MigrateCommand.java index 3acdb9c351b5..5ac4e9ae445e 100644 --- a/core/src/main/java/com/cloud/agent/api/MigrateCommand.java +++ b/core/src/main/java/com/cloud/agent/api/MigrateCommand.java @@ -29,14 +29,14 @@ public class MigrateCommand extends Command { private String vmName; - private String destIp; + private String destinationIp; private Map migrateStorage; private boolean migrateStorageManaged; private boolean migrateNonSharedInc; private boolean autoConvergence; private String hostGuid; - private boolean isWindows; - private VirtualMachineTO vmTO; + private boolean windows; + private VirtualMachineTO virtualMachine; private boolean executeInSequence = false; private List migrateDiskInfoList = new ArrayList<>(); private Map dpdkInterfaceMapping = new HashMap<>(); @@ -64,11 +64,11 @@ public void setVlanToPersistenceMap(Map vlanToPersistenceMap) { protected MigrateCommand() { } - public MigrateCommand(String vmName, String destIp, boolean isWindows, VirtualMachineTO vmTO, boolean executeInSequence) { + public MigrateCommand(String vmName, String destinationIp, boolean windows, VirtualMachineTO virtualMachine, boolean executeInSequence) { this.vmName = vmName; - this.destIp = destIp; - this.isWindows = isWindows; - this.vmTO = vmTO; + this.destinationIp = destinationIp; + this.windows = windows; + this.virtualMachine = virtualMachine; this.executeInSequence = executeInSequence; } @@ -105,15 +105,15 @@ public boolean isAutoConvergence() { } public boolean isWindows() { - return isWindows; + return windows; } public VirtualMachineTO getVirtualMachine() { - return vmTO; + return virtualMachine; } public String getDestinationIp() { - return destIp; + return destinationIp; } public String getVmName() { @@ -233,4 +233,9 @@ public void setSourceDiskOnStorageFileSystem(boolean isDiskOnFileSystemStorage) this.isSourceDiskOnStorageFileSystem = isDiskOnFileSystemStorage; } } + + @Override + public boolean isReconcile() { + return true; + } } diff --git a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolAnswer.java b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolAnswer.java index 552ffb85aaf6..275468214f51 100644 --- a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolAnswer.java @@ -46,6 +46,14 @@ public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, templateInfo = tInfo; } + public ModifyStoragePoolAnswer(final Command command, final boolean success, final String details) { + super(command, success, details); + } + + public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + public void setPoolInfo(StoragePoolInfo poolInfo) { this.poolInfo = poolInfo; } diff --git a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java index 06940266b538..a72000d73995 100644 --- a/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ModifyStoragePoolCommand.java @@ -21,10 +21,10 @@ import java.io.File; import java.util.Map; -import java.util.UUID; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.storage.StoragePool; +import com.cloud.utils.UuidUtils; public class ModifyStoragePoolCommand extends Command { public static final String LOCAL_PATH_PREFIX = "/mnt/"; @@ -47,11 +47,11 @@ public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath, } public ModifyStoragePoolCommand(boolean add, StoragePool pool, Map details) { - this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()), details); + this(add, pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()), details); } public ModifyStoragePoolCommand(boolean add, StoragePool pool) { - this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); + this(add, pool, LOCAL_PATH_PREFIX + File.separator + UuidUtils.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); } public boolean getAdd() { diff --git a/core/src/main/java/com/cloud/agent/api/PingAnswer.java b/core/src/main/java/com/cloud/agent/api/PingAnswer.java index 3a40ad3925f2..22eb4443f8a4 100644 --- a/core/src/main/java/com/cloud/agent/api/PingAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/PingAnswer.java @@ -19,6 +19,7 @@ package com.cloud.agent.api; +import java.util.ArrayList; import java.util.List; public class PingAnswer extends Answer { @@ -27,6 +28,8 @@ public class PingAnswer extends Answer { private boolean sendStartup = false; private List avoidMsList; + private List reconcileCommands = new ArrayList<>(); + protected PingAnswer() { } @@ -49,6 +52,18 @@ public void setSendStartup(boolean sendStartup) { this.sendStartup = sendStartup; } + public List getReconcileCommands() { + return reconcileCommands; + } + + public void setReconcileCommands(List reconcileCommands) { + this.reconcileCommands = reconcileCommands; + } + + public void addReconcileCommand(String reconcileCommand) { + this.reconcileCommands.add(reconcileCommand); + } + public List getAvoidMsList() { return avoidMsList; } diff --git a/core/src/main/java/com/cloud/agent/api/PingCommand.java b/core/src/main/java/com/cloud/agent/api/PingCommand.java index 4192fc2e7474..4ae64da89c3c 100644 --- a/core/src/main/java/com/cloud/agent/api/PingCommand.java +++ b/core/src/main/java/com/cloud/agent/api/PingCommand.java @@ -20,11 +20,14 @@ package com.cloud.agent.api; import com.cloud.host.Host; +import org.apache.cloudstack.command.CommandInfo; public class PingCommand extends Command { Host.Type hostType; long hostId; boolean outOfBand; + @LogLevel(LogLevel.Log4jLevel.Trace) + private CommandInfo[] commandInfos = new CommandInfo[] {}; protected PingCommand() { } @@ -78,4 +81,12 @@ public int hashCode() { result = 31 * result + (int) (hostId ^ (hostId >>> 32)); return result; } + + public CommandInfo[] getCommandInfos() { + return commandInfos; + } + + public void setCommandInfos(CommandInfo[] commandInfos) { + this.commandInfos = commandInfos; + } } diff --git a/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningAnswer.java b/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningAnswer.java new file mode 100644 index 000000000000..b94d18c537ea --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningAnswer.java @@ -0,0 +1,51 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import java.util.Map; + +import com.cloud.agent.api.to.VirtualMachineTO; + +public class PrepareExternalProvisioningAnswer extends Answer { + + Map serverDetails; + VirtualMachineTO virtualMachineTO; + + public PrepareExternalProvisioningAnswer() { + super(); + } + + public PrepareExternalProvisioningAnswer(PrepareExternalProvisioningCommand cmd, Map externalDetails, VirtualMachineTO virtualMachineTO, String details) { + super(cmd, true, details); + this.serverDetails = externalDetails; + this.virtualMachineTO = virtualMachineTO; + } + + public PrepareExternalProvisioningAnswer(PrepareExternalProvisioningCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + + public Map getServerDetails() { + return serverDetails; + } + + public VirtualMachineTO getVirtualMachineTO() { + return virtualMachineTO; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningCommand.java b/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningCommand.java new file mode 100644 index 000000000000..44f57607eba9 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/PrepareExternalProvisioningCommand.java @@ -0,0 +1,39 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import com.cloud.agent.api.to.VirtualMachineTO; + +public class PrepareExternalProvisioningCommand extends Command { + + VirtualMachineTO virtualMachineTO; + + public PrepareExternalProvisioningCommand(VirtualMachineTO vmTO) { + this.virtualMachineTO = vmTO; + } + + public VirtualMachineTO getVirtualMachineTO() { + return virtualMachineTO; + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/PropagateResourceEventCommand.java b/core/src/main/java/com/cloud/agent/api/PropagateResourceEventCommand.java index ed337885beed..21c4e7b97d03 100644 --- a/core/src/main/java/com/cloud/agent/api/PropagateResourceEventCommand.java +++ b/core/src/main/java/com/cloud/agent/api/PropagateResourceEventCommand.java @@ -24,6 +24,8 @@ public class PropagateResourceEventCommand extends Command { long hostId; ResourceState.Event event; + boolean forced; + boolean forceDeleteStorage; protected PropagateResourceEventCommand() { @@ -34,6 +36,13 @@ public PropagateResourceEventCommand(long hostId, ResourceState.Event event) { this.event = event; } + public PropagateResourceEventCommand(long hostId, ResourceState.Event event, boolean forced, boolean forceDeleteStorage) { + this.hostId = hostId; + this.event = event; + this.forced = forced; + this.forceDeleteStorage = forceDeleteStorage; + } + public long getHostId() { return hostId; } @@ -42,6 +51,14 @@ public ResourceState.Event getEvent() { return event; } + public boolean isForced() { + return forced; + } + + public boolean isForceDeleteStorage() { + return forceDeleteStorage; + } + @Override public boolean executeInSequence() { // TODO Auto-generated method stub diff --git a/core/src/main/java/com/cloud/agent/api/ReadyCommand.java b/core/src/main/java/com/cloud/agent/api/ReadyCommand.java index 49768297ad59..ee61fee66c63 100644 --- a/core/src/main/java/com/cloud/agent/api/ReadyCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ReadyCommand.java @@ -26,10 +26,6 @@ public class ReadyCommand extends Command { private String _details; - public ReadyCommand() { - super(); - } - private Long dcId; private Long hostId; private String hostUuid; @@ -41,6 +37,10 @@ public ReadyCommand() { private Boolean enableHumanReadableSizes; private String arch; + public ReadyCommand() { + super(); + } + public ReadyCommand(Long dcId) { super(); this.dcId = dcId; @@ -95,7 +95,7 @@ public List getAvoidMsHostList() { return avoidMsHostList; } - public void setAvoidMsHostList(List msHostList) { + public void setAvoidMsHostList(List avoidMsHostList) { this.avoidMsHostList = avoidMsHostList; } diff --git a/core/src/main/java/com/cloud/agent/api/RecreateCheckpointsCommand.java b/core/src/main/java/com/cloud/agent/api/RecreateCheckpointsCommand.java new file mode 100644 index 000000000000..154b611be98f --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/RecreateCheckpointsCommand.java @@ -0,0 +1,49 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import org.apache.cloudstack.storage.to.VolumeObjectTO; + +import java.util.List; + +public class RecreateCheckpointsCommand extends Command { + + private List volumes; + + private String vmName; + + public RecreateCheckpointsCommand(List volumes, String vmName) { + this.volumes = volumes; + this.vmName = vmName; + } + + public List getDisks() { + return volumes; + } + + public String getVmName() { + return vmName; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/RemoveBitmapCommand.java b/core/src/main/java/com/cloud/agent/api/RemoveBitmapCommand.java new file mode 100644 index 000000000000..90b62e3f17b9 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/RemoveBitmapCommand.java @@ -0,0 +1,46 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import org.apache.cloudstack.storage.to.SnapshotObjectTO; + +public class RemoveBitmapCommand extends Command { + + private SnapshotObjectTO snapshotObjectTO; + + private boolean isVmRunning; + + public RemoveBitmapCommand(SnapshotObjectTO snapshotObjectTO, boolean isVmRunning) { + this.snapshotObjectTO = snapshotObjectTO; + this.isVmRunning = isVmRunning; + } + + @Override + public boolean executeInSequence() { + return true; + } + + public SnapshotObjectTO getSnapshotObjectTO() { + return snapshotObjectTO; + } + + public boolean isVmRunning() { + return isVmRunning; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/RunCustomActionAnswer.java b/core/src/main/java/com/cloud/agent/api/RunCustomActionAnswer.java new file mode 100644 index 000000000000..1deb789c995f --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/RunCustomActionAnswer.java @@ -0,0 +1,32 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +public class RunCustomActionAnswer extends Answer { + + public RunCustomActionAnswer(RunCustomActionCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/RunCustomActionCommand.java b/core/src/main/java/com/cloud/agent/api/RunCustomActionCommand.java new file mode 100644 index 000000000000..113073ac5ee5 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/RunCustomActionCommand.java @@ -0,0 +1,61 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import java.util.Map; + +import com.cloud.agent.api.to.VirtualMachineTO; + +public class RunCustomActionCommand extends Command { + + String actionName; + VirtualMachineTO vmTO; + Map parameters; + + public RunCustomActionCommand(String actionName) { + this.actionName = actionName; + this.setWait(5); + } + + public String getActionName() { + return actionName; + } + + public VirtualMachineTO getVmTO() { + return vmTO; + } + + public void setVmTO(VirtualMachineTO vmTO) { + this.vmTO = vmTO; + } + + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/ScaleVmCommand.java b/core/src/main/java/com/cloud/agent/api/ScaleVmCommand.java index dc63b1ee746d..e2953e9c7ad7 100644 --- a/core/src/main/java/com/cloud/agent/api/ScaleVmCommand.java +++ b/core/src/main/java/com/cloud/agent/api/ScaleVmCommand.java @@ -30,6 +30,7 @@ public class ScaleVmCommand extends Command { Integer maxSpeed; long minRam; long maxRam; + private boolean limitCpuUseChange; public VirtualMachineTO getVm() { return vm; @@ -43,7 +44,7 @@ public int getCpus() { return cpus; } - public ScaleVmCommand(String vmName, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, boolean limitCpuUse) { + public ScaleVmCommand(String vmName, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, boolean limitCpuUse, Double cpuQuotaPercentage, boolean limitCpuUseChange) { super(); this.vmName = vmName; this.cpus = cpus; @@ -52,6 +53,8 @@ public ScaleVmCommand(String vmName, int cpus, Integer minSpeed, Integer maxSpee this.minRam = minRam; this.maxRam = maxRam; this.vm = new VirtualMachineTO(1L, vmName, null, cpus, minSpeed, maxSpeed, minRam, maxRam, null, null, false, limitCpuUse, null); + this.vm.setCpuQuotaPercentage(cpuQuotaPercentage); + this.limitCpuUseChange = limitCpuUseChange; } public void setCpus(int cpus) { @@ -102,6 +105,10 @@ public VirtualMachineTO getVirtualMachine() { return vm; } + public boolean getLimitCpuUseChange() { + return limitCpuUseChange; + } + @Override public boolean executeInSequence() { return true; diff --git a/core/src/main/java/com/cloud/agent/api/SetupGuestNetworkCommand.java b/core/src/main/java/com/cloud/agent/api/SetupGuestNetworkCommand.java index 06583f2d0d3d..fef0ceed6b85 100644 --- a/core/src/main/java/com/cloud/agent/api/SetupGuestNetworkCommand.java +++ b/core/src/main/java/com/cloud/agent/api/SetupGuestNetworkCommand.java @@ -36,6 +36,7 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand { String routerIpv6Gateway = null; String routerIpv6Cidr = null; boolean isVrGuestGateway = false; + long networkId; public NicTO getNic() { return nic; @@ -123,4 +124,12 @@ public boolean isVrGuestGateway() { public void setVrGuestGateway(boolean vrGuestGateway) { isVrGuestGateway = vrGuestGateway; } + + public long getNetworkId() { + return networkId; + } + + public void setNetworkId(long networkId) { + this.networkId = networkId; + } } diff --git a/core/src/main/java/com/cloud/agent/api/StartupRoutingCommand.java b/core/src/main/java/com/cloud/agent/api/StartupRoutingCommand.java index 286fced0c58a..068196aabe54 100644 --- a/core/src/main/java/com/cloud/agent/api/StartupRoutingCommand.java +++ b/core/src/main/java/com/cloud/agent/api/StartupRoutingCommand.java @@ -45,6 +45,7 @@ public class StartupRoutingCommand extends StartupCommand { List hostTags = new ArrayList(); String hypervisorVersion; HashMap> groupDetails = new HashMap>(); + List gpuDevices = new ArrayList<>(); private Boolean hostHealthCheckResult; public StartupRoutingCommand() { @@ -179,7 +180,7 @@ public void setHostTags(List hostTags) { this.hostTags = hostTags; } - public HashMap> getGpuGroupDetails() { + public HashMap> getGpuGroupDetails() { return groupDetails; } @@ -187,6 +188,14 @@ public void setGpuGroupDetails(HashMap> g this.groupDetails = groupDetails; } + public List getGpuDevices() { + return gpuDevices; + } + + public void setGpuDevices(List gpuDevices) { + this.gpuDevices = gpuDevices; + } + public boolean getSupportsClonedVolumes() { return supportsClonedVolumes; } diff --git a/core/src/main/java/com/cloud/agent/api/StopCommand.java b/core/src/main/java/com/cloud/agent/api/StopCommand.java index 3923a35bd0a7..d07ffa2e31f7 100644 --- a/core/src/main/java/com/cloud/agent/api/StopCommand.java +++ b/core/src/main/java/com/cloud/agent/api/StopCommand.java @@ -19,14 +19,14 @@ package com.cloud.agent.api; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import com.cloud.agent.api.to.DpdkTO; import com.cloud.agent.api.to.GPUDeviceTO; import com.cloud.vm.VirtualMachine; -import java.util.ArrayList; -import java.util.Map; -import java.util.List; - public class StopCommand extends RebootCommand { private boolean isProxy = false; private String urlPort = null; @@ -37,6 +37,7 @@ public class StopCommand extends RebootCommand { boolean forceStop = false; private Map dpdkInterfaceMapping; Map vlanToPersistenceMap; + boolean expungeVM = false; public Map getDpdkInterfaceMapping() { return dpdkInterfaceMapping; @@ -138,4 +139,12 @@ public Map getVlanToPersistenceMap() { public void setVlanToPersistenceMap(Map vlanToPersistenceMap) { this.vlanToPersistenceMap = vlanToPersistenceMap; } + + public boolean isExpungeVM() { + return expungeVM; + } + + public void setExpungeVM(boolean expungeVM) { + this.expungeVM = expungeVM; + } } diff --git a/core/src/main/java/com/cloud/agent/api/UnmanageInstanceAnswer.java b/core/src/main/java/com/cloud/agent/api/UnmanageInstanceAnswer.java new file mode 100644 index 000000000000..39a35d499906 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/UnmanageInstanceAnswer.java @@ -0,0 +1,27 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +public class UnmanageInstanceAnswer extends Answer { + + public UnmanageInstanceAnswer(UnmanageInstanceCommand cmd, boolean success, String details) { + super(cmd, success, details); + } +} diff --git a/core/src/main/java/com/cloud/agent/api/UnmanageInstanceCommand.java b/core/src/main/java/com/cloud/agent/api/UnmanageInstanceCommand.java new file mode 100644 index 000000000000..dd504b9ea265 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/UnmanageInstanceCommand.java @@ -0,0 +1,61 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +import com.cloud.agent.api.to.VirtualMachineTO; + +/** + */ +public class UnmanageInstanceCommand extends Command { + String instanceName; + boolean executeInSequence = false; + VirtualMachineTO vm; + boolean isConfigDriveAttached; + + @Override + public boolean executeInSequence() { + return executeInSequence; + } + + public UnmanageInstanceCommand(VirtualMachineTO vm) { + this.vm = vm; + this.instanceName = vm.getName(); + } + + public UnmanageInstanceCommand(String instanceName) { + this.instanceName = instanceName; + } + + public String getInstanceName() { + return instanceName; + } + + public VirtualMachineTO getVm() { + return vm; + } + + public boolean isConfigDriveAttached() { + return isConfigDriveAttached; + } + + public void setConfigDriveAttached(boolean configDriveAttached) { + isConfigDriveAttached = configDriveAttached; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/UnprepareStorageClientCommand.java b/core/src/main/java/com/cloud/agent/api/UnprepareStorageClientCommand.java index bebd30ca519d..b98ce6fa345e 100644 --- a/core/src/main/java/com/cloud/agent/api/UnprepareStorageClientCommand.java +++ b/core/src/main/java/com/cloud/agent/api/UnprepareStorageClientCommand.java @@ -19,18 +19,22 @@ package com.cloud.agent.api; +import java.util.Map; + import com.cloud.storage.Storage.StoragePoolType; public class UnprepareStorageClientCommand extends Command { private StoragePoolType poolType; private String poolUuid; + private Map details; public UnprepareStorageClientCommand() { } - public UnprepareStorageClientCommand(StoragePoolType poolType, String poolUuid) { + public UnprepareStorageClientCommand(StoragePoolType poolType, String poolUuid, Map details) { this.poolType = poolType; this.poolUuid = poolUuid; + this.details = details; } @Override @@ -45,4 +49,8 @@ public StoragePoolType getPoolType() { public String getPoolUuid() { return poolUuid; } + + public Map getDetails() { + return details; + } } diff --git a/core/src/main/java/com/cloud/agent/api/UpdateVmNicAnswer.java b/core/src/main/java/com/cloud/agent/api/UpdateVmNicAnswer.java new file mode 100644 index 000000000000..0af6d7fa3a3d --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/UpdateVmNicAnswer.java @@ -0,0 +1,27 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +public class UpdateVmNicAnswer extends Answer { + public UpdateVmNicAnswer() { + } + + public UpdateVmNicAnswer(UpdateVmNicCommand cmd, boolean success, String result) { + super(cmd, success, result); + } +} diff --git a/core/src/main/java/com/cloud/agent/api/UpdateVmNicCommand.java b/core/src/main/java/com/cloud/agent/api/UpdateVmNicCommand.java new file mode 100644 index 000000000000..a5c5faf32fed --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/UpdateVmNicCommand.java @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.api; + +public class UpdateVmNicCommand extends Command { + + String nicMacAddress; + String instanceName; + Boolean enabled; + + @Override + public boolean executeInSequence() { + return true; + } + + protected UpdateVmNicCommand() { + } + + public UpdateVmNicCommand(String nicMacAdderss, String instanceName, Boolean enabled) { + this.nicMacAddress = nicMacAdderss; + this.instanceName = instanceName; + this.enabled = enabled; + } + + public String getNicMacAddress() { + return nicMacAddress; + } + + public String getVmName() { + return instanceName; + } + + public Boolean isEnabled() { + return enabled; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java b/core/src/main/java/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java index d8cc74817d7b..96d73e11990d 100644 --- a/core/src/main/java/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java +++ b/core/src/main/java/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java @@ -36,6 +36,7 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand { public String lbStatsAuth = "admin1:AdMiN123"; public String lbStatsUri = "/admin?stats"; public String maxconn = ""; + public Long idleTimeout = 50000L; /* 0=infinite, >0 = timeout in milliseconds */ public String lbProtocol; public boolean keepAliveEnabled = false; NicTO nic; @@ -50,7 +51,7 @@ public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, Long vpcId) { } public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, String publicIp, String guestIp, String privateIp, NicTO nic, Long vpcId, String maxconn, - boolean keepAliveEnabled) { + boolean keepAliveEnabled, Long idleTimeout) { this.loadBalancers = loadBalancers; this.lbStatsPublicIP = publicIp; this.lbStatsPrivateIP = privateIp; @@ -59,6 +60,7 @@ public LoadBalancerConfigCommand(LoadBalancerTO[] loadBalancers, String publicIp this.vpcId = vpcId; this.maxconn = maxconn; this.keepAliveEnabled = keepAliveEnabled; + this.idleTimeout = idleTimeout; } public NicTO getNic() { diff --git a/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotAnswer.java b/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotAnswer.java new file mode 100644 index 000000000000..4d61249c7cbc --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotAnswer.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.utils.Pair; + +import java.util.Map; + +public class CreateDiskOnlyVmSnapshotAnswer extends Answer { + + protected Map> mapVolumeToSnapshotSizeAndNewVolumePath; + + public CreateDiskOnlyVmSnapshotAnswer(Command command, boolean success, String details, Map> mapVolumeToSnapshotSizeAndNewVolumePath) { + super(command, success, details); + this.mapVolumeToSnapshotSizeAndNewVolumePath = mapVolumeToSnapshotSizeAndNewVolumePath; + } + + public Map> getMapVolumeToSnapshotSizeAndNewVolumePath() { + return mapVolumeToSnapshotSizeAndNewVolumePath; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotCommand.java b/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotCommand.java new file mode 100644 index 000000000000..952bf0c971de --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotCommand.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + + +import com.cloud.agent.api.VMSnapshotBaseCommand; +import com.cloud.agent.api.VMSnapshotTO; +import com.cloud.vm.VirtualMachine; +import org.apache.cloudstack.storage.to.VolumeObjectTO; + +import java.util.List; + +public class CreateDiskOnlyVmSnapshotCommand extends VMSnapshotBaseCommand { + + protected VirtualMachine.State vmState; + + public CreateDiskOnlyVmSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType, VirtualMachine.State vmState) { + super(vmName, snapshot, volumeTOs, guestOSType); + this.vmState = vmState; + } + + public VirtualMachine.State getVmState() { + return vmState; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/DeleteDiskOnlyVmSnapshotCommand.java b/core/src/main/java/com/cloud/agent/api/storage/DeleteDiskOnlyVmSnapshotCommand.java new file mode 100644 index 000000000000..bf7bdd597360 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/DeleteDiskOnlyVmSnapshotCommand.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.Command; + +import com.cloud.agent.api.to.DataTO; + + +import java.util.List; + +public class DeleteDiskOnlyVmSnapshotCommand extends Command { + + List snapshots; + + public DeleteDiskOnlyVmSnapshotCommand(List snapshots) { + this.snapshots = snapshots; + } + + public List getSnapshots() { + return snapshots; + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/DownloadAnswer.java b/core/src/main/java/com/cloud/agent/api/storage/DownloadAnswer.java index 0c6373134b18..1c5eb7b9a9af 100644 --- a/core/src/main/java/com/cloud/agent/api/storage/DownloadAnswer.java +++ b/core/src/main/java/com/cloud/agent/api/storage/DownloadAnswer.java @@ -140,7 +140,7 @@ public void setTemplateSize(long templateSize) { } public Long getTemplateSize() { - return templateSize; + return templateSize == 0 ? templatePhySicalSize : templateSize; } public void setTemplatePhySicalSize(long templatePhySicalSize) { diff --git a/core/src/main/java/com/cloud/agent/api/storage/MergeDiskOnlyVmSnapshotCommand.java b/core/src/main/java/com/cloud/agent/api/storage/MergeDiskOnlyVmSnapshotCommand.java new file mode 100644 index 000000000000..b6396c24d10a --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/MergeDiskOnlyVmSnapshotCommand.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.Command; +import com.cloud.vm.VirtualMachine; + +import java.util.List; + +public class MergeDiskOnlyVmSnapshotCommand extends Command { + + private List snapshotMergeTreeToList; + private VirtualMachine.State vmState; + private String vmName; + + public MergeDiskOnlyVmSnapshotCommand(List snapshotMergeTreeToList, VirtualMachine.State vmState, String vmName) { + this.snapshotMergeTreeToList = snapshotMergeTreeToList; + this.vmState = vmState; + this.vmName = vmName; + } + + public List getSnapshotMergeTreeToList() { + return snapshotMergeTreeToList; + } + + public VirtualMachine.State getVmState() { + return vmState; + } + + public String getVmName() { + return vmName; + } + + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/core/src/main/java/com/cloud/agent/api/storage/MigrateVolumeCommand.java index 9fed0f913e14..70375c30a1bb 100644 --- a/core/src/main/java/com/cloud/agent/api/storage/MigrateVolumeCommand.java +++ b/core/src/main/java/com/cloud/agent/api/storage/MigrateVolumeCommand.java @@ -145,4 +145,9 @@ public int getWaitInMillSeconds() { } public String getChainInfo() { return chainInfo; } + + @Override + public boolean isReconcile() { + return true; + } } diff --git a/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotAnswer.java b/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotAnswer.java new file mode 100644 index 000000000000..2ecf587d59d1 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotAnswer.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import org.apache.cloudstack.storage.to.VolumeObjectTO; + +import java.util.List; + +public class RevertDiskOnlyVmSnapshotAnswer extends Answer { + List volumeObjectTos; + + public RevertDiskOnlyVmSnapshotAnswer(Command cmd, List volumeObjectTos) { + super(cmd, true, null); + this.volumeObjectTos = volumeObjectTos; + } + + public List getVolumeObjectTos() { + return volumeObjectTos; + } +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotCommand.java b/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotCommand.java new file mode 100644 index 000000000000..72bb92bcb10d --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/RevertDiskOnlyVmSnapshotCommand.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.Command; +import org.apache.cloudstack.storage.to.SnapshotObjectTO; + +import java.util.List; + +public class RevertDiskOnlyVmSnapshotCommand extends Command { + + private List snapshotObjectTos; + private String vmName; + + public RevertDiskOnlyVmSnapshotCommand(List snapshotObjectTos, String vmName) { + super(); + this.snapshotObjectTos = snapshotObjectTos; + this.vmName = vmName; + } + + public List getSnapshotObjectTos() { + return snapshotObjectTos; + } + + public String getVmName() { + return vmName; + } + + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/core/src/main/java/com/cloud/agent/api/storage/SnapshotMergeTreeTO.java b/core/src/main/java/com/cloud/agent/api/storage/SnapshotMergeTreeTO.java new file mode 100644 index 000000000000..78f23105e192 --- /dev/null +++ b/core/src/main/java/com/cloud/agent/api/storage/SnapshotMergeTreeTO.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.agent.api.storage; + +import com.cloud.agent.api.to.DataTO; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; + +import java.util.List; + +public class SnapshotMergeTreeTO { + DataTO parent; + DataTO child; + List grandChildren; + + public SnapshotMergeTreeTO(DataTO parent, DataTO child, List grandChildren) { + this.parent = parent; + this.child = child; + this.grandChildren = grandChildren; + } + + public DataTO getParent() { + return parent; + } + + public DataTO getChild() { + return child; + } + + public List getGrandChildren() { + return grandChildren; + } + + public void addGrandChild(DataTO grandChild) { + grandChildren.add(grandChild); + } + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this); + } +} diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VRScripts.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VRScripts.java index f9ea3e05e97f..7bfbf786e9b4 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VRScripts.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VRScripts.java @@ -82,5 +82,8 @@ public class VRScripts { public static final String VR_UPDATE_INTERFACE_CONFIG = "update_interface_config.sh"; public static final String ROUTER_FILESYSTEM_WRITABLE_CHECK = "filesystem_writable_check.py"; + + // CKS ISO mount + public static final String CKS_ISO_MOUNT_SERVE = "cks_iso.sh"; public static final String MANAGE_SERVICE = "manage_service.sh"; } diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index 4afac9b43cb3..b9ac455130f3 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -34,6 +34,7 @@ import javax.naming.ConfigurationException; +import com.cloud.agent.api.HandleCksIsoCommand; import org.apache.cloudstack.agent.routing.ManageServiceCommand; import com.cloud.agent.api.routing.UpdateNetworkCommand; import com.cloud.agent.api.to.IpAddressTO; @@ -145,6 +146,10 @@ public Answer executeRequest(final NetworkElementCommand cmd) { return execute((UpdateNetworkCommand) cmd); } + if (cmd instanceof HandleCksIsoCommand) { + return execute((HandleCksIsoCommand) cmd); + } + if (cmd instanceof ManageServiceCommand) { return execute((ManageServiceCommand) cmd); } @@ -176,6 +181,13 @@ public Answer executeRequest(final NetworkElementCommand cmd) { } } + protected Answer execute(final HandleCksIsoCommand cmd) { + String routerIp = getRouterSshControlIp(cmd); + logger.info("Attempting to mount CKS ISO on Virtual Router"); + ExecutionResult result = _vrDeployer.executeInVR(routerIp, VRScripts.CKS_ISO_MOUNT_SERVE, String.valueOf(cmd.isMountCksIso())); + return new Answer(cmd, result.isSuccess(), result.getDetails()); + } + private Answer execute(final SetupKeyStoreCommand cmd) { final String args = String.format("/usr/local/cloud/systemvm/conf/agent.properties " + "/usr/local/cloud/systemvm/conf/%s " + @@ -255,13 +267,13 @@ private Answer execute(UpdateNetworkCommand cmd) { if (result.getDetails().contains(String.format("Interface with IP %s not found", ipAddressTO.getPublicIp()))) { logger.warn(String.format("Skipping IP: %s as it isn't configured on router interface", ipAddressTO.getPublicIp())); } else if (ipAddressTO.getDetails().get(ApiConstants.REDUNDANT_STATE).equals(VirtualRouter.RedundantState.PRIMARY.name())) { - logger.warn(String.format("Failed to update interface mtu to %s on interface with ip: %s", + logger.warn(String.format("Failed to update interface MTU to %s on interface with IP: %s", ipAddressTO.getMtu(), ipAddressTO.getPublicIp())); finalResult = false; } continue; } - logger.info(String.format("Successfully updated mtu to %s on interface with ip: %s", + logger.info(String.format("Successfully updated MTU to %s on interface with IP: %s", ipAddressTO.getMtu(), ipAddressTO.getPublicIp())); finalResult &= true; } catch (Exception e) { diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/LoadBalancerConfigItem.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/LoadBalancerConfigItem.java index 4832c906699e..6dae886b4137 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/LoadBalancerConfigItem.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/LoadBalancerConfigItem.java @@ -56,6 +56,8 @@ public List generateConfig(final NetworkElementCommand cmd) { final String[] statRules = allRules[LoadBalancerConfigurator.STATS]; final LoadBalancerRule loadBalancerRule = new LoadBalancerRule(configuration, tmpCfgFilePath, tmpCfgFileName, addRules, removeRules, statRules, routerIp); + final LoadBalancerRule.SslCertEntry[] sslCerts = cfgtr.generateSslCertEntries(command); + loadBalancerRule.setSslCerts(sslCerts); final List rules = new LinkedList(); rules.add(loadBalancerRule); diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/SetGuestNetworkConfigItem.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/SetGuestNetworkConfigItem.java index 1a6824ceb7fc..57c96ec4bc95 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/SetGuestNetworkConfigItem.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/SetGuestNetworkConfigItem.java @@ -76,6 +76,7 @@ public List generateConfig(final NetworkElementCommand cmd) { guestNetwork.setRouterIp6Gateway(command.getRouterIpv6Gateway()); guestNetwork.setRouterIp6Cidr(command.getRouterIpv6Cidr()); guestNetwork.setVrGuestGateway(command.isVrGuestGateway()); + guestNetwork.setNetworkId(command.getNetworkId()); return generateConfigItems(guestNetwork); } diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/GuestNetwork.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/GuestNetwork.java index a416b4bc5e41..6bf36d62bf9f 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/GuestNetwork.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/GuestNetwork.java @@ -38,6 +38,7 @@ public class GuestNetwork extends ConfigBase { private String routerIp6Gateway; private String routerIp6Cidr; private boolean isVrGuestGateway; + long networkId; private Integer mtu; @@ -211,4 +212,12 @@ public boolean isVrGuestGateway() { public void setVrGuestGateway(boolean vrGuestGateway) { isVrGuestGateway = vrGuestGateway; } + + public long getNetworkId() { + return networkId; + } + + public void setNetworkId(long networkId) { + this.networkId = networkId; + } } diff --git a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRule.java b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRule.java index 3743d608e6c2..361c4765cc52 100644 --- a/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRule.java +++ b/core/src/main/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRule.java @@ -25,6 +25,7 @@ public class LoadBalancerRule { private String[] configuration; private String tmpCfgFilePath; private String tmpCfgFileName; + private SslCertEntry[] sslCerts; private String[] addRules; private String[] removeRules; @@ -32,6 +33,53 @@ public class LoadBalancerRule { private String routerIp; + public static class SslCertEntry { + private String name; + private String cert; + private String key; + private String chain; + private String password; + + public SslCertEntry(String name, String cert, String key, String chain, String password) { + this.name = name; + this.cert = cert; + this.key = key; + this.chain = chain; + this.password = password; + } + + public void setName(String name) { + this.name = name; + } + public String getName() { + return name; + } + public void setCert(String cert) { + this.cert = cert; + } + public String getCert() { + return cert; + } + public void setKey(String key) { + this.key = key; + } + public String getKey() { + return key; + } + public void setChain(String chain) { + this.chain = chain; + } + public String getChain() { + return chain; + } + public void setPassword(String password) { + this.password = password; + } + public String getPassword() { + return password; + } + } + public LoadBalancerRule() { // Empty constructor for (de)serialization } @@ -101,4 +149,12 @@ public String getRouterIp() { public void setRouterIp(final String routerIp) { this.routerIp = routerIp; } + + public SslCertEntry[] getSslCerts() { + return sslCerts; + } + + public void setSslCerts(final SslCertEntry[] sslCerts) { + this.sslCerts = sslCerts; + } } diff --git a/core/src/main/java/com/cloud/agent/transport/ArrayTypeAdaptor.java b/core/src/main/java/com/cloud/agent/transport/ArrayTypeAdaptor.java index 7229f0903b74..eabcc82040d6 100644 --- a/core/src/main/java/com/cloud/agent/transport/ArrayTypeAdaptor.java +++ b/core/src/main/java/com/cloud/agent/transport/ArrayTypeAdaptor.java @@ -75,13 +75,17 @@ public T[] deserialize(JsonElement json, Type typeOfT, JsonDeserializationContex try { clazz = Class.forName(name); } catch (ClassNotFoundException e) { - throw new CloudRuntimeException("can't find " + name); + throw new JsonParseException("can't find " + name); } T cmd = (T)_gson.fromJson(entry.getValue(), clazz); cmds.add(cmd); } - Class type = ((Class)typeOfT).getComponentType(); - T[] ts = (T[])Array.newInstance(type, cmds.size()); - return cmds.toArray(ts); + try { + Class type = Class.forName(typeOfT.getTypeName().replace("[]", "")); + T[] ts = (T[])Array.newInstance(type, cmds.size()); + return cmds.toArray(ts); + } catch (ClassNotFoundException e) { + throw new CloudRuntimeException("can't find " + typeOfT.getTypeName()); + } } } diff --git a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java index e4b0a7ffff4c..7d544c2e49c0 100644 --- a/core/src/main/java/com/cloud/network/HAProxyConfigurator.java +++ b/core/src/main/java/com/cloud/network/HAProxyConfigurator.java @@ -36,6 +36,8 @@ import com.cloud.agent.api.to.LoadBalancerTO.DestinationTO; import com.cloud.agent.api.to.LoadBalancerTO.StickinessPolicyTO; import com.cloud.agent.api.to.PortForwardingRuleTO; +import com.cloud.agent.resource.virtualnetwork.model.LoadBalancerRule.SslCertEntry; +import com.cloud.network.lb.LoadBalancingRule.LbSslCert; import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType; import com.cloud.utils.Pair; import com.cloud.utils.net.NetUtils; @@ -52,6 +54,12 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator { private static String[] defaultListen = {"listen vmops", "\tbind 0.0.0.0:9", "\toption transparent"}; + private static final String SSL_CERTS_DIR = "/etc/cloudstack/ssl/"; + + private static final String SSL_CONFIGURATION_INTERMEDIATE = " ssl-min-ver TLSv1.2 no-tls-tickets " + + "ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA256 " + + "ciphersuites TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256"; + @Override public String[] generateConfiguration(final List fwRules) { // Group the rules by publicip:publicport @@ -469,30 +477,41 @@ private String getLbSubRuleForStickiness(final LoadBalancerTO lbTO) { return sb.toString(); } - private List getRulesForPool(final LoadBalancerTO lbTO, final boolean keepAliveEnabled) { + private List getRulesForPool(final LoadBalancerTO lbTO, final LoadBalancerConfigCommand lbCmd) { StringBuilder sb = new StringBuilder(); final String poolName = sb.append(lbTO.getSrcIp().replace(".", "_")).append('-').append(lbTO.getSrcPort()).toString(); final String publicIP = lbTO.getSrcIp(); final int publicPort = lbTO.getSrcPort(); final String algorithm = lbTO.getAlgorithm(); - final List result = new ArrayList(); - // add line like this: "listen 65_37_141_30-80\n\tbind 65.37.141.30:80" - sb = new StringBuilder(); - sb.append("listen ").append(poolName); - result.add(sb.toString()); + boolean sslOffloading = lbTO.getSslCert() != null && !lbTO.getSslCert().isRevoked() + && NetUtils.SSL_PROTO.equals(lbTO.getLbProtocol()); + + final List frontendConfigs = new ArrayList<>(); + final List backendConfigs = new ArrayList<>(); + final List result = new ArrayList<>(); + sb = new StringBuilder(); sb.append("\tbind ").append(publicIP).append(":").append(publicPort); - result.add(sb.toString()); + + if (sslOffloading) { + sb.append(" ssl crt ").append(SSL_CERTS_DIR).append(poolName).append(".pem"); + // check for http2 support + sb.append(" alpn h2,http/1.1"); + sb.append(SSL_CONFIGURATION_INTERMEDIATE); + sb.append("\n\thttp-request add-header X-Forwarded-Proto https"); + } + frontendConfigs.add(sb.toString()); + sb = new StringBuilder(); sb.append("\t").append("balance ").append(algorithm.toLowerCase()); - result.add(sb.toString()); + backendConfigs.add(sb.toString()); int i = 0; - Boolean destsAvailable = false; + boolean destsAvailable = false; final String stickinessSubRule = getLbSubRuleForStickiness(lbTO); - final List dstSubRule = new ArrayList(); - final List dstWithCookieSubRule = new ArrayList(); + final List dstSubRule = new ArrayList<>(); + final List dstWithCookieSubRule = new ArrayList<>(); for (final DestinationTO dest : lbTO.getDestinations()) { // add line like this: "server 65_37_141_30-80_3 10.1.1.4:80 check" if (dest.isRevoked()) { @@ -500,15 +519,20 @@ private List getRulesForPool(final LoadBalancerTO lbTO, final boolean ke } sb = new StringBuilder(); sb.append("\t") - .append("server ") - .append(poolName) - .append("_") - .append(Integer.toString(i++)) - .append(" ") - .append(dest.getDestIp()) - .append(":") - .append(dest.getDestPort()) - .append(" check"); + .append("server ") + .append(poolName) + .append("_") + .append(i++) + .append(" ") + .append(dest.getDestIp()) + .append(":") + .append(dest.getDestPort()) + .append(" check"); + + if (sslOffloading) { + sb.append(SSL_CONFIGURATION_INTERMEDIATE); + } + if(lbTO.getLbProtocol() != null && lbTO.getLbProtocol().equals("tcp-proxy")) { sb.append(" send-proxy"); } @@ -520,9 +544,9 @@ private List getRulesForPool(final LoadBalancerTO lbTO, final boolean ke destsAvailable = true; } - Boolean httpbasedStickiness = false; + boolean httpbasedStickiness = false; /* attach stickiness sub rule only if the destinations are available */ - if (stickinessSubRule != null && destsAvailable == true) { + if (stickinessSubRule != null && destsAvailable) { for (final StickinessPolicyTO stickinessPolicy : lbTO.getStickinessPolicies()) { if (stickinessPolicy == null) { continue; @@ -530,35 +554,40 @@ private List getRulesForPool(final LoadBalancerTO lbTO, final boolean ke if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName()) || StickinessMethodType.AppCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName())) { httpbasedStickiness = true; + break; } } if (httpbasedStickiness) { - result.addAll(dstWithCookieSubRule); + backendConfigs.addAll(dstWithCookieSubRule); } else { - result.addAll(dstSubRule); + backendConfigs.addAll(dstSubRule); } - result.add(stickinessSubRule); + backendConfigs.add(stickinessSubRule); } else { - result.addAll(dstSubRule); + backendConfigs.addAll(dstSubRule); } if (stickinessSubRule != null && !destsAvailable) { logger.warn("Haproxy stickiness policy for lb rule: " + lbTO.getSrcIp() + ":" + lbTO.getSrcPort() + ": Not Applied, cause: backends are unavailable"); } - if (publicPort == NetUtils.HTTP_PORT && !keepAliveEnabled || httpbasedStickiness) { - sb = new StringBuilder(); - sb.append("\t").append("mode http"); - result.add(sb.toString()); - sb = new StringBuilder(); - sb.append("\t").append("option httpclose"); - result.add(sb.toString()); + boolean keepAliveEnabled = lbCmd.keepAliveEnabled; + boolean http = (publicPort == NetUtils.HTTP_PORT && !keepAliveEnabled); + if (http || httpbasedStickiness || sslOffloading) { + frontendConfigs.add("\tmode http"); + String keepAliveLine = keepAliveEnabled ? "\tno option forceclose" : "\toption httpclose"; + frontendConfigs.add(keepAliveLine); } + // add line like this: "listen 65_37_141_30-80\n\tbind 65.37.141.30:80" + result.add(String.format("listen %s", poolName)); + result.addAll(frontendConfigs); + String cidrList = lbTO.getCidrList(); if (StringUtils.isNotBlank(cidrList)) { result.add(String.format("\tacl network_allowed src %s \n\ttcp-request connection reject if !network_allowed", cidrList)); } + result.addAll(backendConfigs); result.add(blankLine); return result; } @@ -566,15 +595,18 @@ private List getRulesForPool(final LoadBalancerTO lbTO, final boolean ke private String generateStatsRule(final LoadBalancerConfigCommand lbCmd, final String ruleName, final String statsIp) { final StringBuilder rule = new StringBuilder("\nlisten ").append(ruleName).append("\n\tbind ").append(statsIp).append(":").append(lbCmd.lbStatsPort); // TODO DH: write test for this in both cases - if (!lbCmd.keepAliveEnabled) { - logger.info("Haproxy mode http enabled"); - rule.append("\n\tmode http\n\toption httpclose"); + rule.append("\n\tmode http"); + if (lbCmd.keepAliveEnabled) { + logger.info("Haproxy option http-keep-alive enabled"); + } else { + logger.info("Haproxy option httpclose enabled"); + rule.append("\n\toption httpclose"); } rule.append("\n\tstats enable\n\tstats uri ") - .append(lbCmd.lbStatsUri) - .append("\n\tstats realm Haproxy\\ Statistics\n\tstats auth ") - .append(lbCmd.lbStatsAuth); - rule.append("\n"); + .append(lbCmd.lbStatsUri) + .append("\n\tstats realm Haproxy\\ Statistics\n\tstats auth ") + .append(lbCmd.lbStatsAuth) + .append("\n"); final String result = rule.toString(); if (logger.isDebugEnabled()) { logger.debug("Haproxystats rule: " + result); @@ -597,15 +629,25 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) { } } result.addAll(gSection); - // TODO decide under what circumstances these options are needed - // result.add("\tnokqueue"); - // result.add("\tnopoll"); result.add(blankLine); final List dSection = Arrays.asList(defaultsSection); if (lbCmd.keepAliveEnabled) { dSection.set(7, "\tno option httpclose"); } + if (lbCmd.idleTimeout > 0) { + dSection.set(9, "\ttimeout client " + Long.toString(lbCmd.idleTimeout)); + dSection.set(10, "\ttimeout server " + Long.toString(lbCmd.idleTimeout)); + } else if (lbCmd.idleTimeout == 0) { + // .remove() is not allowed, only .set() operations are allowed as the list + // is a fixed size. So lets just mark the entry as blank. + dSection.set(9, ""); + dSection.set(10, ""); + } else { + // Negative idleTimeout values are considered invalid; retain the + // default HAProxy timeout values from defaultsSection for predictability. + logger.warn("Negative idleTimeout ({}) configured; retaining default HAProxy timeouts.", lbCmd.idleTimeout); + } if (logger.isDebugEnabled()) { for (final String s : dSection) { @@ -644,7 +686,7 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) { if (lbTO.isRevoked()) { continue; } - final List poolRules = getRulesForPool(lbTO, lbCmd.keepAliveEnabled); + final List poolRules = getRulesForPool(lbTO, lbCmd); result.addAll(poolRules); has_listener = true; } @@ -696,4 +738,30 @@ public String[][] generateFwRules(final LoadBalancerConfigCommand lbCmd) { return result; } + + @Override + public SslCertEntry[] generateSslCertEntries(LoadBalancerConfigCommand lbCmd) { + final Set sslCertEntries = new HashSet<>(); + for (final LoadBalancerTO lbTO : lbCmd.getLoadBalancers()) { + if (lbTO.getSslCert() != null) { + addSslCertEntry(sslCertEntries, lbTO); + } + } + final SslCertEntry[] result = sslCertEntries.toArray(new SslCertEntry[sslCertEntries.size()]); + return result; + } + + private void addSslCertEntry(Set sslCertEntries, LoadBalancerTO lbTO) { + final LbSslCert cert = lbTO.getSslCert(); + if (cert.isRevoked()) { + return; + } + if (lbTO.getLbProtocol() == null || ! lbTO.getLbProtocol().equals(NetUtils.SSL_PROTO)) { + return; + } + StringBuilder sb = new StringBuilder(); + final String name = sb.append(lbTO.getSrcIp().replace(".", "_")).append('-').append(lbTO.getSrcPort()).toString(); + final SslCertEntry sslCertEntry = new SslCertEntry(name, cert.getCert(), cert.getKey(), cert.getChain(), cert.getPassword()); + sslCertEntries.add(sslCertEntry); + } } diff --git a/core/src/main/java/com/cloud/network/LoadBalancerConfigurator.java b/core/src/main/java/com/cloud/network/LoadBalancerConfigurator.java index 0e19b1e606e9..8814f60b0714 100644 --- a/core/src/main/java/com/cloud/network/LoadBalancerConfigurator.java +++ b/core/src/main/java/com/cloud/network/LoadBalancerConfigurator.java @@ -23,6 +23,7 @@ import com.cloud.agent.api.routing.LoadBalancerConfigCommand; import com.cloud.agent.api.to.PortForwardingRuleTO; +import com.cloud.agent.resource.virtualnetwork.model.LoadBalancerRule.SslCertEntry; public interface LoadBalancerConfigurator { public final static int ADD = 0; @@ -34,4 +35,6 @@ public interface LoadBalancerConfigurator { public String[] generateConfiguration(LoadBalancerConfigCommand lbCmd); public String[][] generateFwRules(LoadBalancerConfigCommand lbCmd); + + public SslCertEntry[] generateSslCertEntries(LoadBalancerConfigCommand lbCmd); } diff --git a/core/src/main/java/com/cloud/resource/ServerResource.java b/core/src/main/java/com/cloud/resource/ServerResource.java index 845ac8a48fab..23d200942a27 100644 --- a/core/src/main/java/com/cloud/resource/ServerResource.java +++ b/core/src/main/java/com/cloud/resource/ServerResource.java @@ -22,6 +22,7 @@ import com.cloud.agent.IAgentControl; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; +import com.cloud.agent.api.PingAnswer; import com.cloud.agent.api.PingCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.host.Host; @@ -90,4 +91,5 @@ default boolean isAppendAgentNameToLogs() { return false; } + default void processPingAnswer(PingAnswer answer) {}; } diff --git a/core/src/main/java/com/cloud/serializer/GsonHelper.java b/core/src/main/java/com/cloud/serializer/GsonHelper.java index 2d2cecf26185..7de98c08b7e0 100644 --- a/core/src/main/java/com/cloud/serializer/GsonHelper.java +++ b/core/src/main/java/com/cloud/serializer/GsonHelper.java @@ -62,7 +62,7 @@ public class GsonHelper { LOGGER.info("Default Builder inited."); } - static Gson setDefaultGsonConfig(GsonBuilder builder) { + public static Gson setDefaultGsonConfig(GsonBuilder builder) { builder.setVersion(1.5); InterfaceTypeAdaptor dsAdaptor = new InterfaceTypeAdaptor(); builder.registerTypeAdapter(DataStoreTO.class, dsAdaptor); diff --git a/core/src/main/java/com/cloud/storage/resource/StorageProcessor.java b/core/src/main/java/com/cloud/storage/resource/StorageProcessor.java index b7cd5b8eb5ee..dd8e2abcd643 100644 --- a/core/src/main/java/com/cloud/storage/resource/StorageProcessor.java +++ b/core/src/main/java/com/cloud/storage/resource/StorageProcessor.java @@ -21,7 +21,7 @@ import org.apache.cloudstack.agent.directdownload.DirectDownloadCommand; import org.apache.cloudstack.storage.command.AttachCommand; -import org.apache.cloudstack.storage.command.CheckDataStoreStoragePolicyComplainceCommand; +import org.apache.cloudstack.storage.command.CheckDataStoreStoragePolicyComplianceCommand; import org.apache.cloudstack.storage.command.CopyCommand; import org.apache.cloudstack.storage.command.CreateObjectCommand; import org.apache.cloudstack.storage.command.DeleteCommand; @@ -82,7 +82,7 @@ public interface StorageProcessor { Answer copyVolumeFromPrimaryToPrimary(CopyCommand cmd); - public Answer checkDataStoreStoragePolicyCompliance(CheckDataStoreStoragePolicyComplainceCommand cmd); + public Answer checkDataStoreStoragePolicyCompliance(CheckDataStoreStoragePolicyComplianceCommand cmd); public Answer syncVolumePath(SyncVolumePathCommand cmd); } diff --git a/core/src/main/java/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java b/core/src/main/java/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java index 7d8225462cab..318c069b0b0b 100644 --- a/core/src/main/java/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java +++ b/core/src/main/java/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java @@ -21,7 +21,7 @@ import org.apache.cloudstack.agent.directdownload.DirectDownloadCommand; import org.apache.cloudstack.storage.command.AttachCommand; -import org.apache.cloudstack.storage.command.CheckDataStoreStoragePolicyComplainceCommand; +import org.apache.cloudstack.storage.command.CheckDataStoreStoragePolicyComplianceCommand; import org.apache.cloudstack.storage.command.CopyCommand; import org.apache.cloudstack.storage.command.CreateObjectAnswer; import org.apache.cloudstack.storage.command.CreateObjectCommand; @@ -79,8 +79,8 @@ public Answer handleStorageCommands(StorageSubSystemCommand command) { return processor.resignature((ResignatureCommand) command); } else if (command instanceof DirectDownloadCommand) { return processor.handleDownloadTemplateToPrimaryStorage((DirectDownloadCommand) command); - } else if (command instanceof CheckDataStoreStoragePolicyComplainceCommand) { - return processor.checkDataStoreStoragePolicyCompliance((CheckDataStoreStoragePolicyComplainceCommand) command); + } else if (command instanceof CheckDataStoreStoragePolicyComplianceCommand) { + return processor.checkDataStoreStoragePolicyCompliance((CheckDataStoreStoragePolicyComplianceCommand) command); } else if (command instanceof SyncVolumePathCommand) { return processor.syncVolumePath((SyncVolumePathCommand) command); } else if (command instanceof QuerySnapshotZoneCopyCommand) { @@ -142,7 +142,7 @@ protected Answer execute(CreateObjectCommand cmd) { } return new CreateObjectAnswer("not supported type"); } catch (Exception e) { - logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString()); + logger.error("Failed to create object [{}] due to [{}].", data.getObjectType(), e.getMessage(), e); return new CreateObjectAnswer(e.toString()); } } diff --git a/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java b/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java index 9b126846827e..71c329796d1b 100755 --- a/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java +++ b/core/src/main/java/com/cloud/storage/template/HttpTemplateDownloader.java @@ -27,6 +27,7 @@ import java.io.RandomAccessFile; import java.net.URI; import java.net.URISyntaxException; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -51,6 +52,7 @@ import com.cloud.utils.Pair; import com.cloud.utils.UriUtils; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.net.HttpClientCloudStackUserAgent; import com.cloud.utils.net.Proxy; /** @@ -80,6 +82,18 @@ public class HttpTemplateDownloader extends ManagedContextRunnable implements Te private ResourceType resourceType = ResourceType.TEMPLATE; private final HttpMethodRetryHandler myretryhandler; private boolean followRedirects = false; + private boolean isChunkedTransfer; + + protected static final List CUSTOM_HEADERS_FOR_CHUNKED_TRANSFER_SIZE = Arrays.asList( + "x-goog-stored-content-length", + "x-goog-meta-size", + "x-amz-meta-size", + "x-amz-meta-content-length", + "x-object-meta-size", + "x-original-content-length", + "x-oss-meta-content-length", + "x-file-size"); + private static final long MIN_FORMAT_VERIFICATION_SIZE = 1024 * 1024; public HttpTemplateDownloader(StorageLayer storageLayer, String downloadUrl, String toDir, DownloadCompleteCallback callback, long maxTemplateSizeInBytes, String user, String password, Proxy proxy, ResourceType resourceType) { @@ -112,6 +126,7 @@ private GetMethod createRequest(String downloadUrl) { GetMethod request = new GetMethod(downloadUrl); request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, myretryhandler); request.setFollowRedirects(followRedirects); + request.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); return request; } @@ -138,7 +153,7 @@ private void checkCredentials(String user, String password) { client.getParams().setAuthenticationPreemptive(true); Credentials defaultcreds = new UsernamePasswordCredentials(user, password); client.getState().setCredentials(new AuthScope(hostAndPort.first(), hostAndPort.second(), AuthScope.ANY_REALM), defaultcreds); - logger.info("Added username=" + user + ", password=" + password + "for host " + hostAndPort.first() + ":" + hostAndPort.second()); + logger.info("Added username={}, password=****** for host {}:{}", user, hostAndPort.first(), hostAndPort.second()); } else { logger.info("No credentials configured for host=" + hostAndPort.first() + ":" + hostAndPort.second()); } @@ -205,13 +220,11 @@ public long download(boolean resume, DownloadCompleteCallback callback) { RandomAccessFile out = new RandomAccessFile(file, "rw"); ) { out.seek(localFileSize); - - logger.info("Starting download from " + downloadUrl + " to " + toFile + " remoteSize=" + toHumanReadableSize(remoteSize) + " , max size=" + toHumanReadableSize(maxTemplateSizeInBytes)); - - if (copyBytes(file, in, out)) return 0; - + logger.info("Starting download from {} to {} remoteSize={} , max size={}",downloadUrl, toFile, + toHumanReadableSize(remoteSize), toHumanReadableSize(maxTemplateSizeInBytes)); + boolean eof = copyBytes(file, in, out); Date finish = new Date(); - checkDowloadCompletion(); + checkDownloadCompletion(eof); downloadTime += finish.getTime() - start.getTime(); } finally { /* in.close() and out.close() */ } return totalBytes; @@ -237,28 +250,32 @@ public long download(boolean resume, DownloadCompleteCallback callback) { } private boolean copyBytes(File file, InputStream in, RandomAccessFile out) throws IOException { - int bytes; - byte[] block = new byte[CHUNK_SIZE]; + byte[] buffer = new byte[CHUNK_SIZE]; long offset = 0; - boolean done = false; VerifyFormat verifyFormat = new VerifyFormat(file); status = Status.IN_PROGRESS; - while (!done && status != Status.ABORTED && offset <= remoteSize) { - if ((bytes = in.read(block, 0, CHUNK_SIZE)) > -1) { - offset = writeBlock(bytes, out, block, offset); - if (!ResourceType.SNAPSHOT.equals(resourceType) && - !verifyFormat.isVerifiedFormat() && - (offset >= 1048576 || offset >= remoteSize)) { //let's check format after we get 1MB or full file - verifyFormat.invoke(); - } - } else { - done = true; + while (status != Status.ABORTED) { + int bytesRead = in.read(buffer, 0, CHUNK_SIZE); + if (bytesRead == -1) { + logger.debug("Reached EOF on input stream"); + break; + } + offset = writeBlock(bytesRead, out, buffer, offset); + if (!ResourceType.SNAPSHOT.equals(resourceType) + && !verifyFormat.isVerifiedFormat() + && (offset >= MIN_FORMAT_VERIFICATION_SIZE || offset >= remoteSize)) { + verifyFormat.invoke(); + } + if (offset >= remoteSize) { + logger.debug("Reached expected remote size limit: {} bytes", remoteSize); + break; } } out.getFD().sync(); - return false; + return !Status.ABORTED.equals(status); } + private long writeBlock(int bytes, RandomAccessFile out, byte[] block, long offset) throws IOException { out.write(block, 0, bytes); offset += bytes; @@ -267,11 +284,13 @@ private long writeBlock(int bytes, RandomAccessFile out, byte[] block, long offs return offset; } - private void checkDowloadCompletion() { + private void checkDownloadCompletion(boolean eof) { String downloaded = "(incomplete download)"; - if (totalBytes >= remoteSize) { + if (eof && ((totalBytes >= remoteSize) || (isChunkedTransfer && remoteSize == maxTemplateSizeInBytes))) { status = Status.DOWNLOAD_FINISHED; - downloaded = "(download complete remote=" + toHumanReadableSize(remoteSize) + " bytes)"; + downloaded = "(download complete remote=" + + (remoteSize == maxTemplateSizeInBytes ? toHumanReadableSize(remoteSize) : "unknown") + + " bytes)"; } errorString = "Downloaded " + toHumanReadableSize(totalBytes) + " bytes " + downloaded; } @@ -293,18 +312,42 @@ private void checkAndSetDownloadSize() { } } + protected long getRemoteSizeForChunkedTransfer() { + for (String headerKey : CUSTOM_HEADERS_FOR_CHUNKED_TRANSFER_SIZE) { + Header header = request.getResponseHeader(headerKey); + if (header == null) { + continue; + } + try { + return Long.parseLong(header.getValue()); + } catch (NumberFormatException ignored) {} + } + Header contentRangeHeader = request.getResponseHeader("Content-Range"); + if (contentRangeHeader != null) { + String contentRange = contentRangeHeader.getValue(); + if (contentRange != null && contentRange.contains("/")) { + String totalSize = contentRange.substring(contentRange.indexOf('/') + 1).trim(); + return Long.parseLong(totalSize); + } + } + return 0; + } + private boolean tryAndGetRemoteSize() { Header contentLengthHeader = request.getResponseHeader("content-length"); - boolean chunked = false; + isChunkedTransfer = false; long reportedRemoteSize = 0; if (contentLengthHeader == null) { Header chunkedHeader = request.getResponseHeader("Transfer-Encoding"); - if (chunkedHeader == null || !"chunked".equalsIgnoreCase(chunkedHeader.getValue())) { + if (chunkedHeader != null && "chunked".equalsIgnoreCase(chunkedHeader.getValue())) { + isChunkedTransfer = true; + reportedRemoteSize = getRemoteSizeForChunkedTransfer(); + logger.debug("{} is using chunked transfer encoding, possible remote size: {}", downloadUrl, + reportedRemoteSize); + } else { status = Status.UNRECOVERABLE_ERROR; errorString = " Failed to receive length of download "; return false; - } else if ("chunked".equalsIgnoreCase(chunkedHeader.getValue())) { - chunked = true; } } else { reportedRemoteSize = Long.parseLong(contentLengthHeader.getValue()); @@ -316,9 +359,11 @@ private boolean tryAndGetRemoteSize() { return false; } } - if (remoteSize == 0) { remoteSize = reportedRemoteSize; + if (remoteSize != 0) { + logger.debug("Remote size for {} found to be {}", downloadUrl, toHumanReadableSize(remoteSize)); + } } return true; } @@ -535,7 +580,7 @@ public VerifyFormat invoke() { logger.debug("Error on http connection : " + ex.getMessage()); } status = Status.UNRECOVERABLE_ERROR; - errorString = "Template content is unsupported, or mismatch between selected format and template content. Found : " + unsupportedFormat; + errorString = "Template content is unsupported, or mismatch between selected format and Template content. Found : " + unsupportedFormat; throw new CloudRuntimeException(errorString); } else { logger.debug("Verified format of downloading file " + file.getAbsolutePath() + " is supported"); diff --git a/core/src/main/java/com/cloud/storage/template/IsoProcessor.java b/core/src/main/java/com/cloud/storage/template/IsoProcessor.java index 6ab42effb524..76d19d53453b 100644 --- a/core/src/main/java/com/cloud/storage/template/IsoProcessor.java +++ b/core/src/main/java/com/cloud/storage/template/IsoProcessor.java @@ -48,7 +48,7 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa String isoPath = templatePath + File.separator + templateName + "." + ImageFormat.ISO.getFileExtension(); if (!_storage.exists(isoPath)) { - logger.debug("Unable to find the iso file: " + isoPath); + logger.debug("Unable to find the ISO file: " + isoPath); return null; } diff --git a/core/src/main/java/com/cloud/storage/template/MetalinkTemplateDownloader.java b/core/src/main/java/com/cloud/storage/template/MetalinkTemplateDownloader.java index 2e62809dfeda..0dad2564779c 100644 --- a/core/src/main/java/com/cloud/storage/template/MetalinkTemplateDownloader.java +++ b/core/src/main/java/com/cloud/storage/template/MetalinkTemplateDownloader.java @@ -18,8 +18,11 @@ // package com.cloud.storage.template; + import com.cloud.storage.StorageLayer; import com.cloud.utils.UriUtils; +import com.cloud.utils.net.HttpClientCloudStackUserAgent; + import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpMethodRetryHandler; @@ -59,6 +62,7 @@ protected GetMethod createRequest(String downloadUrl) { GetMethod request = new GetMethod(downloadUrl); request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, myretryhandler); request.setFollowRedirects(followRedirects); + request.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); if (!toFileSet) { String[] parts = downloadUrl.split("/"); String filename = parts[parts.length - 1]; @@ -108,7 +112,7 @@ private boolean performDownload() { ) { IOUtils.copy(in, out); } catch (IOException e) { - logger.error("Error downloading template from: " + _downloadUrl + " due to: " + e.getMessage()); + logger.error("Error downloading Template from: " + _downloadUrl + " due to: " + e.getMessage()); return false; } return true; diff --git a/core/src/main/java/com/cloud/storage/template/OVAProcessor.java b/core/src/main/java/com/cloud/storage/template/OVAProcessor.java index ab3aa0d0e3a5..28ab3b58d45d 100644 --- a/core/src/main/java/com/cloud/storage/template/OVAProcessor.java +++ b/core/src/main/java/com/cloud/storage/template/OVAProcessor.java @@ -68,7 +68,7 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa String templateFilePath = templatePath + File.separator + templateName + "." + ImageFormat.OVA.getFileExtension(); if (!_storage.exists(templateFilePath)) { if (logger.isInfoEnabled()) { - logger.info("Unable to find the vmware template file: " + templateFilePath); + logger.info("Unable to find the VMware Template file: " + templateFilePath); } return null; } @@ -113,7 +113,7 @@ private OVFInformationTO createOvfInformationTO(OVFHelper ovfHelper, Document do List disks = ovfHelper.getOVFVolumeInfoFromFile(ovfFilePath, doc, null); if (CollectionUtils.isNotEmpty(disks)) { if (logger.isTraceEnabled()) { - logger.trace(String.format("Found %d disks in template %s", disks.size(), ovfFilePath)); + logger.trace(String.format("Found %d disks in Template %s", disks.size(), ovfFilePath)); } ovfInformationTO.setDisks(disks); } @@ -122,14 +122,14 @@ private OVFInformationTO createOvfInformationTO(OVFHelper ovfHelper, Document do logger.info("Found " + nets.size() + " prerequisite networks"); ovfInformationTO.setNetworks(nets); } else if (logger.isTraceEnabled()) { - logger.trace(String.format("no net prerequisites found in template %s", ovfFilePath)); + logger.trace(String.format("No net prerequisites found in Template %s", ovfFilePath)); } List ovfProperties = ovfHelper.getConfigurableOVFPropertiesFromDocument(doc); if (CollectionUtils.isNotEmpty(ovfProperties)) { logger.info("Found " + ovfProperties.size() + " configurable OVF properties"); ovfInformationTO.setProperties(ovfProperties); } else if (logger.isTraceEnabled()) { - logger.trace(String.format("no ovf properties found in template %s", ovfFilePath)); + logger.trace(String.format("No OVF properties found in Template %s", ovfFilePath)); } OVFVirtualHardwareSectionTO hardwareSection = ovfHelper.getVirtualHardwareSectionFromDocument(doc); List configurations = hardwareSection.getConfigurations(); @@ -213,7 +213,7 @@ public long getVirtualSize(File file) { return size; } catch (Exception e) { logger.info("[ignored]" - + "failed to get virtual template size for ova: " + e.getLocalizedMessage()); + + "failed to get virtual Template size for ova: " + e.getLocalizedMessage()); } return file.length(); } @@ -231,7 +231,7 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr String ovfFileName = getOVFFilePath(templateFileFullPath); OVFHelper ovfHelper = new OVFHelper(); if (ovfFileName == null) { - String msg = "Unable to locate OVF file in template package directory: " + templatePath; + String msg = "Unable to locate OVF file in Template package directory: " + templatePath; logger.error(msg); throw new InternalErrorException(msg); } diff --git a/core/src/main/java/com/cloud/storage/template/QCOW2Processor.java b/core/src/main/java/com/cloud/storage/template/QCOW2Processor.java index df1722a0201d..547c990fbafa 100644 --- a/core/src/main/java/com/cloud/storage/template/QCOW2Processor.java +++ b/core/src/main/java/com/cloud/storage/template/QCOW2Processor.java @@ -81,7 +81,7 @@ public long getVirtualSize(File file) throws IOException { long size = getTemplateVirtualSize(file); return size; } catch (Exception e) { - logger.info("[ignored]" + "failed to get template virtual size for QCOW2: " + e.getLocalizedMessage()); + logger.info("[ignored]" + "failed to get Template virtual size for QCOW2: " + e.getLocalizedMessage()); } return file.length(); } diff --git a/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java b/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java index c24a4cc221fc..70df906d1ce3 100644 --- a/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java +++ b/core/src/main/java/com/cloud/storage/template/S3TemplateDownloader.java @@ -150,7 +150,7 @@ public long download(boolean resume, DownloadCompleteCallback callback) { } if (remoteSize > maxTemplateSizeInByte) { - errorString = "Remote size is too large for template " + downloadUrl + " remote size is " + remoteSize + " max allowed is " + maxTemplateSizeInByte; + errorString = "Remote size is too large for Template " + downloadUrl + " remote size is " + remoteSize + " max allowed is " + maxTemplateSizeInByte; logger.warn(errorString); status = Status.UNRECOVERABLE_ERROR; @@ -162,7 +162,7 @@ public long download(boolean resume, DownloadCompleteCallback callback) { try { inputStream = new BufferedInputStream(getMethod.getResponseBodyAsStream()); } catch (IOException e) { - errorString = "Exception occurred while opening InputStream for template " + downloadUrl; + errorString = "Exception occurred while opening InputStream for Template " + downloadUrl; logger.warn(errorString); status = Status.UNRECOVERABLE_ERROR; diff --git a/core/src/main/java/com/cloud/storage/template/SimpleHttpMultiFileDownloader.java b/core/src/main/java/com/cloud/storage/template/SimpleHttpMultiFileDownloader.java index 8719947cb4f0..6608754073a1 100644 --- a/core/src/main/java/com/cloud/storage/template/SimpleHttpMultiFileDownloader.java +++ b/core/src/main/java/com/cloud/storage/template/SimpleHttpMultiFileDownloader.java @@ -44,6 +44,7 @@ import org.apache.commons.lang3.StringUtils; import com.cloud.storage.StorageLayer; +import com.cloud.utils.net.HttpClientCloudStackUserAgent; public class SimpleHttpMultiFileDownloader extends ManagedContextRunnable implements TemplateDownloader { private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager(); @@ -95,6 +96,7 @@ private GetMethod createRequest(String downloadUrl) { GetMethod request = new GetMethod(downloadUrl); request.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler); request.setFollowRedirects(followRedirects); + request.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); return request; } @@ -141,6 +143,7 @@ private void tryAndGetTotalRemoteSize() { continue; } HeadMethod headMethod = new HeadMethod(downloadUrl); + headMethod.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); try { if (client.executeMethod(headMethod) != HttpStatus.SC_OK) { continue; diff --git a/core/src/main/java/com/cloud/storage/template/TemplateConstants.java b/core/src/main/java/com/cloud/storage/template/TemplateConstants.java index d6622bed73ef..349997da1b7a 100644 --- a/core/src/main/java/com/cloud/storage/template/TemplateConstants.java +++ b/core/src/main/java/com/cloud/storage/template/TemplateConstants.java @@ -24,7 +24,7 @@ public final class TemplateConstants { public static final String DEFAULT_SNAPSHOT_ROOT_DIR = "snapshots"; public static final String DEFAULT_VOLUME_ROOT_DIR = "volumes"; public static final String DEFAULT_TMPLT_FIRST_LEVEL_DIR = "tmpl/"; - + public static final String DEFAULT_CHECKPOINT_ROOT_DIR = "checkpoints"; public static final String DEFAULT_SYSTEM_VM_TEMPLATE_PATH = "template/tmpl/1/"; public static final int DEFAULT_TMPLT_COPY_PORT = 80; diff --git a/core/src/main/java/com/cloud/storage/template/TemplateLocation.java b/core/src/main/java/com/cloud/storage/template/TemplateLocation.java index 563c642f292e..4cd4d32d255c 100644 --- a/core/src/main/java/com/cloud/storage/template/TemplateLocation.java +++ b/core/src/main/java/com/cloud/storage/template/TemplateLocation.java @@ -103,7 +103,7 @@ public boolean load() throws IOException { try (FileInputStream strm = new FileInputStream(_file);) { _props.load(strm); } catch (IOException e) { - logger.warn("Unable to load the template properties for '" + _file + "': ", e); + logger.warn("Unable to load the Template properties for '" + _file + "': ", e); } for (ImageFormat format : ImageFormat.values()) { @@ -161,7 +161,7 @@ public boolean save() { try (FileOutputStream strm = new FileOutputStream(_file);) { _props.store(strm, ""); } catch (IOException e) { - logger.warn("Unable to save the template properties ", e); + logger.warn("Unable to save the Template properties ", e); return false; } return true; diff --git a/core/src/main/java/com/cloud/storage/template/VhdProcessor.java b/core/src/main/java/com/cloud/storage/template/VhdProcessor.java index 9f18d782b426..e9be8054506d 100644 --- a/core/src/main/java/com/cloud/storage/template/VhdProcessor.java +++ b/core/src/main/java/com/cloud/storage/template/VhdProcessor.java @@ -95,7 +95,7 @@ public long getVirtualSize(File file) throws IOException { long size = getTemplateVirtualSize(file); return size; } catch (Exception e) { - logger.info("[ignored]" + "failed to get template virtual size for VHD: " + e.getLocalizedMessage()); + logger.info("[ignored]" + "failed to get Template virtual size for VHD: " + e.getLocalizedMessage()); } return file.length(); } diff --git a/core/src/main/java/com/cloud/storage/template/VmdkProcessor.java b/core/src/main/java/com/cloud/storage/template/VmdkProcessor.java index 4f53c556667f..292c1f4f52e4 100644 --- a/core/src/main/java/com/cloud/storage/template/VmdkProcessor.java +++ b/core/src/main/java/com/cloud/storage/template/VmdkProcessor.java @@ -60,7 +60,7 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa String templateFilePath = templatePath + File.separator + templateName + "." + ImageFormat.VMDK.getFileExtension(); if (!_storage.exists(templateFilePath)) { if (logger.isInfoEnabled()) { - logger.info("Unable to find the vmware template file: " + templateFilePath); + logger.info("Unable to find the VMware Template file: " + templateFilePath); } return null; } @@ -81,7 +81,7 @@ public long getVirtualSize(File file) { return size; } catch (Exception e) { logger.info("[ignored]" - + "failed to get template virtual size for vmdk: " + e.getLocalizedMessage()); + + "failed to get Template virtual size for vmdk: " + e.getLocalizedMessage()); } return file.length(); } diff --git a/core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java b/core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java index 32f436434c17..864a3e22eb3e 100644 --- a/core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java +++ b/core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java @@ -29,13 +29,15 @@ public class SetupMSListCommand extends Command { private List avoidMsList; private String lbAlgorithm; private Long lbCheckInterval; + private Boolean triggerHostLb; - public SetupMSListCommand(final List msList, final List avoidMsList, final String lbAlgorithm, final Long lbCheckInterval) { + public SetupMSListCommand(final List msList, final List avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final Boolean triggerHostLb) { super(); this.msList = msList; this.avoidMsList = avoidMsList; this.lbAlgorithm = lbAlgorithm; this.lbCheckInterval = lbCheckInterval; + this.triggerHostLb = triggerHostLb; } public List getMsList() { @@ -54,9 +56,12 @@ public Long getLbCheckInterval() { return lbCheckInterval; } + public boolean getTriggerHostLb() { + return triggerHostLb; + } + @Override public boolean executeInSequence() { return false; } - } diff --git a/core/src/main/java/org/apache/cloudstack/backup/BackupAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/BackupAnswer.java index 09f9c5621502..ffc67b628a7e 100644 --- a/core/src/main/java/org/apache/cloudstack/backup/BackupAnswer.java +++ b/core/src/main/java/org/apache/cloudstack/backup/BackupAnswer.java @@ -28,6 +28,7 @@ public class BackupAnswer extends Answer { private Long size; private Long virtualSize; private Map volumes; + Boolean needsCleanup; public BackupAnswer(final Command command, final boolean success, final String details) { super(command, success, details); @@ -56,4 +57,15 @@ public Map getVolumes() { public void setVolumes(Map volumes) { this.volumes = volumes; } + + public Boolean getNeedsCleanup() { + if (needsCleanup == null) { + return false; + } + return needsCleanup; + } + + public void setNeedsCleanup(Boolean needsCleanup) { + this.needsCleanup = needsCleanup; + } } diff --git a/core/src/main/java/org/apache/cloudstack/backup/BackupStorageStatsAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/BackupStorageStatsAnswer.java new file mode 100644 index 000000000000..eabf6877ba6e --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/BackupStorageStatsAnswer.java @@ -0,0 +1,50 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class BackupStorageStatsAnswer extends Answer { + private Long totalSize; + private Long usedSize; + + public BackupStorageStatsAnswer(final Command command, final boolean success, final String details) { + super(command, success, details); + this.totalSize = 0L; + this.usedSize = 0L; + } + + public Long getTotalSize() { + return totalSize; + } + + public void setTotalSize(Long totalSize) { + this.totalSize = totalSize; + } + + public Long getUsedSize() { + return usedSize; + } + + public void setUsedSize(Long usedSize) { + this.usedSize = usedSize; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferAnswer.java new file mode 100644 index 000000000000..34cf6d4ca34c --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferAnswer.java @@ -0,0 +1,56 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Answer; + +public class CreateImageTransferAnswer extends Answer { + private String imageTransferId; + private String transferUrl; + + public CreateImageTransferAnswer() { + } + + public CreateImageTransferAnswer(CreateImageTransferCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + + public CreateImageTransferAnswer(CreateImageTransferCommand cmd, boolean success, String details, + String imageTransferId, String transferUrl) { + super(cmd, success, details); + this.imageTransferId = imageTransferId; + this.transferUrl = transferUrl; + } + + public String getImageTransferId() { + return imageTransferId; + } + + public void setImageTransferId(String imageTransferId) { + this.imageTransferId = imageTransferId; + } + + public String getTransferUrl() { + return transferUrl; + } + + public void setTransferUrl(String transferUrl) { + this.transferUrl = transferUrl; + } + +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferCommand.java b/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferCommand.java new file mode 100644 index 000000000000..95b56c9a9c38 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/CreateImageTransferCommand.java @@ -0,0 +1,94 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; + +public class CreateImageTransferCommand extends Command { + private String transferId; + private String exportName; + private String socket; + private String direction; + private String checkpointId; + private String file; + private ImageTransfer.Backend backend; + private int idleTimeoutSeconds; + + public CreateImageTransferCommand() { + } + + private CreateImageTransferCommand(String transferId, String direction, String socket, int idleTimeoutSeconds) { + this.transferId = transferId; + this.direction = direction; + this.socket = socket; + this.idleTimeoutSeconds = idleTimeoutSeconds; + } + + public CreateImageTransferCommand(String transferId, String direction, String exportName, String socket, String checkpointId, int idleTimeoutSeconds) { + this(transferId, direction, socket, idleTimeoutSeconds); + this.backend = ImageTransfer.Backend.nbd; + this.exportName = exportName; + this.checkpointId = checkpointId; + } + + public CreateImageTransferCommand(String transferId, String direction, String socket, String file, int idleTimeoutSeconds) { + this(transferId, direction, socket, idleTimeoutSeconds); + if (direction == ImageTransfer.Direction.download.toString()) { + throw new IllegalArgumentException("File backend is only supported for upload"); + } + this.backend = ImageTransfer.Backend.file; + this.file = file; + } + + public String getExportName() { + return exportName; + } + + public String getSocket() { + return socket; + } + + public String getFile() { + return file; + } + + public ImageTransfer.Backend getBackend() { + return backend; + } + + public String getTransferId() { + return transferId; + } + + @Override + public boolean executeInSequence() { + return true; + } + + public String getDirection() { + return direction; + } + + public String getCheckpointId() { + return checkpointId; + } + + public int getIdleTimeoutSeconds() { + return idleTimeoutSeconds; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/DeleteVmCheckpointCommand.java b/core/src/main/java/org/apache/cloudstack/backup/DeleteVmCheckpointCommand.java new file mode 100644 index 000000000000..81cf6c1abfcc --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/DeleteVmCheckpointCommand.java @@ -0,0 +1,60 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import java.util.Map; + +import com.cloud.agent.api.Command; + +public class DeleteVmCheckpointCommand extends Command { + private String vmName; + private String checkpointId; + private Map diskPathUuidMap; + private boolean stoppedVM; + + public DeleteVmCheckpointCommand() { + } + + public DeleteVmCheckpointCommand(String vmName, String checkpointId, Map diskPathUuidMap, boolean stoppedVM) { + this.vmName = vmName; + this.checkpointId = checkpointId; + this.diskPathUuidMap = diskPathUuidMap; + this.stoppedVM = stoppedVM; + } + + public String getVmName() { + return vmName; + } + + public String getCheckpointId() { + return checkpointId; + } + + public Map getDiskPathUuidMap() { + return diskPathUuidMap; + } + + public boolean isStoppedVM() { + return stoppedVM; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/FinalizeImageTransferCommand.java b/core/src/main/java/org/apache/cloudstack/backup/FinalizeImageTransferCommand.java new file mode 100644 index 000000000000..84d9b1ff8186 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/FinalizeImageTransferCommand.java @@ -0,0 +1,40 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; + +public class FinalizeImageTransferCommand extends Command { + private String transferId; + + public FinalizeImageTransferCommand() { + } + + public FinalizeImageTransferCommand(String transferId) { + this.transferId = transferId; + } + + public String getTransferId() { + return transferId; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/GetBackupStorageStatsCommand.java b/core/src/main/java/org/apache/cloudstack/backup/GetBackupStorageStatsCommand.java new file mode 100644 index 000000000000..1ceeac17e52e --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/GetBackupStorageStatsCommand.java @@ -0,0 +1,66 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; +import com.cloud.agent.api.LogLevel; + +public class GetBackupStorageStatsCommand extends Command { + private String backupRepoType; + private String backupRepoAddress; + @LogLevel(LogLevel.Log4jLevel.Off) + private String mountOptions; + + public GetBackupStorageStatsCommand(String backupRepoType, String backupRepoAddress, String mountOptions) { + super(); + this.backupRepoType = backupRepoType; + this.backupRepoAddress = backupRepoAddress; + this.mountOptions = mountOptions; + } + + public String getBackupRepoType() { + return backupRepoType; + } + + public void setBackupRepoType(String backupRepoType) { + this.backupRepoType = backupRepoType; + } + + public String getBackupRepoAddress() { + return backupRepoAddress; + } + + public void setBackupRepoAddress(String backupRepoAddress) { + this.backupRepoAddress = backupRepoAddress; + } + + public String getMountOptions() { + return mountOptions == null ? "" : mountOptions; + } + + public void setMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java b/core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java index 7228e35147af..972c2eaf7bb4 100644 --- a/core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java +++ b/core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java @@ -22,6 +22,7 @@ import com.cloud.agent.api.Command; import com.cloud.agent.api.LogLevel; import com.cloud.vm.VirtualMachine; +import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; import java.util.List; @@ -30,11 +31,15 @@ public class RestoreBackupCommand extends Command { private String backupPath; private String backupRepoType; private String backupRepoAddress; - private List volumePaths; + private List backupVolumesUUIDs; + private List restoreVolumePools; + private List restoreVolumePaths; + private List restoreVolumeSizes; + private List backupFiles; private String diskType; private Boolean vmExists; - private String restoreVolumeUUID; private VirtualMachine.State vmState; + private Integer mountTimeout; protected RestoreBackupCommand() { super(); @@ -72,12 +77,36 @@ public void setBackupRepoAddress(String backupRepoAddress) { this.backupRepoAddress = backupRepoAddress; } - public List getVolumePaths() { - return volumePaths; + public List getRestoreVolumePools() { + return restoreVolumePools; } - public void setVolumePaths(List volumePaths) { - this.volumePaths = volumePaths; + public void setRestoreVolumePools(List restoreVolumePools) { + this.restoreVolumePools = restoreVolumePools; + } + + public List getRestoreVolumePaths() { + return restoreVolumePaths; + } + + public void setRestoreVolumePaths(List restoreVolumePaths) { + this.restoreVolumePaths = restoreVolumePaths; + } + + public List getRestoreVolumeSizes() { + return restoreVolumeSizes; + } + + public void setRestoreVolumeSizes(List restoreVolumeSizes) { + this.restoreVolumeSizes = restoreVolumeSizes; + } + + public List getBackupFiles() { + return backupFiles; + } + + public void setBackupFiles(List backupFiles) { + this.backupFiles = backupFiles; } public Boolean isVmExists() { @@ -104,14 +133,6 @@ public void setMountOptions(String mountOptions) { this.mountOptions = mountOptions; } - public String getRestoreVolumeUUID() { - return restoreVolumeUUID; - } - - public void setRestoreVolumeUUID(String restoreVolumeUUID) { - this.restoreVolumeUUID = restoreVolumeUUID; - } - public VirtualMachine.State getVmState() { return vmState; } @@ -127,4 +148,20 @@ public void setVmState(VirtualMachine.State vmState) { public boolean executeInSequence() { return true; } + + public List getBackupVolumesUUIDs() { + return backupVolumesUUIDs; + } + + public void setBackupVolumesUUIDs(List backupVolumesUUIDs) { + this.backupVolumesUUIDs = backupVolumesUUIDs; + } + + public Integer getMountTimeout() { + return this.mountTimeout == null ? 0 : this.mountTimeout; + } + + public void setMountTimeout(Integer mountTimeout) { + this.mountTimeout = mountTimeout; + } } diff --git a/core/src/main/java/org/apache/cloudstack/backup/StartBackupAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/StartBackupAnswer.java new file mode 100644 index 000000000000..d7cbf097df90 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StartBackupAnswer.java @@ -0,0 +1,44 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Answer; + +public class StartBackupAnswer extends Answer { + private Long checkpointCreateTime; + + public StartBackupAnswer() { + } + + public StartBackupAnswer(StartBackupCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + + public StartBackupAnswer(StartBackupCommand cmd, boolean success, String details, Long checkpointCreateTime) { + super(cmd, success, details); + this.checkpointCreateTime = checkpointCreateTime; + } + + public Long getCheckpointCreateTime() { + return checkpointCreateTime; + } + + public void setCheckpointCreateTime(Long checkpointCreateTime) { + this.checkpointCreateTime = checkpointCreateTime; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StartBackupCommand.java b/core/src/main/java/org/apache/cloudstack/backup/StartBackupCommand.java new file mode 100644 index 000000000000..6f1ed6834500 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StartBackupCommand.java @@ -0,0 +1,91 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import java.util.Map; + +import com.cloud.agent.api.Command; +import com.cloud.agent.api.LogLevel; + +public class StartBackupCommand extends Command { + private String vmName; + private String toCheckpointId; + private String fromCheckpointId; + private Long fromCheckpointCreateTime; + private String socket; + private Map diskPathUuidMap; + private boolean stoppedVM; + @LogLevel(LogLevel.Log4jLevel.Off) + private Map diskPathPassphraseMap; + + public StartBackupCommand() { + } + + public StartBackupCommand(String vmName, String toCheckpointId, String fromCheckpointId, Long fromCheckpointCreateTime, + String socket, Map diskPathUuidMap, Map passphrases, boolean stoppedVM) { + this.vmName = vmName; + this.toCheckpointId = toCheckpointId; + this.fromCheckpointId = fromCheckpointId; + this.fromCheckpointCreateTime = fromCheckpointCreateTime; + this.socket = socket; + this.diskPathUuidMap = diskPathUuidMap; + this.diskPathPassphraseMap = passphrases; + this.stoppedVM = stoppedVM; + } + + public String getVmName() { + return vmName; + } + + public String getToCheckpointId() { + return toCheckpointId; + } + + public String getFromCheckpointId() { + return fromCheckpointId; + } + + public Long getFromCheckpointCreateTime() { + return fromCheckpointCreateTime; + } + + public String getSocket() { + return socket; + } + + public Map getDiskPathUuidMap() { + return diskPathUuidMap; + } + + public boolean isIncremental() { + return fromCheckpointId != null && !fromCheckpointId.isEmpty(); + } + + public boolean isStoppedVM() { + return stoppedVM; + } + + public Map getDiskPathPassphraseMap() { + return diskPathPassphraseMap; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerAnswer.java new file mode 100644 index 000000000000..d8c78d3c8807 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerAnswer.java @@ -0,0 +1,56 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Answer; + +public class StartNBDServerAnswer extends Answer { + private String imageTransferId; + private String transferUrl; + + public StartNBDServerAnswer() { + } + + public StartNBDServerAnswer(StartNBDServerCommand cmd, boolean success, String details) { + super(cmd, success, details); + } + + public StartNBDServerAnswer(StartNBDServerCommand cmd, boolean success, String details, + String imageTransferId, String transferUrl) { + super(cmd, success, details); + this.imageTransferId = imageTransferId; + this.transferUrl = transferUrl; + } + + public String getImageTransferId() { + return imageTransferId; + } + + public void setImageTransferId(String imageTransferId) { + this.imageTransferId = imageTransferId; + } + + public String getTransferUrl() { + return transferUrl; + } + + public void setTransferUrl(String transferUrl) { + this.transferUrl = transferUrl; + } + +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerCommand.java b/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerCommand.java new file mode 100644 index 000000000000..07e50f11fd37 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StartNBDServerCommand.java @@ -0,0 +1,78 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; +import com.cloud.agent.api.LogLevel; + +public class StartNBDServerCommand extends Command { + private String transferId; + private String exportName; + private String volumePath; + private String socket; + private String direction; + private String fromCheckpointId; + @LogLevel(LogLevel.Log4jLevel.Off) + private byte[] passphrase; + + public StartNBDServerCommand() { + } + + protected StartNBDServerCommand(String transferId, String exportName, String volumePath, String socket, String direction, String fromCheckpointId, byte[] passphrase) { + this.transferId = transferId; + this.socket = socket; + this.exportName = exportName; + this.volumePath = volumePath; + this.direction = direction; + this.fromCheckpointId = fromCheckpointId; + this.passphrase = passphrase; + } + + public String getExportName() { + return exportName; + } + + public String getSocket() { + return socket; + } + + public String getTransferId() { + return transferId; + } + + @Override + public boolean executeInSequence() { + return true; + } + + public String getVolumePath() { + return volumePath; + } + + public String getDirection() { + return direction; + } + + public String getFromCheckpointId() { + return fromCheckpointId; + } + + public byte[] getPassphrase() { + return passphrase; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StopBackupAnswer.java b/core/src/main/java/org/apache/cloudstack/backup/StopBackupAnswer.java new file mode 100644 index 000000000000..ce977f31e005 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StopBackupAnswer.java @@ -0,0 +1,30 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Answer; + +public class StopBackupAnswer extends Answer { + + public StopBackupAnswer() { + } + + public StopBackupAnswer(StopBackupCommand cmd, boolean success, String details) { + super(cmd, success, details); + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StopBackupCommand.java b/core/src/main/java/org/apache/cloudstack/backup/StopBackupCommand.java new file mode 100644 index 000000000000..d3055021e9de --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StopBackupCommand.java @@ -0,0 +1,52 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; + +public class StopBackupCommand extends Command { + private String vmName; + private Long vmId; + private Long backupId; + + public StopBackupCommand() { + } + + public StopBackupCommand(String vmName, Long vmId, Long backupId) { + this.vmName = vmName; + this.vmId = vmId; + this.backupId = backupId; + } + + public String getVmName() { + return vmName; + } + + public Long getVmId() { + return vmId; + } + + public Long getBackupId() { + return backupId; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/StopNBDServerCommand.java b/core/src/main/java/org/apache/cloudstack/backup/StopNBDServerCommand.java new file mode 100644 index 000000000000..d75168a22eb2 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/backup/StopNBDServerCommand.java @@ -0,0 +1,46 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import com.cloud.agent.api.Command; + +public class StopNBDServerCommand extends Command { + private String transferId; + private String direction; + + public StopNBDServerCommand() { + } + + public StopNBDServerCommand(String transferId, String direction) { + this.transferId = transferId; + this.direction = direction; + } + + public String getTransferId() { + return transferId; + } + + public String getDirection() { + return direction; + } + + @Override + public boolean executeInSequence() { + return true; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java b/core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java index 93855ea17211..5402b6b24760 100644 --- a/core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java +++ b/core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java @@ -21,6 +21,7 @@ import com.cloud.agent.api.Command; import com.cloud.agent.api.LogLevel; +import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; import java.util.List; @@ -29,7 +30,9 @@ public class TakeBackupCommand extends Command { private String backupPath; private String backupRepoType; private String backupRepoAddress; + private List volumePools; private List volumePaths; + private Boolean quiesce; @LogLevel(LogLevel.Log4jLevel.Off) private String mountOptions; @@ -79,6 +82,14 @@ public void setMountOptions(String mountOptions) { this.mountOptions = mountOptions; } + public List getVolumePools() { + return volumePools; + } + + public void setVolumePools(List volumePools) { + this.volumePools = volumePools; + } + public List getVolumePaths() { return volumePaths; } @@ -87,6 +98,14 @@ public void setVolumePaths(List volumePaths) { this.volumePaths = volumePaths; } + public Boolean getQuiesce() { + return quiesce; + } + + public void setQuiesce(Boolean quiesce) { + this.quiesce = quiesce; + } + @Override public boolean executeInSequence() { return true; diff --git a/core/src/main/java/org/apache/cloudstack/command/CommandInfo.java b/core/src/main/java/org/apache/cloudstack/command/CommandInfo.java new file mode 100644 index 000000000000..b9bb702e3459 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/CommandInfo.java @@ -0,0 +1,124 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.Command; +import com.cloud.serializer.GsonHelper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.util.Date; + +public class CommandInfo { + public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSSZ"; + public static final Gson GSON = GsonHelper.setDefaultGsonConfig(new GsonBuilder().setDateFormat(DATE_FORMAT)); + + long requestSeq; + Command.State state; + Date startTime; + Date updateTime; + String commandName; + String command; + int timeout; + String answerName; + String answer; + + public CommandInfo() { + } + + public CommandInfo(long requestSeq, Command command, Command.State state) { + this.requestSeq = requestSeq; + this.state = state; + this.startTime = this.updateTime = new Date(); + this.commandName = command.getClass().getName(); + this.command = GSON.toJson(command); + this.timeout = command.getWait(); + } + + public long getRequestSeq() { + return requestSeq; + } + + public void setRequestSeq(long requestSeq) { + this.requestSeq = requestSeq; + } + + public Command.State getState() { + return state; + } + + public void setState(Command.State state) { + this.state = state; + this.updateTime = new Date(); + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getCommandName() { + return commandName; + } + + public void setCommandName(String commandName) { + this.commandName = commandName; + } + + public String getCommand() { + return command; + } + + public void setCommand(String command) { + this.command = command; + } + + public int getTimeout() { + return timeout; + } + + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + public String getAnswerName() { + return answerName; + } + + public void setAnswerName(String answerName) { + this.answerName = answerName; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileAnswer.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileAnswer.java new file mode 100644 index 000000000000..e8d27e1fa712 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileAnswer.java @@ -0,0 +1,45 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.Answer; +import org.apache.cloudstack.api.ApiCommandResourceType; + +public class ReconcileAnswer extends Answer { + + ApiCommandResourceType resourceType; + Long resourceId; + + public ApiCommandResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ApiCommandResourceType resourceType) { + this.resourceType = resourceType; + } + + public Long getResourceId() { + return resourceId; + } + + public void setResourceId(Long resourceId) { + this.resourceId = resourceId; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileCommand.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileCommand.java new file mode 100644 index 000000000000..262aefb30ac6 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileCommand.java @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.Command; + +public class ReconcileCommand extends Command { + + @Override + public boolean executeInSequence() { + return false; + } + + @Override + public int getWait() { + return 30; // timeout is 30 seconds + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileCommandUtils.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileCommandUtils.java new file mode 100644 index 000000000000..8acc02a730f1 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileCommandUtils.java @@ -0,0 +1,192 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.JsonSyntaxException; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; + +public class ReconcileCommandUtils { + + protected static final Logger LOGGER = LogManager.getLogger(ReconcileCommandUtils.class.getName()); + + public static void createLogFileForCommand(final String logPath, final Command cmd) { + updateLogFileForCommand(logPath, cmd, Command.State.CREATED); + } + + public static void updateLogFileForCommand(final String logPath, final Command cmd, final Command.State state) { + if (cmd.isReconcile()) { + String logFileName = getLogFileNameForCommand(logPath, cmd); + LOGGER.debug(String.format("Updating log file %s with %s state", logFileName, state)); + File logFile = new File(logFileName); + CommandInfo commandInfo = null; + if (logFile.exists()) { + commandInfo = readLogFileForCommand(logFileName); + logFile.delete(); + } + if (commandInfo == null) { + commandInfo = new CommandInfo(cmd.getRequestSequence(), cmd, state); + } else { + commandInfo.setState(state); + } + try { + BufferedWriter writer = new BufferedWriter(new FileWriter(logFile)); + writer.write(CommandInfo.GSON.toJson(commandInfo)); + writer.close(); + } catch (IOException e) { + LOGGER.error(String.format("Failed to write log file %s", logFile)); + } + } + } + + public static void updateLogFileForCommand(final String logFullPath, final Command.State state) { + File logFile = new File(logFullPath); + LOGGER.debug(String.format("Updating log file %s with %s state", logFile.getName(), state)); + if (!logFile.exists()) { + return; + } + CommandInfo commandInfo = readLogFileForCommand(logFullPath); + if (commandInfo != null) { + commandInfo.setState(state); + } + logFile.delete(); + try { + BufferedWriter writer = new BufferedWriter(new FileWriter(logFile)); + writer.write(CommandInfo.GSON.toJson(commandInfo)); + writer.close(); + } catch (IOException e) { + LOGGER.error(String.format("Failed to write log file %s", logFile)); + } + } + + public static void deleteLogFileForCommand(final String logPath, final Command cmd) { + if (cmd.isReconcile()) { + File logFile = new File(getLogFileNameForCommand(logPath, cmd)); + LOGGER.debug(String.format("Removing log file %s", logFile.getName())); + if (logFile.exists()) { + logFile.delete(); + } + } + } + + public static void deleteLogFile(final String logFullPath) { + File logFile = new File(logFullPath); + LOGGER.debug(String.format("Removing log file %s ", logFile.getName())); + if (logFile.exists()) { + logFile.delete(); + } + } + + public static String getLogFileNameForCommand(final String logPath, final Command cmd) { + return String.format("%s/%s-%s.json", logPath, cmd.getRequestSequence(), cmd); + } + + public static CommandInfo readLogFileForCommand(final String logFullPath) { + try { + ObjectMapper objectMapper = new ObjectMapper(); + SimpleDateFormat df = new SimpleDateFormat(CommandInfo.DATE_FORMAT); + objectMapper.setDateFormat(df); + return objectMapper.readValue(new File(logFullPath), CommandInfo.class); + } catch (IOException e) { + LOGGER.error(String.format("Failed to read log file %s: %s", logFullPath, e.getMessage())); + return null; + } + } + + public static Command parseCommandInfo(final CommandInfo commandInfo) { + if (commandInfo.getCommandName() == null || commandInfo.getCommand() == null) { + return null; + } + return parseCommandInfo(commandInfo.getCommandName(), commandInfo.getCommand()); + } + + public static Command parseCommandInfo(final String commandName, final String commandInfo) { + Object parsedObject = null; + try { + Class commandClazz = Class.forName(commandName); + parsedObject = CommandInfo.GSON.fromJson(commandInfo, commandClazz); + } catch (ClassNotFoundException | JsonSyntaxException e) { + LOGGER.error(String.format("Failed to parse command from CommandInfo %s due to %s", commandInfo, e.getMessage())); + } + if (parsedObject != null) { + return (Command) parsedObject; + } + return null; + } + + public static Answer parseAnswerFromCommandInfo(final CommandInfo commandInfo) { + if (commandInfo.getAnswerName() == null || commandInfo.getAnswer() == null) { + return null; + } + return parseAnswerFromAnswerInfo(commandInfo.getAnswerName(), commandInfo.getAnswer()); + } + + public static Answer parseAnswerFromAnswerInfo(final String answerName, final String answerInfo) { + Object parsedObject = null; + try { + Class commandClazz = Class.forName(answerName); + parsedObject = CommandInfo.GSON.fromJson(answerInfo, commandClazz); + } catch (ClassNotFoundException | JsonSyntaxException e) { + LOGGER.error(String.format("Failed to parse answer from answerInfo %s due to %s", answerInfo, e.getMessage())); + } + if (parsedObject != null) { + return (Answer) parsedObject; + } + return null; + } + + public static void updateLogFileWithAnswerForCommand(final String logPath, final Command cmd, final Answer answer) { + if (cmd.isReconcile()) { + String logFileName = getLogFileNameForCommand(logPath, cmd); + LOGGER.debug(String.format("Updating log file %s with answer %s", logFileName, answer)); + File logFile = new File(logFileName); + if (!logFile.exists()) { + return; + } + CommandInfo commandInfo = readLogFileForCommand(logFile.getAbsolutePath()); + if (commandInfo == null) { + return; + } + if (Command.State.STARTED.equals(commandInfo.getState())) { + if (answer.getResult()) { + commandInfo.setState(Command.State.COMPLETED); + } else { + commandInfo.setState(Command.State.FAILED); + } + } + commandInfo.setAnswerName(answer.toString()); + commandInfo.setAnswer(CommandInfo.GSON.toJson(answer)); + try { + BufferedWriter writer = new BufferedWriter(new FileWriter(logFile)); + writer.write(CommandInfo.GSON.toJson(commandInfo)); + writer.close(); + } catch (IOException e) { + LOGGER.error(String.format("Failed to write log file %s", logFile)); + } + } + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyAnswer.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyAnswer.java new file mode 100644 index 000000000000..82a24fa7fa5e --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyAnswer.java @@ -0,0 +1,56 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import org.apache.cloudstack.storage.volume.VolumeOnStorageTO; + +public class ReconcileCopyAnswer extends ReconcileVolumeAnswer { + + boolean isSkipped = false; + String reason; + + public ReconcileCopyAnswer(boolean isSkipped, String reason) { + super(); + this.isSkipped = isSkipped; + this.reason = reason; + } + + public ReconcileCopyAnswer(boolean isSkipped, boolean result, String reason) { + super(); + this.isSkipped = isSkipped; + this.result = result; + this.reason = reason; + } + + public ReconcileCopyAnswer(VolumeOnStorageTO volumeOnSource, VolumeOnStorageTO volumeOnDestination) { + this.isSkipped = false; + this.result = true; + this.volumeOnSource = volumeOnSource; + this.volumeOnDestination = volumeOnDestination; + } + + public boolean isSkipped() { + return isSkipped; + } + + public String getReason() { + return reason; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyCommand.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyCommand.java new file mode 100644 index 000000000000..36a678833d0f --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileCopyCommand.java @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.to.DataTO; + +import java.util.Map; + +public class ReconcileCopyCommand extends ReconcileCommand { + + DataTO srcData; + DataTO destData; + Map option; // details of source volume + Map option2; // details of destination volume + + public ReconcileCopyCommand(DataTO srcData, DataTO destData, Map option, Map option2) { + this.srcData = srcData; + this.destData = destData; + this.option = option; + this.option2 = option2; + } + + public DataTO getSrcData() { + return srcData; + } + + public DataTO getDestData() { + return destData; + } + + public Map getOption() { + return option; + } + + public Map getOption2() { + return option2; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateAnswer.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateAnswer.java new file mode 100644 index 000000000000..6313267c7e4c --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateAnswer.java @@ -0,0 +1,68 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.vm.VirtualMachine; + +import java.util.List; + +public class ReconcileMigrateAnswer extends ReconcileAnswer { + + Long hostId; + String vmName; + VirtualMachine.State vmState; + List vmDisks; + + public ReconcileMigrateAnswer() { + } + + public ReconcileMigrateAnswer(String vmName, VirtualMachine.State vmState) { + this.vmName = vmName; + this.vmState = vmState; + } + + public Long getHostId() { + return hostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } + + public String getVmName() { + return vmName; + } + + public VirtualMachine.State getVmState() { + return vmState; + } + + public void setVmState(VirtualMachine.State vmState) { + this.vmState = vmState; + } + + public List getVmDisks() { + return vmDisks; + } + + public void setVmDisks(List vmDisks) { + this.vmDisks = vmDisks; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateCommand.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateCommand.java new file mode 100644 index 000000000000..50e1c68a65f6 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateCommand.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +public class ReconcileMigrateCommand extends ReconcileCommand { + + String vmName; + + public ReconcileMigrateCommand(String vmName) { + this.vmName = vmName; + } + + public String getVmName() { + return vmName; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeAnswer.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeAnswer.java new file mode 100644 index 000000000000..ebbd913f9718 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeAnswer.java @@ -0,0 +1,50 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import org.apache.cloudstack.storage.volume.VolumeOnStorageTO; + +import java.util.List; + +public class ReconcileMigrateVolumeAnswer extends ReconcileVolumeAnswer { + + String vmName; + List vmDiskPaths; + + public ReconcileMigrateVolumeAnswer(VolumeOnStorageTO volumeOnSource, VolumeOnStorageTO volumeOnDestination) { + super(volumeOnSource, volumeOnDestination); + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + public List getVmDiskPaths() { + return vmDiskPaths; + } + + public void setVmDiskPaths(List vmDiskPaths) { + this.vmDiskPaths = vmDiskPaths; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeCommand.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeCommand.java new file mode 100644 index 000000000000..e3e752494068 --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileMigrateVolumeCommand.java @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.to.DataTO; + +public class ReconcileMigrateVolumeCommand extends ReconcileCommand { + + DataTO srcData; + DataTO destData; + String vmName; + + public ReconcileMigrateVolumeCommand(DataTO srcData, DataTO destData) { + this.srcData = srcData; + this.destData = destData; + } + + public DataTO getSrcData() { + return srcData; + } + + public DataTO getDestData() { + return destData; + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/command/ReconcileVolumeAnswer.java b/core/src/main/java/org/apache/cloudstack/command/ReconcileVolumeAnswer.java new file mode 100644 index 000000000000..da10bf23aeeb --- /dev/null +++ b/core/src/main/java/org/apache/cloudstack/command/ReconcileVolumeAnswer.java @@ -0,0 +1,46 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import org.apache.cloudstack.storage.volume.VolumeOnStorageTO; + +public class ReconcileVolumeAnswer extends ReconcileAnswer { + + // (1) null object: volume is not available. For example the source is secondary storage + // (2) otherwise, if volumeOnSource.getPath() is null, the volume cannot be found on primary storage pool + VolumeOnStorageTO volumeOnSource; + VolumeOnStorageTO volumeOnDestination; + + public ReconcileVolumeAnswer() { + } + + public ReconcileVolumeAnswer(VolumeOnStorageTO volumeOnSource, VolumeOnStorageTO volumeOnDestination) { + this.volumeOnSource = volumeOnSource; + this.volumeOnDestination = volumeOnDestination; + } + + public VolumeOnStorageTO getVolumeOnSource() { + return volumeOnSource; + } + + public VolumeOnStorageTO getVolumeOnDestination() { + return volumeOnDestination; + } +} diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/DirectTemplateDownloaderImpl.java b/core/src/main/java/org/apache/cloudstack/direct/download/DirectTemplateDownloaderImpl.java index d22c803818be..05619e5632b0 100644 --- a/core/src/main/java/org/apache/cloudstack/direct/download/DirectTemplateDownloaderImpl.java +++ b/core/src/main/java/org/apache/cloudstack/direct/download/DirectTemplateDownloaderImpl.java @@ -21,6 +21,7 @@ import com.cloud.utils.UriUtils; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.utils.security.DigestHelper; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; @@ -33,6 +34,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.UUID; public abstract class DirectTemplateDownloaderImpl implements DirectTemplateDownloader { @@ -128,15 +130,14 @@ public void setFollowRedirects(boolean followRedirects) { */ protected File createTemporaryDirectoryAndFile(String downloadDir) { createFolder(downloadDir); - return new File(downloadDir + File.separator + getFileNameFromUrl()); + return new File(downloadDir + File.separator + getTemporaryFileName()); } /** - * Return filename from url + * Return filename from the temporary download file */ - public String getFileNameFromUrl() { - String[] urlParts = url.split("/"); - return urlParts[urlParts.length - 1]; + public String getTemporaryFileName() { + return String.format("%s.%s", UUID.randomUUID(), FilenameUtils.getExtension(url)); } @Override @@ -147,16 +148,16 @@ public boolean validateChecksum() { try { while (!valid && retry > 0) { retry--; - logger.info("Performing checksum validation for downloaded template " + templateId + " using " + checksum + ", retries left: " + retry); + logger.info("Performing checksum validation for downloaded Template " + templateId + " using " + checksum + ", retries left: " + retry); valid = DigestHelper.check(checksum, new FileInputStream(downloadedFilePath)); if (!valid && retry > 0) { - logger.info("Checksum validation failed, re-downloading template"); + logger.info("Checksum validation failed, re-downloading Template"); redownload = true; resetDownloadFile(); downloadTemplate(); } } - logger.info("Checksum validation for template " + templateId + ": " + (valid ? "succeeded" : "failed")); + logger.info("Checksum validation for Template " + templateId + ": " + (valid ? "succeeded" : "failed")); return valid; } catch (IOException e) { throw new CloudRuntimeException("could not check sum for file: " + downloadedFilePath, e); @@ -173,7 +174,7 @@ public boolean validateChecksum() { */ private void resetDownloadFile() { File f = new File(getDownloadedFilePath()); - logger.info("Resetting download file: " + getDownloadedFilePath() + ", in order to re-download and persist template " + templateId + " on it"); + logger.info("Resetting download file: " + getDownloadedFilePath() + ", in order to re-download and persist Template " + templateId + " on it"); try { if (f.exists()) { f.delete(); diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/HttpDirectTemplateDownloader.java b/core/src/main/java/org/apache/cloudstack/direct/download/HttpDirectTemplateDownloader.java index 8c4147fad606..99b84bb645c8 100644 --- a/core/src/main/java/org/apache/cloudstack/direct/download/HttpDirectTemplateDownloader.java +++ b/core/src/main/java/org/apache/cloudstack/direct/download/HttpDirectTemplateDownloader.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.direct.download; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -32,6 +33,7 @@ import com.cloud.utils.Pair; import com.cloud.utils.UriUtils; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.net.HttpClientCloudStackUserAgent; import com.cloud.utils.storage.QCOW2Utils; import org.apache.commons.collections.MapUtils; import org.apache.commons.httpclient.HttpClient; @@ -39,6 +41,7 @@ import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.HeadMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.io.IOUtils; public class HttpDirectTemplateDownloader extends DirectTemplateDownloaderImpl { @@ -68,6 +71,7 @@ public HttpDirectTemplateDownloader(String url, Long templateId, String destPool protected GetMethod createRequest(String downloadUrl, Map headers) { GetMethod request = new GetMethod(downloadUrl); request.setFollowRedirects(this.isFollowRedirects()); + request.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); if (MapUtils.isNotEmpty(headers)) { for (String key : headers.keySet()) { request.setRequestHeader(key, headers.get(key)); @@ -82,7 +86,7 @@ public Pair downloadTemplate() { try { int status = client.executeMethod(request); if (status != HttpStatus.SC_OK) { - logger.warn("Not able to download template, status code: " + status); + logger.warn("Not able to download Template, status code: " + status); return new Pair<>(false, null); } return performDownload(); @@ -94,14 +98,14 @@ public Pair downloadTemplate() { } protected Pair performDownload() { - logger.info("Downloading template " + getTemplateId() + " from " + getUrl() + " to: " + getDownloadedFilePath()); + logger.info("Downloading Template " + getTemplateId() + " from " + getUrl() + " to: " + getDownloadedFilePath()); try ( InputStream in = request.getResponseBodyAsStream(); OutputStream out = new FileOutputStream(getDownloadedFilePath()) ) { IOUtils.copy(in, out); } catch (IOException e) { - logger.error("Error downloading template " + getTemplateId() + " due to: " + e.getMessage()); + logger.error("Error downloading Template " + getTemplateId() + " due to: " + e.getMessage()); return new Pair<>(false, null); } return new Pair<>(true, getDownloadedFilePath()); @@ -111,6 +115,7 @@ protected Pair performDownload() { public boolean checkUrl(String url) { HeadMethod httpHead = new HeadMethod(url); httpHead.setFollowRedirects(this.isFollowRedirects()); + httpHead.getParams().setParameter(HttpMethodParams.USER_AGENT, HttpClientCloudStackUserAgent.CLOUDSTACK_USER_AGENT); try { int responseCode = client.executeMethod(httpHead); if (responseCode != HttpStatus.SC_OK) { diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/HttpsDirectTemplateDownloader.java b/core/src/main/java/org/apache/cloudstack/direct/download/HttpsDirectTemplateDownloader.java index b8a25a11b5c4..34ab94d55b19 100644 --- a/core/src/main/java/org/apache/cloudstack/direct/download/HttpsDirectTemplateDownloader.java +++ b/core/src/main/java/org/apache/cloudstack/direct/download/HttpsDirectTemplateDownloader.java @@ -39,9 +39,7 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import org.apache.cloudstack.utils.security.SSLUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.io.IOUtils; @@ -55,6 +53,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import com.cloud.utils.Pair; @@ -98,8 +97,8 @@ protected void createUriRequest(String downloadUrl, Map headers) req = new HttpGet(downloadUrl); setFollowRedirects(this.isFollowRedirects()); if (MapUtils.isNotEmpty(headers)) { - for (String headerKey: headers.keySet()) { - req.setHeader(headerKey, headers.get(headerKey)); + for (Map.Entry entry : headers.entrySet()) { + req.setHeader(entry.getKey(), entry.getValue()); } } } @@ -120,10 +119,10 @@ private SSLContext getSSLContext() { String password = "changeit"; defaultKeystore.load(is, password.toCharArray()); } - TrustManager[] tm = HttpsMultiTrustManager.getTrustManagersFromKeyStores(customKeystore, defaultKeystore); - SSLContext sslContext = SSLUtils.getSSLContext(); - sslContext.init(null, tm, null); - return sslContext; + return SSLContexts.custom() + .loadTrustMaterial(customKeystore, null) + .loadTrustMaterial(defaultKeystore, null) + .build(); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | KeyManagementException e) { logger.error(String.format("Failure getting SSL context for HTTPS downloader, using default SSL context: %s", e.getMessage()), e); try { @@ -150,7 +149,7 @@ public Pair downloadTemplate() { * Consume response and persist it on getDownloadedFilePath() file */ protected Pair consumeResponse(CloseableHttpResponse response) { - logger.info("Downloading template " + getTemplateId() + " from " + getUrl() + " to: " + getDownloadedFilePath()); + logger.info("Downloading Template " + getTemplateId() + " from " + getUrl() + " to: " + getDownloadedFilePath()); if (response.getStatusLine().getStatusCode() != 200) { throw new CloudRuntimeException("Error on HTTPS response"); } @@ -160,7 +159,7 @@ protected Pair consumeResponse(CloseableHttpResponse response) OutputStream out = new FileOutputStream(getDownloadedFilePath()); IOUtils.copy(in, out); } catch (Exception e) { - logger.error("Error parsing response for template " + getTemplateId() + " due to: " + e.getMessage()); + logger.error("Error parsing response for Template " + getTemplateId() + " due to: " + e.getMessage()); return new Pair<>(false, null); } return new Pair<>(true, getDownloadedFilePath()); diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/HttpsMultiTrustManager.java b/core/src/main/java/org/apache/cloudstack/direct/download/HttpsMultiTrustManager.java deleted file mode 100644 index fe47847c36ca..000000000000 --- a/core/src/main/java/org/apache/cloudstack/direct/download/HttpsMultiTrustManager.java +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 org.apache.cloudstack.direct.download; - -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; - -public class HttpsMultiTrustManager implements X509TrustManager { - - private final List trustManagers; - - public HttpsMultiTrustManager(KeyStore... keystores) { - List trustManagers = new ArrayList<>(); - trustManagers.add(getTrustManager(null)); - for (KeyStore keystore : keystores) { - trustManagers.add(getTrustManager(keystore)); - } - this.trustManagers = ImmutableList.copyOf(trustManagers); - } - - public static TrustManager[] getTrustManagersFromKeyStores(KeyStore... keyStore) { - return new TrustManager[] { new HttpsMultiTrustManager(keyStore) }; - - } - - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - for (X509TrustManager trustManager : trustManagers) { - try { - trustManager.checkClientTrusted(chain, authType); - return; - } catch (CertificateException ignored) {} - } - throw new CertificateException("None of the TrustManagers trust this certificate chain"); - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - for (X509TrustManager trustManager : trustManagers) { - try { - trustManager.checkServerTrusted(chain, authType); - return; - } catch (CertificateException ignored) {} - } - throw new CertificateException("None of the TrustManagers trust this certificate chain"); - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - ImmutableList.Builder certificates = ImmutableList.builder(); - for (X509TrustManager trustManager : trustManagers) { - for (X509Certificate cert : trustManager.getAcceptedIssuers()) { - certificates.add(cert); - } - } - return Iterables.toArray(certificates.build(), X509Certificate.class); - } - - public X509TrustManager getTrustManager(KeyStore keystore) { - return getTrustManager(TrustManagerFactory.getDefaultAlgorithm(), keystore); - } - - public X509TrustManager getTrustManager(String algorithm, KeyStore keystore) { - TrustManagerFactory factory; - try { - factory = TrustManagerFactory.getInstance(algorithm); - factory.init(keystore); - return Iterables.getFirst(Iterables.filter( - Arrays.asList(factory.getTrustManagers()), X509TrustManager.class), null); - } catch (NoSuchAlgorithmException | KeyStoreException e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/MetalinkDirectTemplateDownloader.java b/core/src/main/java/org/apache/cloudstack/direct/download/MetalinkDirectTemplateDownloader.java index 5335da991506..854c310cde9a 100644 --- a/core/src/main/java/org/apache/cloudstack/direct/download/MetalinkDirectTemplateDownloader.java +++ b/core/src/main/java/org/apache/cloudstack/direct/download/MetalinkDirectTemplateDownloader.java @@ -72,10 +72,10 @@ public MetalinkDirectTemplateDownloader(String url, String destPoolPath, Long te metalinkUrls = downloader.getMetalinkUrls(url); metalinkChecksums = downloader.getMetalinkChecksums(url); if (CollectionUtils.isEmpty(metalinkUrls)) { - logger.error(String.format("No urls found on metalink file: %s. Not possible to download template %s ", url, templateId)); + logger.error(String.format("No URLs found on metalink file: %s. Not possible to download Template %s ", url, templateId)); } else { setUrl(metalinkUrls.get(0)); - logger.info("Metalink downloader created, metalink url: " + url + " parsed - " + + logger.info("Metalink downloader created, metalink URL: " + url + " parsed - " + metalinkUrls.size() + " urls and " + (CollectionUtils.isNotEmpty(metalinkChecksums) ? metalinkChecksums.size() : "0") + " checksums found"); } @@ -93,11 +93,11 @@ public Pair downloadTemplate() { if (!isRedownload()) { setUrl(metalinkUrls.get(i)); } - logger.info("Trying to download template from url: " + getUrl()); + logger.info("Trying to download Template from URL: " + getUrl()); DirectTemplateDownloader urlDownloader = createDownloaderForMetalinks(getUrl(), getTemplateId(), getDestPoolPath(), getChecksum(), headers, connectTimeout, soTimeout, null, temporaryDownloadPath); try { - setDownloadedFilePath(downloadDir + File.separator + getFileNameFromUrl()); + setDownloadedFilePath(downloadDir + File.separator + getTemporaryFileName()); File f = new File(getDownloadedFilePath()); if (f.exists()) { f.delete(); @@ -106,10 +106,10 @@ public Pair downloadTemplate() { Pair downloadResult = urlDownloader.downloadTemplate(); downloaded = downloadResult.first(); if (downloaded) { - logger.info("Successfully downloaded template from url: " + getUrl()); + logger.info("Successfully downloaded Template from URL: " + getUrl()); } } catch (Exception e) { - logger.error(String.format("Error downloading template: %s from URL: %s due to: %s", getTemplateId(), getUrl(), e.getMessage()), e); + logger.error(String.format("Error downloading Template: %s from URL: %s due to: %s", getTemplateId(), getUrl(), e.getMessage()), e); } i++; } diff --git a/core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java b/core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java index 21184ef07fe9..6b0959b78ffb 100644 --- a/core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java +++ b/core/src/main/java/org/apache/cloudstack/direct/download/NfsDirectTemplateDownloader.java @@ -69,7 +69,7 @@ public Pair downloadTemplate() { String mount = String.format(mountCommand, srcHost + ":" + srcPath, "/mnt/" + mountSrcUuid); Script.runSimpleBashScript(mount); String downloadDir = getDestPoolPath() + File.separator + getDirectDownloadTempPath(getTemplateId()); - setDownloadedFilePath(downloadDir + File.separator + getFileNameFromUrl()); + setDownloadedFilePath(downloadDir + File.separator + getTemporaryFileName()); Script.runSimpleBashScript("cp /mnt/" + mountSrcUuid + srcPath + " " + getDownloadedFilePath()); Script.runSimpleBashScript("umount /mnt/" + mountSrcUuid); return new Pair<>(true, getDownloadedFilePath()); diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplainceCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplianceCommand.java similarity index 93% rename from core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplainceCommand.java rename to core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplianceCommand.java index f9544b873ef2..4544e98451f3 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplainceCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/CheckDataStoreStoragePolicyComplianceCommand.java @@ -21,12 +21,12 @@ import com.cloud.agent.api.to.StorageFilerTO; -public class CheckDataStoreStoragePolicyComplainceCommand extends StorageSubSystemCommand { +public class CheckDataStoreStoragePolicyComplianceCommand extends StorageSubSystemCommand { String storagePolicyId; private StorageFilerTO storagePool; - public CheckDataStoreStoragePolicyComplainceCommand(String storagePolicyId, StorageFilerTO storagePool) { + public CheckDataStoreStoragePolicyComplianceCommand(String storagePolicyId, StorageFilerTO storagePool) { super(); this.storagePolicyId = storagePolicyId; diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/CopyCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/CopyCommand.java index aac082a01333..36550420909b 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/CopyCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/CopyCommand.java @@ -93,4 +93,9 @@ public Map getOptions2() { public void setExecuteInSequence(final boolean inSeq) { executeInSequence = inSeq; } + + @Override + public boolean isReconcile() { + return true; + } } diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java index 3ac83031eaf5..98db75f39025 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/TemplateOrVolumePostUploadCommand.java @@ -19,6 +19,9 @@ package org.apache.cloudstack.storage.command; +import com.cloud.configuration.Resource; +import org.apache.cloudstack.utils.bytescale.ByteScaleUtils; + public class TemplateOrVolumePostUploadCommand { long entityId; @@ -57,8 +60,10 @@ public class TemplateOrVolumePostUploadCommand { private String nfsVersion; - public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo, - String dataToRole) { + private long zoneId; + + public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, + String type, String name, String imageFormat, String dataTo, String dataToRole, long zoneId) { this.entityId = entityId; this.entityUUID = entityUUID; this.absolutePath = absolutePath; @@ -68,9 +73,7 @@ public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, Strin this.imageFormat = imageFormat; this.dataTo = dataTo; this.dataToRole = dataToRole; - } - - public TemplateOrVolumePostUploadCommand() { + this.zoneId = zoneId; } public String getRemoteEndPoint() { @@ -185,6 +188,11 @@ public void setDescription(String description) { this.description = description; } + public void setDefaultMaxSecondaryStorageInBytes(long defaultMaxSecondaryStorageInBytes) { + this.defaultMaxSecondaryStorageInGB = defaultMaxSecondaryStorageInBytes != Resource.RESOURCE_UNLIMITED ? + ByteScaleUtils.bytesToGibibytes(defaultMaxSecondaryStorageInBytes) : Resource.RESOURCE_UNLIMITED; + } + public void setDefaultMaxSecondaryStorageInGB(long defaultMaxSecondaryStorageInGB) { this.defaultMaxSecondaryStorageInGB = defaultMaxSecondaryStorageInGB; } @@ -216,4 +224,8 @@ public void setProcessTimeout(long processTimeout) { public long getProcessTimeout() { return processTimeout; } + + public long getZoneId() { + return zoneId; + } } diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/UploadStatusCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/UploadStatusCommand.java index 9e6b76e467ff..f78744046f73 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/UploadStatusCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/UploadStatusCommand.java @@ -28,6 +28,7 @@ public enum EntityType { } private String entityUuid; private EntityType entityType; + private Boolean abort; protected UploadStatusCommand() { } @@ -37,6 +38,11 @@ public UploadStatusCommand(String entityUuid, EntityType entityType) { this.entityType = entityType; } + public UploadStatusCommand(String entityUuid, EntityType entityType, Boolean abort) { + this(entityUuid, entityType); + this.abort = abort; + } + public String getEntityUuid() { return entityUuid; } @@ -45,6 +51,10 @@ public EntityType getEntityType() { return entityType; } + public Boolean getAbort() { + return abort; + } + @Override public boolean executeInSequence() { return false; diff --git a/core/src/main/java/org/apache/cloudstack/storage/to/SnapshotObjectTO.java b/core/src/main/java/org/apache/cloudstack/storage/to/SnapshotObjectTO.java index 76b93909b8c1..7643f80bbaac 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/to/SnapshotObjectTO.java +++ b/core/src/main/java/org/apache/cloudstack/storage/to/SnapshotObjectTO.java @@ -35,18 +35,25 @@ public class SnapshotObjectTO extends DownloadableObjectTO implements DataTO { private VolumeObjectTO volume; private String parentSnapshotPath; private DataStoreTO dataStore; + private DataStoreTO imageStore; + private boolean kvmIncrementalSnapshot = false; private String vmName; private String name; private HypervisorType hypervisorType; private long id; private boolean quiescevm; private String[] parents; + private DataStoreTO parentStore; + private String checkpointPath; private Long physicalSize = (long) 0; private long accountId; - public SnapshotObjectTO() { + } + @Override + public DataObjectType getObjectType() { + return DataObjectType.SNAPSHOT; } public SnapshotObjectTO(SnapshotInfo snapshot) { @@ -59,27 +66,28 @@ public SnapshotObjectTO(SnapshotInfo snapshot) { this.setVmName(vol.getAttachedVmName()); } - SnapshotInfo parentSnapshot = snapshot.getParent(); - ArrayList parentsArry = new ArrayList(); - if (parentSnapshot != null) { - this.parentSnapshotPath = parentSnapshot.getPath(); - while(parentSnapshot != null) { - parentsArry.add(parentSnapshot.getPath()); - parentSnapshot = parentSnapshot.getParent(); - } - parents = parentsArry.toArray(new String[parentsArry.size()]); - ArrayUtils.reverse(parents); - } - this.dataStore = snapshot.getDataStore().getTO(); this.setName(snapshot.getName()); this.hypervisorType = snapshot.getHypervisorType(); this.quiescevm = false; - } - @Override - public DataObjectType getObjectType() { - return DataObjectType.SNAPSHOT; + this.checkpointPath = snapshot.getCheckpointPath(); + this.kvmIncrementalSnapshot = snapshot.isKvmIncrementalSnapshot(); + + SnapshotInfo parentSnapshot = snapshot.getParent(); + + if (parentSnapshot == null || (HypervisorType.KVM.equals(snapshot.getHypervisorType()) && !parentSnapshot.isKvmIncrementalSnapshot())) { + return; + } + + ArrayList parentsArray = new ArrayList<>(); + this.parentSnapshotPath = parentSnapshot.getPath(); + while (parentSnapshot != null) { + parentsArray.add(parentSnapshot.getPath()); + parentSnapshot = parentSnapshot.getParent(); + } + parents = parentsArray.toArray(new String[parentsArray.size()]); + ArrayUtils.reverse(parents); } @Override @@ -91,6 +99,30 @@ public void setDataStore(DataStoreTO store) { this.dataStore = store; } + public DataStoreTO getImageStore() { + return imageStore; + } + + public void setImageStore(DataStoreTO imageStore) { + this.imageStore = imageStore; + } + + public boolean isKvmIncrementalSnapshot() { + return kvmIncrementalSnapshot; + } + + public void setKvmIncrementalSnapshot(boolean kvmIncrementalSnapshot) { + this.kvmIncrementalSnapshot = kvmIncrementalSnapshot; + } + + public String getCheckpointPath() { + return checkpointPath; + } + + public void setCheckpointPath(String checkpointPath) { + this.checkpointPath = checkpointPath; + } + @Override public String getPath() { return this.path; @@ -178,6 +210,14 @@ public void setAccountId(long accountId) { this.accountId = accountId; } + public DataStoreTO getParentStore() { + return parentStore; + } + + public void setParentStore(DataStoreTO parentStore) { + this.parentStore = parentStore; + } + @Override public String toString() { return new StringBuilder("SnapshotTO[datastore=").append(dataStore).append("|volume=").append(volume).append("|path").append(path).append("]").toString(); diff --git a/core/src/main/java/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/core/src/main/java/org/apache/cloudstack/storage/to/VolumeObjectTO.java index 4d1d0bf90971..827403ac5ef8 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/to/VolumeObjectTO.java +++ b/core/src/main/java/org/apache/cloudstack/storage/to/VolumeObjectTO.java @@ -33,6 +33,8 @@ import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import java.util.Arrays; +import java.util.List; +import java.util.Set; public class VolumeObjectTO extends DownloadableObjectTO implements DataTO { private String uuid; @@ -76,6 +78,8 @@ public class VolumeObjectTO extends DownloadableObjectTO implements DataTO { @LogLevel(LogLevel.Log4jLevel.Off) private byte[] passphrase; private String encryptFormat; + private List checkpointPaths; + private Set checkpointImageStoreUrls; public VolumeObjectTO() { @@ -112,8 +116,8 @@ public VolumeObjectTO(VolumeInfo volume) { iopsWriteRate = volume.getIopsWriteRate(); iopsWriteRateMax = volume.getIopsWriteRateMax(); iopsWriteRateMaxLength = volume.getIopsWriteRateMaxLength(); - cacheMode = volume.getCacheMode(); hypervisorType = volume.getHypervisorType(); + setCacheMode(volume.getCacheMode()); setDeviceId(volume.getDeviceId()); this.migrationOptions = volume.getMigrationOptions(); this.directDownload = volume.isDirectDownload(); @@ -122,6 +126,8 @@ public VolumeObjectTO(VolumeInfo volume) { this.passphrase = volume.getPassphrase(); this.encryptFormat = volume.getEncryptFormat(); this.followRedirects = volume.isFollowRedirects(); + this.checkpointPaths = volume.getCheckpointPaths(); + this.checkpointImageStoreUrls = volume.getCheckpointImageStoreUrls(); } public String getUuid() { @@ -337,6 +343,10 @@ public void setDeviceId(Long deviceId) { } public void setCacheMode(DiskCacheMode cacheMode) { + if (DiskCacheMode.HYPERVISOR_DEFAULT.equals(cacheMode) && !Hypervisor.HypervisorType.KVM.equals(hypervisorType)) { + this.cacheMode = DiskCacheMode.NONE; + return; + } this.cacheMode = cacheMode; } @@ -397,4 +407,21 @@ public void clearPassphrase() { public boolean requiresEncryption() { return passphrase != null && passphrase.length > 0; } + + + public List getCheckpointPaths() { + return checkpointPaths; + } + + public void setCheckpointPaths(List checkpointPaths) { + this.checkpointPaths = checkpointPaths; + } + + public Set getCheckpointImageStoreUrls() { + return checkpointImageStoreUrls; + } + + public void setCheckpointImageStoreUrls(Set checkpointImageStoreUrls) { + this.checkpointImageStoreUrls = checkpointImageStoreUrls; + } } diff --git a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/ConfigHelperTest.java b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/ConfigHelperTest.java index 042bec9d2168..4ddadab999a4 100644 --- a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/ConfigHelperTest.java +++ b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/ConfigHelperTest.java @@ -57,6 +57,7 @@ import com.cloud.agent.resource.virtualnetwork.model.LoadBalancerRule; import com.cloud.agent.resource.virtualnetwork.model.LoadBalancerRules; import com.cloud.network.lb.LoadBalancingRule.LbDestination; +import com.cloud.network.lb.LoadBalancingRule.LbSslCert; import com.cloud.network.Networks.TrafficType; public class ConfigHelperTest { @@ -223,15 +224,18 @@ public void testDeleteIpAlias() { protected LoadBalancerConfigCommand generateLoadBalancerConfigCommand() { final List lbs = new ArrayList<>(); final List dests = new ArrayList<>(); + final LbSslCert lbSslCert = new LbSslCert("cert", "key", "password", "chain", "fingerprint", false); dests.add(new LbDestination(80, 8080, "10.1.10.2", false)); dests.add(new LbDestination(80, 8080, "10.1.10.2", true)); - lbs.add(new LoadBalancerTO(UUID.randomUUID().toString(), "64.10.1.10", 80, "tcp", "algo", false, false, false, dests)); + LoadBalancerTO loadBalancerTO = new LoadBalancerTO(UUID.randomUUID().toString(), "64.10.1.10", 80, "tcp", "algo", false, false, false, dests); + loadBalancerTO.setLbSslCert(lbSslCert); + lbs.add(loadBalancerTO); final LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()]; lbs.toArray(arrayLbs); final NicTO nic = new NicTO(); - final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false); + final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false, 0L); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2"); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME); diff --git a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java index 201242564ba6..ed819bb7c68f 100644 --- a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java +++ b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java @@ -417,8 +417,6 @@ private void verifyArgs(final SetNetworkACLCommand cmd, final String script, fin // FIXME Check the json content assertEquals(VRScripts.UPDATE_CONFIG, script); assertEquals(VRScripts.NETWORK_ACL_CONFIG, args); - // assertEquals(args, " -d eth3 -M 01:23:45:67:89:AB -i 192.168.1.1 -m 24 -a Egress:ALL:0:0:192.168.0.1/24-192.168.0.2/24:ACCEPT:," + - // "Ingress:ICMP:0:0:192.168.0.1/24-192.168.0.2/24:DROP:,Ingress:TCP:20:80:192.168.0.1/24-192.168.0.2/24:ACCEPT:,"); break; case 2: assertEquals(VRScripts.UPDATE_CONFIG, script); @@ -464,8 +462,6 @@ protected SetupGuestNetworkCommand generateSetupGuestNetworkCommand() { private void verifyArgs(final SetupGuestNetworkCommand cmd, final String script, final String args) { // TODO Check the contents of the json file - //assertEquals(script, VRScripts.VPC_GUEST_NETWORK); - //assertEquals(args, " -C -M 01:23:45:67:89:AB -d eth4 -i 10.1.1.2 -g 10.1.1.1 -m 24 -n 10.1.1.0 -s 8.8.8.8,8.8.4.4 -e cloud.test"); } @Test @@ -783,7 +779,7 @@ protected LoadBalancerConfigCommand generateLoadBalancerConfigCommand1() { final LoadBalancerTO[] arrayLbs = new LoadBalancerTO[lbs.size()]; lbs.toArray(arrayLbs); final NicTO nic = new NicTO(); - final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false); + final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, null, "1000", false, 50000L); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2"); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME); return cmd; @@ -799,7 +795,7 @@ protected LoadBalancerConfigCommand generateLoadBalancerConfigCommand2() { lbs.toArray(arrayLbs); final NicTO nic = new NicTO(); nic.setIp("10.1.10.2"); - final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, Long.valueOf(1), "1000", false); + final LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(arrayLbs, "64.10.2.10", "10.1.10.2", "192.168.1.2", nic, Long.valueOf(1), "1000", false, 50000L); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, "10.1.10.2"); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, ROUTERNAME); return cmd; diff --git a/core/src/test/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRuleTest.java b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRuleTest.java new file mode 100644 index 000000000000..f2b25a5f78ec --- /dev/null +++ b/core/src/test/java/com/cloud/agent/resource/virtualnetwork/model/LoadBalancerRuleTest.java @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.resource.virtualnetwork.model; + +import org.junit.Assert; +import org.junit.Test; + +public class LoadBalancerRuleTest { + + @Test + public void testSslCertEntry() { + String name = "name"; + String cert = "cert"; + String key = "key1"; + String chain = "chain"; + String password = "password"; + LoadBalancerRule.SslCertEntry sslCertEntry = new LoadBalancerRule.SslCertEntry(name, cert, key, chain, password); + + Assert.assertEquals(name, sslCertEntry.getName()); + Assert.assertEquals(cert, sslCertEntry.getCert()); + Assert.assertEquals(key, sslCertEntry.getKey()); + Assert.assertEquals(chain, sslCertEntry.getChain()); + Assert.assertEquals(password, sslCertEntry.getPassword()); + + String name2 = "name2"; + String cert2 = "cert2"; + String key2 = "key2"; + String chain2 = "chain2"; + String password2 = "password2"; + + sslCertEntry.setName(name2); + sslCertEntry.setCert(cert2); + sslCertEntry.setKey(key2); + sslCertEntry.setChain(chain2); + sslCertEntry.setPassword(password2); + + Assert.assertEquals(name2, sslCertEntry.getName()); + Assert.assertEquals(cert2, sslCertEntry.getCert()); + Assert.assertEquals(key2, sslCertEntry.getKey()); + Assert.assertEquals(chain2, sslCertEntry.getChain()); + Assert.assertEquals(password2, sslCertEntry.getPassword()); + + LoadBalancerRule loadBalancerRule = new LoadBalancerRule(); + loadBalancerRule.setSslCerts(new LoadBalancerRule.SslCertEntry[]{sslCertEntry}); + + Assert.assertEquals(1, loadBalancerRule.getSslCerts().length); + Assert.assertEquals(sslCertEntry, loadBalancerRule.getSslCerts()[0]); + } +} diff --git a/core/src/test/java/com/cloud/agent/transport/ResponseTest.java b/core/src/test/java/com/cloud/agent/transport/ResponseTest.java new file mode 100644 index 000000000000..06869b42eb9d --- /dev/null +++ b/core/src/test/java/com/cloud/agent/transport/ResponseTest.java @@ -0,0 +1,46 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.transport; + +import junit.framework.TestCase; + +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.junit.Assert; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.CheckS2SVpnConnectionsAnswer; + +import com.cloud.agent.transport.Request.Version; + +public class ResponseTest extends TestCase { + protected Logger logger = LogManager.getLogger(getClass()); + + public void testCheckS2SVpnConnectionsAnswer() { + logger.info("Testing CheckS2SVpnConnectionsAnswer"); + String content = "[{\"com.cloud.agent.api.CheckS2SVpnConnectionsAnswer\":{\"ipToConnected\":{\"10.0.53.13\":true}," + + "\"ipToDetail\":{\"10.0.53.13\":\"IPsec SA found;Site-to-site VPN have connected\"}," + + "\"details\":\"10.0.53.13:0:IPsec SA found;Site-to-site VPN have connected\\u0026\\n\"," + + "\"result\":true,\"contextMap\":{},\"wait\":0,\"bypassHostMaintenance\":false}}]"; + Response response = new Response(Version.v2, 1L, 2L, 3L, 1L, (short)1, content); + Answer answer = response.getAnswer(); + Assert.assertTrue(answer instanceof CheckS2SVpnConnectionsAnswer); + } + +} diff --git a/core/src/test/java/com/cloud/network/HAProxyConfiguratorTest.java b/core/src/test/java/com/cloud/network/HAProxyConfiguratorTest.java index 2a282cbeca8b..073f976719b5 100644 --- a/core/src/test/java/com/cloud/network/HAProxyConfiguratorTest.java +++ b/core/src/test/java/com/cloud/network/HAProxyConfiguratorTest.java @@ -31,6 +31,7 @@ import com.cloud.agent.api.routing.LoadBalancerConfigCommand; import com.cloud.agent.api.to.LoadBalancerTO; import com.cloud.network.lb.LoadBalancingRule.LbDestination; +import com.cloud.network.lb.LoadBalancingRule.LbSslCert; import java.util.List; import java.util.ArrayList; @@ -78,13 +79,14 @@ public void testGenerateConfigurationLoadBalancerConfigCommand() { LoadBalancerTO[] lba = new LoadBalancerTO[1]; lba[0] = lb; HAProxyConfigurator hpg = new HAProxyConfigurator(); - LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false, 0L); String result = genConfig(hpg, cmd); - assertTrue("keepalive disabled should result in 'mode http' in the resulting haproxy config", result.contains("mode http")); + assertTrue("keepalive disabled should result in 'option httpclose' in the resulting haproxy config", result.contains("\toption httpclose")); - cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true); + cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true, 0L); result = genConfig(hpg, cmd); - assertTrue("keepalive enabled should not result in 'mode http' in the resulting haproxy config", !result.contains("mode http")); + assertTrue("keepalive enabled should result in 'no option httpclose' in the resulting haproxy config", result.contains("\tno option httpclose")); + // TODO // create lb command // setup tests for @@ -92,6 +94,27 @@ public void testGenerateConfigurationLoadBalancerConfigCommand() { // httpmode } + /** + * Test method for {@link com.cloud.network.HAProxyConfigurator#generateConfiguration(com.cloud.agent.api.routing.LoadBalancerConfigCommand)}. + */ + @Test + public void testGenerateConfigurationLoadBalancerIdleTimeoutConfigCommand() { + LoadBalancerTO lb = new LoadBalancerTO("1", "10.2.0.1", 80, "http", "bla", false, false, false, null); + LoadBalancerTO[] lba = new LoadBalancerTO[1]; + lba[0] = lb; + HAProxyConfigurator hpg = new HAProxyConfigurator(); + + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true, 0L); + String result = genConfig(hpg, cmd); + assertTrue("idleTimeout of 0 should not generate 'timeout server' in the resulting haproxy config", !result.contains("\ttimeout server")); + assertTrue("idleTimeout of 0 should not generate 'timeout client' in the resulting haproxy config", !result.contains("\ttimeout client")); + + cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "4", true, 1234L); + result = genConfig(hpg, cmd); + assertTrue("idleTimeout of 1234 should result in 'timeout server 1234' in the resulting haproxy config", result.contains("\ttimeout server 1234")); + assertTrue("idleTimeout of 1234 should result in 'timeout client 1234' in the resulting haproxy config", result.contains("\ttimeout client 1234")); + } + /** * Test method for {@link com.cloud.network.HAProxyConfigurator#generateConfiguration(com.cloud.agent.api.routing.LoadBalancerConfigCommand)}. */ @@ -105,7 +128,7 @@ public void testGenerateConfigurationLoadBalancerProxyProtocolConfigCommand() { LoadBalancerTO[] lba = new LoadBalancerTO[1]; lba[0] = lb; HAProxyConfigurator hpg = new HAProxyConfigurator(); - LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false, 0L); String result = genConfig(hpg, cmd); assertTrue("'send-proxy' should result if protocol is 'tcp-proxy'", result.contains("send-proxy")); } @@ -117,11 +140,24 @@ public void generateConfigurationTestWithCidrList() { LoadBalancerTO[] lba = new LoadBalancerTO[1]; lba[0] = lb; HAProxyConfigurator hpg = new HAProxyConfigurator(); - LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false, 0L); String result = genConfig(hpg, cmd); Assert.assertTrue(result.contains("acl network_allowed src 1.1.1.1 2.2.2.2/24 \n\ttcp-request connection reject if !network_allowed")); } + @Test + public void generateConfigurationTestWithSslCert() { + LoadBalancerTO lb = new LoadBalancerTO("1", "10.2.0.1", 443, "ssl", "roundrobin", false, false, false, null); + final LbSslCert lbSslCert = new LbSslCert("cert", "key", "password", "chain", "fingerprint", false); + lb.setLbSslCert(lbSslCert); + LoadBalancerTO[] lba = new LoadBalancerTO[1]; + lba[0] = lb; + HAProxyConfigurator hpg = new HAProxyConfigurator(); + LoadBalancerConfigCommand cmd = new LoadBalancerConfigCommand(lba, "10.0.0.1", "10.1.0.1", "10.1.1.1", null, 1L, "12", false, 0L); + String result = genConfig(hpg, cmd); + Assert.assertTrue(result.contains("bind 10.2.0.1:443 ssl crt /etc/cloudstack/ssl/10_2_0_1-443.pem")); + } + private String genConfig(HAProxyConfigurator hpg, LoadBalancerConfigCommand cmd) { String[] sa = hpg.generateConfiguration(cmd); StringBuilder sb = new StringBuilder(); diff --git a/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckGuestOsMappingCommandTest.java b/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckGuestOsMappingCommandTest.java index 3f68422d5026..f021009cec0e 100644 --- a/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckGuestOsMappingCommandTest.java +++ b/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckGuestOsMappingCommandTest.java @@ -25,8 +25,6 @@ import com.cloud.agent.api.CheckGuestOsMappingCommand; import org.junit.Test; -import com.cloud.agent.api.AgentControlCommand; - public class CheckGuestOsMappingCommandTest { @Test diff --git a/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java b/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java index be7563be045a..a696049608e5 100644 --- a/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java +++ b/core/src/test/java/org/apache/cloudstack/api/agent/test/CheckOnHostCommandTest.java @@ -284,6 +284,11 @@ public ResourceState getResourceState() { public CPU.CPUArch getArch() { return CPU.CPUArch.amd64; } + + @Override + public String getStorageAccessGroups() { + return null; + } }; CheckOnHostCommand cohc = new CheckOnHostCommand(host); diff --git a/core/src/test/java/org/apache/cloudstack/command/ReconcileCommandUtilsTest.java b/core/src/test/java/org/apache/cloudstack/command/ReconcileCommandUtilsTest.java new file mode 100644 index 000000000000..f69ada58e1a4 --- /dev/null +++ b/core/src/test/java/org/apache/cloudstack/command/ReconcileCommandUtilsTest.java @@ -0,0 +1,69 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import com.cloud.agent.api.Command; +import com.cloud.agent.api.MigrateCommand; +import com.cloud.agent.api.to.VirtualMachineTO; + +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; + +import java.io.File; + +public class ReconcileCommandUtilsTest { + + final static String COMMANDS_LOG_PATH = "/tmp"; + + @Test + public void createAndReadAndDeleteLogFilesForCommand() { + final String vmName = "TestVM"; + final String destIp = "DestinationHost"; + final VirtualMachineTO vmTO = Mockito.mock(VirtualMachineTO.class); + final MigrateCommand command = new MigrateCommand(vmName, destIp, false, vmTO, false); + long requestSequence = 10000L; + command.setRequestSequence(requestSequence); + + String logFile = ReconcileCommandUtils.getLogFileNameForCommand(COMMANDS_LOG_PATH, command); + + ReconcileCommandUtils.createLogFileForCommand(COMMANDS_LOG_PATH, command); + Assert.assertTrue((new File(logFile).exists())); + + CommandInfo commandInfo = ReconcileCommandUtils.readLogFileForCommand(logFile); + Assert.assertNotNull(commandInfo); + Assert.assertEquals(command.getClass().getName(), commandInfo.getCommandName()); + Assert.assertEquals(Command.State.CREATED, commandInfo.getState()); + + Command parseCommand = ReconcileCommandUtils.parseCommandInfo(commandInfo); + System.out.println("command state is " + commandInfo); + Assert.assertNotNull(parseCommand); + Assert.assertTrue(parseCommand instanceof MigrateCommand); + Assert.assertEquals(vmName,((MigrateCommand) parseCommand).getVmName()); + Assert.assertEquals(destIp,((MigrateCommand) parseCommand).getDestinationIp()); + + ReconcileCommandUtils.updateLogFileForCommand(COMMANDS_LOG_PATH, command, Command.State.PROCESSING); + CommandInfo newCommandInfo = ReconcileCommandUtils.readLogFileForCommand(logFile); + System.out.println("new command state is " + newCommandInfo); + Assert.assertNotNull(newCommandInfo); + Assert.assertEquals(command.getClass().getName(), newCommandInfo.getCommandName()); + Assert.assertEquals(Command.State.PROCESSING, newCommandInfo.getState()); + + ReconcileCommandUtils.deleteLogFileForCommand(COMMANDS_LOG_PATH, command); + Assert.assertFalse((new File(logFile).exists())); + } +} diff --git a/debian/changelog b/debian/changelog index d17676ef2686..41f97748a0b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +cloudstack (4.23.0.0-SNAPSHOT) unstable; urgency=low + + * Update the version to 4.23.0.0-SNAPSHOT + + -- the Apache CloudStack project Fri, 22 May 2026 10:20:00 -0300 + +cloudstack (4.22.1.0) unstable; urgency=low + + * Update the version to 4.22.1.0 + + -- the Apache CloudStack project Mon, 11 May 2026 20:26:07 +0530 + +cloudstack (4.22.0.0) unstable; urgency=low + + * Update the version to 4.22.0.0 + + -- the Apache CloudStack project Thu, 30 Oct 2025 19:23:55 +0530 + +cloudstack (4.21.0.0) unstable; urgency=low + + * Update the version to 4.21.0.0 + + -- the Apache CloudStack project Fri, 22 Aug 2025 11:42:37 +0530 + cloudstack (4.21.0.0-SNAPSHOT) unstable; urgency=low * Update the version to 4.21.0.0-SNAPSHOT @@ -196,7 +220,7 @@ cloud (4.0.0-rc2) unstable; urgency=low * Bumping the version to 4.0 RC2 -- Wido den Hollander Mon, 24 Sep 2012 11:30:29 +0200 - + cloud (4.0.0-rc1) unstable; urgency=low * Bumping the version to 4.0 RC1 diff --git a/debian/cloudstack-agent.install b/debian/cloudstack-agent.install index 58715e0746ba..0b9e874cb423 100644 --- a/debian/cloudstack-agent.install +++ b/debian/cloudstack-agent.install @@ -16,6 +16,7 @@ # under the License. /etc/cloudstack/agent/agent.properties +/etc/cloudstack/agent/uefi.properties /etc/cloudstack/agent/environment.properties /etc/cloudstack/agent/log4j-cloud.xml /etc/default/cloudstack-agent diff --git a/debian/cloudstack-agent.postinst b/debian/cloudstack-agent.postinst index 758af6e068ff..cd070c2f7853 100755 --- a/debian/cloudstack-agent.postinst +++ b/debian/cloudstack-agent.postinst @@ -23,7 +23,7 @@ case "$1" in configure) OLDCONFDIR="/etc/cloud/agent" NEWCONFDIR="/etc/cloudstack/agent" - CONFFILES="agent.properties log4j.xml log4j-cloud.xml" + CONFFILES="agent.properties uefi.properties log4j.xml log4j-cloud.xml" mkdir -m 0755 -p /usr/share/cloudstack-agent/tmp diff --git a/debian/cloudstack-common.install b/debian/cloudstack-common.install index 08f56d4f117f..51fc5bf2a661 100644 --- a/debian/cloudstack-common.install +++ b/debian/cloudstack-common.install @@ -27,6 +27,7 @@ /usr/share/cloudstack-common/scripts/vm/hypervisor/versions.sh /usr/share/cloudstack-common/scripts/vm/hypervisor/vmware/* /usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/* +/usr/share/cloudstack-common/scripts/vm/hypervisor/external/provisioner/* /usr/share/cloudstack-common/lib/* /usr/share/cloudstack-common/vms/* /usr/bin/cloudstack-set-guest-password diff --git a/debian/cloudstack-management.install b/debian/cloudstack-management.install index 3d0d7e238149..befc7049c30e 100644 --- a/debian/cloudstack-management.install +++ b/debian/cloudstack-management.install @@ -22,6 +22,9 @@ /etc/cloudstack/management/java.security.ciphers /etc/cloudstack/management/log4j-cloud.xml /etc/cloudstack/management/config.json +/etc/cloudstack/extensions/Proxmox/proxmox.sh +/etc/cloudstack/extensions/HyperV/hyperv.py +/etc/cloudstack/extensions/MaaS/maas.py /etc/default/cloudstack-management /etc/security/limits.d/cloudstack-limits.conf /etc/sudoers.d/cloudstack diff --git a/debian/cloudstack-management.postinst b/debian/cloudstack-management.postinst index fadb7e57eca1..fde3ba96de0a 100755 --- a/debian/cloudstack-management.postinst +++ b/debian/cloudstack-management.postinst @@ -56,6 +56,11 @@ if [ "$1" = configure ]; then chmod 0640 ${CONFDIR}/${DBPROPS} chgrp cloud ${CONFDIR}/${DBPROPS} chown -R cloud:cloud /var/log/cloudstack/management + chown -R cloud:cloud /usr/share/cloudstack-management/templates + find /usr/share/cloudstack-management/templates -type d -exec chmod 0770 {} \; + + chmod -R 0755 /etc/cloudstack/extensions + chown -R cloud:cloud /etc/cloudstack/extensions ln -sf ${CONFDIR}/log4j-cloud.xml ${CONFDIR}/log4j2.xml diff --git a/debian/control b/debian/control index 1292639ef304..cdf663ef8906 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: extra Maintainer: The Apache CloudStack Team Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage, python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3, maven (>= 3) | maven3, - python (>= 2.7) | python2 (>= 2.7), python3 (>= 3), python-setuptools, python3-setuptools, + python3 (>= 3), python3-setuptools, nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13) Standards-Version: 3.8.1 Homepage: http://www.cloudstack.org/ @@ -24,7 +24,7 @@ Description: CloudStack server library Package: cloudstack-agent Architecture: all -Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat +Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat, python3-libnbd, socat Recommends: init-system-helpers Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts Description: CloudStack agent diff --git a/debian/rules b/debian/rules index e7ff6759d446..842fc2408af7 100755 --- a/debian/rules +++ b/debian/rules @@ -4,7 +4,6 @@ VERSION := $(shell grep '' pom.xml | head -2 | tail -1 | cut -d'>' -f2 PACKAGE = $(shell dh_listpackages|head -n 1|cut -d '-' -f 1) SYSCONFDIR = "/etc" DESTDIR = "debian/tmp" -CMK_REL := $(shell wget -O - "https://api.github.com/repos/apache/cloudstack-cloudmonkey/releases" 2>/dev/null | jq -r '.[0].tag_name') %: dh $@ --with systemd @@ -64,12 +63,14 @@ override_dh_auto_install: # cloudstack-management mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management + mkdir -p $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/extensions mkdir -p $(DESTDIR)/$(SYSCONFDIR)/security/limits.d/ mkdir -p $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/ mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management/lib mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management/setup mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm + mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf mkdir $(DESTDIR)/var/log/$(PACKAGE)/management mkdir $(DESTDIR)/var/cache/$(PACKAGE)/management mkdir $(DESTDIR)/var/log/$(PACKAGE)/ipallocator @@ -80,13 +81,15 @@ override_dh_auto_install: cp -r client/target/classes/META-INF/webapp $(DESTDIR)/usr/share/$(PACKAGE)-management/webapp cp server/target/conf/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/ cp client/target/conf/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/management/ + cp -r extensions/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/extensions/ cp client/target/cloud-client-ui-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/cloudstack-$(VERSION).jar cp client/target/lib/*jar $(DESTDIR)/usr/share/$(PACKAGE)-management/lib/ cp -r engine/schema/dist/systemvm-templates/* $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/ - rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/md5sum.txt + cp -r plugins/integrations/kubernetes-service/src/main/resources/conf/* $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/ + rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/sha512sum.txt # Bundle cmk in cloudstack-management - wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/$(CMK_REL)/cmk.linux.x86-64 -O $(DESTDIR)/usr/bin/cmk + wget https://github.com/apache/cloudstack-cloudmonkey/releases/latest/download/cmk.linux.x86-64 -O $(DESTDIR)/usr/bin/cmk chmod +x $(DESTDIR)/usr/bin/cmk # nast hack for a couple of configuration files @@ -95,9 +98,16 @@ override_dh_auto_install: chmod 0440 $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/$(PACKAGE) install -D client/target/utilities/bin/cloud-update-xenserver-licenses $(DESTDIR)/usr/bin/cloudstack-update-xenserver-licenses + + install -D plugins/integrations/kubernetes-service/src/main/resources/conf/etcd-node.yml $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/etcd-node.yml + install -D plugins/integrations/kubernetes-service/src/main/resources/conf/k8s-control-node.yml $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/k8s-control-node.yml + install -D plugins/integrations/kubernetes-service/src/main/resources/conf/k8s-control-node-add.yml $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/k8s-control-node-add.yml + install -D plugins/integrations/kubernetes-service/src/main/resources/conf/k8s-node.yml $(DESTDIR)/usr/share/$(PACKAGE)-management/cks/conf/k8s-node.yml + # Remove configuration in /ur/share/cloudstack-management/webapps/client/WEB-INF # This should all be in /etc/cloudstack/management ln -s ../../..$(SYSCONFDIR)/$(PACKAGE)/management $(DESTDIR)/usr/share/$(PACKAGE)-management/conf + ln -s ../../..$(SYSCONFDIR)/$(PACKAGE)/extensions $(DESTDIR)/usr/share/$(PACKAGE)-management/extensions ln -s ../../../var/log/$(PACKAGE)/management $(DESTDIR)/usr/share/$(PACKAGE)-management/logs install -d -m0755 debian/$(PACKAGE)-management/lib/systemd/system diff --git a/deps/install-non-oss.sh b/deps/install-non-oss.sh index 56cfc2cba9cc..e40946ce312c 100755 --- a/deps/install-non-oss.sh +++ b/deps/install-non-oss.sh @@ -85,4 +85,7 @@ mvn install:install-file -Dfile=juniper-contrail-api-1.0-SNAPSHOT.jar -DgroupId= # From https://github.com/radu-todirica/tungsten-api/raw/master/net/juniper/tungsten/juniper-tungsten-api/2.0/juniper-tungsten-api-2.0.jar mvn install:install-file -Dfile=juniper-tungsten-api-2.0.jar -DgroupId=net.juniper.tungsten -DartifactId=juniper-tungsten-api -Dversion=2.0 -Dpackaging=jar +# Netris Integration +mvn install:install-file -Dfile=netris-java-sdk-1.0.0.jar -DgroupId=io.netris -DartifactId=netris-java-sdk -Dversion=1.0.0 -Dpackaging=jar + exit 0 diff --git a/developer/pom.xml b/developer/pom.xml index c573c03d0086..0a0979ee0379 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT @@ -66,7 +66,7 @@ org.codehaus.mojo properties-maven-plugin - 1.0-alpha-2 + 1.2.1 initialize diff --git a/engine/api/pom.xml b/engine/api/pom.xml index 25aaa1365dfc..cb50ef0cd46b 100644 --- a/engine/api/pom.xml +++ b/engine/api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/engine/api/src/main/java/com/cloud/vm/VirtualMachineGuru.java b/engine/api/src/main/java/com/cloud/vm/VirtualMachineGuru.java index f8032bf4b0e7..76f0830f369e 100644 --- a/engine/api/src/main/java/com/cloud/vm/VirtualMachineGuru.java +++ b/engine/api/src/main/java/com/cloud/vm/VirtualMachineGuru.java @@ -24,6 +24,7 @@ import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.ca.CAManager; import org.apache.cloudstack.framework.ca.Certificate; +import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.utils.security.CertUtils; import org.apache.cloudstack.utils.security.KeyStoreUtils; @@ -37,6 +38,9 @@ */ public interface VirtualMachineGuru { + static final ConfigKey NTPServerConfig = new ConfigKey(String.class, "ntp.server.list", "Advanced", null, + "Comma separated list of NTP servers to configure in System VMs", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null); + boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context); /** diff --git a/engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java index 94c73d8f4d60..5eca02f33d51 100644 --- a/engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java +++ b/engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.vm; +import com.cloud.storage.Snapshot; +import com.cloud.storage.Volume; import java.net.URI; import java.util.HashMap; import java.util.LinkedHashMap; @@ -57,6 +59,8 @@ */ public interface VirtualMachineManager extends Manager { + String KVM_BLANK_VM_TEMPLATE_NAME = "kvm-blank-vm-template"; + ConfigKey ExecuteInSequence = new ConfigKey<>("Advanced", Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, start, stop, reboot, copy and migrate commands will be serialized on the agent side. If set to false the commands are executed in parallel. Default value is false.", false); @@ -104,6 +108,9 @@ public interface VirtualMachineManager extends Manager { ConfigKey VmSyncPowerStateTransitioning = new ConfigKey<>("Advanced", Boolean.class, "vm.sync.power.state.transitioning", "true", "Whether to sync power states of the transitioning and stalled VMs while processing VM power reports.", false); + ConfigKey SystemVmEnableUserData = new ConfigKey<>(Boolean.class, "systemvm.userdata.enabled", "Advanced", "false", + "Enable user data for system VMs. When enabled, the CPVM, SSVM, and Router system VMs will use the values from the global settings console.proxy.vm.userdata, secstorage.vm.userdata, and virtual.router.userdata, respectively, to provide cloud-init user data to the VM.", + true, ConfigKey.Scope.Zone, null); interface Topics { String VM_POWER_STATE = "vm.powerstate"; @@ -122,6 +129,7 @@ interface Topics { * @param defaultNetwork The default network for the VM. * @param rootDiskOffering For created VMs not based on templates, root disk offering specifies the root disk. * @param dataDiskOfferings Data disks to attach to the VM. + * @param dataDiskDeviceIds Device Ids to assign the data disks to. * @param auxiliaryNetworks additional networks to attach the VMs to. * @param plan How to deploy the VM. * @param hyperType Hypervisor type @@ -129,11 +137,11 @@ interface Topics { * @throws InsufficientCapacityException If there are insufficient capacity to deploy this vm. */ void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, DiskOfferingInfo rootDiskOfferingInfo, - List dataDiskOfferings, LinkedHashMap> auxiliaryNetworks, DeploymentPlan plan, - HypervisorType hyperType, Map> extraDhcpOptions, Map datadiskTemplateToDiskOfferingMap) throws InsufficientCapacityException; + List dataDiskOfferings, List dataDiskDeviceIds, LinkedHashMap> auxiliaryNetworks, DeploymentPlan plan, + HypervisorType hyperType, Map> extraDhcpOptions, Map datadiskTemplateToDiskOfferingMap, Volume volume, Snapshot snapshot) throws InsufficientCapacityException; void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, - LinkedHashMap> networkProfiles, DeploymentPlan plan, HypervisorType hyperType) throws InsufficientCapacityException; + LinkedHashMap> networkProfiles, DeploymentPlan plan, HypervisorType hyperType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException; void start(String vmUuid, Map params); @@ -175,15 +183,6 @@ void orchestrateStart(String vmUuid, Map pa void advanceReboot(String vmUuid, Map params) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException; - /** - * Check to see if a virtual machine can be upgraded to the given service offering - * - * @param vm - * @param offering - * @return true if the host can handle the upgrade, false otherwise - */ - boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering); - VirtualMachine findById(long vmId); void storageMigration(String vmUuid, Map volumeToPool); @@ -224,6 +223,8 @@ NicProfile addVmToNetwork(VirtualMachine vm, Network network, NicProfile request Boolean updateDefaultNicForVM(VirtualMachine vm, Nic nic, Nic defaultNic); + boolean updateVmNic(VirtualMachine vm, Nic nic, Boolean enabled) throws ResourceUnavailableException; + /** * @param vm * @param network @@ -271,7 +272,7 @@ static String getHypervisorHostname(String name) { * - Remove the references of the VM and its volumes, nics, IPs from database * - Keep the VM as it is on the hypervisor */ - boolean unmanage(String vmUuid); + Pair unmanage(String vmUuid, Long paramHostId); UserVm restoreVirtualMachine(long vmId, Long newTemplateId, Long rootDiskOfferingId, boolean expunge, Map details) throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException; @@ -309,4 +310,12 @@ static String getHypervisorHostname(String name) { Map getDiskOfferingSuitabilityForVm(long vmId, List diskOfferingIds); + void checkDeploymentPlan(VirtualMachine virtualMachine, VirtualMachineTemplate template, + ServiceOffering serviceOffering, Account systemAccount, DeploymentPlan plan) + throws InsufficientServerCapacityException; + + boolean isBlankInstanceDefaultTemplate(VirtualMachineTemplate template); + + boolean isBlankInstance(VirtualMachineTemplate template); + } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java index 8463d9cee986..030c1277efe2 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java @@ -76,42 +76,61 @@ public interface NetworkOrchestrationService { */ Long RVRHandoverTime = 10000L; - ConfigKey MinVRVersion = new ConfigKey(String.class, MinVRVersionCK, "Advanced", "4.10.0", + ConfigKey MinVRVersion = new ConfigKey<>(String.class, MinVRVersionCK, "Advanced", "4.10.0", "What version should the Virtual Routers report", true, ConfigKey.Scope.Zone, null); - ConfigKey NetworkLockTimeout = new ConfigKey(Integer.class, NetworkLockTimeoutCK, "Network", "600", - "Lock wait timeout (seconds) while implementing network", true, Scope.Global, null); + ConfigKey NetworkLockTimeout = new ConfigKey<>(Integer.class, NetworkLockTimeoutCK, "Network", "600", + "Lock wait timeout (seconds) while implementing Network", true, Scope.Global, null); - ConfigKey DeniedRoutes = new ConfigKey(String.class, "denied.routes", "Network", "", + ConfigKey DeniedRoutes = new ConfigKey<>(String.class, "denied.routes", "Network", "", "Routes that are denied, can not be used for Static Routes creation for the VPC Private Gateway", true, ConfigKey.Scope.Zone, null); - ConfigKey GuestDomainSuffix = new ConfigKey(String.class, GuestDomainSuffixCK, "Network", "cloud.internal", - "Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null); + ConfigKey GuestDomainSuffix = new ConfigKey<>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal", + "Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null); - ConfigKey NetworkThrottlingRate = new ConfigKey("Network", Integer.class, NetworkThrottlingRateCK, "200", - "Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone); + ConfigKey NetworkThrottlingRate = new ConfigKey<>("Network", Integer.class, NetworkThrottlingRateCK, "200", + "Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone); - ConfigKey PromiscuousMode = new ConfigKey("Advanced", Boolean.class, "network.promiscuous.mode", "false", - "Whether to allow or deny promiscuous mode on nics for applicable network elements such as for vswitch/dvswitch portgroups.", true); + ConfigKey PromiscuousMode = new ConfigKey<>("Advanced", Boolean.class, "network.promiscuous.mode", "false", + "Whether to allow or deny promiscuous mode on NICs for applicable network elements such as for vswitch/dvswitch portgroups.", true); - ConfigKey MacAddressChanges = new ConfigKey("Advanced", Boolean.class, "network.mac.address.changes", "true", - "Whether to allow or deny mac address changes on nics for applicable network elements such as for vswitch/dvswitch porgroups.", true); + ConfigKey MacAddressChanges = new ConfigKey<>("Advanced", Boolean.class, "network.mac.address.changes", "true", + "Whether to allow or deny mac address changes on NICs for applicable network elements such as for vswitch/dvswitch porgroups.", true); - ConfigKey ForgedTransmits = new ConfigKey("Advanced", Boolean.class, "network.forged.transmits", "true", - "Whether to allow or deny forged transmits on nics for applicable network elements such as for vswitch/dvswitch portgroups.", true); + ConfigKey ForgedTransmits = new ConfigKey<>("Advanced", Boolean.class, "network.forged.transmits", "true", + "Whether to allow or deny forged transmits on NICs for applicable network elements such as for vswitch/dvswitch portgroups.", true); - ConfigKey MacLearning = new ConfigKey("Advanced", Boolean.class, "network.mac.learning", "false", + ConfigKey MacLearning = new ConfigKey<>("Advanced", Boolean.class, "network.mac.learning", "false", "Whether to allow or deny MAC learning on nics for applicable network elements such as for dvswitch portgroups.", true); - ConfigKey RollingRestartEnabled = new ConfigKey("Advanced", Boolean.class, "network.rolling.restart", "true", + ConfigKey RollingRestartEnabled = new ConfigKey<>("Advanced", Boolean.class, "network.rolling.restart", "true", "Whether to allow or deny rolling restart of network routers.", true); - static final ConfigKey TUNGSTEN_ENABLED = new ConfigKey<>(Boolean.class, "tungsten.plugin.enable", "Advanced", "false", + ConfigKey TUNGSTEN_ENABLED = new ConfigKey<>(Boolean.class, "tungsten.plugin.enable", "Advanced", "false", "Indicates whether to enable the Tungsten plugin", false, ConfigKey.Scope.Zone, null); - static final ConfigKey NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false", + ConfigKey NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false", "Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null); + ConfigKey NETRIS_ENABLED = new ConfigKey<>(Boolean.class, "netris.plugin.enable", "Advanced", "false", + "Indicates whether to enable the Netris plugin", false, ConfigKey.Scope.Zone, null); + ConfigKey NETWORK_LB_HAPROXY_MAX_CONN = new ConfigKey<>( + "Network", + Integer.class, + "network.loadbalancer.haproxy.max.conn", + "4096", + "Load Balancer(haproxy) maximum number of concurrent connections(global max)", + true, + Scope.Global); + ConfigKey NETWORK_LB_HAPROXY_IDLE_TIMEOUT = new ConfigKey<>( + "Network", + Long.class, + "network.loadbalancer.haproxy.idle.timeout", + "50000", + "Load Balancer(haproxy) idle timeout in milliseconds. Use 0 for infinite.", + true, + Scope.Global); + List setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault) throws ConcurrentOperationException; @@ -126,7 +145,7 @@ void allocate(VirtualMachineProfile vm, LinkedHashMap extraDhcpOptions); @@ -155,16 +174,15 @@ void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationC Pair implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; - Map getExtraDhcpOptions(long nicId); - /** * Returns all extra dhcp options which are set on the provided nic * @param nicId * @return map which maps the dhcp value on it's option code */ + Map getExtraDhcpOptions(long nicId); + /** * prepares vm nic change for migration - * * This method will be called in migration transaction before the vm migration. * @param vm * @param dest @@ -173,7 +191,6 @@ void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationC /** * commit vm nic change for migration - * * This method will be called in migration transaction after the successful * vm migration. * @param src @@ -183,7 +200,6 @@ void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationC /** * rollback vm nic change for migration - * * This method will be called in migaration transaction after vm migration * failure. * @param src @@ -204,6 +220,11 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe Boolean displayNetworkEnabled, String isolatedPvlan, Network.PVlanType isolatedPvlanType, String externalId, String routerIp, String routerIpv6, String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Pair vrIfaceMTUs, Integer networkCidrSize) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException; + Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr, String vlanId, boolean bypassVlanOverlapCheck, String networkDomain, Account owner, + Long domainId, PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr, + Boolean displayNetworkEnabled, String isolatedPvlan, Network.PVlanType isolatedPvlanType, String externalId, String routerIp, String routerIpv6, + String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Pair vrIfaceMTUs, Integer networkCidrSize, boolean keepMacAddressOnPublicNic) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException; + UserDataServiceProvider getPasswordResetProvider(Network network); UserDataServiceProvider getSSHKeyResetProvider(Network network); @@ -263,7 +284,7 @@ NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest, R void releaseNic(VirtualMachineProfile vmProfile, Nic nic) throws ConcurrentOperationException, ResourceUnavailableException; NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare) - throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, + throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException; NetworkProfile convertNetworkToNetworkProfile(long networkId); @@ -274,7 +295,7 @@ boolean restartNetwork(Long networkId, Account callerAccount, User callerUser, b boolean shutdownNetworkElementsAndResources(ReservationContext context, boolean b, Network network); void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context, Network network, NetworkOffering findById) - throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException; + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; Map finalizeServicesAndProvidersForNetwork(NetworkOffering offering, Long physicalNetworkId); @@ -302,7 +323,7 @@ void implementNetworkElementsAndResources(DeployDestination dest, ReservationCon void removeDhcpServiceInSubnet(Nic nic); - boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType); + boolean isResourceCountUpdateNeeded(NetworkOffering networkOffering); void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest); diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/StorageOrchestrationService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/StorageOrchestrationService.java index 481d0ebbc769..4af0c806060b 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/StorageOrchestrationService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/StorageOrchestrationService.java @@ -18,12 +18,17 @@ package org.apache.cloudstack.engine.orchestration.service; import java.util.List; +import java.util.concurrent.Future; import org.apache.cloudstack.api.response.MigrationResponse; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult; import org.apache.cloudstack.storage.ImageStoreService.MigrationPolicy; public interface StorageOrchestrationService { MigrationResponse migrateData(Long srcDataStoreId, List destDatastores, MigrationPolicy migrationPolicy); MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreId, List templateIdList, List snapshotIdList); + + Future orchestrateTemplateCopyFromSecondaryStores(long templateId, DataStore destStore); } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java index 7950dda4d68e..a55219511cb3 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java @@ -23,6 +23,8 @@ import java.util.Set; import com.cloud.exception.ResourceAllocationException; +import com.cloud.storage.Storage; +import com.cloud.utils.Pair; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; @@ -83,6 +85,17 @@ public interface VolumeOrchestrationService { "The maximum size for a volume (in GiB).", true); + ConfigKey VolumeAllocationAlgorithm = new ConfigKey<>( + String.class, + "volume.allocation.algorithm", + "Advanced", + "random", + "Order in which storage pool within a cluster will be considered for volume allocation. The value can be 'random', 'firstfit', 'userdispersing', or 'firstfitleastconsumed'.", + true, + ConfigKey.Scope.Global, null, null, null, null, null, + ConfigKey.Kind.Select, + "random,firstfit,userdispersing,firstfitleastconsumed"); + VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType) throws ConcurrentOperationException, StorageUnavailableException; @@ -107,7 +120,7 @@ VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, void destroyVolume(Volume volume); DiskProfile allocateRawVolume(Type type, String name, DiskOffering offering, Long size, Long minIops, Long maxIops, VirtualMachine vm, VirtualMachineTemplate template, - Account owner, Long deviceId); + Account owner, Long deviceId, boolean incrementResourceCount); VolumeInfo createVolumeOnPrimaryStorage(VirtualMachine vm, VolumeInfo volume, HypervisorType rootDiskHyperType, StoragePool storagePool) throws NoTransitionException; @@ -137,7 +150,7 @@ DiskProfile allocateRawVolume(Type type, String name, DiskOffering offering, Lon * Allocate a volume or multiple volumes in case of template is registered with the 'deploy-as-is' option, allowing multiple disks */ List allocateTemplatedVolumes(Type type, String name, DiskOffering offering, Long rootDisksize, Long minIops, Long maxIops, VirtualMachineTemplate template, VirtualMachine vm, - Account owner); + Account owner, Volume volume, Snapshot snapshot); String getVmNameFromVolumeId(long volumeId); @@ -170,13 +183,18 @@ List allocateTemplatedVolumes(Type type, String name, DiskOffering */ DiskProfile importVolume(Type type, String name, DiskOffering offering, Long sizeInBytes, Long minIops, Long maxIops, Long zoneId, HypervisorType hypervisorType, VirtualMachine vm, VirtualMachineTemplate template, - Account owner, Long deviceId, Long poolId, String path, String chainInfo); + Account owner, Long deviceId, Long poolId, Storage.StoragePoolType poolType, String path, String chainInfo); DiskProfile updateImportedVolume(Type type, DiskOffering offering, VirtualMachine vm, VirtualMachineTemplate template, - Long deviceId, Long poolId, String path, String chainInfo, DiskProfile diskProfile); + Long deviceId, Long poolId, Storage.StoragePoolType poolType, String path, String chainInfo, DiskProfile diskProfile); /** * Unmanage VM volumes */ void unmanageVolumes(long vmId); + + /** + * Retrieves the volume's checkpoints paths to be used in the KVM processor. If there are no checkpoints, it will return an empty list. + */ + Pair, Set> getVolumeCheckpointPathsAndImageStoreUrls(long volumeId, HypervisorType hypervisorType); } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/service/api/OrchestrationService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/service/api/OrchestrationService.java index 3ffa496b5445..6be71b3cb250 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/service/api/OrchestrationService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/service/api/OrchestrationService.java @@ -18,6 +18,8 @@ */ package org.apache.cloudstack.engine.service.api; +import com.cloud.storage.Snapshot; +import com.cloud.storage.Volume; import java.net.URL; import java.util.List; import java.util.Map; @@ -38,6 +40,7 @@ import com.cloud.hypervisor.Hypervisor; import com.cloud.offering.DiskOffering; import com.cloud.vm.NicProfile; +import com.cloud.vm.VmDiskInfo; @Path("orchestration") @Produces({"application/json", "application/xml"}) @@ -62,20 +65,22 @@ public interface OrchestrationService { @POST @Path("/createvm") VirtualMachineEntity createVirtualMachine(@QueryParam("id") String id, @QueryParam("owner") String owner, @QueryParam("template-id") String templateId, - @QueryParam("host-name") String hostName, @QueryParam("display-name") String displayName, @QueryParam("hypervisor") String hypervisor, - @QueryParam("cpu") int cpu, @QueryParam("speed") int speed, @QueryParam("ram") long memory, @QueryParam("disk-size") Long diskSize, - @QueryParam("compute-tags") List computeTags, @QueryParam("root-disk-tags") List rootDiskTags, - @QueryParam("network-nic-map") Map> networkNicMap, @QueryParam("deploymentplan") DeploymentPlan plan, - @QueryParam("root-disk-size") Long rootDiskSize, @QueryParam("extra-dhcp-option-map") Map> extraDhcpOptionMap, - @QueryParam("datadisktemplate-diskoffering-map") Map datadiskTemplateToDiskOfferingMap, @QueryParam("disk-offering-id") Long diskOfferingId, @QueryParam("root-disk-offering-id") Long rootDiskOfferingId) throws InsufficientCapacityException; + @QueryParam("host-name") String hostName, @QueryParam("display-name") String displayName, @QueryParam("hypervisor") String hypervisor, + @QueryParam("cpu") int cpu, @QueryParam("speed") int speed, @QueryParam("ram") long memory, @QueryParam("disk-size") Long diskSize, + @QueryParam("compute-tags") List computeTags, @QueryParam("root-disk-tags") List rootDiskTags, + @QueryParam("network-nic-map") Map> networkNicMap, @QueryParam("deploymentplan") DeploymentPlan plan, + @QueryParam("root-disk-size") Long rootDiskSize, @QueryParam("extra-dhcp-option-map") Map> extraDhcpOptionMap, + @QueryParam("datadisktemplate-diskoffering-map") Map datadiskTemplateToDiskOfferingMap, @QueryParam("disk-offering-id") Long diskOfferingId, + @QueryParam("root-disk-offering-id") Long rootDiskOfferingId, List dataDiskInfoList, Volume volume, Snapshot snapshot) throws InsufficientCapacityException; @POST VirtualMachineEntity createVirtualMachineFromScratch(@QueryParam("id") String id, @QueryParam("owner") String owner, @QueryParam("iso-id") String isoId, - @QueryParam("host-name") String hostName, @QueryParam("display-name") String displayName, @QueryParam("hypervisor") String hypervisor, - @QueryParam("os") String os, @QueryParam("cpu") int cpu, @QueryParam("speed") int speed, @QueryParam("ram") long memory, @QueryParam("disk-size") Long diskSize, - @QueryParam("compute-tags") List computeTags, @QueryParam("root-disk-tags") List rootDiskTags, - @QueryParam("network-nic-map") Map> networkNicMap, @QueryParam("deploymentplan") DeploymentPlan plan, - @QueryParam("extra-dhcp-option-map") Map> extraDhcpOptionMap, @QueryParam("disk-offering-id") Long diskOfferingId) throws InsufficientCapacityException; + @QueryParam("host-name") String hostName, @QueryParam("display-name") String displayName, @QueryParam("hypervisor") String hypervisor, + @QueryParam("os") String os, @QueryParam("cpu") int cpu, @QueryParam("speed") int speed, @QueryParam("ram") long memory, @QueryParam("disk-size") Long diskSize, + @QueryParam("compute-tags") List computeTags, @QueryParam("root-disk-tags") List rootDiskTags, + @QueryParam("network-nic-map") Map> networkNicMap, @QueryParam("deploymentplan") DeploymentPlan plan, + @QueryParam("extra-dhcp-option-map") Map> extraDhcpOptionMap, @QueryParam("disk-offering-id") Long diskOfferingId, + @QueryParam("data-disks-offering-info") List dataDiskInfoList, Volume volume, Snapshot snapshot) throws InsufficientCapacityException; @POST NetworkEntity createNetwork(String id, String name, String domainName, String cidr, String gateway); diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java index b0ed7d7d52b5..68c7ed40d8f4 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage; import com.cloud.storage.ScopeType; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; public class ClusterScope extends AbstractScope { private ScopeType type = ScopeType.CLUSTER; @@ -51,4 +52,9 @@ public Long getZoneId() { return this.zoneId; } + @Override + public String toString() { + return String.format("ClusterScope %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "zoneId", "clusterId", "podId")); + } } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java index f537d8f52028..2494cc7c5fcb 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreCapabilities.java @@ -40,5 +40,13 @@ public enum DataStoreCapabilities { /** * indicates that this driver supports reverting a volume to a snapshot state */ - CAN_REVERT_VOLUME_TO_SNAPSHOT + CAN_REVERT_VOLUME_TO_SNAPSHOT, + /** + * indicates that the driver supports copying snapshot between zones on pools of the same type + */ + CAN_COPY_SNAPSHOT_BETWEEN_ZONES_AND_SAME_POOL_TYPE, + /** + * indicates that this driver supports the option to create a template from the back-end snapshot + */ + CAN_CREATE_TEMPLATE_FROM_SNAPSHOT } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java index b197afad863a..af3b38b368c3 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java @@ -45,4 +45,8 @@ public interface DataStoreDriver { boolean canCopy(DataObject srcData, DataObject destData); void resize(DataObject data, AsyncCompletionCallback callback); + + default boolean canDisplayDetails() { + return true; + } } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/EndPointSelector.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/EndPointSelector.java index 4f2a69bc7719..7cf2a593db4a 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/EndPointSelector.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/EndPointSelector.java @@ -18,6 +18,8 @@ */ package org.apache.cloudstack.engine.subsystem.api.storage; +import com.cloud.hypervisor.Hypervisor; + import java.util.List; public interface EndPointSelector { @@ -39,6 +41,8 @@ public interface EndPointSelector { EndPoint select(DataObject object, StorageAction action, boolean encryptionSupportRequired); + EndPoint selectRandom(long zoneId, Hypervisor.HypervisorType hypervisorType); + List selectAll(DataStore store); List findAllEndpointsForScope(DataStore store); diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java index 6e0bc618bfe2..7e6ffe7d4f74 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java @@ -19,8 +19,10 @@ package org.apache.cloudstack.engine.subsystem.api.storage; import com.cloud.storage.ScopeType; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; public class HostScope extends AbstractScope { + private ScopeType type = ScopeType.HOST; private Long hostId; private Long clusterId; private Long zoneId; @@ -34,7 +36,7 @@ public HostScope(Long hostId, Long clusterId, Long zoneId) { @Override public ScopeType getScopeType() { - return ScopeType.HOST; + return this.type; } @Override @@ -49,4 +51,10 @@ public Long getClusterId() { public Long getZoneId() { return zoneId; } + + @Override + public String toString() { + return String.format("HostScope %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "zoneId", "clusterId", "hostId")); + } } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java index 611d1247c49d..afa5d4e36db8 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java @@ -32,10 +32,12 @@ enum State { Migrated("The object has been migrated"), Destroying("Template is destroying"), Destroyed("Template is destroyed"), - Failed("Failed to download template"); - String _description; + Failed("Failed to download Template"), + Hidden("The object is hidden from the user"); - private State(String description) { + final String _description; + + State(String description) { _description = description; } @@ -48,7 +50,7 @@ enum Event { CreateRequested, CreateOnlyRequested, DestroyRequested, - OperationSuccessed, + OperationSucceeded, OperationFailed, CopyRequested, CopyingRequested, diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java index c8d9015af902..d908ef6af508 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java @@ -145,6 +145,14 @@ default boolean canHostPrepareStoragePoolAccess(Host host, StoragePool pool) { return false; } + /** + * intended for managed storage + * returns true if the host can be disconnected from storage pool + */ + default boolean canDisconnectHostFromStoragePool(Host host, StoragePool pool) { + return true; + } + /** * Used by storage pools which want to keep VMs' information * @return true if additional VM info is needed (intended for storage pools). diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java index 54f3c63f8d73..1acaccf09df4 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java @@ -24,8 +24,8 @@ import com.cloud.storage.StoragePool; public interface PrimaryDataStoreLifeCycle extends DataStoreLifeCycle { - public static final String CAPACITY_BYTES = "capacityBytes"; - public static final String CAPACITY_IOPS = "capacityIops"; + String CAPACITY_BYTES = "capacityBytes"; + String CAPACITY_IOPS = "capacityIops"; void updateStoragePool(StoragePool storagePool, Map details); void enableStoragePool(DataStore store); diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java index 1b18264df15d..adb77e69e90e 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java @@ -30,6 +30,7 @@ public class PrimaryDataStoreParameters { private String providerName; private Map details; private String tags; + private String storageAccessGroups; private StoragePoolType type; private HypervisorType hypervisorType; private String host; @@ -165,6 +166,21 @@ public void setTags(String tags) { this.tags = tags; } + /** + * @return the storageAccessGroups + */ + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + /** + * @param storageAccessGroups + * the storageAccessGroups to set + */ + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + /** * @return the details */ diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java index 2a2db4af3e53..32434829c074 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java @@ -21,6 +21,7 @@ import java.util.List; import com.cloud.storage.DataStoreRole; +import com.cloud.utils.fsm.NoTransitionException; public interface SnapshotDataFactory { SnapshotInfo getSnapshot(long snapshotId, DataStore store); @@ -29,6 +30,8 @@ public interface SnapshotDataFactory { SnapshotInfo getSnapshot(long snapshotId, long storeId, DataStoreRole role); + SnapshotInfo getSnapshotIncludingRemoved(long snapshotId, long storeId, DataStoreRole role); + SnapshotInfo getSnapshotWithRoleAndZone(long snapshotId, DataStoreRole role, long zoneId); SnapshotInfo getSnapshotOnPrimaryStore(long snapshotId); @@ -42,4 +45,6 @@ public interface SnapshotDataFactory { List listSnapshotOnCache(long snapshotId); SnapshotInfo getReadySnapshotOnCache(long snapshotId); + + void updateOperationFailed(long snapshotId) throws NoTransitionException; } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java index 3213484694eb..997a66ec5901 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java @@ -25,13 +25,17 @@ public interface SnapshotInfo extends DataObject, Snapshot { ConfigKey BackupSnapshotAfterTakingSnapshot = new ConfigKey<>(Boolean.class, "snapshot.backup.to.secondary", "Snapshots", "true", "Indicates whether to always" - + " backup primary storage snapshot to secondary storage. Keeping snapshots only on Primary storage is applicable for KVM + Ceph only.", false, ConfigKey.Scope.Global, + + " backup primary storage Snapshot to secondary storage. Keeping Snapshots only on Primary storage is applicable for KVM + Ceph only.", false, ConfigKey.Scope.Global, null); SnapshotInfo getParent(); String getPath(); + DataStore getImageStore(); + + void setImageStore(DataStore imageStore); + SnapshotInfo getChild(); List getChildren(); @@ -56,6 +60,14 @@ public interface SnapshotInfo extends DataObject, Snapshot { void markBackedUp() throws CloudRuntimeException; + String getCheckpointPath(); + + void setCheckpointPath(String checkpointPath); + + void setKvmIncrementalSnapshot(boolean isKvmIncrementalSnapshot); + + boolean isKvmIncrementalSnapshot(); + Snapshot getSnapshotVO(); long getAccountId(); diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotService.java index d2e085fe90cf..18c924167e0b 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotService.java @@ -25,8 +25,12 @@ public interface SnapshotService { SnapshotResult takeSnapshot(SnapshotInfo snapshot); + DataStore findSnapshotImageStore(SnapshotInfo snapshot); + SnapshotInfo backupSnapshot(SnapshotInfo snapshot); + SnapshotInfo convertSnapshot(SnapshotInfo snapshotInfo); + boolean deleteSnapshot(SnapshotInfo snapshot); boolean revertSnapshot(SnapshotInfo snapshot); @@ -42,4 +46,6 @@ public interface SnapshotService { AsyncCallFuture copySnapshot(SnapshotInfo snapshot, String copyUrl, DataStore dataStore) throws ResourceUnavailableException; AsyncCallFuture queryCopySnapshot(SnapshotInfo snapshot) throws ResourceUnavailableException; + + AsyncCallFuture copySnapshot(SnapshotInfo sourceSnapshot, SnapshotInfo destSnapshot, SnapshotStrategy strategy); } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java index f3aa8f52c932..43f411f75533 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java @@ -16,12 +16,14 @@ // under the License. package org.apache.cloudstack.engine.subsystem.api.storage; + import com.cloud.storage.Snapshot; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; public interface SnapshotStrategy { enum SnapshotOperation { - TAKE, BACKUP, DELETE, REVERT + TAKE, BACKUP, DELETE, REVERT, COPY } SnapshotInfo takeSnapshot(SnapshotInfo snapshot); @@ -35,4 +37,7 @@ enum SnapshotOperation { StrategyPriority canHandle(Snapshot snapshot, Long zoneId, SnapshotOperation op); void postSnapshotCreation(SnapshotInfo snapshot); + + default void copySnapshot(DataObject snapshotSource, DataObject snapshotDest, AsyncCompletionCallback caller) { + } } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StorageAction.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StorageAction.java index dc93f4aa41e1..037676f81899 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StorageAction.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StorageAction.java @@ -22,6 +22,8 @@ public enum StorageAction { TAKESNAPSHOT, BACKUPSNAPSHOT, DELETESNAPSHOT, + CONVERTSNAPSHOT, + REMOVEBITMAP, MIGRATEVOLUME, DELETEVOLUME } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java index 6a78f6fe253f..9a2dc7346859 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StoragePoolAllocator.java @@ -64,4 +64,5 @@ public interface StoragePoolAllocator extends Adapter { static int RETURN_UPTO_ALL = -1; List reorderPools(List pools, VirtualMachineProfile vmProfile, DeploymentPlan plan, DiskProfile dskCh); + } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java index 115cf024617f..269eb4f1c213 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/TemplateService.java @@ -78,4 +78,8 @@ public TemplateInfo getTemplate() { AsyncCallFuture createDatadiskTemplateAsync(TemplateInfo parentTemplate, TemplateInfo dataDiskTemplate, String path, String diskId, long fileSize, boolean bootable); List getTemplateDatadisksOnImageStore(TemplateInfo templateInfo, String configurationId); -} + + AsyncCallFuture copyTemplateToImageStore(DataObject source, DataStore destStore); + + void handleTemplateCopyFromSecondaryStores(long templateId, DataStore destStore); + } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VMSnapshotStrategy.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VMSnapshotStrategy.java index 6372aa3bd949..2939342ec27c 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VMSnapshotStrategy.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VMSnapshotStrategy.java @@ -18,6 +18,7 @@ */ package org.apache.cloudstack.engine.subsystem.api.storage; +import com.cloud.utils.fsm.NoTransitionException; import com.cloud.vm.snapshot.VMSnapshot; public interface VMSnapshotStrategy { @@ -44,4 +45,6 @@ public interface VMSnapshotStrategy { * @return true if vm snapshot removed from DB, false if not. */ boolean deleteVMSnapshotFromDB(VMSnapshot vmSnapshot, boolean unmanage); + + void updateOperationFailed(VMSnapshot vmSnapshot) throws NoTransitionException; } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java index 19b852bd9126..8b0171870765 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java @@ -26,6 +26,9 @@ import com.cloud.storage.Volume; import com.cloud.vm.VirtualMachine; +import java.util.List; +import java.util.Set; + public interface VolumeInfo extends DownloadableDataInfo, Volume { boolean isAttachedVM(); @@ -96,4 +99,8 @@ public interface VolumeInfo extends DownloadableDataInfo, Volume { public byte[] getPassphrase(); Volume getVolume(); + + List getCheckpointPaths(); + + Set getCheckpointImageStoreUrls(); } diff --git a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java index a0d75b5cc7c9..fa704d05b1ae 100644 --- a/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java +++ b/engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage; import com.cloud.storage.ScopeType; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; public class ZoneScope extends AbstractScope { private ScopeType type = ScopeType.ZONE; @@ -39,4 +40,9 @@ public Long getScopeId() { return this.zoneId; } + @Override + public String toString() { + return String.format("ZoneScope %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "zoneId")); + } } diff --git a/engine/components-api/pom.xml b/engine/components-api/pom.xml index 0b30decffda8..49d41d36f83d 100644 --- a/engine/components-api/pom.xml +++ b/engine/components-api/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java index c01345ca21b1..4d63fae33560 100644 --- a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java @@ -37,7 +37,7 @@ * AgentManager manages hosts. It directly coordinates between the DAOs and the connections it manages. */ public interface AgentManager { - static final ConfigKey Wait = new ConfigKey("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", + ConfigKey Wait = new ConfigKey("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", true); ConfigKey EnableKVMAutoEnableDisable = new ConfigKey<>(Boolean.class, "enable.kvm.host.auto.enable.disable", @@ -54,7 +54,11 @@ public interface AgentManager { "This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " + "For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", false); - public enum TapAgentsAction { + ConfigKey KVMHostDiscoverySshPort = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class, + "kvm.host.discovery.ssh.port", String.valueOf(Host.DEFAULT_SSH_PORT), "SSH port used for KVM host discovery and any other operations on host (using SSH)." + + " Please note that this is applicable when port is not defined through host url while adding the KVM host.", true, ConfigKey.Scope.Cluster); + + enum TapAgentsAction { Add, Del, Contains, } @@ -171,5 +175,7 @@ public enum TapAgentsAction { void propagateChangeToAgents(Map params); - boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs); + boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance); + + int getHostSshPort(HostVO host); } diff --git a/engine/components-api/src/main/java/com/cloud/alert/AlertManager.java b/engine/components-api/src/main/java/com/cloud/alert/AlertManager.java index 3d4e6579f7ca..46993b066a49 100644 --- a/engine/components-api/src/main/java/com/cloud/alert/AlertManager.java +++ b/engine/components-api/src/main/java/com/cloud/alert/AlertManager.java @@ -49,10 +49,13 @@ public interface AlertManager extends Manager, AlertService { "Percentage (as a value between 0 and 1) of guest network IPv6 subnet utilization above which alerts will be sent.", true); + ConfigKey AllowedRepetitiveAlertTypes = new ConfigKey<>(ConfigKey.CATEGORY_ALERT, String.class, + "alert.allowed.repetitive.types", "", + "Comma-separated list of alert types (by name) that can be sent multiple times", true); + void clearAlert(AlertType alertType, long dataCenterId, long podId); void recalculateCapacity(); void sendAlert(AlertType alertType, long dataCenterId, Long podId, String subject, String body); - } diff --git a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java index 4c81c7359f25..abaf6ea967d0 100644 --- a/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java +++ b/engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java @@ -133,6 +133,20 @@ public interface CapacityManager { "capacity.calculate.workers", "1", "Number of worker threads to be used for capacities calculation", true); + ConfigKey KvmMemoryDynamicScalingCapacity = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, + Integer.class, "kvm.memory.dynamic.scaling.capacity", "0", + "Defines the maximum memory capacity in MiB for which VMs can be dynamically scaled to with KVM. " + + "The 'kvm.memory.dynamic.scaling.capacity' setting's value will be used to define the value of the " + + "'' element of domain XMLs. If it is set to a value less than or equal to '0', then the host's memory capacity will be considered.", + true, ConfigKey.Scope.Cluster); + + ConfigKey KvmCpuDynamicScalingCapacity = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, + Integer.class, "kvm.cpu.dynamic.scaling.capacity", "0", + "Defines the maximum vCPU capacity for which VMs can be dynamically scaled to with KVM. " + + "The 'kvm.cpu.dynamic.scaling.capacity' setting's value will be used to define the value of the " + + "'' element of domain XMLs. If it is set to a value less than or equal to '0', then the host's CPU cores capacity will be considered.", + true, ConfigKey.Scope.Cluster); + public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId); void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost); diff --git a/engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java b/engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java index 1694b19c33fd..5909d098db8b 100644 --- a/engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java +++ b/engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java @@ -56,18 +56,25 @@ */ public interface ConfigurationManager { - public static final String MESSAGE_CREATE_POD_IP_RANGE_EVENT = "Message.CreatePodIpRange.Event"; - public static final String MESSAGE_DELETE_POD_IP_RANGE_EVENT = "Message.DeletePodIpRange.Event"; - public static final String MESSAGE_CREATE_VLAN_IP_RANGE_EVENT = "Message.CreateVlanIpRange.Event"; - public static final String MESSAGE_DELETE_VLAN_IP_RANGE_EVENT = "Message.DeleteVlanIpRange.Event"; + String MESSAGE_CREATE_POD_IP_RANGE_EVENT = "Message.CreatePodIpRange.Event"; + String MESSAGE_DELETE_POD_IP_RANGE_EVENT = "Message.DeletePodIpRange.Event"; + String MESSAGE_CREATE_VLAN_IP_RANGE_EVENT = "Message.CreateVlanIpRange.Event"; + String MESSAGE_DELETE_VLAN_IP_RANGE_EVENT = "Message.DeleteVlanIpRange.Event"; public static final ConfigKey AllowNonRFC1918CompliantIPs = new ConfigKey<>(Boolean.class, "allow.non.rfc1918.compliant.ips", "Advanced", "false", "Allows non-compliant RFC 1918 IPs for Shared, Isolated networks and VPCs", true, null); + ConfigKey HostCapacityTypeCpuMemoryWeight = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Float.class, + "host.capacityType.to.order.clusters.cputomemoryweight", + "0.5", + "Weight for CPU (as a value between 0 and 1) applied to compute capacity for Pods, Clusters and Hosts for COMBINED capacityType for ordering. Weight for RAM will be (1 - weight of CPU)", + true, ConfigKey.Scope.Global); + /** - * @param offering - * @return + * Is this for a VPC + * @param offering the offering to check + * @return true or false */ boolean isOfferingForVpc(NetworkOffering offering); @@ -77,86 +84,19 @@ public interface ConfigurationManager { /** * Updates a configuration entry with a new value - * - * @param userId - * @param name - * @param value */ - String updateConfiguration(long userId, String name, String category, String value, String scope, Long id); - -// /** -// * Creates a new service offering -// * -// * @param name -// * @param cpu -// * @param ramSize -// * @param speed -// * @param displayText -// * @param localStorageRequired -// * @param offerHA -// * @param domainId -// * @param volatileVm -// * @param hostTag -// * @param networkRate -// * @param id -// * @param useVirtualNetwork -// * @param deploymentPlanner -// * @param details -// * @param bytesReadRate -// * @param bytesWriteRate -// * @param iopsReadRate -// * @param iopsWriteRate -// * @return ID -// */ -// ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, -// boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map details, -// Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate); - -// /** -// * Creates a new disk offering -// * -// * @param domainId -// * @param name -// * @param description -// * @param numGibibytes -// * @param tags -// * @param isCustomized -// * @param localStorageRequired -// * @param isDisplayOfferingEnabled -// * @param isCustomizedIops (is admin allowing users to set custom iops?) -// * @param minIops -// * @param maxIops -// * @param bytesReadRate -// * @param bytesWriteRate -// * @param iopsReadRate -// * @param iopsWriteRate -// * @return newly created disk offering -// */ -// DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, -// boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops, -// Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate); + String updateConfiguration(long userId, String name, String category, String value, ConfigKey.Scope scope, Long id); /** * Creates a new pod - * - * @param userId - * @param podName - * @param zone - * @param gateway - * @param cidr - * @param startIp - * @param endIp - * @param allocationState - * @param skipGatewayOverlapCheck - * (true if it is ok to not validate that gateway IP address overlap with Start/End IP of the POD) + * @param skipGatewayOverlapCheck (true if it is ok to not validate that gateway IP address overlap with Start/End IP of the POD) * @return Pod */ HostPodVO createPod(long userId, String podName, DataCenter zone, String gateway, String cidr, String startIp, String endIp, String allocationState, - boolean skipGatewayOverlapCheck); + boolean skipGatewayOverlapCheck, List storageAccessGroups); /** * Creates a new zone - * * @param userId * @param zoneName * @param dns1 @@ -164,27 +104,28 @@ HostPodVO createPod(long userId, String podName, DataCenter zone, String gateway * @param internalDns1 * @param internalDns2 * @param guestCidr + * @param domain + * @param domainId * @param zoneType * @param allocationState * @param networkDomain * @param isSecurityGroupEnabled + * @param isLocalStorageEnabled * @param ip6Dns1 * @param ip6Dns2 + * @param isEdge + * @param storageAccessGroups * @return - * @throws - * @throws */ DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String guestCidr, String domain, Long domainId, NetworkType zoneType, String allocationState, String networkDomain, boolean isSecurityGroupEnabled, boolean isLocalStorageEnabled, String ip6Dns1, - String ip6Dns2, boolean isEdge); + String ip6Dns2, boolean isEdge, List storageAccessGroups); /** * Deletes a VLAN from the database, along with all of its IP addresses. Will not delete VLANs that have allocated * IP addresses. * - * @param userId - * @param vlanDbId - * @param caller + * @param caller TODO * @return success/failure */ VlanVO deleteVlanAndPublicIpRange(long userId, long vlanDbId, Account caller); @@ -195,39 +136,48 @@ DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, /** * Creates a new network offering - * * @param name * @param displayText * @param trafficType * @param tags * @param specifyVlan + * @param availability * @param networkRate * @param serviceProviderMap * @param isDefault * @param type * @param systemOnly * @param serviceOfferingId - * @param conserveMode ; + * @param conserveMode + * @param serviceCapabilityMap * @param specifyIpRanges - * @param isPersistent ; + * @param isPersistent * @param details + * @param egressDefaultPolicy + * @param maxconn + * @param enableKeepAlive * @param forVpc * @param forTungsten * @param forNsx + * @param forNetris + * @param networkMode * @param domainIds * @param zoneIds - * @return network offering object + * @param enableOffering + * @param internetProtocol + * @param routingMode + * @param specifyAsNumber + * @return the network offering */ - NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate, Map> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode, Map> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent, Map details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc, - Boolean forTungsten, boolean forNsx, NetworkOffering.NetworkMode networkMode, List domainIds, List zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol, + Boolean forTungsten, boolean forNsx, boolean forNetris, NetworkOffering.NetworkMode networkMode, List domainIds, List zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol, NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber); Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP, - String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, boolean forNsx) + String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, Provider provider) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException; void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException; @@ -235,7 +185,6 @@ Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetwor /** * Release dedicated virtual ip ranges of a domain. * - * @param domainId * @return success/failure */ boolean releaseDomainSpecificVirtualRanges(Domain domain); @@ -243,7 +192,6 @@ Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetwor /** * Release dedicated virtual ip ranges of an account. * - * @param accountId * @return success/failure */ boolean releaseAccountSpecificVirtualRanges(Account account); @@ -251,16 +199,7 @@ Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetwor /** * Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system. * - * @param id - * @param name - * @param startIp - * @param endIp - * @param gateway - * @param netmask - * @param allocationState * @return Pod - * @throws - * @throws */ Pod editPod(long id, String name, String startIp, String endIp, String gateway, String netmask, String allocationState); diff --git a/engine/components-api/src/main/java/com/cloud/event/UsageEventUtils.java b/engine/components-api/src/main/java/com/cloud/event/UsageEventUtils.java index 51d0846fafbc..1c88c7df124c 100644 --- a/engine/components-api/src/main/java/com/cloud/event/UsageEventUtils.java +++ b/engine/components-api/src/main/java/com/cloud/event/UsageEventUtils.java @@ -25,14 +25,16 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; +import com.cloud.network.Network; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; + import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.events.Event; import org.apache.cloudstack.framework.events.EventBus; import org.apache.cloudstack.framework.events.EventDistributor; -import org.apache.commons.collections.MapUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; import com.cloud.dc.DataCenterVO; import com.cloud.dc.dao.DataCenterDao; @@ -92,6 +94,14 @@ public static void publishUsageEvent(String usageType, long accountId, long zone } + public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, + Long size, String entityType, String entityUUID, Long vmId, boolean displayResource) { + if (displayResource) { + saveUsageEvent(usageType, accountId, zoneId, resourceId, offeringId, templateId, size, vmId, resourceName); + } + publishUsageEvent(usageType, accountId, zoneId, entityType, entityUUID); + } + public static void publishUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, Long size, Long virtualSize, String entityType, String entityUUID, Map details) { saveUsageEvent(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, size, virtualSize, details); @@ -200,6 +210,10 @@ public static void saveUsageEvent(String usageType, long accountId, long zoneId, s_usageEventDao.persist(new UsageEventVO(usageType, accountId, zoneId, vmId, securityGroupId)); } + public static void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, Long offeringId, Long templateId, Long size, Long vmId, String resourceName) { + s_usageEventDao.persist(new UsageEventVO(usageType, accountId, zoneId, resourceId, offeringId, templateId, size, vmId, resourceName)); + } + private static void publishUsageEvent(String usageEventType, Long accountId, Long zoneId, String resourceType, String resourceUUID) { String configKey = "publish.usage.events"; String value = s_configDao.getValue(configKey); @@ -243,4 +257,22 @@ private static void publishUsageEvent(String usageEventType, Long accountId, Lon static final String Name = "management-server"; + public static void publishNetworkCreation(Network network) { + publishUsageEvent(EventTypes.EVENT_NETWORK_CREATE, network.getAccountId(), network.getDataCenterId(), + network.getId(), network.getName(), network.getNetworkOfferingId(), null, null, null, network.getState().name(), + network.getUuid()); + } + + public static void publishNetworkUpdate(Network network) { + publishUsageEvent(EventTypes.EVENT_NETWORK_UPDATE, network.getAccountId(), network.getDataCenterId(), + network.getId(), network.getName(), network.getNetworkOfferingId(), null, network.getState().name(), + Network.class.getName(), network.getUuid(), true); + } + + public static void publishNetworkDeletion(Network network) { + publishUsageEvent(EventTypes.EVENT_NETWORK_DELETE, network.getAccountId(), network.getDataCenterId(), + network.getId(), network.getName(), network.getNetworkOfferingId(), null, null, null, + Network.class.getName(), network.getUuid()); + } + } diff --git a/engine/components-api/src/main/java/com/cloud/ha/HighAvailabilityManager.java b/engine/components-api/src/main/java/com/cloud/ha/HighAvailabilityManager.java index ddc8153d7398..53bfcce27038 100644 --- a/engine/components-api/src/main/java/com/cloud/ha/HighAvailabilityManager.java +++ b/engine/components-api/src/main/java/com/cloud/ha/HighAvailabilityManager.java @@ -21,6 +21,7 @@ import com.cloud.deploy.DeploymentPlanner; import com.cloud.host.HostVO; import com.cloud.host.Status; +import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.component.Manager; import com.cloud.vm.VMInstanceVO; import org.apache.cloudstack.framework.config.ConfigKey; @@ -32,6 +33,8 @@ */ public interface HighAvailabilityManager extends Manager { + List LIBVIRT_STORAGE_POOL_TYPES_WITH_HA_SUPPORT = List.of(StoragePoolType.NetworkFilesystem, StoragePoolType.SharedMountPoint); + ConfigKey ForceHA = new ConfigKey<>("Advanced", Boolean.class, "force.ha", "false", "Force High-Availability to happen even if the VM says no.", true, Cluster); @@ -72,10 +75,10 @@ public interface HighAvailabilityManager extends Manager { + " which are registered for the HA event that were successful and are now ready to be purged.", true, Cluster); - public static final ConfigKey KvmHAFenceHostIfHeartbeatFailsOnStorage = new ConfigKey<>("Advanced", Boolean.class, "kvm.ha.fence.on.storage.heartbeat.failure", "false", + ConfigKey KvmHAFenceHostIfHeartbeatFailsOnStorage = new ConfigKey<>("Advanced", Boolean.class, "kvm.ha.fence.on.storage.heartbeat.failure", "false", "Proceed fencing the host even the heartbeat failed for only one storage pool", false, ConfigKey.Scope.Zone); - public enum WorkType { + enum WorkType { Migration, // Migrating VMs off of a host. Stop, // Stops a VM for storage pool migration purposes. This should be obsolete now. CheckStop, // Checks if a VM has been stopped. diff --git a/engine/components-api/src/main/java/com/cloud/hypervisor/ExternalProvisioner.java b/engine/components-api/src/main/java/com/cloud/hypervisor/ExternalProvisioner.java new file mode 100644 index 000000000000..c574a8be0175 --- /dev/null +++ b/engine/components-api/src/main/java/com/cloud/hypervisor/ExternalProvisioner.java @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.hypervisor; + +import java.util.Map; + +import com.cloud.agent.api.GetExternalConsoleAnswer; +import com.cloud.agent.api.GetExternalConsoleCommand; +import com.cloud.agent.api.HostVmStateReportEntry; +import com.cloud.agent.api.PrepareExternalProvisioningAnswer; +import com.cloud.agent.api.PrepareExternalProvisioningCommand; +import com.cloud.agent.api.RebootAnswer; +import com.cloud.agent.api.RebootCommand; +import com.cloud.agent.api.RunCustomActionAnswer; +import com.cloud.agent.api.RunCustomActionCommand; +import com.cloud.agent.api.StartAnswer; +import com.cloud.agent.api.StartCommand; +import com.cloud.agent.api.StopAnswer; +import com.cloud.agent.api.StopCommand; +import com.cloud.utils.component.Manager; + +public interface ExternalProvisioner extends Manager { + + String getExtensionsPath(); + + String getExtensionPath(String relativePath); + + String getChecksumForExtensionPath(String extensionName, String relativePath); + + void prepareExtensionPath(String extensionName, boolean userDefined, String extensionRelativePath); + + void cleanupExtensionPath(String extensionName, String extensionRelativePath); + + void cleanupExtensionData(String extensionName, int olderThanDays, boolean cleanupDirectory); + + PrepareExternalProvisioningAnswer prepareExternalProvisioning(String hostGuid, String extensionName, String extensionRelativePath, PrepareExternalProvisioningCommand cmd); + + StartAnswer startInstance(String hostGuid, String extensionName, String extensionRelativePath, StartCommand cmd); + + StopAnswer stopInstance(String hostGuid, String extensionName, String extensionRelativePath, StopCommand cmd); + + RebootAnswer rebootInstance(String hostGuid, String extensionName, String extensionRelativePath, RebootCommand cmd); + + StopAnswer expungeInstance(String hostGuid, String extensionName, String extensionRelativePath, StopCommand cmd); + + Map getHostVmStateReport(long hostId, String extensionName, String extensionRelativePath); + + GetExternalConsoleAnswer getInstanceConsole(String hostGuid, String extensionName, String extensionRelativePath, GetExternalConsoleCommand cmd); + + RunCustomActionAnswer runCustomAction(String hostGuid, String extensionName, String extensionRelativePath, RunCustomActionCommand cmd); +} diff --git a/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java b/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java index b1cad20b19ec..454cb10a2f2b 100644 --- a/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java @@ -288,4 +288,6 @@ List listAvailablePublicIps(final long dcId, PublicIpQuarantine updatePublicIpAddressInQuarantine(Long quarantineProcessId, Date endDate); void updateSourceNatIpAddress(IPAddressVO requestedIp, List userIps) throws Exception; + + Long getPreferredNetworkIdForPublicIpRuleAssignment(IpAddress ip, Long networkId); } diff --git a/engine/components-api/src/main/java/com/cloud/network/addr/PublicIp.java b/engine/components-api/src/main/java/com/cloud/network/addr/PublicIp.java index d69a72a02c5c..54a99fdf3677 100644 --- a/engine/components-api/src/main/java/com/cloud/network/addr/PublicIp.java +++ b/engine/components-api/src/main/java/com/cloud/network/addr/PublicIp.java @@ -40,7 +40,11 @@ public PublicIp(IPAddressVO addr, VlanVO vlan, long macAddress) { } public static PublicIp createFromAddrAndVlan(IPAddressVO addr, VlanVO vlan) { - return new PublicIp(addr, vlan, NetUtils.createSequenceBasedMacAddress(addr.getMacAddress(), NetworkModel.MACIdentifier.value())); + long macIdentifier = NetworkModel.MACIdentifier.valueIn(addr.getDataCenterId()); + if (macIdentifier == 0) { + macIdentifier = addr.getDataCenterId(); + } + return new PublicIp(addr, vlan, NetUtils.createSequenceBasedMacAddress(addr.getMacAddress(), macIdentifier)); } @Override @@ -275,5 +279,8 @@ public boolean isForSystemVms() { return false; } - + @Override + public boolean isForRouter() { + return _addr.isForRouter(); + } } diff --git a/engine/components-api/src/main/java/com/cloud/network/lb/LoadBalancingRulesManager.java b/engine/components-api/src/main/java/com/cloud/network/lb/LoadBalancingRulesManager.java index 669456cbdcc2..d8011e9ade12 100644 --- a/engine/components-api/src/main/java/com/cloud/network/lb/LoadBalancingRulesManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/lb/LoadBalancingRulesManager.java @@ -39,7 +39,7 @@ public interface LoadBalancingRulesManager { LoadBalancer createPublicLoadBalancer(String xId, String name, String description, int srcPort, int destPort, long sourceIpId, String protocol, String algorithm, - boolean openFirewall, CallContext caller, String lbProtocol, Boolean forDisplay, String cidrList) throws NetworkRuleConflictException; + boolean openFirewall, CallContext caller, String lbProtocol, Boolean forDisplay, String cidrList, Long networkId) throws NetworkRuleConflictException; boolean removeAllLoadBalanacersForIp(long ipId, Account caller, long callerUserId); diff --git a/engine/components-api/src/main/java/com/cloud/network/rules/RulesManager.java b/engine/components-api/src/main/java/com/cloud/network/rules/RulesManager.java index 79ffdfdb9737..5ba74402a4c6 100644 --- a/engine/components-api/src/main/java/com/cloud/network/rules/RulesManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/rules/RulesManager.java @@ -54,6 +54,8 @@ FirewallRule[] reservePorts(IpAddress ip, String protocol, FirewallRule.Purpose boolean disableStaticNat(long ipAddressId, Account caller, long callerUserId, boolean releaseIpIfElastic) throws ResourceUnavailableException; + boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke); + /** * @param networkId * @param continueOnError diff --git a/engine/components-api/src/main/java/com/cloud/network/vpc/NetworkACLManager.java b/engine/components-api/src/main/java/com/cloud/network/vpc/NetworkACLManager.java index de69b8941838..b192cd8d71c7 100644 --- a/engine/components-api/src/main/java/com/cloud/network/vpc/NetworkACLManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/vpc/NetworkACLManager.java @@ -93,5 +93,5 @@ public interface NetworkACLManager { boolean applyACLToPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException; - boolean reorderAclRules(VpcVO vpc, List networks, List networkACLItems); + boolean reorderAclRules(VpcVO vpc, List networks, List networkACLItems, Network.Provider networkProvider); } diff --git a/engine/components-api/src/main/java/com/cloud/network/vpc/VpcManager.java b/engine/components-api/src/main/java/com/cloud/network/vpc/VpcManager.java index 626c4da1bb19..792a3a6b397f 100644 --- a/engine/components-api/src/main/java/com/cloud/network/vpc/VpcManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/vpc/VpcManager.java @@ -195,4 +195,25 @@ public interface VpcManager { * @return */ boolean isSrcNatIpRequired(long vpcOfferingId); + + boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId); + + List getVpcStaticRoutes(Long vpcId); + + List getVpcStaticRoutes(List routes); + + boolean isProviderSupportServiceInVpc(long vpcId, Service service, Provider provider); + + IPAddressVO getIpAddressForVpcVr(Vpc vpc, IPAddressVO ipAddress, boolean allocateIpIfNeeded); + + boolean configStaticNatForVpcVr(Vpc vpc, IPAddressVO ipAddress); + + void reconfigStaticNatForVpcVr(Long vpcId); + + boolean applyStaticRouteForVpcVpnIfNeeded(Long vpcId, boolean updateAllVpn) throws ResourceUnavailableException; + + /** + * Returns true if the network is part of a VPC, and the VPC is created from conserve mode enabled VPC offering + */ + boolean isNetworkOnVpcEnabledConserveMode(Network network); } diff --git a/engine/components-api/src/main/java/com/cloud/resource/Discoverer.java b/engine/components-api/src/main/java/com/cloud/resource/Discoverer.java index a2bb5945a9d1..60b0167758c7 100644 --- a/engine/components-api/src/main/java/com/cloud/resource/Discoverer.java +++ b/engine/components-api/src/main/java/com/cloud/resource/Discoverer.java @@ -50,5 +50,4 @@ Map> find(long dcId, Long podId, L public void putParam(Map params); ServerResource reloadResource(HostVO host); - } diff --git a/engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java b/engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java index 3e65ddf78e29..4767e86e8ab8 100755 --- a/engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java +++ b/engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java @@ -21,6 +21,12 @@ import java.util.List; import java.util.Map; + +import com.cloud.offering.ServiceOffering; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import com.cloud.gpu.VgpuProfileVO; +import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; @@ -28,6 +34,7 @@ import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.agent.api.VgpuTypesInfo; import com.cloud.agent.api.to.GPUDeviceTO; +import com.cloud.cpu.CPU; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; import com.cloud.dc.PodCluster; @@ -50,8 +57,8 @@ public interface ResourceManager extends ResourceService, Configurable { ConfigKey KvmSshToAgentEnabled = new ConfigKey<>("Advanced", Boolean.class, "kvm.ssh.to.agent","true", - "Number of retries when preparing a host into Maintenance Mode is faulty before failing", - false); + "True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations", + true); ConfigKey HOST_MAINTENANCE_LOCAL_STRATEGY = new ConfigKey<>(String.class, "host.maintenance.local.storage.strategy", "Advanced","Error", @@ -61,6 +68,22 @@ public interface ResourceManager extends ResourceService, Configurable { + "To force-stop VMs, choose 'ForceStop' strategy", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "Error,Migration,ForceStop"); + ConfigKey SystemVmPreferredArchitecture = new ConfigKey<>( + String.class, + "system.vm.preferred.architecture", + "Advanced", + CPU.CPUArch.getDefault().getType(), + "Preferred architecture for the system VMs including virtual routers", + true, + ConfigKey.Scope.Zone, null, null, null, null, null, + ConfigKey.Kind.Select, + "," + CPU.CPUArch.getTypesAsCSV()); + + ConfigKey SystemVMDefaultHypervisor = new ConfigKey(String.class, + "system.vm.default.hypervisor", "Advanced", "Any", "Hypervisor type used to create System VMs. Valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, " + + "Parralels, BareMetal, Ovm, LXC, Any", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "XenServer, KVM, VMware, Hyperv, " + + "VirtualBox, Parralels, BareMetal, Ovm, LXC, Any"); + /** * Register a listener for different types of resource life cycle events. * There can only be one type of listener per type of host. @@ -99,6 +122,8 @@ public interface ResourceManager extends ResourceService, Configurable { public boolean executeUserRequest(long hostId, ResourceState.Event event) throws AgentUnavailableException; + boolean executeUserRequest(long hostId, ResourceState.Event event, boolean isForced, boolean isForceDeleteStorage) throws AgentUnavailableException; + boolean resourceStateTransitTo(Host host, Event event, long msId) throws NoTransitionException; boolean umanageHost(long hostId); @@ -144,6 +169,8 @@ public interface ResourceManager extends ResourceService, Configurable { public HostVO findHostByGuid(String guid); + HostVO findHostByGuidPrefix(String guid); + public HostVO findHostByName(String name); HostStats getHostStatistics(Host host); @@ -180,29 +207,34 @@ public interface ResourceManager extends ResourceService, Configurable { */ boolean isHostGpuEnabled(long hostId); + boolean isGPUDeviceAvailable(ServiceOffering offering, Host host, Long vmId); + /** - * Check if host has GPU devices available - * @param hostId the host to be checked - * @param groupName: gpuCard name - * @param vgpuType the VGPU type - * @return true when the host has the capacity with given VGPU type + * Get available GPU device + * + * @param vm the vm for which GPU device is requested + * @param vgpuProfile the VGPU profile + * @param gpuCount + * @return GPUDeviceTO[] */ - boolean isGPUDeviceAvailable(Host host, String groupName, String vgpuType); + GPUDeviceTO getGPUDevice(VirtualMachine vm, long hostId, VgpuProfileVO vgpuProfile, int gpuCount); /** * Get available GPU device - * @param hostId the host to be checked - * @param groupName: gpuCard name - * @param vgpuType the VGPU type + * + * @param hostId the host to be checked + * @param groupName gpuCard name + * @param vgpuType the VGPU type * @return GPUDeviceTO[] */ GPUDeviceTO getGPUDevice(long hostId, String groupName, String vgpuType); /** * Return listof available GPU devices - * @param hostId, the host to be checked - * @param groupName: gpuCard name - * @param vgpuType the VGPU type + * + * @param hostId the host to be checked + * @param groupName gpuCard name + * @param vgpuType the VGPU type * @return List of HostGpuGroupsVO. */ List listAvailableGPUDevice(long hostId, String groupName, String vgpuType); @@ -214,6 +246,16 @@ public interface ResourceManager extends ResourceService, Configurable { */ void updateGPUDetails(long hostId, HashMap> groupDetails); + /** + * Update GPU device details (post VM deployment) + * + * @param vm the VirtualMachine object + * @param gpuDeviceTO GPU device details + */ + void updateGPUDetailsForVmStop(VirtualMachine vm, GPUDeviceTO gpuDeviceTO); + + void updateGPUDetailsForVmStart(long hostId, long vmId, GPUDeviceTO gpuDevice); + /** * Get GPU details for a host * @param host, the Host object @@ -224,4 +266,12 @@ public interface ResourceManager extends ResourceService, Configurable { HostVO findOneRandomRunningHostByHypervisor(HypervisorType type, Long dcId); boolean cancelMaintenance(final long hostId); + + void updateStoragePoolConnectionsOnHosts(Long poolId, List storageAccessGroups); + + List getEligibleUpHostsInClusterForStorageConnection(PrimaryDataStoreInfo primaryStore); + + List getEligibleUpAndEnabledHostsInClusterForStorageConnection(PrimaryDataStoreInfo primaryStore); + + List getEligibleUpAndEnabledHostsInZoneForStorageConnection(DataStore dataStore, long zoneId, HypervisorType hypervisorType); } diff --git a/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java b/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java index 46f796b4f782..3c62738f9ed5 100644 --- a/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java +++ b/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java @@ -161,28 +161,28 @@ public interface StorageManager extends StorageService { ConfigKey.Scope.StoragePool, null); - ConfigKey PRIMARY_STORAGE_DOWNLOAD_WAIT = new ConfigKey("Storage", Integer.class, "primary.storage.download.wait", "10800", + ConfigKey PRIMARY_STORAGE_DOWNLOAD_WAIT = new ConfigKey<>("Storage", Integer.class, "primary.storage.download.wait", "10800", "In second, timeout for download template to primary storage", false); - ConfigKey SecStorageMaxMigrateSessions = new ConfigKey("Advanced", Integer.class, "secstorage.max.migrate.sessions", "2", + ConfigKey SecStorageMaxMigrateSessions = new ConfigKey<>("Advanced", Integer.class, "secstorage.max.migrate.sessions", "2", "The max number of concurrent copy command execution sessions that an SSVM can handle", false, ConfigKey.Scope.Global); - ConfigKey SecStorageVMAutoScaleDown = new ConfigKey("Advanced", Boolean.class, "secstorage.vm.auto.scale.down", "false", + ConfigKey SecStorageVMAutoScaleDown = new ConfigKey<>("Advanced", Boolean.class, "secstorage.vm.auto.scale.down", "false", "Setting this to 'true' will auto scale down SSVMs", true, ConfigKey.Scope.Global); - ConfigKey MaxDataMigrationWaitTime = new ConfigKey("Advanced", Integer.class, "max.data.migration.wait.time", "15", + ConfigKey MaxDataMigrationWaitTime = new ConfigKey<>("Advanced", Integer.class, "max.data.migration.wait.time", "15", "Maximum wait time (in minutes) for a data migration task before spawning a new SSVM", false, ConfigKey.Scope.Global); - ConfigKey DiskProvisioningStrictness = new ConfigKey("Storage", Boolean.class, "disk.provisioning.type.strictness", "false", + ConfigKey DiskProvisioningStrictness = new ConfigKey<>("Storage", Boolean.class, "disk.provisioning.type.strictness", "false", "If set to true, the disk is created only when there is a suitable storage pool that supports the disk provisioning type specified by the service/disk offering. " + "If set to false, the disk is created with a disk provisioning type supported by the pool. Default value is false, and this is currently supported for VMware only.", true, ConfigKey.Scope.Zone); - ConfigKey PreferredStoragePool = new ConfigKey(String.class, "preferred.storage.pool", "Advanced", "", + ConfigKey PreferredStoragePool = new ConfigKey<>(String.class, "preferred.storage.pool", "Advanced", "", "The UUID of preferred storage pool for allocation.", true, ConfigKey.Scope.Account, null); ConfigKey MountDisabledStoragePool = new ConfigKey<>(Boolean.class, "mount.disabled.storage.pool", "Storage", - "false", + Boolean.TRUE.toString(), "Mount all zone-wide or cluster-wide disabled storage pools after node reboot", true, ConfigKey.Scope.Cluster, @@ -203,7 +203,7 @@ public interface StorageManager extends StorageService { true, ConfigKey.Scope.Global, null); - static final ConfigKey DataStoreDownloadFollowRedirects = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, + ConfigKey DataStoreDownloadFollowRedirects = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Boolean.class, "store.download.follow.redirects", "false", "Whether HTTP redirect is followed during store downloads for objects such as template, volume etc.", true, ConfigKey.Scope.Global); @@ -211,7 +211,7 @@ public interface StorageManager extends StorageService { ConfigKey HEURISTICS_SCRIPT_TIMEOUT = new ConfigKey<>("Advanced", Long.class, "heuristics.script.timeout", "3000", "The maximum runtime, in milliseconds, to execute the heuristic rule; if it is reached, a timeout will happen.", true); - ConfigKey AllowVolumeReSizeBeyondAllocation = new ConfigKey("Advanced", Boolean.class, "volume.resize.allowed.beyond.allocation", "false", + ConfigKey AllowVolumeReSizeBeyondAllocation = new ConfigKey<>("Advanced", Boolean.class, "volume.resize.allowed.beyond.allocation", "false", "Determines whether volume size can exceed the pool capacity allocation disable threshold (pool.storage.allocated.capacity.disablethreshold) " + "when resize a volume upto resize capacity disable threshold (pool.storage.allocated.resize.capacity.disablethreshold)", true, List.of(ConfigKey.Scope.StoragePool, ConfigKey.Scope.Zone)); @@ -220,9 +220,22 @@ public interface StorageManager extends StorageService { "storage.pool.host.connect.workers", "1", "Number of worker threads to be used to connect hosts to a primary storage", true); + ConfigKey ObjectStorageCapacityThreshold = new ConfigKey<>("Alert", Float.class, + "objectStorage.capacity.notificationthreshold", + "0.75", + "Percentage (as a value between 0 and 1) of object storage utilization above which alerts will be sent about low storage available.", + true, + ConfigKey.Scope.Global, + null); + + ConfigKey COPY_TEMPLATES_FROM_OTHER_SECONDARY_STORAGES = new ConfigKey<>(Boolean.class, "copy.templates.from.other.secondary.storages", + "Storage", "true", "When enabled, this feature allows templates to be copied from existing Secondary Storage servers (within the same zone or across zones) " + + "while adding a new Secondary Storage. If the copy operation fails, the system falls back to downloading the template from the source URL.", + true, ConfigKey.Scope.Zone, null); + /** * should we execute in sequence not involving any storages? - * @return tru if commands should execute in sequence + * @return true if commands should execute in sequence */ static boolean shouldExecuteInSequenceOnVmware() { return shouldExecuteInSequenceOnVmware(null, null); @@ -244,14 +257,14 @@ static Boolean getFullCloneConfiguration(Long storeId) { /** * Returns a comma separated list of tags for the specified storage pool - * @param poolId + * @param poolId the id of the pool to get tags for * @return comma separated list of tags */ String getStoragePoolTags(long poolId); /** * Returns a list of Strings with tags for the specified storage pool - * @param poolId + * @param poolId the id of the pool to get tags for * @return comma separated list of tags */ List getStoragePoolTagList(long poolId); @@ -268,7 +281,7 @@ static Boolean getFullCloneConfiguration(Long storeId) { Pair sendToPool(StoragePool pool, long[] hostIdsToTryFirst, List hostIdsToAvoid, Command cmd) throws StorageUnavailableException; - public Answer getVolumeStats(StoragePool pool, Command cmd); + Answer getVolumeStats(StoragePool pool, Command cmd); boolean canPoolProvideStorageStats(StoragePool pool); @@ -294,6 +307,8 @@ static Boolean getFullCloneConfiguration(Long storeId) { Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst, Command cmd) throws StorageUnavailableException; + void updateStoragePoolHostVOAndBytes(StoragePool pool, long hostId, ModifyStoragePoolAnswer mspAnswer); + CapacityVO getSecondaryStorageUsedStats(Long hostId, Long zoneId); CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId, Long podId, Long zoneId); @@ -314,6 +329,8 @@ static Boolean getFullCloneConfiguration(Long storeId) { boolean canHostPrepareStoragePoolAccess(Host host, StoragePool pool); + boolean canDisconnectHostFromStoragePool(Host host, StoragePool pool); + Host getHost(long hostId); Host updateSecondaryStorage(long secStorageId, String newUrl); @@ -408,4 +425,11 @@ void connectHostsToPool(DataStore primaryStore, List hostIds, Scope scope, void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List childDatastoreAnswerList); + boolean checkIfHostAndStoragePoolHasCommonStorageAccessGroups(Host host, StoragePool pool); + + Pair checkIfReadyVolumeFitsInStoragePoolWithStorageAccessGroups(StoragePool destPool, Volume volume); + + String[] getStorageAccessGroups(Long zoneId, Long podId, Long clusterId, Long hostId); + + CapacityVO getObjectStorageUsedStats(Long zoneId); } diff --git a/engine/components-api/src/main/java/com/cloud/template/TemplateManager.java b/engine/components-api/src/main/java/com/cloud/template/TemplateManager.java index b8912526fdf2..f1891c774edd 100644 --- a/engine/components-api/src/main/java/com/cloud/template/TemplateManager.java +++ b/engine/components-api/src/main/java/com/cloud/template/TemplateManager.java @@ -29,6 +29,7 @@ import com.cloud.deploy.DeployDestination; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.StorageUnavailableException; +import com.cloud.hypervisor.Hypervisor; import com.cloud.storage.DataStoreRole; import com.cloud.storage.Storage.TemplateType; import com.cloud.storage.StoragePool; @@ -46,7 +47,7 @@ public interface TemplateManager { static final String TemplatePreloaderPoolSizeCK = "template.preloader.pool.size"; static final ConfigKey AllowPublicUserTemplates = new ConfigKey("Advanced", Boolean.class, AllowPublicUserTemplatesCK, "true", - "If false, users will not be able to create public templates.", true, ConfigKey.Scope.Account); + "If false, users will not be able to create public Templates.", true, ConfigKey.Scope.Account); static final ConfigKey TemplatePreloaderPoolSize = new ConfigKey("Advanced", Integer.class, TemplatePreloaderPoolSizeCK, "8", "Size of the TemplateManager threadpool", false, ConfigKey.Scope.Global); @@ -56,6 +57,13 @@ public interface TemplateManager { + "will validate if the provided URL is resolvable during the register of templates/ISOs before persisting them in the database.", true); + ConfigKey TemplateDeleteFromPrimaryStorage = new ConfigKey("Advanced", + Boolean.class, + "template.delete.from.primary.storage", "true", + "Template when deleted will be instantly deleted from the Primary Storage", + true, + ConfigKey.Scope.Global); + static final String VMWARE_TOOLS_ISO = "vmware-tools.iso"; static final String XS_TOOLS_ISO = "xs-tools.iso"; @@ -103,6 +111,8 @@ public interface TemplateManager { */ List getUnusedTemplatesInPool(StoragePoolVO pool); + void evictTemplateFromStoragePoolsForZones(Long templateId, List zoneId); + /** * Deletes a template in the specified storage pool. * @@ -141,7 +151,9 @@ public interface TemplateManager { public static final String MESSAGE_REGISTER_PUBLIC_TEMPLATE_EVENT = "Message.RegisterPublicTemplate.Event"; public static final String MESSAGE_RESET_TEMPLATE_PERMISSION_EVENT = "Message.ResetTemplatePermission.Event"; - TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean isCrossZones); + TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean isCrossZones, Hypervisor.HypervisorType hypervisorType); + + DataStore verifyHeuristicRulesForZone(VMTemplateVO template, Long zoneId); List getTemplateDisksOnImageStore(VirtualMachineTemplate template, DataStoreRole role, String configurationId); diff --git a/engine/components-api/src/main/java/com/cloud/vm/VirtualMachineProfileImpl.java b/engine/components-api/src/main/java/com/cloud/vm/VirtualMachineProfileImpl.java index a1c54b90328b..29b96dcc917a 100644 --- a/engine/components-api/src/main/java/com/cloud/vm/VirtualMachineProfileImpl.java +++ b/engine/components-api/src/main/java/com/cloud/vm/VirtualMachineProfileImpl.java @@ -40,7 +40,7 @@ public class VirtualMachineProfileImpl implements VirtualMachineProfile { VirtualMachine _vm; ServiceOffering _offering; VirtualMachineTemplate _template; - UserVmDetailVO _userVmDetails; + VMInstanceDetailVO _userVmDetails; Map _params; List _nics = new ArrayList(); List _disks = new ArrayList(); diff --git a/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java b/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java index bd6b52d261fa..e4fdc0c4f375 100644 --- a/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java +++ b/engine/components-api/src/main/java/com/cloud/vm/VmWorkSerializer.java @@ -61,7 +61,6 @@ public static String serialize(VmWork work) { // use java binary serialization instead // return JobSerializerHelper.toObjectSerializedString(work); - // return s_gson.toJson(work); } public static T deserialize(Class clazz, String workInJsonText) { @@ -69,6 +68,5 @@ public static T deserialize(Class clazz, String workInJson // use java binary serialization instead // return (T)JobSerializerHelper.fromObjectSerializedString(workInJsonText); - // return (T)s_gson.fromJson(workInJsonText, clazz); } } diff --git a/engine/components-api/src/main/java/com/cloud/vm/VmWorkTakeVolumeSnapshot.java b/engine/components-api/src/main/java/com/cloud/vm/VmWorkTakeVolumeSnapshot.java index 8474052be201..88d25441e0ac 100644 --- a/engine/components-api/src/main/java/com/cloud/vm/VmWorkTakeVolumeSnapshot.java +++ b/engine/components-api/src/main/java/com/cloud/vm/VmWorkTakeVolumeSnapshot.java @@ -30,12 +30,12 @@ public class VmWorkTakeVolumeSnapshot extends VmWork { private boolean quiesceVm; private Snapshot.LocationType locationType; private boolean asyncBackup; - + private List poolIds; private List zoneIds; public VmWorkTakeVolumeSnapshot(long userId, long accountId, long vmId, String handlerName, Long volumeId, Long policyId, Long snapshotId, boolean quiesceVm, Snapshot.LocationType locationType, - boolean asyncBackup, List zoneIds) { + boolean asyncBackup, List zoneIds, List poolIds) { super(userId, accountId, vmId, handlerName); this.volumeId = volumeId; this.policyId = policyId; @@ -44,6 +44,7 @@ public VmWorkTakeVolumeSnapshot(long userId, long accountId, long vmId, String h this.locationType = locationType; this.asyncBackup = asyncBackup; this.zoneIds = zoneIds; + this.poolIds = poolIds; } public Long getVolumeId() { @@ -71,4 +72,8 @@ public boolean isAsyncBackup() { public List getZoneIds() { return zoneIds; } + + public List getPoolIds() { + return poolIds; + } } diff --git a/engine/components-api/src/main/java/com/cloud/vm/snapshot/VMSnapshotManager.java b/engine/components-api/src/main/java/com/cloud/vm/snapshot/VMSnapshotManager.java index a01d4ee5cae7..6831552b83db 100644 --- a/engine/components-api/src/main/java/com/cloud/vm/snapshot/VMSnapshotManager.java +++ b/engine/components-api/src/main/java/com/cloud/vm/snapshot/VMSnapshotManager.java @@ -31,7 +31,7 @@ public interface VMSnapshotManager extends VMSnapshotService, Manager { static final ConfigKey VMSnapshotExpireInterval = new ConfigKey("Advanced", Integer.class, "vmsnapshot.expire.interval", "-1", "VM Snapshot expire interval in hours", true, ConfigKey.Scope.Account); - ConfigKey VMSnapshotMax = new ConfigKey("Advanced", Integer.class, "vmsnapshot.max", "10", "Maximum vm snapshots for a single vm", true, ConfigKey.Scope.Global); + ConfigKey VMSnapshotMax = new ConfigKey("Advanced", Integer.class, "vmsnapshot.max", "10", "Maximum VM snapshots for a single VM", true, ConfigKey.Scope.Account); /** * Delete all VM snapshots belonging to one VM @@ -42,7 +42,7 @@ public interface VMSnapshotManager extends VMSnapshotService, Manager { boolean deleteAllVMSnapshots(long id, VMSnapshot.Type type); /** - * Sync VM snapshot state when VM snapshot in reverting or snapshoting or expunging state + * Sync VM snapshot state when VM snapshot in reverting or snapshotting or expunging state * Used for fullsync after agent connects * * @param vm, the VM in question @@ -54,5 +54,4 @@ public interface VMSnapshotManager extends VMSnapshotService, Manager { boolean hasActiveVMSnapshotTasks(Long vmId); RestoreVMSnapshotCommand createRestoreCommand(UserVmVO userVm, List vmSnapshotVOs); - } diff --git a/engine/components-api/src/test/java/com/cloud/vm/VmWorkTakeVolumeSnapshotTest.java b/engine/components-api/src/test/java/com/cloud/vm/VmWorkTakeVolumeSnapshotTest.java index feb7ee46aec5..f80ba9580d5d 100644 --- a/engine/components-api/src/test/java/com/cloud/vm/VmWorkTakeVolumeSnapshotTest.java +++ b/engine/components-api/src/test/java/com/cloud/vm/VmWorkTakeVolumeSnapshotTest.java @@ -26,8 +26,9 @@ public class VmWorkTakeVolumeSnapshotTest { @Test public void testVmWorkTakeVolumeSnapshotZoneIds() { List zoneIds = List.of(10L, 20L); + List poolIds = List.of(10L, 20L); VmWorkTakeVolumeSnapshot work = new VmWorkTakeVolumeSnapshot(1L, 1L, 1L, "handler", - 1L, 1L, 1L, false, null, false, zoneIds); + 1L, 1L, 1L, false, null, false, zoneIds, poolIds); Assert.assertNotNull(work.getZoneIds()); Assert.assertEquals(zoneIds.size(), work.getZoneIds().size()); Assert.assertEquals(zoneIds.get(0), work.getZoneIds().get(0)); diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml index 437c98dac877..fda63d2558b0 100755 --- a/engine/orchestration/pom.xml +++ b/engine/orchestration/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml @@ -73,6 +73,11 @@ cloud-plugin-maintenance ${project.version} + + org.apache.cloudstack + cloud-plugin-hypervisor-external + ${project.version} + diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java index 30a58d405c9e..0a6bbc876544 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java @@ -32,7 +32,11 @@ import java.util.concurrent.TimeUnit; import com.cloud.agent.api.CleanupPersistentNetworkResourceCommand; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.Pair; +import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.agent.lb.SetupMSListCommand; +import org.apache.cloudstack.command.ReconcileAnswer; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import org.apache.logging.log4j.Logger; @@ -114,6 +118,7 @@ public int compare(final Object o1, final Object o2) { protected final long _id; protected String _uuid; protected String _name = null; + protected HypervisorType _hypervisorType; protected final ConcurrentHashMap _waitForList; protected final LinkedList _requests; protected Long _currentSequence; @@ -135,10 +140,11 @@ public int compare(final Object o1, final Object o2) { Arrays.sort(s_commandsNotAllowedInConnectingMode); } - protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final boolean maintenance) { + protected AgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final HypervisorType hypervisorType, final boolean maintenance) { _id = id; _uuid = uuid; _name = name; + _hypervisorType = hypervisorType; _waitForList = new ConcurrentHashMap(); _currentSequence = null; _maintenance = maintenance; @@ -261,6 +267,10 @@ public String getName() { return _name; } + public HypervisorType get_hypervisorType() { + return _hypervisorType; + } + public int getQueueSize() { return _requests.size(); } @@ -406,10 +416,17 @@ public Answer[] send(final Request req, final int wait) throws AgentUnavailableE try { for (int i = 0; i < 2; i++) { Answer[] answers = null; - try { - answers = sl.waitFor(wait); - } catch (final InterruptedException e) { - logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Interrupted"); + Command[] cmds = req.getCommands(); + if (cmds != null && cmds.length == 1 && (cmds[0] != null) && cmds[0].isReconcile() + && !sl.isDisconnected() && _agentMgr.isReconcileCommandsEnabled(_hypervisorType)) { + // only available if (1) the only command is a Reconcile command (2) agent is connected; (3) reconciliation is enabled; (4) hypervisor is KVM; + answers = waitForAnswerOfReconcileCommand(sl, seq, cmds[0], wait); + } else { + try { + answers = sl.waitFor(wait); + } catch (final InterruptedException e) { + logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Interrupted"); + } } if (answers != null) { new Response(req, answers).logD("Received: ", false); @@ -428,11 +445,13 @@ public Answer[] send(final Request req, final int wait) throws AgentUnavailableE if (current != null && seq != current) { logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Waited too long."); + _agentMgr.updateReconcileCommandsIfNeeded(req.getSequence(), req.getCommands(), Command.State.TIMED_OUT); throw new OperationTimedoutException(req.getCommands(), _id, seq, wait, false); } logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Waiting some more time because this is the current command"); } + _agentMgr.updateReconcileCommandsIfNeeded(req.getSequence(), req.getCommands(), Command.State.TIMED_OUT); throw new OperationTimedoutException(req.getCommands(), _id, seq, wait * 2, true); } catch (OperationTimedoutException e) { logger.warn(LOG_SEQ_FORMATTED_STRING, seq, "Timed out on " + req.toString()); @@ -449,12 +468,57 @@ public Answer[] send(final Request req, final int wait) throws AgentUnavailableE if (req.executeInSequence() && (current != null && current == seq)) { sendNext(seq); } + _agentMgr.updateReconcileCommandsIfNeeded(req.getSequence(), req.getCommands(), Command.State.TIMED_OUT); throw new OperationTimedoutException(req.getCommands(), _id, seq, wait, false); } finally { unregisterListener(seq); } } + private Answer[] waitForAnswerOfReconcileCommand(SynchronousListener sl, final long seq, final Command command, final int wait) { + Answer[] answers = null; + int waitTimeLeft = wait; + while (waitTimeLeft > 0) { + int waitTime = Math.min(waitTimeLeft, _agentMgr.getReconcileInterval()); + logger.debug(String.format("Waiting %s seconds for the answer of reconcile command %s-%s", waitTime, seq, command)); + if (sl.isDisconnected()) { + logger.debug(String.format("Disconnected while waiting for the answer of reconcile command %s-%s", seq, command)); + break; + } + try { + answers = sl.waitFor(waitTime); + } catch (final InterruptedException e) { + logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Interrupted"); + } + if (answers != null) { + break; + } + + logger.debug(String.format("Getting the answer of reconcile command from cloudstack database for %s-%s", seq, command)); + Pair commandInfo = _agentMgr.getStateAndAnswerOfReconcileCommand(seq, command); + if (commandInfo == null) { + logger.debug(String.format("Cannot get the answer of reconcile command from cloudstack database for %s-%s", seq, command)); + continue; + } + Command.State state = commandInfo.first(); + if (Command.State.INTERRUPTED.equals(state)) { + logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Interrupted by agent, will reconcile it"); + throw new CloudRuntimeException("Interrupted by agent"); + } else if (Command.State.DANGLED_IN_BACKEND.equals(state)) { + logger.debug(LOG_SEQ_FORMATTED_STRING, seq, "Dangling in backend, it seems the agent was restarted, will reconcile it"); + throw new CloudRuntimeException("It is not being processed by agent"); + } + Answer answer = commandInfo.second(); + logger.debug(String.format("Got the answer of reconcile command from cloudstack database for %s-%s: %s", seq, command, answer)); + if (answer != null && !(answer instanceof ReconcileAnswer)) { + answers = new Answer[] { answer }; + break; + } + waitTimeLeft -= waitTime; + } + return answers; + } + protected synchronized void sendNext(final long seq) { _currentSequence = null; if (_requests.isEmpty()) { diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index 6d4bcb7b0d9b..1215829d92f8 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; @@ -41,8 +42,13 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.utils.StringUtils; import org.apache.cloudstack.agent.lb.IndirectAgentLB; import org.apache.cloudstack.ca.CAManager; +import org.apache.cloudstack.command.ReconcileCommandService; +import org.apache.cloudstack.command.ReconcileCommandUtils; +import org.apache.cloudstack.command.ReconcileCommandVO; +import org.apache.cloudstack.command.dao.ReconcileCommandDao; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; @@ -55,10 +61,10 @@ import org.apache.cloudstack.management.ManagementServerHost; import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao; import org.apache.cloudstack.utils.identity.ManagementServerNode; -import org.apache.commons.collections.MapUtils; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.logging.log4j.ThreadContext; import com.cloud.agent.AgentManager; @@ -177,6 +183,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl protected HighAvailabilityManager _haMgr = null; @Inject protected AlertManager _alertMgr = null; + @Inject + protected ReconcileCommandService reconcileCommandService; + @Inject + ReconcileCommandDao reconcileCommandDao; @Inject protected HypervisorGuruManager _hvGuruMgr; @@ -207,6 +217,9 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl private final ConcurrentHashMap newAgentConnections = new ConcurrentHashMap<>(); protected ScheduledExecutorService newAgentConnectionsMonitor; + private boolean _reconcileCommandsEnabled = false; + private Integer _reconcileCommandInterval; + @Inject ResourceManager _resourceMgr; @Inject @@ -223,6 +236,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl "Number of maximum concurrent new connections server allows for remote (indirect) agents. " + "If set to zero (default value) then no limit will be enforced on concurrent new connections", false); + protected final ConfigKey RemoteAgentNewConnectionsMonitorInterval = new ConfigKey<>("Advanced", Integer.class, "agent.connections.monitor.interval", "1800", + "Time in seconds to monitor the new agent connections and cleanup the expired connections.", false); protected final ConfigKey AlertWait = new ConfigKey<>("Advanced", Integer.class, "alert.wait", "1800", "Seconds to wait before alerting on a disconnected agent", true); protected final ConfigKey DirectAgentLoadSize = new ConfigKey<>("Advanced", Integer.class, "direct.agent.load.size", "16", @@ -234,6 +249,11 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl protected final ConfigKey CheckTxnBeforeSending = new ConfigKey<>("Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false", "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true); + public static final List HOST_DOWN_ALERT_UNSUPPORTED_HOST_TYPES = Arrays.asList( + Host.Type.SecondaryStorage, + Host.Type.ConsoleProxy + ); + @Override public boolean configure(final String name, final Map params) throws ConfigurationException { @@ -255,8 +275,6 @@ public boolean configure(final String name, final Map params) th _executor = new ThreadPoolExecutor(agentTaskThreads, agentTaskThreads, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("AgentTaskPool")); - initConnectExecutor(); - maxConcurrentNewAgentConnections = RemoteAgentMaxConcurrentNewConnections.value(); _connection = new NioServer("AgentManager", Port.value(), Workers.value() + 10, @@ -273,6 +291,9 @@ public boolean configure(final String name, final Map params) th initializeCommandTimeouts(); + _reconcileCommandsEnabled = ReconcileCommandService.ReconcileCommandsEnabled.value(); + _reconcileCommandInterval = ReconcileCommandService.ReconcileCommandsInterval.value(); + return true; } @@ -641,7 +662,13 @@ public Answer[] send(final Long hostId, final Commands commands, int timeout) th final Request req = new Request(hostId, agent.getName(), _nodeId, cmds, commands.stopOnError(), true); req.setSequence(agent.getNextSequence()); + + reconcileCommandService.persistReconcileCommands(hostId, req.getSequence(), cmds); + final Answer[] answers = agent.send(req, wait); + + reconcileCommandService.processAnswers(req.getSequence(), cmds, answers); + notifyAnswersToMonitors(hostId, req.getSequence(), answers); commands.setAnswers(answers); return answers; @@ -650,17 +677,17 @@ public Answer[] send(final Long hostId, final Commands commands, int timeout) th protected Status investigate(final AgentAttache agent) { final Long hostId = agent.getId(); final HostVO host = _hostDao.findById(hostId); - if (host != null && host.getType() != null && !host.getType().isVirtual()) { - logger.debug("Checking if agent ({}) is alive", host); - final Answer answer = easySend(hostId, new CheckHealthCommand()); - if (answer != null && answer.getResult()) { - final Status status = Status.Up; - logger.debug("Agent ({}) responded to checkHealthCommand, reporting that agent is {}", host, status); - return status; - } - return _haMgr.investigate(hostId); + if (host == null || host.getType() == null || host.getType().isVirtual()) { + return Status.Alert; + } + logger.debug("Checking if agent ({}) is alive", host); + final Answer answer = easySend(hostId, new CheckHealthCommand()); + if (answer != null && answer.getResult()) { + final Status status = Status.Up; + logger.debug("Agent ({}) responded to checkHealthCommand, reporting that agent is {}", host, status); + return status; } - return Status.Alert; + return _haMgr.investigate(hostId); } protected AgentAttache getAttache(final Long hostId) throws AgentUnavailableException { @@ -732,15 +759,15 @@ public void notifyMonitorsOfNewlyAddedHost(long hostId) { } } - protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, final StartupCommand[] cmd, final boolean forRebalance) throws ConnectionException { + protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, final StartupCommand[] cmds, final boolean forRebalance) throws ConnectionException { final long hostId = attache.getId(); final HostVO host = _hostDao.findById(hostId); for (final Pair monitor : _hostMonitors) { logger.debug("Sending Connect to listener: {}, for rebalance: {}", monitor.second().getClass().getSimpleName(), forRebalance); - for (int i = 0; i < cmd.length; i++) { + for (StartupCommand cmd : cmds) { try { - logger.debug("process connection to issue: {} for host: {}, forRebalance: {}, connection transferred: {}", ReflectionToStringBuilderUtils.reflectCollection(cmd[i]), hostId, forRebalance, cmd[i].isConnectionTransferred()); - monitor.second().processConnect(host, cmd[i], forRebalance); + logger.debug("process connection to issue: {} for host: {}, forRebalance: {}", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(cmd, "id", "type", "msHostList", "connectionTransferred"), hostId, forRebalance); + monitor.second().processConnect(host, cmd, forRebalance); } catch (final ConnectionException ce) { if (ce.isSetupError()) { logger.warn("Monitor {} says there is an error in the connect process for {} due to {}", monitor.second().getClass().getSimpleName(), hostId, ce.getMessage()); @@ -776,11 +803,48 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi Map detailsMap = readyAnswer.getDetailsMap(); if (detailsMap != null) { String uefiEnabled = detailsMap.get(Host.HOST_UEFI_ENABLE); + String virtv2vVersion = detailsMap.get(Host.HOST_VIRTV2V_VERSION); + String ovftoolVersion = detailsMap.get(Host.HOST_OVFTOOL_VERSION); + String vddkSupport = detailsMap.get(Host.HOST_VDDK_SUPPORT); + String vddkLibDir = detailsMap.get(Host.HOST_VDDK_LIB_DIR); + String vddkVersion = detailsMap.get(Host.HOST_VDDK_VERSION); logger.debug("Got HOST_UEFI_ENABLE [{}] for host [{}]:", uefiEnabled, host); - if (uefiEnabled != null) { + if (ObjectUtils.anyNotNull(uefiEnabled, virtv2vVersion, ovftoolVersion, vddkSupport, vddkLibDir, vddkVersion)) { _hostDao.loadDetails(host); - if (!uefiEnabled.equals(host.getDetails().get(Host.HOST_UEFI_ENABLE))) { + boolean updateNeeded = false; + if (StringUtils.isNotBlank(uefiEnabled) && !uefiEnabled.equals(host.getDetails().get(Host.HOST_UEFI_ENABLE))) { host.getDetails().put(Host.HOST_UEFI_ENABLE, uefiEnabled); + updateNeeded = true; + } + if (StringUtils.isNotBlank(virtv2vVersion) && !virtv2vVersion.equals(host.getDetails().get(Host.HOST_VIRTV2V_VERSION))) { + host.getDetails().put(Host.HOST_VIRTV2V_VERSION, virtv2vVersion); + updateNeeded = true; + } + if (StringUtils.isNotBlank(ovftoolVersion) && !ovftoolVersion.equals(host.getDetails().get(Host.HOST_OVFTOOL_VERSION))) { + host.getDetails().put(Host.HOST_OVFTOOL_VERSION, ovftoolVersion); + updateNeeded = true; + } + if (StringUtils.isNotBlank(vddkSupport) && !vddkSupport.equals(host.getDetails().get(Host.HOST_VDDK_SUPPORT))) { + host.getDetails().put(Host.HOST_VDDK_SUPPORT, vddkSupport); + updateNeeded = true; + } + if (!StringUtils.defaultString(vddkLibDir).equals(StringUtils.defaultString(host.getDetails().get(Host.HOST_VDDK_LIB_DIR)))) { + if (StringUtils.isBlank(vddkLibDir)) { + host.getDetails().remove(Host.HOST_VDDK_LIB_DIR); + } else { + host.getDetails().put(Host.HOST_VDDK_LIB_DIR, vddkLibDir); + } + updateNeeded = true; + } + if (!StringUtils.defaultString(vddkVersion).equals(StringUtils.defaultString(host.getDetails().get(Host.HOST_VDDK_VERSION)))) { + if (StringUtils.isBlank(vddkVersion)) { + host.getDetails().remove(Host.HOST_VDDK_VERSION); + } else { + host.getDetails().put(Host.HOST_VDDK_VERSION, vddkVersion); + } + updateNeeded = true; + } + if (updateNeeded) { _hostDao.saveDetails(host); } } @@ -801,6 +865,7 @@ public boolean start() { return true; } + initConnectExecutor(); startDirectlyConnectedHosts(false); if (_connection != null) { @@ -938,7 +1003,7 @@ protected boolean loadDirectlyConnectedHost(final HostVO host, final boolean for protected AgentAttache createAttacheForDirectConnect(final Host host, final ServerResource resource) { logger.debug("create DirectAgentAttache for {}", host); - final DirectAgentAttache attache = new DirectAgentAttache(this, host.getId(), host.getUuid(), host.getName(), resource, host.isInMaintenanceStates()); + final DirectAgentAttache attache = new DirectAgentAttache(this, host.getId(), host.getUuid(), host.getName(), host.getHypervisorType(), resource, host.isInMaintenanceStates()); AgentAttache old; synchronized (_agents) { @@ -999,39 +1064,50 @@ protected Status getNextStatusOnDisconnection(Host host, final Status.Event even protected boolean handleDisconnectWithoutInvestigation(final AgentAttache attache, final Status.Event event, final boolean transitState, final boolean removeAgent) { final long hostId = attache.getId(); - + final HostVO host = _hostDao.findById(hostId); boolean result = false; GlobalLock joinLock = getHostJoinLock(hostId); - if (joinLock.lock(60)) { - try { - logger.info("Host {} is disconnecting with event {}", - attache, event); - Status nextStatus; - final HostVO host = _hostDao.findById(hostId); - if (host == null) { - logger.warn("Can't find host with {} ({})", hostId, attache); - nextStatus = Status.Removed; - } else { - nextStatus = getNextStatusOnDisconnection(host, event); - caService.purgeHostCertificate(host); - } - logger.debug("Deregistering link for {} with state {}", attache, nextStatus); - - removeAgent(attache, nextStatus); - - if (host != null && transitState) { - // update the state for host in DB as per the event - disconnectAgent(host, event, _nodeId); - } - } finally { - joinLock.unlock(); + try { + if (!joinLock.lock(60)) { + logger.debug("Unable to acquire lock on host {} to process agent disconnection", Objects.toString(host, String.valueOf(hostId))); + return result; } + + logger.debug("Acquired lock on host {}, to process agent disconnection", Objects.toString(host, String.valueOf(hostId))); + disconnectHostAgent(attache, event, host, transitState, joinLock); result = true; + } finally { + joinLock.releaseRef(); } - joinLock.releaseRef(); + return result; } + private void disconnectHostAgent(final AgentAttache attache, final Status.Event event, final HostVO host, final boolean transitState, final GlobalLock joinLock) { + try { + logger.info("Host {} is disconnecting with event {}", attache, event); + final long hostId = attache.getId(); + Status nextStatus; + if (host == null) { + logger.warn("Can't find host with {} ({})", hostId, attache); + nextStatus = Status.Removed; + } else { + nextStatus = getNextStatusOnDisconnection(host, event); + caService.purgeHostCertificate(host); + } + logger.debug("Deregistering link for {} with state {}", attache, nextStatus); + + removeAgent(attache, nextStatus); + + if (host != null && transitState) { + // update the state for host in DB as per the event + disconnectAgent(host, event, _nodeId); + } + } finally { + joinLock.unlock(); + } + } + protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, Status.Event event) { final long hostId = attache.getId(); HostVO host = _hostDao.findById(hostId); @@ -1071,9 +1147,11 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, if (determinedState == Status.Down) { final String message = String.format("Host %s is down. Starting HA on the VMs", host); logger.error(message); - if (host.getType() != Host.Type.SecondaryStorage && host.getType() != Host.Type.ConsoleProxy) { - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), - host.getPodId(), String.format("Host down, %s", host), message); + if (Status.Down.equals(host.getStatus())) { + logger.debug(String.format("Skipping sending alert for %s as it already in %s state", + host, host.getStatus())); + } else if (!HOST_DOWN_ALERT_UNSUPPORTED_HOST_TYPES.contains(host.getType())) { + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host down, " + host.getId(), message); } event = Status.Event.HostDown; } else if (determinedState == Status.Up) { @@ -1121,6 +1199,7 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, host = _hostDao.findById(hostId); // Maybe the host magically reappeared? if (host != null && host.getStatus() == Status.Down) { _haMgr.scheduleRestartForVmsOnHost(host, true, HighAvailabilityManager.ReasonType.HostDown); + reconcileCommandService.updateReconcileCommandToInterruptedByHostId(hostId); } return true; } @@ -1283,7 +1362,7 @@ public boolean isAgentAttached(final long hostId) { protected AgentAttache createAttacheForConnect(final HostVO host, final Link link) { logger.debug("create ConnectedAgentAttache for {}", host); - final AgentAttache attache = new ConnectedAgentAttache(this, host.getId(), host.getUuid(), host.getName(), link, host.isInMaintenanceStates()); + final AgentAttache attache = new ConnectedAgentAttache(this, host.getId(), host.getUuid(), host.getName(), host.getHypervisorType(), link, host.isInMaintenanceStates()); link.attach(attache); AgentAttache old; @@ -1297,45 +1376,58 @@ protected AgentAttache createAttacheForConnect(final HostVO host, final Link lin return attache; } - private AgentAttache sendReadyAndGetAttache(HostVO host, ReadyCommand ready, Link link, StartupCommand[] startup) throws ConnectionException { - final List agentMSHostList = new ArrayList<>(); - String lbAlgorithm = null; - if (startup != null && startup.length > 0) { - final String agentMSHosts = startup[0].getMsHostList(); - if (StringUtils.isNotEmpty(agentMSHosts)) { - String[] msHosts = agentMSHosts.split("@"); - if (msHosts.length > 1) { - lbAlgorithm = msHosts[1]; - } - agentMSHostList.addAll(Arrays.asList(msHosts[0].split(","))); - } - } - ready.setArch(host.getArch().getType()); + private AgentAttache sendReadyAndGetAttache(HostVO host, ReadyCommand ready, Link link, StartupCommand[] startupCmds) throws ConnectionException { AgentAttache attache; GlobalLock joinLock = getHostJoinLock(host.getId()); - if (joinLock.lock(60)) { - try { + try { + if (!joinLock.lock(60)) { + throw new ConnectionException(true, String.format("Unable to acquire lock on host %s, to process agent connection", host)); + } + + logger.debug("Acquired lock on host {}, to process agent connection", host); + attache = connectHostAgent(host, ready, link, startupCmds, joinLock); + } finally { + joinLock.releaseRef(); + } - if (!indirectAgentLB.compareManagementServerList(host.getId(), host.getDataCenterId(), agentMSHostList, lbAlgorithm)) { - final List newMSList = indirectAgentLB.getManagementServerList(host.getId(), host.getDataCenterId(), null); - ready.setMsHostList(newMSList); - final List avoidMsList = _mshostDao.listNonUpStateMsIPs(); - ready.setAvoidMsHostList(avoidMsList); - ready.setLbAlgorithm(indirectAgentLB.getLBAlgorithmName()); - ready.setLbCheckInterval(indirectAgentLB.getLBPreferredHostCheckInterval(host.getClusterId())); - logger.debug("Agent's management server host list is not up to date, sending list update: {}", newMSList); + return attache; + } + + private AgentAttache connectHostAgent(HostVO host, ReadyCommand ready, Link link, StartupCommand[] startupCmds, GlobalLock joinLock) throws ConnectionException { + AgentAttache attache; + try { + final List agentMSHostList = new ArrayList<>(); + String lbAlgorithm = null; + if (startupCmds != null && startupCmds.length > 0) { + final String agentMSHosts = startupCmds[0].getMsHostList(); + if (StringUtils.isNotEmpty(agentMSHosts)) { + String[] msHosts = agentMSHosts.split("@"); + if (msHosts.length > 1) { + lbAlgorithm = msHosts[1]; + } + agentMSHostList.addAll(Arrays.asList(msHosts[0].split(","))); } + } - attache = createAttacheForConnect(host, link); - attache = notifyMonitorsOfConnection(attache, startup, false); - } finally { - joinLock.unlock(); + if (!indirectAgentLB.compareManagementServerListAndLBAlgorithm(host.getId(), host.getDataCenterId(), agentMSHostList, lbAlgorithm)) { + final List newMSList = indirectAgentLB.getManagementServerList(host.getId(), host.getDataCenterId(), null); + ready.setMsHostList(newMSList); + String newLBAlgorithm = indirectAgentLB.getLBAlgorithmName(); + ready.setLbAlgorithm(newLBAlgorithm); + logger.debug("Agent's management server host list or lb algorithm is not up to date, sending list and algorithm update: {}, {}", newMSList, newLBAlgorithm); } - } else { - throw new ConnectionException(true, - String.format("Unable to acquire lock on host %s", host)); + + final List avoidMsList = _mshostDao.listNonUpStateMsIPs(); + ready.setAvoidMsHostList(avoidMsList); + ready.setLbCheckInterval(indirectAgentLB.getLBPreferredHostCheckInterval(host.getClusterId())); + ready.setArch(host.getArch().getType()); + + attache = createAttacheForConnect(host, link); + attache = notifyMonitorsOfConnection(attache, startupCmds, false); + } finally { + joinLock.unlock(); } - joinLock.releaseRef(); + return attache; } @@ -1583,7 +1675,6 @@ protected void processRequest(final Link link, final Request request) { final String reason = shutdown.getReason(); logger.info("Host {} has informed us that it is shutting down with reason {} and detail {}", attache, reason, shutdown.getDetail()); if (reason.equals(ShutdownCommand.Update)) { - // disconnectWithoutInvestigation(attache, Event.UpdateNeeded); throw new CloudRuntimeException("Agent update not implemented"); } else if (reason.equals(ShutdownCommand.Requested)) { disconnectWithoutInvestigation(attache, Event.ShutdownRequested); @@ -1622,11 +1713,14 @@ protected void processRequest(final Link link, final Request request) { logger.debug("Not processing {} for agent id={}; can't find the host in the DB", PingRoutingCommand.class.getSimpleName(), cmdHostId); } } - if (host!= null && host.getStatus() != Status.Up && gatewayAccessible) { + if (host != null && host.getStatus() != Status.Up && gatewayAccessible) { requestStartupCommand = true; } final List avoidMsList = _mshostDao.listNonUpStateMsIPs(); answer = new PingAnswer((PingCommand)cmd, avoidMsList, requestStartupCommand); + + // Add or update reconcile tasks + reconcileCommandService.processCommand(cmd, answer); } else if (cmd instanceof ReadyAnswer) { final HostVO host = _hostDao.findById(attache.getId()); if (host == null) { @@ -1638,7 +1732,7 @@ protected void processRequest(final Link link, final Request request) { } } } catch (final Throwable th) { - logger.warn("Caught: ", th); + logger.error("Caught: ", th); answer = new Answer(cmd, false, th.getMessage()); } answers[i] = answer; @@ -1653,7 +1747,7 @@ protected void processRequest(final Link link, final Request request) { try { link.send(response.toBytes()); } catch (final ClosedChannelException e) { - logger.warn("Unable to send response because connection is closed: {}", response); + logger.error("Unable to send response because connection is closed: {}", response); } } @@ -1681,7 +1775,6 @@ protected void doTask(final Task task) throws TaskExecutionException { } } catch (final UnsupportedVersionException e) { logger.warn(e.getMessage()); - // upgradeAgent(task.getLink(), data, e.getReason()); } catch (final ClassNotFoundException e) { final String message = String.format("Exception occurred when executing tasks! Error '%s'", e.getMessage()); logger.error(message); @@ -1774,11 +1867,11 @@ protected boolean isHostOwnerSwitched(final HostVO host) { return false; } - private void disconnectInternal(final long hostId, final Status.Event event, final boolean invstigate) { + private void disconnectInternal(final long hostId, final Status.Event event, final boolean investigate) { final AgentAttache attache = findAttache(hostId); if (attache != null) { - if (!invstigate) { + if (!investigate) { disconnectWithoutInvestigation(attache, event); } else { disconnectWithInvestigation(attache, event); @@ -1945,7 +2038,7 @@ protected class AgentNewConnectionsMonitorTask extends ManagedContextRunnable { @Override protected void runInContext() { logger.trace("Agent New Connections Monitor is started."); - final int cleanupTime = Wait.value(); + final int cleanupTime = RemoteAgentNewConnectionsMonitorInterval.value(); Set> entrySet = newAgentConnections.entrySet(); long cutOff = System.currentTimeMillis() - (cleanupTime * 1000L); List expiredConnections = newAgentConnections.entrySet() @@ -2040,7 +2133,8 @@ public String getConfigComponentName() { public ConfigKey[] getConfigKeys() { return new ConfigKey[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait, - GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections }; + GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections, + RemoteAgentNewConnectionsMonitorInterval, KVMHostDiscoverySshPort }; } protected class SetHostParamsListener implements Listener { @@ -2079,6 +2173,7 @@ public void processConnect(final Host host, final StartupCommand cmd, final bool params.put(Config.RouterAggregationCommandEachTimeout.toString(), _configDao.getValue(Config.RouterAggregationCommandEachTimeout.toString())); params.put(Config.MigrateWait.toString(), _configDao.getValue(Config.MigrateWait.toString())); params.put(NetworkOrchestrationService.TUNGSTEN_ENABLED.key(), String.valueOf(NetworkOrchestrationService.TUNGSTEN_ENABLED.valueIn(host.getDataCenterId()))); + params.put(ReconcileCommandService.ReconcileCommandsEnabled.key(), String.valueOf(_reconcileCommandsEnabled)); try { SetHostParamsCommand cmds = new SetHostParamsCommand(params); @@ -2158,11 +2253,62 @@ public void propagateChangeToAgents(Map params) { } @Override - public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs) { + public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance) { return true; } + @Override + public int getHostSshPort(HostVO host) { + if (host == null) { + return KVMHostDiscoverySshPort.value(); + } + + if (host.getHypervisorType() != HypervisorType.KVM) { + return Host.DEFAULT_SSH_PORT; + } + + _hostDao.loadDetails(host); + String hostPort = host.getDetail(Host.HOST_SSH_PORT); + if (StringUtils.isBlank(hostPort)) { + return KVMHostDiscoverySshPort.valueIn(host.getClusterId()); + } + + return Integer.parseInt(hostPort); + } + private GlobalLock getHostJoinLock(Long hostId) { return GlobalLock.getInternLock(String.format("%s-%s", "Host-Join", hostId)); } + + public boolean isReconcileCommandsEnabled(HypervisorType hypervisorType) { + return _reconcileCommandsEnabled && ReconcileCommandService.SupportedHypervisorTypes.contains(hypervisorType); + } + + public void updateReconcileCommandsIfNeeded(long requestSeq, Command[] commands, Command.State state) { + if (!_reconcileCommandsEnabled) { + return; + } + for (Command command: commands) { + if (command.isReconcile()) { + reconcileCommandService.updateReconcileCommand(requestSeq, command, null, state, null); + } + } + } + + public Pair getStateAndAnswerOfReconcileCommand(long requestSeq, Command command) { + ReconcileCommandVO reconcileCommandVO = reconcileCommandDao.findCommand(requestSeq, command.toString()); + if (reconcileCommandVO == null) { + return null; + } + Command.State state = reconcileCommandVO.getStateByAgent(); + if (reconcileCommandVO.getAnswerName() == null || reconcileCommandVO.getAnswerInfo() == null) { + return new Pair<>(state, null); + } + Answer answer = ReconcileCommandUtils.parseAnswerFromAnswerInfo(reconcileCommandVO.getAnswerName(), reconcileCommandVO.getAnswerInfo()); + return new Pair<>(state, answer); + } + + public Integer getReconcileInterval() { + return _reconcileCommandInterval; + } } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentAttache.java index e36b145c8bca..5e4ccfa67c6f 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentAttache.java @@ -31,6 +31,7 @@ import com.cloud.agent.transport.Request; import com.cloud.exception.AgentUnavailableException; import com.cloud.host.Status; +import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.nio.Link; public class ClusteredAgentAttache extends ConnectedAgentAttache implements Routable { @@ -44,14 +45,14 @@ static public void initialize(final ClusteredAgentManagerImpl agentMgr) { s_clusteredAgentMgr = agentMgr; } - public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name) { - super(agentMgr, id, uuid, name, null, false); + public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final Hypervisor.HypervisorType hypervisorType) { + super(agentMgr, id, uuid, name, hypervisorType, null, false); _forward = true; _transferRequests = new LinkedList(); } - public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final Link link, final boolean maintenance) { - super(agentMgr, id, uuid, name, link, maintenance); + public ClusteredAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final Hypervisor.HypervisorType hypervisorType, final Link link, final boolean maintenance) { + super(agentMgr, id, uuid, name, hypervisorType, link, maintenance); _forward = link == null; _transferRequests = new LinkedList(); } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java index dad7d401b940..38a198b73040 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java @@ -42,10 +42,13 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; +import com.cloud.resource.ResourceState; import org.apache.cloudstack.ca.CAManager; import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.cloudstack.framework.extensions.command.ExtensionServerActionBaseCommand; +import org.apache.cloudstack.framework.extensions.manager.ExtensionsManager; import org.apache.cloudstack.ha.dao.HAConfigDao; import org.apache.cloudstack.maintenance.ManagementServerMaintenanceManager; import org.apache.cloudstack.maintenance.command.BaseShutdownManagementServerHostCommand; @@ -60,6 +63,7 @@ import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao; import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.cloudstack.utils.security.SSLUtils; +import org.apache.commons.collections.CollectionUtils; import com.cloud.agent.api.Answer; import com.cloud.agent.api.CancelCommand; @@ -105,8 +109,6 @@ import com.cloud.utils.nio.Task; import com.google.gson.Gson; -import org.apache.commons.collections.CollectionUtils; - public class ClusteredAgentManagerImpl extends AgentManagerImpl implements ClusterManagerListener, ClusteredAgentRebalanceService { private static ScheduledExecutorService s_transferExecutor = Executors.newScheduledThreadPool(2, new NamedThreadFactory("Cluster-AgentRebalancingExecutor")); private final long rebalanceTimeOut = 300000; // 5 mins - after this time remove the agent from the transfer list @@ -146,6 +148,8 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust private ManagementServerMaintenanceManager managementServerMaintenanceManager; @Inject private DataCenterDao dcDao; + @Inject + ExtensionsManager extensionsManager; protected ClusteredAgentManagerImpl() { super(); @@ -210,7 +214,7 @@ private void runDirectAgentScanTimerTask() { scanDirectAgentToLoad(); } - private void scanDirectAgentToLoad() { + protected void scanDirectAgentToLoad() { logger.trace("Begin scanning directly connected hosts"); // for agents that are self-managed, threshold to be considered as disconnected after pingtimeout @@ -231,11 +235,21 @@ private void scanDirectAgentToLoad() { logger.info("{} is detected down, but we have a forward attache running, disconnect this one before launching the host", host); removeAgent(agentattache, Status.Disconnected); } else { - continue; + logger.debug("Host {} status is {} but has an AgentAttache which is not forForward, try to load directly", host, host.getStatus()); + Status hostStatus = investigate(agentattache); + if (Status.Up == hostStatus) { + /* Got ping response from host, bring it back */ + logger.info("After investigation, Agent for host {} is determined to be up and running", host); + agentStatusTransitTo(host, Event.Ping, _nodeId); + } else { + logger.debug("After investigation, AgentAttache is not null but host status is {}, try to load directly {}", hostStatus, host); + loadDirectlyConnectedHost(host, false); + } } + } else { + logger.debug("AgentAttache is null, loading directly connected {}", host); + loadDirectlyConnectedHost(host, false); } - logger.debug("Loading directly connected {}", host); - loadDirectlyConnectedHost(host, false); } catch (final Throwable e) { logger.warn(" can not load directly connected {} due to ", host, e); } @@ -264,7 +278,7 @@ public Task create(final Task.Type type, final Link link, final byte[] data) { protected AgentAttache createAttache(final HostVO host) { logger.debug("create forwarding ClusteredAgentAttache for {}", host); long id = host.getId(); - final AgentAttache attache = new ClusteredAgentAttache(this, id, host.getUuid(), host.getName()); + final AgentAttache attache = new ClusteredAgentAttache(this, id, host.getUuid(), host.getName(), host.getHypervisorType()); AgentAttache old; synchronized (_agents) { old = _agents.get(host.getId()); @@ -280,7 +294,7 @@ protected AgentAttache createAttache(final HostVO host) { @Override protected AgentAttache createAttacheForConnect(final HostVO host, final Link link) { logger.debug("create ClusteredAgentAttache for {}", host); - final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getUuid(), host.getName(), link, host.isInMaintenanceStates()); + final AgentAttache attache = new ClusteredAgentAttache(this, host.getId(), host.getUuid(), host.getName(), host.getHypervisorType(), link, host.isInMaintenanceStates()); link.attach(attache); AgentAttache old; synchronized (_agents) { @@ -296,7 +310,7 @@ protected AgentAttache createAttacheForConnect(final HostVO host, final Link lin @Override protected AgentAttache createAttacheForDirectConnect(final Host host, final ServerResource resource) { logger.debug("Create ClusteredDirectAgentAttache for {}.", host); - final DirectAgentAttache attache = new ClusteredDirectAgentAttache(this, host.getId(), host.getUuid(), host.getName(), _nodeId, resource, host.isInMaintenanceStates()); + final DirectAgentAttache attache = new ClusteredDirectAgentAttache(this, host.getId(), host.getUuid(), host.getName(), host.getHypervisorType(), _nodeId, resource, host.isInMaintenanceStates()); AgentAttache old; synchronized (_agents) { old = _agents.get(host.getId()); @@ -381,20 +395,20 @@ public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnav return; } if (!result) { - throw new CloudRuntimeException("Failed to propagate agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); + throw new CloudRuntimeException(String.format("Failed to propagate agent change request event: %s to host: %s", Event.ShutdownRequested, hostId)); } } public void notifyNodesInCluster(final AgentAttache attache) { logger.debug("Notifying other nodes of to disconnect"); - final Command[] cmds = new Command[] {new ChangeAgentCommand(attache.getId(), Event.AgentDisconnected)}; + final Command[] cmds = new Command[]{new ChangeAgentCommand(attache.getId(), Event.AgentDisconnected)}; _clusterMgr.broadcast(attache.getId(), _gson.toJson(cmds)); } // notifies MS peers to schedule a host scan task immediately, triggered during addHost operation public void notifyNodesInClusterToScheduleHostScanTask() { logger.debug("Notifying other MS nodes to run host scan task"); - final Command[] cmds = new Command[] {new ScheduleHostScanTaskCommand()}; + final Command[] cmds = new Command[]{new ScheduleHostScanTaskCommand()}; _clusterMgr.broadcast(0, _gson.toJson(cmds)); } @@ -421,10 +435,10 @@ public boolean routeToPeer(final String peer, final byte[] bytes) { ch = connectToPeer(peer, ch); if (ch == null) { try { - logD(bytes, "Unable to route to peer: " + Request.parse(bytes)); + logD(bytes, "Unable to establish connection to route to peer: " + Request.parse(bytes)); } catch (ClassNotFoundException | UnsupportedVersionException e) { // Request.parse thrown exception when we try to log it, log as much as we can - logD(bytes, "Unable to route to peer, and Request.parse further caught exception" + e.getMessage()); + logD(bytes, "Unable to establish connection to route to peer, and Request.parse further caught exception" + e.getMessage()); } return false; } @@ -435,7 +449,7 @@ public boolean routeToPeer(final String peer, final byte[] bytes) { } try { logD(bytes, "Routing to peer"); - Link.write(ch, new ByteBuffer[] {ByteBuffer.wrap(bytes)}, sslEngine); + Link.write(ch, new ByteBuffer[]{ByteBuffer.wrap(bytes)}, sslEngine); return true; } catch (final IOException e) { try { @@ -525,7 +539,7 @@ public SocketChannel connectToPeer(final String peerName, final SocketChannel pr ch1.close(); throw new IOException("SSL: Fail to init SSL! " + e); } - logger.debug("Connection to peer opened: {}, ip: {}", peerName, ip); + logger.debug("Connection to peer opened: {}, IP: {}", peerName, ip); _peers.put(peerName, ch1); _sslEngines.put(peerName, sslEngine); return ch1; @@ -537,7 +551,7 @@ public SocketChannel connectToPeer(final String peerName, final SocketChannel pr logger.error("failed to close failed peer socket: {}", ex); } } - logger.warn("Unable to connect to peer management server: {}, ip {} due to {}", peerName, ip, e.getMessage(), e); + logger.warn("Unable to connect to peer management server: {}, IP {} due to {}", peerName, ip, e.getMessage(), e); return null; } } @@ -633,7 +647,6 @@ protected void doTask(final Task task) throws TaskExecutionException { final Link link = task.getLink(); if (Request.fromServer(data)) { - final AgentAttache agent = findAttache(hostId); if (Request.isControl(data)) { @@ -681,7 +694,6 @@ protected void doTask(final Task task) throws TaskExecutionException { cancel(Long.toString(Request.getManagementServerId(data)), hostId, Request.getSequence(data), e.getMessage()); } } else { - final long mgmtId = Request.getManagementServerId(data); if (mgmtId != -1 && mgmtId != _nodeId) { routeToPeer(Long.toString(mgmtId), data); @@ -953,8 +965,7 @@ protected void runInContext() { synchronized (_agentToTransferIds) { if (!_agentToTransferIds.isEmpty()) { logger.debug("Found {} agents to transfer", _agentToTransferIds.size()); - // for (Long hostId : _agentToTransferIds) { - for (final Iterator iterator = _agentToTransferIds.iterator(); iterator.hasNext();) { + for (final Iterator iterator = _agentToTransferIds.iterator(); iterator.hasNext(); ) { final Long hostId = iterator.next(); final AgentAttache attache = findAttache(hostId); @@ -1095,7 +1106,7 @@ protected void finishRebalance(final long hostId, final long futureOwnerId, fina return; } - final ClusteredAgentAttache forwardAttache = (ClusteredAgentAttache)attache; + final ClusteredAgentAttache forwardAttache = (ClusteredAgentAttache) attache; if (success) { @@ -1146,10 +1157,10 @@ protected boolean startRebalance(final long hostId) { } synchronized (_agents) { - final ClusteredDirectAgentAttache attache = (ClusteredDirectAgentAttache)_agents.get(hostId); + final ClusteredDirectAgentAttache attache = (ClusteredDirectAgentAttache) _agents.get(hostId); if (attache != null && attache.getQueueSize() == 0 && attache.getNonRecurringListenersSize() == 0) { handleDisconnectWithoutInvestigation(attache, Event.StartAgentRebalance, true, true); - final ClusteredAgentAttache forwardAttache = (ClusteredAgentAttache)createAttache(host); + final ClusteredAgentAttache forwardAttache = (ClusteredAgentAttache) createAttache(host); if (forwardAttache == null) { logger.warn("Unable to create a forward attache for the host {} as a part of rebalance process", host); return false; @@ -1253,7 +1264,7 @@ public String dispatch(final ClusterServicePdu pdu) { } if (cmds.length == 1 && cmds[0] instanceof ChangeAgentCommand) { // intercepted - final ChangeAgentCommand cmd = (ChangeAgentCommand)cmds[0]; + final ChangeAgentCommand cmd = (ChangeAgentCommand) cmds[0]; logger.debug("Intercepting command for agent change: agent {} event: {}", cmd.getAgentId(), cmd.getEvent()); boolean result; @@ -1270,7 +1281,7 @@ public String dispatch(final ClusterServicePdu pdu) { answers[0] = new ChangeAgentAnswer(cmd, result); return _gson.toJson(answers); } else if (cmds.length == 1 && cmds[0] instanceof TransferAgentCommand) { - final TransferAgentCommand cmd = (TransferAgentCommand)cmds[0]; + final TransferAgentCommand cmd = (TransferAgentCommand) cmds[0]; logger.debug("Intercepting command for agent rebalancing: agent: {}, event: {}, connection transfer: {}", cmd.getAgentId(), cmd.getEvent(), cmd.isConnectionTransfer()); boolean result; @@ -1289,28 +1300,39 @@ public String dispatch(final ClusterServicePdu pdu) { answers[0] = new Answer(cmd, result, null); return _gson.toJson(answers); } else if (cmds.length == 1 && cmds[0] instanceof PropagateResourceEventCommand) { - final PropagateResourceEventCommand cmd = (PropagateResourceEventCommand)cmds[0]; + final PropagateResourceEventCommand cmd = (PropagateResourceEventCommand) cmds[0]; logger.debug("Intercepting command to propagate event {} for host {} ({})", () -> cmd.getEvent().name(), cmd::getHostId, () -> _hostDao.findById(cmd.getHostId())); boolean result; try { - result = _resourceMgr.executeUserRequest(cmd.getHostId(), cmd.getEvent()); + result = _resourceMgr.executeUserRequest(cmd.getHostId(), cmd.getEvent(), cmd.isForced(), cmd.isForceDeleteStorage()); logger.debug("Result is {}", result); } catch (final AgentUnavailableException ex) { logger.warn("Agent is unavailable", ex); return null; + } catch (final RuntimeException ex) { + logger.error(String.format("Failed to execute propagated event %s for host %d", cmd.getEvent().name(), cmd.getHostId()), ex); + final Answer[] answers = new Answer[1]; + String details = ex.getMessage(); + if (details == null || details.isEmpty()) { + details = ex.toString(); + } + answers[0] = new Answer(cmd, false, details); + return _gson.toJson(answers); } final Answer[] answers = new Answer[1]; answers[0] = new Answer(cmd, result, null); return _gson.toJson(answers); } else if (cmds.length == 1 && cmds[0] instanceof ScheduleHostScanTaskCommand) { - final ScheduleHostScanTaskCommand cmd = (ScheduleHostScanTaskCommand)cmds[0]; + final ScheduleHostScanTaskCommand cmd = (ScheduleHostScanTaskCommand) cmds[0]; return handleScheduleHostScanTaskCommand(cmd); } else if (cmds.length == 1 && cmds[0] instanceof BaseShutdownManagementServerHostCommand) { - final BaseShutdownManagementServerHostCommand cmd = (BaseShutdownManagementServerHostCommand)cmds[0]; + final BaseShutdownManagementServerHostCommand cmd = (BaseShutdownManagementServerHostCommand) cmds[0]; return handleShutdownManagementServerHostCommand(cmd); + } else if (cmds.length == 1 && cmds[0] instanceof ExtensionServerActionBaseCommand) { + return extensionsManager.handleExtensionServerCommands((ExtensionServerActionBaseCommand)cmds[0]); } try { @@ -1342,7 +1364,7 @@ private String handleShutdownManagementServerHostCommand(BaseShutdownManagementS if (cmd instanceof PrepareForMaintenanceManagementServerHostCommand) { logger.debug("Received PrepareForMaintenanceManagementServerHostCommand - preparing for maintenance"); try { - managementServerMaintenanceManager.prepareForMaintenance(((PrepareForMaintenanceManagementServerHostCommand) cmd).getLbAlgorithm()); + managementServerMaintenanceManager.prepareForMaintenance(((PrepareForMaintenanceManagementServerHostCommand) cmd).getLbAlgorithm(), ((PrepareForMaintenanceManagementServerHostCommand) cmd).isForced()); return "Successfully prepared for maintenance"; } catch(CloudRuntimeException e) { return e.getMessage(); @@ -1362,7 +1384,7 @@ private String handleShutdownManagementServerHostCommand(BaseShutdownManagementS try { managementServerMaintenanceManager.prepareForShutdown(); return "Successfully prepared for shutdown"; - } catch(CloudRuntimeException e) { + } catch (CloudRuntimeException e) { return e.getMessage(); } } @@ -1371,7 +1393,7 @@ private String handleShutdownManagementServerHostCommand(BaseShutdownManagementS try { managementServerMaintenanceManager.triggerShutdown(); return "Successfully triggered shutdown"; - } catch(CloudRuntimeException e) { + } catch (CloudRuntimeException e) { return e.getMessage(); } } @@ -1380,7 +1402,7 @@ private String handleShutdownManagementServerHostCommand(BaseShutdownManagementS try { managementServerMaintenanceManager.cancelShutdown(); return "Successfully cancelled shutdown"; - } catch(CloudRuntimeException e) { + } catch (CloudRuntimeException e) { return e.getMessage(); } } @@ -1389,14 +1411,14 @@ private String handleShutdownManagementServerHostCommand(BaseShutdownManagementS } @Override - public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs) { + public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance) { if (timeoutDurationInMs <= 0) { logger.debug("Not transferring direct agents from management server node {} (id: {}) to other nodes, invalid timeout duration", fromMsId, fromMsUuid); return false; } long transferStartTimeInMs = System.currentTimeMillis(); - if (CollectionUtils.isEmpty(getDirectAgentHosts(fromMsId))) { + if (CollectionUtils.isEmpty(getDirectAgentHosts(fromMsId, excludeHostsInMaintenance))) { logger.info("No direct agent hosts available on management server node {} (id: {}), to transfer", fromMsId, fromMsUuid); return true; } @@ -1411,7 +1433,7 @@ public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long int agentTransferFailedCount = 0; List dataCenterList = dcDao.listAll(); for (DataCenterVO dc : dataCenterList) { - List directAgentHostsInDc = getDirectAgentHostsInDc(fromMsId, dc.getId()); + List directAgentHostsInDc = getDirectAgentHostsInDc(fromMsId, dc.getId(), excludeHostsInMaintenance); if (CollectionUtils.isEmpty(directAgentHostsInDc)) { continue; } @@ -1445,9 +1467,10 @@ public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long return (agentTransferFailedCount == 0); } - private List getDirectAgentHosts(long msId) { + private List getDirectAgentHosts(long msId, boolean excludeHostsInMaintenance) { List directAgentHosts = new ArrayList<>(); - List hosts = _hostDao.listHostsByMs(msId); + List statesToExclude = excludeHostsInMaintenance ? ResourceState.s_maintenanceStates : List.of(); + List hosts = _hostDao.listHostsByMsResourceState(msId, statesToExclude); for (HostVO host : hosts) { AgentAttache agent = findAttache(host.getId()); if (agent instanceof DirectAgentAttache) { @@ -1458,9 +1481,11 @@ private List getDirectAgentHosts(long msId) { return directAgentHosts; } - private List getDirectAgentHostsInDc(long msId, long dcId) { + private List getDirectAgentHostsInDc(long msId, long dcId, boolean excludeHostsInMaintenance) { List directAgentHosts = new ArrayList<>(); - List hosts = _hostDao.listHostsByMsAndDc(msId, dcId); + // To exclude maintenance states use values from ResourceState as source of truth + List statesToExclude = excludeHostsInMaintenance ? ResourceState.s_maintenanceStates : List.of(); + List hosts = _hostDao.listHostsByMsDcResourceState(msId, dcId, statesToExclude); for (HostVO host : hosts) { AgentAttache agent = findAttache(host.getId()); if (agent instanceof DirectAgentAttache) { @@ -1496,6 +1521,10 @@ public void onManagementServerPreparingForMaintenance() { public void onManagementServerCancelPreparingForMaintenance() { logger.debug("Management server cancel preparing for maintenance"); super.onManagementServerPreparingForMaintenance(); + + // needed for the case when Management Server in Preparing For Maintenance but didn't go to Maintenance state + // (where this variable will be reset) + _agentLbHappened = false; } @Override diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredDirectAgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredDirectAgentAttache.java index e36ea6cedc13..5e796d8e0d86 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredDirectAgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredDirectAgentAttache.java @@ -20,14 +20,15 @@ import com.cloud.agent.transport.Response; import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.UnsupportedVersionException; +import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; import com.cloud.utils.exception.CloudRuntimeException; public class ClusteredDirectAgentAttache extends DirectAgentAttache implements Routable { private final long _nodeId; - public ClusteredDirectAgentAttache(ClusteredAgentManagerImpl agentMgr, long id, String uuid, String name, long mgmtId, ServerResource resource, boolean maintenance) { - super(agentMgr, id, uuid, name, resource, maintenance); + public ClusteredDirectAgentAttache(ClusteredAgentManagerImpl agentMgr, long id, String uuid, String name, final Hypervisor.HypervisorType hypervisorType, long mgmtId, ServerResource resource, boolean maintenance) { + super(agentMgr, id, uuid, name, hypervisorType, resource, maintenance); _nodeId = mgmtId; } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ConnectedAgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ConnectedAgentAttache.java index 523f98fd0108..f4efaaa34a42 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/ConnectedAgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ConnectedAgentAttache.java @@ -22,6 +22,7 @@ import com.cloud.agent.transport.Request; import com.cloud.exception.AgentUnavailableException; import com.cloud.host.Status; +import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.nio.Link; /** @@ -31,8 +32,8 @@ public class ConnectedAgentAttache extends AgentAttache { protected Link _link; - public ConnectedAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final Link link, final boolean maintenance) { - super(agentMgr, id, uuid, name, maintenance); + public ConnectedAgentAttache(final AgentManagerImpl agentMgr, final long id, final String uuid, final String name, final Hypervisor.HypervisorType hypervisorType, final Link link, final boolean maintenance) { + super(agentMgr, id, uuid, name, hypervisorType, maintenance); _link = link; } @@ -53,8 +54,10 @@ public synchronized boolean isClosed() { @Override public void disconnect(final Status state) { synchronized (this) { - logger.debug("Processing Disconnect."); + logger.debug("Processing disconnect [id: {}, uuid: {}, name: {}]", _id, _uuid, _name); + if (_link != null) { + logger.debug("Disconnecting from {}, Socket Address: {}", _link.getIpAddress(), _link.getSocketAddress()); _link.close(); _link.terminated(); } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java index 07d5bf803932..ed18d1e82b7e 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java @@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import com.cloud.utils.ThreadUtil; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.managed.context.ManagedContextRunnable; @@ -35,6 +36,7 @@ import com.cloud.agent.transport.Response; import com.cloud.exception.AgentUnavailableException; import com.cloud.host.Status; +import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; import org.apache.logging.log4j.ThreadContext; @@ -51,8 +53,8 @@ public class DirectAgentAttache extends AgentAttache { AtomicInteger _outstandingTaskCount; AtomicInteger _outstandingCronTaskCount; - public DirectAgentAttache(AgentManagerImpl agentMgr, long id, String uuid,String name, ServerResource resource, boolean maintenance) { - super(agentMgr, id, uuid, name, maintenance); + public DirectAgentAttache(AgentManagerImpl agentMgr, long id, String uuid, String name, final Hypervisor.HypervisorType hypervisorType, ServerResource resource, boolean maintenance) { + super(agentMgr, id, uuid, name, hypervisorType, maintenance); _resource = resource; _outstandingTaskCount = new AtomicInteger(0); _outstandingCronTaskCount = new AtomicInteger(0); @@ -165,7 +167,7 @@ protected synchronized void runInContext() { PingCommand cmd = resource.getCurrentStatus(_id); int retried = 0; while (cmd == null && ++retried <= _HostPingRetryCount.value()) { - Thread.sleep(1000*_HostPingRetryTimer.value()); + ThreadUtil.wait(this, 1000L *_HostPingRetryTimer.value(), _id, _uuid, _name); cmd = resource.getCurrentStatus(_id); } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/DummyAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/DummyAttache.java index 2f15e7af43c3..f2b253fffcbd 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/DummyAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/DummyAttache.java @@ -19,11 +19,12 @@ import com.cloud.agent.transport.Request; import com.cloud.exception.AgentUnavailableException; import com.cloud.host.Status; +import com.cloud.hypervisor.Hypervisor; public class DummyAttache extends AgentAttache { - public DummyAttache(AgentManagerImpl agentMgr, long id, String uuid, String name, boolean maintenance) { - super(agentMgr, id, uuid, name, maintenance); + public DummyAttache(AgentManagerImpl agentMgr, long id, String uuid, String name, final Hypervisor.HypervisorType hypervisorType, boolean maintenance) { + super(agentMgr, id, uuid, name, hypervisorType, maintenance); } @Override diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index 472fe148a5d7..db50a5134d8d 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.vm; +import static com.cloud.configuration.ConfigurationManagerImpl.EXPOSE_ERRORS_TO_USER; import static com.cloud.configuration.ConfigurationManagerImpl.MIGRATE_VM_ACROSS_CLUSTERS; import java.lang.reflect.Field; @@ -49,6 +50,7 @@ import javax.naming.ConfigurationException; import javax.persistence.EntityExistsException; +import com.cloud.hypervisor.KVMGuru; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.annotation.AnnotationService; import org.apache.cloudstack.annotation.dao.AnnotationDao; @@ -57,15 +59,26 @@ import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd; import org.apache.cloudstack.api.command.admin.volume.MigrateVolumeCmdByAdmin; import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd; +import org.apache.cloudstack.backup.BackupManager; +import org.apache.cloudstack.backup.dao.BackupDao; import org.apache.cloudstack.ca.CAManager; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.ca.Certificate; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; +import org.apache.cloudstack.framework.extensions.dao.ExtensionDetailsDao; +import org.apache.cloudstack.framework.extensions.manager.ExtensionsManager; +import org.apache.cloudstack.framework.extensions.vo.ExtensionDetailsVO; import org.apache.cloudstack.framework.jobs.AsyncJob; import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext; import org.apache.cloudstack.framework.jobs.AsyncJobManager; @@ -78,11 +91,13 @@ import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.MessageDispatcher; import org.apache.cloudstack.framework.messagebus.MessageHandler; +import org.apache.cloudstack.gpu.GpuService; import org.apache.cloudstack.jobs.JobInfo; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.reservation.dao.ReservationDao; import org.apache.cloudstack.resource.ResourceCleanupService; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.cloudstack.utils.cache.SingleCache; @@ -92,6 +107,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang3.ObjectUtils; import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; @@ -116,10 +132,13 @@ import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.PlugNicAnswer; import com.cloud.agent.api.PlugNicCommand; +import com.cloud.agent.api.PrepareExternalProvisioningAnswer; +import com.cloud.agent.api.PrepareExternalProvisioningCommand; import com.cloud.agent.api.PrepareForMigrationAnswer; import com.cloud.agent.api.PrepareForMigrationCommand; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; +import com.cloud.agent.api.RecreateCheckpointsCommand; import com.cloud.agent.api.ReplugNicAnswer; import com.cloud.agent.api.ReplugNicCommand; import com.cloud.agent.api.RestoreVMSnapshotAnswer; @@ -133,11 +152,15 @@ import com.cloud.agent.api.StopCommand; import com.cloud.agent.api.UnPlugNicAnswer; import com.cloud.agent.api.UnPlugNicCommand; +import com.cloud.agent.api.UnmanageInstanceCommand; import com.cloud.agent.api.UnregisterVMCommand; +import com.cloud.agent.api.UpdateVmNicAnswer; +import com.cloud.agent.api.UpdateVmNicCommand; import com.cloud.agent.api.VmDiskStatsEntry; import com.cloud.agent.api.VmNetworkStatsEntry; import com.cloud.agent.api.VmStatsEntry; import com.cloud.agent.api.routing.NetworkElementCommand; +import com.cloud.agent.api.to.DataTO; import com.cloud.agent.api.to.DiskTO; import com.cloud.agent.api.to.DpdkTO; import com.cloud.agent.api.to.GPUDeviceTO; @@ -195,12 +218,14 @@ import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDetailsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuru; import com.cloud.hypervisor.HypervisorGuruBase; import com.cloud.hypervisor.HypervisorGuruManager; import com.cloud.network.Network; import com.cloud.network.NetworkModel; +import com.cloud.network.NetworkService; import com.cloud.network.Networks; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkDetailVO; @@ -223,6 +248,7 @@ import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.ScopeType; +import com.cloud.storage.Snapshot; import com.cloud.storage.Storage; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageManager; @@ -241,6 +267,7 @@ import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VMTemplateZoneDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.user.ResourceLimitService; @@ -276,8 +303,8 @@ import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.UserVmDao; -import com.cloud.vm.dao.UserVmDetailsDao; import com.cloud.vm.dao.VMInstanceDao; +import com.cloud.vm.dao.VMInstanceDetailsDao; import com.cloud.vm.snapshot.VMSnapshotManager; import com.cloud.vm.snapshot.VMSnapshotVO; import com.cloud.vm.snapshot.dao.VMSnapshotDao; @@ -324,6 +351,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Inject private HostDao _hostDao; @Inject + private HostDetailsDao hostDetailsDao; + @Inject private AlertManager _alertMgr; @Inject private GuestOSCategoryDao _guestOsCategoryDao; @@ -370,10 +399,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Inject private ClusterDetailsDao _clusterDetailsDao; @Inject - private UserVmDetailsDao userVmDetailsDao; + private VMInstanceDetailsDao vmInstanceDetailsDao; @Inject private VolumeOrchestrationService volumeMgr; @Inject + private GpuService gpuService; + @Inject private DeploymentPlanningManager _dpMgr; @Inject private MessageBus _messageBus; @@ -406,12 +437,34 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac @Inject private DomainDao domainDao; @Inject + public NetworkService networkService; + @Inject ResourceCleanupService resourceCleanupService; @Inject VmWorkJobDao vmWorkJobDao; + @Inject + DataStoreProviderManager dataStoreProviderManager; + @Inject + BackupManager backupManager; + @Inject + BackupDao backupDao; private SingleCache> vmIdsInProgressCache; + @Inject + private SnapshotDataStoreDao snapshotDataStoreDao; + + @Inject + private SnapshotManager snapshotManager; + + @Inject + private VolumeDataFactory volumeDataFactory; + @Inject + ExtensionsManager extensionsManager; + @Inject + ExtensionDetailsDao extensionDetailsDao; + + VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this); Map _vmGurus = new HashMap<>(); @@ -427,7 +480,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac static final ConfigKey VmOpCleanupInterval = new ConfigKey("Advanced", Long.class, "vm.op.cleanup.interval", "86400", "Interval to run the thread that cleans up the vm operations (in seconds)", false); static final ConfigKey VmOpCleanupWait = new ConfigKey("Advanced", Long.class, "vm.op.cleanup.wait", "3600", - "Time (in seconds) to wait before cleanuping up any vm work items", true); + "Time (in seconds) to wait before cleaning up any vm work items", true); static final ConfigKey VmOpCancelInterval = new ConfigKey("Advanced", Long.class, "vm.op.cancel.interval", "3600", "Time (in seconds) to wait before cancelling a operation", false); static final ConfigKey VmDestroyForcestop = new ConfigKey("Advanced", Boolean.class, "vm.destroy.forcestop", "false", @@ -483,11 +536,12 @@ public void registerGuru(final VirtualMachine.Type type, final VirtualMachineGur @Override @DB public void allocate(final String vmInstanceName, final VirtualMachineTemplate template, final ServiceOffering serviceOffering, - final DiskOfferingInfo rootDiskOfferingInfo, final List dataDiskOfferings, - final LinkedHashMap> auxiliaryNetworks, final DeploymentPlan plan, final HypervisorType hyperType, final Map> extraDhcpOptions, final Map datadiskTemplateToDiskOfferingMap) + final DiskOfferingInfo rootDiskOfferingInfo, final List dataDiskOfferings, List dataDiskDeviceIds, + final LinkedHashMap> auxiliaryNetworks,final DeploymentPlan plan, final HypervisorType hyperType, + final Map> extraDhcpOptions, final Map datadiskTemplateToDiskOfferingMap, Volume volume, Snapshot snapshot) throws InsufficientCapacityException { - logger.info("allocating virtual machine from template: {} with hostname: {} and {} networks", template, vmInstanceName, auxiliaryNetworks.size()); + logger.info("Allocating Instance from Template: {} with hostname: {} and {} networks", template, vmInstanceName, auxiliaryNetworks.size()); VMInstanceVO persistedVm = null; try { final VMInstanceVO vm = _vmDao.findVMByInstanceName(vmInstanceName); @@ -510,7 +564,7 @@ public void allocate(final String vmInstanceName, final VirtualMachineTemplate t } final Long rootDiskSizeFinal = rootDiskSize; - logger.debug("Allocating nics for {}", persistedVm); + logger.debug("Allocating NICs for {}", persistedVm); try { if (!vmProfile.getBootArgs().contains("ExternalLoadBalancerVm")) { @@ -522,25 +576,34 @@ public void allocate(final String vmInstanceName, final VirtualMachineTemplate t logger.debug("Allocating disks for {}", persistedVm); - allocateRootVolume(persistedVm, template, rootDiskOfferingInfo, owner, rootDiskSizeFinal); + if (isBlankInstance(template)) { + logger.debug("Template is a dummy template for hypervisor {}, skipping volume allocation", hyperType); + return; + } else { + allocateRootVolume(persistedVm, template, rootDiskOfferingInfo, owner, rootDiskSizeFinal, volume, snapshot); + } + // Create new Volume context and inject event resource type, id and details to generate VOLUME.CREATE event for the ROOT disk. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); try { if (dataDiskOfferings != null) { + int index = 0; for (final DiskOfferingInfo dataDiskOfferingInfo : dataDiskOfferings) { - volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + persistedVm.getId(), dataDiskOfferingInfo.getDiskOffering(), dataDiskOfferingInfo.getSize(), - dataDiskOfferingInfo.getMinIops(), dataDiskOfferingInfo.getMaxIops(), persistedVm, template, owner, null); + Long deviceId = dataDiskDeviceIds.get(index++); + String volumeName = deviceId == null ? "DATA-" + persistedVm.getId() : "DATA-" + persistedVm.getId() + "-" + String.valueOf(deviceId); + volumeMgr.allocateRawVolume(Type.DATADISK, volumeName, dataDiskOfferingInfo.getDiskOffering(), dataDiskOfferingInfo.getSize(), + dataDiskOfferingInfo.getMinIops(), dataDiskOfferingInfo.getMaxIops(), persistedVm, template, owner, deviceId, true); } } if (datadiskTemplateToDiskOfferingMap != null && !datadiskTemplateToDiskOfferingMap.isEmpty()) { - int diskNumber = 1; + Long diskNumber = 1L; for (Entry dataDiskTemplateToDiskOfferingMap : datadiskTemplateToDiskOfferingMap.entrySet()) { DiskOffering diskOffering = dataDiskTemplateToDiskOfferingMap.getValue(); long diskOfferingSize = diskOffering.getDiskSize() / (1024 * 1024 * 1024); VMTemplateVO dataDiskTemplate = _templateDao.findById(dataDiskTemplateToDiskOfferingMap.getKey()); - volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + persistedVm.getId() + "-" + String.valueOf(diskNumber), diskOffering, diskOfferingSize, null, null, - persistedVm, dataDiskTemplate, owner, Long.valueOf(diskNumber)); + volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + persistedVm.getId() + "-" + String.valueOf( diskNumber), diskOffering, diskOfferingSize, null, null, + persistedVm, dataDiskTemplate, owner, diskNumber, true); diskNumber++; } } @@ -563,19 +626,19 @@ public void allocate(final String vmInstanceName, final VirtualMachineTemplate t } } - private void allocateRootVolume(VMInstanceVO vm, VirtualMachineTemplate template, DiskOfferingInfo rootDiskOfferingInfo, Account owner, Long rootDiskSizeFinal) { + private void allocateRootVolume(VMInstanceVO vm, VirtualMachineTemplate template, DiskOfferingInfo rootDiskOfferingInfo, Account owner, Long rootDiskSizeFinal, Volume volume, Snapshot snapshot) { // Create new Volume context and inject event resource type, id and details to generate VOLUME.CREATE event for the ROOT disk. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); try { String rootVolumeName = String.format("ROOT-%s", vm.getId()); if (template.getFormat() == ImageFormat.ISO) { volumeMgr.allocateRawVolume(Type.ROOT, rootVolumeName, rootDiskOfferingInfo.getDiskOffering(), rootDiskOfferingInfo.getSize(), - rootDiskOfferingInfo.getMinIops(), rootDiskOfferingInfo.getMaxIops(), vm, template, owner, null); - } else if (template.getFormat() == ImageFormat.BAREMETAL) { - logger.debug("%s has format [{}]. Skipping ROOT volume [{}] allocation.", template.toString(), ImageFormat.BAREMETAL, rootVolumeName); + rootDiskOfferingInfo.getMinIops(), rootDiskOfferingInfo.getMaxIops(), vm, template, owner, null, true); + } else if (Arrays.asList(ImageFormat.BAREMETAL, ImageFormat.EXTERNAL).contains(template.getFormat())) { + logger.debug("{} has format [{}]. Skipping ROOT volume [{}] allocation.", template, template.getFormat(), rootVolumeName); } else { volumeMgr.allocateTemplatedVolumes(Type.ROOT, rootVolumeName, rootDiskOfferingInfo.getDiskOffering(), rootDiskSizeFinal, - rootDiskOfferingInfo.getMinIops(), rootDiskOfferingInfo.getMaxIops(), template, vm, owner); + rootDiskOfferingInfo.getMinIops(), rootDiskOfferingInfo.getMaxIops(), template, vm, owner, volume, snapshot); } } finally { // Remove volumeContext and pop vmContext back @@ -585,9 +648,9 @@ private void allocateRootVolume(VMInstanceVO vm, VirtualMachineTemplate template @Override public void allocate(final String vmInstanceName, final VirtualMachineTemplate template, final ServiceOffering serviceOffering, - final LinkedHashMap> networks, final DeploymentPlan plan, final HypervisorType hyperType) throws InsufficientCapacityException { + final LinkedHashMap> networks, final DeploymentPlan plan, final HypervisorType hyperType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException { DiskOffering diskOffering = _diskOfferingDao.findById(serviceOffering.getDiskOfferingId()); - allocate(vmInstanceName, template, serviceOffering, new DiskOfferingInfo(diskOffering), new ArrayList<>(), networks, plan, hyperType, null, null); + allocate(vmInstanceName, template, serviceOffering, new DiskOfferingInfo(diskOffering), new ArrayList<>(), new ArrayList<>(), networks, plan, hyperType, null, null, volume, snapshot); } VirtualMachineGuru getVmGuru(final VirtualMachine vm) { @@ -632,6 +695,13 @@ protected void advanceExpunge(VMInstanceVO vm) throws ResourceUnavailableExcepti return; } + if (HypervisorType.External.equals(vm.getHypervisorType())) { + UserVmVO userVM = _userVmDao.findById(vm.getId()); + _userVmDao.loadDetails(userVM); + userVM.setDetail(VmDetailConstants.EXPUNGE_EXTERNAL_VM, Boolean.TRUE.toString()); + _userVmDao.saveDetails(userVM); + } + advanceStop(vm.getUuid(), VmDestroyForcestop.value()); vm = _vmDao.findByUuid(vm.getUuid()); @@ -869,11 +939,27 @@ public void start(final String vmUuid, final Map params, final DeploymentPlan planToDeploy, final DeploymentPlanner planner) { try { advanceStart(vmUuid, params, planToDeploy, planner); - } catch (ConcurrentOperationException | InsufficientCapacityException e) { - throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid); + } catch (ConcurrentOperationException e) { + final CallContext cctxt = CallContext.current(); + final Account account = cctxt.getCallingAccount(); + if (canExposeError(account)) { + throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid); + } + throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to concurrent operation.", vmUuid), e).add(VirtualMachine.class, vmUuid); + } catch (final InsufficientCapacityException e) { + final CallContext cctxt = CallContext.current(); + final Account account = cctxt.getCallingAccount(); + if (canExposeError(account)) { + throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid); + } + throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to insufficient capacity.", vmUuid), e).add(VirtualMachine.class, vmUuid); } catch (final ResourceUnavailableException e) { - if (e.getScope() != null && e.getScope().equals(VirtualRouter.class)){ - throw new CloudRuntimeException("Network is unavailable. Please contact administrator", e).add(VirtualMachine.class, vmUuid); + if (e.getScope() != null && e.getScope().equals(VirtualRouter.class)) { + Account callingAccount = CallContext.current().getCallingAccount(); + String errorSuffix = (callingAccount != null && callingAccount.getType() == Account.Type.ADMIN) ? + String.format("Failure: %s", e.getMessage()) : + "Please contact administrator."; + throw new CloudRuntimeException(String.format("The Network for VM %s is unavailable. %s", vmUuid, errorSuffix), e).add(VirtualMachine.class, vmUuid); } throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid); } @@ -961,7 +1047,7 @@ public Ternary doInTransaction(final final State state = instance.getState(); if (state == State.Running) { - logger.debug("VM is already started: " + vm); + logger.debug("Instance is already started: " + vm); return null; } @@ -1124,6 +1210,141 @@ protected void updateVmMetadataManufacturerAndProduct(VirtualMachineTO vmTO, VMI vmTO.setMetadataProductName(metadataProduct); } + protected void updateExternalVmDetailsFromPrepareAnswer(VirtualMachineTO vmTO, UserVmVO userVmVO, + Map newDetails) { + if (newDetails == null || newDetails.equals(vmTO.getDetails())) { + return; + } + vmTO.setDetails(newDetails); + userVmVO.setDetails(newDetails); + _userVmDao.saveDetails(userVmVO); + } + + protected void updateExternalVmDataFromPrepareAnswer(VirtualMachineTO vmTO, VirtualMachineTO updatedTO) { + final String vncPassword = updatedTO.getVncPassword(); + final Map details = updatedTO.getDetails(); + if ((vncPassword == null || vncPassword.equals(vmTO.getVncPassword())) && + (details == null || details.equals(vmTO.getDetails()))) { + return; + } + UserVmVO userVmVO = _userVmDao.findById(vmTO.getId()); + if (userVmVO == null) { + return; + } + if (vncPassword != null && !vncPassword.equals(userVmVO.getPassword())) { + userVmVO.setVncPassword(vncPassword); + vmTO.setVncPassword(vncPassword); + } + updateExternalVmDetailsFromPrepareAnswer(vmTO, userVmVO, updatedTO.getDetails()); + } + + protected void updateExternalVmNicsFromPrepareAnswer(VirtualMachineTO vmTO, VirtualMachineTO updatedTO) { + if (ObjectUtils.anyNull(vmTO.getNics(), updatedTO.getNics())) { + return; + } + Map originalNicsByUuid = new HashMap<>(); + for (NicTO nic : vmTO.getNics()) { + originalNicsByUuid.put(nic.getNicUuid(), nic); + } + for (NicTO updatedNicTO : updatedTO.getNics()) { + final String nicUuid = updatedNicTO.getNicUuid(); + NicTO originalNicTO = originalNicsByUuid.get(nicUuid); + if (originalNicTO == null) { + continue; + } + final String mac = updatedNicTO.getMac(); + final String ip4 = updatedNicTO.getIp(); + final String ip6 = updatedNicTO.getIp6Address(); + if (Objects.equals(mac, originalNicTO.getMac()) && + Objects.equals(ip4, originalNicTO.getIp()) && + Objects.equals(ip6, originalNicTO.getIp6Address())) { + continue; + } + NicVO nicVO = _nicsDao.findByUuid(nicUuid); + if (nicVO == null) { + continue; + } + logger.debug("Updating {} during External VM preparation", nicVO); + if (ip4 != null && !ip4.equals(nicVO.getIPv4Address())) { + nicVO.setIPv4Address(ip4); + originalNicTO.setIp(ip4); + } + if (ip6 != null && !ip6.equals(nicVO.getIPv6Address())) { + nicVO.setIPv6Address(ip6); + originalNicTO.setIp6Address(ip6); + } + if (mac != null && !mac.equals(nicVO.getMacAddress())) { + nicVO.setMacAddress(mac); + originalNicTO.setMac(mac); + } + _nicsDao.update(nicVO.getId(), nicVO); + } + } + + protected void updateExternalVmFromPrepareAnswer(VirtualMachineTO vmTO, VirtualMachineTO updatedTO) { + if (updatedTO == null) { + return; + } + updateExternalVmDataFromPrepareAnswer(vmTO, updatedTO); + updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + return; + } + + protected void processPrepareExternalProvisioning(boolean firstStart, Host host, + VirtualMachineProfile vmProfile, DataCenter dataCenter) throws CloudRuntimeException { + VirtualMachineTemplate template = vmProfile.getTemplate(); + if (!firstStart || host == null || !HypervisorType.External.equals(host.getHypervisorType()) || + template.getExtensionId() == null) { + return; + } + ExtensionDetailsVO detailsVO = extensionDetailsDao.findDetail(template.getExtensionId(), + ApiConstants.ORCHESTRATOR_REQUIRES_PREPARE_VM); + if (detailsVO == null || !Boolean.parseBoolean(detailsVO.getValue())) { + return; + } + logger.debug("Sending PrepareExternalProvisioningCommand for {}", vmProfile); + VirtualMachineTO virtualMachineTO = toVmTO(vmProfile); + if (virtualMachineTO.getNics() == null || virtualMachineTO.getNics().length == 0) { + List nics = _nicsDao.listByVmId(vmProfile.getId()); + NicTO[] nicTOs = new NicTO[nics.size()]; + nics.forEach(nicVO -> { + NicTO nicTO = toNicTO(_networkModel.getNicProfile(vmProfile.getVirtualMachine(), nicVO, dataCenter), + HypervisorType.External); + nicTOs[nicTO.getDeviceId()] = nicTO; + }); + virtualMachineTO.setNics(nicTOs); + } + Map vmDetails = virtualMachineTO.getExternalDetails(); + Map> externalDetails = extensionsManager.getExternalAccessDetails(host, + vmDetails); + PrepareExternalProvisioningCommand cmd = new PrepareExternalProvisioningCommand(virtualMachineTO); + cmd.setExternalDetails(externalDetails); + Answer answer = null; + CloudRuntimeException cre = new CloudRuntimeException("Failed to prepare VM"); + try { + answer = _agentMgr.send(host.getId(), cmd); + } catch (AgentUnavailableException | OperationTimedoutException e) { + logger.error("Failed PrepareExternalProvisioningCommand due to : {}", e.getMessage(), e); + throw cre; + } + if (answer == null) { + logger.error("Invalid answer received for PrepareExternalProvisioningCommand"); + throw cre; + } + if (!(answer instanceof PrepareExternalProvisioningAnswer)) { + logger.error("Unexpected answer received for PrepareExternalProvisioningCommand: [result: {}, details: {}]", + answer.getResult(), answer.getDetails()); + throw cre; + } + PrepareExternalProvisioningAnswer prepareAnswer = (PrepareExternalProvisioningAnswer)answer; + if (!prepareAnswer.getResult()) { + logger.error("Unexpected answer received for PrepareExternalProvisioningCommand: [result: {}, details: {}]", + answer.getResult(), answer.getDetails()); + throw cre; + } + updateExternalVmFromPrepareAnswer(virtualMachineTO, prepareAnswer.getVirtualMachineTO()); + } + @Override public void orchestrateStart(final String vmUuid, final Map params, final DeploymentPlan planToDeploy, final DeploymentPlanner planner) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { @@ -1135,6 +1356,8 @@ public void orchestrateStart(final String vmUuid, final Map vols = _volsDao.findReadyRootVolumesByInstance(vm.getId()); for (final VolumeVO vol : vols) { final Long volTemplateId = vol.getTemplateId(); if (volTemplateId != null && volTemplateId != template.getId()) { - logger.debug("{} of {} is READY, but template ids don't match, let the planner reassign a new pool", vol, vm); + logger.debug("{} of {} is READY, but Template IDs don't match, let the planner reassign a new pool", vol, vm); continue; } @@ -1224,10 +1449,17 @@ public void orchestrateStart(final String vmUuid, final Map sshAccessDetails = _networkMgr.getSystemVMAccessDetails(vm); final Map ipAddressDetails = new HashMap<>(sshAccessDetails); ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME); StartCommand command = new StartCommand(vmTO, dest.getHost(), getExecuteInSequence(vm.getHypervisorType())); + updateStartCommandWithExternalDetails(dest.getHost(), vmTO, command); cmds.addCommand(command); vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx); @@ -1337,11 +1592,11 @@ public void orchestrateStart(final String vmUuid, final Map vmExternalDetails = vmTO.getExternalDetails(); + for (NicTO nic : vmTO.getNics()) { + if (!nic.isDefaultNic()) { + continue; + } + vmExternalDetails.put(VmDetailConstants.CLOUDSTACK_VLAN, networkService.getNicVlanValueForExternalVm(nic)); + } + Map> externalDetails = extensionsManager.getExternalAccessDetails(host, vmExternalDetails); + command.setExternalDetails(externalDetails); + } + + protected void updateStopCommandForExternalHypervisorType(final HypervisorType hypervisorType, + final VirtualMachineProfile vmProfile, final StopCommand stopCommand) { + if (!HypervisorType.External.equals(hypervisorType) || vmProfile.getHostId() == null) { + return; + } + Host host = _hostDao.findById(vmProfile.getHostId()); + if (host == null) { + return; + } + VirtualMachineTO vmTO = ObjectUtils.defaultIfNull(stopCommand.getVirtualMachine(), toVmTO(vmProfile)); + if (MapUtils.isEmpty(vmTO.getGuestOsDetails())) { + vmTO.setGuestOsDetails(null); + } + if (MapUtils.isEmpty(vmTO.getExtraConfig())) { + vmTO.setExtraConfig(null); + } + if (MapUtils.isEmpty(vmTO.getNetworkIdToNetworkNameMap())) { + vmTO.setNetworkIdToNetworkNameMap(null); + } + Map> externalDetails = extensionsManager.getExternalAccessDetails(host, vmTO.getExternalDetails()); + stopCommand.setVirtualMachine(vmTO); + stopCommand.setExternalDetails(externalDetails); + } + + protected void updateRebootCommandWithExternalDetails(Host host, VirtualMachineTO vmTO, RebootCommand rebootCmd) { + if (!HypervisorType.External.equals(host.getHypervisorType())) { + return; } + Map> externalDetails = extensionsManager.getExternalAccessDetails(host, vmTO.getExternalDetails()); + rebootCmd.setExternalDetails(externalDetails); } public void setVmNetworkDetails(VMInstanceVO vm, VirtualMachineTO vmTO) { @@ -1523,16 +1842,16 @@ private void updateOverCommitRatioForVmProfile(VirtualMachineProfile vmProfile, final ClusterDetailsVO clusterDetailRam = _clusterDetailsDao.findDetail(clusterId, VmDetailConstants.MEMORY_OVER_COMMIT_RATIO); final float parsedClusterCpuDetailCpu = Float.parseFloat(clusterDetailCpu.getValue()); final float parsedClusterDetailRam = Float.parseFloat(clusterDetailRam.getValue()); - UserVmDetailVO vmDetailCpu = userVmDetailsDao.findDetail(vmProfile.getId(), VmDetailConstants.CPU_OVER_COMMIT_RATIO); - UserVmDetailVO vmDetailRam = userVmDetailsDao.findDetail(vmProfile.getId(), VmDetailConstants.MEMORY_OVER_COMMIT_RATIO); + VMInstanceDetailVO vmDetailCpu = vmInstanceDetailsDao.findDetail(vmProfile.getId(), VmDetailConstants.CPU_OVER_COMMIT_RATIO); + VMInstanceDetailVO vmDetailRam = vmInstanceDetailsDao.findDetail(vmProfile.getId(), VmDetailConstants.MEMORY_OVER_COMMIT_RATIO); if ((vmDetailCpu == null && parsedClusterCpuDetailCpu > 1f) || (vmDetailCpu != null && Float.parseFloat(vmDetailCpu.getValue()) != parsedClusterCpuDetailCpu)) { - userVmDetailsDao.addDetail(vmProfile.getId(), VmDetailConstants.CPU_OVER_COMMIT_RATIO, clusterDetailCpu.getValue(), true); + vmInstanceDetailsDao.addDetail(vmProfile.getId(), VmDetailConstants.CPU_OVER_COMMIT_RATIO, clusterDetailCpu.getValue(), true); } if ((vmDetailRam == null && parsedClusterDetailRam > 1f) || (vmDetailRam != null && Float.parseFloat(vmDetailRam.getValue()) != parsedClusterDetailRam)) { - userVmDetailsDao.addDetail(vmProfile.getId(), VmDetailConstants.MEMORY_OVER_COMMIT_RATIO, clusterDetailRam.getValue(), true); + vmInstanceDetailsDao.addDetail(vmProfile.getId(), VmDetailConstants.MEMORY_OVER_COMMIT_RATIO, clusterDetailRam.getValue(), true); } vmProfile.setCpuOvercommitRatio(Float.parseFloat(clusterDetailCpu.getValue())); @@ -1748,7 +2067,7 @@ public boolean getExecuteInSequence(final HypervisorType hypervisorType) { } @Override - public boolean unmanage(String vmUuid) { + public Pair unmanage(String vmUuid, Long paramHostId) { VMInstanceVO vm = _vmDao.findByUuid(vmUuid); if (vm == null || vm.getRemoved() != null) { throw new CloudRuntimeException("Could not find VM with id = " + vmUuid); @@ -1761,6 +2080,10 @@ public boolean unmanage(String vmUuid) { throw new ConcurrentOperationException(msg); } + Long agentHostId = vm.getHostId(); + if (HypervisorType.KVM.equals(vm.getHypervisorType())) { + agentHostId = persistDomainForKVM(vm, paramHostId); + } Boolean result = Transaction.execute(new TransactionCallback() { @Override public Boolean doInTransaction(TransactionStatus status) { @@ -1784,21 +2107,66 @@ public Boolean doInTransaction(TransactionStatus status) { return true; } }); + HostVO host = ApiDBUtils.findHostById(agentHostId); + if (host == null) { + return new Pair<>(result, null); + } + logger.debug("Selected host UUID: {} to unmanage Instance: {}.", host.getUuid(), vm.getName()); + ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_VM_UNMANAGE, + String.format("Successfully unmanaged Instance: %s (ID: %s) on host ID: %s", vm.getName(), vm.getUuid(), host.getUuid()), + vm.getId(), ApiCommandResourceType.VirtualMachine.toString()); + return new Pair<>(result, host.getUuid()); + } + + Long persistDomainForKVM(VMInstanceVO vm, Long paramHostId) { + Long agentHostId = vm.getHostId(); + String vmName = vm.getName(); + UnmanageInstanceCommand unmanageInstanceCommand; + if (State.Stopped.equals(vm.getState())) { + if (paramHostId == null) { + Pair clusterAndHostId = findClusterAndHostIdForVm(vm, false); + agentHostId = clusterAndHostId.second(); + if (agentHostId == null) { + String errorMsg = "No available host to persist domain XML for Instance: " + vmName; + logger.debug(errorMsg); + throw new CloudRuntimeException(errorMsg); + } + } else { + agentHostId = paramHostId; + } + unmanageInstanceCommand = new UnmanageInstanceCommand(prepVmSpecForUnmanageCmd(vm.getId(), agentHostId)); // reconstruct vmSpec for stopped instance + } else { + unmanageInstanceCommand = new UnmanageInstanceCommand(vmName); + unmanageInstanceCommand.setConfigDriveAttached(vmInstanceDetailsDao.findDetail(vm.getId(), VmDetailConstants.CONFIG_DRIVE_LOCATION) != null); + } - return BooleanUtils.isTrue(result); + logger.debug("Selected host ID: {} to persist domain XML for Instance: {}.", agentHostId, vmName); + try { + Answer answer = _agentMgr.send(agentHostId, unmanageInstanceCommand); + if (!answer.getResult()) { + String errorMsg = "Failed to persist domain XML for Instance: " + vmName + " on host ID: " + agentHostId; + logger.debug(errorMsg); + throw new CloudRuntimeException(errorMsg); + } + } catch (AgentUnavailableException | OperationTimedoutException e) { + String errorMsg = "Failed to send command to persist domain XML for Instance: " + vmName + " on host ID: " + agentHostId; + logger.error(errorMsg, e); + throw new CloudRuntimeException(errorMsg); + } + return agentHostId; } /** * Clean up VM snapshots (if any) from DB */ - private void unmanageVMSnapshots(VMInstanceVO vm) { + void unmanageVMSnapshots(VMInstanceVO vm) { _vmSnapshotMgr.deleteVMSnapshotsFromDB(vm.getId(), true); } /** * Clean up volumes for a VM to be unmanaged from CloudStack */ - private void unmanageVMVolumes(VMInstanceVO vm) { + void unmanageVMVolumes(VMInstanceVO vm) { final Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId(); if (hostId != null) { volumeMgr.revokeAccess(vm.getId(), hostId); @@ -1816,7 +2184,7 @@ private void unmanageVMVolumes(VMInstanceVO vm) { * - If 'unmanage.vm.preserve.nics' = true: then the NICs are not removed but still Allocated, to preserve MAC addresses * - If 'unmanage.vm.preserve.nics' = false: then the NICs are removed while unmanaging */ - private void unmanageVMNics(VirtualMachineProfile profile, VMInstanceVO vm) { + void unmanageVMNics(VirtualMachineProfile profile, VMInstanceVO vm) { logger.debug("Cleaning up NICs of {}.", vm.toString()); Boolean preserveNics = UnmanagedVMsManager.UnmanageVMPreserveNic.valueIn(vm.getDataCenterId()); if (BooleanUtils.isTrue(preserveNics)) { @@ -1857,6 +2225,7 @@ protected boolean sendStop(final VirtualMachineGuru guru, final VirtualMachinePr final VirtualMachine vm = profile.getVirtualMachine(); Map vlanToPersistenceMap = getVlanToPersistenceMapForVM(vm.getId()); StopCommand stpCmd = new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()), checkBeforeCleanup); + updateStopCommandForExternalHypervisorType(vm.getHypervisorType(), profile, stpCmd); if (MapUtils.isNotEmpty(vlanToPersistenceMap)) { stpCmd.setVlanToPersistenceMap(vlanToPersistenceMap); } @@ -1881,9 +2250,7 @@ protected boolean sendStop(final VirtualMachineGuru guru, final VirtualMachinePr } final GPUDeviceTO gpuDevice = stop.getGpuDevice(); - if (gpuDevice != null) { - _resourceMgr.updateGPUDetails(vm.getHostId(), gpuDevice.getGroupDetails()); - } + _resourceMgr.updateGPUDetailsForVmStop(vm, gpuDevice); if (!answer.getResult()) { final String details = answer.getDetails(); logger.debug("Unable to stop VM due to {}", details); @@ -1987,7 +2354,7 @@ protected void releaseVmResources(final VirtualMachineProfile profile, final boo } try { - if (vm.getHypervisorType() != HypervisorType.BareMetal) { + if (vm.getHypervisorType() != HypervisorType.BareMetal && vm.getHypervisorType() != HypervisorType.External) { volumeMgr.release(profile); logger.debug("Successfully released storage resources for the VM {} in {} state", vm, state); } @@ -2184,6 +2551,7 @@ private void advanceStop(final VMInstanceVO vm, final boolean cleanUpEvenIfUnabl Map vlanToPersistenceMap = getVlanToPersistenceMapForVM(vm.getId()); final StopCommand stop = new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()), false, cleanUpEvenIfUnableToStop); stop.setControlIp(getControlNicIpForVM(vm)); + updateStopCommandForExternalHypervisorType(vm.getHypervisorType(), profile, stop); if (MapUtils.isNotEmpty(vlanToPersistenceMap)) { stop.setVlanToPersistenceMap(vlanToPersistenceMap); } @@ -2207,13 +2575,11 @@ private void advanceStop(final VMInstanceVO vm, final boolean cleanUpEvenIfUnabl } stopped = answer.getResult(); if (!stopped) { - throw new CloudRuntimeException("Unable to stop the virtual machine due to " + answer.getDetails()); + throw new CloudRuntimeException("Unable to stop the Instance due to " + answer.getDetails()); } vmGuru.finalizeStop(profile, answer); final GPUDeviceTO gpuDevice = stop.getGpuDevice(); - if (gpuDevice != null) { - _resourceMgr.updateGPUDetails(vm.getHostId(), gpuDevice.getGroupDetails()); - } + _resourceMgr.updateGPUDetailsForVmStop(vm, gpuDevice); } else { throw new CloudRuntimeException("Invalid answer received in response to a StopCommand on " + vm.instanceName); } @@ -2233,6 +2599,14 @@ private void advanceStop(final VMInstanceVO vm, final boolean cleanUpEvenIfUnabl } else { logger.warn("Unable to actually stop {} but continue with release because it's a force stop", vm); vmGuru.finalizeStop(profile, answer); + if (HypervisorType.External.equals(profile.getHypervisorType())) { + try { + stateTransitTo(vm, VirtualMachine.Event.OperationSucceeded, null); + } catch (final NoTransitionException e) { + logger.warn("Unable to transition the state " + vm, e); + } + } + } } else { if (VirtualMachine.systemVMs.contains(vm.getType())) { @@ -2308,6 +2682,7 @@ public boolean stateTransitTo(final VirtualMachine vm1, final VirtualMachine.Eve _reservationDao.setResourceId(Resource.ResourceType.user_vm, null); _reservationDao.setResourceId(Resource.ResourceType.cpu, null); _reservationDao.setResourceId(Resource.ResourceType.memory, null); + _reservationDao.setResourceId(Resource.ResourceType.gpu, null); } return _stateMachine.transitTo(vm, e, new Pair<>(vm.getHostId(), hostId), _vmDao); } @@ -2326,6 +2701,8 @@ public void destroy(final String vmUuid, final boolean expunge) throws AgentUnav deleteVMSnapshots(vm, expunge); + gpuService.deallocateAllGpuDevicesForVm(vm.getId()); + Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) throws CloudRuntimeException { @@ -2336,6 +2713,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) throws throw new CloudRuntimeException("Unable to destroy " + vm); } else { if (expunge) { + backupManager.checkAndRemoveBackupOfferingBeforeExpunge(vm); if (!stateTransitTo(vm, VirtualMachine.Event.ExpungeOperation, vm.getHostId())) { logger.debug("Unable to expunge the vm because it is not in the correct state: {}", vm); throw new CloudRuntimeException("Unable to expunge " + vm); @@ -2361,8 +2739,8 @@ public void doInTransactionWithoutResult(final TransactionStatus status) throws private void deleteVMSnapshots(VMInstanceVO vm, boolean expunge) { if (! vm.getHypervisorType().equals(HypervisorType.VMware)) { if (!_vmSnapshotMgr.deleteAllVMSnapshots(vm.getId(), null)) { - logger.debug("Unable to delete all snapshots for {}", vm); - throw new CloudRuntimeException("Unable to delete vm snapshots for " + vm); + logger.debug("Unable to delete all Snapshots for {}", vm); + throw new CloudRuntimeException("Unable to delete Instance Snapshots for " + vm); } } else { @@ -2391,7 +2769,7 @@ protected boolean checkVmOnHost(final VirtualMachine vm, final long hostId) thro if (command != null) { RestoreVMSnapshotAnswer restoreVMSnapshotAnswer = (RestoreVMSnapshotAnswer) _agentMgr.send(hostId, command); if (restoreVMSnapshotAnswer == null || !restoreVMSnapshotAnswer.getResult()) { - logger.warn("Unable to restore the vm snapshot from image file after live migration of vm with vmsnapshots: {}", restoreVMSnapshotAnswer == null ? "null answer" : restoreVMSnapshotAnswer.getDetails()); + logger.warn("Unable to restore the Instance Snapshot from image file after live migration of Instance with vmsnapshots: {}", restoreVMSnapshotAnswer == null ? "null answer" : restoreVMSnapshotAnswer.getDetails()); } } } @@ -2528,6 +2906,7 @@ private void markVolumesInPool(VMInstanceVO vm, Answer[] hypervisorMigrationResu } volume.setPath(result.getPath()); volume.setPoolId(pool.getId()); + volume.setPoolType(pool.getPoolType()); if (result.getChainInfo() != null) { volume.setChainInfo(result.getChainInfo()); } @@ -2577,7 +2956,7 @@ private Map prepareVmStorageMigration(VMInstanceVO vm, Map< clusterId = cluster.getId(); } if (dataCenterId == null) { - String msg = "Unable to migrate vm: failed to create deployment destination with given volume to pool map"; + String msg = "Unable to migrate Instance: failed to create deployment destination with given volume to pool map"; logger.debug(msg); throw new CloudRuntimeException(msg); } @@ -2588,7 +2967,7 @@ private Map prepareVmStorageMigration(VMInstanceVO vm, Map< try { stateTransitTo(vm, Event.StorageMigrationRequested, null); } catch (final NoTransitionException e) { - String msg = String.format("Unable to migrate vm: %s", vm.getUuid()); + String msg = String.format("Unable to migrate Instance: %s", vm.getUuid()); logger.warn(msg, e); throw new CloudRuntimeException(msg, e); } @@ -2714,14 +3093,14 @@ public void migrate(final String vmUuid, final long srcHostId, final DeployDesti private void orchestrateMigrate(final String vmUuid, final long srcHostId, final DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException { final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); if (vm == null) { - logger.debug("Unable to find the vm {}", vmUuid); - throw new CloudRuntimeException("Unable to find a virtual machine with id " + vmUuid); + logger.debug("Unable to find the Instance {}", vmUuid); + throw new CloudRuntimeException("Unable to find a Instance with ID: " + vmUuid); } migrate(vm, srcHostId, dest); } protected void migrate(final VMInstanceVO vm, final long srcHostId, final DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException { - logger.info("Migrating {} to {}", vm, dest); + logger.info("Start preparing migration of the VM: {} to {}", vm, dest); final long dstHostId = dest.getHost().getId(); final Host fromHost = _hostDao.findById(srcHostId); if (fromHost == null) { @@ -2786,9 +3165,11 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy if (pfma == null || !pfma.getResult()) { final String details = pfma != null ? pfma.getDetails() : "null answer returned"; final String msg = "Unable to prepare for migration due to " + details; + logger.error("Failed to prepare destination host {} for migration of VM {} : {}", dstHostId, vm.getInstanceName(), details); pfma = null; throw new AgentUnavailableException(msg, dstHostId); } + logger.debug("Successfully prepared destination host {} for migration of VM {} ", dstHostId, vm.getInstanceName()); } catch (final OperationTimedoutException e1) { throw new AgentUnavailableException("Operation timed out", dstHostId); } finally { @@ -2809,18 +3190,23 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy volumeMgr.release(vm.getId(), dstHostId); } - logger.info("Migration cancelled because state has changed: {}", vm); - throw new ConcurrentOperationException("Migration cancelled because state has changed: " + vm); + String msg = "Migration cancelled because state has changed: " + vm; + logger.warn(msg); + throw new ConcurrentOperationException(msg); } } catch (final NoTransitionException e1) { _networkMgr.rollbackNicForMigration(vmSrc, profile); volumeMgr.release(vm.getId(), dstHostId); - logger.info("Migration cancelled because {}", e1.getMessage()); + String msg = String.format("Migration cancelled for VM %s due to state transition failure: %s", + vm.getInstanceName(), e1.getMessage()); + logger.warn(msg, e1); throw new ConcurrentOperationException("Migration cancelled because " + e1.getMessage()); } catch (final CloudRuntimeException e2) { _networkMgr.rollbackNicForMigration(vmSrc, profile); volumeMgr.release(vm.getId(), dstHostId); - logger.info("Migration cancelled because {}", e2.getMessage()); + String msg = String.format("Migration cancelled for VM %s due to runtime exception: %s", + vm.getInstanceName(), e2.getMessage()); + logger.error(msg, e2); work.setStep(Step.Done); _workDao.update(work.getId(), work); try { @@ -2840,14 +3226,36 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy final Answer ma = _agentMgr.send(vm.getLastHostId(), mc); if (ma == null || !ma.getResult()) { final String details = ma != null ? ma.getDetails() : "null answer returned"; + String msg = String.format("Migration command failed for VM %s on source host id=%s to destination host %s: %s", + vm.getInstanceName(), vm.getLastHostId(), dstHostId, details); + logger.error(msg); throw new CloudRuntimeException(details); } + logger.info("Migration command successful for VM {}", vm.getInstanceName()); } catch (final OperationTimedoutException e) { - if (e.isActive()) { - logger.warn("Active migration command so scheduling a restart for {}", vm, e); - _haMgr.scheduleRestart(vm, true); + boolean success = false; + if (HypervisorType.KVM.equals(vm.getHypervisorType())) { + try { + final Answer answer = _agentMgr.send(vm.getHostId(), new CheckVirtualMachineCommand(vm.getInstanceName())); + if (answer != null && answer.getResult() && answer instanceof CheckVirtualMachineAnswer) { + final CheckVirtualMachineAnswer vmAnswer = (CheckVirtualMachineAnswer) answer; + if (VirtualMachine.PowerState.PowerOn.equals(vmAnswer.getState())) { + logger.info(String.format("Vm %s is found on destination host %s. Migration is successful", vm, vm.getHostId())); + success = true; + } + } + } catch (Exception ex) { + logger.error(String.format("Failed to get state of VM %s on destination host %s: %s", vm, vm.getHostId(), ex.getMessage())); + } + } + if (!success) { + if (e.isActive()) { + logger.warn("Active migration command so scheduling a restart for {}", vm, e); + _haMgr.scheduleRestart(vm, true); + + throw new AgentUnavailableException("Operation timed out on migrating " + vm, dstHostId); + } } - throw new AgentUnavailableException("Operation timed out on migrating " + vm, dstHostId); } try { @@ -2860,7 +3268,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy try { if (!checkVmOnHost(vm, dstHostId)) { - logger.error("Unable to complete migration for {}", vm); + logger.error("Migration verification failed for VM {} : VM not found on destination host {} ", vm.getInstanceName(), dstHostId); try { _agentMgr.send(srcHostId, new Commands(cleanup(vm, dpdkInterfaceMapping)), null); } catch (final AgentUnavailableException e) { @@ -2875,9 +3283,11 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy migrated = true; } finally { if (!migrated) { - logger.info("Migration was unsuccessful. Cleaning up: {}", vm); + logger.info("Migration was unsuccessful. Cleaning up: {}", vm); _networkMgr.rollbackNicForMigration(vmSrc, profile); volumeMgr.release(vm.getId(), dstHostId); + // deallocate GPU devices for the VM on the destination host + gpuService.deallocateGpuDevicesForVmOnHost(vm.getId(), dstHostId); _alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone " + dest.getDataCenter().getName() + " and pod " + @@ -2885,7 +3295,7 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy try { _agentMgr.send(dstHostId, new Commands(cleanup(vm, dpdkInterfaceMapping)), null); } catch (final AgentUnavailableException ae) { - logger.warn("Looks like the destination Host is unavailable for cleanup", ae); + logger.warn("Destination host {} unavailable for cleanup after failed migration of VM {}", dstHostId, vm.getInstanceName(), ae); } _networkMgr.setHypervisorHostname(profile, dest, false); try { @@ -2894,9 +3304,13 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy logger.warn(e.getMessage()); } } else { + logger.info("Migration completed successfully for VM %s" + vm); _networkMgr.commitNicForMigration(vmSrc, profile); volumeMgr.release(vm.getId(), srcHostId); + // deallocate GPU devices for the VM on the src host after migration is complete + gpuService.deallocateGpuDevicesForVmOnHost(vm.getId(), srcHostId); _networkMgr.setHypervisorHostname(profile, dest, true); + recreateCheckpointsKvmOnVmAfterMigration(vm, dstHostId); updateVmPod(vm, dstHostId); } @@ -2921,6 +3335,7 @@ protected MigrateCommand buildMigrateCommand(VMInstanceVO vmInstance, VirtualMac migrateCommand.setVlanToPersistenceMap(vlanToPersistenceMap); } + logger.debug("Setting auto convergence to: {}", StorageManager.KvmAutoConvergence.value()); migrateCommand.setAutoConvergence(StorageManager.KvmAutoConvergence.value()); migrateCommand.setHostGuid(destination.getHost().getGuid()); @@ -3275,7 +3690,7 @@ private void orchestrateMigrateWithStorage(final String vmUuid, final long srcHo if (defaultNic != null && VirtualMachine.Type.User.equals(vm.getType())) { UserVmVO userVm = _userVmDao.findById(vm.getId()); - Map details = userVmDetailsDao.listDetailsKeyPairs(vm.getId()); + Map details = vmInstanceDetailsDao.listDetailsKeyPairs(vm.getId()); userVm.setDetails(details); Network network = _networkModel.getNetwork(defaultNic.getNetworkId()); @@ -3346,6 +3761,7 @@ private void orchestrateMigrateWithStorage(final String vmUuid, final long srcHo _networkMgr.commitNicForMigration(vmSrc, profile); volumeMgr.release(vm.getId(), srcHostId); _networkMgr.setHypervisorHostname(profile, destination, true); + endSnapshotChainForVolumes(volumeToPoolMap, vm.getHypervisorType()); } work.setStep(Step.Done); @@ -3353,6 +3769,68 @@ private void orchestrateMigrateWithStorage(final String vmUuid, final long srcHo } } + protected void endSnapshotChainForVolumes(Map volumeToPoolMap, HypervisorType hypervisorType) { + Set volumes = volumeToPoolMap.keySet(); + volumes.forEach(volume -> { + Volume volumeOnDestination = _volsDao.findByPoolIdName(volumeToPoolMap.get(volume).getId(), volume.getName()); + snapshotManager.endSnapshotChainForVolume(volumeOnDestination.getId(), hypervisorType); + }); + } + + protected void recreateCheckpointsKvmOnVmAfterMigration(VMInstanceVO vm, long hostId) { + if (!HypervisorType.KVM.equals(vm.getHypervisorType())) { + logger.debug("Will not recreate checkpoint on VM as it is not running on KVM, thus it is not needed."); + return; + } + + List volumes = getVmVolumesWithCheckpointsToRecreate(vm); + + if (volumes.isEmpty()) { + logger.debug("Will not recreate checkpoints on VM as its volumes do not have any checkpoints associated with them."); + return; + } + + RecreateCheckpointsCommand recreateCheckpointsCommand = new RecreateCheckpointsCommand(volumes, vm.getInstanceName()); + Answer answer = null; + try { + logger.debug(String.format("Recreating the volume checkpoints with URLs [%s] of volumes [%s] on %s as part of the migration process.", volumes.stream().map(VolumeObjectTO::getCheckpointPaths).collect(Collectors.toList()), volumes, vm)); + answer = _agentMgr.send(hostId, recreateCheckpointsCommand); + } catch (AgentUnavailableException | OperationTimedoutException e) { + logger.error(String.format("Exception while sending command to host [%s] to recreate checkpoints with URLs [%s] of volumes [%s] on %s due to: [%s].", hostId, volumes.stream().map(VolumeObjectTO::getCheckpointPaths).collect(Collectors.toList()), volumes, vm, e.getMessage()), e); + throw new CloudRuntimeException(e); + } finally { + if (answer != null && answer.getResult()) { + logger.debug(String.format("Successfully recreated checkpoints on VM [%s].", vm)); + return; + } + + logger.debug(String.format("Migration on VM [%s] was successful; however, we weren't able to recreate the checkpoints on it. Marking the snapshot chain as ended." + + " Next snapshot will create a new snapshot chain.", vm)); + + volumes.forEach(volumeObjectTO -> snapshotManager.endSnapshotChainForVolume(volumeObjectTO.getId(), HypervisorType.KVM)); + } + } + + + protected List getVmVolumesWithCheckpointsToRecreate(VMInstanceVO vm) { + List vmVolumes = _volsDao.findByInstance(vm.getId()); + List volumes = new ArrayList<>(); + + for (VolumeVO volume : vmVolumes) { + Pair, Set> volumeCheckpointPathsAndImageStoreUrls = volumeMgr.getVolumeCheckpointPathsAndImageStoreUrls(volume.getId(), HypervisorType.KVM); + if (volumeCheckpointPathsAndImageStoreUrls.first().isEmpty()) { + continue; + } + VolumeObjectTO volumeTo = new VolumeObjectTO(); + volumeTo.setCheckpointPaths(volumeCheckpointPathsAndImageStoreUrls.first()); + volumeTo.setCheckpointImageStoreUrls(volumeCheckpointPathsAndImageStoreUrls.second()); + volumeTo.setPath(volume.getPath()); + volumes.add(volumeTo); + } + return volumes; + } + + @Override public VirtualMachineTO toVmTO(final VirtualMachineProfile profile) { final HypervisorGuru hvGuru = _hvGuruMgr.getGuru(profile.getVirtualMachine().getHypervisorType()); @@ -3546,19 +4024,6 @@ protected void runInContext() { } } - @Override - public boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering) { - boolean isMachineUpgradable = true; - for (final HostAllocator allocator : hostAllocators) { - isMachineUpgradable = allocator.isVirtualMachineUpgradable(vm, offering); - if (!isMachineUpgradable) { - break; - } - } - - return isMachineUpgradable; - } - @Override public void reboot(final String vmUuid, final Map params) throws InsufficientCapacityException, ResourceUnavailableException { try { @@ -3600,8 +4065,8 @@ private void orchestrateReboot(final String vmUuid, final Map nics = _nicsDao.listByVmId(vmProfile.getId()); + Collections.sort(nics, (nic1, nic2) -> { + Long nicId1 = Long.valueOf(nic1.getDeviceId()); + Long nicId2 = Long.valueOf(nic2.getDeviceId()); + return nicId1.compareTo(nicId2); + }); + + for (final NicVO nic : nics) { + final Network network = _networkModel.getNetwork(nic.getNetworkId()); + final NicProfile nicProfile = + new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel.isSecurityGroupSupportedInNetwork(network), + _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network)); + vmProfile.addNic(nicProfile); + } + + List volumes = _volsDao.findUsableVolumesForInstance(vmId); + for (VolumeVO vol: volumes) { + VolumeInfo volumeInfo = volumeDataFactory.getVolume(vol.getId()); + DataTO dataTO = volumeInfo.getTO(); + DiskTO disk = storageMgr.getDiskWithThrottling(dataTO, vol.getVolumeType(), vol.getDeviceId(), vol.getPath(), vm.getServiceOfferingId(), vol.getDiskOfferingId()); + vmProfile.addDisk(disk); + } + + Map details = vmInstanceDetailsDao.listDetailsKeyPairs(vmId, + List.of(VirtualMachineProfile.Param.BootType.getName(), VirtualMachineProfile.Param.BootMode.getName(), + VirtualMachineProfile.Param.UefiFlag.getName())); + + if (details.containsKey(VirtualMachineProfile.Param.BootType.getName())) { + vmProfile.getParameters().put(VirtualMachineProfile.Param.BootType, details.get(VirtualMachineProfile.Param.BootType.getName())); + } + + if (details.containsKey(VirtualMachineProfile.Param.BootMode.getName())) { + vmProfile.getParameters().put(VirtualMachineProfile.Param.BootMode, details.get(VirtualMachineProfile.Param.BootMode.getName())); + } + + if (details.containsKey(VirtualMachineProfile.Param.UefiFlag.getName())) { + vmProfile.getParameters().put(VirtualMachineProfile.Param.UefiFlag, details.get(VirtualMachineProfile.Param.UefiFlag.getName())); + } + + return toVmTO(vmProfile); + } + protected VirtualMachineTO getVmTO(Long vmId) { final VMInstanceVO vm = _vmDao.findById(vmId); final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); @@ -3938,11 +4463,6 @@ public void checkIfCanUpgrade(final VirtualMachine vmInstance, final ServiceOffe throw new InvalidParameterValueException("isSystem property is different for current service offering and new service offering"); } - if (!isVirtualMachineUpgradable(vmInstance, newServiceOffering)) { - throw new InvalidParameterValueException("Unable to upgrade virtual machine, not enough resources available " + "for an offering of " + - newServiceOffering.getCpu() + " cpu(s) at " + newServiceOffering.getSpeed() + " Mhz, and " + newServiceOffering.getRamSize() + " MB of memory"); - } - final List currentTags = StringUtils.csvTagsToList(currentDiskOffering.getTags()); final List newTags = StringUtils.csvTagsToList(newDiskOffering.getTags()); if (VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.valueIn(vmInstance.getDataCenterId())) { @@ -4056,7 +4576,7 @@ private NicProfile orchestrateAddVmToNetwork(final VirtualMachine vm, final Netw final CallContext cctx = CallContext.current(); checkIfNetworkExistsForUserVM(vm, network); - logger.debug("Adding vm {} to network {}; requested nic profile {}", vm, network, requested); + logger.debug("Adding Instance {} to Network {}; requested NIC profile {}", vm, network, requested); final VMInstanceVO vmVO = _vmDao.findById(vm.getId()); final ReservationContext context = new ReservationContextImpl(null, null, cctx.getCallingUser(), cctx.getCallingAccount()); @@ -4075,7 +4595,7 @@ private NicProfile orchestrateAddVmToNetwork(final VirtualMachine vm, final Netw final NicTO nicTO = toNicTO(nic, vmProfile.getVirtualMachine().getHypervisorType()); //4) plug the nic to the vm - logger.debug("Plugging nic for vm {} in network {}", vm, network); + logger.debug("Plugging NIC for Instance {} in Network {}", vm, network); boolean result = false; try { @@ -4091,12 +4611,12 @@ private NicProfile orchestrateAddVmToNetwork(final VirtualMachine vm, final Netw } return nic; } else { - logger.warn("Failed to plug nic to the vm {} in network {}", vm, network); + logger.warn("Failed to plug NIC to the Instance {} in Network {}", vm, network); return null; } } finally { if (!result) { - logger.debug("Removing nic {} from vm {} as nic plug failed on the backend.", nic, vmProfile.getVirtualMachine()); + logger.debug("Removing NIC {} from Instance {} as NIC plug failed on the backend.", nic, vmProfile.getVirtualMachine()); _networkMgr.removeNic(vmProfile, _nicsDao.findById(nic.getId())); } } @@ -4167,25 +4687,25 @@ private boolean orchestrateRemoveNicFromVm(final VirtualMachine vm, final Nic ni if (vm.getState() == State.Running) { final NicTO nicTO = toNicTO(nicProfile, vmProfile.getVirtualMachine().getHypervisorType()); - logger.debug("Un-plugging nic {} for vm {} from network {}.", nic, vm, network); + logger.debug("Un-plugging NIC {} for Instance {} from Network {}.", nic, vm, network); final boolean result = unplugNic(network, nicTO, vmTO, context, dest); if (result) { _userVmMgr.setupVmForPvlan(false, vm.getHostId(), nicProfile); - logger.debug("Nic is unplugged successfully for vm {} in network {}.", vm, network); + logger.debug("NIC is unplugged successfully for Instance {} in Network {}.", vm, network); final long isDefault = nic.isDefaultNic() ? 1 : 0; UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay()); } else { - logger.warn("Failed to unplug nic for the vm {} from network {}.", vm, network); + logger.warn("Failed to unplug NIC for the Instance {} from Network {}.", vm, network); return false; } } else if (vm.getState() != State.Stopped) { - logger.warn("Unable to remove vm {} from network {}", vm, network); - throw new ResourceUnavailableException("Unable to remove vm " + vm + " from network, is not in the right state", DataCenter.class, vm.getDataCenterId()); + logger.warn("Unable to remove Instance {} from Network {}", vm, network); + throw new ResourceUnavailableException("Unable to remove Instance " + vm + " from Network, is not in the right state", DataCenter.class, vm.getDataCenterId()); } _networkMgr.releaseNic(vmProfile, nic); - logger.debug("Successfully released nic {} for vm {}", nic, vm); + logger.debug("Successfully released NIC {} for Instance {}", nic, vm); _networkMgr.removeNic(vmProfile, nic); _nicsDao.remove(nic.getId()); @@ -4220,13 +4740,13 @@ private boolean orchestrateRemoveVmFromNetwork(final VirtualMachine vm, final Ne } if (nic == null) { - logger.warn("Could not get a nic with {}", network); + logger.warn("Could not get a NIC with {}", network); return false; } if (nic.isDefaultNic() && vm.getType() == VirtualMachine.Type.User) { - logger.warn("Failed to remove nic from {} in {}, nic is default.", vm, network); - throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + ", nic is default."); + logger.warn("Failed to remove NIC from {} in {}, NIC is default.", vm, network); + throw new CloudRuntimeException("Failed to remove NIC from " + vm + " in " + network + ", NIC is default."); } final Nic lock = _nicsDao.acquireInLockTable(nic.getId()); @@ -4649,7 +5169,7 @@ public VMInstanceVO reConfigureVm(final String vmUuid, final ServiceOffering old try { result = retrieveResultFromJobOutcomeAndThrowExceptionIfNeeded(outcome); } catch (Exception ex) { - throw new RuntimeException("Unhandled exception", ex); + throw new RuntimeException("Unable to reconfigure VM.", ex); } if (result != null) { @@ -4662,22 +5182,29 @@ public VMInstanceVO reConfigureVm(final String vmUuid, final ServiceOffering old private VMInstanceVO orchestrateReConfigureVm(String vmUuid, ServiceOffering oldServiceOffering, ServiceOffering newServiceOffering, boolean reconfiguringOnExistingHost) throws ResourceUnavailableException, ConcurrentOperationException { - final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); + VMInstanceVO vm = _vmDao.findByUuid(vmUuid); HostVO hostVo = _hostDao.findById(vm.getHostId()); - Long clustedId = hostVo.getClusterId(); - Float memoryOvercommitRatio = CapacityManager.MemOverprovisioningFactor.valueIn(clustedId); - Float cpuOvercommitRatio = CapacityManager.CpuOverprovisioningFactor.valueIn(clustedId); - boolean divideMemoryByOverprovisioning = HypervisorGuruBase.VmMinMemoryEqualsMemoryDividedByMemOverprovisioningFactor.valueIn(clustedId); - boolean divideCpuByOverprovisioning = HypervisorGuruBase.VmMinCpuSpeedEqualsCpuSpeedDividedByCpuOverprovisioningFactor.valueIn(clustedId); + Long clusterId = hostVo.getClusterId(); + Float memoryOvercommitRatio = CapacityManager.MemOverprovisioningFactor.valueIn(clusterId); + Float cpuOvercommitRatio = CapacityManager.CpuOverprovisioningFactor.valueIn(clusterId); + boolean divideMemoryByOverprovisioning = HypervisorGuruBase.VmMinMemoryEqualsMemoryDividedByMemOverprovisioningFactor.valueIn(clusterId); + boolean divideCpuByOverprovisioning = HypervisorGuruBase.VmMinCpuSpeedEqualsCpuSpeedDividedByCpuOverprovisioningFactor.valueIn(clusterId); int minMemory = (int)(newServiceOffering.getRamSize() / (divideMemoryByOverprovisioning ? memoryOvercommitRatio : 1)); int minSpeed = (int)(newServiceOffering.getSpeed() / (divideCpuByOverprovisioning ? cpuOvercommitRatio : 1)); - ScaleVmCommand scaleVmCommand = - new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), minSpeed, - newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse()); + Double cpuQuotaPercentage = null; + if (newServiceOffering.getLimitCpuUse() && vm.getHypervisorType().equals(HypervisorType.KVM)) { + KVMGuru kvmGuru = (KVMGuru) _hvGuruMgr.getGuru(vm.getHypervisorType()); + cpuQuotaPercentage = kvmGuru.getCpuQuotaPercentage(minSpeed, hostVo.getSpeed()); + } + + boolean limitCpuUseChange = oldServiceOffering.getLimitCpuUse() != newServiceOffering.getLimitCpuUse(); + ScaleVmCommand scaleVmCommand = new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), minSpeed, newServiceOffering.getSpeed(), + minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, + newServiceOffering.getLimitCpuUse(), cpuQuotaPercentage, limitCpuUseChange); scaleVmCommand.getVirtualMachine().setId(vm.getId()); scaleVmCommand.getVirtualMachine().setUuid(vm.getUuid()); @@ -4706,16 +5233,20 @@ private VMInstanceVO orchestrateReConfigureVm(String vmUuid, ServiceOffering old throw new CloudRuntimeException("Unable to scale vm due to " + (reconfigureAnswer == null ? "" : reconfigureAnswer.getDetails())); } - upgradeVmDb(vm.getId(), newServiceOffering, oldServiceOffering); + if (reconfiguringOnExistingHost) { + _capacityMgr.releaseVmCapacity(vm, false, false, vm.getHostId()); + } + + boolean vmUpgraded = upgradeVmDb(vm.getId(), newServiceOffering, oldServiceOffering); + if (vmUpgraded) { + vm = _vmDao.findById(vm.getId()); + } if (vm.getType().equals(VirtualMachine.Type.User)) { _userVmMgr.generateUsageEvent(vm, vm.isDisplayVm(), EventTypes.EVENT_VM_DYNAMIC_SCALE); } if (reconfiguringOnExistingHost) { - vm.setServiceOfferingId(oldServiceOffering.getId()); - _capacityMgr.releaseVmCapacity(vm, false, false, vm.getHostId()); - vm.setServiceOfferingId(newServiceOffering.getId()); _capacityMgr.allocateVmCapacity(vm, false); } @@ -4730,29 +5261,40 @@ private VMInstanceVO orchestrateReConfigureVm(String vmUuid, ServiceOffering old } private void removeCustomOfferingDetails(long vmId) { - Map details = userVmDetailsDao.listDetailsKeyPairs(vmId); + Map details = vmInstanceDetailsDao.listDetailsKeyPairs(vmId); details.remove(UsageEventVO.DynamicParameters.cpuNumber.name()); details.remove(UsageEventVO.DynamicParameters.cpuSpeed.name()); details.remove(UsageEventVO.DynamicParameters.memory.name()); - List detailList = new ArrayList<>(); + List detailList = new ArrayList<>(); for(Map.Entry entry: details.entrySet()) { - UserVmDetailVO detailVO = new UserVmDetailVO(vmId, entry.getKey(), entry.getValue(), true); + VMInstanceDetailVO detailVO = new VMInstanceDetailVO(vmId, entry.getKey(), entry.getValue(), true); detailList.add(detailVO); } - userVmDetailsDao.saveDetails(detailList); + vmInstanceDetailsDao.saveDetails(detailList); } private void saveCustomOfferingDetails(long vmId, ServiceOffering serviceOffering) { - Map details = userVmDetailsDao.listDetailsKeyPairs(vmId); - details.put(UsageEventVO.DynamicParameters.cpuNumber.name(), serviceOffering.getCpu().toString()); - details.put(UsageEventVO.DynamicParameters.cpuSpeed.name(), serviceOffering.getSpeed().toString()); - details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString()); - List detailList = new ArrayList<>(); + Map details = vmInstanceDetailsDao.listDetailsKeyPairs(vmId); + + // We need to restore only the customizable parameters. If we save a parameter that is not customizable and attempt + // to restore a VM snapshot, com.cloud.vm.UserVmManagerImpl.validateCustomParameters will fail. + ServiceOffering unfilledOffering = _serviceOfferingDao.findByIdIncludingRemoved(serviceOffering.getId()); + if (unfilledOffering.getCpu() == null) { + details.put(UsageEventVO.DynamicParameters.cpuNumber.name(), serviceOffering.getCpu().toString()); + } + if (unfilledOffering.getSpeed() == null) { + details.put(UsageEventVO.DynamicParameters.cpuSpeed.name(), serviceOffering.getSpeed().toString()); + } + if (unfilledOffering.getRamSize() == null) { + details.put(UsageEventVO.DynamicParameters.memory.name(), serviceOffering.getRamSize().toString()); + } + + List detailList = new ArrayList<>(); for (Map.Entry entry: details.entrySet()) { - UserVmDetailVO detailVO = new UserVmDetailVO(vmId, entry.getKey(), entry.getValue(), true); + VMInstanceDetailVO detailVO = new VMInstanceDetailVO(vmId, entry.getKey(), entry.getValue(), true); detailList.add(detailVO); } - userVmDetailsDao.saveDetails(detailList); + vmInstanceDetailsDao.saveDetails(detailList); } @Override @@ -4767,7 +5309,7 @@ public ConfigKey[] getConfigKeys() { VmConfigDriveLabel, VmConfigDriveOnPrimaryPool, VmConfigDriveForceHostCacheUse, VmConfigDriveUseHostCacheOnUnsupportedPool, HaVmRestartHostUp, ResourceCountRunningVMsonly, AllowExposeHypervisorHostname, AllowExposeHypervisorHostnameAccountLevel, SystemVmRootDiskSize, AllowExposeDomainInMetadata, MetadataCustomCloudName, VmMetadataManufacturer, VmMetadataProductName, - VmSyncPowerStateTransitioning + VmSyncPowerStateTransitioning, SystemVmEnableUserData }; } @@ -4882,22 +5424,22 @@ private void handlePowerOnReportWithNoPendingJobsOnVM(final VMInstanceVO vm) { case Destroyed: case Expunging: - logger.info("Receive power on report when VM is in destroyed or expunging state. vm: {}, state: {}.", vm, vm.getState()); + logger.info("Receive power on report when Instance is in destroyed or expunging state. Instance: {}, state: {}.", vm, vm.getState()); break; case Migrating: - logger.info("VM {} is at {} and we received a power-on report while there is no pending jobs on it.", vm, vm.getState()); + logger.info("Instance {} is at {} and we received a power-on report while there is no pending jobs on it.", vm, vm.getState()); try { stateTransitTo(vm, VirtualMachine.Event.FollowAgentPowerOnReport, vm.getPowerHostId()); } catch (final NoTransitionException e) { - logger.warn("Unexpected VM state transition exception, race-condition?", e); + logger.warn("Unexpected Instance state transition exception, race-condition?", e); } - logger.info("VM {} is sync-ed to at Running state according to power-on report from hypervisor.", vm); + logger.info("Instance {} is sync-ed to at Running state according to power-on report from hypervisor.", vm); break; case Error: default: - logger.info("Receive power on report when VM is in error or unexpected state. vm: {}, state: {}.", vm, vm.getState()); + logger.info("Receive power on report when Instance is in error or unexpected state. Instance: {}, state: {}.", vm, vm.getState()); break; } } @@ -5240,10 +5782,9 @@ public Outcome migrateVmAwayThroughJobQueue(final String vmUuid, workJob = newVmWorkJobAndInfo.first(); VmWorkMigrateAway workInfo = new VmWorkMigrateAway(newVmWorkJobAndInfo.second(), srcHostId); - workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); + setCmdInfoAndSubmitAsyncJob(workJob, workInfo, vmId); } - _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vmId); AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId()); @@ -5656,7 +6197,7 @@ public UserVm restoreVirtualMachine(final long vmId, final Long newTemplateId, f } private UserVm orchestrateRestoreVirtualMachine(final long vmId, final Long newTemplateId, final Long rootDiskOfferingId, final boolean expunge, final Map details) throws ResourceUnavailableException, InsufficientCapacityException { - logger.debug("Restoring vm {} with templateId: {}, diskOfferingId: {}, details: {}", vmId, newTemplateId, rootDiskOfferingId, details); + logger.debug("Restoring Instance {} with templateId: {}, diskOfferingId: {}, details: {}", vmId, newTemplateId, rootDiskOfferingId, details); final CallContext context = CallContext.current(); final Account account = context.getCallingAccount(); return _userVmService.restoreVirtualMachine(account, vmId, newTemplateId, rootDiskOfferingId, expunge, details); @@ -5776,6 +6317,80 @@ private Pair orchestrateUpdateDefaultNic(final VmWorkUpd _jobMgr.marshallResultObject(result)); } + @Override + public boolean updateVmNic(VirtualMachine vm, Nic nic, Boolean enabled) { + Outcome outcome = updateVmNicThroughJobQueue(vm, nic, enabled); + + retrieveVmFromJobOutcome(outcome, vm.getUuid(), "updateVmNic"); + + try { + Object jobResult = retrieveResultFromJobOutcomeAndThrowExceptionIfNeeded(outcome); + if (jobResult instanceof Boolean) { + return BooleanUtils.isTrue((Boolean) jobResult); + } + } catch (ResourceUnavailableException | InsufficientCapacityException ex) { + throw new CloudRuntimeException(String.format("Exception while updating VM [%s] NIC. Check the logs for more information.", vm.getUuid())); + } + throw new CloudRuntimeException("Unexpected job execution result."); + } + + private boolean orchestrateUpdateVmNic(final VirtualMachine vm, final Nic nic, final Boolean enabled) throws ResourceUnavailableException { + if (vm.getState() == State.Running) { + try { + UpdateVmNicCommand updateVmNicCmd = new UpdateVmNicCommand(nic.getMacAddress(), vm.getName(), enabled); + Commands cmds = new Commands(Command.OnError.Stop); + cmds.addCommand("updatevmnic", updateVmNicCmd); + + _agentMgr.send(vm.getHostId(), cmds); + + UpdateVmNicAnswer updateVmNicAnswer = cmds.getAnswer(UpdateVmNicAnswer.class); + if (updateVmNicAnswer == null || !updateVmNicAnswer.getResult()) { + logger.warn("Unable to update VM %s NIC [{}].", vm.getName(), nic.getUuid()); + return false; + } + } catch (final OperationTimedoutException e) { + throw new AgentUnavailableException(String.format("Unable to update NIC %s for VM %s.", nic.getUuid(), vm.getUuid()), vm.getHostId(), e); + } + } + + NicVO nicVo = _nicsDao.findById(nic.getId()); + nicVo.setEnabled(enabled); + _nicsDao.persist(nicVo); + + return true; + } + + public Outcome updateVmNicThroughJobQueue(final VirtualMachine vm, final Nic nic, final Boolean isNicEnabled) { + Long vmId = vm.getId(); + String commandName = VmWorkUpdateNic.class.getName(); + Pair pendingWorkJob = retrievePendingWorkJob(vmId, commandName); + + VmWorkJobVO workJob = pendingWorkJob.first(); + + if (workJob == null) { + Pair newVmWorkJobAndInfo = createWorkJobAndWorkInfo(commandName, vmId); + + workJob = newVmWorkJobAndInfo.first(); + VmWorkUpdateNic workInfo = new VmWorkUpdateNic(newVmWorkJobAndInfo.second(), nic.getId(), isNicEnabled); + + setCmdInfoAndSubmitAsyncJob(workJob, workInfo, vmId); + } + AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId()); + + return new VmJobVirtualMachineOutcome(workJob, vmId); + } + + @ReflectionUse + private Pair orchestrateUpdateVmNic(final VmWorkUpdateNic work) throws Exception { + VMInstanceVO vm = findVmById(work.getVmId()); + final NicVO nic = _entityMgr.findById(NicVO.class, work.getNicId()); + if (nic == null) { + throw new CloudRuntimeException(String.format("Unable to find NIC with ID %s.", work.getNicId())); + } + final boolean result = orchestrateUpdateVmNic(vm, nic, work.isEnabled()); + return new Pair<>(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(result)); + } + private Pair findClusterAndHostIdForVmFromVolumes(long vmId) { Long clusterId = null; Long hostId = null; @@ -5817,8 +6432,9 @@ public Pair findClusterAndHostIdForVm(VirtualMachine vm, boolean ski host = host == null ? _hostDao.findById(hostId) : host; if (host != null) { clusterId = host.getClusterId(); + return new Pair<>(clusterId, hostId); } - return new Pair<>(clusterId, hostId); + return findClusterAndHostIdForVmFromVolumes(vm.getId()); } private Pair findClusterAndHostIdForVm(VirtualMachine vm) { @@ -6071,7 +6687,7 @@ protected boolean isDiskOfferingSuitableForVm(VMInstanceVO vm, VirtualMachinePro @Override public Map getDiskOfferingSuitabilityForVm(long vmId, List diskOfferingIds) { VMInstanceVO vm = _vmDao.findById(vmId); - if (userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_VM) != null) { + if (vmInstanceDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_VM) != null) { return new HashMap<>(); } VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); @@ -6084,4 +6700,32 @@ public Map getDiskOfferingSuitabilityForVm(long vmId, List } return result; } + + @Override + public void checkDeploymentPlan(VirtualMachine virtualMachine, VirtualMachineTemplate template, + ServiceOffering serviceOffering, Account systemAccount, DeploymentPlan plan) + throws InsufficientServerCapacityException { + final VirtualMachineProfileImpl vmProfile = + new VirtualMachineProfileImpl(virtualMachine, template, serviceOffering, systemAccount, null); + DeployDestination destination = + _dpMgr.planDeployment(vmProfile, plan, new DeploymentPlanner.ExcludeList(), null); + if (destination == null) { + throw new InsufficientServerCapacityException(String.format("Unable to create a deployment for %s", + vmProfile), DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile)); + } + } + + @Override + public boolean isBlankInstanceDefaultTemplate(VirtualMachineTemplate template) { + return KVM_BLANK_VM_TEMPLATE_NAME.equals(template.getUniqueName()); + } + + @Override + public boolean isBlankInstance(VirtualMachineTemplate template) { + if (isBlankInstanceDefaultTemplate(template)) { + return true; + } + return Boolean.TRUE.equals( + MapUtils.getBoolean(CallContext.current().getContextParameters(), ApiConstants.BLANK_INSTANCE)); + } } diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java index 7a1a39ec0f07..475ed0f37bd2 100644 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java @@ -89,7 +89,7 @@ protected void updateAndPublishVmPowerStates(long hostId, Map hostCache.get(hostId), () -> vmCache.get(vmId), () -> instancePowerStates.get(vmId)); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, @@ -158,8 +158,8 @@ private void processMissingVmReport(long hostId, Set vmIds, boolean force) // an update might have occurred that we should not override in case of out of band migration instancePowerStates.put(instance.getId(), VirtualMachine.PowerState.PowerReportMissing); } else { - logger.debug("vm id: {} - time since last state update({} ms) has not passed graceful period yet", - instance.getId(), milliSecondsSinceLastStateUpdate); + logger.debug("vm id: {} - time since last state update({} ms) has not passed graceful period ({} ms) yet", + instance.getId(), milliSecondsSinceLastStateUpdate, milliSecondsGracefulPeriod); } } updateAndPublishVmPowerStates(hostId, instancePowerStates, startTime); diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VmWorkUpdateNic.java b/engine/orchestration/src/main/java/com/cloud/vm/VmWorkUpdateNic.java new file mode 100644 index 000000000000..1c63cf34a192 --- /dev/null +++ b/engine/orchestration/src/main/java/com/cloud/vm/VmWorkUpdateNic.java @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm; + +public class VmWorkUpdateNic extends VmWork { + private static final long serialVersionUID = -8957066627929113278L; + + Long nicId; + Boolean enabled; + + public VmWorkUpdateNic(VmWork vmWork, Long nicId, Boolean enabled) { + super(vmWork); + this.nicId = nicId; + this.enabled = enabled; + } + + public Long getNicId() { + return nicId; + } + + public Boolean isEnabled() { + return enabled; + } +} diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java index 19b0e773cd01..39ab83fab600 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java @@ -114,6 +114,9 @@ public class EngineClusterVO implements EngineCluster, Identity { @Column(name = "engine_state", updatable = true, nullable = false, length = 32) protected State state = null; + @Column(name = "storage_access_groups") + String storageAccessGroups; + public EngineClusterVO() { clusterType = Cluster.ClusterType.CloudManaged; allocationState = Grouping.AllocationState.Enabled; @@ -176,6 +179,11 @@ public ManagedState getManagedState() { return managedState; } + @Override + public String getStorageAccessGroups() { + return storageAccessGroups; + } + public void setManagedState(ManagedState managedState) { this.managedState = managedState; } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java index 95931d5b72d5..cd3f6b857a29 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java @@ -89,6 +89,9 @@ public class EngineHostPodVO implements EnginePod, Identity { @Temporal(value = TemporalType.TIMESTAMP) protected Date lastUpdated; + @Column(name = "storage_access_groups") + String storageAccessGroups; + /** * Note that state is intentionally missing the setter. Any updates to * the state machine needs to go through the DAO object because someone @@ -202,6 +205,11 @@ public boolean getExternalDhcp() { return externalDhcp; } + @Override + public String getStorageAccessGroups() { + return storageAccessGroups; + } + public void setExternalDhcp(boolean use) { externalDhcp = use; } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java index 8ef2de3f74da..eec2b011b3e8 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java @@ -405,6 +405,9 @@ public void setHostTags(List hostTags) { @Column(name = "engine_state", updatable = true, nullable = false, length = 32) protected State orchestrationState = null; + @Column(name = "storage_access_groups") + private String storageAccessGroups = null; + public EngineHostVO(String guid) { this.guid = guid; this.status = Status.Creating; @@ -807,4 +810,13 @@ public State getOrchestrationState() { public PartitionType partitionType() { return PartitionType.Host; } + + @Override + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java index 2ad8d15d0b71..7f6571becc83 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java @@ -213,7 +213,6 @@ public EngineHostDaoImpl() { SequenceSearch = createSearchBuilder(); SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ); - // SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence()); SequenceSearch.done(); DirectlyConnectedSearch = createSearchBuilder(); diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java index 6763a13aed63..964265cb873e 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java @@ -18,6 +18,10 @@ */ package org.apache.cloudstack.engine.orchestration; +import com.cloud.storage.Snapshot; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.Volume; +import com.cloud.template.VirtualMachineTemplate; import java.net.URL; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -57,8 +61,9 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.VmDiskInfo; import com.cloud.vm.dao.UserVmDao; -import com.cloud.vm.dao.UserVmDetailsDao; +import com.cloud.vm.dao.VMInstanceDetailsDao; import com.cloud.vm.dao.VMInstanceDao; import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS; @@ -83,7 +88,7 @@ public class CloudOrchestrator implements OrchestrationService { protected UserVmDao _userVmDao = null; @Inject - protected UserVmDetailsDao _userVmDetailsDao = null; + protected VMInstanceDetailsDao _vmInstanceDetailsDao = null; @Inject protected ServiceOfferingDao _serviceOfferingDao; @@ -158,8 +163,9 @@ public void destroyVolume(String volumeEntity) { @Override public VirtualMachineEntity createVirtualMachine(String id, String owner, String templateId, String hostName, String displayName, String hypervisor, int cpu, - int speed, long memory, Long diskSize, List computeTags, List rootDiskTags, Map> networkNicMap, DeploymentPlan plan, - Long rootDiskSize, Map> extraDhcpOptionMap, Map dataDiskTemplateToDiskOfferingMap, Long dataDiskOfferingId, Long rootDiskOfferingId) throws InsufficientCapacityException { + int speed, long memory, Long diskSize, List computeTags, List rootDiskTags, Map> networkNicMap, DeploymentPlan plan, + Long rootDiskSize, Map> extraDhcpOptionMap, Map dataDiskTemplateToDiskOfferingMap, Long dataDiskOfferingId, Long rootDiskOfferingId, + List dataDiskInfoList, Volume volume, Snapshot snapshot) throws InsufficientCapacityException { // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, // vmEntityManager); @@ -184,7 +190,6 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String // Else, a disk offering is optional, and if present will be used to create the data disk DiskOfferingInfo rootDiskOfferingInfo = new DiskOfferingInfo(); - List dataDiskOfferings = new ArrayList(); ServiceOfferingVO computeOffering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); @@ -196,7 +201,7 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String rootDiskOfferingInfo.setSize(rootDiskSize); if (rootDiskOffering.isCustomizedIops() != null && rootDiskOffering.isCustomizedIops()) { - Map userVmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId()); + Map userVmDetails = _vmInstanceDetailsDao.listDetailsKeyPairs(vm.getId()); if (userVmDetails != null) { String minIops = userVmDetails.get(MIN_IOPS); @@ -207,6 +212,8 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String } } + List dataDiskOfferings = new ArrayList(); + List dataDiskDeviceIds = new ArrayList<>(); if (dataDiskOfferingId != null) { DiskOfferingVO diskOffering = _diskOfferingDao.findById(dataDiskOfferingId); if (diskOffering == null) { @@ -228,7 +235,7 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String dataDiskOfferingInfo.setSize(size); if (diskOffering.isCustomizedIops() != null && diskOffering.isCustomizedIops()) { - Map userVmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId()); + Map userVmDetails = _vmInstanceDetailsDao.listDetailsKeyPairs(vm.getId()); if (userVmDetails != null) { String minIops = userVmDetails.get("minIopsDo"); @@ -240,6 +247,12 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String } dataDiskOfferings.add(dataDiskOfferingInfo); + dataDiskDeviceIds.add(null); + } + } else if (dataDiskInfoList != null){ + dataDiskOfferings.addAll(dataDiskInfoList); + for (VmDiskInfo dataDiskInfo : dataDiskInfoList) { + dataDiskDeviceIds.add(dataDiskInfo.getDeviceId()); } } @@ -254,9 +267,13 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String } } } - - _itMgr.allocate(vm.getInstanceName(), _templateDao.findById(new Long(templateId)), computeOffering, rootDiskOfferingInfo, dataDiskOfferings, networkIpMap, plan, - hypervisorType, extraDhcpOptionMap, dataDiskTemplateToDiskOfferingMap); + VirtualMachineTemplate template = null; + if (volume != null || snapshot != null) { + template = _templateDao.findByIdIncludingRemoved(new Long(templateId)); + } else + template = _templateDao.findById(new Long(templateId)); + _itMgr.allocate(vm.getInstanceName(), template, computeOffering, rootDiskOfferingInfo, dataDiskOfferings, dataDiskDeviceIds, + networkIpMap, plan, hypervisorType, extraDhcpOptionMap, dataDiskTemplateToDiskOfferingMap, volume, snapshot); return vmEntity; } @@ -264,7 +281,7 @@ public VirtualMachineEntity createVirtualMachine(String id, String owner, String @Override public VirtualMachineEntity createVirtualMachineFromScratch(String id, String owner, String isoId, String hostName, String displayName, String hypervisor, String os, int cpu, int speed, long memory, Long diskSize, List computeTags, List rootDiskTags, Map> networkNicMap, DeploymentPlan plan, - Map> extraDhcpOptionMap, Long diskOfferingId) + Map> extraDhcpOptionMap, Long diskOfferingId, List dataDiskInfoList, Volume volume, Snapshot snapshot) throws InsufficientCapacityException { // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager); @@ -276,9 +293,11 @@ public VirtualMachineEntity createVirtualMachineFromScratch(String id, String ow ServiceOfferingVO computeOffering = _serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); + VMTemplateVO iso = _templateDao.findByIdIncludingRemoved(Long.valueOf(isoId)); + DiskOfferingInfo rootDiskOfferingInfo = new DiskOfferingInfo(); - if (diskOfferingId == null) { + if (diskOfferingId == null && !_itMgr.isBlankInstance(iso)) { throw new InvalidParameterValueException("Installing from ISO requires a disk offering to be specified for the root disk."); } DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId); @@ -300,7 +319,7 @@ public VirtualMachineEntity createVirtualMachineFromScratch(String id, String ow rootDiskOfferingInfo.setSize(size); if (diskOffering.isCustomizedIops() != null && diskOffering.isCustomizedIops()) { - Map userVmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId()); + Map userVmDetails = _vmInstanceDetailsDao.listDetailsKeyPairs(vm.getId()); if (userVmDetails != null) { String minIops = userVmDetails.get("minIopsDo"); @@ -310,6 +329,14 @@ public VirtualMachineEntity createVirtualMachineFromScratch(String id, String ow rootDiskOfferingInfo.setMaxIops(maxIops != null && maxIops.trim().length() > 0 ? Long.parseLong(maxIops) : null); } } + List dataDiskOfferings = new ArrayList<>(); + List dataDiskDeviceIds = new ArrayList<>(); + if (dataDiskInfoList != null) { + dataDiskOfferings.addAll(dataDiskInfoList); + for (VmDiskInfo dataDiskInfo : dataDiskInfoList) { + dataDiskDeviceIds.add(dataDiskInfo.getDeviceId()); + } + } LinkedHashMap> networkIpMap = new LinkedHashMap>(); for (String uuid : networkNicMap.keySet()) { @@ -321,7 +348,8 @@ public VirtualMachineEntity createVirtualMachineFromScratch(String id, String ow HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor); - _itMgr.allocate(vm.getInstanceName(), _templateDao.findById(new Long(isoId)), computeOffering, rootDiskOfferingInfo, new ArrayList(), networkIpMap, plan, hypervisorType, extraDhcpOptionMap, null); + _itMgr.allocate(vm.getInstanceName(), iso, computeOffering, rootDiskOfferingInfo, dataDiskOfferings, dataDiskDeviceIds, + networkIpMap, plan, hypervisorType, extraDhcpOptionMap, null, volume, snapshot); return vmEntity; } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtility.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtility.java index c260f48dcf8c..5a8dc3038aa8 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtility.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtility.java @@ -22,10 +22,12 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import javax.inject.Inject; @@ -206,14 +208,22 @@ public int compare(DataObject o1, DataObject o2) { protected List getAllReadyTemplates(DataStore srcDataStore, Map, Long>> childTemplates, List templates) { List files = new LinkedList<>(); + Set idsForMigration = new HashSet<>(); + for (TemplateDataStoreVO template : templates) { - VMTemplateVO templateVO = templateDao.findById(template.getTemplateId()); - if (template.getState() == ObjectInDataStoreStateMachine.State.Ready && templateVO != null && - (!templateVO.isPublicTemplate() || (templateVO.isPublicTemplate() && templateVO.getUrl() == null)) && - templateVO.getHypervisorType() != Hypervisor.HypervisorType.Simulator && templateVO.getParentTemplateId() == null) { - files.add(templateFactory.getTemplate(template.getTemplateId(), srcDataStore)); + long templateId = template.getTemplateId(); + if (idsForMigration.contains(templateId)) { + logger.warn("Template store reference [{}] is duplicated; not considering it for migration.", template); + continue; + } + VMTemplateVO templateVO = templateDao.findById(templateId); + if (!shouldMigrateTemplate(template, templateVO)) { + continue; } + files.add(templateFactory.getTemplate(template.getTemplateId(), srcDataStore)); + idsForMigration.add(templateId); } + for (TemplateInfo template: files) { List children = templateDao.listByParentTemplatetId(template.getId()); List temps = new ArrayList<>(); @@ -223,6 +233,7 @@ protected List getAllReadyTemplates(DataStore srcDataStore, Map(temps, getTotalChainSize(temps))); } + return (List) (List) files; } @@ -231,22 +242,71 @@ protected List getAllReadyTemplates(DataStore srcDataStore, Map + *
  • its state is ready, and
  • + *
  • its hypervisor type is not simulator, and
  • + *
  • it is not a child template.
  • + * + */ + protected boolean shouldMigrateTemplate(TemplateDataStoreVO template, VMTemplateVO templateVO) { + if (template.getState() != State.Ready) { + logger.debug("Template [{}] should not be migrated as it is not ready.", template); + return false; + } + + if (templateVO.getHypervisorType() == Hypervisor.HypervisorType.Simulator) { + logger.debug("Template [{}] should not be migrated as its hypervisor type is simulator.", template); + return false; + } + + if (templateVO.getParentTemplateId() != null) { + logger.debug("Template [{}] should not be migrated as it has a parent template.", template); + return false; + } + + logger.debug("Template [{}] should be migrated.", template); + return true; + } + /** Returns parent snapshots and snapshots that do not have any children; snapshotChains comprises of the snapshot chain info * for each parent snapshot and the cumulative size of the chain - this is done to ensure that all the snapshots in a chain * are migrated to the same datastore */ protected List getAllReadySnapshotsAndChains(DataStore srcDataStore, Map, Long>> snapshotChains, List snapshots) { List files = new LinkedList<>(); + Set idsForMigration = new HashSet<>(); + for (SnapshotDataStoreVO snapshot : snapshots) { - SnapshotVO snapshotVO = snapshotDao.findById(snapshot.getSnapshotId()); - if (snapshot.getState() == ObjectInDataStoreStateMachine.State.Ready && - snapshotVO != null && snapshotVO.getHypervisorType() != Hypervisor.HypervisorType.Simulator - && snapshot.getParentSnapshotId() == 0 ) { - SnapshotInfo snap = snapshotFactory.getSnapshot(snapshotVO.getSnapshotId(), snapshot.getDataStoreId(), snapshot.getRole()); - if (snap != null) { - files.add(snap); - } + long snapshotId = snapshot.getSnapshotId(); + if (idsForMigration.contains(snapshotId)) { + logger.warn("Snapshot store reference [{}] is duplicated; not considering it for migration.", snapshot); + continue; + } + if (snapshot.getState() != ObjectInDataStoreStateMachine.State.Ready) { + logger.warn("Not migrating snapshot [{}] because its state is not ready.", snapshot); + continue; + } + SnapshotVO snapshotVO = snapshotDao.findById(snapshotId); + if (snapshotVO == null) { + logger.debug("Not migrating snapshot [{}] because we could not find its database entry.", snapshot); + continue; + } + if (snapshotVO.getHypervisorType() == Hypervisor.HypervisorType.Simulator) { + logger.debug("Not migrating snapshot [{}] because its hypervisor type is simulator.", snapshot); + continue; + } + if (snapshot.getParentSnapshotId() != 0) { + continue; // The child snapshot will be migrated in the for loop below. + } + SnapshotInfo snap = snapshotFactory.getSnapshot(snapshotVO.getSnapshotId(), snapshot.getDataStoreId(), snapshot.getRole()); + if (snap == null) { + logger.debug("Not migrating snapshot [{}] because we could not get its information.", snapshot); + continue; } + files.add(snap); + idsForMigration.add(snapshotId); } for (SnapshotInfo parent : files) { @@ -259,7 +319,7 @@ protected List getAllReadySnapshotsAndChains(DataStore srcDataStore, chain.addAll(children); } } - snapshotChains.put(parent, new Pair, Long>(chain, getTotalChainSize(chain))); + snapshotChains.put(parent, new Pair<>(chain, getTotalChainSize(chain))); } return (List) (List) files; @@ -280,14 +340,31 @@ protected Long getTotalChainSize(List chain) { protected List getAllReadyVolumes(DataStore srcDataStore, List volumes) { List files = new LinkedList<>(); + Set idsForMigration = new HashSet<>(); + for (VolumeDataStoreVO volume : volumes) { - if (volume.getState() == ObjectInDataStoreStateMachine.State.Ready) { - VolumeInfo volumeInfo = volumeFactory.getVolume(volume.getVolumeId(), srcDataStore); - if (volumeInfo != null && volumeInfo.getHypervisorType() != Hypervisor.HypervisorType.Simulator) { - files.add(volumeInfo); - } + long volumeId = volume.getVolumeId(); + if (idsForMigration.contains(volumeId)) { + logger.warn("Volume store reference [{}] is duplicated; not considering it for migration.", volume); + continue; + } + if (volume.getState() != ObjectInDataStoreStateMachine.State.Ready) { + logger.debug("Not migrating volume [{}] because its state is not ready.", volume); + continue; } + VolumeInfo volumeInfo = volumeFactory.getVolume(volume.getVolumeId(), srcDataStore); + if (volumeInfo == null) { + logger.debug("Not migrating volume [{}] because we could not get its information.", volume); + continue; + } + if (volumeInfo.getHypervisorType() == Hypervisor.HypervisorType.Simulator) { + logger.debug("Not migrating volume [{}] because its hypervisor type is simulator.", volume); + continue; + } + files.add(volumeInfo); + idsForMigration.add(volumeId); } + return files; } @@ -299,10 +376,9 @@ protected List getAllReadyVolumes(DataStore srcDataStore) { /** Returns the count of active SSVMs - SSVM with agents in connected state, so as to dynamically increase the thread pool * size when SSVMs scale */ - protected int activeSSVMCount(DataStore dataStore) { - long datacenterId = dataStore.getScope().getScopeId(); + protected int activeSSVMCount(Long zoneId) { List ssvms = - secStorageVmDao.getSecStorageVmListInStates(null, datacenterId, VirtualMachine.State.Running, VirtualMachine.State.Migrating); + secStorageVmDao.getSecStorageVmListInStates(null, zoneId, VirtualMachine.State.Running, VirtualMachine.State.Migrating); int activeSSVMs = 0; for (SecondaryStorageVmVO vm : ssvms) { String name = "s-"+vm.getId()+"-VM"; diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index b0081c6e6856..4262ee701aab 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -16,11 +16,14 @@ // under the License. package org.apache.cloudstack.engine.orchestration; +import static com.cloud.configuration.ConfigurationManager.MESSAGE_DELETE_VLAN_IP_RANGE_EVENT; + import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -38,12 +41,6 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.dc.ASNumberVO; -import com.cloud.bgp.BGPService; -import com.cloud.dc.VlanDetailsVO; -import com.cloud.dc.dao.ASNumberDao; -import com.cloud.dc.dao.VlanDetailsDao; -import com.cloud.network.dao.NsxProviderDao; import org.apache.cloudstack.acl.ControlledEntity.ACLType; import org.apache.cloudstack.annotation.AnnotationService; import org.apache.cloudstack.annotation.dao.AnnotationDao; @@ -61,10 +58,12 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.network.RoutedIpv4Manager; import org.apache.cloudstack.network.dao.NetworkPermissionDao; +import org.apache.cloudstack.reservation.dao.ReservationDao; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; @@ -86,8 +85,11 @@ import com.cloud.alert.AlertManager; import com.cloud.api.query.dao.DomainRouterJoinDao; import com.cloud.api.query.vo.DomainRouterJoinVO; +import com.cloud.bgp.BGPService; import com.cloud.configuration.ConfigurationManager; +import com.cloud.configuration.Resource; import com.cloud.configuration.Resource.ResourceType; +import com.cloud.dc.ASNumberVO; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -95,12 +97,15 @@ import com.cloud.dc.DataCenterVnetVO; import com.cloud.dc.PodVlanMapVO; import com.cloud.dc.Vlan; +import com.cloud.dc.VlanDetailsVO; import com.cloud.dc.VlanVO; +import com.cloud.dc.dao.ASNumberDao; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.DataCenterVnetDao; import com.cloud.dc.dao.PodVlanMapDao; import com.cloud.dc.dao.VlanDao; +import com.cloud.dc.dao.VlanDetailsDao; import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeploymentPlan; @@ -151,6 +156,8 @@ import com.cloud.network.dao.FirewallRulesDao; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.Ipv6GuestPrefixSubnetNetworkMapDao; +import com.cloud.network.dao.NetrisProviderDao; import com.cloud.network.dao.NetworkAccountDao; import com.cloud.network.dao.NetworkAccountVO; import com.cloud.network.dao.NetworkDao; @@ -161,6 +168,7 @@ import com.cloud.network.dao.NetworkServiceMapDao; import com.cloud.network.dao.NetworkServiceMapVO; import com.cloud.network.dao.NetworkVO; +import com.cloud.network.dao.NsxProviderDao; import com.cloud.network.dao.PhysicalNetworkDao; import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao; @@ -208,6 +216,7 @@ import com.cloud.offerings.dao.NetworkOfferingDetailsDao; import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; import com.cloud.resource.ResourceManager; +import com.cloud.resourcelimit.CheckedReservation; import com.cloud.server.ManagementServer; import com.cloud.user.Account; import com.cloud.user.ResourceLimitService; @@ -248,8 +257,8 @@ import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.NicDao; @@ -261,9 +270,6 @@ import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.VMInstanceDao; import com.googlecode.ipv6.IPv6Address; -import org.jetbrains.annotations.NotNull; - -import static com.cloud.configuration.ConfigurationManager.MESSAGE_DELETE_VLAN_IP_RANGE_EVENT; /** * NetworkManagerImpl implements NetworkManager. @@ -355,9 +361,13 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra @Inject private NsxProviderDao nsxProviderDao; @Inject + private NetrisProviderDao netrisProviderDao; + @Inject private ASNumberDao asNumberDao; @Inject private BGPService bgpService; + @Inject + private Ipv6GuestPrefixSubnetNetworkMapDao ipv6GuestPrefixSubnetNetworkMapDao; @Override public List getNetworkGurus() { @@ -440,6 +450,8 @@ public void setDhcpProviders(final List dhcpProviders) { ClusterDao clusterDao; @Inject RoutedIpv4Manager routedIpv4Manager; + @Inject + private ReservationDao reservationDao; protected StateMachine2 _stateMachine; ScheduledExecutorService _executor; @@ -447,7 +459,7 @@ public void setDhcpProviders(final List dhcpProviders) { SearchBuilder AssignIpAddressSearch; SearchBuilder AssignIpAddressFromPodVlanSearch; - HashMap _lastNetworkIdsToFree = new HashMap(); + HashMap _lastNetworkIdsToFree = new HashMap<>(); private void updateRouterDefaultDns(final VirtualMachineProfile vmProfile, final NicProfile nicProfile) { if (!Type.DomainRouter.equals(vmProfile.getType()) || !nicProfile.isDefaultNic()) { @@ -485,8 +497,8 @@ private void updateRouterDefaultDns(final VirtualMachineProfile vmProfile, final @DB public boolean configure(final String name, final Map params) throws ConfigurationException { // populate providers - final Map> defaultSharedNetworkOfferingProviders = new HashMap>(); - final Set defaultProviders = new HashSet(); + final Map> defaultSharedNetworkOfferingProviders = new HashMap<>(); + final Set defaultProviders = new HashSet<>(); final Set tungstenProvider = new HashSet<>(); defaultProviders.add(Network.Provider.VirtualRouter); @@ -505,11 +517,11 @@ public boolean configure(final String name, final Map params) th defaultIsolatedNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); defaultIsolatedNetworkOfferingProviders.put(Service.Vpn, defaultProviders); - final Map> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap>(); + final Map> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap<>(); defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dns, defaultProviders); defaultSharedSGEnabledNetworkOfferingProviders.put(Service.UserData, defaultProviders); - final Set sgProviders = new HashSet(); + final Set sgProviders = new HashSet<>(); sgProviders.add(Provider.SecurityGroupProvider); defaultSharedSGEnabledNetworkOfferingProviders.put(Service.SecurityGroup, sgProviders); @@ -522,7 +534,7 @@ public boolean configure(final String name, final Map params) th defaultTungstenSharedSGEnabledNetworkOfferingProviders.put(Service.SecurityGroup, tungstenProvider); - final Map> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap>(); + final Map> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap<>(); defaultProviders.clear(); defaultProviders.add(Network.Provider.VirtualRouter); defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); @@ -536,7 +548,7 @@ public boolean configure(final String name, final Map params) th defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Vpn, defaultProviders); - final Map> defaultVPCOffProviders = new HashMap>(); + final Map> defaultVPCOffProviders = new HashMap<>(); defaultProviders.clear(); defaultProviders.add(Network.Provider.VPCVirtualRouter); defaultVPCOffProviders.put(Service.Dhcp, defaultProviders); @@ -553,32 +565,32 @@ public boolean configure(final String name, final Map params) th Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) { - NetworkOfferingVO offering = null; + NetworkOfferingVO offering; //#1 - quick cloud network offering if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true, - Availability.Optional, null, new HashMap>(), true, Network.GuestType.Shared, false, null, true, null, true, - false, null, false, null, true, false, false, false, null, null, null, true, null, null, false); + Availability.Optional, null, new HashMap<>(), true, Network.GuestType.Shared, false, null, true, null, true, + false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false); } //#2 - SG enabled network offering if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks", TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, - null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false); + null, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false); } //#3 - shared network offering with no SG service if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false, - null, true, false, false, false, null,null, null, true, null, null, false); + null, true, false, false, false, false, null, null, null, true, null, null, false); } if (_networkOfferingDao.findByUniqueName(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE, "Offering for Tungsten Shared Security group enabled networks", TrafficType.Guest, null, true, Availability.Optional, null, defaultTungstenSharedSGEnabledNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, - null, true, false, null, false, null, true, false, true, false, null, null,null, true, null, null, false); + null, true, false, null, false, null, true, false, true, false, false, null, null, null, true, null, null, false); offering.setState(NetworkOffering.State.Enabled); _networkOfferingDao.update(offering.getId(), offering); } @@ -588,14 +600,14 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService, "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, - true, false, false, false, null, null,null, true, null, null, false); + true, false, false, false, false, null, null, null, true, null, null, false); } //#5 - default vpc offering with LB service if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks, "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null, - defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false); + defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false); } //#6 - default vpc offering with no LB service @@ -604,22 +616,22 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { defaultVPCOffProviders.remove(Service.Lb); offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB, "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional, - null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false); + null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false); } //#7 - isolated offering with source nat disabled if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, - true, null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false); + true, null, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false); } //#8 - network offering with internal lb service - final Map> internalLbOffProviders = new HashMap>(); - final Set defaultVpcProvider = new HashSet(); + final Map> internalLbOffProviders = new HashMap<>(); + final Set defaultVpcProvider = new HashSet<>(); defaultVpcProvider.add(Network.Provider.VPCVirtualRouter); - final Set defaultInternalLbProvider = new HashSet(); + final Set defaultInternalLbProvider = new HashSet<>(); defaultInternalLbProvider.add(Network.Provider.InternalLbVm); internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider); @@ -633,18 +645,18 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB, "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders, - true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, true, null, null, false); + true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false, null, null, null, true, null, null, false); offering.setInternalLb(true); offering.setPublicLb(false); _networkOfferingDao.update(offering.getId(), offering); } - final Map> netscalerServiceProviders = new HashMap>(); - final Set vrProvider = new HashSet(); + final Map> netscalerServiceProviders = new HashMap<>(); + final Set vrProvider = new HashSet<>(); vrProvider.add(Provider.VirtualRouter); - final Set sgProvider = new HashSet(); + final Set sgProvider = new HashSet<>(); sgProvider.add(Provider.SecurityGroupProvider); - final Set nsProvider = new HashSet(); + final Set nsProvider = new HashSet<>(); nsProvider.add(Provider.Netscaler); netscalerServiceProviders.put(Service.Dhcp, vrProvider); netscalerServiceProviders.put(Service.Dns, vrProvider); @@ -653,10 +665,10 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { netscalerServiceProviders.put(Service.StaticNat, nsProvider); netscalerServiceProviders.put(Service.Lb, nsProvider); - final Map> serviceCapabilityMap = new HashMap>(); - final Map elb = new HashMap(); + final Map> serviceCapabilityMap = new HashMap<>(); + final Map elb = new HashMap<>(); elb.put(Capability.ElasticLb, "true"); - final Map eip = new HashMap(); + final Map eip = new HashMap<>(); eip.put(Capability.ElasticIp, "true"); serviceCapabilityMap.put(Service.Lb, elb); serviceCapabilityMap.put(Service.StaticNat, eip); @@ -664,7 +676,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) { offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering, "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null, - netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false); + netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, false, null, null, null, true, null, null, false); offering.setDedicatedLB(false); _networkOfferingDao.update(offering.getId(), offering); } @@ -719,11 +731,6 @@ public boolean start() { return true; } - @Override - public boolean stop() { - return true; - } - protected NetworkOrchestrator() { setStateMachine(); } @@ -765,7 +772,7 @@ public List setupNetwork(final Account owner, final NetworkOf } } - final List networks = new ArrayList(); + final List networks = new ArrayList<>(); long related = -1; @@ -821,6 +828,11 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { if (domainId != null && aclType == ACLType.Domain) { _networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null || subdomainAccess); } + String ipv6Cidr = network.getIp6Cidr(); + String ipv6Gateway = network.getIp6Gateway(); + if (StringUtils.isNoneBlank(ipv6Cidr, ipv6Gateway)) { + ipv6Service.assignIpv6SubnetToNetwork(ipv6Cidr, networkPersisted.getId()); + } } }); guru.setup(network, relatedFile); @@ -851,6 +863,7 @@ private static NetworkVO getNetworkVO(long id, final NetworkOffering offering, f vpcId, offering.isRedundantRouter(), predefined.getExternalId()); vo.setDisplayNetwork(isDisplayNetworkEnabled == null || isDisplayNetworkEnabled); vo.setStrechedL2Network(offering.isSupportingStrechedL2()); + vo.setKeepMacAddressOnPublicNic(predefined.getKeepMacAddressOnPublicNic()); return vo; } @@ -883,7 +896,7 @@ public void allocate(final VirtualMachineProfile vm, final LinkedHashMap> profilesList = getOrderedNetworkNicProfileMapping(networks); - final List nics = new ArrayList(size); + final List nics = new ArrayList<>(size); NicProfile defaultNic = null; Network nextNetwork = null; for (Pair networkNicPair : profilesList) { @@ -927,17 +940,17 @@ private Pair addRequestedNicToNicListWithDeviceNumberAndRet final int devId = vmNic.getDeviceId(); if (devId >= deviceIds.length) { - throw new IllegalArgumentException("Device id for nic is too large: " + vmNic); + throw new IllegalArgumentException("Device ID for NIC is too large: " + vmNic); } if (deviceIds[devId]) { - throw new IllegalArgumentException("Conflicting device id for two different nics: " + vmNic); + throw new IllegalArgumentException("Conflicting device ID for two different NICs: " + vmNic); } deviceIds[devId] = true; if (vmNic.isDefaultNic()) { if (defaultNic != null) { - throw new IllegalArgumentException("You cannot specify two nics as default nics: nic 1 = " + defaultNic + "; nic 2 = " + vmNic); + throw new IllegalArgumentException("You cannot specify two NICs as default NICs: NIC 1 = " + defaultNic + "; NIC 2 = " + vmNic); } defaultNic = vmNic; } @@ -960,16 +973,16 @@ private List> getOrderedNetworkNicProfileMapping(final for (final Map.Entry> network : networks.entrySet()) { List requestedProfiles = network.getValue(); if (requestedProfiles == null) { - requestedProfiles = new ArrayList(); + requestedProfiles = new ArrayList<>(); } if (requestedProfiles.isEmpty()) { requestedProfiles.add(null); } for (final NicProfile requested : requestedProfiles) { - profilesList.add(new Pair(network.getKey(), requested)); + profilesList.add(new Pair<>(network.getKey(), requested)); } } - profilesList.sort(new Comparator>() { + profilesList.sort(new Comparator<>() { @Override public int compare(Pair pair1, Pair pair2) { int profile1Order = Integer.MAX_VALUE; @@ -1018,9 +1031,9 @@ private int determineNumberOfNicsRequired(final VirtualMachineProfile vm, final */ private void createExtraNics(final VirtualMachineProfile vm, int size, List nics, Network finalNetwork) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { if (nics.size() != size) { - logger.warn("Number of nics {} doesn't match number of requested nics {}", nics.size(), size); + logger.warn("Number of NICs {} doesn't match number of requested NICs {}", nics.size(), size); if (nics.size() > size) { - throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + size); + throw new CloudRuntimeException("Number of NICs " + nics.size() + " doesn't match number of requested networks " + size); } else { if (finalNetwork == null) { throw new CloudRuntimeException(String.format("can not assign network to %d remaining required NICs", size - nics.size())); @@ -1052,10 +1065,10 @@ public void saveExtraDhcpOptions(final String networkUuid, final Long nicId, fin } private NicVO persistNicAfterRaceCheck(final NicVO nic, final Long networkId, final NicProfile profile, int deviceId) { - return Transaction.execute(new TransactionCallback() { + return Transaction.execute(new TransactionCallback<>() { @Override public NicVO doInTransaction(TransactionStatus status) { - NicVO vo = _nicDao.findByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId); + NicVO vo = _nicDao.findNonPlaceHolderByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId); if (vo == null) { applyProfileToNic(nic, profile, deviceId); vo = _nicDao.persist(nic); @@ -1070,10 +1083,10 @@ public NicVO doInTransaction(TransactionStatus status) { private NicVO checkForRaceAndAllocateNic(final NicProfile requested, final Network network, final Boolean isDefaultNic, int deviceId, final VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { final NetworkVO ntwkVO = _networksDao.findById(network.getId()); - logger.debug("Allocating nic for vm {} in network {} with requested profile {}", vm.getVirtualMachine(), network, requested); + logger.debug("Allocating NIC for Instance {} in Network {} with requested profile {}", vm.getVirtualMachine(), network, requested); final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, ntwkVO.getGuruName()); - NicVO vo = null; + NicVO vo; boolean retryIpAllocation; do { retryIpAllocation = false; @@ -1082,10 +1095,14 @@ private NicVO checkForRaceAndAllocateNic(final NicProfile requested, final Netwo return null; } - if (isNicAllocatedForNsxPublicNetworkOnVR(network, profile, vm)) { + if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Nsx)) { String guruName = "NsxPublicNetworkGuru"; NetworkGuru nsxGuru = AdapterBase.getAdapterByName(networkGurus, guruName); nsxGuru.allocate(network, profile, vm); + } else if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Netris)) { + String guruName = "NetrisPublicNetworkGuru"; + NetworkGuru netrisGuru = AdapterBase.getAdapterByName(networkGurus, guruName); + netrisGuru.allocate(network, profile, vm); } if (isDefaultNic != null) { @@ -1145,10 +1162,10 @@ public Pair allocateNic(final NicProfile requested, final N _nicDao.update(vo.getId(), vo); setMtuInVRNicProfile(networks, network.getTrafficType(), vmNic); } - return new Pair(vmNic, Integer.valueOf(deviceId)); + return new Pair<>(vmNic, Integer.valueOf(deviceId)); } - private boolean isNicAllocatedForNsxPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm) { + private boolean isNicAllocatedForProviderPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm, Provider provider) { if (ObjectUtils.anyNull(network, requested, vm)) { return false; } @@ -1158,7 +1175,9 @@ private boolean isNicAllocatedForNsxPublicNetworkOnVR(Network network, NicProfil return false; } long dataCenterId = vm.getVirtualMachine().getDataCenterId(); - if (nsxProviderDao.findByZoneId(dataCenterId) == null) { + if (Provider.Nsx == provider && nsxProviderDao.findByZoneId(dataCenterId) == null) { + return false; + } else if (Provider.Netris == provider && netrisProviderDao.findByZoneId(dataCenterId) == null) { return false; } @@ -1168,14 +1187,16 @@ private boolean isNicAllocatedForNsxPublicNetworkOnVR(Network network, NicProfil if (CollectionUtils.isEmpty(ips)) { return false; } + ips = ips.stream().filter(x -> !x.getAddress().addr().equals(requested.getIPv4Address())).collect(Collectors.toList()); IPAddressVO ip = ips.get(0); - VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), ApiConstants.NSX_DETAIL_KEY); + String detailKey = Provider.Nsx == provider ? ApiConstants.NSX_DETAIL_KEY : ApiConstants.NETRIS_DETAIL_KEY; + VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), detailKey); if (vlanDetail == null) { return false; } - boolean isForNsx = vlanDetail.getValue().equalsIgnoreCase("true"); - return isForNsx && !ip.isForSystemVms(); + boolean isForProvider = vlanDetail.getValue().equalsIgnoreCase("true"); + return isForProvider && !ip.isForSystemVms(); } private void setMtuDetailsInVRNic(final Pair networks, Network network, NicVO vo) { @@ -1268,7 +1289,7 @@ protected void configureNicProfileBasedOnRequestedIp(NicProfile requestedNicProf nicProfile.setIPv4Gateway(ipv4Gateway); nicProfile.setIPv4Netmask(ipv4Netmask); - if (nicProfile.getMacAddress() == null) { + if (nicProfile.getMacAddress() == null || !_networkModel.isMACUnique(nicProfile.getMacAddress(), network.getId())) { try { String macAddress = _networkModel.getNextAvailableMacAddressInNetwork(network.getId()); nicProfile.setMacAddress(macAddress); @@ -1291,6 +1312,7 @@ protected void acquireLockAndCheckIfIpv4IsFree(Network network, String requested IPAddressVO lockedIpVO = _ipAddressDao.acquireInLockTable(ipVO.getId()); validateLockedRequestedIp(ipVO, lockedIpVO); lockedIpVO.setState(IPAddressVO.State.Allocated); + lockedIpVO.setAllocatedTime(new Date()); _ipAddressDao.update(lockedIpVO.getId(), lockedIpVO); } finally { _ipAddressDao.releaseFromLockTable(ipVO.getId()); @@ -1422,7 +1444,7 @@ boolean isNetworkImplemented(final NetworkVO network) { Pair implementNetwork(final long networkId, final DeployDestination dest, final ReservationContext context, final boolean isRouter) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - Pair implemented = null; + Pair implemented; if (!isRouter) { implemented = implementNetwork(networkId, dest, context); } else { @@ -1433,7 +1455,7 @@ Pair implementNetwork(final long networkId, final Deploy // in issues. In order to avoid it, implementNetwork() call for VR is replaced with below code. final NetworkVO network = _networksDao.findById(networkId); final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); - implemented = new Pair(guru, network); + implemented = new Pair<>(guru, network); } return implemented; } @@ -1521,15 +1543,13 @@ private boolean networkMeetsPersistenceCriteria(NetworkVO network, NetworkOfferi @DB public Pair implementNetwork(final long networkId, final DeployDestination dest, final ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - final Pair implemented = new Pair(null, null); + final Pair implemented = new Pair<>(null, null); NetworkVO network = _networksDao.findById(networkId); final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); if (isNetworkImplemented(network)) { logger.debug("Network {} is already implemented", network); implemented.set(guru, network); - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_UPDATE, network.getAccountId(), network.getDataCenterId(), network.getId(), - network.getName(), network.getNetworkOfferingId(), null, network.getState().name(), Network.class.getName(), network.getUuid(), true); return implemented; } @@ -1585,16 +1605,15 @@ public Pair implementNetwork(final long networkId, final network.setRestartRequired(false); _networksDao.update(network.getId(), network); + UsageEventUtils.publishNetworkUpdate(network); implemented.set(guru, network); - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_CREATE, network.getAccountId(), network.getDataCenterId(), network.getId(), - network.getName(), network.getNetworkOfferingId(), null, null, null, network.getState().name(), network.getUuid()); return implemented; } catch (final NoTransitionException e) { logger.error(e.getMessage()); - return new Pair(null, null); + return new Pair<>(null, null); } catch (final CloudRuntimeException | OperationTimedoutException e) { logger.error("Caught exception: {}", e.getMessage()); - return new Pair(null, null); + return new Pair<>(null, null); } finally { if (implemented.first() == null) { logger.debug("Cleaning up because we're unable to implement the network {}", network); @@ -1638,19 +1657,19 @@ public void implementNetworkElementsAndResources(final DeployDestination dest, f && (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat) || _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Gateway)) && (network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced)) { - List ips = null; + List ips; final Account owner = _entityMgr.findById(Account.class, network.getAccountId()); if (network.getVpcId() != null) { ips = _ipAddressDao.listByAssociatedVpc(network.getVpcId(), true); if (ips.isEmpty()) { final Vpc vpc = _vpcMgr.getActiveVpc(network.getVpcId()); - logger.debug("Creating a source nat ip for vpc {}", vpc); + logger.debug("Creating a source NAT IP for VPC {}", vpc); _vpcMgr.assignSourceNatIpAddressToVpc(owner, vpc, null); } } else { ips = _ipAddressDao.listByAssociatedNetwork(network.getId(), true); if (ips.isEmpty()) { - logger.debug("Creating a source nat ip for network {}", network); + logger.debug("Creating a source NAT IP for Network {}", network); _ipAddrMgr.assignSourceNatIpAddressToGuestNetwork(owner, network); } } @@ -1696,6 +1715,7 @@ public void implementNetworkElementsAndResources(final DeployDestination dest, f } } } + reconfigureAndApplyStaticRouteForVpcVpn(network); } finally { for (final NetworkElement element : networkElements) { if (element instanceof AggregatedCommandExecutor && providersToImplement.contains(element.getProvider())) { @@ -1705,6 +1725,17 @@ public void implementNetworkElementsAndResources(final DeployDestination dest, f } } + private void reconfigureAndApplyStaticRouteForVpcVpn(Network network) { + if (network.getVpcId() != null) { + _vpcMgr.reconfigStaticNatForVpcVr(network.getVpcId()); + try { + _vpcMgr.applyStaticRouteForVpcVpnIfNeeded(network.getVpcId(), true); + } catch (ResourceUnavailableException e) { + logger.error("Unable to apply static routes for vpc " + network.getVpcId() + " due to " + e.getMessage()); + } + } + } + private void implementNetworkElements(final DeployDestination dest, final ReservationContext context, final Network network, final NetworkOffering offering, final List providersToImplement) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { for (NetworkElement element : networkElements) { @@ -1743,13 +1774,13 @@ protected boolean reprogramNetworkRules(final long networkId, final Account call _firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.isEgressDefaultPolicy(), true); } if (!_firewallMgr.applyFirewallRules(firewallEgressRulesToApply, false, caller)) { - logger.warn("Failed to reapply firewall Egress rule(s) as a part of network {} restart", network); + logger.warn("Failed to reapply firewall Egress rule(s) as a part of Network {} restart", network); success = false; } // associate all ip addresses if (!_ipAddrMgr.applyIpAssociations(network, false)) { - logger.warn("Failed to apply ip addresses as a part of network {} restart", network); + logger.warn("Failed to apply IP addresses as a part of Network {} restart", network); success = false; } @@ -1941,6 +1972,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { ip.setOneToOneNat(false); ip.setAssociatedWithVmId(null); ip.setVmIp(null); + ip.setForRouter(false); _ipAddressDao.update(ip.getId(), ip); } } @@ -2095,7 +2127,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { _nicDao.update(nic.getId(), nic); if (nic.getVmType() == VirtualMachine.Type.User) { - logger.debug(String.format("Changing active number of nics for network id=%s on %d", network, count)); + logger.debug(String.format("Changing active number of NICs for Network ID=%s on %d", network, count)); _networksDao.changeActiveNicsBy(network.getId(), count); } @@ -2114,7 +2146,7 @@ public void prepare(final VirtualMachineProfile vmProfile, final DeployDestinati // we have to implement default nics first - to ensure that default network elements start up first in multiple //nics case // (need for setting DNS on Dhcp to domR's Ip4 address) - Collections.sort(nics, new Comparator() { + Collections.sort(nics, new Comparator<>() { @Override public int compare(final NicVO nic1, final NicVO nic2) { @@ -2129,8 +2161,8 @@ public int compare(final NicVO nic1, final NicVO nic2) { final Pair implemented = implementNetwork(nic.getNetworkId(), dest, context, vmProfile.getVirtualMachine().getType() == Type.DomainRouter); if (implemented == null || implemented.first() == null) { NetworkVO network = _networksDao.findById(nic.getNetworkId()); - logger.warn("Failed to implement network: {} as a part of preparing nic {}", network, nic); - throw new CloudRuntimeException(String.format("Failed to implement network id=%s as a part preparing nic %s", network, nic)); + logger.warn("Failed to implement Network: {} as a part of preparing NIC {}", network, nic); + throw new CloudRuntimeException(String.format("Failed to implement Network ID=%s as a part preparing NIC %s", network, nic)); } final NetworkVO network = implemented.second(); @@ -2152,7 +2184,7 @@ public NicProfile prepareNic(final VirtualMachineProfile vmProfile, final Deploy final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); final NicVO nic = _nicDao.findById(nicId); - NicProfile profile = null; + NicProfile profile; if (nic.getReservationStrategy() == Nic.ReservationStrategy.Start) { nic.setState(Nic.State.Reserving); nic.setReservationId(context.getReservationId()); @@ -2300,7 +2332,8 @@ public void prepareAllNicsForMigration(final VirtualMachineProfile vm, final Dep for (final NetworkElement element : networkElements) { if (providersToImplement.contains(element.getProvider())) { if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) { - throw new CloudRuntimeException(String.format("Service provider %s either doesn't exist or is not enabled in physical network: %s", element.getProvider().getName(), _physicalNetworkDao.findById(network.getPhysicalNetworkId()))); + throw new CloudRuntimeException(String.format("Service provider %s either doesn't exist or is not enabled in physical network: %s", + element.getProvider().getName(), _physicalNetworkDao.findById(network.getPhysicalNetworkId()))); } if (element instanceof NetworkMigrationResponder) { if (!((NetworkMigrationResponder) element).prepareMigration(profile, network, vm, dest, context)) { @@ -2313,7 +2346,7 @@ public void prepareAllNicsForMigration(final VirtualMachineProfile vm, final Dep vm.addNic(profile); } - final List addedURIs = new ArrayList(); + final List addedURIs = new ArrayList<>(); if (guestNetworkId != null) { final List publicIps = _ipAddressDao.listByAssociatedNetwork(guestNetworkId, null); for (final IPAddressVO userIp : publicIps) { @@ -2328,7 +2361,7 @@ public void prepareAllNicsForMigration(final VirtualMachineProfile vm, final Dep final NetworkVO network = _networksDao.findById(ntwkId); final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); final NicProfile profile = new NicProfile(); - logger.debug("Creating nic profile for migration. BroadcastUri: {} NetworkId: {} VM: {}", broadcastUri.toString(), network, vm); + logger.debug("Creating NIC profile for migration. BroadcastUri: {} NetworkId: {} Instance: {}", broadcastUri.toString(), network, vm); profile.setDeviceId(255); //dummyId profile.setIPv4Address(userIp.getAddress().toString()); profile.setIPv4Netmask(publicIp.getNetmask()); @@ -2450,7 +2483,7 @@ protected void releaseNic(final VirtualMachineProfile vmProfile, final long nicI public Pair doInTransaction(final TransactionStatus status) { final NicVO nic = _nicDao.lockRow(nicId, true); if (nic == null) { - throw new ConcurrentOperationException(String.format("Unable to acquire lock on nic id=%d", nicId)); + throw new ConcurrentOperationException(String.format("Unable to acquire lock on NIC ID=%d", nicId)); } final Nic.State originalState = nic.getState(); @@ -2514,7 +2547,7 @@ public Pair doInTransaction(final TransactionStatus status) @Override public void cleanupNics(final VirtualMachineProfile vm) { - logger.debug("Cleaning network for vm: {}", vm); + logger.debug("Cleaning Network for Instance: {}", vm); final List nics = _nicDao.listByVmId(vm.getId()); for (final NicVO nic : nics) { @@ -2535,7 +2568,7 @@ protected void removeNic(final VirtualMachineProfile vm, final NicVO nic) { try { releaseNic(vm, nic.getId()); } catch (final Exception ex) { - logger.warn("Failed to release nic: {} as part of remove operation due to", nic.toString(), ex); + logger.warn("Failed to release NIC: {} as part of remove operation due to", nic.toString(), ex); } } @@ -2570,9 +2603,9 @@ protected void removeNic(final VirtualMachineProfile vm, final NicVO nic) { try { element.release(network, profile, vm, null); } catch (final ConcurrentOperationException ex) { - logger.warn("release failed during the nic " + nic.toString() + " removeNic due to ", ex); + logger.warn("Release failed during the NIC " + nic.toString() + " removeNic due to ", ex); } catch (final ResourceUnavailableException ex) { - logger.warn("release failed during the nic " + nic.toString() + " removeNic due to ", ex); + logger.warn("Release failed during the NIC " + nic.toString() + " removeNic due to ", ex); } } } @@ -2595,11 +2628,11 @@ && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { if (dnsServiceProvider != null) { try { if (!dnsServiceProvider.removeDnsSupportForSubnet(network)) { - logger.warn("Failed to remove the ip alias on the dns server"); + logger.warn("Failed to remove the IP alias on the DNS server"); } } catch (final ResourceUnavailableException e) { //failed to remove the dnsconfig. - logger.info("Unable to delete the ip alias due to unable to contact the dns server."); + logger.info("Unable to delete the IP alias due to unable to contact the DNS server."); } } } @@ -2607,11 +2640,15 @@ && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName()); guru.deallocate(network, profile, vm); + if (nic.getReservationStrategy() == Nic.ReservationStrategy.Create) { + applyProfileToNicForRelease(nic, profile); + _nicDao.update(nic.getId(), nic); + } if (BooleanUtils.isNotTrue(preserveNics)) { _nicDao.remove(nic.getId()); } - logger.debug("Removed nic {}", nic); + logger.debug("Removed NIC ID=" + nic.getId()); // release assigned IPv6 for Isolated Network VR NIC if (Type.User.equals(vm.getType()) && GuestType.Isolated.equals(network.getGuestType()) @@ -2624,7 +2661,7 @@ && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { //remove the secondary ip addresses corresponding to this nic if (!removeVmSecondaryIpsOfNic(nic.getId())) { - logger.debug("Removing nic {} secondary ip addresses failed", nic); + logger.debug("Removing NIC {} secondary IP addresses failed", nic); } } @@ -2663,12 +2700,12 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { } }); if (!dhcpServiceProvider.removeDhcpSupportForSubnet(network)) { - logger.warn("Failed to remove the ip alias on the router, marking it as removed in db and freed the allocated ip {}", ipAlias.getIp4Address()); + logger.warn("Failed to remove the IP alias on the router, marking it as removed in db and freed the allocated IP {}", ipAlias.getIp4Address()); } } } catch (final ResourceUnavailableException e) { //failed to remove the dhcpconfig on the router. - logger.info("Unable to delete the ip alias due to unable to contact the virtualrouter."); + logger.info("Unable to delete the IP alias due to unable to contact the virtualrouter."); } } @@ -2688,7 +2725,7 @@ public Network createPrivateNetwork(final long networkOfferingId, final String n return createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, bypassVlanOverlapCheck, null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, vpcId, null, null, true, null, null, null, true, null, null, - null, null, null, null, null, null); + null, null, null, null, null, null, true); } @Override @@ -2699,10 +2736,25 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam final Boolean isDisplayNetworkEnabled, final String isolatedPvlan, Network.PVlanType isolatedPvlanType, String externalId, String routerIp, String routerIpv6, String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Pair vrIfaceMTUs, Integer networkCidrSize) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { + return createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, bypassVlanOverlapCheck, + networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, + isDisplayNetworkEnabled, isolatedPvlan, isolatedPvlanType, externalId, false, routerIp, routerIpv6, + ip4Dns1, ip4Dns2, ip6Dns1, ip6Dns2, vrIfaceMTUs, networkCidrSize, true); + } + + @Override + @DB + public Network createGuestNetwork(final long networkOfferingId, final String name, final String displayText, final String gateway, final String cidr, String vlanId, + boolean bypassVlanOverlapCheck, String networkDomain, final Account owner, final Long domainId, final PhysicalNetwork pNtwk, + final long zoneId, final ACLType aclType, Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr, + final Boolean isDisplayNetworkEnabled, final String isolatedPvlan, Network.PVlanType isolatedPvlanType, String externalId, + String routerIp, String routerIpv6, String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, + Pair vrIfaceMTUs, Integer networkCidrSize, boolean keepMacAddressOnPublicNic) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { // create Isolated/Shared/L2 network return createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, bypassVlanOverlapCheck, networkDomain, owner, domainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, - isDisplayNetworkEnabled, isolatedPvlan, isolatedPvlanType, externalId, false, routerIp, routerIpv6, ip4Dns1, ip4Dns2, ip6Dns1, ip6Dns2, vrIfaceMTUs, networkCidrSize); + isDisplayNetworkEnabled, isolatedPvlan, isolatedPvlanType, externalId, false, routerIp, routerIpv6, + ip4Dns1, ip4Dns2, ip6Dns1, ip6Dns2, vrIfaceMTUs, networkCidrSize, keepMacAddressOnPublicNic); } @DB @@ -2711,7 +2763,8 @@ private Network createGuestNetwork(final long networkOfferingId, final String na final long zoneId, final ACLType aclType, Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr, final Boolean isDisplayNetworkEnabled, final String isolatedPvlan, Network.PVlanType isolatedPvlanType, String externalId, final Boolean isPrivateNetwork, String routerIp, String routerIpv6, final String ip4Dns1, final String ip4Dns2, - final String ip6Dns1, final String ip6Dns2, Pair vrIfaceMTUs, Integer networkCidrSize) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { + final String ip6Dns1, final String ip6Dns2, Pair vrIfaceMTUs, Integer networkCidrSize, + boolean keepMacAddressOnPublicNic) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { final NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId); final DataCenterVO zone = _dcDao.findById(zoneId); @@ -2721,12 +2774,6 @@ private Network createGuestNetwork(final long networkOfferingId, final String na return null; } - final boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, aclType); - //check resource limits - if (updateResourceCount) { - _resourceLimitMgr.checkResourceLimit(owner, ResourceType.network, isDisplayNetworkEnabled); - } - // Validate network offering if (ntwkOff.getState() != NetworkOffering.State.Enabled) { // see NetworkOfferingVO @@ -2745,223 +2792,224 @@ private Network createGuestNetwork(final long networkOfferingId, final String na boolean ipv6 = false; - if (StringUtils.isNoneBlank(ip6Gateway, ip6Cidr)) { - ipv6 = true; - } - // Validate zone - if (zone.getNetworkType() == NetworkType.Basic) { - // In Basic zone the network should have aclType=Domain, domainId=1, subdomainAccess=true - if (aclType == null || aclType != ACLType.Domain) { - throw new InvalidParameterValueException("Only AclType=Domain can be specified for network creation in Basic zone"); - } - - // Only one guest network is supported in Basic zone - final List guestNetworks = _networksDao.listByZoneAndTrafficType(zone.getId(), TrafficType.Guest); - if (!guestNetworks.isEmpty()) { - throw new InvalidParameterValueException("Can't have more than one Guest network in zone with network type " + NetworkType.Basic); + try (CheckedReservation networkReservation = new CheckedReservation(owner, domainId, Resource.ResourceType.network, null, null, 1L, reservationDao, _resourceLimitMgr)) { + if (StringUtils.isNoneBlank(ip6Gateway, ip6Cidr)) { + ipv6 = true; } + // Validate zone + if (zone.getNetworkType() == NetworkType.Basic) { + // In Basic zone the network should have aclType=Domain, domainId=1, subdomainAccess=true + if (aclType == null || aclType != ACLType.Domain) { + throw new InvalidParameterValueException("Only AclType=Domain can be specified for network creation in Basic zone"); + } - // if zone is basic, only Shared network offerings w/o source nat service are allowed - if (!(ntwkOff.getGuestType() == GuestType.Shared && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) { - throw new InvalidParameterValueException("For zone of type " + NetworkType.Basic + " only offerings of " + "guestType " + GuestType.Shared + " with disabled " - + Service.SourceNat.getName() + " service are allowed"); - } + // Only one guest network is supported in Basic zone + final List guestNetworks = _networksDao.listByZoneAndTrafficType(zone.getId(), TrafficType.Guest); + if (!guestNetworks.isEmpty()) { + throw new InvalidParameterValueException("Can't have more than one Guest network in zone with network type " + NetworkType.Basic); + } - if (domainId == null || domainId != Domain.ROOT_DOMAIN) { - throw new InvalidParameterValueException("Guest network in Basic zone should be dedicated to ROOT domain"); - } + // if zone is basic, only Shared network offerings w/o source nat service are allowed + if (!(ntwkOff.getGuestType() == GuestType.Shared && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) { + throw new InvalidParameterValueException("For zone of type " + NetworkType.Basic + " only offerings of " + "guestType " + GuestType.Shared + " with disabled " + + Service.SourceNat.getName() + " service are allowed"); + } - if (subdomainAccess == null) { - subdomainAccess = true; - } else if (!subdomainAccess) { - throw new InvalidParameterValueException("Subdomain access should be set to true for the" + " guest network in the Basic zone"); - } + if (domainId == null || domainId != Domain.ROOT_DOMAIN) { + throw new InvalidParameterValueException("Guest network in Basic zone should be dedicated to ROOT domain"); + } - if (vlanId == null) { - vlanId = Vlan.UNTAGGED; - } else { - if (!vlanId.equalsIgnoreCase(Vlan.UNTAGGED)) { - throw new InvalidParameterValueException("Only vlan " + Vlan.UNTAGGED + " can be created in " + "the zone of type " + NetworkType.Basic); + if (subdomainAccess == null) { + subdomainAccess = true; + } else if (!subdomainAccess) { + throw new InvalidParameterValueException("Subdomain access should be set to true for the" + " guest network in the Basic zone"); } - } - } else if (zone.getNetworkType() == NetworkType.Advanced) { - if (zone.isSecurityGroupEnabled()) { - if (isolatedPvlan != null) { - throw new InvalidParameterValueException("Isolated Private VLAN is not supported with security group!"); + if (vlanId == null) { + vlanId = Vlan.UNTAGGED; + } else { + if (!vlanId.equalsIgnoreCase(Vlan.UNTAGGED)) { + throw new InvalidParameterValueException("Only vlan " + Vlan.UNTAGGED + " can be created in " + "the zone of type " + NetworkType.Basic); + } } - // Only Account specific Isolated network with sourceNat service disabled are allowed in security group - // enabled zone - if ((ntwkOff.getGuestType() != GuestType.Shared) && (ntwkOff.getGuestType() != GuestType.L2)) { - throw new InvalidParameterValueException("Only shared or L2 guest network can be created in security group enabled zone"); + + } else if (zone.getNetworkType() == NetworkType.Advanced) { + if (zone.isSecurityGroupEnabled()) { + if (isolatedPvlan != null) { + throw new InvalidParameterValueException("Isolated Private VLAN is not supported with security group!"); + } + // Only Account specific Isolated network with sourceNat service disabled are allowed in security group + // enabled zone + if ((ntwkOff.getGuestType() != GuestType.Shared) && (ntwkOff.getGuestType() != GuestType.L2)) { + throw new InvalidParameterValueException("Only shared or L2 guest network can be created in security group enabled zone"); + } + if (_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) { + throw new InvalidParameterValueException("Service SourceNat is not allowed in security group enabled zone"); + } } - if (_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) { - throw new InvalidParameterValueException("Service SourceNat is not allowed in security group enabled zone"); + + //don't allow eip/elb networks in Advance zone + if (ntwkOff.isElasticIp() || ntwkOff.isElasticLb()) { + throw new InvalidParameterValueException("Elastic IP and Elastic LB services are supported in zone of type " + NetworkType.Basic); } } - //don't allow eip/elb networks in Advance zone - if (ntwkOff.isElasticIp() || ntwkOff.isElasticLb()) { - throw new InvalidParameterValueException("Elastic IP and Elastic LB services are supported in zone of type " + NetworkType.Basic); + if (ipv6 && !GuestType.Shared.equals(ntwkOff.getGuestType())) { + _networkModel.checkIp6CidrSizeEqualTo64(ip6Cidr); } - } - - if (ipv6 && !GuestType.Shared.equals(ntwkOff.getGuestType())) { - _networkModel.checkIp6CidrSizeEqualTo64(ip6Cidr); - } - //TODO(VXLAN): Support VNI specified - // VlanId can be specified only when network offering supports it - final boolean vlanSpecified = vlanId != null; - if (vlanSpecified != ntwkOff.isSpecifyVlan()) { - if (vlanSpecified) { - if (!isSharedNetworkWithoutSpecifyVlan(ntwkOff) && !isPrivateGatewayWithoutSpecifyVlan(ntwkOff)) { - throw new InvalidParameterValueException("Can't specify vlan; corresponding offering says specifyVlan=false"); + //TODO(VXLAN): Support VNI specified + // VlanId can be specified only when network offering supports it + final boolean vlanSpecified = vlanId != null; + if (vlanSpecified != ntwkOff.isSpecifyVlan()) { + if (vlanSpecified) { + if (!isSharedNetworkWithoutSpecifyVlan(ntwkOff) && !isPrivateGatewayWithoutSpecifyVlan(ntwkOff)) { + throw new InvalidParameterValueException("Can't specify vlan; corresponding offering says specifyVlan=false"); + } + } else { + throw new InvalidParameterValueException("Vlan has to be specified; corresponding offering says specifyVlan=true"); } - } else { - throw new InvalidParameterValueException("Vlan has to be specified; corresponding offering says specifyVlan=true"); } - } - if (vlanSpecified) { - URI uri = encodeVlanIdIntoBroadcastUri(vlanId, pNtwk); - // Aux: generate secondary URI for secondary VLAN ID (if provided) for performing checks - URI secondaryUri = StringUtils.isNotBlank(isolatedPvlan) ? BroadcastDomainType.fromString(isolatedPvlan) : null; - if (isSharedNetworkWithoutSpecifyVlan(ntwkOff) || isPrivateGatewayWithoutSpecifyVlan(ntwkOff)) { - bypassVlanOverlapCheck = true; - } - //don't allow to specify vlan tag used by physical network for dynamic vlan allocation - if (!(bypassVlanOverlapCheck && (ntwkOff.getGuestType() == GuestType.Shared || isPrivateNetwork)) - && _dcDao.findVnet(zoneId, pNtwk.getId(), BroadcastDomainType.getValue(uri)).size() > 0) { - throw new InvalidParameterValueException("The VLAN tag to use for new guest network, " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone " - + zone.getName()); - } - if (secondaryUri != null && !(bypassVlanOverlapCheck && ntwkOff.getGuestType() == GuestType.Shared) && - _dcDao.findVnet(zoneId, pNtwk.getId(), BroadcastDomainType.getValue(secondaryUri)).size() > 0) { - throw new InvalidParameterValueException(String.format( - "The VLAN tag for isolated PVLAN %s is already being used for dynamic vlan allocation for the guest network in zone %s", - isolatedPvlan, zone)); - } - if (!UuidUtils.isUuid(vlanId)) { - // For Isolated and L2 networks, don't allow to create network with vlan that already exists in the zone - if (!hasGuestBypassVlanOverlapCheck(bypassVlanOverlapCheck, ntwkOff, isPrivateNetwork)) { - if (_networksDao.listByZoneAndUriAndGuestType(zoneId, uri.toString(), null).size() > 0) { - throw new InvalidParameterValueException(String.format( - "Network with vlan %s already exists or overlaps with other network vlans in zone %s", - vlanId, zone)); - } else if (secondaryUri != null && _networksDao.listByZoneAndUriAndGuestType(zoneId, secondaryUri.toString(), null).size() > 0) { - throw new InvalidParameterValueException(String.format( - "Network with vlan %s already exists or overlaps with other network vlans in zone %s", - isolatedPvlan, zone)); - } else { - final List dcVnets = _datacenterVnetDao.findVnet(zoneId, BroadcastDomainType.getValue(uri)); - //for the network that is created as part of private gateway, - //the vnet is not coming from the data center vnet table, so the list can be empty - if (!dcVnets.isEmpty()) { - final DataCenterVnetVO dcVnet = dcVnets.get(0); - // Fail network creation if specified vlan is dedicated to a different account - if (dcVnet.getAccountGuestVlanMapId() != null) { - final Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId(); - final AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId); - if (map.getAccountId() != owner.getAccountId()) { - throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account"); - } - // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool - } else { - final List maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId()); - if (maps != null && !maps.isEmpty()) { - final int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId()); - final int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId()); - if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) { - throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" + " to the vlan range dedicated to the owner " - + owner.getAccountName()); + if (vlanSpecified) { + URI uri = encodeVlanIdIntoBroadcastUri(vlanId, pNtwk); + // Aux: generate secondary URI for secondary VLAN ID (if provided) for performing checks + URI secondaryUri = StringUtils.isNotBlank(isolatedPvlan) ? BroadcastDomainType.fromString(isolatedPvlan) : null; + if (isSharedNetworkWithoutSpecifyVlan(ntwkOff) || isPrivateGatewayWithoutSpecifyVlan(ntwkOff)) { + bypassVlanOverlapCheck = true; + } + //don't allow to specify vlan tag used by physical network for dynamic vlan allocation + if (!(bypassVlanOverlapCheck && (ntwkOff.getGuestType() == GuestType.Shared || isPrivateNetwork)) + && _dcDao.findVnet(zoneId, pNtwk.getId(), BroadcastDomainType.getValue(uri)).size() > 0) { + throw new InvalidParameterValueException("The VLAN tag to use for new guest network, " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone " + + zone.getName()); + } + if (secondaryUri != null && !(bypassVlanOverlapCheck && ntwkOff.getGuestType() == GuestType.Shared) && + _dcDao.findVnet(zoneId, pNtwk.getId(), BroadcastDomainType.getValue(secondaryUri)).size() > 0) { + throw new InvalidParameterValueException(String.format( + "The VLAN tag for isolated PVLAN %s is already being used for dynamic vlan allocation for the guest network in zone %s", + isolatedPvlan, zone)); + } + if (!UuidUtils.isUuid(vlanId)) { + // For Isolated and L2 networks, don't allow to create network with vlan that already exists in the zone + if (!hasGuestBypassVlanOverlapCheck(bypassVlanOverlapCheck, ntwkOff, isPrivateNetwork)) { + if (_networksDao.listByZoneAndUriAndGuestType(zoneId, uri.toString(), null).size() > 0) { + throw new InvalidParameterValueException(String.format( + "Network with vlan %s already exists or overlaps with other network vlans in zone %s", + vlanId, zone)); + } else if (secondaryUri != null && _networksDao.listByZoneAndUriAndGuestType(zoneId, secondaryUri.toString(), null).size() > 0) { + throw new InvalidParameterValueException(String.format( + "Network with vlan %s already exists or overlaps with other network vlans in zone %s", + isolatedPvlan, zone)); + } else { + final List dcVnets = _datacenterVnetDao.findVnet(zoneId, BroadcastDomainType.getValue(uri)); + //for the network that is created as part of private gateway, + //the vnet is not coming from the data center vnet table, so the list can be empty + if (!dcVnets.isEmpty()) { + final DataCenterVnetVO dcVnet = dcVnets.get(0); + // Fail network creation if specified vlan is dedicated to a different account + if (dcVnet.getAccountGuestVlanMapId() != null) { + final Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId(); + final AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId); + if (map.getAccountId() != owner.getAccountId()) { + throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account"); + } + // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool + } else { + final List maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId()); + if (maps != null && !maps.isEmpty()) { + final int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId()); + final int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId()); + if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) { + throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" + " to the vlan range dedicated to the owner " + + owner.getAccountName()); + } } } } } - } - } else { - // don't allow to creating shared network with given Vlan ID, if there already exists a isolated network or - // shared network with same Vlan ID in the zone - if (!bypassVlanOverlapCheck && _networksDao.listByZoneAndUriAndGuestType(zoneId, uri.toString(), GuestType.Isolated).size() > 0) { - throw new InvalidParameterValueException(String.format( - "There is an existing isolated/shared network that overlaps with vlan id:%s in zone %s", vlanId, zone)); + } else { + // don't allow to creating shared network with given Vlan ID, if there already exists a isolated network or + // shared network with same Vlan ID in the zone + if (!bypassVlanOverlapCheck && _networksDao.listByZoneAndUriAndGuestType(zoneId, uri.toString(), GuestType.Isolated).size() > 0) { + throw new InvalidParameterValueException(String.format( + "There is an existing isolated/shared network that overlaps with vlan id:%s in zone %s", vlanId, zone)); + } } } - } - } + } - // If networkDomain is not specified, take it from the global configuration - if (_networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.Dns)) { - final Map dnsCapabilities = _networkModel.getNetworkOfferingServiceCapabilities(_entityMgr.findById(NetworkOffering.class, networkOfferingId), - Service.Dns); - final String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification); - if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported)) { - if (networkDomain != null) { - // TBD: NetworkOfferingId and zoneId. Send uuids instead. - throw new InvalidParameterValueException(String.format( - "Domain name change is not supported by network offering id=%d in zone %s", - networkOfferingId, zone)); - } - } else { - if (networkDomain == null) { - // 1) Get networkDomain from the corresponding account/domain/zone - if (aclType == ACLType.Domain) { - networkDomain = _networkModel.getDomainNetworkDomain(domainId, zoneId); - } else if (aclType == ACLType.Account) { - networkDomain = _networkModel.getAccountNetworkDomain(owner.getId(), zoneId); + // If networkDomain is not specified, take it from the global configuration + if (_networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.Dns)) { + final Map dnsCapabilities = _networkModel.getNetworkOfferingServiceCapabilities(_entityMgr.findById(NetworkOffering.class, networkOfferingId), + Service.Dns); + final String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification); + if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported)) { + if (networkDomain != null) { + // TBD: NetworkOfferingId and zoneId. Send uuids instead. + throw new InvalidParameterValueException(String.format( + "Domain name change is not supported by network offering id=%d in zone %s", + networkOfferingId, zone)); } - - // 2) If null, generate networkDomain using domain suffix from the global config variables + } else { if (networkDomain == null) { - networkDomain = "cs" + Long.toHexString(owner.getId()) + GuestDomainSuffix.valueIn(zoneId); - } + // 1) Get networkDomain from the corresponding account/domain/zone + if (aclType == ACLType.Domain) { + networkDomain = _networkModel.getDomainNetworkDomain(domainId, zoneId); + } else if (aclType == ACLType.Account) { + networkDomain = _networkModel.getAccountNetworkDomain(owner.getId(), zoneId); + } - } else { - // validate network domain - if (!NetUtils.verifyDomainName(networkDomain)) { - throw new InvalidParameterValueException("Invalid network domain. Total length shouldn't exceed 190 chars. Each domain " - + "label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', " - + "and the hyphen ('-'); can't start or end with \"-\""); + // 2) If null, generate networkDomain using domain suffix from the global config variables + if (networkDomain == null) { + networkDomain = "cs" + Long.toHexString(owner.getId()) + GuestDomainSuffix.valueIn(zoneId); + } + + } else { + // validate network domain + if (!NetUtils.verifyDomainName(networkDomain)) { + throw new InvalidParameterValueException("Invalid network domain. Total length shouldn't exceed 190 chars. Each domain " + + "label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', " + + "and the hyphen ('-'); can't start or end with \"-\""); + } } } } - } - // In Advance zone Cidr for Shared networks and Isolated networks w/o source nat service can't be NULL - 2.2.x - // limitation, remove after we introduce support for multiple ip ranges - // with different Cidrs for the same Shared network - final boolean cidrRequired = zone.getNetworkType() == NetworkType.Advanced - && ntwkOff.getTrafficType() == TrafficType.Guest - && (ntwkOff.getGuestType() == GuestType.Shared || (ntwkOff.getGuestType() == GuestType.Isolated - && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat) - && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.Gateway))); - if (cidr == null && ip6Cidr == null && cidrRequired) { - if (ntwkOff.getGuestType() == GuestType.Shared) { - throw new InvalidParameterValueException(String.format("Gateway/netmask are required when creating %s networks.", Network.GuestType.Shared)); - } else { - throw new InvalidParameterValueException("gateway/netmask are required when create network of" + " type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled"); + // In Advance zone Cidr for Shared networks and Isolated networks w/o source nat service can't be NULL - 2.2.x + // limitation, remove after we introduce support for multiple ip ranges + // with different Cidrs for the same Shared network + final boolean cidrRequired = zone.getNetworkType() == NetworkType.Advanced + && ntwkOff.getTrafficType() == TrafficType.Guest + && (ntwkOff.getGuestType() == GuestType.Shared || (ntwkOff.getGuestType() == GuestType.Isolated + && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat) + && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.Gateway))); + if (cidr == null && ip6Cidr == null && cidrRequired) { + if (ntwkOff.getGuestType() == GuestType.Shared) { + throw new InvalidParameterValueException(String.format("Gateway/netmask are required when creating %s networks.", Network.GuestType.Shared)); + } else { + throw new InvalidParameterValueException("gateway/netmask are required when create network of" + " type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled"); + } } - } - checkL2OfferingServices(ntwkOff); + checkL2OfferingServices(ntwkOff); - // No cidr can be specified in Basic zone - if (zone.getNetworkType() == NetworkType.Basic && cidr != null) { - throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask can't be specified for zone of type " + NetworkType.Basic); - } + // No cidr can be specified in Basic zone + if (zone.getNetworkType() == NetworkType.Basic && cidr != null) { + throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask can't be specified for zone of type " + NetworkType.Basic); + } - // Check if cidr is RFC1918 compliant if the network is Guest Isolated for IPv4 - if (cidr != null && (ntwkOff.getGuestType() == Network.GuestType.Isolated && ntwkOff.getTrafficType() == TrafficType.Guest) && - !NetUtils.validateGuestCidr(cidr, !ConfigurationManager.AllowNonRFC1918CompliantIPs.value())) { + // Check if cidr is RFC1918 compliant if the network is Guest Isolated for IPv4 + if (cidr != null && (ntwkOff.getGuestType() == Network.GuestType.Isolated && ntwkOff.getTrafficType() == TrafficType.Guest) && + !NetUtils.validateGuestCidr(cidr, !ConfigurationManager.AllowNonRFC1918CompliantIPs.value())) { throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC 1918 or 6598 compliant"); - } + } final String networkDomainFinal = networkDomain; final String vlanIdFinal = vlanId; final Boolean subdomainAccessFinal = subdomainAccess; - final Network network = Transaction.execute(new TransactionCallback() { + final Network network = Transaction.execute(new TransactionCallback<>() { @Override public Network doInTransaction(final TransactionStatus status) { Long physicalNetworkId = null; @@ -2972,75 +3020,75 @@ public Network doInTransaction(final TransactionStatus status) { final NetworkVO userNetwork = new NetworkVO(); userNetwork.setNetworkDomain(networkDomainFinal); - if (cidr != null && gateway != null) { - userNetwork.setCidr(cidr); - userNetwork.setGateway(gateway); - } - - if (StringUtils.isNoneBlank(ip6Gateway, ip6Cidr)) { - userNetwork.setIp6Cidr(ip6Cidr); - userNetwork.setIp6Gateway(ip6Gateway); - } + if (cidr != null && gateway != null) { + userNetwork.setCidr(cidr); + userNetwork.setGateway(gateway); + } - if (externalId != null) { - userNetwork.setExternalId(externalId); - } + if (StringUtils.isNoneBlank(ip6Gateway, ip6Cidr)) { + userNetwork.setIp6Cidr(ip6Cidr); + userNetwork.setIp6Gateway(ip6Gateway); + } - if (StringUtils.isNotBlank(routerIp)) { - userNetwork.setRouterIp(routerIp); - } + if (externalId != null) { + userNetwork.setExternalId(externalId); + } - if (StringUtils.isNotBlank(routerIpv6)) { - userNetwork.setRouterIpv6(routerIpv6); - } + if (StringUtils.isNotBlank(routerIp)) { + userNetwork.setRouterIp(routerIp); + } - if (vrIfaceMTUs != null) { - if (vrIfaceMTUs.first() != null && vrIfaceMTUs.first() > 0) { - userNetwork.setPublicMtu(vrIfaceMTUs.first()); - } else { - userNetwork.setPublicMtu(Integer.valueOf(NetworkService.VRPublicInterfaceMtu.defaultValue())); + if (StringUtils.isNotBlank(routerIpv6)) { + userNetwork.setRouterIpv6(routerIpv6); } - if (vrIfaceMTUs.second() != null && vrIfaceMTUs.second() > 0) { - userNetwork.setPrivateMtu(vrIfaceMTUs.second()); + if (vrIfaceMTUs != null) { + if (vrIfaceMTUs.first() != null && vrIfaceMTUs.first() > 0) { + userNetwork.setPublicMtu(vrIfaceMTUs.first()); + } else { + userNetwork.setPublicMtu(Integer.valueOf(NetworkService.VRPublicInterfaceMtu.defaultValue())); + } + + if (vrIfaceMTUs.second() != null && vrIfaceMTUs.second() > 0) { + userNetwork.setPrivateMtu(vrIfaceMTUs.second()); + } else { + userNetwork.setPrivateMtu(Integer.valueOf(NetworkService.VRPrivateInterfaceMtu.defaultValue())); + } } else { + userNetwork.setPublicMtu(Integer.valueOf(NetworkService.VRPublicInterfaceMtu.defaultValue())); userNetwork.setPrivateMtu(Integer.valueOf(NetworkService.VRPrivateInterfaceMtu.defaultValue())); } - } else { - userNetwork.setPublicMtu(Integer.valueOf(NetworkService.VRPublicInterfaceMtu.defaultValue())); - userNetwork.setPrivateMtu(Integer.valueOf(NetworkService.VRPrivateInterfaceMtu.defaultValue())); - } - if (!GuestType.L2.equals(userNetwork.getGuestType())) { - if (StringUtils.isNotBlank(ip4Dns1)) { - userNetwork.setDns1(ip4Dns1); - } - if (StringUtils.isNotBlank(ip4Dns2)) { - userNetwork.setDns2(ip4Dns2); - } - if (StringUtils.isNotBlank(ip6Dns1)) { - userNetwork.setIp6Dns1(ip6Dns1); - } - if (StringUtils.isNotBlank(ip6Dns2)) { - userNetwork.setIp6Dns2(ip6Dns2); + if (!GuestType.L2.equals(userNetwork.getGuestType())) { + if (StringUtils.isNotBlank(ip4Dns1)) { + userNetwork.setDns1(ip4Dns1); + } + if (StringUtils.isNotBlank(ip4Dns2)) { + userNetwork.setDns2(ip4Dns2); + } + if (StringUtils.isNotBlank(ip6Dns1)) { + userNetwork.setIp6Dns1(ip6Dns1); + } + if (StringUtils.isNotBlank(ip6Dns2)) { + userNetwork.setIp6Dns2(ip6Dns2); + } } - } - if (vlanIdFinal != null) { - if (isolatedPvlan == null) { - URI uri = null; - if (UuidUtils.isUuid(vlanIdFinal)) { - //Logical router's UUID provided as VLAN_ID - userNetwork.setVlanIdAsUUID(vlanIdFinal); //Set transient field - } else { - uri = encodeVlanIdIntoBroadcastUri(vlanIdFinal, pNtwk); - } + if (vlanIdFinal != null) { + if (isolatedPvlan == null) { + URI uri = null; + if (UuidUtils.isUuid(vlanIdFinal)) { + //Logical router's UUID provided as VLAN_ID + userNetwork.setVlanIdAsUUID(vlanIdFinal); //Set transient field + } else { + uri = encodeVlanIdIntoBroadcastUri(vlanIdFinal, pNtwk); + } - if (_networksDao.listByPhysicalNetworkPvlan(physicalNetworkId, uri.toString()).size() > 0) { - throw new InvalidParameterValueException(String.format( - "Network with vlan %s already exists or overlaps with other network pvlans in zone %s", - vlanIdFinal, zone)); - } + if (_networksDao.listByPhysicalNetworkPvlan(physicalNetworkId, uri.toString()).size() > 0) { + throw new InvalidParameterValueException(String.format( + "Network with vlan %s already exists or overlaps with other network pvlans in zone %s", + vlanIdFinal, zone)); + } userNetwork.setBroadcastUri(uri); if (!vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) { @@ -3064,9 +3112,10 @@ public Network doInTransaction(final TransactionStatus status) { } } userNetwork.setNetworkCidrSize(networkCidrSize); + userNetwork.setKeepMacAddressOnPublicNic(keepMacAddressOnPublicNic); final List networks = setupNetwork(owner, ntwkOff, userNetwork, plan, name, displayText, true, domainId, aclType, subdomainAccessFinal, vpcId, isDisplayNetworkEnabled); - Network network = null; + Network network; if (networks == null || networks.isEmpty()) { throw new CloudRuntimeException("Fail to create a network"); } else { @@ -3084,17 +3133,19 @@ public Network doInTransaction(final TransactionStatus status) { } } - if (updateResourceCount) { - _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.network, isDisplayNetworkEnabled); + if (isResourceCountUpdateNeeded(ntwkOff)) { + changeAccountResourceCountOrRecalculateDomainResourceCount(owner.getAccountId(), domainId, isDisplayNetworkEnabled, true); } + UsageEventUtils.publishNetworkCreation(network); return network; } }); - CallContext.current().setEventDetails("Network Id: " + network.getId()); + CallContext.current().setEventDetails("Network ID: " + network.getUuid()); CallContext.current().putContextParameter(Network.class, network.getUuid()); return network; + } } @Override @@ -3168,13 +3219,14 @@ public boolean shutdownNetwork(final long networkId, final ReservationContext co } logger.debug("Lock is acquired for network {} as a part of network shutdown", network); - if (network.getState() == Network.State.Allocated) { - logger.debug("Network is already shutdown: {}", network); + final Network.State initialState = network.getState(); + if (initialState == Network.State.Allocated) { + logger.debug(String.format("Network [%s] is in Allocated state, no need to shutdown.", network)); return true; } - if (network.getState() != Network.State.Implemented && network.getState() != Network.State.Shutdown) { - logger.debug("Network is not implemented: {}", network); + if (initialState != Network.State.Implemented && initialState != Network.State.Shutdown) { + logger.debug("Network is not implemented: " + network); return false; } @@ -3193,10 +3245,10 @@ public boolean shutdownNetwork(final long networkId, final ReservationContext co final boolean success = shutdownNetworkElementsAndResources(context, cleanupElements, network); final NetworkVO networkFinal = network; - final boolean result = Transaction.execute(new TransactionCallback() { + final boolean result = Transaction.execute(new TransactionCallback<>() { @Override public Boolean doInTransaction(final TransactionStatus status) { - boolean result = false; + boolean result; if (success) { logger.debug("Network {} is shutdown successfully, cleaning up corresponding resources now.", networkFinal); @@ -3218,6 +3270,9 @@ public Boolean doInTransaction(final TransactionStatus status) { } _networksDao.update(networkFinal.getId(), networkFinal); _networksDao.clearCheckForGc(networkId); + if (initialState == Network.State.Implemented) { + UsageEventUtils.publishNetworkUpdate(networkFinal); + } result = true; } else { try { @@ -3293,6 +3348,7 @@ public boolean shutdownNetworkElementsAndResources(final ReservationContext cont } } } + reconfigureAndApplyStaticRouteForVpcVpn(network); return success; } @@ -3339,7 +3395,7 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con for (final UserVmVO vm : userVms) { if (!(vm.getState() == VirtualMachine.State.Expunging && vm.getRemoved() != null)) { - logger.warn("Can't delete the network, not all user vms are expunged. Vm {} is in {} state", vm, vm.getState()); + logger.warn("Can't delete the Network, not all User Instances are expunged. Instance {} is in {} state", vm, vm.getState()); return false; } } @@ -3347,7 +3403,7 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con // Don't allow to delete network via api call when it has vms assigned to it final int nicCount = getActiveNicsInNetwork(networkId); if (nicCount > 0) { - logger.debug("The network {} has active Nics, but shouldn't.", network); + logger.debug("The Network {} has active NICs, but shouldn't.", network); // at this point we have already determined that there are no active user vms in network // if the op_networks table shows active nics, it's a bug in releasing nics updating op_networks _networksDao.changeActiveNicsBy(networkId, -1 * nicCount); @@ -3358,7 +3414,7 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con if (zone.getNetworkType() == NetworkType.Basic) { final List systemVms = _vmDao.listNonRemovedVmsByTypeAndNetwork(network.getId(), Type.ConsoleProxy, Type.SecondaryStorageVm); if (systemVms != null && !systemVms.isEmpty()) { - logger.warn("Can't delete the network, not all consoleProxy/secondaryStorage vms are expunged"); + logger.warn("Can't delete the Network, not all consoleProxy/secondaryStorage VMs are expunged"); return false; } } @@ -3410,18 +3466,18 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con final NetworkVO networkFinal = network; try { - final List deletedVlanRangeToPublish = Transaction.execute(new TransactionCallback>() { + final List deletedVlanRangeToPublish = Transaction.execute(new TransactionCallback<>() { @Override public List doInTransaction(TransactionStatus status) { final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, networkFinal.getGuruName()); if (!guru.trash(networkFinal, _networkOfferingDao.findById(networkFinal.getNetworkOfferingId()))) { - throw new CloudRuntimeException("Failed to trash network."); + throw new CloudRuntimeException("Failed to trash Network."); } Pair> deletedVlans = deleteVlansInNetwork(networkFinal, context.getCaller().getId(), callerAccount); if (!deletedVlans.first()) { - logger.warn("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges"); - throw new CloudRuntimeException("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges"); + logger.warn("Failed to delete Network " + networkFinal + "; was unable to cleanup corresponding IP ranges"); + throw new CloudRuntimeException("Failed to delete Network " + networkFinal + "; was unable to cleanup corresponding IP ranges"); } else { // commit transaction only when ips and vlans for the network are released successfully @@ -3455,9 +3511,8 @@ public List doInTransaction(TransactionStatus status) { } final NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, networkFinal.getNetworkOfferingId()); - final boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, networkFinal.getAclType()); - if (updateResourceCount) { - _resourceLimitMgr.decrementResourceCount(networkFinal.getAccountId(), ResourceType.network, networkFinal.getDisplayNetwork()); + if (isResourceCountUpdateNeeded(ntwkOff)) { + changeAccountResourceCountOrRecalculateDomainResourceCount(networkFinal.getAccountId(), networkFinal.getDomainId(), networkFinal.getDisplayNetwork(), false); } } return deletedVlans.second(); @@ -3466,11 +3521,10 @@ public List doInTransaction(TransactionStatus status) { publishDeletedVlanRanges(deletedVlanRangeToPublish); if (_networksDao.findById(network.getId()) == null) { // remove its related ACL permission - final Pair, Long> networkMsg = new Pair, Long>(Network.class, networkFinal.getId()); + final Pair, Long> networkMsg = new Pair<>(Network.class, networkFinal.getId()); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg); } - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_DELETE, network.getAccountId(), network.getDataCenterId(), network.getId(), - network.getName(), network.getNetworkOfferingId(), null, null, null, Network.class.getName(), network.getUuid()); + UsageEventUtils.publishNetworkDeletion(network); return true; } catch (final CloudRuntimeException e) { logger.error("Failed to delete network", e); @@ -3481,6 +3535,23 @@ public List doInTransaction(TransactionStatus status) { return success; } + /** + * If it is a shared network with {@link ACLType#Domain}, it will belong to account {@link Account#ACCOUNT_ID_SYSTEM} and the resources will be not incremented for the + * domain. Therefore, we force the recalculation of the domain's resource count in this case. Otherwise, it will change the count for the account owner. + * @param incrementAccountResourceCount If true, the account resource count will be incremented by 1; otherwise, it will decremented by 1. + */ + private void changeAccountResourceCountOrRecalculateDomainResourceCount(Long accountId, Long domainId, boolean displayNetwork, boolean incrementAccountResourceCount) { + if (Account.ACCOUNT_ID_SYSTEM == accountId && ObjectUtils.isNotEmpty(domainId)) { + _resourceLimitMgr.recalculateDomainResourceCount(domainId, ResourceType.network, null); + } else { + if (incrementAccountResourceCount) { + _resourceLimitMgr.incrementResourceCount(accountId, ResourceType.network, displayNetwork); + } else { + _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.network, displayNetwork); + } + } + } + private void publishDeletedVlanRanges(List deletedVlanRangeToPublish) { if (CollectionUtils.isNotEmpty(deletedVlanRangeToPublish)) { for (VlanVO vlan : deletedVlanRangeToPublish) { @@ -3490,10 +3561,8 @@ private void publishDeletedVlanRanges(List deletedVlanRangeToPublish) { } @Override - public boolean resourceCountNeedsUpdate(final NetworkOffering ntwkOff, final ACLType aclType) { - //Update resource count only for Isolated account specific non-system networks - final boolean updateResourceCount = ntwkOff.getGuestType() == GuestType.Isolated && !ntwkOff.isSystemOnly() && aclType == ACLType.Account; - return updateResourceCount; + public boolean isResourceCountUpdateNeeded(NetworkOffering networkOffering) { + return !networkOffering.isSystemOnly(); } protected Pair> deleteVlansInNetwork(final NetworkVO network, final long userId, final Account callerAccount) { @@ -3515,7 +3584,7 @@ protected Pair> deleteVlansInNetwork(final NetworkVO netwo //cleanup private vlans final int privateIpAllocCount = _privateIpDao.countAllocatedByNetworkId(networkId); if (privateIpAllocCount > 0) { - logger.warn("Can't delete Private ip range for network {} as it has allocated ip addresses", network); + logger.warn("Can't delete Private IP range for Network {} as it has allocated IP addresses", network); result = false; } else { _privateIpDao.deleteByNetworkId(networkId); @@ -3550,13 +3619,14 @@ protected void runInContext() { public void reallyRun() { try { - final List shutdownList = new ArrayList(); + final List shutdownList = new ArrayList<>(); final long currentTime = System.currentTimeMillis() / 1000; - final HashMap stillFree = new HashMap(); + final HashMap stillFree = new HashMap<>(); final List networkIds = _networksDao.findNetworksToGarbageCollect(); - final int netGcWait = NumbersUtil.parseInt(_configDao.getValue(NetworkGcWait.key()), 60); - logger.info("NetworkGarbageCollector uses '{}' seconds for GC interval.", netGcWait); + final int netGcWait = NetworkGcWait.value(); + final int netGcInterval = NetworkGcInterval.value(); + logger.info("NetworkGarbageCollector uses '{}' seconds for GC wait and '{}' seconds for GC interval.", netGcWait, netGcInterval); for (final Long networkId : networkIds) { if (!_networkModel.isNetworkReadyForGc(networkId)) { @@ -3664,7 +3734,7 @@ public boolean restartNetwork(final Long networkId, final Account callerAccount, try { VMInstanceVO instanceVO = _vmDao.findById(router.getId()); if (instanceVO == null) { - logger.info("Did not find a virtual router instance for the network"); + logger.info("Did not find a virtual router Instance for the Network"); continue; } Pair patched = mgr.updateSystemVM(instanceVO, true); @@ -3922,7 +3992,7 @@ protected boolean isSharedNetworkOfferingWithServices(final long networkOffering @Override public List listVmNics(final long vmId, final Long nicId, final Long networkId, String keyword) { - List result = null; + List result; if (keyword == null || keyword.isEmpty()) { if (nicId == null && networkId == null) { @@ -3965,8 +4035,8 @@ public boolean reallocate(final VirtualMachineProfile vm, final DataCenterDeploy if (dc.getNetworkType() == NetworkType.Basic) { final List nics = _nicDao.listByVmId(vmInstance.getId()); final NetworkVO network = _networksDao.findById(nics.get(0).getNetworkId()); - final LinkedHashMap> profiles = new LinkedHashMap>(); - profiles.put(network, new ArrayList()); + final LinkedHashMap> profiles = new LinkedHashMap<>(); + profiles.put(network, new ArrayList<>()); Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { @Override @@ -4100,7 +4170,7 @@ private boolean shutdownNetworkResources(final Network network, final Account ca // Mark all static rules as revoked and apply them on the backend (not in the DB) final List firewallStaticNatRules = _firewallDao.listByNetworkAndPurpose(network.getId(), Purpose.StaticNat); - final List staticNatRules = new ArrayList(); + final List staticNatRules = new ArrayList<>(); logger.debug("Releasing {} static nat rules for network {} as a part of shutdownNetworkRules", firewallStaticNatRules.size(), network); for (final FirewallRuleVO firewallStaticNatRule : firewallStaticNatRules) { @@ -4222,7 +4292,7 @@ private boolean shutdownNetworkResources(final Network network, final Account ca // Get all ip addresses, mark as releasing and release them on the backend final List userIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null); - final List publicIpsToRelease = new ArrayList(); + final List publicIpsToRelease = new ArrayList<>(); if (userIps != null && !userIps.isEmpty()) { for (final IPAddressVO userIp : userIps) { userIp.setState(IpAddress.State.Releasing); @@ -4271,7 +4341,7 @@ public void processConnect(final Host host, final StartupCommand cmd, final bool final String dataCenter = startup.getDataCenter(); - long dcId = -1; + long dcId; DataCenterVO dc = _dcDao.findByName(dataCenter); if (dc == null) { try { @@ -4288,7 +4358,7 @@ public void processConnect(final Host host, final StartupCommand cmd, final bool logger.debug("Host's hypervisorType is: {}", hypervisorType); - final List networkInfoList = new ArrayList(); + final List networkInfoList = new ArrayList<>(); // list all physicalnetworks in the zone & for each get the network names final List physicalNtwkList = _physicalNetworkDao.listByZone(dcId); @@ -4367,8 +4437,8 @@ public boolean processTimeout(final long agentId, final long seq) { @Override public Map finalizeServicesAndProvidersForNetwork(final NetworkOffering offering, final Long physicalNetworkId) { - final Map svcProviders = new HashMap(); - final Map> providerSvcs = new HashMap>(); + final Map svcProviders = new HashMap<>(); + final Map> providerSvcs = new HashMap<>(); final List servicesMap = _ntwkOfferingSrvcDao.listByNetworkOfferingId(offering.getId()); final boolean checkPhysicalNetwork = physicalNetworkId != null ? true : false; @@ -4398,7 +4468,7 @@ public Map finalizeServicesAndProvidersForNetwork(final NetworkO svcProviders.put(service, provider); List l = providerSvcs.get(provider); if (l == null) { - providerSvcs.put(provider, l = new ArrayList()); + providerSvcs.put(provider, l = new ArrayList<>()); } l.add(service); } @@ -4408,7 +4478,7 @@ public Map finalizeServicesAndProvidersForNetwork(final NetworkO private List getNetworkProviders(final long networkId) { final List providerNames = _ntwkSrvcDao.getDistinctProviders(networkId); - final List providers = new ArrayList(); + final List providers = new ArrayList<>(); for (final String providerName : providerNames) { providers.add(Network.Provider.getProvider(providerName)); } @@ -4465,7 +4535,7 @@ public NicProfile createNicForVm(final Network network, final NicProfile request nic = allocateNic(requested, network, isDefaultNic, deviceId, vmProfile).first(); if (nic == null) { - throw new CloudRuntimeException("Failed to allocate nic for vm " + vm + " in network " + network); + throw new CloudRuntimeException("Failed to allocate nic for Instance " + vm + " in network " + network); } //Update vm_network_map table @@ -4473,18 +4543,18 @@ public NicProfile createNicForVm(final Network network, final NicProfile request final VMNetworkMapVO vno = new VMNetworkMapVO(vm.getId(), network.getId()); _vmNetworkMapDao.persist(vno); } - logger.debug("Nic is allocated successfully for vm {} in network {}", vm, network); + logger.debug("NIC is allocated successfully for Instance {} in Network {}", vm, network); } //2) prepare nic if (prepare) { final Pair implemented = implementNetwork(nic.getNetworkId(), dest, context, vmProfile.getVirtualMachine().getType() == Type.DomainRouter); if (implemented == null || implemented.first() == null) { - logger.warn("Failed to implement network {} as a part of preparing nic {}", network, nic); - throw new CloudRuntimeException(String.format("Failed to implement network %s as a part preparing nic %s", network, nic)); + logger.warn("Failed to implement Network {} as a part of preparing NIC {}", network, nic); + throw new CloudRuntimeException(String.format("Failed to implement Network %s as a part preparing NIC %s", network, nic)); } nic = prepareNic(vmProfile, dest, context, nic.getId(), implemented.second()); - logger.debug("Nic is prepared successfully for vm {} in network {}", vm, network); + logger.debug("NIC is prepared successfully for Instance {} in Network {}", vm, network); } return nic; @@ -4503,7 +4573,7 @@ private boolean getNicProfileDefaultNic(NicProfile nicProfile) { @Override public List getNicProfiles(final Long vmId, HypervisorType hypervisorType) { final List nics = _nicDao.listByVmId(vmId); - final List profiles = new ArrayList(); + final List profiles = new ArrayList<>(); if (nics != null) { for (final Nic nic : nics) { @@ -4569,12 +4639,12 @@ private void setStateMachine() { } private Map> getServiceProvidersMap(final long networkId) { - final Map> map = new HashMap>(); + final Map> map = new HashMap<>(); final List nsms = _ntwkSrvcDao.getServicesInNetwork(networkId); for (final NetworkServiceMapVO nsm : nsms) { Set providers = map.get(Service.getService(nsm.getService())); if (providers == null) { - providers = new HashSet(); + providers = new HashSet<>(); } providers.add(Provider.getProvider(nsm.getProvider())); map.put(Service.getService(nsm.getService()), providers); @@ -4586,14 +4656,14 @@ private Map> getServiceProvidersMap(final long networkId) public List getProvidersForServiceInNetwork(final Network network, final Service service) { final Map> service2ProviderMap = getServiceProvidersMap(network.getId()); if (service2ProviderMap.get(service) != null) { - final List providers = new ArrayList(service2ProviderMap.get(service)); + final List providers = new ArrayList<>(service2ProviderMap.get(service)); return providers; } return null; } protected List getElementForServiceInNetwork(final Network network, final Service service) { - final List elements = new ArrayList(); + final List elements = new ArrayList<>(); final List providers = getProvidersForServiceInNetwork(network, service); //Only support one provider now if (providers == null) { @@ -4627,7 +4697,7 @@ public LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(final Net final List lbElements = getElementForServiceInNetwork(network, Service.Lb); NetworkElement lbElement = null; if (lbElements.size() > 1) { - String providerName = null; + String providerName; //get network offering details final NetworkOffering off = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); if (lbScheme == Scheme.Public) { @@ -4702,7 +4772,7 @@ public NicVO savePlaceholderNic(final Network network, final String ip4Address, @Override public Pair importNic(final String macAddress, int deviceId, final Network network, final Boolean isDefaultNic, final VirtualMachine vm, final Network.IpAddresses ipAddresses, final DataCenter dataCenter, final boolean forced) throws ConcurrentOperationException, InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { - logger.debug("Allocating nic for vm {} in network {} during import", vm, network); + logger.debug("Allocating NIC for Instance {} in Network {} during import", vm, network); String selectedIp = null; if (ipAddresses != null && StringUtils.isNotEmpty(ipAddresses.getIp4Address())) { if (ipAddresses.getIp4Address().equals("auto")) { @@ -4715,7 +4785,7 @@ public Pair importNic(final String macAddress, int deviceId } } final String finalSelectedIp = selectedIp; - final NicVO vo = Transaction.execute(new TransactionCallback() { + final NicVO vo = Transaction.execute(new TransactionCallback<>() { @Override public NicVO doInTransaction(TransactionStatus status) { if (StringUtils.isBlank(macAddress)) { @@ -4768,6 +4838,18 @@ public NicVO doInTransaction(TransactionStatus status) { } }); + if (selectedIp != null && GuestType.Shared.equals(network.getGuestType())) { + IPAddressVO ipAddressVO = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), selectedIp); + if (ipAddressVO != null && IpAddress.State.Free.equals(ipAddressVO.getState())) { + ipAddressVO.setState(IPAddressVO.State.Allocated); + ipAddressVO.setAllocatedTime(new Date()); + Account account = _accountDao.findById(vm.getAccountId()); + ipAddressVO.setAllocatedInDomainId(account.getDomainId()); + ipAddressVO.setAllocatedToAccountId(account.getId()); + _ipAddressDao.update(ipAddressVO.getId(), ipAddressVO); + } + } + final Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId()); final NicProfile vmNic = new NicProfile(vo, network, vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vm.getHypervisorType(), network)); @@ -4779,15 +4861,15 @@ protected String getSelectedIpForNicImport(Network network, DataCenter dataCente if (network.getGuestType() == GuestType.L2) { return null; } - return dataCenter.getNetworkType() == NetworkType.Basic ? - getSelectedIpForNicImportOnBasicZone(ipAddresses.getIp4Address(), network, dataCenter): + return GuestType.Shared.equals(network.getGuestType()) ? + getSelectedIpForNicImportOnSharedNetwork(ipAddresses.getIp4Address(), network, dataCenter): _ipAddrMgr.acquireGuestIpAddress(network, ipAddresses.getIp4Address()); } - protected String getSelectedIpForNicImportOnBasicZone(String requestedIp, Network network, DataCenter dataCenter) { + protected String getSelectedIpForNicImportOnSharedNetwork(String requestedIp, Network network, DataCenter dataCenter) { IPAddressVO ipAddressVO = StringUtils.isBlank(requestedIp) ? _ipAddressDao.findBySourceNetworkIdAndDatacenterIdAndState(network.getId(), dataCenter.getId(), IpAddress.State.Free): - _ipAddressDao.findByIp(requestedIp); + _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), requestedIp); if (ipAddressVO == null || ipAddressVO.getState() != IpAddress.State.Free) { String msg = String.format("Cannot find a free IP to assign to VM NIC on network %s", network.getName()); logger.error(msg); @@ -4866,15 +4948,16 @@ public String getConfigComponentName() { } public static final ConfigKey NetworkGcWait = new ConfigKey(Integer.class, "network.gc.wait", "Advanced", "600", - "Time (in seconds) to wait before shutting down a network that's not in used", false, Scope.Global, null); + "Time (in seconds) to wait before shutting down a network that's not in used", true, Scope.Global, null); public static final ConfigKey NetworkGcInterval = new ConfigKey(Integer.class, "network.gc.interval", "Advanced", "600", - "Seconds to wait before checking for networks to shutdown", true, Scope.Global, null); + "Seconds to wait before checking for networks to shutdown", false, Scope.Global, null); @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes, GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion, PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled, - TUNGSTEN_ENABLED, NSX_ENABLED }; + TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED, NETWORK_LB_HAPROXY_MAX_CONN, + NETWORK_LB_HAPROXY_IDLE_TIMEOUT}; } } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java index 0773c20b6b98..933b4e0c5ce6 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java @@ -36,6 +36,9 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.template.TemplateManager; import org.apache.cloudstack.api.response.MigrationResponse; import org.apache.cloudstack.engine.orchestration.service.StorageOrchestrationService; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; @@ -45,7 +48,10 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SecondaryStorageService.DataObjectResult; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult; import org.apache.cloudstack.framework.async.AsyncCallFuture; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; @@ -71,9 +77,12 @@ import com.cloud.utils.Pair; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.logging.log4j.ThreadContext; public class StorageOrchestrator extends ManagerBase implements StorageOrchestrationService, Configurable { + private static final String LOGCONTEXTID = "logcontextid"; + @Inject SnapshotDataStoreDao snapshotDataStoreDao; @Inject @@ -91,11 +100,22 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra @Inject private SecondaryStorageService secStgSrv; @Inject + TemplateService templateService; + @Inject TemplateDataStoreDao templateDataStoreDao; @Inject VolumeDataStoreDao volumeDataStoreDao; @Inject DataMigrationUtility migrationHelper; + @Inject + TemplateManager templateManager; + @Inject + VMTemplateDao templateDao; + @Inject + TemplateDataFactory templateDataFactory; + @Inject + DataCenterDao dcDao; + ConfigKey ImageStoreImbalanceThreshold = new ConfigKey<>("Advanced", Double.class, "image.store.imbalance.threshold", @@ -106,6 +126,9 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra Integer numConcurrentCopyTasksPerSSVM = 2; + private final Map zoneExecutorMap = new HashMap<>(); + private final Map zonePendingWorkCountMap = new HashMap<>(); + @Override public String getConfigComponentName() { return StorageOrchestrationService.class.getName(); @@ -167,8 +190,6 @@ public MigrationResponse migrateData(Long srcDataStoreId, List destDatasto double meanstddev = getStandardDeviation(storageCapacities); double threshold = ImageStoreImbalanceThreshold.value(); MigrationResponse response = null; - ThreadPoolExecutor executor = new ThreadPoolExecutor(numConcurrentCopyTasksPerSSVM , numConcurrentCopyTasksPerSSVM, 30, - TimeUnit.MINUTES, new MigrateBlockingQueue<>(numConcurrentCopyTasksPerSSVM)); Date start = new Date(); if (meanstddev < threshold && migrationPolicy == MigrationPolicy.BALANCE) { logger.debug("mean std deviation of the image stores is below threshold, no migration required"); @@ -177,7 +198,7 @@ public MigrationResponse migrateData(Long srcDataStoreId, List destDatasto } int skipped = 0; - List>> futures = new ArrayList<>(); + List> futures = new ArrayList<>(); while (true) { DataObject chosenFileForMigration = null; if (files.size() > 0) { @@ -206,7 +227,7 @@ public MigrationResponse migrateData(Long srcDataStoreId, List destDatasto } if (shouldMigrate(chosenFileForMigration, srcDatastore.getId(), destDatastoreId, storageCapacities, snapshotChains, childTemplates, migrationPolicy)) { - storageCapacities = migrateAway(chosenFileForMigration, storageCapacities, snapshotChains, childTemplates, srcDatastore, destDatastoreId, executor, futures); + storageCapacities = migrateAway(chosenFileForMigration, storageCapacities, snapshotChains, childTemplates, srcDatastore, destDatastoreId, futures); } else { if (migrationPolicy == MigrationPolicy.BALANCE) { continue; @@ -217,7 +238,7 @@ public MigrationResponse migrateData(Long srcDataStoreId, List destDatasto } } Date end = new Date(); - handleSnapshotMigration(srcDataStoreId, start, end, migrationPolicy, futures, storageCapacities, executor); + handleSnapshotMigration(srcDataStoreId, start, end, migrationPolicy, futures, storageCapacities); return handleResponse(futures, migrationPolicy, message, success); } @@ -250,9 +271,7 @@ public MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreI storageCapacities = getStorageCapacities(storageCapacities, srcImgStoreId); storageCapacities = getStorageCapacities(storageCapacities, destImgStoreId); - ThreadPoolExecutor executor = new ThreadPoolExecutor(numConcurrentCopyTasksPerSSVM, numConcurrentCopyTasksPerSSVM, 30, - TimeUnit.MINUTES, new MigrateBlockingQueue<>(numConcurrentCopyTasksPerSSVM)); - List>> futures = new ArrayList<>(); + List> futures = new ArrayList<>(); Date start = new Date(); while (true) { @@ -272,7 +291,7 @@ public MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreI } if (storageCapacityBelowThreshold(storageCapacities, destImgStoreId)) { - storageCapacities = migrateAway(chosenFileForMigration, storageCapacities, snapshotChains, childTemplates, srcDatastore, destImgStoreId, executor, futures); + storageCapacities = migrateAway(chosenFileForMigration, storageCapacities, snapshotChains, childTemplates, srcDatastore, destImgStoreId, futures); } else { message = "Migration failed. Destination store doesn't have enough capacity for migration"; success = false; @@ -289,7 +308,7 @@ public MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreI SnapshotInfo snapshotInfo = snapshotFactory.getSnapshot(snap.getSnapshotId(), snap.getDataStoreId(), DataStoreRole.Image); SnapshotInfo parentSnapshot = snapshotInfo.getParent(); if (snapshotInfo.getDataStore().getId() == srcImgStoreId && parentSnapshot != null && migratedSnapshotIdList.contains(parentSnapshot.getSnapshotId())) { - futures.add(executor.submit(new MigrateDataTask(snapshotInfo, srcDatastore, dataStoreManager.getDataStore(destImgStoreId, DataStoreRole.Image)))); + futures.add(submit(srcDatastore.getScope().getScopeId(), new MigrateDataTask(snapshotInfo, srcDatastore, dataStoreManager.getDataStore(destImgStoreId, DataStoreRole.Image)))); } }); } @@ -297,6 +316,12 @@ public MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreI return handleResponse(futures, null, message, success); } + @Override + public Future orchestrateTemplateCopyFromSecondaryStores(long srcTemplateId, DataStore destStore) { + Long dstZoneId = destStore.getScope().getScopeId(); + return submit(dstZoneId, new CopyTemplateFromSecondaryStorageTask(srcTemplateId, destStore)); + } + protected Pair migrateCompleted(Long destDatastoreId, DataStore srcDatastore, List files, MigrationPolicy migrationPolicy, int skipped) { String message = ""; boolean success = true; @@ -332,19 +357,10 @@ protected Map> migrateAway( Map, Long>> templateChains, DataStore srcDatastore, Long destDatastoreId, - ThreadPoolExecutor executor, - List>> futures) { + List> futures) { Long fileSize = migrationHelper.getFileSize(chosenFileForMigration, snapshotChains, templateChains); - storageCapacities = assumeMigrate(storageCapacities, srcDatastore.getId(), destDatastoreId, fileSize); - long activeSsvms = migrationHelper.activeSSVMCount(srcDatastore); - long totalJobs = activeSsvms * numConcurrentCopyTasksPerSSVM; - // Increase thread pool size with increase in number of SSVMs - if ( totalJobs > executor.getCorePoolSize()) { - executor.setMaximumPoolSize((int) (totalJobs)); - executor.setCorePoolSize((int) (totalJobs)); - } MigrateDataTask task = new MigrateDataTask(chosenFileForMigration, srcDatastore, dataStoreManager.getDataStore(destDatastoreId, DataStoreRole.Image)); if (chosenFileForMigration instanceof SnapshotInfo ) { @@ -353,19 +369,64 @@ protected Map> migrateAway( if (chosenFileForMigration instanceof TemplateInfo) { task.setTemplateChain(templateChains); } - futures.add((executor.submit(task))); + futures.add(submit(srcDatastore.getScope().getScopeId(), task)); logger.debug("Migration of {}: {} is initiated.", chosenFileForMigration.getType().name(), chosenFileForMigration.getUuid()); return storageCapacities; } + protected Future submit(Long zoneId, Callable task) { + ThreadPoolExecutor executor; + synchronized (this) { + if (!zoneExecutorMap.containsKey(zoneId)) { + zoneExecutorMap.put(zoneId, new ThreadPoolExecutor(numConcurrentCopyTasksPerSSVM, numConcurrentCopyTasksPerSSVM, + 30, TimeUnit.MINUTES, new MigrateBlockingQueue<>(numConcurrentCopyTasksPerSSVM))); + zonePendingWorkCountMap.put(zoneId, 0); + } + zonePendingWorkCountMap.merge(zoneId, 1, Integer::sum); + scaleExecutorIfNecessary(zoneId); + executor = zoneExecutorMap.get(zoneId); + } + return executor.submit(task); + + } + + protected void scaleExecutorIfNecessary(Long zoneId) { + long activeSsvms = migrationHelper.activeSSVMCount(zoneId); + long totalJobs = activeSsvms * numConcurrentCopyTasksPerSSVM; + ThreadPoolExecutor executor = zoneExecutorMap.get(zoneId); + if (totalJobs > executor.getCorePoolSize()) { + logger.debug("Scaling up executor of zone [{}] from [{}] to [{}] threads.", zoneId, executor.getCorePoolSize(), + totalJobs); + executor.setMaximumPoolSize((int) (totalJobs)); + executor.setCorePoolSize((int) (totalJobs)); + } + } + + protected synchronized void tryCleaningUpExecutor(Long zoneId) { + if (!zoneExecutorMap.containsKey(zoneId)) { + logger.debug("No executor exists for zone [{}].", zoneId); + return; + } + zonePendingWorkCountMap.merge(zoneId, -1, Integer::sum); + Integer pendingWorkCount = zonePendingWorkCountMap.get(zoneId); + if (pendingWorkCount > 0) { + logger.debug("Not cleaning executor of zone [{}] yet, as there is [{}] pending work.", zoneId, pendingWorkCount); + return; + } + + logger.debug("Cleaning executor of zone [{}].", zoneId); + ThreadPoolExecutor executor = zoneExecutorMap.get(zoneId); + zoneExecutorMap.remove(zoneId); + executor.shutdown(); + } - private MigrationResponse handleResponse(List>> futures, MigrationPolicy migrationPolicy, String message, boolean success) { + private MigrationResponse handleResponse(List> futures, MigrationPolicy migrationPolicy, String message, boolean success) { int successCount = 0; - for (Future> future : futures) { + for (Future future : futures) { try { - AsyncCallFuture res = future.get(); - if (res.get().isSuccess()) { + DataObjectResult res = future.get(); + if (res.isSuccess()) { successCount++; } } catch ( InterruptedException | ExecutionException e) { @@ -379,7 +440,7 @@ private MigrationResponse handleResponse(List>> futures, Map> storageCapacities, ThreadPoolExecutor executor) { + List> futures, Map> storageCapacities) { DataStore srcDatastore = dataStoreManager.getDataStore(srcDataStoreId, DataStoreRole.Image); List snaps = snapshotDataStoreDao.findSnapshots(srcDataStoreId, start, end); if (!snaps.isEmpty()) { @@ -395,12 +456,12 @@ private void handleSnapshotMigration(Long srcDataStoreId, Date start, Date end, storeId = dstores.get(1); } DataStore datastore = dataStoreManager.getDataStore(storeId, DataStoreRole.Image); - futures.add(executor.submit(new MigrateDataTask(snapshotInfo, srcDatastore, datastore))); + futures.add(submit(srcDatastore.getScope().getScopeId(), new MigrateDataTask(snapshotInfo, srcDatastore, datastore))); } if (parentSnapshot != null) { DataStore parentDS = dataStoreManager.getDataStore(parentSnapshot.getDataStore().getId(), DataStoreRole.Image); if (parentDS.getId() != snapshotInfo.getDataStore().getId()) { - futures.add(executor.submit(new MigrateDataTask(snapshotInfo, srcDatastore, parentDS))); + futures.add(submit(srcDatastore.getScope().getScopeId(), new MigrateDataTask(snapshotInfo, srcDatastore, parentDS))); } } } @@ -527,16 +588,19 @@ private double calculateStorageStandardDeviation(double[] metricValues, double m return standardDeviation.evaluate(metricValues, mean); } - private class MigrateDataTask implements Callable> { + private class MigrateDataTask implements Callable { private DataObject file; private DataStore srcDataStore; private DataStore destDataStore; private Map, Long>> snapshotChain; private Map, Long>> templateChain; + private String logid; + public MigrateDataTask(DataObject file, DataStore srcDataStore, DataStore destDataStore) { this.file = file; this.srcDataStore = srcDataStore; this.destDataStore = destDataStore; + this.logid = ThreadContext.get(LOGCONTEXTID); } public void setSnapshotChains(Map, Long>> snapshotChain) { @@ -557,8 +621,49 @@ public DataObject getFile() { } @Override - public AsyncCallFuture call() throws Exception { - return secStgSrv.migrateData(file, srcDataStore, destDataStore, snapshotChain, templateChain); + public DataObjectResult call() { + ThreadContext.put(LOGCONTEXTID, logid); + DataObjectResult result; + AsyncCallFuture future = secStgSrv.migrateData(file, srcDataStore, destDataStore, snapshotChain, templateChain); + try { + result = future.get(); + } catch (ExecutionException | InterruptedException e) { + logger.warn("Exception while migrating data to another secondary storage: {}", e.toString()); + result = new DataObjectResult(file); + result.setResult(e.toString()); + } + tryCleaningUpExecutor(srcDataStore.getScope().getScopeId()); + ThreadContext.clearAll(); + return result; + } + } + + private class CopyTemplateFromSecondaryStorageTask implements Callable { + private final long srcTemplateId; + private final DataStore destStore; + private final String logid; + + CopyTemplateFromSecondaryStorageTask(long srcTemplateId, DataStore destStore) { + this.srcTemplateId = srcTemplateId; + this.destStore = destStore; + this.logid = ThreadContext.get(LOGCONTEXTID); + } + + @Override + public TemplateApiResult call() { + ThreadContext.put(LOGCONTEXTID, logid); + TemplateApiResult result; + long destZoneId = destStore.getScope().getScopeId(); + TemplateInfo sourceTmpl = templateDataFactory.getTemplate(srcTemplateId, DataStoreRole.Image); + try { + templateService.handleTemplateCopyFromSecondaryStores(srcTemplateId, destStore); + result = new TemplateApiResult(sourceTmpl); + } finally { + tryCleaningUpExecutor(destZoneId); + ThreadContext.clearAll(); + } + + return result; } } } diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index db0119febde7..bf3985d3ce77 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -38,10 +38,13 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.deploy.DeploymentClusterPlanner; import com.cloud.exception.ResourceAllocationException; +import com.cloud.resourcelimit.ReservationHelper; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.user.AccountManager; import org.apache.cloudstack.api.ApiCommandResourceType; import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy; @@ -55,6 +58,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; @@ -73,16 +78,20 @@ import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.jobs.AsyncJobManager; import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO; import org.apache.cloudstack.resourcedetail.DiskOfferingDetailVO; import org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDao; +import org.apache.cloudstack.resourcelimit.Reserver; import org.apache.cloudstack.secret.PassphraseVO; import org.apache.cloudstack.secret.dao.PassphraseDao; import org.apache.cloudstack.snapshot.SnapshotHelper; import org.apache.cloudstack.storage.command.CommandResult; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; @@ -161,7 +170,7 @@ import com.cloud.vm.DiskProfile; import com.cloud.vm.SecondaryStorageVmVO; import com.cloud.vm.UserVmCloneSettingVO; -import com.cloud.vm.UserVmDetailVO; +import com.cloud.vm.VMInstanceDetailVO; import com.cloud.vm.UserVmVO; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; @@ -176,7 +185,8 @@ import com.cloud.vm.dao.SecondaryStorageVmDao; import com.cloud.vm.dao.UserVmCloneSettingDao; import com.cloud.vm.dao.UserVmDao; -import com.cloud.vm.dao.UserVmDetailsDao; +import com.cloud.vm.dao.VMInstanceDetailsDao; +import com.cloud.vm.dao.VMInstanceDao; public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable { @@ -198,6 +208,8 @@ public enum UserVmCloneType { @Inject protected PrimaryDataStoreDao _storagePoolDao = null; @Inject + protected ImageStoreDao imageStoreDao; + @Inject protected TemplateDataStoreDao _vmTemplateStoreDao = null; @Inject protected VolumeDao _volumeDao; @@ -246,7 +258,7 @@ public enum UserVmCloneType { @Inject TemplateService templateService; @Inject - UserVmDetailsDao userVmDetailsDao; + VMInstanceDetailsDao vmInstanceDetailsDao; @Inject private SecondaryStorageVmDao secondaryStorageVmDao; @Inject @@ -257,10 +269,19 @@ public enum UserVmCloneType { StoragePoolHostDao storagePoolHostDao; @Inject DiskOfferingDao diskOfferingDao; + @Inject + ConfigDepot configDepot; + @Inject + ConfigurationDao configurationDao; + @Inject + VMInstanceDao vmInstanceDao; @Inject protected SnapshotHelper snapshotHelper; + @Inject + private DataStoreProviderManager dataStoreProviderMgr; + private final StateMachine2 _volStateMachine; protected List _storagePoolAllocators; @@ -561,21 +582,34 @@ public VolumeInfo createVolumeFromSnapshot(Volume volume, Snapshot snapshot, Use } VolumeInfo vol = volFactory.getVolume(volume.getId()); + long zoneId = volume.getDataCenterId(); DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary); - DataStoreRole dataStoreRole = snapshotHelper.getDataStoreRole(snapshot); - SnapshotInfo snapInfo = snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, volume.getDataCenterId()); - - boolean kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole); + DataStoreRole dataStoreRole = snapshotHelper.getDataStoreRole(snapshot, zoneId); + SnapshotInfo snapInfo = snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, zoneId); + boolean kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole, zoneId); + logger.debug("Creating volume from snapshot, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); + boolean storageSupportSnapshotToTemplateEnabled = snapshotHelper.isStorageSupportSnapshotToTemplate(snapInfo); // storageSupportSnapshotToTemplateEnabled is true only for StorPool now [TODO: Update to check storage supports snapshot to volume (DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_SNAPSHOT) - may impact other storages, or StorPool storage type only] try { - snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage); + if (!storageSupportSnapshotToTemplateEnabled) { + dataStoreRole = snapshotHelper.getDataStoreRole(snapshot); + snapInfo = snapshotFactory.getSnapshotWithRoleAndZone(snapshot.getId(), dataStoreRole, zoneId); + kvmSnapshotOnlyInPrimaryStorage = snapshotHelper.isKvmSnapshotOnlyInPrimaryStorage(snapshot, dataStoreRole); + logger.debug("Creating volume from snapshot, with dataStore role {} and on primary storage: {}", dataStoreRole, kvmSnapshotOnlyInPrimaryStorage); + snapInfo = snapshotHelper.backupSnapshotToSecondaryStorageIfNotExists(snapInfo, dataStoreRole, snapshot, kvmSnapshotOnlyInPrimaryStorage); + } } catch (CloudRuntimeException e) { snapshotHelper.expungeTemporarySnapshot(kvmSnapshotOnlyInPrimaryStorage, snapInfo); throw e; } + boolean kvmIncrementalSnapshot = SnapshotManager.kvmIncrementalSnapshot.valueIn(_hostDao.findClusterIdByVolumeInfo(snapInfo.getBaseVolume())); + if (kvmIncrementalSnapshot && DataStoreRole.Image.equals(dataStoreRole)) { + snapInfo = snapshotHelper.convertSnapshotIfNeeded(snapInfo); + } + // don't try to perform a sync if the DataStoreRole of the snapshot is equal to DataStoreRole.Primary - if (!DataStoreRole.Primary.equals(dataStoreRole) || kvmSnapshotOnlyInPrimaryStorage) { + if (!DataStoreRole.Primary.equals(dataStoreRole) || (kvmSnapshotOnlyInPrimaryStorage && !storageSupportSnapshotToTemplateEnabled)) { try { // sync snapshot to region store if necessary DataStore snapStore = snapInfo.getDataStore(); @@ -595,13 +629,13 @@ public VolumeInfo createVolumeFromSnapshot(Volume volume, Snapshot snapshot, Use try { VolumeApiResult result = future.get(); if (result.isFailed()) { - String logMsg = String.format("Failed to create volume from snapshot [%s] due to [%s].", snapshotToString, result.getResult()); + String logMsg = String.format("Failed to create volume from Snapshot [%s] due to [%s].", snapshotToString, result.getResult()); logger.error(logMsg); throw new CloudRuntimeException(logMsg); } return result.getVolume(); } catch (InterruptedException | ExecutionException e) { - String message = String.format("Failed to create volume from snapshot [%s] due to [%s].", snapshotToString, e.getMessage()); + String message = String.format("Failed to create volume from Snapshot [%s] due to [%s].", snapshotToString, e.getMessage()); logger.error(message); logger.debug("Exception: ", e); throw new CloudRuntimeException(message, e); @@ -727,7 +761,7 @@ public VolumeInfo createVolume(VolumeInfo volumeInfo, VirtualMachine vm, Virtual VolumeApiResult result = future.get(); if (result.isFailed()) { if (result.getResult().contains(REQUEST_TEMPLATE_RELOAD) && (i == 0)) { - logger.debug("Retrying to deploy template [{}] for VMware, attempt 2/2. ", templateToString); + logger.debug("Retrying to deploy Template [{}] for VMware, attempt 2/2. ", templateToString); continue; } else { String msg = String.format("Failed to create volume [%s] due to [%s].", volumeToString, result.getResult()); @@ -743,7 +777,7 @@ public VolumeInfo createVolume(VolumeInfo volumeInfo, VirtualMachine vm, Virtual throw new CloudRuntimeException(msg, e); } } - throw new CloudRuntimeException(String.format("Failed to create volume [%s] even after retrying to deploy the template.", volumeToString)); + throw new CloudRuntimeException(String.format("Failed to create volume [%s] even after retrying to deploy the Template.", volumeToString)); } private String getReflectOnlySelectedFields(Object obj) { @@ -830,7 +864,7 @@ protected DiskProfile toDiskProfile(Volume vol, DiskOffering offering) { @ActionEvent(eventType = EventTypes.EVENT_VOLUME_CREATE, eventDescription = "creating volume", create = true) @Override public DiskProfile allocateRawVolume(Type type, String name, DiskOffering offering, Long size, Long minIops, Long maxIops, VirtualMachine vm, VirtualMachineTemplate template, Account owner, - Long deviceId) { + Long deviceId, boolean incrementResourceCount) { if (size == null) { size = offering.getDiskSize(); } else { @@ -869,9 +903,9 @@ public DiskProfile allocateRawVolume(Type type, String name, DiskOffering offeri saveVolumeDetails(offering.getId(), vol.getId()); // Save usage event and update resource count for user vm volumes - if (vm.getType() == VirtualMachine.Type.User) { + if (vm.getType() == VirtualMachine.Type.User && incrementResourceCount) { UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offering.getId(), null, size, - Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume()); + Volume.class.getName(), vol.getUuid(), vol.getInstanceId(), vol.isDisplayVolume()); _resourceLimitMgr.incrementVolumeResourceCount(vm.getAccountId(), vol.isDisplayVolume(), vol.getSize(), offering); } DiskProfile diskProfile = toDiskProfile(vol, offering); @@ -882,10 +916,20 @@ public DiskProfile allocateRawVolume(Type type, String name, DiskOffering offeri } private DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering offering, Long rootDisksize, Long minIops, Long maxIops, VirtualMachineTemplate template, VirtualMachine vm, - Account owner, long deviceId, String configurationId) { + Account owner, long deviceId, String configurationId, Volume volume, Snapshot snapshot) { assert (template.getFormat() != ImageFormat.ISO) : "ISO is not a template."; - Long size = _tmpltMgr.getTemplateSize(template, vm.getDataCenterId()); + if (volume != null) { + volume = attachExistingVolumeToVm(vm, deviceId, volume, type); + provideVmInfoToTheStorageVolume(vm, volume); + return toDiskProfile(volume, offering); + } + Long size; + if (snapshot != null) { + size = _volsDao.findByIdIncludingRemoved(snapshot.getVolumeId()).getSize(); + } else { + size = _tmpltMgr.getTemplateSize(template, vm.getDataCenterId()); + } if (rootDisksize != null) { if (template.isDeployAsIs()) { // Volume size specified from template deploy-as-is @@ -933,21 +977,55 @@ private DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering // Create event and update resource count for volumes if vm is a user vm if (vm.getType() == VirtualMachine.Type.User) { - Long offeringId = null; - if (!offering.isComputeOnly()) { offeringId = offering.getId(); } UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offeringId, vol.getTemplateId(), size, - Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume()); + Volume.class.getName(), vol.getUuid(), vol.getInstanceId(), vol.isDisplayVolume()); _resourceLimitMgr.incrementVolumeResourceCount(vm.getAccountId(), vol.isDisplayVolume(), vol.getSize(), offering); } + if (snapshot != null) { + UserVmVO userVmVO = _userVmDao.findById(vm.getId()); + try { + VolumeInfo volumeInfo = createVolumeFromSnapshot(vol, snapshot, userVmVO); + return toDiskProfile(volumeInfo, offering); + } catch (StorageUnavailableException ex) { + throw new CloudRuntimeException("Could not create volume from a snapshot", ex); + } + } return toDiskProfile(vol, offering); } + private void provideVmInfoToTheStorageVolume(VirtualMachine vm, Volume volume) { + + StoragePoolVO pool = _storagePoolDao.findById(volume.getPoolId()); + if (pool != null) { + DataStoreProvider storeProvider = dataStoreProviderMgr + .getDataStoreProvider(pool.getStorageProviderName()); + DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); + if (storeDriver != null && storeDriver instanceof PrimaryDataStoreDriver && ((PrimaryDataStoreDriver) storeDriver).isVmInfoNeeded()) { + ((PrimaryDataStoreDriver) storeDriver).provideVmInfo(vm.getId(), volume.getId()); + } + } + } + + private Volume attachExistingVolumeToVm(VirtualMachine vm, long deviceId, Volume volume, Type type) { + VolumeVO volumeVO = _volumeDao.findById(volume.getId()); + if (volumeVO == null) { + throw new CloudRuntimeException(String.format("Could not find the volume %s in the DB", volume)); + } + volumeVO.setDeviceId(deviceId); + volumeVO.setVolumeType(type); + if (vm != null) { + volumeVO.setInstanceId(vm.getId()); + } + _volumeDao.update(volumeVO.getId(), volumeVO); + return volumeVO; + } + @Override public void saveVolumeDetails(Long diskOfferingId, Long volumeId) { List volumeDetailsVO = new ArrayList<>(); @@ -977,7 +1055,7 @@ public void saveVolumeDetails(Long diskOfferingId, Long volumeId) { @ActionEvent(eventType = EventTypes.EVENT_VOLUME_CREATE, eventDescription = "creating ROOT volume", create = true) @Override public List allocateTemplatedVolumes(Type type, String name, DiskOffering offering, Long rootDisksize, Long minIops, Long maxIops, VirtualMachineTemplate template, VirtualMachine vm, - Account owner) { + Account owner, Volume volume, Snapshot snapshot) { String templateToString = getReflectOnlySelectedFields(template); int volumesNumber = 1; @@ -990,7 +1068,7 @@ public List allocateTemplatedVolumes(Type type, String name, DiskOf logger.info("Could not find a running SSVM in datacenter [{}] for deploying VM as is. Not deploying VM [{}] as is.", vm.getDataCenterId(), vm); } else { - UserVmDetailVO configurationDetail = userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_AS_IS_CONFIGURATION); + VMInstanceDetailVO configurationDetail = vmInstanceDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_AS_IS_CONFIGURATION); if (configurationDetail != null) { configurationId = configurationDetail.getValue(); } @@ -1024,7 +1102,7 @@ public List allocateTemplatedVolumes(Type type, String name, DiskOf } logger.info("Adding disk object [{}] to VM [{}]", volumeName, vm); DiskProfile diskProfile = allocateTemplatedVolume(type, volumeName, offering, volumeSize, minIops, maxIops, - template, vm, owner, deviceId, configurationId); + template, vm, owner, deviceId, configurationId, volume, snapshot); profiles.add(diskProfile); } @@ -1050,7 +1128,7 @@ private void updateRootDiskVolumeEventDetails(Type type, VirtualMachine vm, List callContext.setEventResourceId(volumeIds.get(0)); } String volumeUuids = volumeIds.stream().map(volumeId -> this._uuidMgr.getUuid(Volume.class, volumeId)).collect(Collectors.joining(", ")); - callContext.setEventDetails("Volume Type: " + type + "Volume Id: " + volumeUuids + " Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, vm.getId())); + callContext.setEventDetails("Volume Type: " + type + "Volume ID: " + volumeUuids + " Instance ID: " + vm.getUuid()); } } @@ -1059,13 +1137,13 @@ private void handleRootDiskControllerTpeForDeployAsIs(List disksAsIs String diskControllerSubType = disksAsIs.get(0).getDiskControllerSubType(); if (StringUtils.isNotBlank(diskControllerSubType)) { long vmId = vm.getId(); - UserVmDetailVO detail = userVmDetailsDao.findDetail(vmId, VmDetailConstants.ROOT_DISK_CONTROLLER); + VMInstanceDetailVO detail = vmInstanceDetailsDao.findDetail(vmId, VmDetailConstants.ROOT_DISK_CONTROLLER); if (detail != null) { detail.setValue(diskControllerSubType); - userVmDetailsDao.update(detail.getId(), detail); + vmInstanceDetailsDao.update(detail.getId(), detail); } else { - detail = new UserVmDetailVO(vmId, VmDetailConstants.ROOT_DISK_CONTROLLER, diskControllerSubType, false); - userVmDetailsDao.persist(detail); + detail = new VMInstanceDetailVO(vmId, VmDetailConstants.ROOT_DISK_CONTROLLER, diskControllerSubType, false); + vmInstanceDetailsDao.persist(detail); } } } @@ -1290,7 +1368,7 @@ private void destroyVolumeInContext(Volume volume) { // Create new context and inject correct event resource type, id and details, // otherwise VOLUME.DESTROY event will be associated with VirtualMachine and contain VM id and other information. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); - volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + volume.getUuid() + " Vm Id: " + _uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); + volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume ID: " + volume.getUuid() + " Instance ID: " + _uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); volumeContext.setEventResourceType(ApiCommandResourceType.Volume); volumeContext.setEventResourceId(volume.getId()); try { @@ -1347,7 +1425,7 @@ public Volume migrateVolume(Volume volume, StoragePool destPool) throws StorageU String volumeToString = getVolumeIdentificationInfos(volume); VolumeInfo vol = volFactory.getVolume(volume.getId()); - if (vol == null){ + if (vol == null) { throw new CloudRuntimeException(String.format("Volume migration failed because volume [%s] is null.", volumeToString)); } if (destPool == null) { @@ -1425,7 +1503,7 @@ public void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHos String storagePoolToString = getReflectOnlySelectedFields(storagePool); if (volume.getInstanceId() != vm.getId()) { - throw new CloudRuntimeException(String.format("Volume [%s] that has to be migrated, but it doesn't belong to the instance [%s].", volumeToString, vm)); + throw new CloudRuntimeException(String.format("Volume [%s] that has to be migrated, but it doesn't belong to the Instance [%s].", volumeToString, vm)); } if (destPool == null) { @@ -1507,12 +1585,8 @@ public void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest vm.addDisk(disk); } - //if (vm.getType() == VirtualMachine.Type.User && vm.getTemplate().getFormat() == ImageFormat.ISO) { if (vm.getType() == VirtualMachine.Type.User) { _tmpltMgr.prepareIsoForVmProfile(vm, dest); - //DataTO dataTO = tmplFactory.getTemplate(vm.getTemplate().getId(), DataStoreRole.Image, vm.getVirtualMachine().getDataCenterId()).getTO(); - //DiskTO iso = new DiskTO(dataTO, 3L, null, Volume.Type.ISO); - //vm.addDisk(iso); } } @@ -1554,7 +1628,7 @@ private Map getDetails(VolumeInfo volumeInfo, DataStore dataStor private void setIoDriverPolicy(Map details, StoragePoolVO storagePool, VolumeVO volume) { if (volume.getInstanceId() != null) { - UserVmDetailVO ioDriverPolicy = userVmDetailsDao.findDetail(volume.getInstanceId(), + VMInstanceDetailVO ioDriverPolicy = vmInstanceDetailsDao.findDetail(volume.getInstanceId(), VmDetailConstants.IO_POLICY); if (ioDriverPolicy != null) { if (IoDriverPolicy.STORAGE_SPECIFIC.toString().equals(ioDriverPolicy.getValue())) { @@ -1866,20 +1940,32 @@ protected void updateVolumeSize(DataStore store, VolumeVO vol) throws ResourceAl template == null ? null : template.getSize(), vol.getPassphraseId() != null); - if (newSize != vol.getSize()) { - DiskOfferingVO diskOffering = diskOfferingDao.findByIdIncludingRemoved(vol.getDiskOfferingId()); - if (newSize > vol.getSize()) { - _resourceLimitMgr.checkPrimaryStorageResourceLimit(_accountMgr.getActiveAccountById(vol.getAccountId()), - vol.isDisplay(), newSize - vol.getSize(), diskOffering); - _resourceLimitMgr.incrementVolumePrimaryStorageResourceCount(vol.getAccountId(), vol.isDisplay(), - newSize - vol.getSize(), diskOffering); - } else { - _resourceLimitMgr.decrementVolumePrimaryStorageResourceCount(vol.getAccountId(), vol.isDisplay(), - vol.getSize() - newSize, diskOffering); + if (newSize == vol.getSize()) { + return; + } + + DiskOfferingVO diskOffering = diskOfferingDao.findByIdIncludingRemoved(vol.getDiskOfferingId()); + + List reservations = new ArrayList<>(); + try { + VMInstanceVO vm = vol.getInstanceId() != null ? vmInstanceDao.findById(vol.getInstanceId()) : null; + if (vm == null || vm.getType() == VirtualMachine.Type.User) { + // Update resource count for user vm volumes when volume is attached + if (newSize > vol.getSize()) { + _resourceLimitMgr.checkPrimaryStorageResourceLimit(_accountMgr.getActiveAccountById(vol.getAccountId()), + vol.isDisplay(), newSize - vol.getSize(), diskOffering, reservations); + _resourceLimitMgr.incrementVolumePrimaryStorageResourceCount(vol.getAccountId(), vol.isDisplay(), + newSize - vol.getSize(), diskOffering); + } else { + _resourceLimitMgr.decrementVolumePrimaryStorageResourceCount(vol.getAccountId(), vol.isDisplay(), + vol.getSize() - newSize, diskOffering); + } } - vol.setSize(newSize); - _volsDao.persist(vol); + } finally { + ReservationHelper.closeAll(reservations); } + vol.setSize(newSize); + _volsDao.persist(vol); } @Override @@ -1974,8 +2060,27 @@ public void prepare(VirtualMachineProfile vm, DeployDestination dest) throws Sto _vmCloneSettingDao.persist(vmCloneSettingVO); } } + } + } + @Override + public Pair, Set> getVolumeCheckpointPathsAndImageStoreUrls(long volumeId, HypervisorType hypervisorType) { + List checkpointPaths = new ArrayList<>(); + Set imageStoreIds = new HashSet<>(); + Set imageStoreUrls = new HashSet<>(); + if (HypervisorType.KVM.equals(hypervisorType)) { + List snapshotDataStoreVos = _snapshotDataStoreDao.listReadyByVolumeIdAndCheckpointPathNotNull(volumeId); + snapshotDataStoreVos.forEach(snapshotDataStoreVO -> { + checkpointPaths.add(snapshotDataStoreVO.getKvmCheckpointPath()); + if (DataStoreRole.Image.equals(snapshotDataStoreVO.getRole())) { + imageStoreIds.add(snapshotDataStoreVO.getDataStoreId()); + } + }); + imageStoreUrls = imageStoreIds.stream().map(id -> imageStoreDao.findById(id).getUrl()).collect(Collectors.toSet()); + logger.debug(String.format("Found [%s] snapshots [%s] that have checkpoints for volume with id [%s].", snapshotDataStoreVos.size(), snapshotDataStoreVos, volumeId)); } + + return new Pair<>(checkpointPaths, imageStoreUrls); } private void handleCheckAndRepairVolume(Volume vol, Long hostId) { @@ -2018,7 +2123,9 @@ public boolean canVmRestartOnAnotherServer(long vmId) { @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] {RecreatableSystemVmEnabled, MaxVolumeSize, StorageHAMigrationEnabled, StorageMigrationEnabled, CustomDiskOfferingMaxSize, CustomDiskOfferingMinSize, VolumeUrlCheck}; + return new ConfigKey[] { + RecreatableSystemVmEnabled, MaxVolumeSize, StorageHAMigrationEnabled, StorageMigrationEnabled, + CustomDiskOfferingMaxSize, CustomDiskOfferingMinSize, VolumeUrlCheck, VolumeAllocationAlgorithm}; } @Override @@ -2031,6 +2138,18 @@ public boolean configure(String name, Map params) throws Configu return true; } + @Override + public boolean start() { + if (configDepot.isNewConfig(VolumeAllocationAlgorithm)) { + String vmAllocationAlgo = DeploymentClusterPlanner.VmAllocationAlgorithm.value(); + if (com.cloud.utils.StringUtils.isNotEmpty(vmAllocationAlgo) && !VolumeAllocationAlgorithm.defaultValue().equalsIgnoreCase(vmAllocationAlgo)) { + logger.debug("Updating value for configuration: {} to {}", VolumeAllocationAlgorithm.key(), vmAllocationAlgo); + configurationDao.update(VolumeAllocationAlgorithm.key(), vmAllocationAlgo); + } + } + return true; + } + private void cleanupVolumeDuringAttachFailure(Long volumeId, Long vmId) { VolumeVO volume = _volsDao.findById(volumeId); if (volume == null) { @@ -2195,6 +2314,7 @@ public void updateVolumeDiskChain(long volumeId, String path, String chainInfo, StoragePoolVO pool = _storagePoolDao.findByUuid(updatedDataStoreUUID); if (pool != null) { vol.setPoolId(pool.getId()); + vol.setPoolType(pool.getPoolType()); } } _volsDao.update(volumeId, vol); @@ -2204,7 +2324,7 @@ public void updateVolumeDiskChain(long volumeId, String path, String chainInfo, @Override public DiskProfile importVolume(Type type, String name, DiskOffering offering, Long sizeInBytes, Long minIops, Long maxIops, Long zoneId, HypervisorType hypervisorType, VirtualMachine vm, VirtualMachineTemplate template, Account owner, - Long deviceId, Long poolId, String path, String chainInfo) { + Long deviceId, Long poolId, Storage.StoragePoolType poolType, String path, String chainInfo) { if (sizeInBytes == null) { sizeInBytes = offering.getDiskSize(); } @@ -2245,6 +2365,7 @@ public DiskProfile importVolume(Type type, String name, DiskOffering offering, L vol.setFormat(getSupportedImageFormatForCluster(hypervisorType)); vol.setPoolId(poolId); + vol.setPoolType(poolType); vol.setPath(path); vol.setChainInfo(chainInfo); vol.setState(Volume.State.Ready); @@ -2254,7 +2375,7 @@ public DiskProfile importVolume(Type type, String name, DiskOffering offering, L @Override public DiskProfile updateImportedVolume(Type type, DiskOffering offering, VirtualMachine vm, VirtualMachineTemplate template, - Long deviceId, Long poolId, String path, String chainInfo, DiskProfile diskProfile) { + Long deviceId, Long poolId, Storage.StoragePoolType poolType, String path, String chainInfo, DiskProfile diskProfile) { VolumeVO vol = _volsDao.findById(diskProfile.getVolumeId()); if (vm != null) { @@ -2288,6 +2409,7 @@ public DiskProfile updateImportedVolume(Type type, DiskOffering offering, Virtua vol.setFormat(getSupportedImageFormatForCluster(vm.getHypervisorType())); vol.setPoolId(poolId); + vol.setPoolType(poolType); vol.setPath(path); vol.setChainInfo(chainInfo); vol.setSize(diskProfile.getSize()); diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java index 51e87663919b..ff75aa0cbb65 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java @@ -140,20 +140,12 @@ public List listHosts() { @Override public List listPods() { - /* - * Not in use now, just commented out. - */ - //List pods = new ArrayList(); - //pods.add(new PodEntityImpl("pod-uuid-1", "pod1")); - //pods.add(new PodEntityImpl("pod-uuid-2", "pod2")); return null; } @Override public List listZones() { List zones = new ArrayList(); - //zones.add(new ZoneEntityImpl("zone-uuid-1")); - //zones.add(new ZoneEntityImpl("zone-uuid-2")); return zones; } diff --git a/engine/orchestration/src/main/resources/META-INF/cloudstack/core/spring-engine-orchestration-core-context.xml b/engine/orchestration/src/main/resources/META-INF/cloudstack/core/spring-engine-orchestration-core-context.xml index 17c5002c718b..49c668f50e8b 100644 --- a/engine/orchestration/src/main/resources/META-INF/cloudstack/core/spring-engine-orchestration-core-context.xml +++ b/engine/orchestration/src/main/resources/META-INF/cloudstack/core/spring-engine-orchestration-core-context.xml @@ -88,6 +88,7 @@ + diff --git a/engine/orchestration/src/test/java/com/cloud/agent/manager/AgentManagerImplTest.java b/engine/orchestration/src/test/java/com/cloud/agent/manager/AgentManagerImplTest.java index 52b7ed775335..43d83a672c0f 100644 --- a/engine/orchestration/src/test/java/com/cloud/agent/manager/AgentManagerImplTest.java +++ b/engine/orchestration/src/test/java/com/cloud/agent/manager/AgentManagerImplTest.java @@ -22,9 +22,11 @@ import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.exception.ConnectionException; +import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.Pair; import org.junit.Assert; import org.junit.Before; @@ -47,7 +49,7 @@ public void setUp() throws Exception { host = new HostVO("some-Uuid"); host.setDataCenterId(1L); cmds = new StartupCommand[]{new StartupRoutingCommand()}; - attache = new ConnectedAgentAttache(null, 1L, "uuid", "kvm-attache", null, false); + attache = new ConnectedAgentAttache(null, 1L, "uuid", "kvm-attache", Hypervisor.HypervisorType.KVM, null, false); hostDao = Mockito.mock(HostDao.class); storagePoolMonitor = Mockito.mock(Listener.class); @@ -103,4 +105,36 @@ public void testGetTimeoutWithGranularTimeout() { Assert.assertEquals(50, result); } + + @Test + public void testGetHostSshPortWithHostNull() { + int hostSshPort = mgr.getHostSshPort(null); + Assert.assertEquals(22, hostSshPort); + } + + @Test + public void testGetHostSshPortWithNonKVMHost() { + HostVO host = Mockito.mock(HostVO.class); + Mockito.when(host.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.XenServer); + int hostSshPort = mgr.getHostSshPort(host); + Assert.assertEquals(22, hostSshPort); + } + + @Test + public void testGetHostSshPortWithKVMHostDefaultPort() { + HostVO host = Mockito.mock(HostVO.class); + Mockito.when(host.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + Mockito.when(host.getClusterId()).thenReturn(1L); + int hostSshPort = mgr.getHostSshPort(host); + Assert.assertEquals(22, hostSshPort); + } + + @Test + public void testGetHostSshPortWithKVMHostCustomPort() { + HostVO host = Mockito.mock(HostVO.class); + Mockito.when(host.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + Mockito.when(host.getDetail(Host.HOST_SSH_PORT)).thenReturn(String.valueOf(3922)); + int hostSshPort = mgr.getHostSshPort(host); + Assert.assertEquals(3922, hostSshPort); + } } diff --git a/engine/orchestration/src/test/java/com/cloud/agent/manager/ClusteredAgentManagerImplTest.java b/engine/orchestration/src/test/java/com/cloud/agent/manager/ClusteredAgentManagerImplTest.java new file mode 100644 index 000000000000..5e4678f62225 --- /dev/null +++ b/engine/orchestration/src/test/java/com/cloud/agent/manager/ClusteredAgentManagerImplTest.java @@ -0,0 +1,150 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.agent.manager; + +import com.cloud.configuration.ManagementServiceConfiguration; +import com.cloud.ha.HighAvailabilityManagerImpl; +import com.cloud.host.HostVO; +import com.cloud.host.Status; +import com.cloud.host.dao.HostDao; +import com.cloud.resource.ResourceManagerImpl; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.ArrayList; +import java.util.List; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class ClusteredAgentManagerImplTest { + + private HostDao _hostDao; + @Mock + ManagementServiceConfiguration _mgmtServiceConf; + + @Before + public void setUp() throws Exception { + _hostDao = mock(HostDao.class); + } + + @Test + public void scanDirectAgentToLoadNoHostsTest() { + ClusteredAgentManagerImpl clusteredAgentManagerImpl = mock(ClusteredAgentManagerImpl.class); + clusteredAgentManagerImpl._hostDao = _hostDao; + clusteredAgentManagerImpl.scanDirectAgentToLoad(); + verify(clusteredAgentManagerImpl, never()).findAttache(anyLong()); + verify(clusteredAgentManagerImpl, never()).loadDirectlyConnectedHost(any(), anyBoolean()); + } + + @Test + public void scanDirectAgentToLoadHostWithoutAttacheTest() { + // Arrange + ClusteredAgentManagerImpl clusteredAgentManagerImpl = Mockito.spy(ClusteredAgentManagerImpl.class); + HostVO hostVO = mock(HostVO.class); + clusteredAgentManagerImpl._hostDao = _hostDao; + clusteredAgentManagerImpl.mgmtServiceConf = _mgmtServiceConf; + clusteredAgentManagerImpl._resourceMgr = mock(ResourceManagerImpl.class); + when(_mgmtServiceConf.getTimeout()).thenReturn(16000L); + when(hostVO.getId()).thenReturn(1L); + List hosts = new ArrayList<>(); + hosts.add(hostVO); + when(_hostDao.findAndUpdateDirectAgentToLoad(anyLong(), anyLong(), anyLong())).thenReturn(hosts); + AgentAttache agentAttache = mock(AgentAttache.class); + doReturn(Boolean.TRUE).when(clusteredAgentManagerImpl).loadDirectlyConnectedHost(hostVO, false); + clusteredAgentManagerImpl.scanDirectAgentToLoad(); + verify(clusteredAgentManagerImpl).loadDirectlyConnectedHost(hostVO, false); + } + + @Test + public void scanDirectAgentToLoadHostWithForwardAttacheTest() { + ClusteredAgentManagerImpl clusteredAgentManagerImpl = Mockito.spy(ClusteredAgentManagerImpl.class); + HostVO hostVO = mock(HostVO.class); + clusteredAgentManagerImpl._hostDao = _hostDao; + clusteredAgentManagerImpl.mgmtServiceConf = _mgmtServiceConf; + when(_mgmtServiceConf.getTimeout()).thenReturn(16000L); + when(hostVO.getId()).thenReturn(1L); + List hosts = new ArrayList<>(); + hosts.add(hostVO); + when(_hostDao.findAndUpdateDirectAgentToLoad(anyLong(), anyLong(), anyLong())).thenReturn(hosts); + AgentAttache agentAttache = mock(AgentAttache.class); + when(agentAttache.forForward()).thenReturn(Boolean.TRUE); + when(clusteredAgentManagerImpl.findAttache(1L)).thenReturn(agentAttache); + + clusteredAgentManagerImpl.scanDirectAgentToLoad(); + verify(clusteredAgentManagerImpl).removeAgent(agentAttache, Status.Disconnected); + } + + @Test + public void scanDirectAgentToLoadHostWithNonForwardAttacheTest() { + // Arrange + ClusteredAgentManagerImpl clusteredAgentManagerImpl = Mockito.spy(new ClusteredAgentManagerImpl()); + HostVO hostVO = mock(HostVO.class); + clusteredAgentManagerImpl._hostDao = _hostDao; + clusteredAgentManagerImpl.mgmtServiceConf = _mgmtServiceConf; + clusteredAgentManagerImpl._haMgr = mock(HighAvailabilityManagerImpl.class); + when(_mgmtServiceConf.getTimeout()).thenReturn(16000L); + when(hostVO.getId()).thenReturn(0L); + List hosts = new ArrayList<>(); + hosts.add(hostVO); + when(_hostDao.findAndUpdateDirectAgentToLoad(anyLong(), anyLong(), anyLong())).thenReturn(hosts); + + AgentAttache agentAttache = mock(AgentAttache.class); + when(agentAttache.forForward()).thenReturn(Boolean.FALSE); + when(clusteredAgentManagerImpl.findAttache(0L)).thenReturn(agentAttache); + doReturn(Boolean.TRUE).when(clusteredAgentManagerImpl).agentStatusTransitTo(hostVO, Status.Event.Ping, clusteredAgentManagerImpl._nodeId); + doReturn(Status.Up).when(clusteredAgentManagerImpl).investigate(agentAttache); + + clusteredAgentManagerImpl.scanDirectAgentToLoad(); + verify(clusteredAgentManagerImpl).investigate(agentAttache); + verify(clusteredAgentManagerImpl).agentStatusTransitTo(hostVO, Status.Event.Ping, clusteredAgentManagerImpl._nodeId); + } + + @Test + public void scanDirectAgentToLoadHostWithNonForwardAttacheAndDisconnectedTest() { + ClusteredAgentManagerImpl clusteredAgentManagerImpl = Mockito.spy(ClusteredAgentManagerImpl.class); + HostVO hostVO = mock(HostVO.class); + clusteredAgentManagerImpl._hostDao = _hostDao; + clusteredAgentManagerImpl.mgmtServiceConf = _mgmtServiceConf; + clusteredAgentManagerImpl._haMgr = mock(HighAvailabilityManagerImpl.class); + clusteredAgentManagerImpl._resourceMgr = mock(ResourceManagerImpl.class); + when(_mgmtServiceConf.getTimeout()).thenReturn(16000L); + when(hostVO.getId()).thenReturn(0L); + List hosts = new ArrayList<>(); + hosts.add(hostVO); + when(_hostDao.findAndUpdateDirectAgentToLoad(anyLong(), anyLong(), anyLong())).thenReturn(hosts); + AgentAttache agentAttache = mock(AgentAttache.class); + when(agentAttache.forForward()).thenReturn(Boolean.FALSE); + when(clusteredAgentManagerImpl.findAttache(0L)).thenReturn(agentAttache); + doReturn(Boolean.TRUE).when(clusteredAgentManagerImpl).loadDirectlyConnectedHost(hostVO, false); + clusteredAgentManagerImpl.scanDirectAgentToLoad(); + verify(clusteredAgentManagerImpl).investigate(agentAttache); + verify(clusteredAgentManagerImpl).loadDirectlyConnectedHost(hostVO, false); + } +} diff --git a/engine/orchestration/src/test/java/com/cloud/agent/manager/ConnectedAgentAttacheTest.java b/engine/orchestration/src/test/java/com/cloud/agent/manager/ConnectedAgentAttacheTest.java index 0b42b505668a..66e6bbae5e2c 100644 --- a/engine/orchestration/src/test/java/com/cloud/agent/manager/ConnectedAgentAttacheTest.java +++ b/engine/orchestration/src/test/java/com/cloud/agent/manager/ConnectedAgentAttacheTest.java @@ -22,6 +22,7 @@ import org.junit.Test; +import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.nio.Link; public class ConnectedAgentAttacheTest { @@ -31,8 +32,8 @@ public void testEquals() throws Exception { Link link = mock(Link.class); - ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, link, false); - ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, "uuid", null, link, false); + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, Hypervisor.HypervisorType.KVM, link, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, "uuid", null, Hypervisor.HypervisorType.KVM,link, false); assertTrue(agentAttache1.equals(agentAttache2)); } @@ -42,7 +43,7 @@ public void testEqualsFalseNull() throws Exception { Link link = mock(Link.class); - ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, link, false); + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, Hypervisor.HypervisorType.KVM, link, false); assertFalse(agentAttache1.equals(null)); } @@ -53,8 +54,8 @@ public void testEqualsFalseDiffLink() throws Exception { Link link1 = mock(Link.class); Link link2 = mock(Link.class); - ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, link1, false); - ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, "uuid", null, link2, false); + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 0, "uuid", null, Hypervisor.HypervisorType.KVM, link1, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 0, "uuid", null, Hypervisor.HypervisorType.KVM, link2, false); assertFalse(agentAttache1.equals(agentAttache2)); } @@ -64,8 +65,8 @@ public void testEqualsFalseDiffId() throws Exception { Link link1 = mock(Link.class); - ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, "uuid", null, link1, false); - ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 2, "uuid", null, link1, false); + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, "uuid", null, Hypervisor.HypervisorType.KVM, link1, false); + ConnectedAgentAttache agentAttache2 = new ConnectedAgentAttache(null, 2, "uuid", null, Hypervisor.HypervisorType.KVM, link1, false); assertFalse(agentAttache1.equals(agentAttache2)); } @@ -75,7 +76,7 @@ public void testEqualsFalseDiffClass() throws Exception { Link link1 = mock(Link.class); - ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, "uuid", null, link1, false); + ConnectedAgentAttache agentAttache1 = new ConnectedAgentAttache(null, 1, "uuid", null, Hypervisor.HypervisorType.KVM, link1, false); assertFalse(agentAttache1.equals("abc")); } diff --git a/engine/orchestration/src/test/java/com/cloud/agent/manager/DirectAgentAttacheTest.java b/engine/orchestration/src/test/java/com/cloud/agent/manager/DirectAgentAttacheTest.java index 65e31c271a42..4ba276460e3a 100644 --- a/engine/orchestration/src/test/java/com/cloud/agent/manager/DirectAgentAttacheTest.java +++ b/engine/orchestration/src/test/java/com/cloud/agent/manager/DirectAgentAttacheTest.java @@ -24,6 +24,7 @@ import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; +import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; import java.util.UUID; @@ -42,7 +43,7 @@ public class DirectAgentAttacheTest { @Before public void setup() { - directAgentAttache = new DirectAgentAttache(_agentMgr, _id, _uuid, "myDirectAgentAttache", _resource, false); + directAgentAttache = new DirectAgentAttache(_agentMgr, _id, _uuid, "myDirectAgentAttache", Hypervisor.HypervisorType.KVM, _resource, false); MockitoAnnotations.initMocks(directAgentAttache); } diff --git a/engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java b/engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java index 47f9b9f33e27..a07870d09af2 100644 --- a/engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java +++ b/engine/orchestration/src/test/java/com/cloud/vm/VirtualMachineManagerImplTest.java @@ -19,20 +19,29 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,18 +49,39 @@ import java.util.UUID; import java.util.stream.Collectors; +import com.cloud.agent.api.UnmanageInstanceAnswer; +import com.cloud.agent.api.UnmanageInstanceCommand; +import com.cloud.agent.api.to.DataTO; +import com.cloud.agent.api.to.DiskTO; +import com.cloud.api.ApiDBUtils; +import com.cloud.event.ActionEventUtils; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.ha.HighAvailabilityManager; +import com.cloud.network.Network; +import com.cloud.network.NetworkModel; +import com.cloud.resource.ResourceManager; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.impl.ConfigDepotImpl; +import org.apache.cloudstack.framework.extensions.dao.ExtensionDetailsDao; +import org.apache.cloudstack.framework.extensions.manager.ExtensionsManager; +import org.apache.cloudstack.framework.extensions.vo.ExtensionDetailsVO; +import org.apache.cloudstack.framework.jobs.dao.VmWorkJobDao; +import org.apache.cloudstack.framework.jobs.impl.VmWorkJobVO; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.commons.collections.MapUtils; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -64,15 +94,20 @@ import com.cloud.agent.AgentManager; import com.cloud.agent.api.Command; +import com.cloud.agent.api.PrepareExternalProvisioningAnswer; +import com.cloud.agent.api.RebootCommand; +import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StopAnswer; import com.cloud.agent.api.StopCommand; import com.cloud.agent.api.routing.NetworkElementCommand; +import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.api.query.dao.UserVmJoinDao; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.dc.ClusterDetailsDao; import com.cloud.dc.ClusterDetailsVO; import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenterVO; import com.cloud.dc.Pod; import com.cloud.dc.dao.ClusterDao; @@ -85,12 +120,15 @@ import com.cloud.deploy.DeploymentPlanningManager; import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; +import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.OperationTimedoutException; import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuruManager; +import com.cloud.network.NetworkService; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkVO; import com.cloud.network.vpc.VpcVO; @@ -114,6 +152,7 @@ import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VMTemplateZoneDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.user.AccountVO; @@ -126,8 +165,9 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.fsm.StateMachine2; import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.UserVmDao; -import com.cloud.vm.dao.UserVmDetailsDao; +import com.cloud.vm.dao.VMInstanceDetailsDao; import com.cloud.vm.dao.VMInstanceDao; @RunWith(MockitoJUnitRunner.class) @@ -148,17 +188,26 @@ public class VirtualMachineManagerImplTest { private PrimaryDataStoreDao storagePoolDaoMock; @Mock private VMInstanceVO vmInstanceMock; + @Mock + private VmWorkJobDao _workJobDao; + private long vmInstanceVoMockId = 1L; @Mock private ServiceOfferingVO serviceOfferingMock; + @Mock + private SnapshotManager snapshotManagerMock; + @Mock private DiskOfferingVO diskOfferingMock; private long hostMockId = 1L; private long clusterMockId = 2L; private long zoneMockId = 3L; + private final String vmMockUuid = UUID.randomUUID().toString(); + private final String hostUuid = UUID.randomUUID().toString(); + @Mock private HostVO hostMock; @Mock @@ -170,6 +219,7 @@ public class VirtualMachineManagerImplTest { private StoragePoolVO storagePoolVoMock; private long storagePoolVoMockId = 11L; private long storagePoolVoMockClusterId = 234L; + private String vmName = "vm1"; @Mock private VolumeVO volumeVoMock; @@ -209,6 +259,8 @@ public class VirtualMachineManagerImplTest { @Mock private EntityManager _entityMgr; @Mock + private ResourceManager _resourceMgr; + @Mock private DeploymentPlanningManager _dpMgr; @Mock private HypervisorGuruManager _hvGuruMgr; @@ -217,11 +269,29 @@ public class VirtualMachineManagerImplTest { @Mock private ClusterDetailsDao _clusterDetailsDao; @Mock - private UserVmDetailsDao userVmDetailsDao; + private VMInstanceDetailsDao vmInstanceDetailsDao; @Mock private ItWorkDao _workDao; @Mock protected StateMachine2 _stateMachine; + @Mock + ExtensionsManager extensionsManager; + @Mock + ExtensionDetailsDao extensionDetailsDao; + @Mock + NicDao _nicsDao; + @Mock + NetworkService networkService; + @Mock + NetworkModel networkModel; + @Mock + VolumeDataFactory volumeDataFactoryMock; + @Mock + StorageManager storageManager; + @Mock + private HighAvailabilityManager _haMgr; + @Mock + VirtualMachineGuru guru; private ConfigDepotImpl configDepotImpl; private boolean updatedConfigKeyDepot = false; @@ -231,6 +301,7 @@ public void setup() { ReflectionTestUtils.getField(VirtualMachineManager.VmMetadataManufacturer, "s_depot"); virtualMachineManagerImpl.setHostAllocators(new ArrayList<>()); + when(vmInstanceMock.getName()).thenReturn(vmName); when(vmInstanceMock.getId()).thenReturn(vmInstanceVoMockId); when(vmInstanceMock.getServiceOfferingId()).thenReturn(2L); when(hostMock.getId()).thenReturn(hostMockId); @@ -451,8 +522,8 @@ public void executeManagedStorageChecksWhenTargetStoragePoolProvidedTestCurrentS virtualMachineManagerImpl.executeManagedStorageChecksWhenTargetStoragePoolProvided(storagePoolVoMock, volumeVoMock, Mockito.mock(StoragePoolVO.class)); - Mockito.verify(storagePoolVoMock).isManaged(); - Mockito.verify(storagePoolVoMock, Mockito.times(0)).getId(); + verify(storagePoolVoMock).isManaged(); + verify(storagePoolVoMock, Mockito.times(0)).getId(); } @Test @@ -462,8 +533,8 @@ public void allowVolumeMigrationsForPowerFlexStorage() { virtualMachineManagerImpl.executeManagedStorageChecksWhenTargetStoragePoolProvided(storagePoolVoMock, volumeVoMock, Mockito.mock(StoragePoolVO.class)); - Mockito.verify(storagePoolVoMock).isManaged(); - Mockito.verify(storagePoolVoMock, Mockito.times(0)).getId(); + verify(storagePoolVoMock).isManaged(); + verify(storagePoolVoMock, Mockito.times(0)).getId(); } @Test @@ -478,8 +549,8 @@ public void executeManagedStorageChecksWhenTargetStoragePoolProvidedTestCurrentS virtualMachineManagerImpl.executeManagedStorageChecksWhenTargetStoragePoolProvided(storagePoolVoMock, volumeVoMock, storagePoolVoMock); - Mockito.verify(storagePoolVoMock).isManaged(); - Mockito.verify(storagePoolVoMock, Mockito.times(2)).getId(); + verify(storagePoolVoMock).isManaged(); + verify(storagePoolVoMock, Mockito.times(2)).getId(); } @Test(expected = CloudRuntimeException.class) @@ -503,7 +574,7 @@ public void buildMapUsingUserInformationTestUserDefinedMigrationMapEmpty() { Assert.assertTrue(volumeToPoolObjectMap.isEmpty()); - Mockito.verify(userDefinedVolumeToStoragePoolMap, times(0)).keySet(); + verify(userDefinedVolumeToStoragePoolMap, times(0)).keySet(); } @Test(expected = CloudRuntimeException.class) @@ -532,7 +603,7 @@ public void buildMapUsingUserInformationTestTargetHostHasAccessToPool() { assertFalse(volumeToPoolObjectMap.isEmpty()); assertEquals(storagePoolVoMock, volumeToPoolObjectMap.get(volumeVoMock)); - Mockito.verify(userDefinedVolumeToStoragePoolMap, times(1)).keySet(); + verify(userDefinedVolumeToStoragePoolMap, times(1)).keySet(); } @Test @@ -559,8 +630,8 @@ public void executeManagedStorageChecksWhenTargetStoragePoolNotProvidedTestCurre virtualMachineManagerImpl.executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); - Mockito.verify(storagePoolVoMock).isManaged(); - Mockito.verify(storagePoolHostDaoMock, Mockito.times(0)).findByPoolHost(anyLong(), anyLong()); + verify(storagePoolVoMock).isManaged(); + verify(storagePoolHostDaoMock, Mockito.times(0)).findByPoolHost(anyLong(), anyLong()); } @Test @@ -570,8 +641,8 @@ public void executeManagedStorageChecksWhenTargetStoragePoolNotProvidedTestCurre virtualMachineManagerImpl.executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); - Mockito.verify(storagePoolVoMock).isManaged(); - Mockito.verify(storagePoolHostDaoMock, Mockito.times(1)).findByPoolHost(storagePoolVoMockId, hostMockId); + verify(storagePoolVoMock).isManaged(); + verify(storagePoolHostDaoMock, Mockito.times(1)).findByPoolHost(storagePoolVoMockId, hostMockId); } @Test(expected = CloudRuntimeException.class) @@ -670,11 +741,11 @@ public void getCandidateStoragePoolsToMigrateLocalVolumeTestMoreThanOneAllocator Assert.assertTrue(poolList.isEmpty()); - Mockito.verify(storagePoolAllocatorMock).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), + verify(storagePoolAllocatorMock).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), any(ExcludeList.class), Mockito.eq(StoragePoolAllocator.RETURN_UPTO_ALL)); - Mockito.verify(storagePoolAllocatorMock2).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), + verify(storagePoolAllocatorMock2).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), any(ExcludeList.class), Mockito.eq(StoragePoolAllocator.RETURN_UPTO_ALL)); - Mockito.verify(storagePoolAllocatorMock3).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), + verify(storagePoolAllocatorMock3).allocateToPool(any(DiskProfile.class), any(VirtualMachineProfile.class), any(DeploymentPlan.class), any(ExcludeList.class), Mockito.eq(StoragePoolAllocator.RETURN_UPTO_ALL)); } @@ -732,8 +803,8 @@ public void createStoragePoolMappingsForVolumesTestLocalStoragevolume() { virtualMachineManagerImpl.createStoragePoolMappingsForVolumes(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, allVolumes); Assert.assertTrue(volumeToPoolObjectMap.isEmpty()); - Mockito.verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); - Mockito.verify(virtualMachineManagerImpl).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, storagePoolVoMock); + verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); + verify(virtualMachineManagerImpl).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, storagePoolVoMock); } @Test @@ -751,9 +822,9 @@ public void createStoragePoolMappingsForVolumesTestCrossCluterMigration() { virtualMachineManagerImpl.createStoragePoolMappingsForVolumes(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, allVolumes); Assert.assertTrue(volumeToPoolObjectMap.isEmpty()); - Mockito.verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); - Mockito.verify(virtualMachineManagerImpl).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, storagePoolVoMock); - Mockito.verify(virtualMachineManagerImpl).isStorageCrossClusterMigration(clusterMockId, storagePoolVoMock); + verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); + verify(virtualMachineManagerImpl).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, storagePoolVoMock); + verify(virtualMachineManagerImpl).isStorageCrossClusterMigration(clusterMockId, storagePoolVoMock); } @Test @@ -772,9 +843,9 @@ public void createStoragePoolMappingsForVolumesTestNotCrossCluterMigrationWithCl assertFalse(volumeToPoolObjectMap.isEmpty()); assertEquals(storagePoolVoMock, volumeToPoolObjectMap.get(volumeVoMock)); - Mockito.verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); - Mockito.verify(virtualMachineManagerImpl).isStorageCrossClusterMigration(clusterMockId, storagePoolVoMock); - Mockito.verify(virtualMachineManagerImpl, Mockito.times(0)).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, + verify(virtualMachineManagerImpl).executeManagedStorageChecksWhenTargetStoragePoolNotProvided(hostMock, storagePoolVoMock, volumeVoMock); + verify(virtualMachineManagerImpl).isStorageCrossClusterMigration(clusterMockId, storagePoolVoMock); + verify(virtualMachineManagerImpl, Mockito.times(0)).createVolumeToStoragePoolMappingIfPossible(virtualMachineProfileMock, dataCenterDeploymentMock, volumeToPoolObjectMap, volumeVoMock, storagePoolVoMock); } @@ -1091,7 +1162,7 @@ public void testOrchestrateStartNonNullPodId() throws Exception { when(cluster.getId()).thenReturn(1L); when(_clusterDetailsDao.findDetail(1L, VmDetailConstants.CPU_OVER_COMMIT_RATIO)).thenReturn(cluster_detail_cpu); when(_clusterDetailsDao.findDetail(1L, VmDetailConstants.MEMORY_OVER_COMMIT_RATIO)).thenReturn(cluster_detail_ram); - when(userVmDetailsDao.findDetail(anyLong(), Mockito.anyString())).thenReturn(null); + when(vmInstanceDetailsDao.findDetail(anyLong(), Mockito.anyString())).thenReturn(null); when(cluster_detail_cpu.getValue()).thenReturn("1.0"); when(cluster_detail_ram.getValue()).thenReturn("1.0"); doReturn(false).when(virtualMachineManagerImpl).areAllVolumesAllocated(Mockito.anyLong()); @@ -1187,7 +1258,7 @@ public void testOrchestrateStartNullPodId() throws Exception { when(cluster.getId()).thenReturn(1L); when(_clusterDetailsDao.findDetail(1L, VmDetailConstants.CPU_OVER_COMMIT_RATIO)).thenReturn(cluster_detail_cpu); when(_clusterDetailsDao.findDetail(1L, VmDetailConstants.MEMORY_OVER_COMMIT_RATIO)).thenReturn(cluster_detail_ram); - when(userVmDetailsDao.findDetail(anyLong(), Mockito.anyString())).thenReturn(null); + when(vmInstanceDetailsDao.findDetail(anyLong(), Mockito.anyString())).thenReturn(null); when(cluster_detail_cpu.getValue()).thenReturn("1.0"); when(cluster_detail_ram.getValue()).thenReturn("1.0"); doReturn(true).when(virtualMachineManagerImpl).areAllVolumesAllocated(Mockito.anyLong()); @@ -1304,4 +1375,583 @@ public void testUpdateVmMetadataManufacturerAndProductCustomManufacturer() { Assert.assertEquals(manufacturer, to.getMetadataManufacturer()); Assert.assertEquals(product, to.getMetadataProductName()); } + + @Test + public void recreateCheckpointsKvmOnVmAfterMigrationTestReturnIfNotKvm() { + Mockito.doReturn(HypervisorType.VMware).when(vmInstanceMock).getHypervisorType(); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(volumeDaoMock, never()).findByInstance(Mockito.anyLong()); + } + + @Test + public void recreateCheckpointsKvmOnVmAfterMigrationTestReturnIfVolumesDoNotHaveCheckpoints() throws OperationTimedoutException, AgentUnavailableException { + Mockito.doReturn(HypervisorType.KVM).when(vmInstanceMock).getHypervisorType(); + Mockito.doReturn(new ArrayList()).when(virtualMachineManagerImpl).getVmVolumesWithCheckpointsToRecreate(Mockito.any()); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(agentManagerMock, never()).send(Mockito.anyLong(), (Command) any()); + } + + @Test (expected = CloudRuntimeException.class) + public void recreateCheckpointsKvmOnVmAfterMigrationTestAgentUnavailableThrowsCloudRuntimeExceptionAndEndsSnapshotChains() throws OperationTimedoutException, AgentUnavailableException { + Mockito.doReturn(HypervisorType.KVM).when(vmInstanceMock).getHypervisorType(); + Mockito.doReturn(List.of(new VolumeObjectTO())).when(virtualMachineManagerImpl).getVmVolumesWithCheckpointsToRecreate(Mockito.any()); + + doThrow(new AgentUnavailableException(0)).when(agentManagerMock).send(Mockito.anyLong(), (Command) any()); + Mockito.doNothing().when(snapshotManagerMock).endSnapshotChainForVolume(Mockito.anyLong(), Mockito.any()); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(snapshotManagerMock, Mockito.times(1)).endSnapshotChainForVolume(Mockito.anyLong(),any()); + } + + @Test (expected = CloudRuntimeException.class) + public void recreateCheckpointsKvmOnVmAfterMigrationTestOperationTimedoutExceptionThrowsCloudRuntimeExceptionAndEndsSnapshotChains() throws OperationTimedoutException, AgentUnavailableException { + Mockito.doReturn(HypervisorType.KVM).when(vmInstanceMock).getHypervisorType(); + Mockito.doReturn(List.of(new VolumeObjectTO())).when(virtualMachineManagerImpl).getVmVolumesWithCheckpointsToRecreate(Mockito.any()); + + doThrow(new OperationTimedoutException(null, 0, 0, 0, false)).when(agentManagerMock).send(Mockito.anyLong(), (Command) any()); + Mockito.doNothing().when(snapshotManagerMock).endSnapshotChainForVolume(Mockito.anyLong(), Mockito.any()); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(snapshotManagerMock, Mockito.times(1)).endSnapshotChainForVolume(Mockito.anyLong(),any()); + } + + @Test + public void recreateCheckpointsKvmOnVmAfterMigrationTestRecreationFails() throws OperationTimedoutException, AgentUnavailableException { + Mockito.doReturn(HypervisorType.KVM).when(vmInstanceMock).getHypervisorType(); + Mockito.doReturn(List.of(new VolumeObjectTO())).when(virtualMachineManagerImpl).getVmVolumesWithCheckpointsToRecreate(Mockito.any()); + + Mockito.doReturn(new com.cloud.agent.api.Answer(null, false, null)).when(agentManagerMock).send(Mockito.anyLong(), (Command) any()); + Mockito.doNothing().when(snapshotManagerMock).endSnapshotChainForVolume(Mockito.anyLong(), Mockito.any()); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(snapshotManagerMock, Mockito.times(1)).endSnapshotChainForVolume(Mockito.anyLong(),any()); + } + + @Test + public void recreateCheckpointsKvmOnVmAfterMigrationTestRecreationSucceeds() throws OperationTimedoutException, AgentUnavailableException { + Mockito.doReturn(HypervisorType.KVM).when(vmInstanceMock).getHypervisorType(); + Mockito.doReturn(List.of(new VolumeObjectTO())).when(virtualMachineManagerImpl).getVmVolumesWithCheckpointsToRecreate(Mockito.any()); + + Mockito.doReturn(new com.cloud.agent.api.Answer(null, true, null)).when(agentManagerMock).send(Mockito.anyLong(), (Command) any()); + + virtualMachineManagerImpl.recreateCheckpointsKvmOnVmAfterMigration(vmInstanceMock, 0); + + verify(snapshotManagerMock, never()).endSnapshotChainForVolume(Mockito.anyLong(),any()); + } + + @Test + public void updateStartCommandWithExternalDetails_nonExternalHypervisor_noAction() { + Host host = mock(Host.class); + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + StartCommand command = mock(StartCommand.class); + + when(host.getHypervisorType()).thenReturn(HypervisorType.KVM); + + virtualMachineManagerImpl.updateStartCommandWithExternalDetails(host, vmTO, command); + + verify(command, never()).setExternalDetails(any()); + } + + @Test + public void updateStartCommandWithExternalDetails_externalHypervisor_setsExternalDetails() { + Host host = mock(Host.class); + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + StartCommand command = mock(StartCommand.class); + NicTO nic = mock(NicTO.class); + + when(host.getHypervisorType()).thenReturn(HypervisorType.External); + when(vmTO.getExternalDetails()).thenReturn(new HashMap<>()); + when(vmTO.getNics()).thenReturn(new NicTO[]{nic}); + when(nic.isDefaultNic()).thenReturn(true); + when(networkService.getNicVlanValueForExternalVm(nic)).thenReturn("segmentName"); + when(extensionsManager.getExternalAccessDetails(eq(host), any())).thenReturn(new HashMap<>()); + + virtualMachineManagerImpl.updateStartCommandWithExternalDetails(host, vmTO, command); + + verify(command).setExternalDetails(any()); + } + + @Test + public void updateStopCommandForExternalHypervisorType_nonExternalHypervisor_noAction() { + VirtualMachineProfile vmProfile = mock(VirtualMachineProfile.class); + StopCommand stopCommand = mock(StopCommand.class); + + virtualMachineManagerImpl.updateStopCommandForExternalHypervisorType(HypervisorType.KVM, vmProfile, stopCommand); + + verify(stopCommand, never()).setExternalDetails(any()); + } + + @Test + public void updateStopCommandForExternalHypervisorType_externalHypervisor_setsExternalDetails() { + VirtualMachineProfile vmProfile = mock(VirtualMachineProfile.class); + StopCommand stopCommand = mock(StopCommand.class); + HostVO host = mock(HostVO.class); + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + when(vmProfile.getHostId()).thenReturn(1L); + when(hostDaoMock.findById(1L)).thenReturn(host); + when(stopCommand.getVirtualMachine()).thenReturn(vmTO); + when(vmTO.getExternalDetails()).thenReturn(new HashMap<>()); + when(extensionsManager.getExternalAccessDetails(eq(host), any())).thenReturn(new HashMap<>()); + doReturn(mock(VirtualMachineTO.class)).when(virtualMachineManagerImpl).toVmTO(any()); + virtualMachineManagerImpl.updateStopCommandForExternalHypervisorType(HypervisorType.External, vmProfile, stopCommand); + verify(stopCommand).setExternalDetails(any()); + } + + @Test + public void updateRebootCommandWithExternalDetails_nonExternalHypervisor_noAction() { + Host host = mock(Host.class); + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + RebootCommand rebootCmd = mock(RebootCommand.class); + when(host.getHypervisorType()).thenReturn(HypervisorType.KVM); + virtualMachineManagerImpl.updateRebootCommandWithExternalDetails(host, vmTO, rebootCmd); + verify(rebootCmd, never()).setExternalDetails(any()); + } + + @Test + public void updateRebootCommandWithExternalDetails_externalHypervisor_setsExternalDetails() { + Host host = mock(Host.class); + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + RebootCommand rebootCmd = mock(RebootCommand.class); + when(host.getHypervisorType()).thenReturn(HypervisorType.External); + when(vmTO.getExternalDetails()).thenReturn(new HashMap<>()); + when(extensionsManager.getExternalAccessDetails(eq(host), any())).thenReturn(new HashMap<>()); + virtualMachineManagerImpl.updateRebootCommandWithExternalDetails(host, vmTO, rebootCmd); + verify(rebootCmd).setExternalDetails(any()); + } + + @Test + public void updateExternalVmDetailsFromPrepareAnswer_nullDetails_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + UserVmVO userVmVO = mock(UserVmVO.class); + virtualMachineManagerImpl.updateExternalVmDetailsFromPrepareAnswer(vmTO, userVmVO, null); + verify(vmTO, never()).setDetails(any()); + verify(userVmVO, never()).setDetails(any()); + verify(userVmDaoMock, never()).saveDetails(any()); + } + + @Test + public void updateExternalVmDetailsFromPrepareAnswer_sameDetails_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + UserVmVO userVmVO = mock(UserVmVO.class); + Map details = new HashMap<>(); + when(vmTO.getDetails()).thenReturn(details); + virtualMachineManagerImpl.updateExternalVmDetailsFromPrepareAnswer(vmTO, userVmVO, details); + verify(vmTO, never()).setDetails(any()); + verify(userVmVO, never()).setDetails(any()); + verify(userVmDaoMock, never()).saveDetails(any()); + } + + @Test + public void updateExternalVmDataFromPrepareAnswer_vncPasswordUpdated_updatesPassword() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + UserVmVO userVmVO = mock(UserVmVO.class); + when(updatedTO.getVncPassword()).thenReturn("newPassword"); + when(vmTO.getVncPassword()).thenReturn("oldPassword"); + when(userVmDaoMock.findById(anyLong())).thenReturn(userVmVO); + virtualMachineManagerImpl.updateExternalVmDataFromPrepareAnswer(vmTO, updatedTO); + verify(userVmVO).setVncPassword("newPassword"); + verify(vmTO).setVncPassword("newPassword"); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_nullNics_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + when(vmTO.getNics()).thenReturn(null); + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + verify(_nicsDao, never()).findByUuid(anyString()); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_updatesNicsSuccessfully() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + NicTO nicTO = mock(NicTO.class); + NicTO updatedNicTO = mock(NicTO.class); + + when(vmTO.getNics()).thenReturn(new NicTO[]{nicTO}); + when(updatedTO.getNics()).thenReturn(new NicTO[]{updatedNicTO}); + when(nicTO.getNicUuid()).thenReturn("nic-uuid"); + when(nicTO.getMac()).thenReturn("mac-a"); + when(updatedNicTO.getNicUuid()).thenReturn("nic-uuid"); + when(updatedNicTO.getMac()).thenReturn("mac-b"); + when(_nicsDao.findByUuid("nic-uuid")).thenReturn(mock(NicVO.class)); + + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + + verify(_nicsDao).findByUuid("nic-uuid"); + verify(_nicsDao).update(anyLong(), any(NicVO.class)); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_noMatchingNicUuid_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + NicTO nicTO = mock(NicTO.class); + NicTO updatedNicTO = mock(NicTO.class); + + when(vmTO.getNics()).thenReturn(new NicTO[]{nicTO}); + when(updatedTO.getNics()).thenReturn(new NicTO[]{updatedNicTO}); + when(nicTO.getNicUuid()).thenReturn("nic-uuid"); + when(updatedNicTO.getNicUuid()).thenReturn("different-uuid"); + + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + + verify(_nicsDao, never()).findByUuid(anyString()); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_nullUpdatedNics_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + + when(vmTO.getNics()).thenReturn(new NicTO[]{mock(NicTO.class)}); + when(updatedTO.getNics()).thenReturn(null); + + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + + verify(_nicsDao, never()).findByUuid(anyString()); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_nullVmNics_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + + when(vmTO.getNics()).thenReturn(null); + when(updatedTO.getNics()).thenReturn(new NicTO[]{mock(NicTO.class)}); + + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + + verify(_nicsDao, never()).findByUuid(anyString()); + } + + @Test + public void updateExternalVmNicsFromPrepareAnswer_emptyNics_noAction() { + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + VirtualMachineTO updatedTO = mock(VirtualMachineTO.class); + + when(vmTO.getNics()).thenReturn(new NicTO[]{}); + when(updatedTO.getNics()).thenReturn(new NicTO[]{}); + + virtualMachineManagerImpl.updateExternalVmNicsFromPrepareAnswer(vmTO, updatedTO); + + verify(_nicsDao, never()).findByUuid(anyString()); + } + + @Test + public void processPrepareExternalProvisioning_nonExternalHypervisor_noAction() throws OperationTimedoutException, AgentUnavailableException { + Host host = mock(Host.class); + VirtualMachineProfile vmProfile = mock(VirtualMachineProfile.class); + VirtualMachineTemplate template = mock(VirtualMachineTemplate.class); + when(vmProfile.getTemplate()).thenReturn(template); + when(host.getHypervisorType()).thenReturn(HypervisorType.KVM); + virtualMachineManagerImpl.processPrepareExternalProvisioning(true, host, vmProfile, mock(DataCenter.class)); + verify(agentManagerMock, never()).send(anyLong(), any(Command.class)); + } + + @Test + public void processPrepareExternalProvisioning_externalHypervisor_sendsCommand() throws OperationTimedoutException, AgentUnavailableException { + Host host = mock(Host.class); + VirtualMachineProfile vmProfile = mock(VirtualMachineProfile.class); + VirtualMachineTemplate template = mock(VirtualMachineTemplate.class); + when(vmProfile.getTemplate()).thenReturn(template); + NicTO[] nics = new NicTO[]{mock(NicTO.class)}; + VirtualMachineTO vmTO = mock(VirtualMachineTO.class); + when(vmTO.getNics()).thenReturn(nics); + doReturn(vmTO).when(virtualMachineManagerImpl).toVmTO(vmProfile); + ExtensionDetailsVO detailsVO = mock(ExtensionDetailsVO.class); + when(host.getHypervisorType()).thenReturn(HypervisorType.External); + when(template.getExtensionId()).thenReturn(1L); + when(extensionDetailsDao.findDetail(eq(1L), eq(ApiConstants.ORCHESTRATOR_REQUIRES_PREPARE_VM))).thenReturn(detailsVO); + when(detailsVO.getValue()).thenReturn("true"); + PrepareExternalProvisioningAnswer answer = mock(PrepareExternalProvisioningAnswer.class); + when(answer.getResult()).thenReturn(true); + when(answer.getVirtualMachineTO()).thenReturn(vmTO); + when(agentManagerMock.send(anyLong(), any(Command.class))).thenReturn(answer); + virtualMachineManagerImpl.processPrepareExternalProvisioning(true, host, vmProfile, mock(DataCenter.class)); + verify(agentManagerMock).send(anyLong(), any(Command.class)); + } + + @Test + public void testPrepVMSpecForUnmanageInstance() { + // Arrange + final Long accountId = 1L; + final Long offeringId = 1L; + final Long templateId = 1L; + + // Mock vm + VMInstanceVO vm = Mockito.mock(VMInstanceVO.class); + when(vm.getId()).thenReturn(vmInstanceVoMockId); + when(vm.getAccountId()).thenReturn(accountId); + when(vm.getServiceOfferingId()).thenReturn(offeringId); + when(vm.getTemplateId()).thenReturn(templateId); + when(vm.getHypervisorType()).thenReturn(HypervisorType.KVM); + when(vmInstanceDaoMock.findById(vmInstanceVoMockId)).thenReturn(vm); + + // Mock owner + AccountVO owner = Mockito.mock(AccountVO.class); + when(_entityMgr.findById(Account.class, accountId)).thenReturn(owner); + + ServiceOfferingVO offering = Mockito.mock(ServiceOfferingVO.class); + when(serviceOfferingDaoMock.findById(vmInstanceVoMockId, offeringId)).thenReturn(offering); + + VMTemplateVO template = Mockito.mock(VMTemplateVO.class); + when(_entityMgr.findByIdIncludingRemoved(VirtualMachineTemplate.class, templateId)).thenReturn(template); + + when(hostMock.getClusterId()).thenReturn(clusterMockId); + + // Mock cpuOvercommitRatio and ramOvercommitRatio + ClusterDetailsVO cpuOvercommitRatio = Mockito.mock(ClusterDetailsVO.class); + when(cpuOvercommitRatio.getValue()).thenReturn("1.0"); + when(_clusterDetailsDao.findDetail(clusterMockId, VmDetailConstants.CPU_OVER_COMMIT_RATIO)).thenReturn(cpuOvercommitRatio); + ClusterDetailsVO ramOvercommitRatio = Mockito.mock(ClusterDetailsVO.class); + when(ramOvercommitRatio.getValue()).thenReturn("1.0"); + when(_clusterDetailsDao.findDetail(clusterMockId, VmDetailConstants.MEMORY_OVER_COMMIT_RATIO)).thenReturn(ramOvercommitRatio); + + // Mock NICs + List nics = new ArrayList<>(); + NicVO nic1 = Mockito.mock(NicVO.class); + when(nic1.getDeviceId()).thenReturn(1); + nics.add(nic1); + NicVO nic2 = Mockito.mock(NicVO.class); + when(nic2.getDeviceId()).thenReturn(0); + nics.add(nic2); + when(_nicsDao.listByVmId(vmInstanceVoMockId)).thenReturn(nics); + + Network networkMock = Mockito.mock(Network.class); + when(networkModel.getNetwork(anyLong())).thenReturn(networkMock); + + when(volumeVoMock.getVolumeType()).thenReturn(Volume.Type.ROOT); + when(volumeVoMock.getDeviceId()).thenReturn(0L); + when(volumeVoMock.getPath()).thenReturn("/"); + when(volumeVoMock.getDiskOfferingId()).thenReturn(1L); + when(volumeDaoMock.findUsableVolumesForInstance(vmInstanceVoMockId)).thenReturn(List.of(volumeVoMock)); + + VolumeInfo volumeInfo = mock(VolumeInfo.class); + DataTO dataTO = mock(DataTO.class); + when(volumeInfo.getTO()).thenReturn(dataTO); + when(volumeDataFactoryMock.getVolume(anyLong())).thenReturn(volumeInfo); + when(storageManager.getDiskWithThrottling(any(), any(), anyLong(), anyString(), anyLong(), anyLong())).thenReturn(Mockito.mock(DiskTO.class)); + + Map details = new HashMap<>(); + details.put(VirtualMachineProfile.Param.BootType.getName(), "BIOS"); + details.put(VirtualMachineProfile.Param.BootMode.getName(), "LEGACY"); + details.put(VirtualMachineProfile.Param.UefiFlag.getName(), "Yes"); + when(vmInstanceDetailsDao.listDetailsKeyPairs(anyLong(), anyList())).thenReturn(details); + + com.cloud.hypervisor.HypervisorGuru guru = Mockito.mock(com.cloud.hypervisor.HypervisorGuru.class); + when(_hvGuruMgr.getGuru(HypervisorType.KVM)).thenReturn(guru); + VirtualMachineTO vmTO = new VirtualMachineTO() {}; + when(guru.implement(any(VirtualMachineProfile.class))).thenAnswer((Answer) invocation -> { + VirtualMachineProfile profile = invocation.getArgument(0); + assertEquals("BIOS", profile.getParameter(VirtualMachineProfile.Param.BootType)); + return vmTO; + }); + + // Act + VirtualMachineTO result = virtualMachineManagerImpl.prepVmSpecForUnmanageCmd(vmInstanceVoMockId, hostMockId); + + // Assert + assertNotNull(result); + assertEquals(vmTO, result); + verify(_clusterDetailsDao, times(2)).findDetail(eq(clusterMockId), anyString()); + verify(vmInstanceDetailsDao).listDetailsKeyPairs(anyLong(), anyList()); + } + + @Test + public void testPersistDomainForKvmForRunningVmSuccess() throws AgentUnavailableException, OperationTimedoutException { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Running); + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + UnmanageInstanceAnswer successAnswer = new UnmanageInstanceAnswer(null, true, "success"); + when(agentManagerMock.send(anyLong(), any(Command.class))).thenReturn(successAnswer); + virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null); + ArgumentCaptor hostIdCaptor = ArgumentCaptor.forClass(Long.class); + ArgumentCaptor commandCaptor = ArgumentCaptor.forClass(UnmanageInstanceCommand.class); + verify(agentManagerMock).send(hostIdCaptor.capture(), commandCaptor.capture()); + assertEquals(hostMockId, hostIdCaptor.getValue().longValue()); + } + + @Test + public void testPersistDomainForKvmForStoppedVmSuccess() throws AgentUnavailableException, OperationTimedoutException { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Stopped); + VirtualMachineTO vmTO = new VirtualMachineTO() {}; + vmTO.setName(vmName); + doReturn(vmTO).when(virtualMachineManagerImpl).prepVmSpecForUnmanageCmd(vmInstanceVoMockId, 1L); + UnmanageInstanceAnswer successAnswer = new UnmanageInstanceAnswer(null, true, "success"); + when(agentManagerMock.send(anyLong(), any(UnmanageInstanceCommand.class))).thenReturn(successAnswer); + when(virtualMachineManagerImpl.findClusterAndHostIdForVm(vmInstanceMock, false)).thenReturn(new Pair<>(clusterMockId, hostMockId)); + virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null); + ArgumentCaptor hostIdCaptor = ArgumentCaptor.forClass(Long.class); + ArgumentCaptor commandCaptor = ArgumentCaptor.forClass(UnmanageInstanceCommand.class); + verify(agentManagerMock).send(hostIdCaptor.capture(), commandCaptor.capture()); + assertEquals(1L, hostIdCaptor.getValue().longValue()); + UnmanageInstanceCommand sentCommand = commandCaptor.getValue(); + assertNotNull(sentCommand.getVm()); + assertEquals(vmTO, sentCommand.getVm()); + assertEquals(vmName, sentCommand.getInstanceName()); + verify(virtualMachineManagerImpl).prepVmSpecForUnmanageCmd(vmInstanceVoMockId, 1L); + } + + + @Test + public void testPersistDomainForKvmForStoppedVmNoHost() { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Stopped); + VirtualMachineTO vmTO = new VirtualMachineTO() {}; + vmTO.setName(vmName); + when(virtualMachineManagerImpl.findClusterAndHostIdForVm(vmInstanceMock, false)).thenReturn(new Pair<>(clusterMockId, null)); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, () -> virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null)); + assertEquals("No available host to persist domain XML for Instance: " + vmName, exception.getMessage()); + } + + @Test + public void testPersistDomainForKvmForRunningVmAgentFailure() throws AgentUnavailableException, OperationTimedoutException { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Running); + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + UnmanageInstanceAnswer failureAnswer = new UnmanageInstanceAnswer(null, false, "failure"); + when(agentManagerMock.send(anyLong(), any(UnmanageInstanceCommand.class))).thenReturn(failureAnswer); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, () -> virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null)); + assertEquals("Failed to persist domain XML for Instance: " + vmName + " on host ID: " + hostMockId, exception.getMessage()); + } + + @Test + public void testPersistDomainForKvmAgentUnavailable() throws AgentUnavailableException, OperationTimedoutException { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Running); + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + doThrow(new AgentUnavailableException("Agent down", hostMockId)).when(agentManagerMock).send(anyLong(), any(UnmanageInstanceCommand.class)); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, () -> virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null)); + assertEquals("Failed to send command to persist domain XML for Instance: " + vmName + " on host ID: " + hostMockId, exception.getMessage()); + } + + @Test(expected = ConcurrentOperationException.class) + public void testUnmanagePendingHaWork() { + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + when(_workJobDao.listPendingWorkJobs(VirtualMachine.Type.Instance, vmInstanceVoMockId)).thenReturn(Collections.emptyList()); + when(_haMgr.hasPendingHaWork(vmInstanceVoMockId)).thenReturn(true); + virtualMachineManagerImpl.unmanage(vmMockUuid, null); + } + + @Test + public void testPersistDomainForKvmOperationTimedOut() throws AgentUnavailableException, OperationTimedoutException { + when(vmInstanceMock.getState()).thenReturn(VirtualMachine.State.Running); + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + doThrow(new OperationTimedoutException(null, hostMockId, 123L, 60, false)).when(agentManagerMock).send(anyLong(), any(UnmanageInstanceCommand.class)); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, () -> virtualMachineManagerImpl.persistDomainForKVM(vmInstanceMock, null)); + assertEquals("Failed to send command to persist domain XML for Instance: " + vmName + " on host ID: " + hostMockId, exception.getMessage()); + } + + @Test(expected = CloudRuntimeException.class) + public void testUnmanageVmRemoved() { + when(vmInstanceMock.getRemoved()).thenReturn(new Date()); + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + virtualMachineManagerImpl.unmanage(vmMockUuid, null); + } + + @Test(expected = ConcurrentOperationException.class) + public void testUnmanagePendingWorkJobs() { + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + List pendingJobs = new ArrayList<>(); + VmWorkJobVO vmWorkJobVO = mock(VmWorkJobVO.class); + pendingJobs.add(vmWorkJobVO); + when(_workJobDao.listPendingWorkJobs(VirtualMachine.Type.Instance, vmInstanceVoMockId)).thenReturn(pendingJobs); + virtualMachineManagerImpl.unmanage(vmMockUuid, null); + } + + @Test + public void testUnmanageHostNotFoundAfterTransaction() { + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + when(_workJobDao.listPendingWorkJobs(any(), anyLong())).thenReturn(Collections.emptyList()); + when(_haMgr.hasPendingHaWork(anyLong())).thenReturn(false); + doReturn(guru).when(virtualMachineManagerImpl).getVmGuru(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMSnapshots(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMNics(any(VirtualMachineProfile.class), any(VMInstanceVO.class)); + doNothing().when(virtualMachineManagerImpl).unmanageVMVolumes(vmInstanceMock); + doNothing().when(guru).finalizeUnmanage(vmInstanceMock); + try (MockedStatic ignored = Mockito.mockStatic(ApiDBUtils.class)) { + when(ApiDBUtils.findHostById(hostMockId)).thenReturn(null); + Pair result = virtualMachineManagerImpl.unmanage(vmMockUuid, null); + assertNull(result.second()); + } + } + + @Test + public void testUnmanageSuccessNonKvm() { + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + when(hostMock.getUuid()).thenReturn(hostUuid); + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + when(_workJobDao.listPendingWorkJobs(any(), anyLong())).thenReturn(Collections.emptyList()); + when(_haMgr.hasPendingHaWork(anyLong())).thenReturn(false); + doReturn(guru).when(virtualMachineManagerImpl).getVmGuru(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMSnapshots(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMNics(any(VirtualMachineProfile.class), any(VMInstanceVO.class)); + doNothing().when(virtualMachineManagerImpl).unmanageVMVolumes(vmInstanceMock); + doNothing().when(guru).finalizeUnmanage(vmInstanceMock); + try (MockedStatic ignored = Mockito.mockStatic(ApiDBUtils.class)) { + when(ApiDBUtils.findHostById(hostMockId)).thenReturn(hostMock); + try (MockedStatic actionUtil = Mockito.mockStatic(ActionEventUtils.class)) { + actionUtil.when(() -> ActionEventUtils.onActionEvent( + anyLong(), anyLong(), anyLong(), + anyString(), anyString(), + anyLong(), anyString() + )).thenReturn(1L); + + Pair result = virtualMachineManagerImpl.unmanage(vmMockUuid, null); + assertNotNull(result); + assertTrue(result.first()); + assertEquals(hostUuid, result.second()); + + verify(virtualMachineManagerImpl, never()).persistDomainForKVM(any(VMInstanceVO.class), anyLong()); + verify(virtualMachineManagerImpl, times(1)).unmanageVMSnapshots(vmInstanceMock); + verify(virtualMachineManagerImpl, times(1)).unmanageVMNics(any(VirtualMachineProfile.class), any(VMInstanceVO.class)); + verify(virtualMachineManagerImpl, times(1)).unmanageVMVolumes(vmInstanceMock); + verify(guru, times(1)).finalizeUnmanage(vmInstanceMock); + } + } + } + + @Test + public void testUnmanageSuccessKvm() throws Exception { + when(vmInstanceMock.getHostId()).thenReturn(hostMockId); + when(hostMock.getUuid()).thenReturn(hostUuid); + when(vmInstanceMock.getHypervisorType()).thenReturn(HypervisorType.KVM); + when(vmInstanceDaoMock.findByUuid(vmMockUuid)).thenReturn(vmInstanceMock); + when(_workJobDao.listPendingWorkJobs(any(), anyLong())).thenReturn(Collections.emptyList()); + when(_haMgr.hasPendingHaWork(anyLong())).thenReturn(false); + doReturn(guru).when(virtualMachineManagerImpl).getVmGuru(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMSnapshots(vmInstanceMock); + doNothing().when(virtualMachineManagerImpl).unmanageVMNics(any(VirtualMachineProfile.class), any(VMInstanceVO.class)); + doNothing().when(virtualMachineManagerImpl).unmanageVMVolumes(vmInstanceMock); + doNothing().when(guru).finalizeUnmanage(vmInstanceMock); + try (MockedStatic ignored = Mockito.mockStatic(ApiDBUtils.class)) { + when(ApiDBUtils.findHostById(hostMockId)).thenReturn(hostMock); + try (MockedStatic actionUtil = Mockito.mockStatic(ActionEventUtils.class)) { + actionUtil.when(() -> ActionEventUtils.onActionEvent( + anyLong(), anyLong(), anyLong(), + anyString(), anyString(), + anyLong(), anyString() + )).thenReturn(1L); + UnmanageInstanceAnswer successAnswer = new UnmanageInstanceAnswer(null, true, "success"); + when(agentManagerMock.send(anyLong(), any(UnmanageInstanceCommand.class))).thenReturn(successAnswer); + Pair result = virtualMachineManagerImpl.unmanage(vmMockUuid, null); + assertNotNull(result); + assertTrue(result.first()); + assertEquals(hostUuid, result.second()); + verify(virtualMachineManagerImpl, times(1)).persistDomainForKVM(vmInstanceMock, null); + verify(virtualMachineManagerImpl, times(1)).unmanageVMSnapshots(vmInstanceMock); + verify(virtualMachineManagerImpl, times(1)).unmanageVMNics(any(VirtualMachineProfile.class), any(VMInstanceVO.class)); + verify(virtualMachineManagerImpl, times(1)).unmanageVMVolumes(vmInstanceMock); + verify(guru, times(1)).finalizeUnmanage(vmInstanceMock); + } + } + } + } diff --git a/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtilityTest.java b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtilityTest.java new file mode 100644 index 000000000000..acd98e1cbffb --- /dev/null +++ b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/DataMigrationUtilityTest.java @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.engine.orchestration; + +import com.cloud.hypervisor.Hypervisor; +import com.cloud.storage.VMTemplateVO; +import junit.framework.TestCase; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class DataMigrationUtilityTest extends TestCase { + + @Spy + private DataMigrationUtility dataMigrationUtility; + + @Mock + private VMTemplateVO templateVoMock; + + @Mock + private TemplateDataStoreVO templateDataStoreVoMock; + + private void prepareForShouldMigrateTemplateTests() { + Mockito.when(templateDataStoreVoMock.getState()).thenReturn(ObjectInDataStoreStateMachine.State.Ready); + Mockito.when(templateVoMock.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + Mockito.when(templateVoMock.getParentTemplateId()).thenReturn(null); + } + + @Test + public void shouldMigrateTemplateTestReturnsFalseWhenTemplateIsNotReady() { + prepareForShouldMigrateTemplateTests(); + Mockito.when(templateDataStoreVoMock.getState()).thenReturn(ObjectInDataStoreStateMachine.State.Migrating); + + boolean result = dataMigrationUtility.shouldMigrateTemplate(templateDataStoreVoMock, templateVoMock); + + Assert.assertFalse(result); + } + + @Test + public void shouldMigrateTemplateTestReturnsFalseWhenHypervisorTypeIsSimulator() { + prepareForShouldMigrateTemplateTests(); + Mockito.when(templateVoMock.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.Simulator); + + boolean result = dataMigrationUtility.shouldMigrateTemplate(templateDataStoreVoMock, templateVoMock); + + Assert.assertFalse(result); + } + + @Test + public void shouldMigrateTemplateTestReturnsFalseWhenTemplateHasParentTemplate() { + prepareForShouldMigrateTemplateTests(); + Mockito.when(templateVoMock.getParentTemplateId()).thenReturn(1L); + + boolean result = dataMigrationUtility.shouldMigrateTemplate(templateDataStoreVoMock, templateVoMock); + + Assert.assertFalse(result); + } + + @Test + public void shouldMigrateTemplateTestReturnsTrueWhenTemplateIsReadyAndDoesNotHaveParentTemplateAndHypervisorTypeIsNotSimulator() { + prepareForShouldMigrateTemplateTests(); + + boolean result = dataMigrationUtility.shouldMigrateTemplate(templateDataStoreVoMock, templateVoMock); + + Assert.assertTrue(result); + } +} diff --git a/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java index 58746a9a6cf2..e3989737112d 100644 --- a/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java +++ b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestratorTest.java @@ -396,6 +396,7 @@ private void configureTestConfigureNicProfileBasedOnRequestedIpTests(NicProfile when(testOrchestrator._ipAddressDao.acquireInLockTable(Mockito.anyLong())).thenReturn(ipVoSpy); when(testOrchestrator._ipAddressDao.update(Mockito.anyLong(), Mockito.any(IPAddressVO.class))).thenReturn(true); when(testOrchestrator._ipAddressDao.releaseFromLockTable(Mockito.anyLong())).thenReturn(true); + when(testOrchestrator._networkModel.isMACUnique(Mockito.anyString(), Mockito.anyLong())).thenReturn(true); try { when(testOrchestrator._networkModel.getNextAvailableMacAddressInNetwork(Mockito.anyLong())).thenReturn(macAddress); } catch (InsufficientAddressCapacityException e) { @@ -822,7 +823,7 @@ public void testGetGuestIpForNicImportBasicZoneManualIP() { Mockito.when(network.getId()).thenReturn(networkId); Mockito.when(dataCenter.getId()).thenReturn(dataCenterId); Mockito.when(ipAddresses.getIp4Address()).thenReturn(requestedIp); - Mockito.when(testOrchestrator._ipAddressDao.findByIp(requestedIp)).thenReturn(ipAddressVO); + Mockito.when(testOrchestrator._ipAddressDao.findByIpAndSourceNetworkId(networkId, requestedIp)).thenReturn(ipAddressVO); String ipAddress = testOrchestrator.getSelectedIpForNicImport(network, dataCenter, ipAddresses); Assert.assertEquals(requestedIp, ipAddress); } @@ -891,7 +892,7 @@ public void testShutdownNetworkInImplementingState() { boolean shutdownNetworkStatus = testOrchestrator.shutdownNetwork(networkId, reservationContext, false); Assert.assertFalse(shutdownNetworkStatus); - verify(network, times(3)).getState(); + verify(network).getState(); verify(testOrchestrator._networksDao, times(1)).acquireInLockTable(networkId, NetworkLockTimeout.value()); verify(testOrchestrator._networksDao, times(1)).releaseFromLockTable(networkId); } diff --git a/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestratorTest.java b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestratorTest.java index a37845c86c2f..b4a26c17e2e5 100644 --- a/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestratorTest.java +++ b/engine/orchestration/src/test/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestratorTest.java @@ -18,13 +18,32 @@ import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.Set; +import java.lang.reflect.Field; +import com.cloud.configuration.Resource; +import com.cloud.deploy.DeploymentClusterPlanner; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.StorageAccessException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; import com.cloud.hypervisor.Hypervisor; import com.cloud.offering.DiskOffering; +import com.cloud.storage.ScopeType; +import com.cloud.storage.DataStoreRole; import com.cloud.storage.Storage; import com.cloud.storage.Volume; +import com.cloud.storage.Volume.Type; +import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.VolumeDao; import com.cloud.user.Account; +import com.cloud.user.ResourceLimitService; +import com.cloud.uservm.UserVm; +import com.cloud.utils.db.EntityManager; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.VirtualMachine; +import com.cloud.utils.Pair; import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore; @@ -32,6 +51,17 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; +import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO; +import org.apache.cloudstack.framework.config.ConfigDepot; +import org.apache.cloudstack.framework.config.ConfigKey; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.cloudstack.secret.PassphraseVO; +import org.apache.cloudstack.secret.dao.PassphraseDao; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.commons.lang3.ObjectUtils; import org.junit.Assert; import org.junit.Before; @@ -45,14 +75,9 @@ import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; -import com.cloud.configuration.Resource; -import com.cloud.exception.StorageAccessException; -import com.cloud.host.Host; -import com.cloud.host.HostVO; -import com.cloud.storage.VolumeVO; -import com.cloud.storage.Volume.Type; -import com.cloud.user.ResourceLimitService; -import com.cloud.utils.exception.CloudRuntimeException; +import static org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService.VolumeAllocationAlgorithm; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; @RunWith(MockitoJUnitRunner.class) public class VolumeOrchestratorTest { @@ -65,6 +90,24 @@ public class VolumeOrchestratorTest { protected VolumeDataFactory volumeDataFactory; @Mock protected VolumeDao volumeDao; + @Mock + protected PassphraseDao passphraseDao; + @Mock + protected PrimaryDataStoreDao storagePoolDao; + @Mock + protected EntityManager entityMgr; + @Mock + ConfigDepot configDepot; + @Mock + ConfigurationDao configurationDao; + + + @Mock + private SnapshotDataStoreDao snapshotDataStoreDaoMock; + + @Mock + private ImageStoreDao imageStoreDaoMock; + @Spy @InjectMocks @@ -72,6 +115,9 @@ public class VolumeOrchestratorTest { private static final Long DEFAULT_ACCOUNT_PS_RESOURCE_COUNT = 100L; private Long accountPSResourceCount; + private static final long MOCK_VM_ID = 202L; + private static final long MOCK_POOL_ID = 303L; + private static final String MOCK_VM_NAME = "Test-VM"; @Before public void setUp() throws Exception { @@ -195,7 +241,7 @@ public void testImportVolume() { volumeOrchestrator.importVolume(volumeType, name, diskOffering, sizeInBytes, null, null, zoneId, hypervisorType, null, null, owner, - deviceId, poolId, path, chainInfo); + deviceId, poolId, Storage.StoragePoolType.NetworkFilesystem, path, chainInfo); VolumeVO volume = volumeVOMockedConstructionConstruction.constructed().get(0); Mockito.verify(volume, Mockito.never()).setInstanceId(Mockito.anyLong()); @@ -208,4 +254,390 @@ public void testImportVolume() { Mockito.verify(volume, Mockito.times(1)).setChainInfo(chainInfo); Mockito.verify(volume, Mockito.times(1)).setState(Volume.State.Ready); } + + @Test + public void testAllocateDuplicateVolumeVOBasic() { + Volume oldVol = Mockito.mock(Volume.class); + Mockito.when(oldVol.getVolumeType()).thenReturn(Volume.Type.ROOT); + Mockito.when(oldVol.getName()).thenReturn("testVol"); + Mockito.when(oldVol.getDataCenterId()).thenReturn(1L); + Mockito.when(oldVol.getDomainId()).thenReturn(2L); + Mockito.when(oldVol.getAccountId()).thenReturn(3L); + Mockito.when(oldVol.getDiskOfferingId()).thenReturn(4L); + Mockito.when(oldVol.getProvisioningType()).thenReturn(Storage.ProvisioningType.THIN); + Mockito.when(oldVol.getSize()).thenReturn(10L); + Mockito.when(oldVol.getMinIops()).thenReturn(100L); + Mockito.when(oldVol.getMaxIops()).thenReturn(200L); + Mockito.when(oldVol.get_iScsiName()).thenReturn("iqn.test"); + Mockito.when(oldVol.getTemplateId()).thenReturn(5L); + Mockito.when(oldVol.getDeviceId()).thenReturn(1L); + Mockito.when(oldVol.getInstanceId()).thenReturn(6L); + Mockito.when(oldVol.isRecreatable()).thenReturn(false); + Mockito.when(oldVol.getFormat()).thenReturn(Storage.ImageFormat.QCOW2); + Mockito.when(oldVol.getPassphraseId()).thenReturn(null); // no encryption + + VolumeVO persistedVol = Mockito.mock(VolumeVO.class); + Mockito.when(volumeDao.persist(Mockito.any(VolumeVO.class))).thenReturn(persistedVol); + + VolumeVO result = volumeOrchestrator.allocateDuplicateVolumeVO(oldVol, null, null); + assertNotNull(result); + Mockito.verify(volumeDao, Mockito.times(1)).persist(Mockito.any(VolumeVO.class)); + } + + @Test + public void testAllocateDuplicateVolumeVOWithEncryption() { + Volume oldVol = Mockito.mock(Volume.class); + Mockito.when(oldVol.getVolumeType()).thenReturn(Volume.Type.ROOT); + Mockito.when(oldVol.getName()).thenReturn("secureVol"); + Mockito.when(oldVol.getDataCenterId()).thenReturn(1L); + Mockito.when(oldVol.getDomainId()).thenReturn(2L); + Mockito.when(oldVol.getAccountId()).thenReturn(3L); + Mockito.when(oldVol.getDiskOfferingId()).thenReturn(4L); + Mockito.when(oldVol.getProvisioningType()).thenReturn(Storage.ProvisioningType.THIN); + Mockito.when(oldVol.getSize()).thenReturn(10L); + Mockito.when(oldVol.getMinIops()).thenReturn(100L); + Mockito.when(oldVol.getMaxIops()).thenReturn(200L); + Mockito.when(oldVol.get_iScsiName()).thenReturn("iqn.secure"); + Mockito.when(oldVol.getTemplateId()).thenReturn(5L); + Mockito.when(oldVol.getDeviceId()).thenReturn(2L); + Mockito.when(oldVol.getInstanceId()).thenReturn(7L); + Mockito.when(oldVol.isRecreatable()).thenReturn(true); + Mockito.when(oldVol.getFormat()).thenReturn(Storage.ImageFormat.RAW); + Mockito.when(oldVol.getPassphraseId()).thenReturn(42L); + + PassphraseVO passphrase = Mockito.mock(PassphraseVO.class); + Mockito.when(passphrase.getId()).thenReturn(999L); + Mockito.when(passphraseDao.persist(Mockito.any())).thenReturn(passphrase); + + VolumeVO persistedVol = Mockito.mock(VolumeVO.class); + Mockito.when(volumeDao.persist(Mockito.any())).thenReturn(persistedVol); + + VolumeVO result = volumeOrchestrator.allocateDuplicateVolumeVO(oldVol, null, null); + assertNotNull(result); + Mockito.verify(passphraseDao).persist(Mockito.any(PassphraseVO.class)); + Mockito.verify(volumeDao).persist(Mockito.any()); + } + + @Test + public void testAllocateDuplicateVolumeVOWithTemplateOverride() { + Volume oldVol = Mockito.mock(Volume.class); + Mockito.when(oldVol.getVolumeType()).thenReturn(Volume.Type.ROOT); + Mockito.when(oldVol.getName()).thenReturn("tmplVol"); + Mockito.when(oldVol.getDataCenterId()).thenReturn(1L); + Mockito.when(oldVol.getDomainId()).thenReturn(2L); + Mockito.when(oldVol.getAccountId()).thenReturn(3L); + Mockito.when(oldVol.getDiskOfferingId()).thenReturn(4L); + Mockito.when(oldVol.getProvisioningType()).thenReturn(Storage.ProvisioningType.THIN); + Mockito.when(oldVol.getSize()).thenReturn(20L); + Mockito.when(oldVol.getMinIops()).thenReturn(50L); + Mockito.when(oldVol.getMaxIops()).thenReturn(250L); + Mockito.when(oldVol.get_iScsiName()).thenReturn("iqn.tmpl"); + + VolumeVO persistedVol = Mockito.mock(VolumeVO.class); + Mockito.when(volumeDao.persist(Mockito.any())).thenReturn(persistedVol); + + PassphraseVO mockPassPhrase = Mockito.mock(PassphraseVO.class); + Mockito.when(passphraseDao.persist(Mockito.any())).thenReturn(mockPassPhrase); + + VolumeVO result = volumeOrchestrator.allocateDuplicateVolumeVO(oldVol, null, 222L); + assertNotNull(result); + } + + @Test + public void testAllocateDuplicateVolumeVOEncryptionFromOldVolumeOnly() { + Volume oldVol = Mockito.mock(Volume.class); + Mockito.when(oldVol.getVolumeType()).thenReturn(Volume.Type.ROOT); + Mockito.when(oldVol.getName()).thenReturn("vol-old"); + Mockito.when(oldVol.getDataCenterId()).thenReturn(1L); + Mockito.when(oldVol.getDomainId()).thenReturn(2L); + Mockito.when(oldVol.getAccountId()).thenReturn(3L); + Mockito.when(oldVol.getDiskOfferingId()).thenReturn(4L); + Mockito.when(oldVol.getProvisioningType()).thenReturn(Storage.ProvisioningType.SPARSE); + Mockito.when(oldVol.getSize()).thenReturn(30L); + Mockito.when(oldVol.getMinIops()).thenReturn(10L); + Mockito.when(oldVol.getMaxIops()).thenReturn(500L); + Mockito.when(oldVol.get_iScsiName()).thenReturn("iqn.old"); + Mockito.when(oldVol.getTemplateId()).thenReturn(123L); + Mockito.when(oldVol.getDeviceId()).thenReturn(1L); + Mockito.when(oldVol.getInstanceId()).thenReturn(100L); + Mockito.when(oldVol.isRecreatable()).thenReturn(false); + Mockito.when(oldVol.getFormat()).thenReturn(Storage.ImageFormat.RAW); + + DiskOffering diskOffering = Mockito.mock(DiskOffering.class); + Mockito.when(diskOffering.getEncrypt()).thenReturn(false); // explicitly disables encryption + + VolumeVO persistedVol = Mockito.mock(VolumeVO.class); + Mockito.when(volumeDao.persist(Mockito.any())).thenReturn(persistedVol); + + VolumeVO result = volumeOrchestrator.allocateDuplicateVolumeVO(oldVol, diskOffering, null); + assertNotNull(result); + Mockito.verify(volumeDao).persist(Mockito.any()); + } + + @Test + public void testVolumeOnSharedStoragePoolTrue() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getPoolId()).thenReturn(MOCK_POOL_ID); + + StoragePoolVO pool = Mockito.mock(StoragePoolVO.class); + Mockito.when(pool.getScope()).thenReturn(ScopeType.CLUSTER); // Shared scope + Mockito.when(storagePoolDao.findById(MOCK_POOL_ID)).thenReturn(pool); + + assertTrue(volumeOrchestrator.volumeOnSharedStoragePool(volume)); + } + + @Test + public void testVolumeOnSharedStoragePoolFalseHostScope() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getPoolId()).thenReturn(MOCK_POOL_ID); + + StoragePoolVO pool = Mockito.mock(StoragePoolVO.class); + Mockito.when(pool.getScope()).thenReturn(ScopeType.HOST); // Local scope + Mockito.when(storagePoolDao.findById(MOCK_POOL_ID)).thenReturn(pool); + + Assert.assertFalse(volumeOrchestrator.volumeOnSharedStoragePool(volume)); + } + + @Test + public void testVolumeOnSharedStoragePoolFalseNoPool() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getPoolId()).thenReturn(null); // No pool associated + + Assert.assertFalse(volumeOrchestrator.volumeOnSharedStoragePool(volume)); + Mockito.verify(storagePoolDao, Mockito.never()).findById(Mockito.anyLong()); + } + + @Test + public void testVolumeOnSharedStoragePoolFalsePoolNotFound() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getPoolId()).thenReturn(MOCK_POOL_ID); + + Mockito.when(storagePoolDao.findById(MOCK_POOL_ID)).thenReturn(null); // Pool not found in DB + + Assert.assertFalse(volumeOrchestrator.volumeOnSharedStoragePool(volume)); + } + + + @Test + public void testVolumeInactiveNoVmId() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(null); + assertTrue(volumeOrchestrator.volumeInactive(volume)); + Mockito.verify(entityMgr, Mockito.never()).findById(Mockito.eq(UserVm.class), Mockito.anyLong()); + } + + @Test + public void testVolumeInactiveVmNotFound() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + Mockito.when(entityMgr.findById(UserVm.class, MOCK_VM_ID)).thenReturn(null); + assertTrue(volumeOrchestrator.volumeInactive(volume)); + } + + @Test + public void testVolumeInactiveVmStopped() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + UserVm vm = Mockito.mock(UserVm.class); + Mockito.when(vm.getState()).thenReturn(VirtualMachine.State.Stopped); + Mockito.when(entityMgr.findById(UserVm.class, MOCK_VM_ID)).thenReturn(vm); + assertTrue(volumeOrchestrator.volumeInactive(volume)); + } + + @Test + public void testVolumeInactiveVmDestroyed() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + UserVm vm = Mockito.mock(UserVm.class); + Mockito.when(vm.getState()).thenReturn(VirtualMachine.State.Destroyed); + Mockito.when(entityMgr.findById(UserVm.class, MOCK_VM_ID)).thenReturn(vm); + assertTrue(volumeOrchestrator.volumeInactive(volume)); + } + + @Test + public void testVolumeInactiveVmRunning() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + UserVm vm = Mockito.mock(UserVm.class); + Mockito.when(vm.getState()).thenReturn(VirtualMachine.State.Running); // Active state + Mockito.when(entityMgr.findById(UserVm.class, MOCK_VM_ID)).thenReturn(vm); + Assert.assertFalse(volumeOrchestrator.volumeInactive(volume)); + } + + @Test + public void testGetVmNameOnVolumeNoVmId() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(null); + Assert.assertNull(volumeOrchestrator.getVmNameOnVolume(volume)); + Mockito.verify(entityMgr, Mockito.never()).findById(Mockito.eq(VirtualMachine.class), Mockito.anyLong()); + } + + @Test + public void testGetVmNameOnVolumeVmNotFound() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + Mockito.when(entityMgr.findById(VirtualMachine.class, MOCK_VM_ID)).thenReturn(null); + Assert.assertNull(volumeOrchestrator.getVmNameOnVolume(volume)); + } + + @Test + public void testGetVmNameOnVolumeSuccess() { + VolumeVO volume = Mockito.mock(VolumeVO.class); + Mockito.when(volume.getInstanceId()).thenReturn(MOCK_VM_ID); + VirtualMachine vm = Mockito.mock(VirtualMachine.class); + Mockito.when(vm.getInstanceName()).thenReturn(MOCK_VM_NAME); + Mockito.when(entityMgr.findById(VirtualMachine.class, MOCK_VM_ID)).thenReturn(vm); + Assert.assertEquals(MOCK_VM_NAME, volumeOrchestrator.getVmNameOnVolume(volume)); + } + + @Test + public void testValidateVolumeSizeRangeValid() throws Exception { + overrideDefaultConfigValue(VolumeOrchestrator.MaxVolumeSize, "2000"); + assertTrue(volumeOrchestrator.validateVolumeSizeRange(1024 * 1024 * 1024)); // 1 GiB + assertTrue(volumeOrchestrator.validateVolumeSizeRange(2000 * 1024 * 1024 * 1024)); // 2 TiB + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateVolumeSizeRangeTooSmall() { + volumeOrchestrator.validateVolumeSizeRange(1024L); // Less than 1GiB + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateVolumeSizeRangeNegative() { + volumeOrchestrator.validateVolumeSizeRange(-10); // Negative size + } + + @Test(expected = InvalidParameterValueException.class) + public void testValidateVolumeSizeRangeTooLarge() throws Exception { + overrideDefaultConfigValue(VolumeOrchestrator.MaxVolumeSize, "100L"); + volumeOrchestrator.validateVolumeSizeRange(101); + } + + @Test + public void testCanVmRestartOnAnotherServerAllShared() { + VolumeVO vol1 = Mockito.mock(VolumeVO.class); + VolumeVO vol2 = Mockito.mock(VolumeVO.class); + Mockito.when(vol1.getPoolId()).thenReturn(10L); + Mockito.when(vol2.getPoolId()).thenReturn(20L); + Mockito.when(vol1.isRecreatable()).thenReturn(false); + Mockito.when(vol2.isRecreatable()).thenReturn(false); + + + StoragePoolVO pool1 = Mockito.mock(StoragePoolVO.class); + StoragePoolVO pool2 = Mockito.mock(StoragePoolVO.class); + Mockito.when(pool1.getPoolType()).thenReturn(Storage.StoragePoolType.NetworkFilesystem); // Shared + Mockito.when(pool2.getPoolType()).thenReturn(Storage.StoragePoolType.RBD); // Shared + + Mockito.when(volumeDao.findCreatedByInstance(MOCK_VM_ID)).thenReturn(List.of(vol1, vol2)); + Mockito.when(storagePoolDao.findById(10L)).thenReturn(pool1); + Mockito.when(storagePoolDao.findById(20L)).thenReturn(pool2); + + + assertTrue(volumeOrchestrator.canVmRestartOnAnotherServer(MOCK_VM_ID)); + } + + @Test + public void testCanVmRestartOnAnotherServerOneLocalNotRecreatable() { + VolumeVO vol1 = Mockito.mock(VolumeVO.class); + VolumeVO vol2 = Mockito.mock(VolumeVO.class); // Local, not recreatable + Mockito.when(vol1.getPoolId()).thenReturn(10L); + Mockito.when(vol2.getPoolId()).thenReturn(30L); + Mockito.when(vol1.isRecreatable()).thenReturn(false); + Mockito.when(vol2.isRecreatable()).thenReturn(false); // Not recreatable + + StoragePoolVO pool1 = Mockito.mock(StoragePoolVO.class); + StoragePoolVO pool2 = Mockito.mock(StoragePoolVO.class); + Mockito.when(pool1.getPoolType()).thenReturn(Storage.StoragePoolType.NetworkFilesystem); // Shared + Mockito.when(pool2.getPoolType()).thenReturn(Storage.StoragePoolType.LVM); // Local + + Mockito.when(volumeDao.findCreatedByInstance(MOCK_VM_ID)).thenReturn(List.of(vol1, vol2)); + Mockito.when(storagePoolDao.findById(10L)).thenReturn(pool1); + Mockito.when(storagePoolDao.findById(30L)).thenReturn(pool2); + + Assert.assertFalse("VM restart should be false if a non-recreatable local disk exists", + volumeOrchestrator.canVmRestartOnAnotherServer(MOCK_VM_ID)); + } + + @Test + public void testCanVmRestartOnAnotherServerOneLocalRecreatable() { + VolumeVO vol1 = Mockito.mock(VolumeVO.class); + VolumeVO vol2 = Mockito.mock(VolumeVO.class); // Local, but recreatable + Mockito.when(vol1.getPoolId()).thenReturn(10L); + Mockito.when(vol2.getPoolId()).thenReturn(30L); + Mockito.when(vol1.isRecreatable()).thenReturn(false); + Mockito.when(vol2.isRecreatable()).thenReturn(true); // Recreatable + + StoragePoolVO pool1 = Mockito.mock(StoragePoolVO.class); + StoragePoolVO pool2 = Mockito.mock(StoragePoolVO.class); + Mockito.when(pool1.getPoolType()).thenReturn(Storage.StoragePoolType.NetworkFilesystem); // Shared + + Mockito.when(volumeDao.findCreatedByInstance(MOCK_VM_ID)).thenReturn(List.of(vol1, vol2)); + Mockito.when(storagePoolDao.findById(10L)).thenReturn(pool1); + Mockito.when(storagePoolDao.findById(30L)).thenReturn(pool2); + + assertTrue("VM restart should be true if local disk is recreatable", + volumeOrchestrator.canVmRestartOnAnotherServer(MOCK_VM_ID)); + } + + private void overrideDefaultConfigValue(final ConfigKey configKey, final String value) throws IllegalAccessException, NoSuchFieldException { + final Field f = ConfigKey.class.getDeclaredField("_defaultValue"); + f.setAccessible(true); + f.set(configKey, value); + } + + @Test + public void testStart() throws Exception { + Mockito.when(configDepot.isNewConfig(VolumeAllocationAlgorithm)).thenReturn(true); + overrideDefaultConfigValue(DeploymentClusterPlanner.VmAllocationAlgorithm, "firstfit"); + Mockito.when(configurationDao.update(Mockito.anyString(), Mockito.anyString())).thenReturn(true); + volumeOrchestrator.start(); + } + + @Test + public void testConfigKeys() { + assertTrue(volumeOrchestrator.getConfigKeys().length > 0); + } + + @Test + public void getVolumeCheckpointPathsAndImageStoreUrlsTestReturnEmptyListsIfNotKVM() { + Pair, Set> result = volumeOrchestrator.getVolumeCheckpointPathsAndImageStoreUrls(0, Hypervisor.HypervisorType.VMware); + + Assert.assertTrue(result.first().isEmpty()); + Assert.assertTrue(result.second().isEmpty()); + } + + @Test + public void getVolumeCheckpointPathsAndImageStoreUrlsTestReturnCheckpointIfKVM() { + SnapshotDataStoreVO snapshotDataStoreVO = new SnapshotDataStoreVO(); + snapshotDataStoreVO.setKvmCheckpointPath("Test"); + snapshotDataStoreVO.setRole(DataStoreRole.Primary); + + Mockito.doReturn(List.of(snapshotDataStoreVO)).when(snapshotDataStoreDaoMock).listReadyByVolumeIdAndCheckpointPathNotNull(Mockito.anyLong()); + + Pair, Set> result = volumeOrchestrator.getVolumeCheckpointPathsAndImageStoreUrls(0, Hypervisor.HypervisorType.KVM); + + Assert.assertEquals("Test", result.first().get(0)); + Assert.assertTrue(result.second().isEmpty()); + } + + @Test + public void getVolumeCheckpointPathsAndImageStoreUrlsTestReturnCheckpointIfKVMAndImageStore() { + SnapshotDataStoreVO snapshotDataStoreVO = new SnapshotDataStoreVO(); + snapshotDataStoreVO.setKvmCheckpointPath("Test"); + snapshotDataStoreVO.setRole(DataStoreRole.Image); + snapshotDataStoreVO.setDataStoreId(13); + + Mockito.doReturn(List.of(snapshotDataStoreVO)).when(snapshotDataStoreDaoMock).listReadyByVolumeIdAndCheckpointPathNotNull(Mockito.anyLong()); + + ImageStoreVO imageStoreVO = new ImageStoreVO(); + imageStoreVO.setUrl("URL"); + Mockito.doReturn(imageStoreVO).when(imageStoreDaoMock).findById(Mockito.anyLong()); + + Pair, Set> result = volumeOrchestrator.getVolumeCheckpointPathsAndImageStoreUrls(0, Hypervisor.HypervisorType.KVM); + + Assert.assertEquals("Test", result.first().get(0)); + Assert.assertTrue(result.second().contains("URL")); + Assert.assertEquals(1, result.second().size()); + } + } diff --git a/engine/pom.xml b/engine/pom.xml index 1df7d84284f7..2de84eab85af 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml index 8238da848356..654cd14a25d3 100644 --- a/engine/schema/pom.xml +++ b/engine/schema/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloud-engine - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml @@ -106,7 +106,7 @@ templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-xen") templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-ovm") templateList.add("systemvmtemplate-${csVersion}.${patch}-x86_64-hyperv") - File file = new File("./engine/schema/dist/systemvm-templates/md5sum.txt") + File file = new File("./engine/schema/dist/systemvm-templates/sha512sum.txt") def lines = file.readLines() for (template in templateList) { def data = lines.findAll { it.contains(template) } @@ -135,7 +135,7 @@ wget - ${project.systemvm.template.location}/${cs.version}/md5sum.txt + ${project.systemvm.template.location}/${cs.version}/sha512sum.txt ${basedir}/dist/systemvm-templates/ true true @@ -165,6 +165,15 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + true + + +
    @@ -196,7 +205,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-kvm.qcow2.bz2 ${basedir}/dist/systemvm-templates/ - ${kvm.checksum} + ${kvm.checksum} @@ -232,7 +241,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-vmware.ova ${basedir}/dist/systemvm-templates/ - ${vmware.checksum} + ${vmware.checksum} @@ -268,7 +277,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-xen.vhd.bz2 ${basedir}/dist/systemvm-templates/ - ${xen.checksum} + ${xen.checksum} @@ -304,7 +313,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-ovm.raw.bz2 ${basedir}/dist/systemvm-templates/ - ${ovm.checksum} + ${ovm.checksum} @@ -340,7 +349,7 @@ true ${project.systemvm.template.location}/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-x86_64-hyperv.vhd.zip ${basedir}/dist/systemvm-templates/ - ${hyperv.checksum} + ${hyperv.checksum} diff --git a/engine/schema/src/main/java/com/cloud/capacity/CapacityVO.java b/engine/schema/src/main/java/com/cloud/capacity/CapacityVO.java index cd62935f17ee..fb2d61d8e11a 100644 --- a/engine/schema/src/main/java/com/cloud/capacity/CapacityVO.java +++ b/engine/schema/src/main/java/com/cloud/capacity/CapacityVO.java @@ -254,6 +254,8 @@ public String getUuid() { capacityNames.put(CAPACITY_TYPE_GPU, "GPU"); capacityNames.put(CAPACITY_TYPE_CPU_CORE, "CPU_CORE"); capacityNames.put(CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET, "VIRTUAL_NETWORK_IPV6_SUBNET"); + capacityNames.put(CAPACITY_TYPE_BACKUP_STORAGE, "BACKUP_STORAGE"); + capacityNames.put(CAPACITY_TYPE_OBJECT_STORAGE, "OBJECT_STORAGE"); } public static String getCapacityName (Short capacityType) { diff --git a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao.java b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao.java index 1bb79ce417aa..42313efa512f 100644 --- a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao.java +++ b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao.java @@ -30,7 +30,7 @@ public interface CapacityDao extends GenericDao { List listByHostIdTypes(Long hostId, List capacityTypes); - List listClustersInZoneOrPodByHostCapacities(long id, long vmId, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone); + List listClustersInZoneOrPodByHostCapacities(long id, long vmId, int requiredCpu, long requiredRam, boolean isZone); List listHostsWithEnoughCapacity(int requiredCpu, long requiredRam, Long clusterId, String hostType); @@ -48,7 +48,7 @@ public interface CapacityDao extends GenericDao { List findFilteredCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId, List hostIds, List poolIds); - List listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType); + List listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam); Pair, Map> orderPodsByAggregateCapacity(long zoneId, short capacityType); @@ -64,5 +64,11 @@ List listCapacitiesGroupedByLevelAndType(Integer capacityType, L float findClusterConsumption(Long clusterId, short capacityType, long computeRequested); - List orderHostsByFreeCapacity(Long zoneId, Long clusterId, short capacityType); + Pair, Map> orderHostsByFreeCapacity(Long zoneId, Long clusterId, short capacityType); + + List listHostCapacityByCapacityTypes(Long zoneId, Long clusterId, List capacityTypes); + + List listPodCapacityByCapacityTypes(Long zoneId, List capacityTypes); + + List listClusterCapacityByCapacityTypes(Long zoneId, Long podId, List capacityTypes); } diff --git a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java index 5e7eee4566c1..f65c3cf188cd 100644 --- a/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java @@ -204,15 +204,17 @@ public class CapacityDaoImpl extends GenericDaoBase implements "(CASE WHEN ISNULL(service_offering.speed) THEN custom_speed.value ELSE service_offering.speed end) AS speed, " + "(CASE WHEN ISNULL(service_offering.ram_size) THEN custom_ram_size.value ELSE service_offering.ram_size end) AS ram_size " + "FROM vm_instance vi LEFT JOIN service_offering ON(((vi.service_offering_id = service_offering.id))) " + - "LEFT JOIN user_vm_details custom_cpu ON(((custom_cpu.vm_id = vi.id) AND (custom_cpu.name = 'CpuNumber'))) " + - "LEFT JOIN user_vm_details custom_speed ON(((custom_speed.vm_id = vi.id) AND (custom_speed.name = 'CpuSpeed'))) " + - "LEFT JOIN user_vm_details custom_ram_size ON(((custom_ram_size.vm_id = vi.id) AND (custom_ram_size.name = 'memory'))) "; + "LEFT JOIN vm_instance_details custom_cpu ON(((custom_cpu.vm_id = vi.id) AND (custom_cpu.name = 'CpuNumber'))) " + + "LEFT JOIN vm_instance_details custom_speed ON(((custom_speed.vm_id = vi.id) AND (custom_speed.name = 'CpuSpeed'))) " + + "LEFT JOIN vm_instance_details custom_ram_size ON(((custom_ram_size.vm_id = vi.id) AND (custom_ram_size.name = 'memory'))) "; private static final String WHERE_STATE_IS_NOT_DESTRUCTIVE = "WHERE ISNULL(vi.removed) AND vi.state NOT IN ('Destroyed', 'Error', 'Expunging')"; private static final String LEFT_JOIN_VM_TEMPLATE = "LEFT JOIN vm_template ON vm_template.id = vi.vm_template_id "; + private static final String STORAGE_POOLS_WITH_CHILDREN = "SELECT DISTINCT parent FROM storage_pool WHERE parent != 0 AND removed IS NULL"; + public CapacityDaoImpl() { _hostIdTypeSearch = createSearchBuilder(); _hostIdTypeSearch.and("hostId", _hostIdTypeSearch.entity().getHostOrPoolId(), SearchCriteria.Op.EQ); @@ -379,6 +381,11 @@ public List listCapacitiesGroupedByLevelAndType(Integer capacity finalQuery.append(" AND capacity_type = ?"); resourceIdList.add(capacityType.longValue()); } + + // Exclude storage pools with children from capacity calculations to avoid double counting + finalQuery.append(" AND NOT (capacity.capacity_type = ").append(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) + .append(" AND capacity.host_id IN (").append(STORAGE_POOLS_WITH_CHILDREN).append("))"); + if (CollectionUtils.isNotEmpty(hostIds)) { finalQuery.append(String.format(" AND capacity.host_id IN (%s)", StringUtils.join(hostIds, ","))); if (capacityType == null) { @@ -541,6 +548,10 @@ public List findFilteredCapacityBy(Integer capacityType, Long zo StringBuilder sql = new StringBuilder(LIST_CAPACITY_GROUP_BY_CAPACITY_PART1); List resourceIdList = new ArrayList(); + // Exclude storage pools with children from capacity calculations to avoid double counting + sql.append(" AND NOT (capacity.capacity_type = ").append(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) + .append(" AND capacity.host_id IN (").append(STORAGE_POOLS_WITH_CHILDREN).append("))"); + if (zoneId != null) { sql.append(" AND capacity.data_center_id = ?"); resourceIdList.add(zoneId); @@ -684,7 +695,7 @@ public List listByHostIdTypes(Long hostId, List capacityTypes } @Override - public List listClustersInZoneOrPodByHostCapacities(long id, long vmId, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone) { + public List listClustersInZoneOrPodByHostCapacities(long id, long vmId, int requiredCpu, long requiredRam, boolean isZone) { TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; List result = new ArrayList(); @@ -1028,10 +1039,11 @@ public Pair, Map> orderClustersByAggregateCapacity(long } @Override - public List orderHostsByFreeCapacity(Long zoneId, Long clusterId, short capacityTypeForOrdering){ + public Pair, Map> orderHostsByFreeCapacity(Long zoneId, Long clusterId, short capacityTypeForOrdering){ TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; - List result = new ArrayList(); + List result = new ArrayList<>(); + Map hostCapacityMap = new HashMap<>(); StringBuilder sql = new StringBuilder(ORDER_HOSTS_BY_FREE_CAPACITY_PART1); if (zoneId != null) { sql.append(" AND data_center_id = ?"); @@ -1054,9 +1066,11 @@ public List orderHostsByFreeCapacity(Long zoneId, Long clusterId, short ca ResultSet rs = pstmt.executeQuery(); while (rs.next()) { - result.add(rs.getLong(1)); + Long hostId = rs.getLong(1); + result.add(hostId); + hostCapacityMap.put(hostId, rs.getDouble(2)); } - return result; + return new Pair<>(result, hostCapacityMap); } catch (SQLException e) { throw new CloudRuntimeException("DB Exception on: " + sql, e); } catch (Throwable e) { @@ -1065,7 +1079,65 @@ public List orderHostsByFreeCapacity(Long zoneId, Long clusterId, short ca } @Override - public List listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType) { + public List listHostCapacityByCapacityTypes(Long zoneId, Long clusterId, List capacityTypes) { + SearchBuilder sb = createSearchBuilder(); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ); + sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN); + sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ); + sb.done(); + + SearchCriteria sc = sb.create(); + sc.setParameters("capacityState", "Enabled"); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + if (clusterId != null) { + sc.setParameters("clusterId", clusterId); + } + sc.setParameters("capacityTypes", capacityTypes.toArray()); + return listBy(sc); + } + + @Override + public List listPodCapacityByCapacityTypes(Long zoneId, List capacityTypes) { + SearchBuilder sb = createSearchBuilder(); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN); + sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("capacityState", "Enabled"); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + sc.setParameters("capacityTypes", capacityTypes.toArray()); + return listBy(sc); + } + + @Override + public List listClusterCapacityByCapacityTypes(Long zoneId, Long podId, List capacityTypes) { + SearchBuilder sb = createSearchBuilder(); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ); + sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN); + sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ); + sb.done(); + + SearchCriteria sc = sb.create(); + sc.setParameters("capacityState", "Enabled"); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + if (podId != null) { + sc.setParameters("podId", podId); + } + sc.setParameters("capacityTypes", capacityTypes.toArray()); + return listBy(sc); + } + + @Override + public List listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam) { TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; List result = new ArrayList(); diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java index b978cc04bfa7..ebacbd8b3e5a 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDao.java @@ -62,20 +62,6 @@ List findByOwnersAndTypeAndTag(List ownerIdList, Resource long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType); - /** - * Counts the number of CPU cores allocated for the given account. - * - * Side note: This method is not using the "resource_count" table. It is executing the actual count instead. - */ - long countCpuNumberAllocatedToAccount(long accountId); - - /** - * Counts the amount of memory allocated for the given account. - * - * Side note: This method is not using the "resource_count" table. It is executing the actual count instead. - */ - long countMemoryAllocatedToAccount(long accountId); - void removeResourceCountsForNonMatchingTags(Long ownerId, ResourceOwnerType ownerType, List types, List tags); List lockRows(Set ids); diff --git a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java index 65d7fed2d1a1..2083fb422d28 100644 --- a/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java @@ -336,22 +336,9 @@ public long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType) { + " END)) as total " + " from vm_instance vm " + " join service_offering so on so.id = vm.service_offering_id " - + " left join user_vm_details vmd on vmd.vm_id = vm.id and vmd.name = '%s' " + + " left join vm_instance_details vmd on vmd.vm_id = vm.id and vmd.name = '%s' " + " where vm.type = 'User' and state not in ('Destroyed', 'Error', 'Expunging') and display_vm = true and account_id = ? "; - @Override - public long countCpuNumberAllocatedToAccount(long accountId) { - String sqlCountCpuNumberAllocatedToAccount = String.format(baseSqlCountComputingResourceAllocatedToAccount, ResourceType.cpu, ResourceType.cpu, "cpuNumber"); - return executeSqlCountComputingResourcesForAccount(accountId, sqlCountCpuNumberAllocatedToAccount); - } - - @Override - public long countMemoryAllocatedToAccount(long accountId) { - String serviceOfferingRamSizeField = "ram_size"; - String sqlCountCpuNumberAllocatedToAccount = String.format(baseSqlCountComputingResourceAllocatedToAccount, serviceOfferingRamSizeField, serviceOfferingRamSizeField, "memory"); - return executeSqlCountComputingResourcesForAccount(accountId, sqlCountCpuNumberAllocatedToAccount); - } - private long executeSqlCountComputingResourcesForAccount(long accountId, String sqlCountComputingResourcesAllocatedToAccount) { TransactionLegacy tx = TransactionLegacy.currentTxn(); try { diff --git a/engine/schema/src/main/java/com/cloud/dc/ClusterDetailsDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/ClusterDetailsDaoImpl.java index 4c752ff9b4ff..a8888f98ad29 100644 --- a/engine/schema/src/main/java/com/cloud/dc/ClusterDetailsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/ClusterDetailsDaoImpl.java @@ -171,7 +171,7 @@ public Scope getScope() { @Override public String getConfigValue(long id, String key) { ClusterDetailsVO vo = findDetail(id, key); - return vo == null ? null : vo.getValue(); + return vo == null ? null : getActualValue(vo); } @Override diff --git a/engine/schema/src/main/java/com/cloud/dc/ClusterVO.java b/engine/schema/src/main/java/com/cloud/dc/ClusterVO.java index 434901ef5b3b..a18097db6d6c 100644 --- a/engine/schema/src/main/java/com/cloud/dc/ClusterVO.java +++ b/engine/schema/src/main/java/com/cloud/dc/ClusterVO.java @@ -85,6 +85,10 @@ public class ClusterVO implements Cluster { @Column(name = "uuid") String uuid; + @Column(name = "storage_access_groups") + String storageAccessGroups; + + public ClusterVO() { clusterType = Cluster.ClusterType.CloudManaged; allocationState = Grouping.AllocationState.Enabled; @@ -215,6 +219,14 @@ public void setArch(String arch) { this.arch = arch; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + @Override public String toString() { return String.format("Cluster {id: \"%s\", name: \"%s\", uuid: \"%s\"}", id, name, uuid); diff --git a/engine/schema/src/main/java/com/cloud/dc/DataCenterVO.java b/engine/schema/src/main/java/com/cloud/dc/DataCenterVO.java index 827b72b58b05..9b24e51a1a8b 100644 --- a/engine/schema/src/main/java/com/cloud/dc/DataCenterVO.java +++ b/engine/schema/src/main/java/com/cloud/dc/DataCenterVO.java @@ -142,6 +142,9 @@ public class DataCenterVO implements DataCenter { @Enumerated(value = EnumType.STRING) private DataCenter.Type type; + @Column(name = "storage_access_groups") + String storageAccessGroups; + @Override public String getDnsProvider() { return dnsProvider; @@ -485,6 +488,14 @@ public void setType(Type type) { this.type = type; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + @Override public String toString() { return String.format("Zone {\"id\": \"%s\", \"name\": \"%s\", \"uuid\": \"%s\"}", id, name, uuid); diff --git a/engine/schema/src/main/java/com/cloud/dc/HostPodVO.java b/engine/schema/src/main/java/com/cloud/dc/HostPodVO.java index fdda38fbc393..99ebcf2346c5 100644 --- a/engine/schema/src/main/java/com/cloud/dc/HostPodVO.java +++ b/engine/schema/src/main/java/com/cloud/dc/HostPodVO.java @@ -71,6 +71,9 @@ public class HostPodVO implements Pod { @Column(name = "uuid") private String uuid; + @Column(name = "storage_access_groups") + String storageAccessGroups; + public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) { this.name = name; this.dataCenterId = dcId; @@ -199,6 +202,14 @@ public void setUuid(String uuid) { this.uuid = uuid; } + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + @Override public String toString() { return String.format("HostPod %s", diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDao.java index 01afd0780f7e..e4047cf7973d 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDao.java @@ -27,6 +27,6 @@ public interface AccountVlanMapDao extends GenericDao { public List listAccountVlanMapsByVlan(long vlanDbId); - public AccountVlanMapVO findAccountVlanMap(long accountId, long vlanDbId); + public AccountVlanMapVO findAccountVlanMap(Long accountId, long vlanDbId); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDaoImpl.java index 12114770f112..0844bb77caa2 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/AccountVlanMapDaoImpl.java @@ -48,9 +48,9 @@ public List listAccountVlanMapsByVlan(long vlanDbId) { } @Override - public AccountVlanMapVO findAccountVlanMap(long accountId, long vlanDbId) { + public AccountVlanMapVO findAccountVlanMap(Long accountId, long vlanDbId) { SearchCriteria sc = AccountVlanSearch.create(); - sc.setParameters("accountId", accountId); + sc.setParametersIfNotNull("accountId", accountId); sc.setParameters("vlanDbId", vlanDbId); return findOneIncludingRemovedBy(sc); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java index bf12abd5114c..3d04f6679def 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDao.java @@ -18,11 +18,12 @@ import java.util.List; import java.util.Map; -import java.util.Set; import com.cloud.cpu.CPU; import com.cloud.dc.ClusterVO; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; public interface ClusterDao extends GenericDao { @@ -30,13 +31,11 @@ public interface ClusterDao extends GenericDao { ClusterVO findBy(String name, long podId); - List listByHyTypeWithoutGuid(String hyType); - List listByZoneId(long zoneId); List getAvailableHypervisorInZone(Long zoneId); - Set getDistinctAvailableHypervisorsAcrossClusters(); + List> listDistinctHypervisorsAndArchExcludingExternalType(Long zoneId); List listByDcHyType(long dcId, String hyType); @@ -59,4 +58,10 @@ public interface ClusterDao extends GenericDao { List getClustersArchsByZone(long zoneId); List listClustersByArchAndZoneId(long zoneId, CPU.CPUArch arch); + + List listDistinctStorageAccessGroups(String name, String keyword); + + List listEnabledClusterIdsByZoneHypervisorArch(Long zoneId, HypervisorType hypervisorType, CPU.CPUArch arch); + + List listByZonesAndHypervisorType(List zoneIds, HypervisorType hypervisorType, Filter filter); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java index af6b83976430..9b6f0f7ac3a6 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java @@ -20,15 +20,15 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.stream.Collectors; import javax.inject.Inject; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; import com.cloud.cpu.CPU; @@ -39,6 +39,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.org.Grouping; import com.cloud.org.Managed; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.JoinBuilder; @@ -148,14 +150,6 @@ public ClusterVO findBy(String name, long podId) { return findOneBy(sc); } - @Override - public List listByHyTypeWithoutGuid(String hyType) { - SearchCriteria sc = HyTypeWithoutGuidSearch.create(); - sc.setParameters("hypervisorType", hyType); - - return listBy(sc); - } - @Override public List listByDcHyType(long dcId, String hyType) { SearchCriteria sc = ZoneHyTypeSearch.create(); @@ -177,9 +171,30 @@ public List getAvailableHypervisorInZone(Long zoneId) { .collect(Collectors.toList()); } + /** + * Returns distinct (HypervisorType, CPUArch) pairs from clusters in the given zone, + * excluding clusters with {@link HypervisorType#External}. + * + * @param zoneId the zone ID to filter by, or {@code null} to include all zones + * @return list of unique hypervisor type and CPU architecture pairs + */ @Override - public Set getDistinctAvailableHypervisorsAcrossClusters() { - return new HashSet<>(getAvailableHypervisorInZone(null)); + public List> listDistinctHypervisorsAndArchExcludingExternalType(Long zoneId) { + SearchBuilder sb = createSearchBuilder(); + sb.select(null, Func.DISTINCT_PAIR, sb.entity().getHypervisorType(), sb.entity().getArch()); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.NEQ); + sb.done(); + SearchCriteria sc = sb.create(); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + sc.setParameters("hypervisorType", HypervisorType.External); + + final List clusters = search(sc, null); + return clusters.stream() + .map(c -> new Pair<>(c.getHypervisorType(), c.getArch())) + .collect(Collectors.toList()); } @Override @@ -344,4 +359,76 @@ public List listClustersByArchAndZoneId(long zoneId, CPU.CPUArch arch sc.setParameters("arch", arch); return listBy(sc); } + + @Override + public List listDistinctStorageAccessGroups(String name, String keyword) { + GenericSearchBuilder searchBuilder = createSearchBuilder(String.class); + + searchBuilder.select(null, SearchCriteria.Func.DISTINCT, searchBuilder.entity().getStorageAccessGroups()); + if (name != null) { + searchBuilder.and().op("storageAccessGroupExact", searchBuilder.entity().getStorageAccessGroups(), Op.EQ); + searchBuilder.or("storageAccessGroupPrefix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupSuffix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupMiddle", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.cp(); + } + if (keyword != null) { + searchBuilder.and("keyword", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + } + searchBuilder.done(); + + SearchCriteria sc = searchBuilder.create(); + if (name != null) { + sc.setParameters("storageAccessGroupExact", name); + sc.setParameters("storageAccessGroupPrefix", name + ",%"); + sc.setParameters("storageAccessGroupSuffix", "%," + name); + sc.setParameters("storageAccessGroupMiddle", "%," + name + ",%"); + } + + if (keyword != null) { + sc.setParameters("keyword", "%" + keyword + "%"); + } + + return customSearch(sc, null); + } + + @Override + public List listEnabledClusterIdsByZoneHypervisorArch(Long zoneId, HypervisorType hypervisorType, CPU.CPUArch arch) { + GenericSearchBuilder sb = createSearchBuilder(Long.class); + sb.selectFields(sb.entity().getId()); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.and("allocationState", sb.entity().getAllocationState(), Op.EQ); + sb.and("managedState", sb.entity().getManagedState(), Op.EQ); + sb.and("hypervisor", sb.entity().getHypervisorType(), Op.EQ); + sb.and("arch", sb.entity().getArch(), Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("allocationState", Grouping.AllocationState.Enabled); + sc.setParameters("managedState", Managed.ManagedState.Managed); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + if (hypervisorType != null) { + sc.setParameters("hypervisor", hypervisorType); + } + if (arch != null) { + sc.setParameters("arch", arch); + } + return customSearch(sc, null); + } + + @Override + public List listByZonesAndHypervisorType(List zoneIds, HypervisorType hypervisorType, Filter filter) { + if (CollectionUtils.isEmpty(zoneIds)) { + return Collections.emptyList(); + } + SearchBuilder sb = createSearchBuilder(); + sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.IN); + sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("dataCenterId", zoneIds.toArray()); + sc.setParameters("hypervisorType", hypervisorType.toString()); + return listBy(sc, filter); + } } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java index 02a7ac6977c2..76058d213338 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java @@ -36,7 +36,6 @@ public class ClusterVSMMapDaoImpl extends GenericDaoBase final SearchBuilder VsmSearch; public ClusterVSMMapDaoImpl() { - //super(); ClusterSearch = createSearchBuilder(); ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ); @@ -82,8 +81,6 @@ public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); ClusterVSMMapVO cluster = createForUpdate(); - //cluster.setClusterId(null); - //cluster.setVsmId(null); update(id, cluster); diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDao.java index dddbce31772d..0ba88f39b233 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDao.java @@ -117,4 +117,6 @@ public Integer getVlan() { List listAllZones(); List listByIds(List ids); + + List listDistinctStorageAccessGroups(String name, String keyword); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDaoImpl.java index 7719e5adfc7e..d8ab12e82e61 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDaoImpl.java @@ -25,6 +25,7 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.utils.db.GenericSearchBuilder; import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; @@ -441,4 +442,36 @@ public List listByIds(List ids) { sc.setParameters("ids", ids.toArray()); return listBy(sc); } + + @Override + public List listDistinctStorageAccessGroups(String name, String keyword) { + GenericSearchBuilder searchBuilder = createSearchBuilder(String.class); + + searchBuilder.select(null, SearchCriteria.Func.DISTINCT, searchBuilder.entity().getStorageAccessGroups()); + if (name != null) { + searchBuilder.and().op("storageAccessGroupExact", searchBuilder.entity().getStorageAccessGroups(), SearchCriteria.Op.EQ); + searchBuilder.or("storageAccessGroupPrefix", searchBuilder.entity().getStorageAccessGroups(), SearchCriteria.Op.LIKE); + searchBuilder.or("storageAccessGroupSuffix", searchBuilder.entity().getStorageAccessGroups(), SearchCriteria.Op.LIKE); + searchBuilder.or("storageAccessGroupMiddle", searchBuilder.entity().getStorageAccessGroups(), SearchCriteria.Op.LIKE); + searchBuilder.cp(); + } + if (keyword != null) { + searchBuilder.and("keyword", searchBuilder.entity().getStorageAccessGroups(), SearchCriteria.Op.LIKE); + } + searchBuilder.done(); + + SearchCriteria sc = searchBuilder.create(); + if (name != null) { + sc.setParameters("storageAccessGroupExact", name); + sc.setParameters("storageAccessGroupPrefix", name + ",%"); + sc.setParameters("storageAccessGroupSuffix", "%," + name); + sc.setParameters("storageAccessGroupMiddle", "%," + name + ",%"); + } + + if (keyword != null) { + sc.setParameters("keyword", "%" + keyword + "%"); + } + + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java index bb03a96d02ee..687071699920 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterDetailsDaoImpl.java @@ -31,7 +31,8 @@ public class DataCenterDetailsDaoImpl extends ResourceDetailsDaoBase DetailSearch; - DataCenterDetailsDaoImpl() { + public DataCenterDetailsDaoImpl() { + super(); DetailSearch = createSearchBuilder(); DetailSearch.and("zoneId", DetailSearch.entity().getResourceId(), SearchCriteria.Op.EQ); DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ); @@ -46,7 +47,7 @@ public Scope getScope() { @Override public String getConfigValue(long id, String key) { ResourceDetail vo = findDetail(id, key); - return vo == null ? null : vo.getValue(); + return vo == null ? null : getActualValue(vo); } @Override diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java index ba01e31f80a8..6c1d944ca3e7 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterIpAddressDaoImpl.java @@ -161,14 +161,14 @@ public void addIpRange(long dcId, long podId, String start, String end, boolean } txn.commit(); } catch (SQLException ex) { - throw new CloudRuntimeException("Unable to persist ip address range ", ex); + throw new CloudRuntimeException("Unable to persist IP address range ", ex); } } @Override public void releaseIpAddress(String ipAddress, long dcId, Long nicId) { if (logger.isDebugEnabled()) { - logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId); + logger.debug("Releasing IP address: " + ipAddress + " data center " + dcId); } SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("ip", ipAddress); @@ -186,7 +186,7 @@ public void releaseIpAddress(String ipAddress, long dcId, Long nicId) { @Override public void releaseIpAddress(long nicId, String reservationId) { if (logger.isDebugEnabled()) { - logger.debug("Releasing ip address for reservationId=" + reservationId + ", nic=" + nicId); + logger.debug("Releasing IP address for reservationId=" + reservationId + ", nic=" + nicId); } SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("nic", nicId); @@ -202,7 +202,7 @@ public void releaseIpAddress(long nicId, String reservationId) { @Override public void releasePodIpAddress(long id) { if (logger.isDebugEnabled()) { - logger.debug("Releasing ip address for ID=" + id); + logger.debug("Releasing IP address for ID=" + id); } DataCenterIpAddressVO vo = this.findById(id); @@ -215,7 +215,7 @@ public void releasePodIpAddress(long id) { @Override public void releaseIpAddress(long nicId) { if (logger.isDebugEnabled()) { - logger.debug("Releasing ip address for nic=" + nicId); + logger.debug("Releasing IP address for nic=" + nicId); } SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("nic", nicId); diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java index 517f02edde78..1c9d8b439cbd 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DataCenterLinkLocalIpAddressDaoImpl.java @@ -104,7 +104,7 @@ public void addIpRange(long dcId, long podId, String start, String end) { @Override public void releaseIpAddress(String ipAddress, long dcId, long instanceId) { if (logger.isDebugEnabled()) { - logger.debug("Releasing ip address: " + ipAddress + " data center " + dcId); + logger.debug("Releasing IP address: " + ipAddress + " data center " + dcId); } SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("ip", ipAddress); diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDao.java index 6af16bbace99..d14ccbe86ca6 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDao.java @@ -24,5 +24,5 @@ public interface DomainVlanMapDao extends GenericDao { public List listDomainVlanMapsByDomain(long domainId); public List listDomainVlanMapsByVlan(long vlanDbId); - public DomainVlanMapVO findDomainVlanMap(long domainId, long vlanDbId); + public DomainVlanMapVO findDomainVlanMap(Long domainId, long vlanDbId); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDaoImpl.java index f789721d5fd6..0b4c781349fd 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/DomainVlanMapDaoImpl.java @@ -46,9 +46,9 @@ public List listDomainVlanMapsByVlan(long vlanDbId) { } @Override - public DomainVlanMapVO findDomainVlanMap(long domainId, long vlanDbId) { + public DomainVlanMapVO findDomainVlanMap(Long domainId, long vlanDbId) { SearchCriteria sc = DomainVlanSearch.create(); - sc.setParameters("domainId", domainId); + sc.setParametersIfNotNull("domainId", domainId); sc.setParameters("vlanDbId", vlanDbId); return findOneIncludingRemovedBy(sc); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDao.java index b2e9b898606c..2549a0555e8c 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDao.java @@ -34,4 +34,6 @@ public interface HostPodDao extends GenericDao { public List listAllPods(Long zoneId); public List listAllPodsByCidr(long zoneId, String cidr); + + List listDistinctStorageAccessGroups(String name, String keyword); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDaoImpl.java index f1835067380f..08901c9a61ea 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/HostPodDaoImpl.java @@ -143,4 +143,36 @@ public List listAllPodsByCidr(long zoneId, String cidr) { return listBy(sc); } + @Override + public List listDistinctStorageAccessGroups(String name, String keyword) { + GenericSearchBuilder searchBuilder = createSearchBuilder(String.class); + + searchBuilder.select(null, SearchCriteria.Func.DISTINCT, searchBuilder.entity().getStorageAccessGroups()); + if (name != null) { + searchBuilder.and().op("storageAccessGroupExact", searchBuilder.entity().getStorageAccessGroups(), Op.EQ); + searchBuilder.or("storageAccessGroupPrefix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupSuffix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupMiddle", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.cp(); + } + if (keyword != null) { + searchBuilder.and("keyword", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + } + searchBuilder.done(); + + SearchCriteria sc = searchBuilder.create(); + if (name != null) { + sc.setParameters("storageAccessGroupExact", name); + sc.setParameters("storageAccessGroupPrefix", name + ",%"); + sc.setParameters("storageAccessGroupSuffix", "%," + name); + sc.setParameters("storageAccessGroupMiddle", "%," + name + ",%"); + } + + if (keyword != null) { + sc.setParameters("keyword", "%" + keyword + "%"); + } + + return customSearch(sc, null); + } + } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/VlanDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/VlanDao.java index 84f38f054412..a6c267bb189b 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/VlanDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/VlanDao.java @@ -64,4 +64,6 @@ public interface VlanDao extends GenericDao { List listIpv6RangeByZoneIdAndVlanId(long zoneId, String vlanId); List listIpv6SupportingVlansByZone(long zoneId); + + List listVlansForExternalNetworkProvider(long zoneId, String detailKey); } diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/VlanDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/VlanDaoImpl.java index 461a9a13b10f..d9fad3cad12a 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/VlanDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/VlanDaoImpl.java @@ -26,6 +26,7 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.dc.VlanDetailsVO; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -67,6 +68,8 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao protected SearchBuilder ZoneVlanIp6Search; protected SearchBuilder ZoneIp6Search; protected SearchBuilder ZoneVlansSearch; + protected SearchBuilder ProviderVlanSearch; + protected SearchBuilder VlanDetailsProviderSearch; protected SearchBuilder AccountVlanMapSearch; protected SearchBuilder DomainVlanMapSearch; @@ -79,6 +82,8 @@ public class VlanDaoImpl extends GenericDaoBase implements VlanDao protected DomainVlanMapDao _domainVlanMapDao; @Inject protected IPAddressDao _ipAddressDao; + @Inject + protected VlanDetailsDao vlanDetailsDao; @Override public VlanVO findByZoneAndVlanId(long zoneId, String vlanId) { @@ -277,6 +282,19 @@ public boolean configure(String name, Map params) throws Configu ZoneVlansSearch.and("zoneId", ZoneVlansSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); ZoneVlansSearch.and("vlan", ZoneVlansSearch.entity().getVlanTag(), SearchCriteria.Op.IN); ZoneVlansSearch.done(); + + ProviderVlanSearch = createSearchBuilder(); + ProviderVlanSearch.and("removed", ProviderVlanSearch.entity().getRemoved(), SearchCriteria.Op.NULL); + ProviderVlanSearch.and("dataCenterId", ProviderVlanSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + VlanDetailsProviderSearch = vlanDetailsDao.createSearchBuilder(); + VlanDetailsProviderSearch.and("name", VlanDetailsProviderSearch.entity().getName(), SearchCriteria.Op.EQ); + VlanDetailsProviderSearch.and("value", VlanDetailsProviderSearch.entity().getValue(), SearchCriteria.Op.EQ); + ProviderVlanSearch.join("VlanDetailsProviderSearch", VlanDetailsProviderSearch, ProviderVlanSearch.entity().getId(), + VlanDetailsProviderSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER); + + VlanDetailsProviderSearch.done(); + ProviderVlanSearch.done(); + return result; } @@ -434,4 +452,13 @@ public List listIpv6SupportingVlansByZone(long zoneId) { return listBy(sc); } + @Override + public List listVlansForExternalNetworkProvider(long zoneId, String detailKey) { + SearchCriteria sc = ProviderVlanSearch.create(); + sc.setParameters("dataCenterId", zoneId); + sc.setJoinParameters("VlanDetailsProviderSearch", "name", detailKey); + sc.setJoinParameters("VlanDetailsProviderSearch", "value", "true"); + return search(sc, null); + } + } diff --git a/engine/schema/src/main/java/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/main/java/com/cloud/domain/dao/DomainDaoImpl.java index 56d971bbe015..1afa0d22dcc1 100644 --- a/engine/schema/src/main/java/com/cloud/domain/dao/DomainDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/domain/dao/DomainDaoImpl.java @@ -262,7 +262,7 @@ public boolean isChildDomain(Long parentId, Long childId) { SearchCriteria sc = DomainPairSearch.create(); sc.setParameters("id", parentId, childId); - List domainPair = listBy(sc); + List domainPair = listIncludingRemovedBy(sc); if ((domainPair != null) && (domainPair.size() == 2)) { DomainVO d1 = domainPair.get(0); diff --git a/engine/schema/src/main/java/com/cloud/event/UsageEventVO.java b/engine/schema/src/main/java/com/cloud/event/UsageEventVO.java index 3fc9fda94873..41ecec0c7fb8 100644 --- a/engine/schema/src/main/java/com/cloud/event/UsageEventVO.java +++ b/engine/schema/src/main/java/com/cloud/event/UsageEventVO.java @@ -75,6 +75,9 @@ public enum DynamicParameters { @Column(name = "virtual_size") private Long virtualSize; + @Column(name = "vm_id") + private Long vmId; + public UsageEventVO() { } @@ -143,6 +146,18 @@ public UsageEventVO(String usageType, long accountId, long zoneId, long vmId, lo this.offeringId = securityGroupId; } + public UsageEventVO(String usageType, long accountId, long zoneId, long resourceId, Long offeringId, Long templateId, Long size, Long vmId, String resourceName) { + this.type = usageType; + this.accountId = accountId; + this.zoneId = zoneId; + this.resourceId = resourceId; + this.offeringId = offeringId; + this.templateId = templateId; + this.size = size; + this.vmId = vmId; + this.resourceName = resourceName; + } + @Override public long getId() { return id; @@ -248,4 +263,11 @@ public void setVirtualSize(Long virtualSize) { this.virtualSize = virtualSize; } + public Long getVmId() { + return vmId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } } diff --git a/engine/schema/src/main/java/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/main/java/com/cloud/event/dao/UsageEventDaoImpl.java index fdef509da5bd..bce9c474e2d2 100644 --- a/engine/schema/src/main/java/com/cloud/event/dao/UsageEventDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/event/dao/UsageEventDaoImpl.java @@ -45,11 +45,11 @@ public class UsageEventDaoImpl extends GenericDaoBase implem private final SearchBuilder latestEventsSearch; private final SearchBuilder IpeventsSearch; private static final String COPY_EVENTS = - "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) " - + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? "; + "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id) " + + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id FROM cloud.usage_event vmevt WHERE vmevt.id > ? and vmevt.id <= ? "; private static final String COPY_ALL_EVENTS = - "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size) " - + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size FROM cloud.usage_event vmevt WHERE vmevt.id <= ?"; + "INSERT INTO cloud_usage.usage_event (id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id) " + + "SELECT id, type, account_id, created, zone_id, resource_id, resource_name, offering_id, template_id, size, resource_type, virtual_size, vm_id FROM cloud.usage_event vmevt WHERE vmevt.id <= ?"; private static final String COPY_EVENT_DETAILS = "INSERT INTO cloud_usage.usage_event_details (id, usage_event_id, name, value) " + "SELECT id, usage_event_id, name, value FROM cloud.usage_event_details vmevtDetails WHERE vmevtDetails.usage_event_id > ? and vmevtDetails.usage_event_id <= ? "; private static final String COPY_ALL_EVENT_DETAILS = "INSERT INTO cloud_usage.usage_event_details (id, usage_event_id, name, value) " diff --git a/engine/schema/src/main/java/com/cloud/gpu/GpuCardVO.java b/engine/schema/src/main/java/com/cloud/gpu/GpuCardVO.java new file mode 100644 index 000000000000..2410077c84ad --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/GpuCardVO.java @@ -0,0 +1,147 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.gpu.GpuCard; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; +import java.util.UUID; + +@Entity +@Table(name = "gpu_card") +public class GpuCardVO implements GpuCard { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "device_id") + private String deviceId; + + @Column(name = "device_name") + private String deviceName; + + @Column(name = "name") + private String name; + + @Column(name = "vendor_name") + private String vendorName; + + @Column(name = "vendor_id") + private String vendorId; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public GpuCardVO() { + this.uuid = UUID.randomUUID().toString(); + } + + public GpuCardVO(String deviceId, String deviceName, String name, String vendorName, String vendorId) { + this.uuid = UUID.randomUUID().toString(); + this.deviceId = deviceId; + this.deviceName = deviceName; + this.name = name; + this.vendorName = vendorName; + this.vendorId = vendorId; + this.created = new Date(); + } + + @Override + public String toString() { + return String.format("GPUCard %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "id", "uuid", "name", "deviceId", "deviceName", "vendorId", "vendorName")); + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + @Override + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + @Override + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + + @Override + public Date getCreated() { + return created; + } + + @Override + public String getGroupName() { + return "Group of " + getVendorName() + " " + getDeviceName() + " GPUs"; + } +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/GpuDeviceVO.java b/engine/schema/src/main/java/com/cloud/gpu/GpuDeviceVO.java new file mode 100644 index 000000000000..ac20e74c3604 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/GpuDeviceVO.java @@ -0,0 +1,200 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu; + +import org.apache.cloudstack.gpu.GpuDevice; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.UUID; + +@Entity +@Table(name = "gpu_device") +public class GpuDeviceVO implements GpuDevice { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "card_id") + private long cardId; + + @Column(name = "vgpu_profile_id") + private long vgpuProfileId; + + @Column(name = "bus_address") + private String busAddress; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "vm_id") + private Long vmId; + + @Column(name = "type") + @Enumerated(value = EnumType.STRING) + private DeviceType type = DeviceType.PCI; + + @Column(name = "state") + @Enumerated(value = EnumType.STRING) + private State state = State.Free; + + @Column(name = "managed_state") + @Enumerated(value = EnumType.STRING) + private ManagedState managedState = ManagedState.Managed; + + @Column(name = "parent_gpu_device_id") + private Long parentGpuDeviceId; + + @Column(name = "numa_node") + private String numaNode; + + @Column(name = "pci_root") + private String pciRoot; + + public GpuDeviceVO() { + this.uuid = UUID.randomUUID().toString(); + } + + public GpuDeviceVO(long cardId, long vgpuProfileId, String busAddress, long hostId, Long parentGpuDeviceId, + String numaNode, String pciRoot) { + this.uuid = UUID.randomUUID().toString(); + this.cardId = cardId; + this.vgpuProfileId = vgpuProfileId; + this.busAddress = busAddress; + this.hostId = hostId; + this.parentGpuDeviceId = parentGpuDeviceId; + this.numaNode = numaNode; + this.pciRoot = pciRoot; + } + + @Override + public String toString() { + return String.format("GpuDevice %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "id", "uuid", "cardId", "vgpuProfileId", "busAddress", "hostId", "vmId", + "parentGpuDeviceId", "numaNode", "pciRoot", "state", "resourceState")); + } + + @Override + public long getId() { + return id; + } + + public String getUuid() { + return uuid; + } + + public long getCardId() { + return cardId; + } + + public void setCardId(long cardId) { + this.cardId = cardId; + } + + public long getVgpuProfileId() { + return vgpuProfileId; + } + + public void setVgpuProfileId(long vgpuProfileId) { + this.vgpuProfileId = vgpuProfileId; + } + + public String getBusAddress() { + return busAddress; + } + + public void setBusAddress(String busAddress) { + this.busAddress = busAddress; + } + + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + @Override + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + public DeviceType getType() { + return type; + } + + public void setType(DeviceType type) { + this.type = type; + } + + public ManagedState getManagedState() { + return managedState; + } + + public void setManagedState(ManagedState managedState) { + this.managedState = managedState; + } + + public Long getVmId() { + return vmId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } + + public Long getParentGpuDeviceId() { + return parentGpuDeviceId; + } + + public void setParentGpuDeviceId(Long parentGpuDeviceId) { + this.parentGpuDeviceId = parentGpuDeviceId; + } + + public String getNumaNode() { + return numaNode; + } + + public void setNumaNode(String numaNode) { + this.numaNode = numaNode; + } + + public String getPciRoot() { + return pciRoot; + } + + public void setPciRoot(String pciRoot) { + this.pciRoot = pciRoot; + } +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/VGPUTypesVO.java b/engine/schema/src/main/java/com/cloud/gpu/VGPUTypesVO.java index 5bbf90854ee6..4944d51f1b44 100644 --- a/engine/schema/src/main/java/com/cloud/gpu/VGPUTypesVO.java +++ b/engine/schema/src/main/java/com/cloud/gpu/VGPUTypesVO.java @@ -40,19 +40,19 @@ public class VGPUTypesVO implements InternalIdentity { private String vgpuType; @Column(name="video_ram") - private long videoRam; + private Long videoRam; @Column(name="max_heads") - private long maxHeads; + private Long maxHeads; @Column(name="max_resolution_x") - private long maxResolutionX; + private Long maxResolutionX; @Column(name="max_resolution_y") - private long maxResolutionY; + private Long maxResolutionY; @Column(name="max_vgpu_per_pgpu") - private long maxVgpuPerPgpu; + private Long maxVgpuPerPgpu; @Column(name="remaining_capacity") private long remainingCapacity; @@ -63,7 +63,7 @@ public class VGPUTypesVO implements InternalIdentity { protected VGPUTypesVO() { } - public VGPUTypesVO(long gpuGroupId, String vgpuType, long videoRam, long maxHeads, long maxResolutionX, long maxResolutionY, long maxVgpuPerPgpu, + public VGPUTypesVO(long gpuGroupId, String vgpuType, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY, Long maxVgpuPerPgpu, long remainingCapacity, long maxCapacity) { this.gpuGroupId = gpuGroupId; this.vgpuType = vgpuType; @@ -92,43 +92,43 @@ public void setVgpuType(String vgpuType) { this.vgpuType = vgpuType; } - public long getVideoRam() { + public Long getVideoRam() { return videoRam; } - public void setVideoRam(long videoRam) { + public void setVideoRam(Long videoRam) { this.videoRam = videoRam; } - public long getMaxHeads() { + public Long getMaxHeads() { return maxHeads; } - public void setMaxHeads(long maxHeads) { + public void setMaxHeads(Long maxHeads) { this.maxHeads = maxHeads; } - public long getMaxResolutionX() { + public Long getMaxResolutionX() { return maxResolutionX; } - public void setMaxResolutionX(long maxResolutionX) { + public void setMaxResolutionX(Long maxResolutionX) { this.maxResolutionX = maxResolutionX; } - public long getMaxResolutionY() { + public Long getMaxResolutionY() { return maxResolutionY; } - public void setMaxResolutionY(long maxResolutionY) { + public void setMaxResolutionY(Long maxResolutionY) { this.maxResolutionY = maxResolutionY; } - public long getMaxVgpuPerPgpu() { + public Long getMaxVgpuPerPgpu() { return maxVgpuPerPgpu; } - public void setMaxVgpuPerPgpu(long maxVgpuPerPgpu) { + public void setMaxVgpuPerPgpu(Long maxVgpuPerPgpu) { this.maxVgpuPerPgpu = maxVgpuPerPgpu; } diff --git a/engine/schema/src/main/java/com/cloud/gpu/VgpuProfileVO.java b/engine/schema/src/main/java/com/cloud/gpu/VgpuProfileVO.java new file mode 100644 index 000000000000..86f5eb94415b --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/VgpuProfileVO.java @@ -0,0 +1,191 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.gpu.VgpuProfile; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; +import java.util.UUID; + +@Entity +@Table(name = "vgpu_profile") +public class VgpuProfileVO implements VgpuProfile { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + + @Column(name = "card_id") + private Long cardId; + + @Column(name = "max_vgpu_per_pgpu") + private Long maxVgpuPerPgpu; + + @Column(name = "video_ram") + private Long videoRam; + + @Column(name = "max_heads") + private Long maxHeads; + + @Column(name = "max_resolution_x") + private Long maxResolutionX; + + @Column(name = "max_resolution_y") + private Long maxResolutionY; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public VgpuProfileVO() { + this.uuid = UUID.randomUUID().toString(); + } + + public VgpuProfileVO(String name, String description, Long gpuCardId, Long maxVgpuPerPgpu) { + this.uuid = UUID.randomUUID().toString(); + this.name = name; + this.description = description; + this.cardId = gpuCardId; + this.maxVgpuPerPgpu = maxVgpuPerPgpu; + this.created = new Date(); + } + + + public VgpuProfileVO(String name, String description, Long gpuCardId, Long maxVgpuPerPgpu, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY) { + this.uuid = UUID.randomUUID().toString(); + this.name = name; + this.description = description; + this.cardId = gpuCardId; + this.maxVgpuPerPgpu = maxVgpuPerPgpu; + this.videoRam = videoRam; + this.maxHeads = maxHeads; + this.maxResolutionX = maxResolutionX; + this.maxResolutionY = maxResolutionY; + this.created = new Date(); + } + + @Override + public String toString() { + return String.format("VgpuProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( + this, "id", "uuid", "name", "cardId")); + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public Date getCreated() { + return created; + } + + @Override + public Long getCardId() { + return cardId; + } + + public void setCardId(Long cardId) { + this.cardId = cardId; + } + + @Override + public Long getMaxVgpuPerPgpu() { + return maxVgpuPerPgpu; + } + + public void setMaxVgpuPerPgpu(Long maxVgpuPerPgpu) { + this.maxVgpuPerPgpu = maxVgpuPerPgpu; + } + + @Override + public Long getVideoRam() { + return videoRam; + } + + public void setVideoRam(Long videoRam) { + this.videoRam = videoRam; + } + + @Override + public Long getMaxHeads() { + return maxHeads; + } + + public void setMaxHeads(Long maxHeads) { + this.maxHeads = maxHeads; + } + + @Override + public Long getMaxResolutionX() { + return maxResolutionX; + } + + public void setMaxResolutionX(Long maxResolutionX) { + this.maxResolutionX = maxResolutionX; + } + + @Override + public Long getMaxResolutionY() { + return maxResolutionY; + } + + public void setMaxResolutionY(Long maxResolutionY) { + this.maxResolutionY = maxResolutionY; + } +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDao.java b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDao.java new file mode 100644 index 000000000000..4463a690ae92 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDao.java @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuCardVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; + +import java.util.List; + +public interface GpuCardDao extends GenericDao { + + /** + * Find GPU card by vendor and device id + * + * @param vendorId the vendor id + * @param deviceId the device id + * @return GpuCardVO + */ + GpuCardVO findByVendorIdAndDeviceId(String vendorId, String deviceId); + + Pair, Integer> searchAndCountGpuCards( + Long id, String keyword, String vendorId, String vendorName, + String deviceId, String deviceName, boolean activeOnly, Long startIndex, Long pageSize); +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDaoImpl.java b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDaoImpl.java new file mode 100644 index 000000000000..8aad85d45086 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuCardDaoImpl.java @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuCardVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import java.util.List; + +@Component +public class GpuCardDaoImpl extends GenericDaoBase implements GpuCardDao { + + private final SearchBuilder allFieldSearch; + + @Inject + private GpuDeviceDao gpuDeviceDao; + + public GpuCardDaoImpl() { + allFieldSearch = createSearchBuilder(); + allFieldSearch.and("name", allFieldSearch.entity().getName(), SearchCriteria.Op.EQ); + allFieldSearch.and("vendorId", allFieldSearch.entity().getVendorId(), SearchCriteria.Op.EQ); + allFieldSearch.and("vendorName", allFieldSearch.entity().getVendorName(), SearchCriteria.Op.EQ); + allFieldSearch.and("deviceId", allFieldSearch.entity().getDeviceId(), SearchCriteria.Op.EQ); + allFieldSearch.and("deviceName", allFieldSearch.entity().getDeviceName(), SearchCriteria.Op.EQ); + allFieldSearch.done(); + } + + @Override + public GpuCardVO findByVendorIdAndDeviceId(String vendorId, String deviceId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters("vendorId", vendorId); + sc.setParameters("deviceId", deviceId); + return findOneBy(sc); + } + + @Override + public Pair, Integer> searchAndCountGpuCards(Long id, String keyword, String vendorId, + String vendorName, String deviceId, String deviceName, boolean activeOnly, Long startIndex, Long pageSize + ) { + + Filter searchFilter = new Filter(GpuCardVO.class, "id", true, startIndex, pageSize); + SearchBuilder sb = createSearchBuilder(); + + if (id != null) { + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + } + if (keyword != null) { + sb.op("nameKeyword", sb.entity().getName(), SearchCriteria.Op.LIKE); + sb.and("deviceNameKeyword", sb.entity().getDeviceName(), SearchCriteria.Op.LIKE); + sb.and("vendorNameKeyword", sb.entity().getVendorName(), SearchCriteria.Op.LIKE); + sb.cp(); + } + if (vendorId != null) { + sb.and("vendorId", sb.entity().getVendorId(), SearchCriteria.Op.EQ); + } + if (vendorName != null) { + sb.and("vendorName", sb.entity().getVendorName(), SearchCriteria.Op.EQ); + } + if (deviceId != null) { + sb.and("deviceId", sb.entity().getDeviceId(), SearchCriteria.Op.EQ); + } + if (deviceName != null) { + sb.and("deviceName", sb.entity().getDeviceName(), SearchCriteria.Op.EQ); + } + if (activeOnly) { + sb.and("ids", sb.entity().getId(), SearchCriteria.Op.IN); + } + sb.done(); + + // Build search criteria + SearchCriteria sc = sb.create(); + if (id != null) { + sc.setParameters("id", id); + } + if (keyword != null) { + sc.setParameters("nameKeyword", "%" + keyword + "%"); + sc.setParameters("deviceNameKeyword", "%" + keyword + "%"); + sc.setParameters("vendorNameKeyword", "%" + keyword + "%"); + } + if (vendorId != null) { + sc.setParameters("vendorId", vendorId); + } + if (vendorName != null) { + sc.setParameters("vendorName", vendorName); + } + if (deviceId != null) { + sc.setParameters("deviceId", deviceId); + } + if (deviceName != null) { + sc.setParameters("deviceName", deviceName); + } + if (activeOnly) { + List cardIds = gpuDeviceDao.getDistinctGpuCardIds(); + if (cardIds.isEmpty()) { + return new Pair<>(List.of(), 0); + } + sc.setParameters("ids", cardIds.toArray()); + } + + return searchAndCount(sc, searchFilter); + } +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDao.java b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDao.java new file mode 100644 index 000000000000..e362f23888d3 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDao.java @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuDeviceVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; + +import java.util.List; + +public interface GpuDeviceDao extends GenericDao { + + List listByIds(List ids); + + /** + * Find GPU device by host ID and bus address + * + * @param hostId the host ID + * @param busAddress the PCI bus address + * @return GpuDeviceVO + */ + GpuDeviceVO findByHostIdAndBusAddress(long hostId, String busAddress); + + /** + * List GPU devices by host ID + * + * @param hostId the ID of the host + * @return a list of GPU devices for the host + */ + List listByHostId(long hostId); + + /** + * List GPU devices by VM ID + * + * @param vmId the VM ID + * @return list of GpuDeviceVO + */ + List listByVmId(long vmId); + + boolean isVgpuProfileInUse(long vgpuProfileId); + + boolean isGpuCardInUse(long cardId); + + List listByHostAndVm(Long hostId, long vmId); + + List listDevicesForAllocation(Long hostId, Long vgpuProfileId); + + Pair, Integer> searchAndCountGpuDevices( + Long id, String keyword, Long hostId, Long vmId, Long gpuCardId, Long vgpuProfileId, + Long startIndex, Long pageSize); + + List getDistinctGpuCardIds(); + + List getDistinctVgpuProfileIds(); + + List listByParentGpuDeviceId(Long parentGpuDeviceId); +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDaoImpl.java b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDaoImpl.java new file mode 100644 index 000000000000..bd7032aff27b --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/GpuDeviceDaoImpl.java @@ -0,0 +1,260 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuCardVO; +import com.cloud.gpu.GpuDeviceVO; +import com.cloud.gpu.VgpuProfileVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.apache.cloudstack.gpu.GpuDevice; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Component +public class GpuDeviceDaoImpl extends GenericDaoBase implements GpuDeviceDao { + + private static final String IDS = "ids"; + private static final String HOST_ID = "hostId"; + private static final String VM_ID = "vmId"; + private static final String BUS_ADDRESS = "busAddress"; + private static final String CARD_ID = "cardId"; + private static final String VGPU_PROFILE_ID = "vgpuProfileId"; + private static final String PARENT_GPU_DEVICE_ID = "parentGpuDeviceId"; + private static final String STATE = "state"; + private static final String MANAGED_STATE = "managedState"; + private static final String TYPE = "type"; + private final SearchBuilder allFieldSearch; + private SearchBuilder devicesForAllocationSearch; + @Inject + private GpuCardDao gpuCardDao; + @Inject + private VgpuProfileDao vgpuProfileDao; + + public GpuDeviceDaoImpl() { + allFieldSearch = createSearchBuilder(); + allFieldSearch.and(IDS, allFieldSearch.entity().getId(), SearchCriteria.Op.IN); + allFieldSearch.and(HOST_ID, allFieldSearch.entity().getHostId(), SearchCriteria.Op.EQ); + allFieldSearch.and(CARD_ID, allFieldSearch.entity().getCardId(), SearchCriteria.Op.EQ); + allFieldSearch.and(BUS_ADDRESS, allFieldSearch.entity().getBusAddress(), SearchCriteria.Op.EQ); + allFieldSearch.and(STATE, allFieldSearch.entity().getState(), SearchCriteria.Op.EQ); + allFieldSearch.and(VGPU_PROFILE_ID, allFieldSearch.entity().getVgpuProfileId(), SearchCriteria.Op.EQ); + allFieldSearch.and(PARENT_GPU_DEVICE_ID, allFieldSearch.entity().getParentGpuDeviceId(), SearchCriteria.Op.EQ); + allFieldSearch.and(VM_ID, allFieldSearch.entity().getVmId(), SearchCriteria.Op.EQ); + allFieldSearch.done(); + + devicesForAllocationSearch = createSearchBuilder(); + devicesForAllocationSearch.and(HOST_ID, devicesForAllocationSearch.entity().getHostId(), SearchCriteria.Op.EQ); + devicesForAllocationSearch.and(VGPU_PROFILE_ID, devicesForAllocationSearch.entity().getVgpuProfileId(), SearchCriteria.Op.IN); + devicesForAllocationSearch.and(STATE, devicesForAllocationSearch.entity().getState(), SearchCriteria.Op.EQ); + devicesForAllocationSearch.and(MANAGED_STATE, devicesForAllocationSearch.entity().getManagedState(), SearchCriteria.Op.EQ); + devicesForAllocationSearch.and(TYPE, devicesForAllocationSearch.entity().getType(), SearchCriteria.Op.NEQ); + devicesForAllocationSearch.done(); + } + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + return super.configure(name, params); + } + + @Override + public List listByIds(List ids) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyList(); + } + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(IDS, ids.toArray()); + return listBy(sc); + } + + @Override + public GpuDeviceVO findByHostIdAndBusAddress(long hostId, String busAddress) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(HOST_ID, hostId); + sc.setParameters(BUS_ADDRESS, busAddress); + return findOneBy(sc); + } + + @Override + public List listByHostId(long hostId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(HOST_ID, hostId); + return listBy(sc); + } + + @Override + public List listByVmId(long vmId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(VM_ID, vmId); + return listBy(sc); + } + + @Override + public boolean isVgpuProfileInUse(long vgpuProfileId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(VGPU_PROFILE_ID, vgpuProfileId); + return getCount(sc) > 0; + } + + @Override + public boolean isGpuCardInUse(long cardId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(CARD_ID, cardId); + return getCount(sc) > 0; + } + + @Override + public List listByHostAndVm(Long hostId, long vmId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(HOST_ID, hostId); + sc.setParameters(VM_ID, vmId); + return search(sc, null); + } + + @Override + public List listDevicesForAllocation(Long hostId, Long vgpuProfileId) { + SearchCriteria sc = devicesForAllocationSearch.create(); + sc.setParameters(HOST_ID, hostId); + sc.setParameters(VGPU_PROFILE_ID, vgpuProfileId); + sc.setParameters(STATE, GpuDevice.State.Free); + sc.setParameters(MANAGED_STATE, GpuDevice.ManagedState.Managed); + sc.setParameters(TYPE, GpuDevice.DeviceType.VGPUOnly); + return search(sc, null); + } + + @Override + public Pair, Integer> searchAndCountGpuDevices(Long id, String keyword, Long hostId, Long vmId, + Long gpuCardId, Long vgpuProfileId, Long startIndex, Long pageSize) { + Filter searchFilter = new Filter(GpuDeviceVO.class, "id", true, startIndex, pageSize); + SearchBuilder sb = createSearchBuilder(); + + if (id != null) { + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + } + if (hostId != null) { + sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ); + } + if (vmId != null) { + sb.and("vmId", sb.entity().getVmId(), SearchCriteria.Op.EQ); + } + if (gpuCardId != null) { + sb.and("cardId", sb.entity().getCardId(), SearchCriteria.Op.EQ); + } + if (vgpuProfileId != null) { + sb.and("vgpuProfileId", sb.entity().getVgpuProfileId(), SearchCriteria.Op.EQ); + } + if (keyword != null) { + SearchBuilder cardSb = gpuCardDao.createSearchBuilder(); + SearchBuilder profileSb = vgpuProfileDao.createSearchBuilder(); + sb.join("cardJoin", cardSb, sb.entity().getCardId(), cardSb.entity().getId(), JoinBuilder.JoinType.INNER); + sb.join("profileJoin", profileSb, sb.entity().getCardId(), profileSb.entity().getId(), + JoinBuilder.JoinType.INNER); + + sb.op("cardNameKeyword", cardSb.entity().getName(), SearchCriteria.Op.LIKE); + sb.or("cardNameKeyword", cardSb.entity().getVendorName(), SearchCriteria.Op.LIKE); + sb.or("cardNameKeyword", cardSb.entity().getDeviceName(), SearchCriteria.Op.LIKE); + + sb.op("profileNameKeyword", profileSb.entity().getName(), SearchCriteria.Op.LIKE); + sb.op("profileDescriptionKeyword", profileSb.entity().getDescription(), SearchCriteria.Op.LIKE); + sb.cp(); + } + + sb.done(); + + // Build search criteria + SearchCriteria sc = sb.create(); + if (id != null) { + sc.setParameters("id", id); + } + if (hostId != null) { + sc.setParameters("hostId", hostId); + } + if (vmId != null) { + sc.setParameters("vmId", vmId); + } + if (gpuCardId != null) { + sc.setParameters("cardId", gpuCardId); + } + if (vgpuProfileId != null) { + sc.setParameters("vgpuProfileId", vgpuProfileId); + } + + if (keyword != null) { + sc.setJoinParameters("cardJoin", "cardNameKeyword", "%" + keyword + "%"); + sc.setJoinParameters("cardJoin", "cardNameKeyword", "%" + keyword + "%"); + sc.setJoinParameters("cardJoin", "cardNameKeyword", "%" + keyword + "%"); + sc.setJoinParameters("profileJoin", "profileNameKeyword", "%" + keyword + "%"); + sc.setJoinParameters("profileJoin", "profileDescriptionKeyword", "%" + keyword + "%"); + } + + return searchAndCount(sc, searchFilter); + } + + @Override + public List getDistinctGpuCardIds() { + SearchBuilder sb = createSearchBuilder(); + sb.select(null, SearchCriteria.Func.DISTINCT, sb.entity().getCardId()); + sb.done(); + SearchCriteria sc = sb.create(); + + List gpuDevices = listBy(sc); + if (CollectionUtils.isEmpty(gpuDevices)) { + return Collections.emptyList(); + } + + return gpuDevices.stream() + .map(GpuDeviceVO::getCardId) + .distinct() + .collect(Collectors.toList()); + } + + @Override + public List getDistinctVgpuProfileIds() { + SearchBuilder sb = createSearchBuilder(); + sb.select(null, SearchCriteria.Func.DISTINCT, sb.entity().getVgpuProfileId()); + sb.done(); + SearchCriteria sc = sb.create(); + + List gpuDevices = listBy(sc); + if (CollectionUtils.isEmpty(gpuDevices)) { + return Collections.emptyList(); + } + + return gpuDevices.stream() + .map(GpuDeviceVO::getVgpuProfileId) + .distinct() + .collect(Collectors.toList()); + } + + @Override + public List listByParentGpuDeviceId(Long parentGpuDeviceId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters(PARENT_GPU_DEVICE_ID, parentGpuDeviceId); + return listBy(sc); + } +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDao.java b/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDao.java index 8e4f2f742ac5..99e336175393 100644 --- a/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDao.java +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDao.java @@ -19,6 +19,7 @@ import java.util.List; import com.cloud.gpu.HostGpuGroupsVO; +import com.cloud.utils.Pair; import com.cloud.utils.db.GenericDao; public interface HostGpuGroupsDao extends GenericDao { @@ -57,4 +58,15 @@ public interface HostGpuGroupsDao extends GenericDao { */ void persist(long hostId, List gpuGroups); + + /** + * Returns max and remaining GPU capacity + * + * @param dcId + * @param podId + * @param clusterId + * @param hostId + * @return Pair containing max GPU capacity and remaining GPU capacity + */ + Pair getGpuStats(Long dcId, Long podId, Long clusterId, Long hostId); } diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDaoImpl.java b/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDaoImpl.java index 30535c7e27d5..343b144597c5 100644 --- a/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/HostGpuGroupsDaoImpl.java @@ -16,9 +16,16 @@ // under the License. package com.cloud.gpu.dao; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; +import com.cloud.utils.Pair; +import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.exception.CloudRuntimeException; import org.springframework.stereotype.Component; import com.cloud.gpu.HostGpuGroupsVO; @@ -87,4 +94,75 @@ public void deleteGpuEntries(long hostId) { sc.setParameters("hostId", hostId); remove(sc); } + + @Override + public Pair getGpuStats(Long dcId, Long podId, Long clusterId, Long hostId) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + Pair result = null; + List resourceIdList = new ArrayList<>(); + String query = getStatsQuery(resourceIdList, dcId, podId, clusterId, hostId); + + try { + PreparedStatement pstmt = txn.prepareAutoCloseStatement(query); + for (int i = 0; i < resourceIdList.size(); i++) { + pstmt.setLong(1 + i, resourceIdList.get(i)); + } + + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + result = new Pair<>(rs.getLong(1), rs.getLong(2)); + } + return result; + } catch (SQLException e) { + throw new CloudRuntimeException("Error while fetching GPU stats: " + e.getMessage(), e); + } catch (Throwable e) { + throw new CloudRuntimeException("Caught: " + query, e); + } + } + + private String getStatsQuery(List resourceIdList, Long dcId, Long podId, Long clusterId, Long hostId) { + StringBuilder query = new StringBuilder("SELECT SUM(max_capacity), SUM(remaining_capacity)" + + "FROM vgpu_types " + + "WHERE" + + " gpu_group_id IN (" + + " SELECT" + + " host_gpu_groups.id" + + " FROM" + + " host_gpu_groups" + + " INNER JOIN host ON host.id = host_gpu_groups.host_id "); + if (dcId != null) { + query.append("WHERE host.data_center_id = ? "); + resourceIdList.add(dcId); + } + + if (podId != null) { + if (resourceIdList.isEmpty()) { + query.append("WHERE "); + } else { + query.append("AND "); + } + query.append(" host.pod_id = ? "); + resourceIdList.add(podId); + } + if (clusterId != null) { + if (resourceIdList.isEmpty()) { + query.append("WHERE "); + } else { + query.append("AND "); + } + query.append(" host.cluster_id = ? "); + resourceIdList.add(clusterId); + } + if (hostId != null) { + if (resourceIdList.isEmpty()) { + query.append("WHERE "); + } else { + query.append("AND "); + } + query.append(" host.id = ? "); + resourceIdList.add(hostId); + } + query.append(" )"); + return query.toString(); + } } diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/VGPUTypesDaoImpl.java b/engine/schema/src/main/java/com/cloud/gpu/dao/VGPUTypesDaoImpl.java index edc5e1f67c86..524feed24679 100644 --- a/engine/schema/src/main/java/com/cloud/gpu/dao/VGPUTypesDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/VGPUTypesDaoImpl.java @@ -16,19 +16,6 @@ //under the License. package com.cloud.gpu.dao; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; - -import javax.inject.Inject; - -import org.springframework.stereotype.Component; - import com.cloud.agent.api.VgpuTypesInfo; import com.cloud.gpu.HostGpuGroupsVO; import com.cloud.gpu.VGPUTypesVO; @@ -37,30 +24,42 @@ import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; @Component public class VGPUTypesDaoImpl extends GenericDaoBase implements VGPUTypesDao { - private final SearchBuilder _searchByGroupId; - private final SearchBuilder _searchByGroupIdVGPUType; - - @Inject protected HostGpuGroupsDao _hostGpuGroupsDao; + @Inject + protected HostGpuGroupsDao hostGpuGroupsDao; private static final String LIST_ZONE_POD_CLUSTER_WIDE_GPU_CAPACITIES = "SELECT host_gpu_groups.group_name, vgpu_type, max_vgpu_per_pgpu, SUM(remaining_capacity) AS remaining_capacity, SUM(max_capacity) AS total_capacity FROM" + - " `cloud`.`vgpu_types` INNER JOIN `cloud`.`host_gpu_groups` ON vgpu_types.gpu_group_id = host_gpu_groups.id INNER JOIN `cloud`.`host`" + - " ON host_gpu_groups.host_id = host.id WHERE host.type = 'Routing' AND host.data_center_id = ?"; + " `cloud`.`vgpu_types` INNER JOIN `cloud`.`host_gpu_groups` ON vgpu_types.gpu_group_id = host_gpu_groups.id INNER JOIN `cloud`.`host`" + + " ON host_gpu_groups.host_id = host.id WHERE host.type = 'Routing' AND vgpu_types.max_capacity > 0 AND host.data_center_id = ?"; + + private final SearchBuilder searchByGroupId; + private final SearchBuilder searchByGroupIdVGPUType; public VGPUTypesDaoImpl() { - _searchByGroupId = createSearchBuilder(); - _searchByGroupId.and("groupId", _searchByGroupId.entity().getGpuGroupId(), SearchCriteria.Op.EQ); - _searchByGroupId.done(); + searchByGroupId = createSearchBuilder(); + searchByGroupId.and("groupId", searchByGroupId.entity().getGpuGroupId(), SearchCriteria.Op.EQ); + searchByGroupId.done(); - _searchByGroupIdVGPUType = createSearchBuilder(); - _searchByGroupIdVGPUType.and("groupId", _searchByGroupIdVGPUType.entity().getGpuGroupId(), SearchCriteria.Op.EQ); - _searchByGroupIdVGPUType.and("vgpuType", _searchByGroupIdVGPUType.entity().getVgpuType(), SearchCriteria.Op.EQ); - _searchByGroupIdVGPUType.done(); + searchByGroupIdVGPUType = createSearchBuilder(); + searchByGroupIdVGPUType.and("groupId", searchByGroupIdVGPUType.entity().getGpuGroupId(), SearchCriteria.Op.EQ); + searchByGroupIdVGPUType.and("vgpuType", searchByGroupIdVGPUType.entity().getVgpuType(), SearchCriteria.Op.EQ); + searchByGroupIdVGPUType.done(); } @Override @@ -83,7 +82,7 @@ public List listGPUCapacities(Long dcId, Long podId, Long cluster finalQuery.append(" AND host.cluster_id = ?"); resourceIdList.add(clusterId); } - finalQuery.append(" GROUP BY host_gpu_groups.group_name, vgpu_type"); + finalQuery.append(" GROUP BY host_gpu_groups.group_name, vgpu_type, max_vgpu_per_pgpu"); try { pstmt = txn.prepareAutoCloseStatement(finalQuery.toString()); @@ -106,14 +105,14 @@ public List listGPUCapacities(Long dcId, Long podId, Long cluster @Override public List listByGroupId(long groupId) { - SearchCriteria sc = _searchByGroupId.create(); + SearchCriteria sc = searchByGroupId.create(); sc.setParameters("groupId", groupId); return listBy(sc); } @Override public VGPUTypesVO findByGroupIdVGPUType(long groupId, String vgpuType) { - SearchCriteria sc = _searchByGroupIdVGPUType.create(); + SearchCriteria sc = searchByGroupIdVGPUType.create(); sc.setParameters("groupId", groupId); sc.setParameters("vgpuType", vgpuType); return findOneBy(sc); @@ -124,7 +123,7 @@ public void persist(long hostId, HashMap> Iterator>> it1 = groupDetails.entrySet().iterator(); while (it1.hasNext()) { Entry> entry = it1.next(); - HostGpuGroupsVO gpuGroup = _hostGpuGroupsDao.findByHostIdGroupName(hostId, entry.getKey()); + HostGpuGroupsVO gpuGroup = hostGpuGroupsDao.findByHostIdGroupName(hostId, entry.getKey()); HashMap values = entry.getValue(); Iterator> it2 = values.entrySet().iterator(); while (it2.hasNext()) { diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDao.java b/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDao.java new file mode 100644 index 000000000000..2628f1851f22 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDao.java @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.VgpuProfileVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; + +import java.util.List; + +public interface VgpuProfileDao extends GenericDao { + + VgpuProfileVO findByNameAndCardId(String name, long cardId); + + int removeByCardId(long cardId); + + Pair, Integer> searchAndCountVgpuProfiles(Long id, String name, String keyword, Long gpuCardId, + boolean activeOnly, Long startIndex, Long pageSize); +} diff --git a/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDaoImpl.java b/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDaoImpl.java new file mode 100644 index 000000000000..11dd7edb30d5 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/gpu/dao/VgpuProfileDaoImpl.java @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.VgpuProfileVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import java.util.List; + +@Component +public class VgpuProfileDaoImpl extends GenericDaoBase implements VgpuProfileDao { + + private final SearchBuilder allFieldSearch; + + @Inject + private GpuDeviceDao gpuDeviceDao; + + public VgpuProfileDaoImpl() { + allFieldSearch = createSearchBuilder(); + allFieldSearch.and("name", allFieldSearch.entity().getName(), SearchCriteria.Op.EQ); + allFieldSearch.and("cardId", allFieldSearch.entity().getCardId(), SearchCriteria.Op.IN); + allFieldSearch.done(); + } + + @Override + public VgpuProfileVO findByNameAndCardId(String name, long cardId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters("name", name); + sc.setParameters("cardId", cardId); + return findOneBy(sc); + } + + @Override + public int removeByCardId(long cardId) { + SearchCriteria sc = allFieldSearch.create(); + sc.setParameters("cardId", cardId); + return remove(sc); + } + + @Override + public Pair, Integer> searchAndCountVgpuProfiles(Long id, String name, String keyword, + Long gpuCardId, boolean activeOnly, Long startIndex, Long pageSize) { + Filter searchFilter = new Filter(VgpuProfileVO.class, "id", true, startIndex, pageSize); + SearchBuilder sb = createSearchBuilder(); + + if (id != null) { + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + } + if (name != null) { + sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); + } + if (keyword != null) { + sb.and("keywordName", sb.entity().getName(), SearchCriteria.Op.LIKE); + sb.and("keywordDescription", sb.entity().getDescription(), SearchCriteria.Op.LIKE); + } + if (gpuCardId != null) { + sb.and("cardId", sb.entity().getCardId(), SearchCriteria.Op.EQ); + } + if (activeOnly) { + sb.and("ids", sb.entity().getId(), SearchCriteria.Op.IN); + } + sb.done(); + + // Build search criteria + SearchCriteria sc = sb.create(); + if (id != null) { + sc.setParameters("id", id); + } + if (name != null) { + sc.setParameters("name", name); + } + if (keyword != null) { + sc.setParameters("keywordName", "%" + keyword + "%"); + sc.setParameters("keywordDescription", "%" + keyword + "%"); + } + if (gpuCardId != null) { + sc.setParameters("cardId", gpuCardId); + } + + if (activeOnly) { + List vgpuProfileIds = gpuDeviceDao.getDistinctVgpuProfileIds(); + if (vgpuProfileIds.isEmpty()) { + return new Pair<>(List.of(), 0); + } + sc.setParameters("ids", vgpuProfileIds.toArray()); + } + + return searchAndCount(sc, searchFilter); + } +} diff --git a/engine/schema/src/main/java/com/cloud/host/HostVO.java b/engine/schema/src/main/java/com/cloud/host/HostVO.java index bd6768fa0ddb..d51b4eca0577 100644 --- a/engine/schema/src/main/java/com/cloud/host/HostVO.java +++ b/engine/schema/src/main/java/com/cloud/host/HostVO.java @@ -165,6 +165,9 @@ public class HostVO implements Host { @Column(name = "uuid") private String uuid; + @Column(name = "storage_access_groups") + String storageAccessGroups; + // This is a delayed load value. If the value is null, // then this field has not been loaded yet. // Call host dao to load it. @@ -357,6 +360,15 @@ public Boolean getIsTagARule() { return isTagARule; } + @Override + public String getStorageAccessGroups() { + return storageAccessGroups; + } + + public void setStorageAccessGroups(String storageAccessGroups) { + this.storageAccessGroups = storageAccessGroups; + } + public HashMap> getGpuGroupDetails() { return groupDetails; } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDao.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDao.java index d44e842db8bf..5f5b2affee08 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostDao.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDao.java @@ -19,6 +19,7 @@ import java.util.Date; import java.util.List; +import com.cloud.cpu.CPU; import com.cloud.host.Host; import com.cloud.host.Host.Type; import com.cloud.host.HostVO; @@ -30,6 +31,7 @@ import com.cloud.utils.Pair; import com.cloud.utils.db.GenericDao; import com.cloud.utils.fsm.StateDao; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; /** * Data Access Object for server @@ -82,6 +84,10 @@ public interface HostDao extends GenericDao, StateDao findHypervisorHostInCluster(long clusterId); + List findHypervisorHostInPod(long podId); + + List findHypervisorHostInZone(long zoneId); + HostVO findAnyStateHypervisorHostInCluster(long clusterId); HostVO findOldestExistentHypervisorHostInCluster(long clusterId); @@ -94,10 +100,14 @@ public interface HostDao extends GenericDao, StateDao findByPodId(Long podId); + List findByPodId(Long podId, Type type); + List listIdsByPodId(Long podId); List findByClusterId(Long clusterId); + List findByClusterId(Long clusterId, Type type); + List listIdsByClusterId(Long clusterId); List listIdsForUpRouting(Long zoneId, Long podId, Long clusterId); @@ -167,14 +177,24 @@ public interface HostDao extends GenericDao, StateDao listHostsByMsAndDc(long msId, long dcId); + List listHostsByMsDcResourceState(long msId, long dcId, List excludedResourceStates); + List listHostsByMs(long msId); + List listHostsByMsResourceState(long msId, List excludedResourceStates); + /** - * Retrieves the number of hosts/agents this {@see ManagementServer} has responsibility over. - * @param msId the id of the {@see ManagementServer} - * @return the number of hosts/agents this {@see ManagementServer} has responsibility over + * Count Hosts by given Management Server, Host and Hypervisor Types, + * and exclude Hosts with given Resource States. + * + * @param msId Management Server Id + * @param excludedResourceStates Resource States to be excluded + * @param hostTypes Host Types + * @param hypervisorTypes Hypervisor Types + * @return Hosts count */ - int countByMs(long msId); + int countHostsByMsResourceStateTypeAndHypervisorType(long msId, List excludedResourceStates, + List hostTypes, List hypervisorTypes); /** * Retrieves the host ids/agents this {@see ManagementServer} has responsibility over. @@ -198,7 +218,7 @@ public interface HostDao extends GenericDao, StateDao listOrderedHostsHypervisorVersionsInDatacenter(long datacenterId, HypervisorType hypervisorType); - List findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags); + List findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags); List findClustersThatMatchHostTagRule(String computeOfferingTags); @@ -212,5 +232,13 @@ List findHostIdsByZoneClusterResourceStateTypeAndHypervisorType(final Long List listDistinctHypervisorTypes(final Long zoneId); + List> listDistinctHypervisorArchTypes(final Long zoneId); + + List listDistinctArchTypes(final Long clusterId); + List listByIds(final List ids); + + Long findClusterIdByVolumeInfo(VolumeInfo volumeInfo); + + List listDistinctStorageAccessGroups(String name, String keyword); } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java index fac895400f32..99c9a979c3bf 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java @@ -35,6 +35,8 @@ import javax.inject.Inject; import javax.persistence.TableGenerator; +import com.cloud.vm.VirtualMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.utils.jsinterpreter.TagAsRuleHelper; import org.apache.commons.collections.CollectionUtils; @@ -42,6 +44,7 @@ import com.cloud.cluster.agentlb.HostTransferMapVO; import com.cloud.cluster.agentlb.dao.HostTransferMapDao; import com.cloud.configuration.ManagementServiceConfiguration; +import com.cloud.cpu.CPU; import com.cloud.dc.ClusterVO; import com.cloud.dc.dao.ClusterDao; import com.cloud.gpu.dao.HostGpuGroupsDao; @@ -69,6 +72,7 @@ import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.JoinBuilder; import com.cloud.utils.db.JoinBuilder.JoinType; +import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; @@ -76,6 +80,7 @@ import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.db.UpdateBuilder; import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.commons.lang3.ObjectUtils; @DB @TableGenerator(name = "host_req_sq", table = "op_host", pkColumnName = "id", valueColumnName = "sequence", allocationSize = 1) @@ -103,7 +108,7 @@ public class HostDaoImpl extends GenericDaoBase implements HostDao protected SearchBuilder IdStatusSearch; protected SearchBuilder TypeDcSearch; protected SearchBuilder TypeDcStatusSearch; - protected SearchBuilder TypeClusterStatusSearch; + protected SearchBuilder TypeStatusStateSearch; protected SearchBuilder MsStatusSearch; protected SearchBuilder DcPrivateIpAddressSearch; protected SearchBuilder DcStorageIpAddressSearch; @@ -262,12 +267,14 @@ public void init() { TypeDcStatusSearch.and("resourceState", TypeDcStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ); TypeDcStatusSearch.done(); - TypeClusterStatusSearch = createSearchBuilder(); - TypeClusterStatusSearch.and("type", TypeClusterStatusSearch.entity().getType(), SearchCriteria.Op.EQ); - TypeClusterStatusSearch.and("cluster", TypeClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ); - TypeClusterStatusSearch.and("status", TypeClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ); - TypeClusterStatusSearch.and("resourceState", TypeClusterStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ); - TypeClusterStatusSearch.done(); + TypeStatusStateSearch = createSearchBuilder(); + TypeStatusStateSearch.and("type", TypeStatusStateSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.and("cluster", TypeStatusStateSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.and("pod", TypeStatusStateSearch.entity().getPodId(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.and("zone", TypeStatusStateSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.and("status", TypeStatusStateSearch.entity().getStatus(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.and("resourceState", TypeStatusStateSearch.entity().getResourceState(), SearchCriteria.Op.EQ); + TypeStatusStateSearch.done(); IdsSearch = createSearchBuilder(); IdsSearch.and("id", IdsSearch.entity().getId(), SearchCriteria.Op.IN); @@ -324,10 +331,12 @@ public void init() { PodSearch = createSearchBuilder(); PodSearch.and("podId", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ); + PodSearch.and("type", PodSearch.entity().getType(), Op.EQ); PodSearch.done(); ClusterSearch = createSearchBuilder(); ClusterSearch.and("clusterId", ClusterSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + ClusterSearch.and("type", ClusterSearch.entity().getType(), Op.EQ); ClusterSearch.done(); TypeSearch = createSearchBuilder(); @@ -1234,8 +1243,16 @@ public List listIdsByDataCenterId(Long zoneId) { @Override public List findByPodId(Long podId) { + return findByPodId(podId, null); + } + + @Override + public List findByPodId(Long podId, Type type) { SearchCriteria sc = PodSearch.create(); sc.setParameters("podId", podId); + if (type != null) { + sc.setParameters("type", Type.Routing); + } return listBy(sc); } @@ -1246,8 +1263,16 @@ public List listIdsByPodId(Long podId) { @Override public List findByClusterId(Long clusterId) { + return findByClusterId(clusterId, null); + } + + @Override + public List findByClusterId(Long clusterId, Type type) { SearchCriteria sc = ClusterSearch.create(); sc.setParameters("clusterId", clusterId); + if (type != null) { + sc.setParameters("type", Type.Routing); + } return listBy(sc); } @@ -1351,7 +1376,7 @@ public HostVO findByIp(final String ipAddress) { @Override public List findHypervisorHostInCluster(long clusterId) { - SearchCriteria sc = TypeClusterStatusSearch.create(); + SearchCriteria sc = TypeStatusStateSearch.create(); sc.setParameters("type", Host.Type.Routing); sc.setParameters("cluster", clusterId); sc.setParameters("status", Status.Up); @@ -1360,18 +1385,40 @@ public List findHypervisorHostInCluster(long clusterId) { return listBy(sc); } + @Override + public List findHypervisorHostInZone(long zoneId) { + SearchCriteria sc = TypeStatusStateSearch.create(); + sc.setParameters("type", Host.Type.Routing); + sc.setParameters("zone", zoneId); + sc.setParameters("status", Status.Up); + sc.setParameters("resourceState", ResourceState.Enabled); + + return listBy(sc); + } + + @Override + public List findHypervisorHostInPod(long podId) { + SearchCriteria sc = TypeStatusStateSearch.create(); + sc.setParameters("type", Host.Type.Routing); + sc.setParameters("pod", podId); + sc.setParameters("status", Status.Up); + sc.setParameters("resourceState", ResourceState.Enabled); + + return listBy(sc); + } + @Override public HostVO findAnyStateHypervisorHostInCluster(long clusterId) { - SearchCriteria sc = TypeClusterStatusSearch.create(); + SearchCriteria sc = TypeStatusStateSearch.create(); sc.setParameters("type", Host.Type.Routing); sc.setParameters("cluster", clusterId); - List list = listBy(sc, new Filter(1)); + List list = listBy(sc, new Filter(1, true)); return list.isEmpty() ? null : list.get(0); } @Override public HostVO findOldestExistentHypervisorHostInCluster(long clusterId) { - SearchCriteria sc = TypeClusterStatusSearch.create(); + SearchCriteria sc = TypeStatusStateSearch.create(); sc.setParameters("type", Host.Type.Routing); sc.setParameters("cluster", clusterId); sc.setParameters("status", Status.Up); @@ -1473,7 +1520,7 @@ private List findHostIdsByHostTags(String hostTags){ } } - public List findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags) { + public List findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags) { List hostTagVOList = _hostTagsDao.findHostRuleTags(); List result = new ArrayList<>(); for (HostTagVO rule: hostTagVOList) { @@ -1487,7 +1534,7 @@ public List findHostsWithTagRuleThatMatchComputeOferringTags(String comp public List findClustersThatMatchHostTagRule(String computeOfferingTags) { Set result = new HashSet<>(); - List hosts = findHostsWithTagRuleThatMatchComputeOferringTags(computeOfferingTags); + List hosts = findHostsWithTagRuleThatMatchComputeOfferingTags(computeOfferingTags); for (HostVO host: hosts) { result.add(host.getClusterId()); } @@ -1554,6 +1601,17 @@ public List listHostsByMsAndDc(long msId, long dcId) { return listBy(sc); } + @Override + public List listHostsByMsDcResourceState(long msId, long dcId, List excludedResourceStates) { + QueryBuilder sc = QueryBuilder.create(HostVO.class); + sc.and(sc.entity().getManagementServerId(), Op.EQ, msId); + sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId); + if (CollectionUtils.isNotEmpty(excludedResourceStates)) { + sc.and(sc.entity().getResourceState(), Op.NIN, excludedResourceStates.toArray()); + } + return listBy(sc.create()); + } + @Override public List listHostsByMs(long msId) { SearchCriteria sc = ResponsibleMsSearch.create(); @@ -1562,10 +1620,32 @@ public List listHostsByMs(long msId) { } @Override - public int countByMs(long msId) { - SearchCriteria sc = ResponsibleMsSearch.create(); - sc.setParameters("managementServerId", msId); - return getCount(sc); + public List listHostsByMsResourceState(long msId, List excludedResourceStates) { + QueryBuilder sc = QueryBuilder.create(HostVO.class); + sc.and(sc.entity().getManagementServerId(), Op.EQ, msId); + if (CollectionUtils.isNotEmpty(excludedResourceStates)) { + sc.and(sc.entity().getResourceState(), Op.NIN, excludedResourceStates.toArray()); + } + return listBy(sc.create()); + } + + @Override + public int countHostsByMsResourceStateTypeAndHypervisorType(long msId, + List excludedResourceStates, + List hostTypes, + List hypervisorTypes) { + QueryBuilder sc = QueryBuilder.create(HostVO.class); + sc.and(sc.entity().getManagementServerId(), Op.EQ, msId); + if (CollectionUtils.isNotEmpty(excludedResourceStates)) { + sc.and(sc.entity().getResourceState(), Op.NIN, excludedResourceStates.toArray()); + } + if (CollectionUtils.isNotEmpty(hostTypes)) { + sc.and(sc.entity().getType(), Op.IN, hostTypes.toArray()); + } + if (CollectionUtils.isNotEmpty(hypervisorTypes)) { + sc.and(sc.entity().getHypervisorType(), Op.IN, hypervisorTypes.toArray()); + } + return getCount(sc.create()); } @Override @@ -1795,17 +1875,52 @@ public List findHostIdsByZoneClusterResourceStateTypeAndHypervisorType(fin @Override public List listDistinctHypervisorTypes(final Long zoneId) { - GenericSearchBuilder sb = createSearchBuilder(HypervisorType.class); + GenericSearchBuilder sb = createSearchBuilder(String.class); sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ); sb.select(null, Func.DISTINCT, sb.entity().getHypervisorType()); sb.done(); - SearchCriteria sc = sb.create(); + SearchCriteria sc = sb.create(); if (zoneId != null) { sc.setParameters("zoneId", zoneId); } sc.setParameters("type", Type.Routing); - return customSearch(sc, null); + List hypervisorString = customSearch(sc, null); + return hypervisorString.stream().map(HypervisorType::getType).collect(Collectors.toList()); + } + + @Override + public List> listDistinctHypervisorArchTypes(final Long zoneId) { + SearchBuilder sb = createSearchBuilder(); + sb.select(null, Func.DISTINCT_PAIR, sb.entity().getHypervisorType(), sb.entity().getArch()); + sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ); + sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("type", Type.Routing); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + final List hosts = search(sc, null); + return hosts.stream() + .map(h -> new Pair<>(h.getHypervisorType(), h.getArch())) + .collect(Collectors.toList()); + } + + @Override + public List listDistinctArchTypes(final Long clusterId) { + GenericSearchBuilder sb = createSearchBuilder(String.class); + sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ); + sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ); + sb.select(null, Func.DISTINCT, sb.entity().getArch()); + sb.done(); + SearchCriteria sc = sb.create(); + if (clusterId != null) { + sc.setParameters("clusterId", clusterId); + } + sc.setParameters("type", Type.Routing); + List archStrings = customSearch(sc, null); + return archStrings.stream().map(CPU.CPUArch::fromType).collect(Collectors.toList()); } @Override @@ -1817,4 +1932,56 @@ public List listByIds(List ids) { sc.setParameters("id", ids.toArray()); return search(sc, null); } + + + @Override + public Long findClusterIdByVolumeInfo(VolumeInfo volumeInfo) { + VirtualMachine virtualMachine = volumeInfo.getAttachedVM(); + if (virtualMachine == null) { + return null; + } + + Long hostId = ObjectUtils.defaultIfNull(virtualMachine.getHostId(), virtualMachine.getLastHostId()); + Host host = findById(hostId); + + if (host == null) { + logger.warn(String.format("VM [%s] has null host on DB, either this VM was never started, or there is some inconsistency on the DB.", virtualMachine.getUuid())); + return null; + } + + return host.getClusterId(); + } + + + @Override + public List listDistinctStorageAccessGroups(String name, String keyword) { + GenericSearchBuilder searchBuilder = createSearchBuilder(String.class); + + searchBuilder.select(null, SearchCriteria.Func.DISTINCT, searchBuilder.entity().getStorageAccessGroups()); + if (name != null) { + searchBuilder.and().op("storageAccessGroupExact", searchBuilder.entity().getStorageAccessGroups(), Op.EQ); + searchBuilder.or("storageAccessGroupPrefix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupSuffix", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.or("storageAccessGroupMiddle", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + searchBuilder.cp(); + } + if (keyword != null) { + searchBuilder.and("keyword", searchBuilder.entity().getStorageAccessGroups(), Op.LIKE); + } + searchBuilder.done(); + + SearchCriteria sc = searchBuilder.create(); + if (name != null) { + sc.setParameters("storageAccessGroupExact", name); + sc.setParameters("storageAccessGroupPrefix", name + ",%"); + sc.setParameters("storageAccessGroupSuffix", "%," + name); + sc.setParameters("storageAccessGroupMiddle", "%," + name + ",%"); + } + + if (keyword != null) { + sc.setParameters("keyword", "%" + keyword + "%"); + } + + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDao.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDao.java index 8dc4efa91f3c..b72ec5239ffb 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDao.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDao.java @@ -32,4 +32,9 @@ public interface HostDetailsDao extends GenericDao { void deleteDetails(long hostId); List findByName(String name); + + void removeExternalDetails(long hostId); + + void replaceExternalDetails(long hostId, Map details); + } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDaoImpl.java index 9c1340592f93..0f8e8623506d 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDetailsDaoImpl.java @@ -18,6 +18,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,12 +32,14 @@ import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.VmDetailConstants; @Component public class HostDetailsDaoImpl extends GenericDaoBase implements HostDetailsDao { protected final SearchBuilder HostSearch; protected final SearchBuilder DetailSearch; protected final SearchBuilder DetailNameSearch; + protected final SearchBuilder ExternalDetailSearch; public HostDetailsDaoImpl() { HostSearch = createSearchBuilder(); @@ -51,6 +54,11 @@ public HostDetailsDaoImpl() { DetailNameSearch = createSearchBuilder(); DetailNameSearch.and("name", DetailNameSearch.entity().getName(), SearchCriteria.Op.EQ); DetailNameSearch.done(); + + ExternalDetailSearch = createSearchBuilder(); + ExternalDetailSearch.and("hostId", ExternalDetailSearch.entity().getHostId(), SearchCriteria.Op.EQ); + ExternalDetailSearch.and("name", ExternalDetailSearch.entity().getName(), SearchCriteria.Op.LIKE); + ExternalDetailSearch.done(); } @Override @@ -130,4 +138,41 @@ public List findByName(String name) { sc.setParameters("name", name); return listBy(sc); } + + @Override + public void removeExternalDetails(long hostId) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + txn.start(); + SearchCriteria sc = ExternalDetailSearch.create(); + sc.setParameters("hostId", hostId); + sc.setParameters("name", VmDetailConstants.EXTERNAL_DETAIL_PREFIX + "%"); + remove(sc); + txn.commit(); + } + + @Override + public void replaceExternalDetails(long hostId, Map details) { + if (details.isEmpty()) { + return; + } + TransactionLegacy txn = TransactionLegacy.currentTxn(); + txn.start(); + List detailVOs = new ArrayList<>(); + for (Map.Entry entry : details.entrySet()) { + String name = entry.getKey(); + String value = entry.getValue(); + if ("password".equals(entry.getKey())) { + value = DBEncryptionUtil.encrypt(value); + } + detailVOs.add(new DetailVO(hostId, name, value)); + } + SearchCriteria sc = ExternalDetailSearch.create(); + sc.setParameters("hostId", hostId); + sc.setParameters("name", VmDetailConstants.EXTERNAL_DETAIL_PREFIX + "%"); + remove(sc); + for (DetailVO detail : detailVOs) { + persist(detail); + } + txn.commit(); + } } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDao.java b/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDao.java index 7a00829fd44e..0d86ca0e48c7 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDao.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDao.java @@ -45,4 +45,9 @@ public interface HostTagsDao extends GenericDao { HostTagResponse newHostTagResponse(HostTagVO hostTag); List searchByIds(Long... hostTagIds); + + /** + * List all host tags defined on hosts within a cluster + */ + List listByClusterId(Long clusterId); } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDaoImpl.java index 4aa14a31cfcf..d3fee6a26761 100644 --- a/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostTagsDaoImpl.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -43,9 +44,12 @@ public class HostTagsDaoImpl extends GenericDaoBase implements private final SearchBuilder stSearch; private final SearchBuilder tagIdsearch; private final SearchBuilder ImplicitTagsSearch; + private final GenericSearchBuilder tagSearch; @Inject private ConfigurationDao _configDao; + @Inject + private HostDao hostDao; public HostTagsDaoImpl() { HostSearch = createSearchBuilder(); @@ -72,6 +76,11 @@ public HostTagsDaoImpl() { ImplicitTagsSearch.and("hostId", ImplicitTagsSearch.entity().getHostId(), SearchCriteria.Op.EQ); ImplicitTagsSearch.and("isImplicit", ImplicitTagsSearch.entity().getIsImplicit(), SearchCriteria.Op.EQ); ImplicitTagsSearch.done(); + + tagSearch = createSearchBuilder(String.class); + tagSearch.selectFields(tagSearch.entity().getTag()); + tagSearch.and("hostIdIN", tagSearch.entity().getHostId(), SearchCriteria.Op.IN); + tagSearch.done(); } @Override @@ -235,4 +244,15 @@ public List searchByIds(Long... tagIds) { return tagList; } + + @Override + public List listByClusterId(Long clusterId) { + List hostIds = hostDao.listIdsByClusterId(clusterId); + if (CollectionUtils.isEmpty(hostIds)) { + return new ArrayList<>(); + } + SearchCriteria sc = tagSearch.create(); + sc.setParameters("hostIdIN", hostIds.toArray()); + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java index 718511746c2f..9775f8ad5b10 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java @@ -37,4 +37,6 @@ public interface AutoScaleVmGroupVmMapDao extends GenericDao vmIds, Long batchSize); + + int getErroredInstanceCount(long vmGroupId); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java index 1ae55d97da2c..b2f4e578a82f 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java @@ -127,4 +127,13 @@ public int expungeByVmList(List vmIds, Long batchSize) { sc.setParameters("vmIds", vmIds.toArray()); return batchExpunge(sc, batchSize); } + + @Override + public int getErroredInstanceCount(long vmGroupId) { + SearchCriteria sc = CountBy.create(); + sc.setParameters("vmGroupId", vmGroupId); + sc.setJoinParameters("vmSearch", "states", State.Error); + final List results = customSearch(sc, null); + return results.get(0); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java index 4c9df8e749fe..372dc930b683 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDao.java @@ -24,6 +24,7 @@ import com.cloud.utils.db.GenericDao; public interface CounterDao extends GenericDao { + CounterVO findByNameProviderValue(String name, String value, String provider); public List listCounters(Long id, String name, String source, String provider, String keyword, Filter filter); } diff --git a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java index 2d3906b83414..0badbe449acc 100644 --- a/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/as/dao/CounterDaoImpl.java @@ -32,6 +32,7 @@ @Component public class CounterDaoImpl extends GenericDaoBase implements CounterDao { final SearchBuilder AllFieldsSearch; + final SearchBuilder CounterValueSearch; protected CounterDaoImpl() { AllFieldsSearch = createSearchBuilder(); @@ -40,6 +41,21 @@ protected CounterDaoImpl() { AllFieldsSearch.and("source", AllFieldsSearch.entity().getSource(), Op.EQ); AllFieldsSearch.and("provider", AllFieldsSearch.entity().getProvider(), Op.EQ); AllFieldsSearch.done(); + + CounterValueSearch = createSearchBuilder(); + CounterValueSearch.and("name", CounterValueSearch.entity().getName(), Op.EQ); + CounterValueSearch.and("value", CounterValueSearch.entity().getValue(), Op.EQ); + CounterValueSearch.and("provider", CounterValueSearch.entity().getProvider(), Op.EQ); + CounterValueSearch.done(); + } + + @Override + public CounterVO findByNameProviderValue(String name, String value, String provider) { + SearchCriteria sc = CounterValueSearch.create(); + sc.setParameters("name", name); + sc.setParameters("value", value); + sc.setParameters("provider", provider); + return findOneBy(sc); } @Override diff --git a/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDao.java b/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDao.java index 056445225d0b..7f322ae6c037 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDao.java @@ -75,5 +75,7 @@ public interface FirewallRulesDao extends GenericDao { void loadDestinationCidrs(FirewallRuleVO rule); + FirewallRuleVO findByNetworkIdAndPorts(long networkId, int startPort, int endPort); + List listRoutingIngressFirewallRules(long networkId); } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDaoImpl.java index a793a9172d4c..27bf7ba6aa83 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/FirewallRulesDaoImpl.java @@ -48,6 +48,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase i protected final SearchBuilder NotRevokedSearch; protected final SearchBuilder ReleaseSearch; protected SearchBuilder VmSearch; + protected SearchBuilder FirewallByPortsAndNetwork; protected final SearchBuilder SystemRuleSearch; protected final GenericSearchBuilder RulesByIpCount; protected final SearchBuilder RoutingFirewallRulesSearch; @@ -106,6 +107,12 @@ protected FirewallRulesDaoImpl() { RulesByIpCount.and("state", RulesByIpCount.entity().getState(), Op.EQ); RulesByIpCount.done(); + FirewallByPortsAndNetwork = createSearchBuilder(); + FirewallByPortsAndNetwork.and("networkId", FirewallByPortsAndNetwork.entity().getNetworkId(), Op.EQ); + FirewallByPortsAndNetwork.and("sourcePortStart", FirewallByPortsAndNetwork.entity().getSourcePortStart(), Op.EQ); + FirewallByPortsAndNetwork.and("sourcePortEnd", FirewallByPortsAndNetwork.entity().getSourcePortEnd(), Op.EQ); + FirewallByPortsAndNetwork.done(); + RoutingFirewallRulesSearch = createSearchBuilder(); RoutingFirewallRulesSearch.and("networkId", RoutingFirewallRulesSearch.entity().getNetworkId(), Op.EQ); RoutingFirewallRulesSearch.and("purpose", RoutingFirewallRulesSearch.entity().getPurpose(), Op.EQ); @@ -408,6 +415,16 @@ public void loadDestinationCidrs(FirewallRuleVO rule){ rule.setDestinationCidrsList(destCidrs); } + @Override + public FirewallRuleVO findByNetworkIdAndPorts(long networkId, int startPort, int endPort) { + SearchCriteria sc = FirewallByPortsAndNetwork.create(); + sc.setParameters("networkId", networkId); + sc.setParameters("sourcePortStart", startPort); + sc.setParameters("sourcePortEnd", endPort); + + return findOneBy(sc); + } + @Override public List listRoutingIngressFirewallRules(long networkId) { SearchCriteria sc = RoutingFirewallRulesSearch.create(); diff --git a/engine/schema/src/main/java/com/cloud/network/dao/IPAddressDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/IPAddressDaoImpl.java index 5499d04e3a1f..0a5ecd25667e 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/IPAddressDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/IPAddressDaoImpl.java @@ -197,6 +197,7 @@ public void unassignIpAddress(long ipAddressId) { address.setSourceNat(false); address.setOneToOneNat(false); address.setAssociatedWithVmId(null); + address.setForRouter(false); address.setState(State.Free); address.setAssociatedWithNetworkId(null); address.setVpcId(null); diff --git a/engine/schema/src/main/java/com/cloud/network/dao/IPAddressVO.java b/engine/schema/src/main/java/com/cloud/network/dao/IPAddressVO.java index 88e146d2a804..a3a65fdb01b3 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/IPAddressVO.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/IPAddressVO.java @@ -117,6 +117,9 @@ public class IPAddressVO implements IpAddress { @Column(name = "forsystemvms") private boolean forSystemVms = false; + @Column(name = "for_router") + private boolean forRouter = false; + @Column(name= GenericDao.REMOVED_COLUMN) private Date removed; @@ -388,4 +391,13 @@ public void setRuleState(State ruleState) { public boolean isForSystemVms() { return forSystemVms; } + + @Override + public boolean isForRouter() { + return forRouter; + } + + public void setForRouter(boolean forRouter) { + this.forRouter = forRouter; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVO.java b/engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVO.java index ad0338b98497..3886529322e3 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVO.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/LoadBalancerVO.java @@ -144,4 +144,13 @@ public String toString() { ReflectionToStringBuilderUtils.reflectOnlySelectedFields( this, "id", "uuid", "name", "purpose", "state")); } + + /** + * Sets the CIDR list associated with this load balancer rule. + * + * @param cidrList a comma-separated list of CIDR strings, e.g. "1.2.3.4/24,1.2.3.5/24" or an empty string e.g. "" to clear the restrictions + */ + public void setCidrList(String cidrList) { + this.cidrList = cidrList; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDao.java b/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDao.java new file mode 100644 index 000000000000..fe21f72e4dbb --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDao.java @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.dao; + +import com.cloud.network.element.NetrisProviderVO; +import com.cloud.utils.db.GenericDao; + +public interface NetrisProviderDao extends GenericDao { + NetrisProviderVO findByZoneId(long zoneId); +} diff --git a/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDaoImpl.java new file mode 100644 index 000000000000..86ea04f1db09 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/dao/NetrisProviderDaoImpl.java @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.dao; + +import com.cloud.network.element.NetrisProviderVO; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; + +@Component +@DB() +public class NetrisProviderDaoImpl extends GenericDaoBase implements NetrisProviderDao { + + final SearchBuilder allFieldsSearch; + + public NetrisProviderDaoImpl() { + super(); + allFieldsSearch = createSearchBuilder(); + allFieldsSearch.and("id", allFieldsSearch.entity().getId(), + SearchCriteria.Op.EQ); + allFieldsSearch.and("uuid", allFieldsSearch.entity().getUuid(), + SearchCriteria.Op.EQ); + allFieldsSearch.and("hostname", allFieldsSearch.entity().getUrl(), + SearchCriteria.Op.EQ); + allFieldsSearch.and("zone_id", allFieldsSearch.entity().getZoneId(), + SearchCriteria.Op.EQ); + allFieldsSearch.done(); + } + + @Override + public NetrisProviderVO findByZoneId(long zoneId) { + SearchCriteria sc = allFieldsSearch.create(); + sc.setParameters("zone_id", zoneId); + return findOneBy(sc); + } +} diff --git a/engine/schema/src/main/java/com/cloud/network/dao/NetworkDao.java b/engine/schema/src/main/java/com/cloud/network/dao/NetworkDao.java index 0861a424ebb6..8406f80ed09d 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/NetworkDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/NetworkDao.java @@ -18,11 +18,13 @@ import java.util.List; import java.util.Map; +import java.util.Set; import com.cloud.network.Network; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.State; import com.cloud.network.Networks.TrafficType; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.fsm.StateDao; @@ -47,6 +49,12 @@ public interface NetworkDao extends GenericDao, StateDao listByNetworkDomains(Set uniqueNtwkDomains); + + List listByNetworkDomainsAndAccountIds(Set uniqueNtwkDomains, Set accountIds); + + List listByNetworkDomainsAndDomainIds(Set uniqueNtwkDomains, Set domainIds); + /** * Retrieves the next available mac address in this network configuration. * @@ -89,8 +97,13 @@ public interface NetworkDao extends GenericDao, StateDao serviceProviderMap); + List listByZoneAndTrafficType(long zoneId, TrafficType trafficType, Filter filter); + List listByZoneAndTrafficType(long zoneId, TrafficType trafficType); + List listByZonesTrafficTypeAndOwners(List zoneIds, final TrafficType trafficType, + List accountIds, List domainIds, Filter filter); + void setCheckForGc(long networkId); int getNetworkCountByNetworkOffId(long networkOfferingId); diff --git a/engine/schema/src/main/java/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/NetworkDaoImpl.java index 0aae532eac57..f3ece4879040 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/NetworkDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/NetworkDaoImpl.java @@ -19,6 +19,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -29,9 +30,9 @@ import javax.inject.Inject; import javax.persistence.TableGenerator; -import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.acl.ControlledEntity.ACLType; import org.apache.cloudstack.api.ApiConstants; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; import com.cloud.network.Network; @@ -63,6 +64,7 @@ import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.db.SequenceFetcher; import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; @Component @@ -86,6 +88,7 @@ public class NetworkDaoImpl extends GenericDaoBaseimplements Ne GenericSearchBuilder GarbageCollectedSearch; SearchBuilder PrivateNetworkSearch; + SearchBuilder NetworkDomainSearch; @Inject ResourceTagDao _tagsDao; @@ -192,12 +195,19 @@ protected void init() { PersistentNetworkSearch.and("id", PersistentNetworkSearch.entity().getId(), Op.NEQ); PersistentNetworkSearch.and("guestType", PersistentNetworkSearch.entity().getGuestType(), Op.IN); PersistentNetworkSearch.and("broadcastUri", PersistentNetworkSearch.entity().getBroadcastUri(), Op.EQ); + PersistentNetworkSearch.and("dc", PersistentNetworkSearch.entity().getDataCenterId(), Op.EQ); PersistentNetworkSearch.and("removed", PersistentNetworkSearch.entity().getRemoved(), Op.NULL); final SearchBuilder persistentNtwkOffJoin = _ntwkOffDao.createSearchBuilder(); persistentNtwkOffJoin.and("persistent", persistentNtwkOffJoin.entity().isPersistent(), Op.EQ); PersistentNetworkSearch.join("persistent", persistentNtwkOffJoin, PersistentNetworkSearch.entity().getNetworkOfferingId(), persistentNtwkOffJoin.entity().getId(), JoinType.INNER); PersistentNetworkSearch.done(); + NetworkDomainSearch = createSearchBuilder(); + NetworkDomainSearch.and("networkDomains", NetworkDomainSearch.entity().getNetworkDomain(), Op.IN); + NetworkDomainSearch.and("accounts", NetworkDomainSearch.entity().getAccountId(), Op.IN); + NetworkDomainSearch.and("domains", NetworkDomainSearch.entity().getDomainId(), Op.IN); + NetworkDomainSearch.done(); + PhysicalNetworkSearch = createSearchBuilder(); PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ); PhysicalNetworkSearch.done(); @@ -428,12 +438,35 @@ public List getAllPersistentNetworksFromZone(long dataCenterId) { return search(sc, null); } + @Override + public List listByNetworkDomains(Set uniqueNtwkDomains) { + SearchCriteria sc = NetworkDomainSearch.create(); + sc.setParameters("networkDomains", uniqueNtwkDomains.toArray()); + return search(sc, null); + } + + @Override + public List listByNetworkDomainsAndAccountIds(Set uniqueNtwkDomains, Set accountIds) { + SearchCriteria sc = NetworkDomainSearch.create(); + sc.setParameters("networkDomains", uniqueNtwkDomains.toArray()); + sc.setParameters("accounts", accountIds.toArray()); + return search(sc, null); + } + + @Override + public List listByNetworkDomainsAndDomainIds(Set uniqueNtwkDomains, Set domainIds) { + SearchCriteria sc = NetworkDomainSearch.create(); + sc.setParameters("networkDomains", uniqueNtwkDomains.toArray()); + sc.setParameters("domains", domainIds.toArray()); + return search(sc, null); + } + @Override public String getNextAvailableMacAddress(final long networkConfigId, Integer zoneMacIdentifier) { final SequenceFetcher fetch = SequenceFetcher.getInstance(); long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId); - if(zoneMacIdentifier != null && zoneMacIdentifier.intValue() != 0 ){ - seq = seq | _prefix << 40 | (long)zoneMacIdentifier << 32 | networkConfigId << 16 & 0x00000000ffff0000l; + if (zoneMacIdentifier != null && zoneMacIdentifier != 0) { + seq = seq | _prefix << 40 | (long)zoneMacIdentifier << 32 | networkConfigId << 16 & 0x00000000ffff0000L; } return NetUtils.long2Mac(seq); } @@ -568,7 +601,7 @@ public List listByPhysicalNetwork(final long physicalNetworkId) { public List listByPhysicalNetworkTrafficType(final long physicalNetworkId, final TrafficType trafficType) { final SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("trafficType", trafficType); - sc.setParameters("physicalNetwork", physicalNetworkId); + sc.setParameters("physicalNetworkId", physicalNetworkId); return listBy(sc); } @@ -601,12 +634,46 @@ public List listBy(final long accountId, final long dataCenterId, fin } @Override - public List listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) { + public List listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType, Filter filter) { final SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("datacenter", zoneId); sc.setParameters("trafficType", trafficType); - return listBy(sc, null); + return listBy(sc, filter); + } + + @Override + public List listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) { + return listByZoneAndTrafficType(zoneId, trafficType, null); + } + + @Override + public List listByZonesTrafficTypeAndOwners(List zoneIds, final TrafficType trafficType, + List accountIds, List domainIds, Filter filter) { + if (CollectionUtils.isEmpty(zoneIds)) { + return Collections.emptyList(); + } + SearchBuilder sb = createSearchBuilder(); + sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.IN); + sb.and("trafficType", sb.entity().getTrafficType(), Op.EQ); + boolean accountIdsNotEmpty = CollectionUtils.isNotEmpty(accountIds); + boolean domainIdsNotEmpty = CollectionUtils.isNotEmpty(domainIds); + if (accountIdsNotEmpty || domainIdsNotEmpty) { + sb.and().op("account", sb.entity().getAccountId(), SearchCriteria.Op.IN); + sb.or("domain", sb.entity().getDomainId(), SearchCriteria.Op.IN); + sb.cp(); + } + sb.done(); + final SearchCriteria sc = sb.create(); + sc.setParameters("dataCenterId", zoneIds.toArray()); + sc.setParameters("trafficType", trafficType); + if (accountIdsNotEmpty) { + sc.setParameters("account", accountIds.toArray()); + } + if (domainIdsNotEmpty) { + sc.setParameters("domain", domainIds.toArray()); + } + return listBy(sc, filter); } @Override diff --git a/engine/schema/src/main/java/com/cloud/network/dao/NetworkVO.java b/engine/schema/src/main/java/com/cloud/network/dao/NetworkVO.java index 02abaacd854e..f2572ba91c21 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/NetworkVO.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/NetworkVO.java @@ -203,9 +203,13 @@ public class NetworkVO implements Network { @Column(name = "private_mtu") Integer privateMtu; + @Column(name = "keep_mac_address_on_public_nic") + private boolean keepMacAddressOnPublicNic = true; + @Transient Integer networkCidrSize; + public NetworkVO() { uuid = UUID.randomUUID().toString(); } @@ -773,4 +777,13 @@ public Integer getNetworkCidrSize() { public void setNetworkCidrSize(Integer networkCidrSize) { this.networkCidrSize = networkCidrSize; } + + @Override + public boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + + public void setKeepMacAddressOnPublicNic(boolean keepMacAddressOnPublicNic) { + this.keepMacAddressOnPublicNic = keepMacAddressOnPublicNic; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java index 4811b59d31e5..fdd827ffeeef 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java @@ -125,7 +125,7 @@ public String getNetworkTag(long physicalNetworkId, TrafficType trafficType, Hyp sc = simulatorAllFieldsSearch.create(); } else if (hType == HypervisorType.Ovm) { sc = ovmAllFieldsSearch.create(); - } else if (hType == HypervisorType.BareMetal) { + } else if (hType == HypervisorType.BareMetal || hType == HypervisorType.External) { return null; } else if (hType == HypervisorType.Hyperv) { sc = hypervAllFieldsSearch.create(); @@ -137,7 +137,9 @@ public String getNetworkTag(long physicalNetworkId, TrafficType trafficType, Hyp } sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("trafficType", trafficType); + if (trafficType != null) { + sc.setParameters("trafficType", trafficType); + } List tag = customSearch(sc, null); return tag.size() == 0 ? null : tag.get(0); diff --git a/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java b/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java index ccba6bb18893..606bdaaaa7a7 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java @@ -19,9 +19,21 @@ import com.cloud.network.vo.PublicIpQuarantineVO; import com.cloud.utils.db.GenericDao; +import java.util.Date; +import java.util.List; + public interface PublicIpQuarantineDao extends GenericDao { PublicIpQuarantineVO findByPublicIpAddressId(long publicIpAddressId); PublicIpQuarantineVO findByIpAddress(String publicIpAddress); + + /** + * Returns a list of public IP addresses that are actively quarantined at the specified date and the previous owner differs from the specified user. + * + * @param userId used to check against the IP's previous owner; + * @param date used to check if the quarantine is active; + * @return a list of PublicIpQuarantineVOs. + */ + List listQuarantinedIpAddressesToUser(Long userId, Date date); } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java index a1b789b8a46b..0c47a0d36e30 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java @@ -26,6 +26,8 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; +import java.util.Date; +import java.util.List; @Component public class PublicIpQuarantineDaoImpl extends GenericDaoBase implements PublicIpQuarantineDao { @@ -33,6 +35,8 @@ public class PublicIpQuarantineDaoImpl extends GenericDaoBase ipAddressSearchBuilder; + private SearchBuilder quarantinedIpAddressesSearch; + @Inject IPAddressDao ipAddressDao; @@ -47,8 +51,16 @@ public void init() { publicIpAddressByIdSearch.join("quarantineJoin", ipAddressSearchBuilder, ipAddressSearchBuilder.entity().getId(), publicIpAddressByIdSearch.entity().getPublicIpAddressId(), JoinBuilder.JoinType.INNER); + quarantinedIpAddressesSearch = createSearchBuilder(); + quarantinedIpAddressesSearch.and("previousOwnerId", quarantinedIpAddressesSearch.entity().getPreviousOwnerId(), SearchCriteria.Op.NEQ); + quarantinedIpAddressesSearch.and(); + quarantinedIpAddressesSearch.op("removedIsNull", quarantinedIpAddressesSearch.entity().getRemoved(), SearchCriteria.Op.NULL); + quarantinedIpAddressesSearch.and("endDate", quarantinedIpAddressesSearch.entity().getEndDate(), SearchCriteria.Op.GT); + quarantinedIpAddressesSearch.cp(); + ipAddressSearchBuilder.done(); publicIpAddressByIdSearch.done(); + quarantinedIpAddressesSearch.done(); } @Override @@ -68,4 +80,14 @@ public PublicIpQuarantineVO findByIpAddress(String publicIpAddress) { return findOneBy(sc, filter); } + + @Override + public List listQuarantinedIpAddressesToUser(Long userId, Date date) { + SearchCriteria sc = quarantinedIpAddressesSearch.create(); + + sc.setParameters("previousOwnerId", userId); + sc.setParameters("endDate", date); + + return searchIncludingRemoved(sc, null, false, false); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDao.java b/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDao.java index 8113c06c866e..f4120a138ac5 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDao.java @@ -33,4 +33,6 @@ public interface RemoteAccessVpnDao extends GenericDao List findByAccount(Long accountId); List listByNetworkId(Long networkId); + + List listByVpcId(Long vpcId); } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java index 484aa6f6631e..ccbc60a5562c 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java @@ -85,4 +85,11 @@ public List listByNetworkId(Long networkId) { sc.setParameters("networkId", networkId); return listBy(sc); } + + @Override + public List listByVpcId(Long vpcId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vpcId", vpcId); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/RouterHealthCheckResultVO.java b/engine/schema/src/main/java/com/cloud/network/dao/RouterHealthCheckResultVO.java index 9803ccb6a4bd..204ef2d15381 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/RouterHealthCheckResultVO.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/RouterHealthCheckResultVO.java @@ -29,6 +29,7 @@ import javax.persistence.TemporalType; import com.cloud.network.RouterHealthCheckResult; +import com.cloud.network.VirtualNetworkApplianceService; import com.cloud.utils.StringUtils; @Entity @@ -49,7 +50,7 @@ public class RouterHealthCheckResultVO implements RouterHealthCheckResult { private String checkType; @Column(name = "check_result") - private boolean checkResult; + private VirtualNetworkApplianceService.RouterHealthStatus checkResult; @Temporal(TemporalType.TIMESTAMP) @Column(name = "last_update", updatable = true, nullable = true) @@ -87,7 +88,7 @@ public String getCheckType() { } @Override - public boolean getCheckResult() { + public VirtualNetworkApplianceService.RouterHealthStatus getCheckResult() { return checkResult; } @@ -105,7 +106,7 @@ public byte[] getCheckDetails() { return checkDetails; } - public void setCheckResult(boolean checkResult) { + public void setCheckResult(VirtualNetworkApplianceService.RouterHealthStatus checkResult) { this.checkResult = checkResult; } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDao.java b/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDao.java index d3fef252f506..3475003c2690 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDao.java @@ -20,4 +20,6 @@ public interface Site2SiteVpnGatewayDao extends GenericDao { Site2SiteVpnGatewayVO findByVpcId(long vpcId); + + Site2SiteVpnGatewayVO findByPublicIpAddress(long ipAddressId); } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java index d1fde963217e..0aeefe90c29e 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java @@ -35,6 +35,7 @@ public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase sc = AllFieldsSearch.create(); + sc.setParameters("ipAddressId", ipAddressId); + return findOneBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/SslCertDao.java b/engine/schema/src/main/java/com/cloud/network/dao/SslCertDao.java index 80bb44a1f4a0..1e73cd7b33ee 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/SslCertDao.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/SslCertDao.java @@ -22,4 +22,6 @@ public interface SslCertDao extends GenericDao { List listByAccountId(Long id); + + int removeByAccountId(long accountId); } diff --git a/engine/schema/src/main/java/com/cloud/network/dao/SslCertDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/dao/SslCertDaoImpl.java index 185c18aecd85..efadc009dfc2 100644 --- a/engine/schema/src/main/java/com/cloud/network/dao/SslCertDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/dao/SslCertDaoImpl.java @@ -40,4 +40,10 @@ public List listByAccountId(Long accountId) { return listBy(sc); } + @Override + public int removeByAccountId(long accountId) { + SearchCriteria sc = listByAccountId.create(); + sc.setParameters("accountId", accountId); + return remove(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/element/NetrisProviderVO.java b/engine/schema/src/main/java/com/cloud/network/element/NetrisProviderVO.java new file mode 100644 index 000000000000..113678f7b010 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/network/element/NetrisProviderVO.java @@ -0,0 +1,265 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.element; + +import com.cloud.network.netris.NetrisProvider; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; +import java.util.UUID; + +@Entity +@Table(name = "netris_providers") +public class NetrisProviderVO implements NetrisProvider { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "name") + private String name; + + @Column(name = "zone_id") + private long zoneId; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "url") + private String url; + + @Column(name = "username") + private String username; + + @Column(name = "password") + private String password; + + @Column(name = "site_name") + private String siteName; + + @Column(name = "tenant_name") + private String tenantName; + + @Column(name = "netris_tag") + private String netrisTag; + + @Column(name = "created") + private Date created; + + @Column(name = "removed") + private Date removed; + + public NetrisProviderVO() { + this.uuid = UUID.randomUUID().toString(); + } + + @Override + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public long getZoneId() { + return zoneId; + } + + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + @Override + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + @Override + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSiteName() { + return siteName; + } + + public void setSiteName(String siteName) { + this.siteName = siteName; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getNetrisTag() { + return netrisTag; + } + + public void setNetrisTag(String netrisTag) { + this.netrisTag = netrisTag; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public static final class Builder { + private long zoneId; + private long hostId; + private String name; + private String url; + private String username; + private String password; + private String siteName; + private String tenantName; + private String netrisTag; + + public Builder() { + // Default constructor + } + + public Builder setZoneId(long zoneId) { + this.zoneId = zoneId; + return this; + } + + public Builder setHostId(long hostId) { + this.hostId = hostId; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setUrl(String url) { + this.url = url; + return this; + } + + public Builder setUsername(String username) { + this.username = username; + return this; + } + + public Builder setPassword(String password) { + this.password = password; + return this; + } + + public Builder setSiteName(String siteName) { + this.siteName = siteName; + return this; + } + + public Builder setTenantName(String tenantName) { + this.tenantName = tenantName; + return this; + } + + public Builder setNetrisTag(String netrisTag) { + this.netrisTag = netrisTag; + return this; + } + + public NetrisProviderVO build() { + NetrisProviderVO provider = new NetrisProviderVO(); + provider.setZoneId(this.zoneId); + provider.setHostId(this.hostId); + provider.setUuid(UUID.randomUUID().toString()); + provider.setName(this.name); + provider.setUrl(this.url); + provider.setUsername(this.username); + provider.setPassword(this.password); + provider.setSiteName(this.siteName); + provider.setTenantName(this.tenantName); + provider.setNetrisTag(this.netrisTag); + provider.setCreated(new Date()); + return provider; + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDao.java b/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDao.java index 8cd114b7fc4f..a737f1b9a205 100644 --- a/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDao.java +++ b/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDao.java @@ -47,5 +47,7 @@ public interface PortForwardingRulesDao extends GenericDao listByNetworkAndDestIpAddr(String ip4Address, long networkId); + + PortForwardingRuleVO findByNetworkAndPorts(long networkId, int startPort, int endPort); int expungeByVmList(List vmIds, Long batchSize); } diff --git a/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java index 1b3df06e1a2d..637f47731b47 100644 --- a/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java @@ -58,6 +58,8 @@ protected PortForwardingRulesDaoImpl() { AllFieldsSearch.and("vmId", AllFieldsSearch.entity().getVirtualMachineId(), Op.EQ); AllFieldsSearch.and("purpose", AllFieldsSearch.entity().getPurpose(), Op.EQ); AllFieldsSearch.and("dstIp", AllFieldsSearch.entity().getDestinationIpAddress(), Op.EQ); + AllFieldsSearch.and("sourcePortStart", AllFieldsSearch.entity().getSourcePortStart(), Op.EQ); + AllFieldsSearch.and("sourcePortEnd", AllFieldsSearch.entity().getSourcePortEnd(), Op.EQ); AllFieldsSearch.done(); ApplicationSearch = createSearchBuilder(); @@ -175,6 +177,15 @@ public PortForwardingRuleVO findByIdAndIp(long id, String secondaryIp) { return findOneBy(sc); } + @Override + public PortForwardingRuleVO findByNetworkAndPorts(long networkId, int startPort, int endPort) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("networkId", networkId); + sc.setParameters("sourcePortStart", startPort); + sc.setParameters("sourcePortEnd", endPort); + return findOneBy(sc); + } + @Override public int expungeByVmList(List vmIds, Long batchSize) { if (CollectionUtils.isEmpty(vmIds)) { diff --git a/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java b/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java index d12b9f9443fd..59699cba1d40 100644 --- a/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java +++ b/engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java @@ -50,6 +50,9 @@ public class SecurityGroupVMMapVO implements InternalIdentity { @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false) private String guestIpAddress; + @Column(name = "ip6_address", table = "nics", insertable = false, updatable = false) + private String guestIpv6Address; + @Column(name = "state", table = "vm_instance", insertable = false, updatable = false) private State vmState; @@ -77,6 +80,10 @@ public String getGuestIpAddress() { return guestIpAddress; } + public String getGuestIpv6Address() { + return guestIpv6Address; + } + public long getInstanceId() { return instanceId; } diff --git a/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDao.java b/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDao.java index 793334731095..2b18bcbd87bd 100644 --- a/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDao.java +++ b/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDao.java @@ -31,4 +31,6 @@ public interface SecurityGroupDao extends GenericDao { List findByAccountAndNames(Long accountId, String... names); int removeByAccountId(long accountId); + + List listByIds(List ids); } diff --git a/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDaoImpl.java index 019cf5fec462..ffb45629b625 100644 --- a/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupDaoImpl.java @@ -129,4 +129,14 @@ public boolean expunge(Long id) { txn.commit(); return result; } + + @Override + public List listByIds(List ids) { + SearchBuilder idsSearch = createSearchBuilder(); + idsSearch.and("ids", idsSearch.entity().getId(), SearchCriteria.Op.IN); + idsSearch.done(); + SearchCriteria sc = idsSearch.create(); + sc.setParameters("ids", ids.toArray()); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java index 9a9ca80bce59..7ed0ad0bcc54 100644 --- a/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/security/dao/VmRulesetLogDaoImpl.java @@ -76,7 +76,6 @@ public VmRulesetLogVO findByVmId(long vmId) { @Override public int createOrUpdate(Set workItems) { - //return createOrUpdateUsingBatch(workItems); return createOrUpdateUsingMultiInsert(workItems); } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/StaticRouteVO.java b/engine/schema/src/main/java/com/cloud/network/vpc/StaticRouteVO.java index 2246bd6eed25..632d96819cd3 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/StaticRouteVO.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/StaticRouteVO.java @@ -27,6 +27,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import javax.persistence.Transient; import com.cloud.utils.db.GenericDao; @@ -42,7 +43,10 @@ public class StaticRouteVO implements StaticRoute { String uuid; @Column(name = "vpc_gateway_id", updatable = false) - long vpcGatewayId; + Long vpcGatewayId; + + @Column(name = "next_hop") + private String nextHop; @Column(name = "cidr") private String cidr; @@ -67,6 +71,9 @@ protected StaticRouteVO() { uuid = UUID.randomUUID().toString(); } + @Transient + boolean forVpn = false; + /** * @param vpcGatewayId * @param cidr @@ -74,7 +81,7 @@ protected StaticRouteVO() { * @param accountId TODO * @param domainId TODO */ - public StaticRouteVO(long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId) { + public StaticRouteVO(Long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId, String nextHop) { super(); this.vpcGatewayId = vpcGatewayId; this.cidr = cidr; @@ -82,14 +89,32 @@ public StaticRouteVO(long vpcGatewayId, String cidr, Long vpcId, long accountId, this.vpcId = vpcId; this.accountId = accountId; this.domainId = domainId; + this.nextHop = nextHop; + uuid = UUID.randomUUID().toString(); + } + + public StaticRouteVO(String cidr, Long vpcId, long accountId, long domainId, String nextHop, State state, boolean forVpn) { + super(); + this.cidr = cidr; + this.state = state; + this.vpcId = vpcId; + this.accountId = accountId; + this.domainId = domainId; + this.nextHop = nextHop; uuid = UUID.randomUUID().toString(); + this.forVpn = forVpn; } @Override - public long getVpcGatewayId() { + public Long getVpcGatewayId() { return vpcGatewayId; } + @Override + public String getNextHop() { + return nextHop; + } + @Override public String getCidr() { return cidr; @@ -145,4 +170,8 @@ public Class getEntityType() { public String getName() { return null; } + + public boolean isForVpn() { + return forVpn; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/VpcOfferingVO.java b/engine/schema/src/main/java/com/cloud/network/vpc/VpcOfferingVO.java index 274b9fedecce..b913468384e4 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/VpcOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/VpcOfferingVO.java @@ -60,9 +60,6 @@ public class VpcOfferingVO implements VpcOffering { @Column(name = "default") boolean isDefault = false; - @Column(name = "for_nsx") - boolean forNsx = false; - @Column(name = "network_mode") NetworkOffering.NetworkMode networkMode; @@ -94,6 +91,9 @@ public class VpcOfferingVO implements VpcOffering { @Column(name = "specify_as_number") private Boolean specifyAsNumber = false; + @Column(name = "conserve_mode") + private boolean conserveMode; + public VpcOfferingVO() { this.uuid = UUID.randomUUID().toString(); } @@ -159,14 +159,6 @@ public boolean isDefault() { return isDefault; } - public boolean isForNsx() { - return forNsx; - } - - public void setForNsx(boolean forNsx) { - this.forNsx = forNsx; - } - public NetworkOffering.NetworkMode getNetworkMode() { return networkMode; } @@ -253,4 +245,13 @@ public Boolean isSpecifyAsNumber() { public void setSpecifyAsNumber(Boolean specifyAsNumber) { this.specifyAsNumber = specifyAsNumber; } + + @Override + public boolean isConserveMode() { + return conserveMode; + } + + public void setConserveMode(boolean conserveMode) { + this.conserveMode = conserveMode; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/main/java/com/cloud/network/vpc/VpcVO.java index e8ccc2ebcf1c..742d3f2f82ee 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/VpcVO.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/VpcVO.java @@ -105,6 +105,12 @@ public class VpcVO implements Vpc { @Column(name = "ip6Dns2") String ip6Dns2; + @Column(name = "use_router_ip_resolver") + boolean useRouterIpResolver = false; + + @Column(name = "keep_mac_address_on_public_nic") + private boolean keepMacAddressOnPublicNic = true; + @Transient boolean rollingRestart = false; @@ -309,4 +315,22 @@ public String getIp6Dns1() { public String getIp6Dns2() { return ip6Dns2; } + + @Override + public boolean useRouterIpAsResolver() { + return useRouterIpResolver; + } + + public void setUseRouterIpResolver(boolean useRouterIpResolver) { + this.useRouterIpResolver = useRouterIpResolver; + } + + @Override + public boolean getKeepMacAddressOnPublicNic() { + return keepMacAddressOnPublicNic; + } + + public void setKeepMacAddressOnPublicNic(boolean keepMacAddressOnPublicNic) { + this.keepMacAddressOnPublicNic = keepMacAddressOnPublicNic; + } } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java index 06cfd25e670b..020536e97ec9 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDao.java @@ -18,6 +18,7 @@ import java.util.List; +import com.cloud.network.Network; import com.cloud.network.Network.Service; import com.cloud.network.vpc.VpcOfferingServiceMapVO; import com.cloud.utils.db.GenericDao; @@ -37,4 +38,8 @@ public interface VpcOfferingServiceMapDao extends GenericDao listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service); + } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java index c7400f6edfd5..dcb1becf9e88 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcOfferingServiceMapDaoImpl.java @@ -19,6 +19,7 @@ import java.util.List; +import com.cloud.network.Network; import org.springframework.stereotype.Component; import com.cloud.network.Network.Service; @@ -110,4 +111,22 @@ public VpcOfferingServiceMapVO findByServiceProviderAndOfferingId(String service return findOneBy(sc); } + + @Override + public boolean isProviderForVpcOffering(Network.Provider provider, long vpcOfferingId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vpcOffId", vpcOfferingId); + sc.setParameters("provider", provider.getName()); + return findOneBy(sc) != null; + } + + @Override + public List listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service) { + SearchCriteria sc = AllFieldsSearch.create(); + + sc.setParameters("vpcOffId", vpcOfferingId); + sc.setParameters("service", service.getName()); + + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java index 753c45fcc789..a5c4c83ff0fe 100644 --- a/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/network/vpc/dao/VpcServiceMapDaoImpl.java @@ -68,8 +68,15 @@ public boolean areServicesSupportedInVpc(long vpcId, Service... services) { @Override public boolean canProviderSupportServiceInVpc(long vpcId, Service service, Provider provider) { - // TODO Auto-generated method stub - return false; + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vpcId", vpcId); + sc.setParameters("service", service.getName()); + sc.setParameters("provider", provider.getName()); + if (findOneBy(sc) != null) { + return true; + } else { + return false; + } } @Override diff --git a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java index 5cad366945f3..904c8e646eb5 100644 --- a/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/offerings/NetworkOfferingVO.java @@ -134,12 +134,6 @@ public class NetworkOfferingVO implements NetworkOffering { @Column(name = "for_vpc") boolean forVpc; - @Column(name = "for_tungsten") - boolean forTungsten = false; - - @Column(name = "for_nsx") - boolean forNsx = false; - @Column(name = "network_mode") NetworkMode networkMode; @@ -200,24 +194,6 @@ public void setForVpc(boolean isForVpc) { this.forVpc = isForVpc; } - @Override - public boolean isForTungsten() { - return forTungsten; - } - - public void setForTungsten(boolean forTungsten) { - this.forTungsten = forTungsten; - } - - @Override - public boolean isForNsx() { - return forNsx; - } - - public void setForNsx(boolean forNsx) { - this.forNsx = forNsx; - } - @Override public NetworkMode getNetworkMode() { return networkMode; diff --git a/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDao.java b/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDao.java index 3724e03d9d06..cee5cc15e112 100644 --- a/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDao.java +++ b/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDao.java @@ -22,10 +22,13 @@ import com.cloud.utils.db.GenericDao; import org.apache.cloudstack.api.response.ResourceIconResponse; +import java.util.Collection; import java.util.List; public interface ResourceIconDao extends GenericDao { ResourceIconResponse newResourceIconResponse(ResourceIcon resourceIconVO); ResourceIconVO findByResourceUuid(String resourceUuid, ResourceTag.ResourceObjectType resourceType); + List listByResourceTypeAndIds(ResourceTag.ResourceObjectType resourceType, Collection resourceIds); + List listByResourceTypeAndUuids(ResourceTag.ResourceObjectType resourceType, Collection resourceUuids); List listResourceIcons(List resourceUuids, ResourceTag.ResourceObjectType resourceType); } diff --git a/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDaoImpl.java b/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDaoImpl.java index 1ae01bfc1ec2..49a1fe7a560a 100644 --- a/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/resource/icon/dao/ResourceIconDaoImpl.java @@ -24,8 +24,10 @@ import com.cloud.utils.db.SearchCriteria; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.response.ResourceIconResponse; +import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; +import java.util.Collection; import java.util.List; public class ResourceIconDaoImpl extends GenericDaoBase implements ResourceIconDao { @@ -58,11 +60,36 @@ public ResourceIconVO findByResourceUuid(String resourceUuid, ResourceTag.Resour } @Override - public List listResourceIcons(List resourceUuids, ResourceTag.ResourceObjectType resourceType) { + public List listByResourceTypeAndIds(ResourceTag.ResourceObjectType resourceType, + Collection resourceIds) { + if (CollectionUtils.isEmpty(resourceIds)) { + return new ArrayList<>(); + } + SearchBuilder sb = createSearchBuilder(); + sb.and("resourceId", sb.entity().getResourceId(), SearchCriteria.Op.IN); + sb.and("resourceType", sb.entity().getResourceType(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("resourceId", resourceIds.toArray()); + sc.setParameters("resourceType", resourceType); + return listBy(sc); + } + + @Override + public List listByResourceTypeAndUuids(ResourceTag.ResourceObjectType resourceType, + Collection resourceUuids) { + if (CollectionUtils.isEmpty(resourceUuids)) { + return new ArrayList<>(); + } SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("uuid", resourceUuids.toArray()); sc.setParameters("resourceType", resourceType); - List resourceIcons = listBy(sc); + return listBy(sc); + } + + @Override + public List listResourceIcons(List resourceUuids, ResourceTag.ResourceObjectType resourceType) { + List resourceIcons = listByResourceTypeAndUuids(resourceType, resourceUuids); List iconResponses = new ArrayList<>(); for (ResourceIconVO resourceIcon : resourceIcons) { ResourceIconResponse response = new ResourceIconResponse(); diff --git a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java index 7f5c1a7afa19..cfe8049f5b2c 100644 --- a/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/service/ServiceOfferingVO.java @@ -124,6 +124,15 @@ public class ServiceOfferingVO implements ServiceOffering { @Column(name = "dynamic_scaling_enabled") private boolean dynamicScalingEnabled = true; + @Column(name = "vgpu_profile_id") + private Long vgpuProfileId; + + @Column(name = "gpu_count") + private Integer gpuCount; + + @Column(name = "gpu_display") + private Boolean gpuDisplay; + // This is a delayed load value. If the value is null, // then this field has not been loaded yet. // Call service offering dao to load it. @@ -198,6 +207,8 @@ public ServiceOfferingVO(ServiceOfferingVO offering) { systemUse = offering.isSystemUse(); dynamicScalingEnabled = offering.isDynamicScalingEnabled(); diskOfferingStrictness = offering.diskOfferingStrictness; + vgpuProfileId = offering.vgpuProfileId; + gpuCount = offering.gpuCount; } @Override @@ -445,4 +456,30 @@ public Boolean getDiskOfferingStrictness() { public void setDiskOfferingStrictness(boolean diskOfferingStrictness) { this.diskOfferingStrictness = diskOfferingStrictness; } + + @Override + public Long getVgpuProfileId() { + return vgpuProfileId; + } + + public void setVgpuProfileId(Long vgpuProfileId) { + this.vgpuProfileId = vgpuProfileId; + } + + @Override + public Integer getGpuCount() { + return gpuCount; + } + + public void setGpuCount(Integer gpuCount) { + this.gpuCount = gpuCount; + } + + public Boolean getGpuDisplay() { + return gpuDisplay; + } + + public void setGpuDisplay(Boolean gpuDisplay) { + this.gpuDisplay = gpuDisplay; + } } diff --git a/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDao.java b/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDao.java index ceb5b0a4fc1c..d3bab4fcbe27 100644 --- a/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDao.java +++ b/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDao.java @@ -22,6 +22,7 @@ import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.Storage.ProvisioningType; import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.SearchBuilder; import com.cloud.vm.VirtualMachine; /* @@ -57,4 +58,6 @@ List createSystemServiceOfferings(String name, String uniqueN ServiceOfferingVO findServiceOfferingByComputeOnlyDiskOffering(long diskOfferingId, boolean includingRemoved); List listIdsByHostTag(String tag); + + void addCheckForGpuEnabled(SearchBuilder serviceOfferingSearch, Boolean gpuEnabled); } diff --git a/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java b/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java index 803522fa6aa6..f360770ad686 100644 --- a/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java @@ -39,7 +39,7 @@ import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.dao.UserVmDetailsDao; +import com.cloud.vm.dao.VMInstanceDetailsDao; @Component @DB() @@ -48,7 +48,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); + Map dynamicOffering = vmInstanceDetailsDao.listDetailsKeyPairs(vmId); return getComputeOffering(offering, dynamicOffering); } return offering; @@ -190,7 +190,7 @@ public ServiceOfferingVO findByIdIncludingRemoved(Long vmId, long serviceOfferin if (vmId == null) { throw new CloudRuntimeException("missing argument vmId"); } - Map dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); + Map dynamicOffering = vmInstanceDetailsDao.listDetailsKeyPairs(vmId); return getComputeOffering(offering, dynamicOffering); } return offering; @@ -312,4 +312,13 @@ public List listIdsByHostTag(String tag) { sc.setParameters("tagEndLike", "%," + tag); return customSearch(sc, null); } + + @Override + public void addCheckForGpuEnabled(SearchBuilder serviceOfferingSearch, Boolean gpuEnabled) { + if (gpuEnabled) { + serviceOfferingSearch.and("gpuEnabled", serviceOfferingSearch.entity().getVgpuProfileId(), SearchCriteria.Op.NNULL); + } else { + serviceOfferingSearch.and("gpuDisabled", serviceOfferingSearch.entity().getVgpuProfileId(), SearchCriteria.Op.NULL); + } + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/main/java/com/cloud/storage/DiskOfferingVO.java index 79f5bcb51578..7f6b6d8adf0e 100644 --- a/engine/schema/src/main/java/com/cloud/storage/DiskOfferingVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/DiskOfferingVO.java @@ -577,11 +577,11 @@ public Integer getHypervisorSnapshotReserve() { @Override public void setEncrypt(boolean encrypt) { this.encrypt = encrypt; } + @Override public boolean isShared() { return !useLocalStorage; } - public boolean getDiskSizeStrictness() { return diskSizeStrictness; } diff --git a/engine/schema/src/main/java/com/cloud/storage/GuestOSCategoryVO.java b/engine/schema/src/main/java/com/cloud/storage/GuestOSCategoryVO.java index 36773e351e36..642705ffcbe4 100644 --- a/engine/schema/src/main/java/com/cloud/storage/GuestOSCategoryVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/GuestOSCategoryVO.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.storage; +import java.util.Date; import java.util.UUID; import javax.persistence.Column; @@ -25,6 +26,8 @@ import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.utils.db.GenericDao; + @Entity @Table(name = "guest_os_category") public class GuestOSCategoryVO implements GuestOsCategory { @@ -39,6 +42,26 @@ public class GuestOSCategoryVO implements GuestOsCategory { @Column(name = "uuid") String uuid = UUID.randomUUID().toString(); + @Column(name = "featured") + boolean featured; + + @Column(name = "sort_key") + private int sortKey; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + public GuestOSCategoryVO() { + } + + public GuestOSCategoryVO(String name, boolean featured) { + this.name = name; + this.featured = featured; + } + @Override public long getId() { return id; @@ -59,7 +82,25 @@ public String getUuid() { return this.uuid; } - public void setUuid(String uuid) { - this.uuid = uuid; + @Override + public boolean isFeatured() { + return featured; + } + + public void setFeatured(Boolean featured) { + this.featured = featured; + } + + public void setSortKey(int key) { + sortKey = key; + } + + public int getSortKey() { + return sortKey; + } + + @Override + public Date getCreated() { + return created; } } diff --git a/engine/schema/src/main/java/com/cloud/storage/SnapshotPolicyVO.java b/engine/schema/src/main/java/com/cloud/storage/SnapshotPolicyVO.java index f57d9d3dccf2..299c6380ab63 100644 --- a/engine/schema/src/main/java/com/cloud/storage/SnapshotPolicyVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/SnapshotPolicyVO.java @@ -59,6 +59,12 @@ public class SnapshotPolicyVO implements SnapshotPolicy { @Column(name = "uuid") String uuid; + @Column(name = "account_id") + long accountId; + + @Column(name = "domain_id") + long domainId; + @Column(name = "display", updatable = true, nullable = false) protected boolean display = true; @@ -66,7 +72,7 @@ public SnapshotPolicyVO() { this.uuid = UUID.randomUUID().toString(); } - public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps, boolean display) { + public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps, long accountId, long domainId, boolean display) { this.volumeId = volumeId; this.schedule = schedule; this.timezone = timezone; @@ -75,6 +81,8 @@ public SnapshotPolicyVO(long volumeId, String schedule, String timezone, Interva this.active = true; this.display = display; this.uuid = UUID.randomUUID().toString(); + this.accountId = accountId; + this.domainId = domainId; } @Override @@ -160,4 +168,32 @@ public boolean isDisplay() { public void setDisplay(boolean display) { this.display = display; } + + @Override + public long getAccountId() { + return accountId; + } + + public void setAccountId(long accountId) { + this.accountId = accountId; + } + + @Override + public long getDomainId() { + return domainId; + } + + public void setDomainId(long domainId) { + this.domainId = domainId; + } + + @Override + public Class getEntityType() { + return SnapshotPolicy.class; + } + + @Override + public String getName() { + return null; + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/SnapshotVO.java b/engine/schema/src/main/java/com/cloud/storage/SnapshotVO.java index 19c67a91e2c8..4a504333344f 100644 --- a/engine/schema/src/main/java/com/cloud/storage/SnapshotVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/SnapshotVO.java @@ -284,6 +284,6 @@ public Class getEntityType() { public String toString() { return String.format("Snapshot %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields( - this, "id", "uuid", "name", "volumeId", "version")); + this, "id", "uuid", "name", "volumeId", "version", "state")); } } diff --git a/engine/schema/src/main/java/com/cloud/storage/StoragePoolAndAccessGroupMapVO.java b/engine/schema/src/main/java/com/cloud/storage/StoragePoolAndAccessGroupMapVO.java new file mode 100644 index 000000000000..5690324340c4 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/storage/StoragePoolAndAccessGroupMapVO.java @@ -0,0 +1,64 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.storage; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "storage_pool_and_access_group_map") +public class StoragePoolAndAccessGroupMapVO implements InternalIdentity { + + protected StoragePoolAndAccessGroupMapVO() { + } + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "pool_id") + private long poolId; + + @Column(name = "storage_access_group") + private String storageAccessGroup; + + public StoragePoolAndAccessGroupMapVO(long poolId, String storageAccessGroup) { + this.poolId = poolId; + this.storageAccessGroup = storageAccessGroup; + } + + @Override + public long getId() { + return this.id; + } + + public long getPoolId() { + return poolId; + } + + public String getStorageAccessGroup() { + return storageAccessGroup; + } + +} diff --git a/engine/schema/src/main/java/com/cloud/storage/StoragePoolHostVO.java b/engine/schema/src/main/java/com/cloud/storage/StoragePoolHostVO.java index 53c08322e0cf..73a11b02c050 100644 --- a/engine/schema/src/main/java/com/cloud/storage/StoragePoolHostVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/StoragePoolHostVO.java @@ -28,6 +28,7 @@ import javax.persistence.TemporalType; import com.cloud.utils.db.GenericDaoBase; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; /** * Join table for storage pools and hosts @@ -100,4 +101,9 @@ public void setLocalPath(String localPath) { this.localPath = localPath; } + @Override + public String toString() { + return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "hostId", "poolId"); + } + } diff --git a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java index 10d08601515b..88d3b7ba2d8d 100644 --- a/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java +++ b/engine/schema/src/main/java/com/cloud/storage/VMTemplateVO.java @@ -34,6 +34,7 @@ import com.cloud.cpu.CPU; import com.cloud.user.UserData; +import com.cloud.utils.UuidUtils; import org.apache.cloudstack.util.CPUArchConverter; import org.apache.cloudstack.util.HypervisorTypeConverter; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; @@ -162,6 +163,9 @@ public class VMTemplateVO implements VirtualMachineTemplate { @Column(name = "deploy_as_is") private boolean deployAsIs; + @Column(name = "for_cks") + private boolean forCks; + @Column(name = "user_data_id") private Long userDataId; @@ -173,6 +177,9 @@ public class VMTemplateVO implements VirtualMachineTemplate { @Convert(converter = CPUArchConverter.class) private CPU.CPUArch arch; + @Column(name = "extension_id") + private Long extensionId; + @Override public String getUniqueName() { return uniqueName; @@ -215,7 +222,7 @@ private VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled, boolean isDynamicallyScalable, boolean directDownload, - boolean deployAsIs, CPU.CPUArch arch) { + boolean deployAsIs, CPU.CPUArch arch, Long extensionId) { this(id, name, format, @@ -242,6 +249,7 @@ public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, this.directDownload = directDownload; this.deployAsIs = deployAsIs; this.arch = arch; + this.extensionId = extensionId; } public static VMTemplateVO createPreHostIso(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, @@ -337,7 +345,7 @@ private static String generateUniqueName(long id, long userId, String displayNam name.append("-"); name.append(userId); name.append("-"); - name.append(UUID.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString()); + name.append(UuidUtils.nameUUIDFromBytes((displayName + System.currentTimeMillis()).getBytes()).toString()); return name.toString(); } @@ -664,6 +672,14 @@ public void setDeployAsIs(boolean deployAsIs) { this.deployAsIs = deployAsIs; } + public boolean isForCks() { + return forCks; + } + + public void setForCks(boolean forCks) { + this.forCks = forCks; + } + @Override public Long getUserDataId() { return userDataId; @@ -691,4 +707,11 @@ public void setArch(CPU.CPUArch arch) { this.arch = arch; } + public Long getExtensionId() { + return extensionId; + } + + public void setExtensionId(Long extensionId) { + this.extensionId = extensionId; + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDao.java index f726bca3c5d6..ea97f663768f 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDao.java @@ -30,7 +30,9 @@ public interface DiskOfferingDao extends GenericDao { List listAllBySizeAndProvisioningType(long size, Storage.ProvisioningType provisioningType); - List findCustomDiskOfferings(); + List listCustomDiskOfferings(); + List listByStorageTag(String tag); + List listAllActiveAndNonComputeDiskOfferings(); } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDaoImpl.java index 93e747662775..44e6551da17d 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/DiskOfferingDaoImpl.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.storage.dao; +import static org.apache.cloudstack.query.QueryService.SortKeyAscending; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -26,12 +28,14 @@ import javax.inject.Inject; import javax.persistence.EntityExistsException; +import com.cloud.offering.DiskOffering; import org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDao; import org.springframework.stereotype.Component; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.Storage; import com.cloud.utils.db.Attribute; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; @@ -45,6 +49,8 @@ public class DiskOfferingDaoImpl extends GenericDaoBase im protected DiskOfferingDetailsDao detailsDao; protected final SearchBuilder UniqueNameSearch; + protected final SearchBuilder ActiveAndNonComputeSearch; + private final String SizeDiskOfferingSearch = "SELECT * FROM disk_offering WHERE " + "disk_size = ? AND provisioning_type = ? AND removed IS NULL"; @@ -56,6 +62,11 @@ protected DiskOfferingDaoImpl() { UniqueNameSearch.and("name", UniqueNameSearch.entity().getUniqueName(), SearchCriteria.Op.EQ); UniqueNameSearch.done(); + ActiveAndNonComputeSearch = createSearchBuilder(); + ActiveAndNonComputeSearch.and("state", ActiveAndNonComputeSearch.entity().getState(), SearchCriteria.Op.EQ); + ActiveAndNonComputeSearch.and("computeOnly", ActiveAndNonComputeSearch.entity().isComputeOnly(), SearchCriteria.Op.EQ); + ActiveAndNonComputeSearch.done(); + _computeOnlyAttr = _allAttributes.get("computeOnly"); } @@ -130,13 +141,14 @@ public List listAllBySizeAndProvisioningType(long size, Storage. } @Override - public List findCustomDiskOfferings() { + public List listCustomDiskOfferings() { SearchBuilder sb = createSearchBuilder(); sb.and("customized", sb.entity().isCustomized(), SearchCriteria.Op.EQ); sb.done(); SearchCriteria sc = sb.create(); sc.setParameters("customized", true); - return listBy(sc); + Filter searchFilter = new Filter(DiskOfferingVO.class, "sortKey", SortKeyAscending.value()); + return listBy(sc, searchFilter); } @Override @@ -164,4 +176,12 @@ public List listByStorageTag(String tag) { sc.setParameters("tagEndLike", "%," + tag); return listBy(sc); } + + @Override + public List listAllActiveAndNonComputeDiskOfferings() { + SearchCriteria sc = ActiveAndNonComputeSearch.create(); + sc.setParameters("state", DiskOffering.State.Active); + sc.setParameters("computeOnly", false); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java index 6fad6c5c47ee..cc1c96aee52c 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSCategoryDaoImpl.java @@ -27,7 +27,6 @@ public class GuestOSCategoryDaoImpl extends GenericDaoBase implements GuestOSCategoryDao { protected GuestOSCategoryDaoImpl() { - } @Override diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDao.java index 13cd398073ad..f24f3f3b67c4 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDao.java @@ -16,14 +16,14 @@ // under the License. package com.cloud.storage.dao; +import java.util.List; +import java.util.Set; + import com.cloud.storage.GuestOS; import com.cloud.storage.GuestOSVO; import com.cloud.utils.Pair; import com.cloud.utils.db.GenericDao; -import java.util.List; -import java.util.Set; - public interface GuestOSDao extends GenericDao { GuestOSVO findOneByDisplayName(String displayName); @@ -35,5 +35,7 @@ public interface GuestOSDao extends GenericDao { List listByDisplayName(String displayName); - Pair, Integer> listGuestOSByCriteria(Long startIndex, Long pageSize, Long id, Long osCategoryId, String description, String keyword, Boolean forDisplay); + Pair, Integer> listGuestOSByCriteria(Long startIndex, Long pageSize, List ids, Long osCategoryId, String description, String keyword, Boolean forDisplay); + + List listIdsByCategoryId(final long categoryId); } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDaoImpl.java index efcaa482a676..09f8772fb59c 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/GuestOSDaoImpl.java @@ -25,19 +25,20 @@ import java.util.List; import java.util.Set; -import com.cloud.storage.GuestOS; -import com.cloud.utils.Pair; -import com.cloud.utils.db.DB; -import com.cloud.utils.db.TransactionLegacy; -import com.cloud.utils.exception.CloudRuntimeException; import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; +import com.cloud.storage.GuestOS; import com.cloud.storage.GuestOSVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.DB; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.exception.CloudRuntimeException; @Component public class GuestOSDaoImpl extends GenericDaoBase implements GuestOSDao { @@ -124,12 +125,12 @@ public List listByDisplayName(String displayName) { return listBy(sc); } - public Pair, Integer> listGuestOSByCriteria(Long startIndex, Long pageSize, Long id, Long osCategoryId, String description, String keyword, Boolean forDisplay) { + public Pair, Integer> listGuestOSByCriteria(Long startIndex, Long pageSize, List ids, Long osCategoryId, String description, String keyword, Boolean forDisplay) { final Filter searchFilter = new Filter(GuestOSVO.class, "displayName", true, startIndex, pageSize); final SearchCriteria sc = createSearchCriteria(); - if (id != null) { - sc.addAnd("id", SearchCriteria.Op.EQ, id); + if (CollectionUtils.isNotEmpty(ids)) { + sc.addAnd("id", SearchCriteria.Op.IN, ids.toArray()); } if (osCategoryId != null) { @@ -152,4 +153,14 @@ public Pair, Integer> listGuestOSByCriteria(Long startIn return new Pair<>(result.first(), result.second()); } + @Override + public List listIdsByCategoryId(final long categoryId) { + GenericSearchBuilder sb = createSearchBuilder(Long.class); + sb.selectFields(sb.entity().getId()); + sb.and("categoryId", sb.entity().getCategoryId(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("categoryId", categoryId); + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/LaunchPermissionDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/LaunchPermissionDaoImpl.java index b4fdb4b6394e..f154692c6c87 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/LaunchPermissionDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/LaunchPermissionDaoImpl.java @@ -143,7 +143,7 @@ public List listPermittedTemplates(long accountId) { permittedTemplates.add(template); } } catch (Exception e) { - logger.warn("Error listing permitted templates", e); + logger.warn("Error listing permitted Templates", e); } return permittedTemplates; } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDao.java index 171634fb1044..f851f158331e 100755 --- a/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDao.java @@ -47,6 +47,8 @@ public interface SnapshotDao extends GenericDao, StateDao listAllByStatus(Snapshot.State... status); + List listAllByStatusIncludingRemoved(Snapshot.State... status); + void updateVolumeIds(long oldVolId, long newVolId); List listByStatusNotIn(long volumeId, Snapshot.State... status); @@ -58,4 +60,6 @@ public interface SnapshotDao extends GenericDao, StateDao listByIds(Object... ids); List searchByVolumes(List volumeIds); + + List listByVolumeIdAndTypeNotInAndStateNotRemoved(long volumeId, Type... type); } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDaoImpl.java index f5fc9c47d036..f167b5731878 100755 --- a/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/SnapshotDaoImpl.java @@ -19,6 +19,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; @@ -56,6 +57,10 @@ public class SnapshotDaoImpl extends GenericDaoBase implements private static final String GET_LAST_SNAPSHOT = "SELECT snapshots.id FROM snapshot_store_ref, snapshots where snapshots.id = snapshot_store_ref.snapshot_id AND snapshosts.volume_id = ? AND snapshot_store_ref.role = ? ORDER BY created DESC"; + private static final String VOLUME_ID = "volumeId"; + private static final String NOT_TYPE = "notType"; + private static final String STATUS = "status"; + private SearchBuilder snapshotIdsSearch; private SearchBuilder VolumeIdSearch; private SearchBuilder VolumeIdTypeSearch; @@ -66,6 +71,8 @@ public class SnapshotDaoImpl extends GenericDaoBase implements private SearchBuilder StatusSearch; private SearchBuilder notInStatusSearch; private GenericSearchBuilder CountSnapshotsByAccount; + + private SearchBuilder volumeIdAndTypeNotInSearch; @Inject ResourceTagDao _tagsDao; @Inject @@ -163,6 +170,7 @@ protected void init() { CountSnapshotsByAccount.select(null, Func.COUNT, null); CountSnapshotsByAccount.and("account", CountSnapshotsByAccount.entity().getAccountId(), SearchCriteria.Op.EQ); CountSnapshotsByAccount.and("status", CountSnapshotsByAccount.entity().getState(), SearchCriteria.Op.NIN); + CountSnapshotsByAccount.and("snapshotTypeNEQ", CountSnapshotsByAccount.entity().getSnapshotType(), SearchCriteria.Op.NIN); CountSnapshotsByAccount.and("removed", CountSnapshotsByAccount.entity().getRemoved(), SearchCriteria.Op.NULL); CountSnapshotsByAccount.done(); @@ -181,6 +189,12 @@ protected void init() { InstanceIdSearch.join("instanceSnapshots", volumeSearch, volumeSearch.entity().getId(), InstanceIdSearch.entity().getVolumeId(), JoinType.INNER); InstanceIdSearch.done(); + + volumeIdAndTypeNotInSearch = createSearchBuilder(); + volumeIdAndTypeNotInSearch.and(VOLUME_ID, volumeIdAndTypeNotInSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); + volumeIdAndTypeNotInSearch.and(STATUS, volumeIdAndTypeNotInSearch.entity().getState(), SearchCriteria.Op.NEQ); + volumeIdAndTypeNotInSearch.and(NOT_TYPE, volumeIdAndTypeNotInSearch.entity().getTypeDescription(), SearchCriteria.Op.NOTIN); + volumeIdAndTypeNotInSearch.done(); } @Override @@ -207,6 +221,7 @@ public Long countSnapshotsForAccount(long accountId) { SearchCriteria sc = CountSnapshotsByAccount.create(); sc.setParameters("account", accountId); sc.setParameters("status", State.Error, State.Destroyed); + sc.setParameters("snapshotTypeNEQ", Snapshot.Type.GROUP.ordinal()); return customSearch(sc, null).get(0); } @@ -252,6 +267,13 @@ public List listAllByStatus(Snapshot.State... status) { return listBy(sc, null); } + @Override + public List listAllByStatusIncludingRemoved(Snapshot.State... status) { + SearchCriteria sc = StatusSearch.create(); + sc.setParameters("status", (Object[])status); + return listIncludingRemovedBy(sc, null); + } + @Override public List listByIds(Object... ids) { SearchCriteria sc = snapshotIdsSearch.create(); @@ -299,4 +321,14 @@ public List searchByVolumes(List volumeIds) { sc.setParameters("volumeIds", volumeIds.toArray()); return search(sc, null); } + + @Override + public List listByVolumeIdAndTypeNotInAndStateNotRemoved(long volumeId, Type... types) { + SearchCriteria sc = volumeIdAndTypeNotInSearch.create(); + sc.setParameters(VOLUME_ID, volumeId); + sc.setParameters(NOT_TYPE, Arrays.stream(types).map(Type::toString).toArray()); + sc.setParameters(STATUS, State.Destroyed); + + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDao.java new file mode 100644 index 000000000000..3ff797f7e741 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDao.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.storage.dao; + +import java.util.List; + +import com.cloud.storage.StoragePoolAndAccessGroupMapVO; + +import com.cloud.utils.db.GenericDao; + +public interface StoragePoolAndAccessGroupMapDao extends GenericDao { + + void persist(long poolId, List storageAccessGroups); + List getStorageAccessGroups(long poolId); + void deleteStorageAccessGroups(long poolId); + List listDistinctStorageAccessGroups(String name, String keyword); +} diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDaoImpl.java new file mode 100644 index 000000000000..63e82b79748d --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolAndAccessGroupMapDaoImpl.java @@ -0,0 +1,105 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.storage.dao; + +import java.util.ArrayList; +import java.util.List; + +import com.cloud.storage.StoragePoolAndAccessGroupMapVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.TransactionLegacy; + +public class StoragePoolAndAccessGroupMapDaoImpl extends GenericDaoBase implements StoragePoolAndAccessGroupMapDao { + + protected final SearchBuilder StoragePoolAccessGroupSearch; + + public StoragePoolAndAccessGroupMapDaoImpl() { + StoragePoolAccessGroupSearch = createSearchBuilder(); + StoragePoolAccessGroupSearch.and("poolId", StoragePoolAccessGroupSearch.entity().getPoolId(), SearchCriteria.Op.EQ); + StoragePoolAccessGroupSearch.done(); + } + + @Override + public void persist(long poolId, List storageAccessGroups) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + + txn.start(); + SearchCriteria sc = StoragePoolAccessGroupSearch.create(); + sc.setParameters("poolId", poolId); + expunge(sc); + + for (String sag : storageAccessGroups) { + sag = sag.trim(); + if (sag.length() > 0) { + StoragePoolAndAccessGroupMapVO vo = new StoragePoolAndAccessGroupMapVO(poolId, sag); + persist(vo); + } + } + txn.commit(); + } + + @Override + public List getStorageAccessGroups(long poolId) { + SearchCriteria sc = StoragePoolAccessGroupSearch.create(); + sc.setParameters("poolId", poolId); + + List results = search(sc, null); + List storagePoolAccessGroups = new ArrayList(results.size()); + for (StoragePoolAndAccessGroupMapVO result : results) { + storagePoolAccessGroups.add(result.getStorageAccessGroup()); + } + + return storagePoolAccessGroups; + } + + @Override + public void deleteStorageAccessGroups(long poolId) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + txn.start(); + SearchCriteria sc = StoragePoolAccessGroupSearch.create(); + sc.setParameters("poolId", poolId); + expunge(sc); + txn.commit(); + } + + @Override + public List listDistinctStorageAccessGroups(String name, String keyword) { + GenericSearchBuilder searchBuilder = createSearchBuilder(String.class); + + searchBuilder.select(null, SearchCriteria.Func.DISTINCT, searchBuilder.entity().getStorageAccessGroup()); + searchBuilder.and("name", searchBuilder.entity().getStorageAccessGroup(), SearchCriteria.Op.EQ); + searchBuilder.and("keyword", searchBuilder.entity().getStorageAccessGroup(), SearchCriteria.Op.LIKE); + searchBuilder.done(); + + SearchCriteria sc = searchBuilder.create(); + + if (name != null) { + sc.setParameters("name", name); + } + + if (keyword != null) { + sc.setParameters("keyword", "%" + keyword + "%"); + } + + return customSearch(sc, null); + } + +} diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDao.java index 639c2571541d..94e13ba2d56e 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDao.java @@ -30,6 +30,8 @@ public interface StoragePoolHostDao extends GenericDao public StoragePoolHostVO findByPoolHost(long poolId, long hostId); + List findByLocalPath(String path); + List listByHostStatus(long poolId, Status hostStatus); List findHostsConnectedToPools(List poolIds); diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDaoImpl.java index 5a466af348c3..55b5668bbc17 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/StoragePoolHostDaoImpl.java @@ -45,6 +45,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase PoolSearch; protected final SearchBuilder HostSearch; protected final SearchBuilder PoolHostSearch; + protected final SearchBuilder LocalPathSearch; protected SearchBuilder poolNotInClusterSearch; @@ -77,6 +78,9 @@ public StoragePoolHostDaoImpl() { PoolHostSearch.and("host_id", PoolHostSearch.entity().getHostId(), SearchCriteria.Op.EQ); PoolHostSearch.done(); + LocalPathSearch = createSearchBuilder(); + LocalPathSearch.and("local_path", LocalPathSearch.entity().getLocalPath(), SearchCriteria.Op.EQ); + LocalPathSearch.done(); } @PostConstruct @@ -117,6 +121,13 @@ public StoragePoolHostVO findByPoolHost(long poolId, long hostId) { return findOneIncludingRemovedBy(sc); } + @Override + public List findByLocalPath(String path) { + SearchCriteria sc = LocalPathSearch.create(); + sc.setParameters("local_path", path); + return listBy(sc); + } + @Override public List listByHostStatus(long poolId, Status hostStatus) { TransactionLegacy txn = TransactionLegacy.currentTxn(); diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDao.java index 3ac514530ced..aec06d6d0003 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDao.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; +import com.cloud.cpu.CPU; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage; import com.cloud.storage.VMTemplateVO; @@ -57,6 +58,8 @@ public interface VMTemplateDao extends GenericDao, StateDao< public List listInZoneByState(long dataCenterId, VirtualMachineTemplate.State... states); + public List listTemplateIsoByArchVnfAndZone(Long dataCenterId, CPU.CPUArch arch, Boolean isIso, Boolean isVnf); + public List listAllActive(); public List listByState(VirtualMachineTemplate.State... states); @@ -71,11 +74,15 @@ public interface VMTemplateDao extends GenericDao, StateDao< VMTemplateVO findSystemVMTemplate(long zoneId); - VMTemplateVO findSystemVMReadyTemplate(long zoneId, HypervisorType hypervisorType); + VMTemplateVO findSystemVMReadyTemplate(long zoneId, HypervisorType hypervisorType, String preferredArch); + + List findSystemVMReadyTemplates(long zoneId, HypervisorType hypervisorType, String preferredArch); VMTemplateVO findRoutingTemplate(HypervisorType type, String templateName); - VMTemplateVO findLatestTemplateByTypeAndHypervisor(HypervisorType hypervisorType, Storage.TemplateType type); + List findRoutingTemplates(HypervisorType type, String templateName, String preferredArch); + + VMTemplateVO findLatestTemplateByTypeAndHypervisorAndArch(HypervisorType hypervisorType, CPU.CPUArch arch, Storage.TemplateType type); public Long countTemplatesForAccount(long accountId); @@ -87,11 +94,18 @@ public interface VMTemplateDao extends GenericDao, StateDao< List listByParentTemplatetId(long parentTemplatetId); - VMTemplateVO findLatestTemplateByName(String name); + VMTemplateVO findLatestTemplateByName(String name, HypervisorType hypervisorType, CPU.CPUArch arch); List findTemplatesLinkedToUserdata(long userdataId); List listByIds(List ids); List listIdsByTemplateTag(String tag); + + List listIdsByExtensionId(long extensionId); + + VMTemplateVO findActiveSystemTemplateByHypervisorArchAndUrlPath(HypervisorType hypervisorType, + CPU.CPUArch arch, String urlPathSuffix); + + VMTemplateVO findByAccountAndName(Long accountId, String templateName); } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java index 7513848536b2..8c6e3fe0983f 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java @@ -17,10 +17,14 @@ package com.cloud.storage.dao; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.inject.Inject; import javax.naming.ConfigurationException; @@ -28,8 +32,10 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import com.cloud.cpu.CPU; import com.cloud.dc.dao.DataCenterDao; import com.cloud.domain.dao.DomainDao; import com.cloud.host.Host; @@ -47,6 +53,7 @@ import com.cloud.tags.ResourceTagVO; import com.cloud.tags.dao.ResourceTagDao; import com.cloud.template.VirtualMachineTemplate; +import com.cloud.utils.Pair; import com.cloud.utils.db.DB; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; @@ -93,7 +100,6 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem private SearchBuilder PublicIsoSearch; private SearchBuilder UserIsoSearch; private GenericSearchBuilder CountTemplatesByAccount; - // private SearchBuilder updateStateSearch; private SearchBuilder AllFieldsSearch; protected SearchBuilder ParentTemplateIdSearch; private SearchBuilder InactiveUnremovedTmpltSearch; @@ -111,6 +117,7 @@ public VMTemplateDaoImpl() { LatestTemplateByHypervisorTypeSearch = createSearchBuilder(); LatestTemplateByHypervisorTypeSearch.and("hypervisorType", LatestTemplateByHypervisorTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); LatestTemplateByHypervisorTypeSearch.and("templateType", LatestTemplateByHypervisorTypeSearch.entity().getTemplateType(), SearchCriteria.Op.EQ); + LatestTemplateByHypervisorTypeSearch.and("arch", LatestTemplateByHypervisorTypeSearch.entity().getArch(), SearchCriteria.Op.EQ); LatestTemplateByHypervisorTypeSearch.and("removed", LatestTemplateByHypervisorTypeSearch.entity().getRemoved(), SearchCriteria.Op.NULL); } @@ -238,10 +245,20 @@ public List listReadyTemplates() { @Override - public VMTemplateVO findLatestTemplateByName(String name) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("name", SearchCriteria.Op.EQ, name); - sc.addAnd("removed", SearchCriteria.Op.NULL); + public VMTemplateVO findLatestTemplateByName(String name, HypervisorType hypervisorType, CPU.CPUArch arch) { + SearchBuilder sb = createSearchBuilder(); + sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); + sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ); + sb.and("arch", sb.entity().getArch(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("name", name); + if (hypervisorType != null) { + sc.setParameters("hypervisorType", hypervisorType); + } + if (arch != null) { + sc.setParameters("arch", arch); + } Filter filter = new Filter(VMTemplateVO.class, "id", false, null, 1L); List templates = listBy(sc, filter); if ((templates != null) && !templates.isEmpty()) { @@ -301,7 +318,7 @@ public boolean configure(String name, Map params) throws Configu consoleProxyTmpltName = "routing"; } if (logger.isDebugEnabled()) { - logger.debug("Use console proxy template : " + consoleProxyTmpltName); + logger.debug("Use console proxy Template : " + consoleProxyTmpltName); } UniqueNameSearch = createSearchBuilder(); @@ -390,12 +407,6 @@ public boolean configure(String name, Map params) throws Configu CountTemplatesByAccount.and("state", CountTemplatesByAccount.entity().getState(), SearchCriteria.Op.EQ); CountTemplatesByAccount.done(); - // updateStateSearch = this.createSearchBuilder(); - // updateStateSearch.and("id", updateStateSearch.entity().getId(), Op.EQ); - // updateStateSearch.and("state", updateStateSearch.entity().getState(), Op.EQ); - // updateStateSearch.and("updatedCount", updateStateSearch.entity().getUpdatedCount(), Op.EQ); - // updateStateSearch.done(); - AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ); AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ); @@ -446,7 +457,7 @@ public void saveDetails(VMTemplateVO tmpl) { if (detailsStr == null) { return; } - List details = new ArrayList(); + List details = new ArrayList<>(); for (String key : detailsStr.keySet()) { VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key), true); details.add(detail); @@ -464,11 +475,11 @@ public long addTemplateToZone(VMTemplateVO tmplt, long zoneId) { VMTemplateVO tmplt2 = findById(tmplt.getId()); if (tmplt2 == null) { if (persist(tmplt) == null) { - throw new CloudRuntimeException("Failed to persist the template " + tmplt); + throw new CloudRuntimeException("Failed to persist the Template " + tmplt); } if (tmplt.getDetails() != null) { - List details = new ArrayList(); + List details = new ArrayList<>(); for (String key : tmplt.getDetails().keySet()) { details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key), true)); } @@ -508,6 +519,48 @@ public List listInZoneByState(long dataCenterId, VirtualMachineTem return listBy(sc); } + @Override + public List listTemplateIsoByArchVnfAndZone(Long dataCenterId, CPU.CPUArch arch, Boolean isIso, + Boolean isVnf) { + GenericSearchBuilder sb = createSearchBuilder(Long.class); + sb.select(null, Func.DISTINCT, sb.entity().getGuestOSId()); + sb.and("state", sb.entity().getState(), SearchCriteria.Op.IN); + sb.and("type", sb.entity().getTemplateType(), SearchCriteria.Op.IN); + sb.and("arch", sb.entity().getArch(), SearchCriteria.Op.EQ); + if (isIso != null) { + sb.and("isIso", sb.entity().getFormat(), isIso ? SearchCriteria.Op.EQ : SearchCriteria.Op.NEQ); + } + if (dataCenterId != null) { + SearchBuilder templateZoneSearch = _templateZoneDao.createSearchBuilder(); + templateZoneSearch.and("removed", templateZoneSearch.entity().getRemoved(), SearchCriteria.Op.NULL); + templateZoneSearch.and("zoneId", templateZoneSearch.entity().getZoneId(), SearchCriteria.Op.EQ); + sb.join("templateZoneSearch", templateZoneSearch, templateZoneSearch.entity().getTemplateId(), + sb.entity().getId(), JoinBuilder.JoinType.INNER); + templateZoneSearch.done(); + } + sb.done(); + SearchCriteria sc = sb.create(); + List types = new ArrayList<>(Arrays.asList(TemplateType.USER, TemplateType.BUILTIN, + TemplateType.PERHOST)); + if (isVnf == null) { + types.add(TemplateType.VNF); + } else if (isVnf) { + types = Collections.singletonList(TemplateType.VNF); + } + sc.setParameters("type", types.toArray()); + sc.setParameters("state", VirtualMachineTemplate.State.Active); + if (dataCenterId != null) { + sc.setJoinParameters("templateZoneSearch", "zoneId", dataCenterId); + } + if (arch != null) { + sc.setParameters("arch", arch); + } + if (isIso != null) { + sc.setParameters("isIso", ImageFormat.ISO); + } + return customSearch(sc, null); + } + @Override public List listAllActive() { SearchCriteria sc = ActiveTmpltSearch.create(); @@ -566,11 +619,19 @@ public List listAllReadySystemVMTemplates(Long zoneId) { } @Override - public VMTemplateVO findSystemVMReadyTemplate(long zoneId, HypervisorType hypervisorType) { + public VMTemplateVO findSystemVMReadyTemplate(long zoneId, HypervisorType hypervisorType, String preferredArch) { List templates = listAllReadySystemVMTemplates(zoneId); if (CollectionUtils.isEmpty(templates)) { return null; } + if (StringUtils.isNotBlank(preferredArch)) { + // Sort the templates by preferred architecture first + templates = templates.stream() + .sorted(Comparator.comparing( + x -> !x.getArch().getType().equalsIgnoreCase(preferredArch) + )) + .collect(Collectors.toList()); + } if (hypervisorType == HypervisorType.Any) { return templates.get(0); } @@ -580,6 +641,59 @@ public VMTemplateVO findSystemVMReadyTemplate(long zoneId, HypervisorType hyperv .orElse(null); } + protected List getSortedTemplatesListWithPreferredArch( + Map, VMTemplateVO> uniqueTemplates, String preferredArch) { + List result = new ArrayList<>(uniqueTemplates.values()); + if (StringUtils.isNotBlank(preferredArch)) { + result.sort((t1, t2) -> { + boolean t1Preferred = t1.getArch().getType().equalsIgnoreCase(preferredArch); + boolean t2Preferred = t2.getArch().getType().equalsIgnoreCase(preferredArch); + if (t1Preferred && !t2Preferred) { + return -1; // t1 comes before t2 + } else if (!t1Preferred && t2Preferred) { + return 1; // t2 comes before t1 + } else { + // Both are either preferred or not preferred; use template id as a secondary sorting key. + return Long.compare(t1.getId(), t2.getId()); + } + }); + } else { + result.sort(Comparator.comparing(VMTemplateVO::getId).reversed()); + } + return result; + } + + @Override + public List findSystemVMReadyTemplates(long zoneId, HypervisorType hypervisorType, + String preferredArch) { + List> availableHypervisors = _hostDao.listDistinctHypervisorArchTypes(zoneId); + if (CollectionUtils.isEmpty(availableHypervisors)) { + return Collections.emptyList(); + } + SearchCriteria sc = readySystemTemplateSearch.create(); + sc.setParameters("templateType", Storage.TemplateType.SYSTEM); + sc.setParameters("state", VirtualMachineTemplate.State.Active); + if (hypervisorType != null && !HypervisorType.Any.equals(hypervisorType)) { + sc.setParameters("hypervisorType", List.of(hypervisorType).toArray()); + } else { + sc.setParameters("hypervisorType", + availableHypervisors.stream().map(Pair::first).distinct().toArray()); + } + sc.setJoinParameters("vmTemplateJoinTemplateStoreRef", "downloadState", + List.of(VMTemplateStorageResourceAssoc.Status.DOWNLOADED, + VMTemplateStorageResourceAssoc.Status.BYPASSED).toArray()); + // order by descending order of id + List templates = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, null)); + Map, VMTemplateVO> uniqueTemplates = new HashMap<>(); + for (VMTemplateVO template : templates) { + Pair key = new Pair<>(template.getHypervisorType(), template.getArch()); + if (availableHypervisors.contains(key) && !uniqueTemplates.containsKey(key)) { + uniqueTemplates.put(key, template); + } + } + return getSortedTemplatesListWithPreferredArch(uniqueTemplates, preferredArch); + } + @Override public VMTemplateVO findRoutingTemplate(HypervisorType hType, String templateName) { SearchCriteria sc = tmpltTypeHyperSearch2.create(); @@ -618,10 +732,43 @@ public VMTemplateVO findRoutingTemplate(HypervisorType hType, String templateNam } @Override - public VMTemplateVO findLatestTemplateByTypeAndHypervisor(HypervisorType hypervisorType, TemplateType type) { + public List findRoutingTemplates(HypervisorType hType, String templateName, String preferredArch) { + SearchCriteria sc = tmpltTypeHyperSearch2.create(); + sc.setParameters("templateType", TemplateType.ROUTING); + sc.setParameters("hypervisorType", hType); + sc.setParameters("state", VirtualMachineTemplate.State.Active.toString()); + if (templateName != null) { + sc.setParameters("templateName", templateName); + } + List templates = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, 1L)); + if (CollectionUtils.isEmpty(templates)) { + sc = tmpltTypeHyperSearch2.create(); + sc.setParameters("templateType", TemplateType.SYSTEM); + sc.setParameters("hypervisorType", hType); + sc.setParameters("state", VirtualMachineTemplate.State.Active.toString()); + if (templateName != null) { + sc.setParameters("templateName", templateName); + } + templates = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, 1L)); + } + Map, VMTemplateVO> uniqueTemplates = new HashMap<>(); + for (VMTemplateVO template : templates) { + Pair key = new Pair<>(template.getHypervisorType(), template.getArch()); + if (!uniqueTemplates.containsKey(key)) { + uniqueTemplates.put(key, template); + } + } + return getSortedTemplatesListWithPreferredArch(uniqueTemplates, preferredArch); + } + + @Override + public VMTemplateVO findLatestTemplateByTypeAndHypervisorAndArch(HypervisorType hypervisorType, CPU.CPUArch arch, TemplateType type) { SearchCriteria sc = LatestTemplateByHypervisorTypeSearch.create(); sc.setParameters("hypervisorType", hypervisorType); sc.setParameters("templateType", type); + if (arch != null) { + sc.setParameters("arch", arch); + } Filter filter = new Filter(VMTemplateVO.class, "id", false, null, 1L); List templates = listBy(sc, filter); if (templates != null && !templates.isEmpty()) { @@ -696,6 +843,48 @@ public List listIdsByTemplateTag(String tag) { return customSearchIncludingRemoved(sc, null); } + @Override + public List listIdsByExtensionId(long extensionId) { + GenericSearchBuilder sb = createSearchBuilder(Long.class); + sb.selectFields(sb.entity().getId()); + sb.and("extensionId", sb.entity().getExtensionId(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("extensionId", extensionId); + return customSearch(sc, null); + } + + @Override + public VMTemplateVO findActiveSystemTemplateByHypervisorArchAndUrlPath(HypervisorType hypervisorType, + CPU.CPUArch arch, String urlPathSuffix) { + if (StringUtils.isBlank(urlPathSuffix)) { + return null; + } + SearchBuilder sb = createSearchBuilder(); + sb.and("templateType", sb.entity().getTemplateType(), SearchCriteria.Op.EQ); + sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ); + sb.and("arch", sb.entity().getArch(), SearchCriteria.Op.EQ); + sb.and("urlPathSuffix", sb.entity().getUrl(), SearchCriteria.Op.LIKE); + sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("templateType", TemplateType.SYSTEM); + if (hypervisorType != null) { + sc.setParameters("hypervisorType", hypervisorType); + } + if (arch != null) { + sc.setParameters("arch", arch); + } + sc.setParameters("urlPathSuffix", "%" + urlPathSuffix); + sc.setParameters("state", VirtualMachineTemplate.State.Active); + Filter filter = new Filter(VMTemplateVO.class, "id", false, null, 1L); + List templates = listBy(sc, filter); + if (CollectionUtils.isNotEmpty(templates)) { + return templates.get(0); + } + return null; + } + @Override public boolean updateState( com.cloud.template.VirtualMachineTemplate.State currentState, @@ -751,9 +940,17 @@ public boolean updateState( .append("; updatedTime=") .append(oldUpdatedTime); } else { - logger.debug("Unable to update template: id=" + vo.getId() + ", as no such template exists in the database anymore"); + logger.debug("Unable to update Template: id=" + vo.getId() + ", as no such template exists in the database anymore"); } } return rows > 0; } + + @Override + public VMTemplateVO findByAccountAndName(Long accountId, String templateName) { + SearchCriteria sc = NameAccountIdSearch.create(); + sc.setParameters("name", templateName); + sc.setParameters("accountId", accountId); + return findOneBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDao.java index a3ce03a74c34..a208590e23a3 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDao.java @@ -35,6 +35,8 @@ public interface VMTemplatePoolDao extends GenericDao listByPoolIdAndState(long poolId, ObjectInDataStoreStateMachine.State state); + List listByPoolIdsAndTemplate(List poolIds, Long templateId); + List listByTemplateStatus(long templateId, VMTemplateStoragePoolVO.Status downloadState); List listByTemplateStatus(long templateId, VMTemplateStoragePoolVO.Status downloadState, long poolId); diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java index 5a2ec1163fb0..5dfc138d8e1b 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java @@ -150,6 +150,16 @@ public VMTemplateStoragePoolVO findByPoolTemplate(long poolId, long templateId, return findOneIncludingRemovedBy(sc); } + @Override + public List listByPoolIdsAndTemplate(List poolIds, Long templateId) { + SearchCriteria sc = PoolTemplateSearch.create(); + if (CollectionUtils.isNotEmpty(poolIds)) { + sc.setParameters("pool_id", poolIds.toArray()); + } + sc.setParameters("template_id", templateId); + return listBy(sc); + } + @Override public List listByTemplateStatus(long templateId, VMTemplateStoragePoolVO.Status downloadState) { SearchCriteria sc = TemplateStatusSearch.create(); diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java index e6ffca06f9e0..7d566a1ea01e 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java @@ -46,9 +46,11 @@ public interface VolumeDao extends GenericDao, StateDao findByInstanceAndType(long id, Volume.Type vType); + List findByInstanceAndNotStates(long id, Volume.State...states); + List findIncludingRemovedByInstanceAndType(long id, Volume.Type vType); - List findByInstanceIdAndPoolId(long instanceId, long poolId); + List findNonDestroyedVolumesByInstanceIdAndPoolId(long instanceId, long poolId); List findByInstanceIdDestroyed(long vmId); @@ -70,11 +72,11 @@ public interface VolumeDao extends GenericDao, StateDao findCreatedByInstance(long id); - List findByPoolId(long poolId); + List findNonDestroyedVolumesByPoolId(long poolId); VolumeVO findByPoolIdName(long poolId, String name); - List findByPoolId(long poolId, Volume.Type volumeType); + List findNonDestroyedVolumesByPoolId(long poolId, Volume.Type volumeType); List findByPoolIdAndState(long poolid, Volume.State state); @@ -162,4 +164,16 @@ public interface VolumeDao extends GenericDao, StateDao searchRemovedByVms(List vmIds, Long batchSize); VolumeVO findOneByIScsiName(String iScsiName); + + int getVolumeCountByOfferingId(long diskOfferingId); + + VolumeVO findByLastIdAndState(long lastVolumeId, Volume.State...states); + + /** + * Retrieves volume by its externalId + * + * @param externalUuid + * @return Volume Object of matching search criteria + */ + VolumeVO findByExternalUuid(String externalUuid); } diff --git a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java index 750dbf2bee0f..91f1c7f5eb69 100644 --- a/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java @@ -49,6 +49,7 @@ import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; @@ -73,10 +74,12 @@ public class VolumeDaoImpl extends GenericDaoBase implements Vol private final SearchBuilder storeAndInstallPathSearch; private final SearchBuilder volumeIdSearch; protected GenericSearchBuilder CountByAccount; + protected final SearchBuilder ExternalUuidSearch; protected GenericSearchBuilder primaryStorageSearch; protected GenericSearchBuilder primaryStorageSearch2; protected GenericSearchBuilder secondaryStorageSearch; private final SearchBuilder poolAndPathSearch; + final GenericSearchBuilder CountByOfferingId; @Inject ReservationDao reservationDao; @@ -134,7 +137,7 @@ public List findByInstanceAndDeviceId(long instanceId, long deviceId) } @Override - public List findByPoolId(long poolId) { + public List findNonDestroyedVolumesByPoolId(long poolId) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("poolId", poolId); sc.setParameters("notDestroyed", Volume.State.Destroy, Volume.State.Expunged); @@ -143,7 +146,7 @@ public List findByPoolId(long poolId) { } @Override - public List findByInstanceIdAndPoolId(long instanceId, long poolId) { + public List findNonDestroyedVolumesByInstanceIdAndPoolId(long instanceId, long poolId) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("instanceId", instanceId); sc.setParameters("poolId", poolId); @@ -160,7 +163,7 @@ public VolumeVO findByPoolIdName(long poolId, String name) { } @Override - public List findByPoolId(long poolId, Volume.Type volumeType) { + public List findNonDestroyedVolumesByPoolId(long poolId, Volume.Type volumeType) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("poolId", poolId); sc.setParameters("notDestroyed", Volume.State.Destroy, Volume.State.Expunged); @@ -205,6 +208,17 @@ public List findByInstanceAndType(long id, Type vType) { return listBy(sc); } + @Override + public List findByInstanceAndNotStates(long id, Volume.State...states) { + SearchBuilder sb = createSearchBuilder(); + sb.and("instanceId", sb.entity().getInstanceId(), Op.EQ); + sb.and("state", sb.entity().getState(), Op.NIN); + SearchCriteria sc = sb.create(); + sc.setParameters("instanceId", id); + sc.setParameters("state", (Object[]) states); + return listBy(sc); + } + @Override public List findIncludingRemovedByInstanceAndType(long id, Type vType) { SearchCriteria sc = AllFieldsSearch.create(); @@ -381,7 +395,7 @@ public ImageFormat getImageFormat(Long volumeId) { public VolumeDaoImpl() { AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); + AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.IN); AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ); AllFieldsSearch.and("dcId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ); AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ); @@ -397,6 +411,7 @@ public VolumeDaoImpl() { AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.EQ); AllFieldsSearch.and("passphraseId", AllFieldsSearch.entity().getPassphraseId(), Op.EQ); AllFieldsSearch.and("iScsiName", AllFieldsSearch.entity().get_iScsiName(), Op.EQ); + AllFieldsSearch.and("path", AllFieldsSearch.entity().getPath(), Op.EQ); AllFieldsSearch.done(); RootDiskStateSearch = createSearchBuilder(); @@ -456,6 +471,10 @@ public VolumeDaoImpl() { CountByAccount.and("idNIN", CountByAccount.entity().getId(), Op.NIN); CountByAccount.done(); + ExternalUuidSearch = createSearchBuilder(); + ExternalUuidSearch.and("externalUuid", ExternalUuidSearch.entity().getExternalUuid(), Op.EQ); + ExternalUuidSearch.done(); + primaryStorageSearch = createSearchBuilder(SumCount.class); primaryStorageSearch.select("sum", Func.SUM, primaryStorageSearch.entity().getSize()); primaryStorageSearch.and("accountId", primaryStorageSearch.entity().getAccountId(), Op.EQ); @@ -504,6 +523,11 @@ public VolumeDaoImpl() { poolAndPathSearch.and("poolId", poolAndPathSearch.entity().getPoolId(), Op.EQ); poolAndPathSearch.and("path", poolAndPathSearch.entity().getPath(), Op.EQ); poolAndPathSearch.done(); + + CountByOfferingId = createSearchBuilder(Integer.class); + CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId()); + CountByOfferingId.and("diskOfferingId", CountByOfferingId.entity().getDiskOfferingId(), Op.EQ); + CountByOfferingId.done(); } @Override @@ -573,17 +597,16 @@ public long secondaryStorageUsedForAccount(long accountId) { @Override public List listVolumesToBeDestroyed() { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("state", Volume.State.Destroy); - - return listBy(sc); + return listVolumesToBeDestroyed(null); } @Override public List listVolumesToBeDestroyed(Date date) { SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("state", Volume.State.Destroy); - sc.setParameters("updateTime", date); + sc.setParameters("state", Volume.State.Destroy, Volume.State.Expunging); + if (date != null) { + sc.setParameters("updateTime", date); + } return listBy(sc); } @@ -820,6 +843,7 @@ public void updateAndRemoveVolume(VolumeVO volume) { if (volume.getState() != Volume.State.Destroy) { volume.setState(Volume.State.Destroy); volume.setPoolId(null); + volume.setPoolType(null); volume.setInstanceId(null); update(volume.getId(), volume); remove(volume.getId()); @@ -904,9 +928,33 @@ public List searchRemovedByVms(List vmIds, Long batchSize) { return searchIncludingRemoved(sc, filter, null, false); } + @Override public VolumeVO findOneByIScsiName(String iScsiName) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("iScsiName", iScsiName); return findOneIncludingRemovedBy(sc); } + + @Override + public int getVolumeCountByOfferingId(long diskOfferingId) { + SearchCriteria sc = CountByOfferingId.create(); + sc.setParameters("diskOfferingId", diskOfferingId); + List results = customSearch(sc, null); + return results.get(0); + } + + @Override + public VolumeVO findByLastIdAndState(long lastVolumeId, State ...states) { + QueryBuilder sc = QueryBuilder.create(VolumeVO.class); + sc.and(sc.entity().getLastId(), SearchCriteria.Op.EQ, lastVolumeId); + sc.and(sc.entity().getState(), SearchCriteria.Op.IN, (Object[]) states); + return sc.find(); + } + + @Override + public VolumeVO findByExternalUuid(String externalUuid) { + SearchCriteria sc = ExternalUuidSearch.create(); + sc.setParameters("externalUuid", externalUuid); + return findOneBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagDao.java b/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagDao.java index bacb09b98793..5efaea40a943 100644 --- a/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagDao.java +++ b/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagDao.java @@ -20,11 +20,13 @@ import java.util.Map; import java.util.Set; +import org.apache.cloudstack.api.response.ResourceTagResponse; + import com.cloud.server.ResourceTag; import com.cloud.server.ResourceTag.ResourceObjectType; import com.cloud.tags.ResourceTagVO; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.response.ResourceTagResponse; public interface ResourceTagDao extends GenericDao { @@ -60,4 +62,13 @@ public interface ResourceTagDao extends GenericDao { void removeByResourceIdAndKey(long resourceId, ResourceObjectType resourceType, String key); List listByResourceUuid(String resourceUuid); + + List listByResourceTypeKeyPrefixAndOwners(ResourceObjectType resourceType, String key, + List accountIds, List domainIds, + Filter filter); + + ResourceTagVO findByResourceTypeKeyPrefixAndValue(ResourceObjectType resourceType, String key, String value); + + List listByResourceTypeIdAndKeyPrefix(ResourceObjectType resourceType, long resourceId, String key); + } diff --git a/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagsDaoImpl.java b/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagsDaoImpl.java index cc9d99e6ab16..22c7b7b2ee5b 100644 --- a/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagsDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/tags/dao/ResourceTagsDaoImpl.java @@ -16,19 +16,22 @@ // under the License. package com.cloud.tags.dao; -import java.util.List; -import java.util.Set; -import java.util.Map; import java.util.HashMap; import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.cloudstack.api.response.ResourceTagResponse; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; import com.cloud.server.ResourceTag; import com.cloud.server.ResourceTag.ResourceObjectType; import com.cloud.tags.ResourceTagVO; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; @@ -120,4 +123,62 @@ public List listByResourceUuid(String resourceUuid) { sc.setParameters("resourceUuid", resourceUuid); return listBy(sc); } + + @Override + public List listByResourceTypeKeyPrefixAndOwners(ResourceObjectType resourceType, String key, + List accountIds, List domainIds, + Filter filter) { + GenericSearchBuilder sb = createSearchBuilder(String.class); + sb.select(null, SearchCriteria.Func.DISTINCT, sb.entity().getValue()); + sb.and("resourceType", sb.entity().getResourceType(), Op.EQ); + sb.and("key", sb.entity().getKey(), Op.LIKE); + boolean accountIdsNotEmpty = CollectionUtils.isNotEmpty(accountIds); + boolean domainIdsNotEmpty = CollectionUtils.isNotEmpty(domainIds); + if (accountIdsNotEmpty || domainIdsNotEmpty) { + sb.and().op("account", sb.entity().getAccountId(), SearchCriteria.Op.IN); + sb.or("domain", sb.entity().getDomainId(), SearchCriteria.Op.IN); + sb.cp(); + } + sb.done(); + final SearchCriteria sc = sb.create(); + sc.setParameters("resourceType", resourceType); + sc.setParameters("key", key + "%"); + if (accountIdsNotEmpty) { + sc.setParameters("account", accountIds.toArray()); + } + if (domainIdsNotEmpty) { + sc.setParameters("domain", domainIds.toArray()); + } + return customSearch(sc, filter); + } + + @Override + public ResourceTagVO findByResourceTypeKeyPrefixAndValue(ResourceObjectType resourceType, String key, + String value) { + SearchBuilder sb = createSearchBuilder(); + sb.and("resourceType", sb.entity().getResourceType(), Op.EQ); + sb.and("key", sb.entity().getKey(), Op.LIKE); + sb.and("value", sb.entity().getValue(), Op.EQ); + sb.done(); + final SearchCriteria sc = sb.create(); + sc.setParameters("resourceType", resourceType); + sc.setParameters("key", key + "%"); + sc.setParameters("value", value); + return findOneBy(sc); + } + + @Override + public List listByResourceTypeIdAndKeyPrefix(ResourceObjectType resourceType, long resourceId, + String key) { + SearchBuilder sb = createSearchBuilder(); + sb.and("resourceType", sb.entity().getResourceType(), Op.EQ); + sb.and("resourceId", sb.entity().getResourceId(), Op.EQ); + sb.and("key", sb.entity().getKey(), Op.LIKE); + sb.done(); + final SearchCriteria sc = sb.create(); + sc.setParameters("resourceType", resourceType); + sc.setParameters("resourceId", resourceId); + sc.setParameters("key", key + "%"); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java index 384826227af7..cccfbe8a0065 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java @@ -99,7 +99,7 @@ private static void initDB(String dbPropsFile, String rootPassword, String[] dat String username = dbProperties.getProperty(String.format("db.%s.username", database)); String password = dbProperties.getProperty(String.format("db.%s.password", database)); String dbName = dbProperties.getProperty(String.format("db.%s.name", database)); - System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=%s", dbName, host, port, username, password)); + System.out.println(String.format("========> Initializing database=%s with host=%s port=%s username=%s password=******", dbName, host, port, username)); List queries = new ArrayList(); queries.add(String.format("drop database if exists `%s`", dbName)); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java index 1e3b3a7e5ece..0e784d961b3d 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -33,11 +33,10 @@ import javax.inject.Inject; -import com.cloud.utils.FileUtil; import org.apache.cloudstack.utils.CloudStackVersion; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import com.cloud.upgrade.dao.DbUpgrade; import com.cloud.upgrade.dao.DbUpgradeSystemVmTemplate; @@ -90,8 +89,11 @@ import com.cloud.upgrade.dao.Upgrade41910to42000; import com.cloud.upgrade.dao.Upgrade42000to42010; import com.cloud.upgrade.dao.Upgrade42010to42100; +import com.cloud.upgrade.dao.Upgrade42100to42200; +import com.cloud.upgrade.dao.Upgrade42200to42210; import com.cloud.upgrade.dao.Upgrade420to421; import com.cloud.upgrade.dao.Upgrade421to430; +import com.cloud.upgrade.dao.Upgrade42210to42300; import com.cloud.upgrade.dao.Upgrade430to440; import com.cloud.upgrade.dao.Upgrade431to440; import com.cloud.upgrade.dao.Upgrade432to440; @@ -120,12 +122,17 @@ import com.cloud.upgrade.dao.VersionDaoImpl; import com.cloud.upgrade.dao.VersionVO; import com.cloud.upgrade.dao.VersionVO.Step; +import com.cloud.utils.FileUtil; import com.cloud.utils.component.SystemIntegrityChecker; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.GlobalLock; import com.cloud.utils.db.ScriptRunner; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.TransactionCallback; import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; + import com.google.common.annotations.VisibleForTesting; public class DatabaseUpgradeChecker implements SystemIntegrityChecker { @@ -234,6 +241,9 @@ public DatabaseUpgradeChecker() { .next("4.19.1.0", new Upgrade41910to42000()) .next("4.20.0.0", new Upgrade42000to42010()) .next("4.20.1.0", new Upgrade42010to42100()) + .next("4.21.0.0", new Upgrade42100to42200()) + .next("4.22.0.0", new Upgrade42200to42210()) + .next("4.22.1.0", new Upgrade42210to42300()) .build(); } @@ -249,7 +259,6 @@ protected void runScript(Connection conn, InputStream file) { LOGGER.error("Unable to execute upgrade script", e); throw new CloudRuntimeException("Unable to execute upgrade script", e); } - } @VisibleForTesting @@ -311,20 +320,20 @@ protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVer } protected void executeProcedureScripts() { - LOGGER.info(String.format("Executing Stored Procedure scripts that are under resource directory [%s].", PROCEDURES_DIRECTORY)); + LOGGER.info("Executing Stored Procedure scripts that are under resource directory [{}].", PROCEDURES_DIRECTORY); List filesPathUnderViewsDirectory = FileUtil.getFilesPathsUnderResourceDirectory(PROCEDURES_DIRECTORY); try (TransactionLegacy txn = TransactionLegacy.open("execute-procedure-scripts")) { Connection conn = txn.getConnection(); for (String filePath : filesPathUnderViewsDirectory) { - LOGGER.debug(String.format("Executing PROCEDURE script [%s].", filePath)); + LOGGER.debug("Executing PROCEDURE script [{}].", filePath); InputStream viewScript = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); runScript(conn, viewScript); } - LOGGER.info(String.format("Finished execution of PROCEDURE scripts that are under resource directory [%s].", PROCEDURES_DIRECTORY)); + LOGGER.info("Finished execution of PROCEDURE scripts that are under resource directory [{}].", PROCEDURES_DIRECTORY); } catch (SQLException e) { String message = String.format("Unable to execute PROCEDURE scripts due to [%s].", e.getMessage()); LOGGER.error(message, e); @@ -333,7 +342,7 @@ protected void executeProcedureScripts() { } private DbUpgrade[] executeUpgrades(CloudStackVersion dbVersion, CloudStackVersion currentVersion) { - LOGGER.info("Database upgrade must be performed from " + dbVersion + " to " + currentVersion); + LOGGER.info("Database upgrade must be performed from {} to {}", dbVersion, currentVersion); final DbUpgrade[] upgrades = calculateUpgradePath(dbVersion, currentVersion); @@ -346,8 +355,8 @@ private DbUpgrade[] executeUpgrades(CloudStackVersion dbVersion, CloudStackVersi private VersionVO executeUpgrade(DbUpgrade upgrade) { VersionVO version; - LOGGER.debug("Running upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade - .getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion()); + LOGGER.debug("Running upgrade {} to upgrade from {}-{} to {}", upgrade.getClass().getSimpleName(), upgrade.getUpgradableVersionRange()[0], upgrade + .getUpgradableVersionRange()[1], upgrade.getUpgradedVersion()); TransactionLegacy txn = TransactionLegacy.open("Upgrade"); txn.start(); try { @@ -379,6 +388,9 @@ private VersionVO executeUpgrade(DbUpgrade upgrade) { } finally { txn.close(); } + if (upgrade.refreshPoolConnectionsAfterUpgrade()) { + TransactionLegacy.refreshConnections(TransactionLegacy.CLOUD_DB); + } return version; } @@ -387,8 +399,8 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) { // Run the corresponding '-cleanup.sql' script txn = TransactionLegacy.open("Cleanup"); try { - LOGGER.info("Cleanup upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" + upgrade - .getUpgradableVersionRange()[1] + " to " + upgrade.getUpgradedVersion()); + LOGGER.info("Cleanup upgrade {} to upgrade from {}-{} to {}", upgrade.getClass().getSimpleName(), upgrade.getUpgradableVersionRange()[0], upgrade + .getUpgradableVersionRange()[1], upgrade.getUpgradedVersion()); txn.start(); Connection conn; @@ -403,7 +415,7 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) { if (scripts != null) { for (InputStream script : scripts) { runScript(conn, script); - LOGGER.debug("Cleanup script " + upgrade.getClass().getSimpleName() + " is executed successfully"); + LOGGER.debug("Cleanup script {} is executed successfully", upgrade.getClass().getSimpleName()); } } txn.commit(); @@ -413,27 +425,27 @@ private void executeUpgradeCleanup(DbUpgrade upgrade, VersionVO version) { version.setUpdated(new Date()); _dao.update(version.getId(), version); txn.commit(); - LOGGER.debug("Upgrade completed for version " + version.getVersion()); + LOGGER.debug("Upgrade completed for version {}", version.getVersion()); } finally { txn.close(); } } protected void executeViewScripts() { - LOGGER.info(String.format("Executing VIEW scripts that are under resource directory [%s].", VIEWS_DIRECTORY)); + LOGGER.info("Executing VIEW scripts that are under resource directory [{}].", VIEWS_DIRECTORY); List filesPathUnderViewsDirectory = FileUtil.getFilesPathsUnderResourceDirectory(VIEWS_DIRECTORY); try (TransactionLegacy txn = TransactionLegacy.open("execute-view-scripts")) { Connection conn = txn.getConnection(); for (String filePath : filesPathUnderViewsDirectory) { - LOGGER.debug(String.format("Executing VIEW script [%s].", filePath)); + LOGGER.debug("Executing VIEW script [{}].", filePath); InputStream viewScript = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); runScript(conn, viewScript); } - LOGGER.info(String.format("Finished execution of VIEW scripts that are under resource directory [%s].", VIEWS_DIRECTORY)); + LOGGER.info("Finished execution of VIEW scripts that are under resource directory [{}].", VIEWS_DIRECTORY); } catch (SQLException e) { String message = String.format("Unable to execute VIEW scripts due to [%s].", e.getMessage()); LOGGER.error(message, e); @@ -450,43 +462,101 @@ public void check() { throw new CloudRuntimeException("Unable to acquire lock to check for database integrity."); } - try { - initializeDatabaseEncryptors(); - - final CloudStackVersion dbVersion = CloudStackVersion.parse(_dao.getCurrentVersion()); - final String currentVersionValue = this.getClass().getPackage().getImplementationVersion(); + doUpgrades(lock); + } finally { + lock.releaseRef(); + } + } - if (StringUtils.isBlank(currentVersionValue)) { - return; + boolean isStandalone() throws CloudRuntimeException { + return Transaction.execute(new TransactionCallback<>() { + @Override + public Boolean doInTransaction(TransactionStatus status) { + String sql = "SELECT COUNT(*) FROM `cloud`.`mshost` WHERE `state` = 'UP'"; + try (Connection conn = TransactionLegacy.getStandaloneConnection(); + PreparedStatement pstmt = conn.prepareStatement(sql); + ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) { + int count = rs.getInt(1); + return count == 0; + } + } catch (SQLException e) { + String errorMessage = "Unable to check if the management server is running in standalone mode."; + LOGGER.error(errorMessage, e); + return false; + } catch (NullPointerException npe) { + String errorMessage = "Unable to check if the management server is running in standalone mode. Not able to get a Database connection."; + LOGGER.error(errorMessage, npe); + return false; } + return true; + } + }); + } - String csVersion = SystemVmTemplateRegistration.parseMetadataFile(); - final CloudStackVersion sysVmVersion = CloudStackVersion.parse(csVersion); - final CloudStackVersion currentVersion = CloudStackVersion.parse(currentVersionValue); - SystemVmTemplateRegistration.CS_MAJOR_VERSION = String.valueOf(sysVmVersion.getMajorRelease()) + "." + String.valueOf(sysVmVersion.getMinorRelease()); - SystemVmTemplateRegistration.CS_TINY_VERSION = String.valueOf(sysVmVersion.getPatchRelease()); + @VisibleForTesting + protected void doUpgrades(GlobalLock lock) { + try { + initializeDatabaseEncryptors(); - LOGGER.info("DB version = " + dbVersion + " Code Version = " + currentVersion); + final CloudStackVersion dbVersion = CloudStackVersion.parse(_dao.getCurrentVersion()); + final String currentVersionValue = getImplementationVersion(); - if (dbVersion.compareTo(currentVersion) > 0) { - throw new CloudRuntimeException("Database version " + dbVersion + " is higher than management software version " + currentVersionValue); - } + if (StringUtils.isBlank(currentVersionValue)) { + return; + } - if (dbVersion.compareTo(currentVersion) == 0) { - LOGGER.info("DB version and code version matches so no upgrade needed."); - return; - } + String csVersion = parseSystemVmMetadata(); + final CloudStackVersion sysVmVersion = CloudStackVersion.parse(csVersion); + final CloudStackVersion currentVersion = CloudStackVersion.parse(currentVersionValue); + SystemVmTemplateRegistration.CS_MAJOR_VERSION = sysVmVersion.getMajorRelease() + "." + sysVmVersion.getMinorRelease(); + SystemVmTemplateRegistration.CS_TINY_VERSION = String.valueOf(sysVmVersion.getPatchRelease()); + LOGGER.info("DB version = {} Code Version = {}", dbVersion, currentVersion); + + if (dbVersion.compareTo(currentVersion) > 0) { + throw new CloudRuntimeException("Database version " + dbVersion + " is higher than management software version " + currentVersionValue); + } + + if (dbVersion.compareTo(currentVersion) == 0) { + LOGGER.info("DB version and code version matches so no upgrade needed."); + return; + } + + if (isStandalone()) { upgrade(dbVersion, currentVersion); - } finally { - lock.unlock(); + } else { + String errorMessage = "Database upgrade is required but the management server is running in a clustered environment. " + + "Please perform the database upgrade when the management server is not running in a clustered environment."; + LOGGER.error(errorMessage); + handleClusteredUpgradeRequired(); // allow tests to override behavior } } finally { - lock.releaseRef(); + lock.unlock(); } } - private void initializeDatabaseEncryptors() { + /** + * Hook that is called when an upgrade is required but the management server is clustered. + * Default behavior is to exit the JVM, tests can override to throw instead. + */ + @VisibleForTesting + protected void handleClusteredUpgradeRequired() { + System.exit(5); // I would prefer ServerDaemon.abort(errorMessage) but that would create a dependency hell + } + + @VisibleForTesting + protected String getImplementationVersion() { + return this.getClass().getPackage().getImplementationVersion(); + } + + @VisibleForTesting + protected String parseSystemVmMetadata() { + return SystemVmTemplateRegistration.parseMetadataFile(); + } + + // Make this protected so tests can noop it out + protected void initializeDatabaseEncryptors() { TransactionLegacy txn = TransactionLegacy.open("initializeDatabaseEncryptors"); txn.start(); String errorMessage = "Unable to get the database connections"; @@ -515,7 +585,7 @@ private void decryptInit(Connection conn) throws SQLException { ResultSet result = pstmt.executeQuery()) { if (result.next()) { String init = result.getString(1); - LOGGER.info("init = " + DBEncryptionUtil.decrypt(init)); + LOGGER.info("init = {}", DBEncryptionUtil.decrypt(init)); } } } @@ -546,21 +616,11 @@ public String getUpgradedVersion() { return upgradedVersion; } - @Override - public boolean supportsRollingUpgrade() { - return false; - } - @Override public InputStream[] getPrepareScripts() { return new InputStream[0]; } - @Override - public void performDataMigration(Connection conn) { - - } - @Override public InputStream[] getCleanupScripts() { return new InputStream[0]; diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseVersionHierarchy.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseVersionHierarchy.java index 445a59310fb4..377b2f913755 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseVersionHierarchy.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseVersionHierarchy.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.upgrade; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -96,7 +97,9 @@ public DbUpgrade[] getPath(final CloudStackVersion fromVersion, final CloudStack // we cannot find the version specified, so get the // most recent one immediately before this version if (!contains(fromVersion)) { - return getPath(getRecentVersion(fromVersion), toVersion); + DbUpgrade[] dbUpgrades = getPath(getRecentVersion(fromVersion), toVersion); + return Arrays.stream(dbUpgrades).filter(up -> CloudStackVersion.compare(up.getUpgradedVersion(), fromVersion.toString()) > 0) + .toArray(DbUpgrade[]::new); } final Predicate predicate; diff --git a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java index 9b0e10cbbfcc..2acb4138d234 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/SystemVmTemplateRegistration.java @@ -16,18 +16,64 @@ // under the License. package com.cloud.upgrade; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.Date; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl; +import org.apache.cloudstack.framework.config.impl.ConfigurationVO; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDaoImpl; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDaoImpl; +import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; +import org.apache.cloudstack.utils.security.DigestHelper; +import org.apache.cloudstack.utils.server.ServerPropertiesUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.ini4j.Ini; + +import com.cloud.cpu.CPU; import com.cloud.dc.DataCenterVO; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.ClusterDaoImpl; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.DataCenterDaoImpl; +import com.cloud.dc.dao.DataCenterDetailsDao; +import com.cloud.dc.dao.DataCenterDetailsDaoImpl; import com.cloud.hypervisor.Hypervisor; import com.cloud.storage.DataStoreRole; +import com.cloud.storage.GuestOSVO; import com.cloud.storage.Storage; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateZoneVO; +import com.cloud.storage.dao.GuestOSDao; +import com.cloud.storage.dao.GuestOSDaoImpl; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VMTemplateDaoImpl; import com.cloud.storage.dao.VMTemplateZoneDao; @@ -36,6 +82,7 @@ import com.cloud.upgrade.dao.BasicTemplateDataStoreDaoImpl; import com.cloud.user.Account; import com.cloud.utils.DateUtil; +import com.cloud.utils.HttpUtils; import com.cloud.utils.Pair; import com.cloud.utils.UriUtils; import com.cloud.utils.db.GlobalLock; @@ -46,48 +93,10 @@ import com.cloud.utils.script.Script; import com.cloud.vm.dao.VMInstanceDao; import com.cloud.vm.dao.VMInstanceDaoImpl; -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; -import org.apache.cloudstack.framework.config.dao.ConfigurationDao; -import org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl; -import org.apache.cloudstack.framework.config.impl.ConfigurationVO; -import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; -import org.apache.cloudstack.storage.datastore.db.ImageStoreDaoImpl; -import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; -import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDaoImpl; -import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; -import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; -import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; -import org.apache.cloudstack.utils.security.DigestHelper; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; -import org.ini4j.Ini; - -import javax.inject.Inject; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.Connection; -import java.sql.Date; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; public class SystemVmTemplateRegistration { protected static Logger LOGGER = LogManager.getLogger(SystemVmTemplateRegistration.class); - private static final String MOUNT_COMMAND = "sudo mount -t nfs %s %s"; + private static final String MOUNT_COMMAND_BASE = "sudo mount -t nfs"; private static final String UMOUNT_COMMAND = "sudo umount %s"; private static final String RELATIVE_TEMPLATE_PATH = "./engine/schema/dist/systemvm-templates/"; private static final String ABSOLUTE_TEMPLATE_PATH = "/usr/share/cloudstack-management/templates/systemvm/"; @@ -96,13 +105,20 @@ public class SystemVmTemplateRegistration { private static final String METADATA_FILE = TEMPLATES_PATH + METADATA_FILE_NAME; public static final String TEMPORARY_SECONDARY_STORE = "tmp"; private static final String PARTIAL_TEMPLATE_FOLDER = String.format("/template/tmpl/%d/", Account.ACCOUNT_ID_SYSTEM); - private static final String storageScriptsDir = "scripts/storage/secondary"; + protected static final String STORAGE_SCRIPTS_DIR = "scripts/storage/secondary"; private static final Integer OTHER_LINUX_ID = 99; - private static final Integer LINUX_5_ID = 15; - private static final Integer LINUX_7_ID = 183; + protected static Integer LINUX_12_ID = 363; private static final Integer SCRIPT_TIMEOUT = 1800000; private static final Integer LOCK_WAIT_TIMEOUT = 1200; - + protected static final String TEMPLATE_DOWNLOAD_URL_KEY = "downloadurl"; + protected static final String TEMPLATES_DOWNLOAD_REPOSITORY_KEY = "downloadrepository"; + protected static final String TEMPLATES_CUSTOM_DOWNLOAD_REPOSITORY_KEY = "system.vm.templates.download.repository"; + protected static final List DOWNLOADABLE_TEMPLATE_ARCH_TYPES = Arrays.asList( + CPU.CPUArch.amd64, + CPU.CPUArch.arm64 + ); + protected static final String MINIMUM_SYSTEM_VM_VERSION_KEY = "minreq.sysvmtemplate.version"; + protected static final String DEFAULT_SYSTEM_VM_GUEST_OS_NAME = "Debian GNU/Linux 12 (64-bit)"; public static String CS_MAJOR_VERSION = null; public static String CS_TINY_VERSION = null; @@ -125,11 +141,18 @@ public class SystemVmTemplateRegistration { ClusterDao clusterDao; @Inject ConfigurationDao configurationDao; + @Inject + DataCenterDetailsDao dataCenterDetailsDao; + @Inject + GuestOSDao guestOSDao; private String systemVmTemplateVersion; + private final File tempDownloadDir; + public SystemVmTemplateRegistration() { dataCenterDao = new DataCenterDaoImpl(); + dataCenterDetailsDao = new DataCenterDetailsDaoImpl(); vmTemplateDao = new VMTemplateDaoImpl(); vmTemplateZoneDao = new VMTemplateZoneDaoImpl(); templateDataStoreDao = new BasicTemplateDataStoreDaoImpl(); @@ -138,32 +161,19 @@ public SystemVmTemplateRegistration() { imageStoreDetailsDao = new ImageStoreDetailsDaoImpl(); clusterDao = new ClusterDaoImpl(); configurationDao = new ConfigurationDaoImpl(); + guestOSDao = new GuestOSDaoImpl(); + tempDownloadDir = new File(System.getProperty("java.io.tmpdir")); } /** - * Convenience constructor method to use when there is no system VM template change for a new version. + * Convenience constructor method to use when there is no system VM Template change for a new version. */ public SystemVmTemplateRegistration(String systemVmTemplateVersion) { this(); this.systemVmTemplateVersion = systemVmTemplateVersion; } - public static String getMountCommand(String nfsVersion, String device, String dir) { - String cmd = "sudo mount -t nfs"; - if (StringUtils.isNotBlank(nfsVersion)) { - cmd = String.format("%s -o vers=%s", cmd, nfsVersion); - } - return String.format("%s %s %s", cmd, device, dir); - } - - public String getSystemVmTemplateVersion() { - if (StringUtils.isEmpty(systemVmTemplateVersion)) { - return String.format("%s.%s", CS_MAJOR_VERSION, CS_TINY_VERSION); - } - return systemVmTemplateVersion; - } - - private static class SystemVMTemplateDetails { + protected static class SystemVMTemplateDetails { Long id; String uuid; String name; @@ -174,6 +184,7 @@ private static class SystemVMTemplateDetails { ImageFormat format; Integer guestOsId; Hypervisor.HypervisorType hypervisorType; + CPU.CPUArch arch; Long storeId; Long size; Long physicalSize; @@ -183,7 +194,7 @@ private static class SystemVMTemplateDetails { SystemVMTemplateDetails(String uuid, String name, Date created, String url, String checksum, ImageFormat format, Integer guestOsId, Hypervisor.HypervisorType hypervisorType, - Long storeId) { + CPU.CPUArch arch, Long storeId) { this.uuid = uuid; this.name = name; this.created = created; @@ -192,6 +203,7 @@ private static class SystemVMTemplateDetails { this.format = format; this.guestOsId = guestOsId; this.hypervisorType = hypervisorType; + this.arch = arch; this.storeId = storeId; } @@ -235,6 +247,10 @@ public Hypervisor.HypervisorType getHypervisorType() { return hypervisorType; } + public CPU.CPUArch getArch() { + return arch; + } + public Long getStoreId() { return storeId; } @@ -288,20 +304,19 @@ public void setUpdated(Date updated) { } } - public static final List hypervisorList = Arrays.asList(Hypervisor.HypervisorType.KVM, - Hypervisor.HypervisorType.VMware, - Hypervisor.HypervisorType.XenServer, - Hypervisor.HypervisorType.Hyperv, - Hypervisor.HypervisorType.LXC, - Hypervisor.HypervisorType.Ovm3 + protected static final List> AVAILABLE_SYSTEM_TEMPLATES_HYPERVISOR_ARCH_LIST = Arrays.asList( + new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64), + new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64), + new Pair<>(Hypervisor.HypervisorType.VMware, CPU.CPUArch.amd64), + new Pair<>(Hypervisor.HypervisorType.XenServer, CPU.CPUArch.amd64), + new Pair<>(Hypervisor.HypervisorType.Hyperv, CPU.CPUArch.amd64), + new Pair<>(Hypervisor.HypervisorType.LXC, CPU.CPUArch.amd64), + new Pair<>(Hypervisor.HypervisorType.Ovm3, CPU.CPUArch.amd64) ); - public static final Map NewTemplateNameList = new HashMap(); - public static final Map FileNames = new HashMap(); - public static final Map NewTemplateUrl = new HashMap(); - public static final Map NewTemplateChecksum = new HashMap(); + protected static final List METADATA_TEMPLATE_LIST = new ArrayList<>(); - public static final Map RouterTemplateConfigurationNames = new HashMap() { + protected static final Map ROUTER_TEMPLATE_CONFIGURATION_NAMES = new HashMap<>() { { put(Hypervisor.HypervisorType.KVM, "router.template.kvm"); put(Hypervisor.HypervisorType.VMware, "router.template.vmware"); @@ -312,18 +327,7 @@ public void setUpdated(Date updated) { } }; - public static final Map hypervisorGuestOsMap = new HashMap() { - { - put(Hypervisor.HypervisorType.KVM, LINUX_5_ID); - put(Hypervisor.HypervisorType.XenServer, OTHER_LINUX_ID); - put(Hypervisor.HypervisorType.VMware, OTHER_LINUX_ID); - put(Hypervisor.HypervisorType.Hyperv, LINUX_5_ID); - put(Hypervisor.HypervisorType.LXC, LINUX_5_ID); - put(Hypervisor.HypervisorType.Ovm3, LINUX_7_ID); - } - }; - - public static final Map hypervisorImageFormat = new HashMap() { + protected static final Map HYPERVISOR_IMAGE_FORMAT_MAP = new HashMap<>() { { put(Hypervisor.HypervisorType.KVM, ImageFormat.QCOW2); put(Hypervisor.HypervisorType.XenServer, ImageFormat.VHD); @@ -334,92 +338,231 @@ public void setUpdated(Date updated) { } }; - public boolean validateIfSeeded(TemplateDataStoreVO templDataStoreVO, String url, String path, String nfsVersion) { - String filePath = null; - try { - filePath = Files.createTempDirectory(TEMPORARY_SECONDARY_STORE).toString(); - if (filePath == null) { - throw new CloudRuntimeException("Failed to create temporary directory to mount secondary store"); - } - mountStore(url, filePath, nfsVersion); - int lastIdx = path.lastIndexOf(File.separator); - String partialDirPath = path.substring(0, lastIdx); - String templatePath = filePath + File.separator + partialDirPath; - File templateProps = new File(templatePath + "/template.properties"); - if (templateProps.exists()) { - Pair templateSizes = readTemplatePropertiesSizes(templatePath + "/template.properties"); - updateSeededTemplateDetails(templDataStoreVO.getTemplateId(), templDataStoreVO.getDataStoreId(), - templateSizes.first(), templateSizes.second()); - LOGGER.info("SystemVM template already seeded, skipping registration"); - return true; - } - LOGGER.info("SystemVM template not seeded"); - return false; - } catch (Exception e) { - LOGGER.error("Failed to verify if the template is seeded", e); - throw new CloudRuntimeException("Failed to verify if the template is seeded", e); - } finally { - unmountStore(filePath); - try { - Files.delete(Path.of(filePath)); - } catch (IOException e) { - LOGGER.error(String.format("Failed to delete temporary directory: %s", filePath)); + protected static Map hypervisorGuestOsMap = new HashMap<>() { + { + put(Hypervisor.HypervisorType.KVM, LINUX_12_ID); + put(Hypervisor.HypervisorType.XenServer, OTHER_LINUX_ID); + put(Hypervisor.HypervisorType.VMware, OTHER_LINUX_ID); + put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID); + put(Hypervisor.HypervisorType.LXC, LINUX_12_ID); + put(Hypervisor.HypervisorType.Ovm3, LINUX_12_ID); + } + }; + + private static boolean isRunningInTest() { + return "true".equalsIgnoreCase(System.getProperty("test.mode")); + } + + private static String getHypervisorArchLog(Hypervisor.HypervisorType hypervisorType, CPU.CPUArch arch) { + StringBuilder sb = new StringBuilder("hypervisor: ").append(hypervisorType.name()); + sb.append(", arch: ").append(arch == null ? CPU.CPUArch.amd64.getType() : arch.getType()); + return sb.toString(); + } + + /** + * Attempts to determine the templates directory path by locating the metadata file. + *

    + * This method checks if the application is running in a test environment by invoking + * {@code isRunningInTest()}. If so, it immediately returns the {@code RELATIVE_TEMPLATE_PATH}. + *

    + *

    + * Otherwise, it creates a list of candidate paths (typically including both relative and absolute + * template paths) and iterates through them. For each candidate, it constructs the metadata file + * path by appending {@code METADATA_FILE_NAME} to {@code RELATIVE_TEMPLATE_PATH} (note: the candidate + * path is not used in the file path construction in this implementation) and checks if that file exists. + * If the metadata file exists, the candidate path is returned. + *

    + *

    + * If none of the candidate paths contain the metadata file, the method logs an error and throws a + * {@link CloudRuntimeException}. + *

    + * + * @return the path to the templates directory if the metadata file is found, or {@code RELATIVE_TEMPLATE_PATH} + * when running in a test environment. + * @throws CloudRuntimeException if the metadata file cannot be located in any of the candidate paths. + */ + private static String fetchTemplatesPath() { + if (isRunningInTest()) { + return RELATIVE_TEMPLATE_PATH; + } + List paths = Arrays.asList(RELATIVE_TEMPLATE_PATH, ABSOLUTE_TEMPLATE_PATH); + for (String path : paths) { + String filePath = path + METADATA_FILE_NAME; + LOGGER.debug("Looking for file [ {} ] in the classpath.", filePath); + File metaFile = new File(filePath); + if (metaFile.exists()) { + return path; } } + String errMsg = String.format("Unable to locate metadata file in your setup at %s", StringUtils.join(paths)); + LOGGER.error(errMsg); + throw new CloudRuntimeException(errMsg); } - public Long getRegisteredTemplateId(Pair hypervisorAndTemplateName) { - VMTemplateVO vmTemplate = vmTemplateDao.findLatestTemplateByName(hypervisorAndTemplateName.second()); - Long templateId = null; - if (vmTemplate != null) { - templateId = vmTemplate.getId(); + protected static void cleanupStore(Long templateId, String filePath) { + String destTempFolder = filePath + PARTIAL_TEMPLATE_FOLDER + String.valueOf(templateId); + try { + Files.deleteIfExists(Paths.get(destTempFolder)); + } catch (IOException e) { + LOGGER.error("Failed to cleanup mounted store at: {}", filePath, e); } - return templateId; } - private static String fetchTemplatesPath() { - String filePath = RELATIVE_TEMPLATE_PATH + METADATA_FILE_NAME; - LOGGER.debug(String.format("Looking for file [ %s ] in the classpath.", filePath)); - File metaFile = new File(filePath); - String templatePath = null; - if (metaFile.exists()) { - templatePath = RELATIVE_TEMPLATE_PATH; - } - if (templatePath == null) { - filePath = ABSOLUTE_TEMPLATE_PATH + METADATA_FILE_NAME; - metaFile = new File(filePath); - templatePath = ABSOLUTE_TEMPLATE_PATH; - LOGGER.debug(String.format("Looking for file [ %s ] in the classpath.", filePath)); - if (!metaFile.exists()) { - String errMsg = String.format("Unable to locate metadata file in your setup at %s", filePath.toString()); - LOGGER.error(errMsg); - throw new CloudRuntimeException(errMsg); + protected static Pair readTemplatePropertiesSizes(String path) { + File tmpFile = new File(path); + Long size = null; + Long physicalSize = 0L; + try (FileReader fr = new FileReader(tmpFile); BufferedReader brf = new BufferedReader(fr);) { + String line = null; + while ((line = brf.readLine()) != null) { + if (line.startsWith("size=")) { + physicalSize = Long.parseLong(line.split("=")[1]); + } else if (line.startsWith("virtualsize=")) { + size = Long.parseLong(line.split("=")[1]); + } + if (size == null) { + size = physicalSize; + } } + } catch (IOException ex) { + LOGGER.warn("Failed to read from template.properties", ex); } - return templatePath; + return new Pair<>(size, physicalSize); + } + + protected static MetadataTemplateDetails getMetadataTemplateDetails(Hypervisor.HypervisorType hypervisorType, + CPU.CPUArch arch) { + return METADATA_TEMPLATE_LIST + .stream() + .filter(x -> Objects.equals(x.getHypervisorType(), hypervisorType) && + Objects.equals(x.getArch(), arch)) + .findFirst() + .orElse(null); + } + + protected static String getMetadataFilePath() { + return METADATA_FILE; } - private String getHypervisorName(String name) { - if (name.equals("xenserver")) { - return "xen"; + protected static Ini.Section getMetadataSectionForHypervisorAndArch(Ini ini, + Hypervisor.HypervisorType hypervisorType, CPU.CPUArch arch) { + String key = String.format("%s-%s", hypervisorType.name().toLowerCase(), + arch.getType().toLowerCase()); + Ini.Section section = ini.get(key); + if (section == null && !Hypervisor.HypervisorType.KVM.equals(hypervisorType)) { + key = String.format("%s", hypervisorType.name().toLowerCase()); + section = ini.get(key); } - if (name.equals("ovm3")) { - return "ovm"; + return section; + } + + protected static String getMountCommand(String nfsVersion, String device, String dir) { + String cmd = MOUNT_COMMAND_BASE; + if (StringUtils.isNotBlank(nfsVersion)) { + cmd = String.format("%s -o vers=%s", cmd, nfsVersion); } - return name; + return String.format("%s %s %s", cmd, device, dir); + } + /** + * This method parses the metadata file consisting of the system VM Templates information + * @return the version of the system VM Template that is to be used. This is done in order + * to fallback on the latest available version of the system VM Template when there doesn't + * exist a template corresponding to the current code version. + */ + public static String parseMetadataFile() { + String metadataFilePath = getMetadataFilePath(); + String errMsg = String.format("Failed to parse system VM Template metadata file: %s", metadataFilePath); + final Ini ini = new Ini(); + try (FileReader reader = new FileReader(metadataFilePath)) { + ini.load(reader); + } catch (IOException e) { + LOGGER.error(errMsg, e); + throw new CloudRuntimeException(errMsg, e); + } + if (!ini.containsKey("default")) { + errMsg = String.format("%s as unable to default section", errMsg); + LOGGER.error(errMsg); + throw new CloudRuntimeException(errMsg); + } + Ini.Section defaultSection = ini.get("default"); + String defaultDownloadRepository = defaultSection.get(TEMPLATES_DOWNLOAD_REPOSITORY_KEY); + String customDownloadRepository = ServerPropertiesUtil.getProperty(TEMPLATES_CUSTOM_DOWNLOAD_REPOSITORY_KEY); + boolean updateCustomDownloadRepository = StringUtils.isNotBlank(customDownloadRepository) && + StringUtils.isNotBlank(defaultDownloadRepository); + for (Pair hypervisorTypeArchPair : AVAILABLE_SYSTEM_TEMPLATES_HYPERVISOR_ARCH_LIST) { + String key = String.format("%s-%s", hypervisorTypeArchPair.first().name().toLowerCase(), + hypervisorTypeArchPair.second().getType().toLowerCase()); + Ini.Section section = getMetadataSectionForHypervisorAndArch(ini, hypervisorTypeArchPair.first(), + hypervisorTypeArchPair.second()); + if (section == null) { + LOGGER.error("Failed to find details for {} in template metadata file: {}", + getHypervisorArchLog(hypervisorTypeArchPair.first(), hypervisorTypeArchPair.second()), + metadataFilePath); + continue; + } + String url = section.get(TEMPLATE_DOWNLOAD_URL_KEY); + if (StringUtils.isNotBlank(url) && updateCustomDownloadRepository) { + url = url.replaceFirst(defaultDownloadRepository.trim(), + customDownloadRepository.trim()); + LOGGER.debug("Updated download URL for {} using custom repository to {}", key, url); + } + METADATA_TEMPLATE_LIST.add(new MetadataTemplateDetails( + hypervisorTypeArchPair.first(), + section.get("templatename"), + section.get("filename"), + url, + section.get("checksum"), + hypervisorTypeArchPair.second(), + section.get("guestos"))); + } + return defaultSection.get("version").trim(); } - private Hypervisor.HypervisorType getHypervisorType(String hypervisor) { - if (hypervisor.equalsIgnoreCase("xen")) { - hypervisor = "xenserver"; - } else if (hypervisor.equalsIgnoreCase("ovm")) { - hypervisor = "ovm3"; + public static void mountStore(String storeUrl, String path, String nfsVersion) { + try { + if (storeUrl == null) { + return; + } + URI uri = new URI(UriUtils.encodeURIComponent(storeUrl)); + String host = uri.getHost(); + String mountPath = uri.getPath(); + Script.runSimpleBashScript(getMountCommand(nfsVersion, host + ":" + mountPath, path)); + } catch (Exception e) { + String msg = "NFS Store URL is not in the correct format"; + LOGGER.error(msg, e); + throw new CloudRuntimeException(msg, e); } - return Hypervisor.HypervisorType.getType(hypervisor); } - private List getEligibleZoneIds() { + public static void unmountStore(String filePath) { + try { + LOGGER.info("Unmounting store"); + String umountCmd = String.format(UMOUNT_COMMAND, filePath); + Script.runSimpleBashScript(umountCmd); + try { + Files.deleteIfExists(Paths.get(filePath)); + } catch (IOException e) { + LOGGER.error(String.format("Failed to cleanup mounted store at: %s", filePath), e); + } + } catch (Exception e) { + String msg = String.format("Failed to unmount store mounted at %s", filePath); + LOGGER.error(msg, e); + throw new CloudRuntimeException(msg, e); + } + } + + protected File getTempDownloadDir() { + return tempDownloadDir; + } + + protected void readTemplateProperties(String path, SystemVMTemplateDetails details) { + Pair templateSizes = readTemplatePropertiesSizes(path); + details.setSize(templateSizes.first()); + details.setPhysicalSize(templateSizes.second()); + } + + protected List getEligibleZoneIds() { List zoneIds = new ArrayList<>(); List stores = imageStoreDao.findByProtocol("nfs"); for (ImageStoreVO store : stores) { @@ -430,40 +573,24 @@ private List getEligibleZoneIds() { return zoneIds; } - private Pair getNfsStoreInZone(Long zoneId) { - String url = null; - Long storeId = null; + protected Pair getNfsStoreInZone(Long zoneId) { ImageStoreVO storeVO = imageStoreDao.findOneByZoneAndProtocol(zoneId, "nfs"); if (storeVO == null) { - String errMsg = String.format("Failed to fetch NFS store in zone = %s for SystemVM template registration", zoneId); + String errMsg = String.format("Failed to fetch NFS store in zone = %s for SystemVM Template registration", + zoneId); LOGGER.error(errMsg); throw new CloudRuntimeException(errMsg); } - url = storeVO.getUrl(); - storeId = storeVO.getId(); + String url = storeVO.getUrl(); + Long storeId = storeVO.getId(); return new Pair<>(url, storeId); } - public static void mountStore(String storeUrl, String path, String nfsVersion) { - try { - if (storeUrl != null) { - URI uri = new URI(UriUtils.encodeURIComponent(storeUrl)); - String host = uri.getHost(); - String mountPath = uri.getPath(); - Script.runSimpleBashScript(getMountCommand(nfsVersion, host + ":" + mountPath, path)); - } - } catch (Exception e) { - String msg = "NFS Store URL is not in the correct format"; - LOGGER.error(msg, e); - throw new CloudRuntimeException(msg, e); + protected String getSystemVmTemplateVersion() { + if (StringUtils.isEmpty(systemVmTemplateVersion)) { + return String.format("%s.%s", CS_MAJOR_VERSION, CS_TINY_VERSION); } - } - - private List fetchAllHypervisors(Long zoneId) { - List hypervisorList = new ArrayList<>(); - List hypervisorTypes = clusterDao.getAvailableHypervisorInZone(zoneId); - hypervisorList = hypervisorTypes.stream().distinct().map(Hypervisor.HypervisorType::name).collect(Collectors.toList()); - return hypervisorList; + return systemVmTemplateVersion; } private VMTemplateVO createTemplateObjectInDB(SystemVMTemplateDetails details) { @@ -479,20 +606,21 @@ private VMTemplateVO createTemplateObjectInDB(SystemVMTemplateDetails details) { template.setBits(64); template.setAccountId(Account.ACCOUNT_ID_SYSTEM); template.setUrl(details.getUrl()); - template.setChecksum(details.getChecksum()); + template.setChecksum(DigestHelper.prependAlgorithm(details.getChecksum())); template.setEnablePassword(false); template.setDisplayText(details.getName()); template.setFormat(details.getFormat()); template.setGuestOSId(details.getGuestOsId()); template.setCrossZones(true); template.setHypervisorType(details.getHypervisorType()); + template.setArch(details.getArch()); template.setState(VirtualMachineTemplate.State.Inactive); template.setDeployAsIs(false); template = vmTemplateDao.persist(template); return template; } - private VMTemplateZoneVO createOrUpdateTemplateZoneEntry(long zoneId, long templateId) { + protected VMTemplateZoneVO createOrUpdateTemplateZoneEntry(long zoneId, long templateId) { VMTemplateZoneVO templateZoneVO = vmTemplateZoneDao.findByZoneTemplate(zoneId, templateId); if (templateZoneVO == null) { templateZoneVO = new VMTemplateZoneVO(zoneId, templateId, new java.util.Date()); @@ -506,33 +634,37 @@ private VMTemplateZoneVO createOrUpdateTemplateZoneEntry(long zoneId, long templ return templateZoneVO; } - private void createCrossZonesTemplateZoneRefEntries(Long templateId) { + protected void createCrossZonesTemplateZoneRefEntries(Long templateId) { List dcs = dataCenterDao.listAll(); for (DataCenterVO dc : dcs) { VMTemplateZoneVO templateZoneVO = createOrUpdateTemplateZoneEntry(dc.getId(), templateId); if (templateZoneVO == null) { - throw new CloudRuntimeException(String.format("Failed to create template_zone_ref record for the systemVM template (id: %s) and zone: %s", templateId, dc)); + throw new CloudRuntimeException(String.format("Failed to create template-zone record for the system " + + "VM Template (ID : %d) and zone: %s", templateId, dc)); } } } - private void createTemplateStoreRefEntry(SystemVMTemplateDetails details) { - TemplateDataStoreVO templateDataStoreVO = new TemplateDataStoreVO(details.storeId, details.getId(), details.getCreated(), 0, - VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, null, null, null, details.getInstallPath(), details.getUrl()); + protected void createTemplateStoreRefEntry(SystemVMTemplateDetails details) { + TemplateDataStoreVO templateDataStoreVO = new TemplateDataStoreVO(details.getStoreId(), details.getId(), + details.getCreated(), 0, VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, + null, null, null, details.getInstallPath(), details.getUrl()); templateDataStoreVO.setDataStoreRole(DataStoreRole.Image); templateDataStoreVO = templateDataStoreDao.persist(templateDataStoreVO); if (templateDataStoreVO == null) { - throw new CloudRuntimeException(String.format("Failed to create template_store_ref record for the systemVM template for hypervisor: %s", details.getHypervisorType().name())); + throw new CloudRuntimeException(String.format("Failed to create template-store record for the system VM " + + "template (ID : %d) and store (ID: %d)", details.getId(), details.getStoreId())); } } - public void updateTemplateDetails(SystemVMTemplateDetails details) { + protected void updateTemplateDetails(SystemVMTemplateDetails details) { VMTemplateVO template = vmTemplateDao.findById(details.getId()); template.setSize(details.getSize()); template.setState(VirtualMachineTemplate.State.Active); vmTemplateDao.update(template.getId(), template); - TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(details.getStoreId(), template.getId()); + TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(details.getStoreId(), + template.getId()); templateDataStoreVO.setSize(details.getSize()); templateDataStoreVO.setPhysicalSize(details.getPhysicalSize()); templateDataStoreVO.setDownloadPercent(100); @@ -541,11 +673,11 @@ public void updateTemplateDetails(SystemVMTemplateDetails details) { templateDataStoreVO.setState(ObjectInDataStoreStateMachine.State.Ready); boolean updated = templateDataStoreDao.update(templateDataStoreVO.getId(), templateDataStoreVO); if (!updated) { - throw new CloudRuntimeException("Failed to update template_store_ref entry for registered systemVM template"); + throw new CloudRuntimeException("Failed to update template-store record for registered system VM Template"); } } - public void updateSeededTemplateDetails(long templateId, long storeId, long size, long physicalSize) { + protected void updateSeededTemplateDetails(long templateId, long storeId, long size, long physicalSize) { VMTemplateVO template = vmTemplateDao.findById(templateId); template.setSize(size); vmTemplateDao.update(template.getId(), template); @@ -556,109 +688,113 @@ public void updateSeededTemplateDetails(long templateId, long storeId, long size templateDataStoreVO.setLastUpdated(new Date(DateUtil.currentGMTTime().getTime())); boolean updated = templateDataStoreDao.update(templateDataStoreVO.getId(), templateDataStoreVO); if (!updated) { - throw new CloudRuntimeException("Failed to update template_store_ref entry for seeded systemVM template"); + throw new CloudRuntimeException("Failed to update template-store record for seeded system VM Template"); } } - public void updateSystemVMEntries(Long templateId, Hypervisor.HypervisorType hypervisorType) { + protected void updateSystemVMEntries(Long templateId, Hypervisor.HypervisorType hypervisorType) { vmInstanceDao.updateSystemVmTemplateId(templateId, hypervisorType); } - public void updateConfigurationParams(Map configParams) { - for (Map.Entry config : configParams.entrySet()) { - boolean updated = configurationDao.update(config.getKey(), config.getValue()); - if (!updated) { - throw new CloudRuntimeException(String.format("Failed to update configuration parameter %s", config.getKey())); + protected void updateHypervisorGuestOsMap() { + try { + GuestOSVO guestOS = guestOSDao.findOneByDisplayName(DEFAULT_SYSTEM_VM_GUEST_OS_NAME); + if (guestOS == null) { + LOGGER.warn("Couldn't find Guest OS by name [{}] to update system VM Template guest OS ID", + DEFAULT_SYSTEM_VM_GUEST_OS_NAME); + return; } + LOGGER.debug("Updating system VM Template guest OS [{}] ID", DEFAULT_SYSTEM_VM_GUEST_OS_NAME); + SystemVmTemplateRegistration.LINUX_12_ID = Math.toIntExact(guestOS.getId()); + hypervisorGuestOsMap.put(Hypervisor.HypervisorType.KVM, LINUX_12_ID); + hypervisorGuestOsMap.put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID); + hypervisorGuestOsMap.put(Hypervisor.HypervisorType.LXC, LINUX_12_ID); + hypervisorGuestOsMap.put(Hypervisor.HypervisorType.Ovm3, LINUX_12_ID); + } catch (Exception e) { + LOGGER.warn("Couldn't update System VM template guest OS ID, due to {}", e.getMessage()); } } - private static Pair readTemplatePropertiesSizes(String path) { - File tmpFile = new File(path); - Long size = null; - Long physicalSize = 0L; - try (FileReader fr = new FileReader(tmpFile); BufferedReader brf = new BufferedReader(fr);) { - String line = null; - while ((line = brf.readLine()) != null) { - if (line.startsWith("size=")) { - physicalSize = Long.parseLong(line.split("=")[1]); - } else if (line.startsWith("virtualsize=")) { - size = Long.parseLong(line.split("=")[1]); - } - if (size == null) { - size = physicalSize; - } - } - } catch (IOException ex) { - LOGGER.warn("Failed to read from template.properties", ex); + protected void updateConfigurationParams(Hypervisor.HypervisorType hypervisorType, String templateName, Long zoneId) { + String configName = ROUTER_TEMPLATE_CONFIGURATION_NAMES.get(hypervisorType); + boolean updated = configurationDao.update(configName, templateName); + if (!updated) { + throw new CloudRuntimeException(String.format("Failed to update configuration parameter %s", configName)); + } + if (zoneId != null) { + dataCenterDetailsDao.removeDetail(zoneId, configName); + } + updated = configurationDao.update(MINIMUM_SYSTEM_VM_VERSION_KEY, getSystemVmTemplateVersion()); + if (!updated) { + throw new CloudRuntimeException(String.format("Failed to update configuration parameter %s", configName)); + } + if (zoneId != null) { + dataCenterDetailsDao.removeDetail(zoneId, MINIMUM_SYSTEM_VM_VERSION_KEY); } - return new Pair<>(size, physicalSize); - } - - public static void readTemplateProperties(String path, SystemVMTemplateDetails details) { - Pair templateSizes = readTemplatePropertiesSizes(path); - details.setSize(templateSizes.first()); - details.setPhysicalSize(templateSizes.second()); } - private void updateTemplateTablesOnFailure(long templateId) { + protected void updateTemplateEntriesOnFailure(long templateId) { VMTemplateVO template = vmTemplateDao.createForUpdate(templateId); template.setState(VirtualMachineTemplate.State.Inactive); vmTemplateDao.update(template.getId(), template); vmTemplateDao.remove(templateId); - TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByTemplate(template.getId(), DataStoreRole.Image); - templateDataStoreDao.remove(templateDataStoreVO.getId()); - } - - public static void unmountStore(String filePath) { - try { - LOGGER.info("Unmounting store"); - String umountCmd = String.format(UMOUNT_COMMAND, filePath); - Script.runSimpleBashScript(umountCmd); - try { - Files.deleteIfExists(Paths.get(filePath)); - } catch (IOException e) { - LOGGER.error(String.format("Failed to cleanup mounted store at: %s", filePath), e); - } - } catch (Exception e) { - String msg = String.format("Failed to unmount store mounted at %s", filePath); - LOGGER.error(msg, e); - throw new CloudRuntimeException(msg, e); + TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByTemplate(template.getId(), + DataStoreRole.Image); + if (templateDataStoreVO == null) { + return; } + templateDataStoreDao.remove(templateDataStoreVO.getId()); } - private void setupTemplate(String templateName, Pair hypervisorAndTemplateName, - String destTempFolder) throws CloudRuntimeException { - String setupTmpltScript = Script.findScript(storageScriptsDir, "setup-sysvm-tmplt"); + protected void setupTemplateOnStore(String templateName, MetadataTemplateDetails templateDetails, + String destTempFolder) throws CloudRuntimeException { + String setupTmpltScript = Script.findScript(STORAGE_SCRIPTS_DIR, "setup-sysvm-tmplt"); if (setupTmpltScript == null) { - throw new CloudRuntimeException("Unable to find the createtmplt.sh"); + throw new CloudRuntimeException("Unable to find the setup-sysvm-tmplt script"); } Script scr = new Script(setupTmpltScript, SCRIPT_TIMEOUT, LOGGER); scr.add("-u", templateName); - scr.add("-f", TEMPLATES_PATH + FileNames.get(hypervisorAndTemplateName.first())); - scr.add("-h", hypervisorAndTemplateName.first().name().toLowerCase(Locale.ROOT)); + String filePath = StringUtils.isNotBlank(templateDetails.getDownloadedFilePath()) ? + templateDetails.getDownloadedFilePath() : + templateDetails.getDefaultFilePath(); + scr.add("-f", filePath); + scr.add("-h", templateDetails.getHypervisorType().name().toLowerCase(Locale.ROOT)); scr.add("-d", destTempFolder); String result = scr.execute(); if (result != null) { - String errMsg = String.format("failed to create template: %s ", result); + String errMsg = String.format("Failed to create Template: %s ", result); LOGGER.error(errMsg); throw new CloudRuntimeException(errMsg); } - } - private Long performTemplateRegistrationOperations(Pair hypervisorAndTemplateName, - String url, String checksum, ImageFormat format, long guestOsId, - Long storeId, Long templateId, String filePath, TemplateDataStoreVO templateDataStoreVO) { - Hypervisor.HypervisorType hypervisor = hypervisorAndTemplateName.first(); + /** + * Register or update a system VM Template record and seed it on the target store. + * + * @param name display name of the template + * @param templateDetails metadata for the template + * @param url download URL of the template + * @param checksum expected checksum of the template file + * @param format image format of the template + * @param guestOsId guest OS id + * @param storeId target image store id + * @param templateId existing template id if present, otherwise {@code null} + * @param filePath temporary mount path for the store + * @param templateDataStoreVO existing template-store mapping; may be {@code null} + * @return the id of the template that was created or updated + */ + protected Long performTemplateRegistrationOperations(String name, MetadataTemplateDetails templateDetails, + String url, String checksum, ImageFormat format, long guestOsId, Long storeId, Long templateId, + String filePath, TemplateDataStoreVO templateDataStoreVO) { String templateName = UUID.randomUUID().toString(); Date created = new Date(DateUtil.currentGMTTime().getTime()); - SystemVMTemplateDetails details = new SystemVMTemplateDetails(templateName, hypervisorAndTemplateName.second(), created, - url, checksum, format, (int) guestOsId, hypervisor, storeId); + SystemVMTemplateDetails details = new SystemVMTemplateDetails(templateName, name, created, url, checksum, + format, (int) guestOsId, templateDetails.getHypervisorType(), templateDetails.getArch(), storeId); if (templateId == null) { VMTemplateVO template = createTemplateObjectInDB(details); if (template == null) { - throw new CloudRuntimeException(String.format("Failed to register template for hypervisor: %s", hypervisor.name())); + throw new CloudRuntimeException(String.format("Failed to register Template for hypervisor: %s", + templateDetails.getHypervisorType().name())); } templateId = template.getId(); } @@ -667,52 +803,69 @@ private Long performTemplateRegistrationOperations(Pair hypervisorAndTemplateName, - Pair storeUrlAndId, VMTemplateVO templateVO, - TemplateDataStoreVO templateDataStoreVO, String filePath) { - Long templateId = null; + /** + * Add an existing system VM Template to a secondary image store and update related DB entries. + * + * @param templateVO the existing VM template (must not be null) + * @param templateDetails the metadata details of the template to be added + * @param templateDataStoreVO optional existing template-store mapping; may be null + * @param zoneId zone id where the operation is performed + * @param storeId target image store id + * @param filePath temporary mount path for the store + * @throws CloudRuntimeException on failure; the method attempts rollback/cleanup + */ + protected void addExistingTemplateToStore(VMTemplateVO templateVO, MetadataTemplateDetails templateDetails, + TemplateDataStoreVO templateDataStoreVO, long zoneId, Long storeId, String filePath) { try { - templateId = templateVO.getId(); - performTemplateRegistrationOperations(hypervisorAndTemplateName, templateVO.getUrl(), templateVO.getChecksum(), - templateVO.getFormat(), templateVO.getGuestOSId(), storeUrlAndId.second(), templateId, filePath, templateDataStoreVO); + performTemplateRegistrationOperations(templateVO.getName(), templateDetails, templateVO.getUrl(), + templateVO.getChecksum(), templateVO.getFormat(), templateVO.getGuestOSId(), storeId, + templateVO.getId(), filePath, templateDataStoreVO); } catch (Exception e) { - String errMsg = String.format("Failed to register template for hypervisor: %s", hypervisorAndTemplateName.first()); + String errMsg = String.format("Failed to add %s to store ID: %d, zone ID: %d", templateVO, storeId, zoneId); LOGGER.error(errMsg, e); - if (templateId != null) { - updateTemplateTablesOnFailure(templateId); - cleanupStore(templateId, filePath); - } + cleanupStore(templateVO.getId(), filePath); throw new CloudRuntimeException(errMsg, e); } } - public void registerTemplate(Pair hypervisorAndTemplateName, Pair storeUrlAndId, String filePath) { + /** + * Registers a new system VM Template for the given hypervisor/arch when no existing template is present. + * + * @param name the name of the new template + * @param templateDetails the metadata details of the template to be registered + * @param zoneId the zone id for which the new template should be seeded + * @param storeId the store id on which the new template will be seeded + * @param filePath temporary mount path for the store + * @throws CloudRuntimeException on failure; the method attempts rollback/cleanup + */ + protected void registerNewTemplate(String name, MetadataTemplateDetails templateDetails, long zoneId, Long storeId, + String filePath) { Long templateId = null; + Hypervisor.HypervisorType hypervisor = templateDetails.getHypervisorType(); try { - Hypervisor.HypervisorType hypervisor = hypervisorAndTemplateName.first(); - templateId = performTemplateRegistrationOperations(hypervisorAndTemplateName, NewTemplateUrl.get(hypervisor), NewTemplateChecksum.get(hypervisor), - hypervisorImageFormat.get(hypervisor), hypervisorGuestOsMap.get(hypervisor), storeUrlAndId.second(), null, filePath, null); - Map configParams = new HashMap<>(); - configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second()); - configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion()); - updateConfigurationParams(configParams); - updateSystemVMEntries(templateId, hypervisorAndTemplateName.first()); + templateId = performTemplateRegistrationOperations(name, templateDetails, templateDetails.getUrl(), + templateDetails.getChecksum(), HYPERVISOR_IMAGE_FORMAT_MAP.get(hypervisor), + hypervisorGuestOsMap.get(hypervisor), storeId, null, filePath, null); + updateConfigurationParams(hypervisor, name, zoneId); + updateSystemVMEntries(templateId, hypervisor); } catch (Exception e) { - String errMsg = String.format("Failed to register template for hypervisor: %s", hypervisorAndTemplateName.first()); + String errMsg = String.format("Failed to register Template for hypervisor: %s", hypervisor); LOGGER.error(errMsg, e); if (templateId != null) { - updateTemplateTablesOnFailure(templateId); + updateTemplateEntriesOnFailure(templateId); cleanupStore(templateId, filePath); } throw new CloudRuntimeException(errMsg, e); @@ -720,82 +873,149 @@ public void registerTemplate(Pair hypervisorA } /** - * This method parses the metadata file consisting of the systemVM templates information - * @return the version of the systemvm template that is to be used. This is done in order - * to fallback on the latest available version of the systemVM template when there doesn't - * exist a template corresponding to the current code version. + * Validate presence and integrity of metadata and local template file for the given hypervisor/arch. + * + * @param hypervisor target hypervisor type + * @param arch target CPU architecture + * @return validated MetadataTemplateDetails + * @throws CloudRuntimeException if template is not available, missing, or checksum validation fails */ - public static String parseMetadataFile() { - try { - Ini ini = new Ini(); - ini.load(new FileReader(METADATA_FILE)); - for (Hypervisor.HypervisorType hypervisorType : hypervisorList) { - String hypervisor = hypervisorType.name().toLowerCase(Locale.ROOT); - Ini.Section section = ini.get(hypervisor); - NewTemplateNameList.put(hypervisorType, section.get("templatename")); - FileNames.put(hypervisorType, section.get("filename")); - NewTemplateChecksum.put(hypervisorType, section.get("checksum")); - NewTemplateUrl.put(hypervisorType, section.get("downloadurl")); - } - Ini.Section section = ini.get("default"); - return section.get("version"); - } catch (Exception e) { - String errMsg = String.format("Failed to parse systemVM template metadata file: %s", METADATA_FILE); - LOGGER.error(errMsg, e); - throw new CloudRuntimeException(errMsg, e); + protected MetadataTemplateDetails getValidatedTemplateDetailsForHypervisorAndArch( + Hypervisor.HypervisorType hypervisor, CPU.CPUArch arch) { + if (!AVAILABLE_SYSTEM_TEMPLATES_HYPERVISOR_ARCH_LIST.contains(new Pair<>(hypervisor, arch))) { + throw new CloudRuntimeException("No system VM Template available for the given hypervisor and arch"); } - } - - private static void cleanupStore(Long templateId, String filePath) { - String destTempFolder = filePath + PARTIAL_TEMPLATE_FOLDER + String.valueOf(templateId); - try { - Files.deleteIfExists(Paths.get(destTempFolder)); - } catch (IOException e) { - LOGGER.error(String.format("Failed to cleanup mounted store at: %s", filePath), e); + MetadataTemplateDetails templateDetails = getMetadataTemplateDetails(hypervisor, arch); + if (templateDetails == null) { + throw new CloudRuntimeException("No template details found for the given hypervisor and arch"); } + File templateFile = getTemplateFile(templateDetails); + if (templateFile == null) { + throw new CloudRuntimeException("Failed to find local template file"); + } + if (templateDetails.isFileChecksumDifferent(templateFile)) { + throw new CloudRuntimeException("Checksum failed for local template file"); + } + return templateDetails; } - private void validateTemplates(Set hypervisorsInUse) { - Set hypervisors = hypervisorsInUse.stream(). - map(Hypervisor.HypervisorType::name).map(name -> name.toLowerCase(Locale.ROOT)).map(this::getHypervisorName).collect(Collectors.toSet()); - List templates = new ArrayList<>(); - for (Hypervisor.HypervisorType hypervisorType : hypervisorsInUse) { - templates.add(FileNames.get(hypervisorType)); + /** + * Return the local template file. Downloads it if not present locally and url is present. + * + * @param templateDetails template metadata; may set `downloadedFilePath` + * @return the template {@code File} on disk, or {@code null} if not found/downloaded + */ + protected File getTemplateFile(MetadataTemplateDetails templateDetails) { + File templateFile = new File(templateDetails.getDefaultFilePath()); + if (templateFile.exists()) { + return templateFile; + } + LOGGER.debug("{} is not present", templateFile.getAbsolutePath()); + if (StringUtils.isNotBlank(templateDetails.getUrl())) { + LOGGER.debug("Downloading the template file {} for {}", + templateDetails.getUrl(), templateDetails.getHypervisorArchLog()); + Path path = Path.of(TEMPLATES_PATH); + if (!Files.isWritable(path)) { + templateFile = new File(getTempDownloadDir(), templateDetails.getFilename()); + } + if (!templateFile.exists() && + !HttpUtils.downloadFileWithProgress(templateDetails.getUrl(), templateFile.getAbsolutePath(), + LOGGER)) { + LOGGER.error("Failed to download template for {} using url: {}", + templateDetails.getHypervisorArchLog(), templateDetails.getUrl()); + return null; + } + templateDetails.setDownloadedFilePath(templateFile.getAbsolutePath()); } + return templateFile; + } + /** + * Validate that templates for the provided hypervisor/architecture pairs which are in use and are valid. + * + * If a template is missing or validation fails for any required pair, a + * {@link CloudRuntimeException} is thrown to abort the upgrade. If system VM Template for a hypervisor/arch is + * not considered available then validation is skipped for that pair. + * + * @param hypervisorArchList list of hypervisor/architecture pairs to validate + */ + protected void validateTemplates(List> hypervisorArchList) { boolean templatesFound = true; - for (String hypervisor : hypervisors) { - String matchedTemplate = templates.stream().filter(x -> x.contains(hypervisor)).findAny().orElse(null); - if (matchedTemplate == null) { - templatesFound = false; - break; + for (Pair hypervisorArch : hypervisorArchList) { + if (!AVAILABLE_SYSTEM_TEMPLATES_HYPERVISOR_ARCH_LIST.contains(hypervisorArch)) { + LOGGER.info("No system VM Template available for {}. Skipping validation.", + getHypervisorArchLog(hypervisorArch.first(), hypervisorArch.second())); + continue; } - - File tempFile = new File(TEMPLATES_PATH + matchedTemplate); - String templateChecksum = DigestHelper.calculateChecksum(tempFile); - if (!templateChecksum.equals(NewTemplateChecksum.get(getHypervisorType(hypervisor)))) { - LOGGER.error(String.format("Checksum mismatch: %s != %s ", templateChecksum, NewTemplateChecksum.get(getHypervisorType(hypervisor)))); + try { + getValidatedTemplateDetailsForHypervisorAndArch(hypervisorArch.first(), hypervisorArch.second()); + } catch (CloudRuntimeException e) { + LOGGER.error("Validation failed for {}: {}", + getHypervisorArchLog(hypervisorArch.first(), hypervisorArch.second()), e.getMessage()); templatesFound = false; break; } } - if (!templatesFound) { - String errMsg = "SystemVm template not found. Cannot upgrade system Vms"; + String errMsg = "SystemVM Template not found. Cannot upgrade system VMs"; LOGGER.error(errMsg); throw new CloudRuntimeException(errMsg); } } - public void registerTemplates(Set hypervisorsInUse) { + /** + * Register or ensure system VM Templates are present on the NFS store for a given zone. + * + * Mounts the zone image store, enumerates hypervisors and architectures in the zone, + * and for each template either adds an existing template to the store or registers + * a new template as required. + * + * @param zoneId the zone id + * @param storeMountPath temporary mount path for the store + */ + protected void registerTemplatesForZone(long zoneId, String storeMountPath) { + Pair storeUrlAndId = getNfsStoreInZone(zoneId); + String nfsVersion = getNfsVersion(storeUrlAndId.second()); + mountStore(storeUrlAndId.first(), storeMountPath, nfsVersion); + List> hypervisorArchList = + clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); + for (Pair hypervisorArch : hypervisorArchList) { + Hypervisor.HypervisorType hypervisorType = hypervisorArch.first(); + MetadataTemplateDetails templateDetails = getMetadataTemplateDetails(hypervisorType, + hypervisorArch.second()); + if (templateDetails == null) { + continue; + } + VMTemplateVO templateVO = getRegisteredTemplate(templateDetails.getName(), + templateDetails.getHypervisorType(), templateDetails.getArch(), templateDetails.getUrl()); + if (templateVO != null) { + TemplateDataStoreVO templateDataStoreVO = + templateDataStoreDao.findByStoreTemplate(storeUrlAndId.second(), templateVO.getId()); + if (templateDataStoreVO != null) { + String installPath = templateDataStoreVO.getInstallPath(); + if (validateIfSeeded(templateDataStoreVO, storeUrlAndId.first(), installPath, nfsVersion)) { + continue; + } + } + addExistingTemplateToStore(templateVO, templateDetails, templateDataStoreVO, zoneId, + storeUrlAndId.second(), storeMountPath); + updateRegisteredTemplateDetails(templateVO.getId(), templateDetails, zoneId); + continue; + } + registerNewTemplate(templateDetails.getName(), templateDetails, zoneId, storeUrlAndId.second(), + storeMountPath); + } + } + + protected void registerTemplates(List> hypervisorsArchInUse) { GlobalLock lock = GlobalLock.getInternLock("UpgradeDatabase-Lock"); try { - LOGGER.info("Grabbing lock to register templates."); + LOGGER.info("Grabbing lock to register Templates."); if (!lock.lock(LOCK_WAIT_TIMEOUT)) { - throw new CloudRuntimeException("Unable to acquire lock to register SystemVM template."); + throw new CloudRuntimeException("Unable to acquire lock to register system VM Template."); } try { - validateTemplates(hypervisorsInUse); + validateTemplates(hypervisorsArchInUse); // Perform Registration if templates not already registered Transaction.execute(new TransactionCallbackNoReturn() { @Override @@ -808,42 +1028,17 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { if (filePath == null) { throw new CloudRuntimeException("Failed to create temporary file path to mount the store"); } - Pair storeUrlAndId = getNfsStoreInZone(zoneId); - String nfsVersion = getNfsVersion(storeUrlAndId.second()); - mountStore(storeUrlAndId.first(), filePath, nfsVersion); - List hypervisorList = fetchAllHypervisors(zoneId); - for (String hypervisor : hypervisorList) { - Hypervisor.HypervisorType name = Hypervisor.HypervisorType.getType(hypervisor); - String templateName = NewTemplateNameList.get(name); - Pair hypervisorAndTemplateName = new Pair(name, templateName); - Long templateId = getRegisteredTemplateId(hypervisorAndTemplateName); - if (templateId != null) { - VMTemplateVO templateVO = vmTemplateDao.findById(templateId); - TemplateDataStoreVO templateDataStoreVO = templateDataStoreDao.findByStoreTemplate(storeUrlAndId.second(), templateId); - if (templateDataStoreVO != null) { - String installPath = templateDataStoreVO.getInstallPath(); - if (validateIfSeeded(templateDataStoreVO, storeUrlAndId.first(), installPath, nfsVersion)) { - continue; - } - } - if (templateVO != null) { - registerTemplate(hypervisorAndTemplateName, storeUrlAndId, templateVO, templateDataStoreVO, filePath); - updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName); - continue; - } - } - registerTemplate(hypervisorAndTemplateName, storeUrlAndId, filePath); - } + registerTemplatesForZone(zoneId, filePath); unmountStore(filePath); } catch (Exception e) { unmountStore(filePath); - throw new CloudRuntimeException("Failed to register systemVM template. Upgrade Failed"); + throw new CloudRuntimeException("Failed to register system VM Template. Upgrade Failed"); } } } }); } catch (Exception e) { - throw new CloudRuntimeException("Failed to register systemVM template. Upgrade Failed"); + throw new CloudRuntimeException("Failed to register system VM Template. Upgrade Failed"); } } finally { lock.unlock(); @@ -851,101 +1046,331 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { } } - private void updateRegisteredTemplateDetails(Long templateId, Map.Entry hypervisorAndTemplateName) { - Pair entry = new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue()); - updateRegisteredTemplateDetails(templateId, entry); - } - - private void updateRegisteredTemplateDetails(Long templateId, Pair hypervisorAndTemplateName) { + /** + * Update the DB record for an existing template to mark it as a system template, + * set the guest OS (if resolvable), and propagate the change to system VM entries + * and related configuration for the template's hypervisor. + * + * @param templateId id of the template to update + * @param templateDetails metadata used to update the template record + * @param zoneId zone id whose per-zone details (if any) should be cleared; may be null + * @throws CloudRuntimeException if updating the template record fails + */ + protected void updateRegisteredTemplateDetails(Long templateId, MetadataTemplateDetails templateDetails, + Long zoneId) { VMTemplateVO templateVO = vmTemplateDao.findById(templateId); templateVO.setTemplateType(Storage.TemplateType.SYSTEM); + GuestOSVO guestOS = guestOSDao.findOneByDisplayName(templateDetails.getGuestOs()); + if (guestOS != null) { + templateVO.setGuestOSId(guestOS.getId()); + } boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO); if (!updated) { - String errMsg = String.format("updateSystemVmTemplates:Exception while updating template with id %s to be marked as 'system'", templateId); + String errMsg = String.format("Exception while updating template with id %s to be marked as 'system'", + templateId); LOGGER.error(errMsg); throw new CloudRuntimeException(errMsg); } - - updateSystemVMEntries(templateId, hypervisorAndTemplateName.first()); - - // Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version - Map configParams = new HashMap<>(); - configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second()); - configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion()); - updateConfigurationParams(configParams); + Hypervisor.HypervisorType hypervisorType = templateDetails.getHypervisorType(); + updateSystemVMEntries(templateId, hypervisorType); + updateConfigurationParams(hypervisorType, templateVO.getName(), zoneId); } - private void updateTemplateUrlAndChecksum(VMTemplateVO templateVO, Map.Entry hypervisorAndTemplateName) { - templateVO.setUrl(NewTemplateUrl.get(hypervisorAndTemplateName.getKey())); - templateVO.setChecksum(NewTemplateChecksum.get(hypervisorAndTemplateName.getKey())); + protected void updateTemplateUrlChecksumAndGuestOsId(VMTemplateVO templateVO, + MetadataTemplateDetails templateDetails) { + templateVO.setUrl(templateDetails.getUrl()); + templateVO.setChecksum(DigestHelper.prependAlgorithm(templateDetails.getChecksum())); + GuestOSVO guestOS = guestOSDao.findOneByDisplayName(templateDetails.getGuestOs()); + if (guestOS != null) { + templateVO.setGuestOSId(guestOS.getId()); + } boolean updated = vmTemplateDao.update(templateVO.getId(), templateVO); if (!updated) { - String errMsg = String.format("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type %s", hypervisorAndTemplateName.getKey().name()); + String errMsg = String.format("Exception while updating 'url' and 'checksum' for hypervisor type %s", + templateDetails.getHypervisorType()); LOGGER.error(errMsg); throw new CloudRuntimeException(errMsg); } } + /** + * Updates or registers the system VM Template for the given hypervisor/arch if not already present. + * Returns true if a new template was registered. + * If there is an existing system VM Template for the given hypervisor/arch, its details are updated. + * If no existing template is found, new templates are registered for the valid hypervisor/arch which are in use. + */ + protected boolean updateOrRegisterSystemVmTemplate(MetadataTemplateDetails templateDetails, + List> hypervisorArchInUse) { + String systemVmTemplateLog = String.format("%s system VM Template for %s", getSystemVmTemplateVersion(), + templateDetails.getHypervisorArchLog()); + LOGGER.debug("Registering or updating {}", systemVmTemplateLog, + templateDetails.getHypervisorArchLog()); + VMTemplateVO registeredTemplate = getRegisteredTemplate(templateDetails.getName(), + templateDetails.getHypervisorType(), templateDetails.getArch(), templateDetails.getUrl()); + if (registeredTemplate != null) { + LOGGER.info("{} is already registered, updating details for: {}", + systemVmTemplateLog, templateDetails.getHypervisorArchLog(), registeredTemplate); + updateRegisteredTemplateDetails(registeredTemplate.getId(), templateDetails, null); + return false; + } + boolean isHypervisorArchMatchMetadata = hypervisorArchInUse.stream() + .anyMatch(p -> p.first().equals(templateDetails.getHypervisorType()) + && Objects.equals(p.second(), templateDetails.getArch())); + if (!isHypervisorArchMatchMetadata) { + LOGGER.warn("Skipping upgrading {} as it is not used, not failing upgrade", + getSystemVmTemplateVersion(), templateDetails.getHypervisorArchLog()); + VMTemplateVO templateVO = vmTemplateDao.findLatestTemplateByTypeAndHypervisorAndArch( + templateDetails.getHypervisorType(), templateDetails.getArch(), Storage.TemplateType.SYSTEM); + if (templateVO != null) { + updateTemplateUrlChecksumAndGuestOsId(templateVO, templateDetails); + } + return false; + } + try { + registerTemplates(hypervisorArchInUse); + return true; + } catch (final Exception e) { + throw new CloudRuntimeException(String.format("Failed to register %s templates for hypervisors: [%s]. " + + "Cannot upgrade system VMs", + getSystemVmTemplateVersion(), + StringUtils.join(hypervisorArchInUse.stream() + .map(x -> String.format("%s-%s", x.first().name(), x.second().name())) + .collect(Collectors.toList()), ",")), e); + } + } + + /** + * Return NFS version for the store: store-specific config if present + * or global config if absent. Returns null if not set. + */ + protected String getNfsVersion(long storeId) { + final String configKey = "secstorage.nfs.version"; + final Map storeDetails = imageStoreDetailsDao.getDetails(storeId); + if (storeDetails != null && storeDetails.containsKey(configKey)) { + return storeDetails.get(configKey); + } + ConfigurationVO globalNfsVersion = configurationDao.findByName(configKey); + if (globalNfsVersion != null) { + return globalNfsVersion.getValue(); + } + return null; + } + + /** + * Validate metadata for the given template's hypervisor/arch and add the existing template + * to the specified secondary store. On success, database entries are created/updated. + * + * @param templateVO template to add + * @param templateDataStoreVO existing template-store mapping; may be null + * @param zoneId zone id where the operation is performed + * @param storeId target image store id + * @param filePath temporary mount path for the store + * @throws CloudRuntimeException on failure; the method attempts rollback/cleanup + */ + public void validateAndAddTemplateToStore(VMTemplateVO templateVO, TemplateDataStoreVO templateDataStoreVO, + long zoneId, long storeId, String filePath) { + MetadataTemplateDetails templateDetails = getValidatedTemplateDetailsForHypervisorAndArch( + templateVO.getHypervisorType(), templateVO.getArch()); + addExistingTemplateToStore(templateVO, templateDetails, templateDataStoreVO, zoneId, storeId, filePath); + } + + /** + * Validate metadata for the given hypervisor/arch and register a new system VM Template + * on the specified store and zone. Creates DB entries and seeds the template on the store. + * + * @param hypervisor hypervisor type + * @param arch cpu architecture + * @param name template name to register + * @param zoneId zone id where the operation is performed + * @param storeId target image store id + * @param filePath temporary mount path for the store + * @throws CloudRuntimeException on failure; the method attempts rollback/cleanup + */ + public void validateAndRegisterNewTemplate(Hypervisor.HypervisorType hypervisor, CPU.CPUArch arch, String name, + long zoneId, long storeId, String filePath) { + MetadataTemplateDetails templateDetails = getValidatedTemplateDetailsForHypervisorAndArch(hypervisor, arch); + registerNewTemplate(name, templateDetails, zoneId, storeId, filePath); + } + + /** + * Check whether the template at the given `path` on NFS `url` is already seeded. + * If found, updates DB with sizes and returns true; otherwise returns false. + * + * @throws CloudRuntimeException on any error + */ + public boolean validateIfSeeded(TemplateDataStoreVO templDataStoreVO, String url, String path, String nfsVersion) { + String filePath = null; + try { + filePath = Files.createTempDirectory(TEMPORARY_SECONDARY_STORE).toString(); + if (filePath == null) { + throw new CloudRuntimeException("Failed to create temporary directory to mount secondary store"); + } + mountStore(url, filePath, nfsVersion); + int lastIdx = path.lastIndexOf(File.separator); + String partialDirPath = path.substring(0, lastIdx); + String templatePath = filePath + File.separator + partialDirPath; + File templateProps = new File(templatePath + "/template.properties"); + if (templateProps.exists()) { + Pair templateSizes = readTemplatePropertiesSizes(templatePath + "/template.properties"); + updateSeededTemplateDetails(templDataStoreVO.getTemplateId(), templDataStoreVO.getDataStoreId(), + templateSizes.first(), templateSizes.second()); + LOGGER.info("System VM template already seeded, skipping registration"); + return true; + } + LOGGER.info("System VM template not seeded"); + return false; + } catch (Exception e) { + LOGGER.error("Failed to verify if the template is seeded", e); + throw new CloudRuntimeException("Failed to verify if the template is seeded", e); + } finally { + unmountStore(filePath); + try { + Files.delete(Path.of(filePath)); + } catch (IOException e) { + LOGGER.error("Failed to delete temporary directory: {}", filePath); + } + } + } + + /** + * Finds a registered system VM Template matching the provided criteria. + * + *

    The method first attempts to locate the latest template by {@code templateName}, + * {@code hypervisorType} and {@code arch}. If none is found and a non-blank {@code url} + * is provided, it falls back to searching for an active system template by the + * URL path segment (the substring after the last '/' in the URL).

    + * + * @param templateName the template name to search for + * @param hypervisorType the hypervisor type + * @param arch the CPU architecture + * @param url optional download URL used as a fallback; may be {@code null} or blank + * @return the matching {@code VMTemplateVO} if found; {@code null} otherwise + */ + public VMTemplateVO getRegisteredTemplate(String templateName, Hypervisor.HypervisorType hypervisorType, + CPU.CPUArch arch, String url) { + VMTemplateVO registeredTemplate = vmTemplateDao.findLatestTemplateByName(templateName, hypervisorType, arch); + if (registeredTemplate == null && StringUtils.isNotBlank(url)) { + String urlPath = url.substring(url.lastIndexOf("/") + 1); + LOGGER.debug("No template found by name, falling back to search existing SYSTEM template by " + + "urlPath: {}, hypervisor: {}, arch:{}", urlPath, hypervisorType, arch); + registeredTemplate = vmTemplateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath(hypervisorType, arch, + urlPath); + } + LOGGER.debug("Found existing registered template for hypervisor: {}, arch: {}: {}", hypervisorType, + arch, registeredTemplate); + return registeredTemplate; + } + + /** + * Update or register system VM Templates based on metadata. + * + * Runs the registration logic inside a database transaction: obtains the + * set of hypervisors/architectures in use, iterates over metadata entries + * and attempts to register or update each template. + * + * @param conn retained for compatibility with callers (not used directly) + */ public void updateSystemVmTemplates(final Connection conn) { - LOGGER.debug("Updating System Vm template IDs"); + LOGGER.debug("Updating System VM templates"); + updateHypervisorGuestOsMap(); Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) { - Set hypervisorsListInUse = new HashSet(); + List> hypervisorsInUse; try { - hypervisorsListInUse = clusterDao.getDistinctAvailableHypervisorsAcrossClusters(); - + hypervisorsInUse = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(null); } catch (final Exception e) { - LOGGER.error("updateSystemVmTemplates: Exception caught while getting hypervisor types from clusters: " + e.getMessage()); - throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e); + throw new CloudRuntimeException("Exception while getting hypervisor types from clusters", e); } - - for (final Map.Entry hypervisorAndTemplateName : NewTemplateNameList.entrySet()) { - LOGGER.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms"); - Long templateId = getRegisteredTemplateId(new Pair<>(hypervisorAndTemplateName.getKey(), hypervisorAndTemplateName.getValue())); + for (MetadataTemplateDetails templateDetails : METADATA_TEMPLATE_LIST) { try { - // change template type to SYSTEM - if (templateId != null) { - updateRegisteredTemplateDetails(templateId, hypervisorAndTemplateName); - } else { - if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())) { - try { - registerTemplates(hypervisorsListInUse); - break; - } catch (final Exception e) { - throw new CloudRuntimeException(String.format("%s %s SystemVm template not found. Cannot upgrade system Vms", getSystemVmTemplateVersion(), hypervisorAndTemplateName.getKey())); - } - } else { - LOGGER.warn(String.format("%s %s SystemVm template not found. Cannot upgrade system Vms hypervisor is not used, so not failing upgrade", - getSystemVmTemplateVersion(), hypervisorAndTemplateName.getKey())); - // Update the latest template URLs for corresponding hypervisor - VMTemplateVO templateVO = vmTemplateDao.findLatestTemplateByTypeAndHypervisor(hypervisorAndTemplateName.getKey(), Storage.TemplateType.SYSTEM); - if (templateVO != null) { - updateTemplateUrlAndChecksum(templateVO, hypervisorAndTemplateName); - } - } + if (updateOrRegisterSystemVmTemplate(templateDetails, hypervisorsInUse)) { + break; } } catch (final Exception e) { - String errMsg = "updateSystemVmTemplates:Exception while getting ids of templates"; + String errMsg = "Exception while registering/updating system VM Templates for hypervisors in metadata"; LOGGER.error(errMsg, e); throw new CloudRuntimeException(errMsg, e); } } - LOGGER.debug("Updating System Vm Template IDs Complete"); + LOGGER.debug("Updating System VM Templates Complete"); } }); } - public String getNfsVersion(long storeId) { - final String configKey = "secstorage.nfs.version"; - final Map storeDetails = imageStoreDetailsDao.getDetails(storeId); - if (storeDetails != null && storeDetails.containsKey(configKey)) { - return storeDetails.get(configKey); + protected static class MetadataTemplateDetails { + private final Hypervisor.HypervisorType hypervisorType; + private final String name; + private final String filename; + private final String url; + private final String checksum; + private final CPU.CPUArch arch; + private String downloadedFilePath; + private final String guestOs; + + MetadataTemplateDetails(Hypervisor.HypervisorType hypervisorType, String name, String filename, String url, + String checksum, CPU.CPUArch arch, String guestOs) { + this.hypervisorType = hypervisorType; + this.name = name; + this.filename = filename; + this.url = url; + this.checksum = checksum; + this.arch = arch; + this.guestOs = guestOs; } - ConfigurationVO globalNfsVersion = configurationDao.findByName(configKey); - if (globalNfsVersion != null) { - return globalNfsVersion.getValue(); + + public Hypervisor.HypervisorType getHypervisorType() { + return hypervisorType; + } + + public String getName() { + return name; + } + + public String getFilename() { + return filename; + } + + public String getUrl() { + return url; + } + + public String getChecksum() { + return checksum; + } + + public CPU.CPUArch getArch() { + return arch; + } + + public String getGuestOs() { + return guestOs; + } + + public String getDownloadedFilePath() { + return downloadedFilePath; + } + + public void setDownloadedFilePath(String downloadedFilePath) { + this.downloadedFilePath = downloadedFilePath; + } + + public String getDefaultFilePath() { + return TEMPLATES_PATH + filename; + } + + public boolean isFileChecksumDifferent(File file) { + String fileChecksum = DigestHelper.calculateChecksum(file); + if (!fileChecksum.equals(getChecksum())) { + LOGGER.error("Checksum {} for file {} does not match checksum {} from metadata", + fileChecksum, file, getChecksum()); + return true; + } + return false; + } + + public String getHypervisorArchLog() { + return SystemVmTemplateRegistration.getHypervisorArchLog(hypervisorType, arch); } - return null; } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java index 02c401c81558..fa0d0506ac13 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgrade.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.upgrade.dao; +import com.cloud.utils.exception.CloudRuntimeException; + import java.io.InputStream; import java.sql.Connection; @@ -24,18 +26,45 @@ public interface DbUpgrade { String getUpgradedVersion(); - boolean supportsRollingUpgrade(); + default boolean supportsRollingUpgrade() { + return false; + } /** * @return the script to prepare the database schema for the * data migration step. */ - InputStream[] getPrepareScripts(); + default InputStream[] getPrepareScripts() { + String fromVersion = getUpgradableVersionRange()[0]; + String toVersion = getUpgradableVersionRange()[1]; + final String scriptFile = String.format("META-INF/db/schema-%sto%s.sql", fromVersion.replace(".", ""), toVersion.replace(".", "")); + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[]{script}; + } /** * Performs the actual data migration. */ - void performDataMigration(Connection conn); + default void performDataMigration(Connection conn) { + } + + default InputStream[] getCleanupScripts() { + String fromVersion = getUpgradableVersionRange()[0]; + String toVersion = getUpgradableVersionRange()[1]; + final String scriptFile = String.format("META-INF/db/schema-%sto%s-cleanup.sql", fromVersion.replace(".", ""), toVersion.replace(".", "")); + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[]{script}; + } - InputStream[] getCleanupScripts(); + default boolean refreshPoolConnectionsAfterUpgrade() { + return false; + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java index 4211898adc7d..a8d2436672e7 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/DbUpgradeSystemVmTemplate.java @@ -17,9 +17,23 @@ package com.cloud.upgrade.dao; +import com.cloud.upgrade.SystemVmTemplateRegistration; +import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import java.sql.Connection; public interface DbUpgradeSystemVmTemplate { - void updateSystemVmTemplates(Connection conn); + default void updateSystemVmTemplates(Connection conn) { + Logger logger = LogManager.getLogger(getClass()); + logger.debug("Updating System Vm template IDs"); + try { + SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration(""); + systemVmTemplateRegistration.updateSystemVmTemplates(conn); + } catch (Exception e) { + throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + } + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade218to22.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade218to22.java index 171357578ee9..a73c458c948a 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade218to22.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade218to22.java @@ -140,7 +140,7 @@ protected void upgradeInstanceGroups(Connection conn) { } } catch (SQLException e) { - throw new CloudRuntimeException("Can't update instance groups ", e); + throw new CloudRuntimeException("Can't update Instance groups ", e); } } @@ -464,7 +464,7 @@ protected void upgradeUserVms(Connection conn, long domainRouterId, long network vm[4] = rs.getString(5); // vm state vms.add(vm); } - logger.debug("Upgrading " + vms.size() + " vms for router " + domainRouterId); + logger.debug("Upgrading " + vms.size() + " Instances for router " + domainRouterId); for (Object[] vm : vms) { String state = (String)vm[4]; @@ -1218,7 +1218,7 @@ private void updateUserStats(Connection conn) { } } } else { - logger.debug("Account id=" + accountId + " doesn't own any user vms and domRs, so skipping user_statistics update"); + logger.debug("Account id=" + accountId + " doesn't own any user Instances and domRs, so skipping user_statistics update"); continue; } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java index 524b6a34893b..d4cdbcb9707d 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2214to30.java @@ -77,8 +77,6 @@ public void performDataMigration(Connection conn) { encryptData(conn); // drop keys dropKeysIfExist(conn); - //update template ID for system Vms - //updateSystemVms(conn); This is not required as system template update is handled during 4.2 upgrade // update domain network ref updateDomainNetworkRef(conn); // update networks that use redundant routers to the new network offering diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade222to224.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade222to224.java index b891b02ea572..5cb7d4287956 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade222to224.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade222to224.java @@ -153,7 +153,7 @@ private void updateGuestOsType(Connection conn) { } } catch (SQLException e) { - throw new CloudRuntimeException("Unable to update the guest os type for default template as a part of 222 to 224 upgrade", e); + throw new CloudRuntimeException("Unable to update the guest os type for default Template as a part of 222 to 224 upgrade", e); } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java index aa427252585f..bd8ddaa7c498 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade302to40.java @@ -62,7 +62,6 @@ public InputStream[] getPrepareScripts() { @Override public void performDataMigration(Connection conn) { - //updateVmWareSystemVms(conn); This is not required as system template update is handled during 4.2 upgrade correctVRProviders(conn); correctMultiplePhysicaNetworkSetups(conn); addHostDetailsUniqueKey(conn); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java index bb4c73f67b68..38dc90b460dd 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade304to305.java @@ -65,7 +65,6 @@ public void performDataMigration(Connection conn) { addVpcProvider(conn); updateRouterNetworkRef(conn); fixZoneUsingExternalDevices(conn); -// updateSystemVms(conn); fixForeignKeys(conn); encryptClusterDetails(conn); } @@ -81,57 +80,9 @@ public InputStream[] getCleanupScripts() { return new InputStream[] {script}; } - private void updateSystemVms(Connection conn) { - PreparedStatement pstmt = null; - ResultSet rs = null; - boolean VMware = false; - try { - pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); - rs = pstmt.executeQuery(); - while (rs.next()) { - if ("VMware".equals(rs.getString(1))) { - VMware = true; - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("Error while iterating through list of hypervisors in use", e); - } - // Just update the VMware system template. Other hypervisor templates are unchanged from previous 3.0.x versions. - logger.debug("Updating VMware System Vms"); - try { - //Get 3.0.5 VMware system Vm template Id - pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = 'systemvm-vmware-3.0.5' and removed is null"); - rs = pstmt.executeQuery(); - if (rs.next()) { - long templateId = rs.getLong(1); - rs.close(); - pstmt.close(); - // change template type to SYSTEM - pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?"); - pstmt.setLong(1, templateId); - pstmt.executeUpdate(); - pstmt.close(); - // update template ID of system Vms - pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = 'VMware'"); - pstmt.setLong(1, templateId); - pstmt.executeUpdate(); - pstmt.close(); - } else { - if (VMware) { - throw new CloudRuntimeException("3.0.5 VMware SystemVm template not found. Cannot upgrade system Vms"); - } else { - logger.warn("3.0.5 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade"); - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("Error while updating VMware systemVm template", e); - } - logger.debug("Updating System Vm Template IDs Complete"); - } - private void addVpcProvider(Connection conn) { //Encrypt config params and change category to Hidden - logger.debug("Adding vpc provider to all physical networks in the system"); + logger.debug("Adding VPC provider to all physical Networks in the system"); PreparedStatement pstmt = null; ResultSet rs = null; try { diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java index b78aed3119a4..5c47087b9689 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java @@ -665,25 +665,25 @@ private void upgradeVmwareLabels(Connection conn) { newLabel = getNewLabel(rsLabel, trafficTypeVswitchParamValue); try(PreparedStatement update_pstmt = conn.prepareStatement("update physical_network_traffic_types set vmware_network_label = ? where traffic_type = ? and vmware_network_label is not NULL;");) { - logger.debug("Updating vmware label for " + trafficType + " traffic. Update SQL statement is " + pstmt); + logger.debug("Updating VMware label for " + trafficType + " traffic. Update SQL statement is " + pstmt); pstmt.setString(1, newLabel); pstmt.setString(2, trafficType); update_pstmt.executeUpdate(); }catch (SQLException e) { - throw new CloudRuntimeException("Unable to set vmware traffic labels ", e); + throw new CloudRuntimeException("Unable to set VMware traffic labels ", e); } }catch (SQLException e) { - throw new CloudRuntimeException("Unable to set vmware traffic labels ", e); + throw new CloudRuntimeException("Unable to set VMware traffic labels ", e); } }catch (SQLException e) { - throw new CloudRuntimeException("Unable to set vmware traffic labels ", e); + throw new CloudRuntimeException("Unable to set VMware traffic labels ", e); } } }catch (SQLException e) { - throw new CloudRuntimeException("Unable to set vmware traffic labels ", e); + throw new CloudRuntimeException("Unable to set VMware traffic labels ", e); } } catch (SQLException e) { - throw new CloudRuntimeException("Unable to set vmware traffic labels ", e); + throw new CloudRuntimeException("Unable to set VMware traffic labels ", e); } } @@ -1195,9 +1195,9 @@ private void updateGlobalDeploymentPlanner(Connection conn) { plannerName = "FirstFitPlanner"; } else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.firstfit.toString())) { plannerName = "FirstFitPlanner"; - } else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userconcentratedpod_firstfit.toString())) { + } else if (globalValue.equals("userconcentratedpod_firstfit")) { plannerName = "UserConcentratedPodPlanner"; - } else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userconcentratedpod_random.toString())) { + } else if (globalValue.equals("userconcentratedpod_random")) { plannerName = "UserConcentratedPodPlanner"; } else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userdispersing.toString())) { plannerName = "UserDispersingPlanner"; @@ -1947,7 +1947,7 @@ private void migrateS3ToImageStore(Connection conn) { Map detailMap = new HashMap(); detailMap.put(ApiConstants.S3_ACCESS_KEY, s3_accesskey); - detailMap.put(ApiConstants.S3_SECRET_KEY, s3_secretkey); + detailMap.put(ApiConstants.SECRET_KEY, s3_secretkey); detailMap.put(ApiConstants.S3_BUCKET_NAME, s3_bucket); detailMap.put(ApiConstants.S3_END_POINT, s3_endpoint); detailMap.put(ApiConstants.S3_HTTPS_FLAG, String.valueOf(s3_https)); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41500to41510.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41500to41510.java index a6b77813fa15..c7295414326d 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41500to41510.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41500to41510.java @@ -74,7 +74,7 @@ public void performDataMigration(Connection conn) { @Override @SuppressWarnings("serial") public void updateSystemVmTemplates(final Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); final Set hypervisorsListInUse = new HashSet(); try (PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); ResultSet rs = pstmt.executeQuery()) { while (rs.next()) { @@ -153,8 +153,8 @@ public void updateSystemVmTemplates(final Connection conn) { templateId = rs.getLong(1); } } catch (final SQLException e) { - logger.error("updateSystemVmTemplates: Exception caught while getting ids of templates: " + e.getMessage()); - throw new CloudRuntimeException("updateSystemVmTemplates: Exception caught while getting ids of templates", e); + logger.error("updateSystemVmTemplates: Exception caught while getting IDs of Templates: " + e.getMessage()); + throw new CloudRuntimeException("updateSystemVmTemplates: Exception caught while getting IDs of Templates", e); } // change template type to SYSTEM @@ -163,8 +163,8 @@ public void updateSystemVmTemplates(final Connection conn) { templ_type_pstmt.setLong(1, templateId); templ_type_pstmt.executeUpdate(); } catch (final SQLException e) { - logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage()); - throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e); + logger.error("updateSystemVmTemplates:Exception while updating Template with ID: " + templateId + " to be marked as 'system': " + e.getMessage()); + throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating Template with ID: " + templateId + " to be marked as 'system'", e); } // update template ID of system Vms try (PreparedStatement update_templ_id_pstmt = conn @@ -173,9 +173,9 @@ public void updateSystemVmTemplates(final Connection conn) { update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString()); update_templ_id_pstmt.executeUpdate(); } catch (final Exception e) { - logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId + logger.error("updateSystemVmTemplates:Exception while setting Template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId + ": " + e.getMessage()); - throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting Template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId, e); } @@ -225,8 +225,8 @@ public void updateSystemVmTemplates(final Connection conn) { } } } catch (final SQLException e) { - logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage()); - throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e); + logger.error("updateSystemVmTemplates:Exception while getting IDs of Templates: " + e.getMessage()); + throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting IDs of Templates", e); } } logger.debug("Updating System Vm Template IDs Complete"); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java index 76227d434173..f13e0ffb1169 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java @@ -94,7 +94,7 @@ private void checkAndPersistAnnotationPermissions(Connection conn, RoleType role } private void generateUuidForExistingSshKeyPairs(Connection conn) { - logger.debug("Generating uuid for existing ssh key-pairs"); + logger.debug("Generating UUID for existing SSH key-pairs"); try { PreparedStatement pstmt = conn.prepareStatement("SELECT id FROM `cloud`.`ssh_keypairs` WHERE uuid is null"); ResultSet rs = pstmt.executeQuery(); @@ -110,9 +110,9 @@ private void generateUuidForExistingSshKeyPairs(Connection conn) { if (!pstmt.isClosed()) { pstmt.close(); } - logger.debug("Successfully generated uuid for existing ssh key-pairs"); + logger.debug("Successfully generated UUID for existing SSH key-pairs"); } catch (SQLException e) { - String errMsg = "Exception while generating uuid for existing ssh key-pairs: " + e.getMessage(); + String errMsg = "Exception while generating UUID for existing SSh key-pairs: " + e.getMessage(); logger.error(errMsg, e); throw new CloudRuntimeException(errMsg, e); } @@ -125,7 +125,7 @@ private void initSystemVmTemplateRegistration() { @Override @SuppressWarnings("serial") public void updateSystemVmTemplates(final Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41600to41610.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41600to41610.java index 3208b4ad8f97..07446a64a8c9 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41600to41610.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41600to41610.java @@ -75,12 +75,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register SystemVM Template(s)"); } } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java index 0a0ab0b9f5a9..10404deac924 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41610to41700.java @@ -80,12 +80,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register SystemVM Template(s)"); } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java index 266401e0c31c..1f0d7c49a054 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41700to41710.java @@ -90,12 +90,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register System VM Template(s)"); } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java index 9854268c1ff1..2e17fa297c27 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41720.java @@ -62,12 +62,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register System VM Template(s)"); } } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java index 6a90396deb0b..2f15b85af8e3 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41720to41800.java @@ -99,12 +99,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register System VM Template(s)"); } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41810to41900.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41810to41900.java index e2b1ae1399b6..35e706595ec1 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41810to41900.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41810to41900.java @@ -95,12 +95,12 @@ private void initSystemVmTemplateRegistration() { @Override public void updateSystemVmTemplates(Connection conn) { - logger.debug("Updating System Vm template IDs"); + logger.debug("Updating System VM Template IDs"); initSystemVmTemplateRegistration(); try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register System VM Template(s)"); } } @@ -159,7 +159,7 @@ private void modifyDateColumnNameAndCreateNewOne(Connection conn) { try (PreparedStatement pstmt = conn.prepareStatement(createNewColumn)) { pstmt.execute(); } catch (SQLException e) { - String message = String.format("Unable to crate new backups' column date due to [%s].", e.getMessage()); + String message = String.format("Unable to create new backups' column date due to [%s].", e.getMessage()); logger.error(message, e); throw new CloudRuntimeException(message, e); } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42000to42010.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42000to42010.java index 6298e0e729a5..0c0a9f070baa 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42000to42010.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42000to42010.java @@ -78,7 +78,7 @@ public void updateSystemVmTemplates(Connection conn) { try { systemVmTemplateRegistration.updateSystemVmTemplates(conn); } catch (Exception e) { - throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); + throw new CloudRuntimeException("Failed to find / register SystemVM template(s)", e); } } @@ -100,8 +100,6 @@ private void addIndexes(Connection conn) { DbUpgradeUtils.addIndexIfNeeded(conn, "network_offering_details", "name"); - DbUpgradeUtils.addIndexIfNeeded(conn, "network_offering_details", "resource_id", "resource_type"); - DbUpgradeUtils.addIndexIfNeeded(conn, "service_offering", "cpu"); DbUpgradeUtils.addIndexIfNeeded(conn, "service_offering", "speed"); DbUpgradeUtils.addIndexIfNeeded(conn, "service_offering", "ram_size"); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java index d6dc85dbb9aa..786ee5afbc8e 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42100.java @@ -16,18 +16,22 @@ // under the License. package com.cloud.upgrade.dao; -import com.cloud.upgrade.SystemVmTemplateRegistration; -import com.cloud.utils.db.TransactionLegacy; -import com.cloud.utils.exception.CloudRuntimeException; - import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.cloudstack.framework.config.ConfigKey; +import com.cloud.upgrade.SystemVmTemplateRegistration; +import com.cloud.utils.db.TransactionLegacy; +import com.cloud.utils.exception.CloudRuntimeException; + public class Upgrade42010to42100 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { private SystemVmTemplateRegistration systemVmTemplateRegistration; @@ -59,6 +63,7 @@ public InputStream[] getPrepareScripts() { @Override public void performDataMigration(Connection conn) { + updateKubernetesClusterNodeVersions(conn); migrateConfigurationScopeToBitmask(conn); } @@ -88,6 +93,95 @@ public void updateSystemVmTemplates(Connection conn) { } } + private void updateKubernetesClusterNodeVersions(Connection conn) { + //get list of all non removed kubernetes clusters + try { + Map clusterAndVersion = getKubernetesClusterIdsAndVersion(conn); + updateKubernetesNodeVersions(conn, clusterAndVersion); + } catch (Exception e) { + String errMsg = "Failed to update kubernetes cluster nodes version"; + logger.error(errMsg); + throw new CloudRuntimeException(errMsg, e); + } + } + + private Map getKubernetesClusterIdsAndVersion(Connection conn) { + String listKubernetesClusters = "SELECT c.id, v.semantic_version FROM `cloud`.`kubernetes_cluster` c JOIN `cloud`.`kubernetes_supported_version` v ON (c.kubernetes_version_id = v.id) WHERE c.removed is NULL;"; + Map clusterAndVersion = new HashMap<>(); + try { + PreparedStatement pstmt = conn.prepareStatement(listKubernetesClusters); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + clusterAndVersion.put(rs.getLong(1), rs.getString(2)); + } + rs.close(); + pstmt.close(); + } catch (SQLException e) { + String errMsg = String.format("Failed to get all the kubernetes cluster ids due to: %s", e.getMessage()); + logger.error(errMsg); + throw new CloudRuntimeException(errMsg, e); + } + return clusterAndVersion; + } + + private void updateKubernetesNodeVersions(Connection conn, Map clusterAndVersion) { + List kubernetesClusterVmIds; + for (Map.Entry clusterVersionEntry : clusterAndVersion.entrySet()) { + try { + Long cksClusterId = clusterVersionEntry.getKey(); + String cksVersion = clusterVersionEntry.getValue(); + logger.debug(String.format("Adding CKS version %s to existing CKS cluster %s nodes", cksVersion, cksClusterId)); + kubernetesClusterVmIds = getKubernetesClusterVmMapIds(conn, cksClusterId); + updateKubernetesNodeVersion(conn, kubernetesClusterVmIds, cksClusterId, cksVersion); + } catch (Exception e) { + String errMsg = String.format("Failed to update the node version for kubernetes cluster nodes for the" + + " kubernetes cluster with id: %s," + + " due to: %s", clusterVersionEntry.getKey(), e.getMessage()); + logger.error(errMsg, e); + throw new CloudRuntimeException(errMsg, e); + } + } + } + + private List getKubernetesClusterVmMapIds(Connection conn, Long cksClusterId) { + List kubernetesClusterVmIds = new ArrayList<>(); + String getKubernetesClustersVmMap = "SELECT id FROM `cloud`.`kubernetes_cluster_vm_map` WHERE cluster_id = %s;"; + try { + PreparedStatement pstmt = conn.prepareStatement(String.format(getKubernetesClustersVmMap, cksClusterId)); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + kubernetesClusterVmIds.add(rs.getLong(1)); + } + rs.close(); + pstmt.close(); + } catch (SQLException e) { + String errMsg = String.format("Failed to get the kubernetes cluster vm map IDs for kubernetes cluster with id: %s," + + " due to: %s", cksClusterId, e.getMessage()); + logger.error(errMsg, e); + throw new CloudRuntimeException(errMsg, e); + } + return kubernetesClusterVmIds; + } + + private void updateKubernetesNodeVersion(Connection conn, List kubernetesClusterVmIds, Long cksClusterId, String cksVersion) { + String updateKubernetesNodeVersion = "UPDATE `cloud`.`kubernetes_cluster_vm_map` set kubernetes_node_version = ? WHERE id = ?;"; + for (Long nodeVmId : kubernetesClusterVmIds) { + try { + PreparedStatement pstmt = conn.prepareStatement(updateKubernetesNodeVersion); + pstmt.setString(1, cksVersion); + pstmt.setLong(2, nodeVmId); + pstmt.executeUpdate(); + pstmt.close(); + } catch (Exception e) { + String errMsg = String.format("Failed to update the node version for kubernetes cluster nodes for the" + + " kubernetes cluster with id: %s," + + " due to: %s", cksClusterId, e.getMessage()); + logger.error(errMsg, e); + throw new CloudRuntimeException(errMsg, e); + } + } + } + protected void migrateConfigurationScopeToBitmask(Connection conn) { String scopeDataType = DbUpgradeUtils.getTableColumnType(conn, "configuration", "scope"); logger.info("Data type of the column scope of table configuration is {}", scopeDataType); @@ -118,4 +212,9 @@ protected void migrateExistingConfigurationScopeValues(Connection conn) { throw new CloudRuntimeException(String.format("Failed to migrate existing configuration scope values to bitmask due to: %s", e.getMessage())); } } + + @Override + public boolean refreshPoolConnectionsAfterUpgrade() { + return true; + } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java new file mode 100644 index 000000000000..e0aa38a717b2 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade.dao; + +import java.io.InputStream; +import java.sql.Connection; + +import com.cloud.utils.exception.CloudRuntimeException; + +public class Upgrade42020to42030 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { + + @Override + public String[] getUpgradableVersionRange() { + return new String[]{"4.20.2.0", "4.20.3.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.20.3.0"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public InputStream[] getPrepareScripts() { + final String scriptFile = "META-INF/db/schema-42020to42030.sql"; + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[] {script}; + } + + @Override + public void performDataMigration(Connection conn) { + } + + @Override + public InputStream[] getCleanupScripts() { + return null; + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java new file mode 100644 index 000000000000..5138d51bb1b6 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42100to42200.java @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade.dao; + +import com.cloud.utils.exception.CloudRuntimeException; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class Upgrade42100to42200 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { + + @Override + public String[] getUpgradableVersionRange() { + return new String[]{"4.21.0.0", "4.22.0.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.22.0.0"; + } + + @Override + public InputStream[] getPrepareScripts() { + final String scriptFile = "META-INF/db/schema-42100to42200.sql"; + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[] {script}; + } + + @Override + public void performDataMigration(Connection conn) { + updateSnapshotPolicyOwnership(conn); + updateBackupScheduleOwnership(conn); + } + + protected void updateSnapshotPolicyOwnership(Connection conn) { + // set account_id and domain_id in snapshot_policy table from volume table + String selectSql = "SELECT sp.id, v.account_id, v.domain_id FROM snapshot_policy sp, volumes v WHERE sp.volume_id = v.id AND (sp.account_id IS NULL AND sp.domain_id IS NULL)"; + String updateSql = "UPDATE snapshot_policy SET account_id = ?, domain_id = ? WHERE id = ?"; + + try (PreparedStatement selectPstmt = conn.prepareStatement(selectSql); + ResultSet rs = selectPstmt.executeQuery(); + PreparedStatement updatePstmt = conn.prepareStatement(updateSql)) { + + while (rs.next()) { + long policyId = rs.getLong(1); + long accountId = rs.getLong(2); + long domainId = rs.getLong(3); + + updatePstmt.setLong(1, accountId); + updatePstmt.setLong(2, domainId); + updatePstmt.setLong(3, policyId); + updatePstmt.executeUpdate(); + } + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to update snapshot_policy table with account_id and domain_id", e); + } + } + + protected void updateBackupScheduleOwnership(Connection conn) { + // Set account_id and domain_id in backup_schedule table from vm_instance table + String selectSql = "SELECT bs.id, vm.account_id, vm.domain_id FROM backup_schedule bs, vm_instance vm WHERE bs.vm_id = vm.id AND (bs.account_id IS NULL AND bs.domain_id IS NULL)"; + String updateSql = "UPDATE backup_schedule SET account_id = ?, domain_id = ? WHERE id = ?"; + + try (PreparedStatement selectPstmt = conn.prepareStatement(selectSql); + ResultSet rs = selectPstmt.executeQuery(); + PreparedStatement updatePstmt = conn.prepareStatement(updateSql)) { + + while (rs.next()) { + long scheduleId = rs.getLong(1); + long accountId = rs.getLong(2); + long domainId = rs.getLong(3); + + updatePstmt.setLong(1, accountId); + updatePstmt.setLong(2, domainId); + updatePstmt.setLong(3, scheduleId); + updatePstmt.executeUpdate(); + } + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to update backup_schedule table with account_id and domain_id", e); + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42200to42210.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42200to42210.java new file mode 100644 index 000000000000..813351d75341 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42200to42210.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade.dao; + +import org.apache.cloudstack.vm.UnmanagedVMsManager; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +public class Upgrade42200to42210 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { + + @Override + public String[] getUpgradableVersionRange() { + return new String[] {"4.22.0.0", "4.22.1.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.22.1.0"; + } + + @Override + public void performDataMigration(Connection conn) { + removeDuplicateKVMImportTemplates(conn); + } + + private void removeDuplicateKVMImportTemplates(Connection conn) { + List templateIds = new ArrayList<>(); + try (PreparedStatement selectStmt = conn.prepareStatement(String.format("SELECT id FROM cloud.vm_template WHERE name='%s' ORDER BY id ASC", UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME))) { + ResultSet rs = selectStmt.executeQuery(); + while (rs.next()) { + templateIds.add(rs.getLong(1)); + } + + if (templateIds.size() <= 1) { + return; + } + + logger.info("Removing duplicate template " + UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME + " entries"); + Long firstTemplateId = templateIds.get(0); + + String updateTemplateSql = "UPDATE cloud.vm_instance SET vm_template_id = ? WHERE vm_template_id = ?"; + String deleteTemplateSql = "DELETE FROM cloud.vm_template WHERE id = ?"; + + try (PreparedStatement updateTemplateStmt = conn.prepareStatement(updateTemplateSql); + PreparedStatement deleteTemplateStmt = conn.prepareStatement(deleteTemplateSql)) { + for (int i = 1; i < templateIds.size(); i++) { + Long duplicateTemplateId = templateIds.get(i); + + // Update VM references + updateTemplateStmt.setLong(1, firstTemplateId); + updateTemplateStmt.setLong(2, duplicateTemplateId); + updateTemplateStmt.executeUpdate(); + + // Delete duplicate dummy template + deleteTemplateStmt.setLong(1, duplicateTemplateId); + deleteTemplateStmt.executeUpdate(); + } + } + } catch (Exception e) { + logger.warn("Failed to remove duplicate template " + UnmanagedVMsManager.KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME + " entries", e); + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java new file mode 100644 index 000000000000..393f20399503 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42210to42300.java @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade.dao; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import com.cloud.utils.crypt.DBEncryptionUtil; +import com.cloud.utils.exception.CloudRuntimeException; + +public class Upgrade42210to42300 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate { + + @Override + public String[] getUpgradableVersionRange() { + return new String[]{"4.22.1.0", "4.23.0.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.23.0.0"; + } + + @Override + public InputStream[] getPrepareScripts() { + final String scriptFile = "META-INF/db/schema-42210to42300.sql"; + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[] {script}; + } + + @Override + public void performDataMigration(Connection conn) { + unhideJsInterpretationEnabled(conn); + } + + protected void unhideJsInterpretationEnabled(Connection conn) { + String value = getJsInterpretationEnabled(conn); + if (value != null) { + updateJsInterpretationEnabledFields(conn, value); + } + } + + protected String getJsInterpretationEnabled(Connection conn) { + String query = "SELECT value FROM cloud.configuration WHERE name = 'js.interpretation.enabled' AND category = 'Hidden';"; + + try (PreparedStatement pstmt = conn.prepareStatement(query)) { + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) { + return rs.getString("value"); + } + logger.debug("Unable to retrieve value of hidden configuration 'js.interpretation.enabled'. The configuration may already be unhidden."); + return null; + } catch (SQLException e) { + throw new CloudRuntimeException("Error while retrieving value of hidden configuration 'js.interpretation.enabled'.", e); + } + } + + protected void updateJsInterpretationEnabledFields(Connection conn, String encryptedValue) { + String query = "UPDATE cloud.configuration SET value = ?, category = 'System', component = 'JsInterpreter', is_dynamic = 1 WHERE name = 'js.interpretation.enabled';"; + + try (PreparedStatement pstmt = conn.prepareStatement(query)) { + String decryptedValue = DBEncryptionUtil.decrypt(encryptedValue); + logger.info("Updating setting 'js.interpretation.enabled' to decrypted value [{}], category 'System', component 'JsInterpreter', and is_dynamic '1'.", decryptedValue); + pstmt.setString(1, decryptedValue); + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new CloudRuntimeException("Error while unhiding configuration 'js.interpretation.enabled'.", e); + } catch (CloudRuntimeException e) { + logger.warn("Error while decrypting configuration 'js.interpretation.enabled'. The configuration may already be decrypted."); + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/usage/UsageVolumeVO.java b/engine/schema/src/main/java/com/cloud/usage/UsageVolumeVO.java index 96abd2d69c08..6d5315e33464 100644 --- a/engine/schema/src/main/java/com/cloud/usage/UsageVolumeVO.java +++ b/engine/schema/src/main/java/com/cloud/usage/UsageVolumeVO.java @@ -59,6 +59,9 @@ public class UsageVolumeVO implements InternalIdentity { @Column(name = "size") private long size; + @Column(name = "vm_id") + private Long vmId; + @Column(name = "created") @Temporal(value = TemporalType.TIMESTAMP) private Date created = null; @@ -70,13 +73,14 @@ public class UsageVolumeVO implements InternalIdentity { protected UsageVolumeVO() { } - public UsageVolumeVO(long id, long zoneId, long accountId, long domainId, Long diskOfferingId, Long templateId, long size, Date created, Date deleted) { + public UsageVolumeVO(long id, long zoneId, long accountId, long domainId, Long diskOfferingId, Long templateId, Long vmId, long size, Date created, Date deleted) { this.volumeId = id; this.zoneId = zoneId; this.accountId = accountId; this.domainId = domainId; this.diskOfferingId = diskOfferingId; this.templateId = templateId; + this.vmId = vmId; this.size = size; this.created = created; this.deleted = deleted; @@ -126,4 +130,12 @@ public void setDeleted(Date deleted) { public long getVolumeId() { return volumeId; } + + public Long getVmId() { + return vmId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDao.java index 8a72182ec677..2a24016653db 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDao.java @@ -24,7 +24,7 @@ import com.cloud.utils.db.GenericDao; public interface UsageBackupDao extends GenericDao { - void updateMetrics(Long vmId, Long size, Long virtualSize); - void removeUsage(Long accountId, Long vmId, Date eventDate); + void updateMetrics(Long vmId, Long backupOfferingId, Long size, Long virtualSize); + void removeUsage(Long accountId, Long vmId, Long backupOfferingId, Date eventDate); List getUsageRecords(Long accountId, Date startDate, Date endDate); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDaoImpl.java index 3403a8dfe5bb..3f852b0cfb5a 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageBackupDaoImpl.java @@ -36,16 +36,17 @@ @Component public class UsageBackupDaoImpl extends GenericDaoBase implements UsageBackupDao { - protected static final String UPDATE_DELETED = "UPDATE usage_backup SET removed = ? WHERE account_id = ? AND vm_id = ? and removed IS NULL"; + protected static final String UPDATE_DELETED = "UPDATE usage_backup SET removed = ? WHERE account_id = ? AND vm_id = ? and backup_offering_id = ? and removed IS NULL"; protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT id, zone_id, account_id, domain_id, vm_id, backup_offering_id, size, protected_size, created, removed FROM usage_backup WHERE " + " account_id = ? AND ((removed IS NULL AND created <= ?) OR (created BETWEEN ? AND ?) OR (removed BETWEEN ? AND ?) " + " OR ((created <= ?) AND (removed >= ?)))"; @Override - public void updateMetrics(final Long vmId, final Long size, final Long virtualSize) { + public void updateMetrics(final Long vmId, Long backupOfferingId, final Long size, final Long virtualSize) { try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB)) { SearchCriteria sc = this.createSearchCriteria(); sc.addAnd("vmId", SearchCriteria.Op.EQ, vmId); + sc.addAnd("backupOfferingId", SearchCriteria.Op.EQ, backupOfferingId); UsageBackupVO vo = findOneBy(sc); if (vo != null) { vo.setSize(size); @@ -58,7 +59,7 @@ public void updateMetrics(final Long vmId, final Long size, final Long virtualSi } @Override - public void removeUsage(Long accountId, Long vmId, Date eventDate) { + public void removeUsage(Long accountId, Long vmId, Long backupOfferingId, Date eventDate) { TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); try { txn.start(); @@ -67,6 +68,7 @@ public void removeUsage(Long accountId, Long vmId, Date eventDate) { pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), eventDate)); pstmt.setLong(2, accountId); pstmt.setLong(3, vmId); + pstmt.setLong(4, backupOfferingId); pstmt.executeUpdate(); } } catch (SQLException e) { diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDao.java index ea490e60f9e7..b9d8d9c05366 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDao.java @@ -62,7 +62,7 @@ public interface UsageDao extends GenericDao { void saveUsageRecords(List usageRecords); - void removeOldUsageRecords(int days); + void expungeAllOlderThan(int days, long limitPerQuery); UsageVO persistUsage(final UsageVO usage); diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java index fb925a285136..2d99c78fad18 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageDaoImpl.java @@ -26,15 +26,16 @@ import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.QueryBuilder; +import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.Transaction; import com.cloud.utils.db.TransactionCallback; -import com.cloud.utils.db.TransactionCallbackNoReturn; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.db.TransactionStatus; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.acl.RoleType; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.stereotype.Component; import java.sql.PreparedStatement; @@ -51,8 +52,7 @@ public class UsageDaoImpl extends GenericDaoBase implements UsageDao { private static final String DELETE_ALL = "DELETE FROM cloud_usage"; private static final String DELETE_ALL_BY_ACCOUNTID = "DELETE FROM cloud_usage WHERE account_id = ?"; - private static final String DELETE_ALL_BY_INTERVAL = "DELETE FROM cloud_usage WHERE end_date < DATE_SUB(CURRENT_DATE(), INTERVAL ? DAY)"; - private static final String INSERT_ACCOUNT = "INSERT INTO cloud_usage.account (id, account_name, type, role_id, domain_id, removed, cleanup_needed) VALUES (?,?,?,?,?,?,?)"; + private static final String INSERT_ACCOUNT = "INSERT INTO cloud_usage.account (id, account_name, uuid, type, role_id, domain_id, removed, cleanup_needed) VALUES (?,?,?,?,?,?,?,?)"; private static final String INSERT_USER_STATS = "INSERT INTO cloud_usage.user_statistics (id, data_center_id, account_id, public_ip_address, device_id, device_type, network_id, net_bytes_received," + " net_bytes_sent, current_bytes_received, current_bytes_sent, agg_bytes_received, agg_bytes_sent) VALUES (?,?,?,?,?,?,?,?,?,?, ?, ?, ?)"; @@ -88,8 +88,12 @@ public class UsageDaoImpl extends GenericDaoBase implements Usage private static final String UPDATE_BUCKET_STATS = "UPDATE cloud_usage.bucket_statistics SET size=? WHERE id=?"; + protected SearchBuilder endDateLessThanSearch; public UsageDaoImpl() { + endDateLessThanSearch = createSearchBuilder(); + endDateLessThanSearch.and("endDate", endDateLessThanSearch.entity().getEndDate(), SearchCriteria.Op.LT); + endDateLessThanSearch.done(); } @Override @@ -107,7 +111,7 @@ public void deleteRecordsForAccount(Long accountId) { txn.commit(); } catch (Exception ex) { txn.rollback(); - logger.error("error retrieving usage vm instances for account id: " + accountId, ex); + logger.error("Error retrieving usage Instances for Account ID: " + accountId, ex); } finally { txn.close(); } @@ -129,25 +133,26 @@ public void saveAccounts(List accounts) { for (AccountVO acct : accounts) { pstmt.setLong(1, acct.getId()); pstmt.setString(2, acct.getAccountName()); - pstmt.setInt(3, acct.getType().ordinal()); + pstmt.setString(3, acct.getUuid()); + pstmt.setInt(4, acct.getType().ordinal()); //prevent autoboxing NPE by defaulting to User role if(acct.getRoleId() == null){ - pstmt.setLong(4, RoleType.User.getId()); + pstmt.setLong(5, RoleType.User.getId()); }else{ - pstmt.setLong(4, acct.getRoleId()); + pstmt.setLong(5, acct.getRoleId()); } - pstmt.setLong(5, acct.getDomainId()); + pstmt.setLong(6, acct.getDomainId()); Date removed = acct.getRemoved(); if (removed == null) { - pstmt.setString(6, null); + pstmt.setString(7, null); } else { - pstmt.setString(6, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), acct.getRemoved())); + pstmt.setString(7, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), acct.getRemoved())); } - pstmt.setBoolean(7, acct.getNeedsCleanup()); + pstmt.setBoolean(8, acct.getNeedsCleanup()); pstmt.addBatch(); } @@ -369,7 +374,7 @@ public List listPublicTemplatesByAccount(long accountId) { templateList.add(Long.valueOf(rs.getLong(1))); } } catch (Exception ex) { - logger.error("error listing public templates", ex); + logger.error("Error listing public Templates", ex); } return templateList; } @@ -538,21 +543,20 @@ public void saveUsageRecords(List usageRecords) { } @Override - public void removeOldUsageRecords(int days) { - Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallbackNoReturn() { - @Override - public void doInTransactionWithoutResult(TransactionStatus status) { - TransactionLegacy txn = TransactionLegacy.currentTxn(); - PreparedStatement pstmt = null; - try { - pstmt = txn.prepareAutoCloseStatement(DELETE_ALL_BY_INTERVAL); - pstmt.setLong(1, days); - pstmt.executeUpdate(); - } catch (Exception ex) { - logger.error("error removing old cloud_usage records for interval: " + days); - } - } - }); + public void expungeAllOlderThan(int days, long limitPerQuery) { + SearchCriteria sc = endDateLessThanSearch.create(); + + Date limit = DateUtils.addDays(new Date(), -days); + sc.setParameters("endDate", limit); + + TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); + try { + logger.debug("Removing all cloud_usage records older than [{}].", limit); + int totalExpunged = batchExpunge(sc, limitPerQuery); + logger.info("Removed a total of [{}] cloud_usage records older than [{}].", totalExpunged, limit); + } finally { + txn.close(); + } } public UsageVO persistUsage(final UsageVO usage) { diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDao.java index f22a906054d9..b22ce69d94ea 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDao.java @@ -28,6 +28,8 @@ public interface UsageJobDao extends GenericDao { UsageJobVO getLastJob(); + UsageJobVO getNextRecurringJob(); + UsageJobVO getNextImmediateJob(); long getLastJobSuccessDateMillis(); @@ -37,4 +39,6 @@ public interface UsageJobDao extends GenericDao { UsageJobVO isOwner(String hostname, int pid); void updateJobSuccess(Long jobId, long startMillis, long endMillis, long execTime, boolean success); + + void removeLastOpenJobsOwned(String hostname, int pid); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java index 6d460aadd093..6f340501cf18 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java @@ -22,6 +22,7 @@ import java.util.List; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; import com.cloud.usage.UsageJobVO; @@ -114,7 +115,7 @@ public Long checkHeartbeat(String hostname, int pid, int aggregationDuration) { public UsageJobVO isOwner(String hostname, int pid) { TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); try { - if ((hostname == null) || (pid <= 0)) { + if (hostname == null || pid <= 0) { return null; } @@ -155,7 +156,8 @@ public UsageJobVO getLastJob() { return jobs.get(0); } - private UsageJobVO getNextRecurringJob() { + @Override + public UsageJobVO getNextRecurringJob() { Filter filter = new Filter(UsageJobVO.class, "id", false, Long.valueOf(0), Long.valueOf(1)); SearchCriteria sc = createSearchCriteria(); sc.addAnd("endMillis", SearchCriteria.Op.EQ, Long.valueOf(0)); @@ -174,7 +176,7 @@ public UsageJobVO getNextImmediateJob() { SearchCriteria sc = createSearchCriteria(); sc.addAnd("endMillis", SearchCriteria.Op.EQ, Long.valueOf(0)); sc.addAnd("jobType", SearchCriteria.Op.EQ, Integer.valueOf(UsageJobVO.JOB_TYPE_SINGLE)); - sc.addAnd("scheduled", SearchCriteria.Op.EQ, Integer.valueOf(0)); + sc.addAnd("scheduled", SearchCriteria.Op.EQ, Integer.valueOf(UsageJobVO.JOB_NOT_SCHEDULED)); List jobs = search(sc, filter); if ((jobs == null) || jobs.isEmpty()) { @@ -194,4 +196,36 @@ public Date getLastHeartbeat() { } return jobs.get(0).getHeartbeat(); } + + private List getLastOpenJobsOwned(String hostname, int pid) { + SearchCriteria sc = createSearchCriteria(); + sc.addAnd("endMillis", SearchCriteria.Op.EQ, Long.valueOf(0)); + sc.addAnd("host", SearchCriteria.Op.EQ, hostname); + if (pid > 0) { + sc.addAnd("pid", SearchCriteria.Op.EQ, Integer.valueOf(pid)); + } + return listBy(sc); + } + + @Override + public void removeLastOpenJobsOwned(String hostname, int pid) { + if (hostname == null) { + return; + } + + TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); + try { + List jobs = getLastOpenJobsOwned(hostname, pid); + if (CollectionUtils.isNotEmpty(jobs)) { + logger.info("Found {} opens job, to remove", jobs.size()); + for (UsageJobVO job : jobs) { + logger.debug("Removing job - id: {}, pid: {}, job type: {}, scheduled: {}, heartbeat: {}", + job.getId(), job.getPid(), job.getJobType(), job.getScheduled(), job.getHeartbeat()); + remove(job.getId()); + } + } + } finally { + txn.close(); + } + } } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDao.java index 9be4c49b55e0..4d84caaad44f 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDao.java @@ -28,4 +28,6 @@ public interface UsageNetworksDao extends GenericDao { void remove(long networkId, Date removed); List getUsageRecords(Long accountId, Date startDate, Date endDate); + + List listAll(long networkId); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDaoImpl.java index 99ba35876884..e7ae622ae54f 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageNetworksDaoImpl.java @@ -19,6 +19,7 @@ import com.cloud.usage.UsageNetworksVO; import com.cloud.utils.DateUtil; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.TransactionLegacy; @@ -26,6 +27,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import javax.annotation.PostConstruct; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; @@ -40,6 +42,14 @@ public class UsageNetworksDaoImpl extends GenericDaoBase " account_id = ? AND ((removed IS NULL AND created <= ?) OR (created BETWEEN ? AND ?) OR (removed BETWEEN ? AND ?) " + " OR ((created <= ?) AND (removed >= ?)))"; + private SearchBuilder usageNetworksSearch; + + @PostConstruct + public void init() { + usageNetworksSearch = createSearchBuilder(); + usageNetworksSearch.and("networkId", usageNetworksSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); + usageNetworksSearch.done(); + } @Override public void update(long networkId, long newNetworkOffering, String state) { @@ -131,4 +141,11 @@ public List getUsageRecords(Long accountId, Date startDate, Dat return usageRecords; } + + @Override + public List listAll(long networkId) { + SearchCriteria sc = usageNetworksSearch.create(); + sc.setParameters("networkId", networkId); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageStorageDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageStorageDaoImpl.java index 1da533493997..f863cd1e3a35 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageStorageDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageStorageDaoImpl.java @@ -57,6 +57,7 @@ public UsageStorageDaoImpl() { IdSearch.and("accountId", IdSearch.entity().getAccountId(), SearchCriteria.Op.EQ); IdSearch.and("id", IdSearch.entity().getEntityId(), SearchCriteria.Op.EQ); IdSearch.and("type", IdSearch.entity().getStorageType(), SearchCriteria.Op.EQ); + IdSearch.and("deleted", IdSearch.entity().getDeleted(), SearchCriteria.Op.NULL); IdSearch.done(); IdZoneSearch = createSearchBuilder(); @@ -74,6 +75,7 @@ public List listById(long accountId, long id, int type) { sc.setParameters("accountId", accountId); sc.setParameters("id", id); sc.setParameters("type", type); + sc.setParameters("deleted", null); return listBy(sc, null); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVMInstanceDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVMInstanceDaoImpl.java index 2fd453013bd1..41138bae2bdc 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVMInstanceDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVMInstanceDaoImpl.java @@ -81,7 +81,7 @@ public void delete(UsageVMInstanceVO instance) { txn.commit(); } catch (Exception ex) { txn.rollback(); - logger.error("error deleting usage vm instance with vmId: " + instance.getVmInstanceId() + ", for account with id: " + instance.getAccountId()); + logger.error("Error deleting usage Instance with vmId: " + instance.getVmInstanceId() + ", for account with id: " + instance.getAccountId()); } finally { txn.close(); } @@ -139,7 +139,7 @@ public List getUsageRecords(long accountId, Date startDate, D usageInstances.add(usageInstance); } } catch (Exception ex) { - logger.error("error retrieving usage vm instances for account id: " + accountId, ex); + logger.error("Error retrieving usage Instances for Account ID: " + accountId, ex); } finally { txn.close(); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDao.java index 09590b739930..05287240f254 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDao.java @@ -23,9 +23,7 @@ import com.cloud.utils.db.GenericDao; public interface UsageVolumeDao extends GenericDao { - public void removeBy(long userId, long id); - - public void update(UsageVolumeVO usage); - public List getUsageRecords(Long accountId, Long domainId, Date startDate, Date endDate, boolean limit, int page); + + List listByVolumeId(long volumeId, long accountId); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDaoImpl.java index 4662a6f26ce8..095070feac1c 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVolumeDaoImpl.java @@ -18,81 +18,46 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.TimeZone; -import com.cloud.exception.CloudException; +import javax.annotation.PostConstruct; + import org.springframework.stereotype.Component; import com.cloud.usage.UsageVolumeVO; import com.cloud.utils.DateUtil; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.TransactionLegacy; @Component public class UsageVolumeDaoImpl extends GenericDaoBase implements UsageVolumeDao { - protected static final String REMOVE_BY_USERID_VOLID = "DELETE FROM usage_volume WHERE account_id = ? AND volume_id = ?"; - protected static final String UPDATE_DELETED = "UPDATE usage_volume SET deleted = ? WHERE account_id = ? AND volume_id = ? and deleted IS NULL"; - protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, size, created, deleted " + protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, vm_id, size, created, deleted " + "FROM usage_volume " + "WHERE account_id = ? AND ((deleted IS NULL) OR (created BETWEEN ? AND ?) OR " + " (deleted BETWEEN ? AND ?) OR ((created <= ?) AND (deleted >= ?)))"; - protected static final String GET_USAGE_RECORDS_BY_DOMAIN = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, size, created, deleted " + protected static final String GET_USAGE_RECORDS_BY_DOMAIN = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, vm_id, size, created, deleted " + "FROM usage_volume " + "WHERE domain_id = ? AND ((deleted IS NULL) OR (created BETWEEN ? AND ?) OR " + " (deleted BETWEEN ? AND ?) OR ((created <= ?) AND (deleted >= ?)))"; - protected static final String GET_ALL_USAGE_RECORDS = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, size, created, deleted " + protected static final String GET_ALL_USAGE_RECORDS = "SELECT volume_id, zone_id, account_id, domain_id, disk_offering_id, template_id, vm_id, size, created, deleted " + "FROM usage_volume " + "WHERE (deleted IS NULL) OR (created BETWEEN ? AND ?) OR " + " (deleted BETWEEN ? AND ?) OR ((created <= ?) AND (deleted >= ?))"; + private SearchBuilder volumeSearch; public UsageVolumeDaoImpl() { } - @Override - public void removeBy(long accountId, long volId) { - TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); - try { - txn.start(); - try(PreparedStatement pstmt = txn.prepareStatement(REMOVE_BY_USERID_VOLID);) { - if (pstmt != null) { - pstmt.setLong(1, accountId); - pstmt.setLong(2, volId); - pstmt.executeUpdate(); - } - }catch (SQLException e) { - throw new CloudException("Error removing usageVolumeVO:"+e.getMessage(), e); - } - txn.commit(); - } catch (Exception e) { - txn.rollback(); - logger.warn("Error removing usageVolumeVO:"+e.getMessage(), e); - } finally { - txn.close(); - } - } - - @Override - public void update(UsageVolumeVO usage) { - TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); - PreparedStatement pstmt = null; - try { - txn.start(); - if (usage.getDeleted() != null) { - pstmt = txn.prepareAutoCloseStatement(UPDATE_DELETED); - pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), usage.getDeleted())); - pstmt.setLong(2, usage.getAccountId()); - pstmt.setLong(3, usage.getVolumeId()); - pstmt.executeUpdate(); - } - txn.commit(); - } catch (Exception e) { - txn.rollback(); - logger.warn("Error updating UsageVolumeVO", e); - } finally { - txn.close(); - } + @PostConstruct + protected void init() { + volumeSearch = createSearchBuilder(); + volumeSearch.and("accountId", volumeSearch.entity().getAccountId(), SearchCriteria.Op.EQ); + volumeSearch.and("volumeId", volumeSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); + volumeSearch.and("deleted", volumeSearch.entity().getDeleted(), SearchCriteria.Op.NULL); + volumeSearch.done(); } @Override @@ -150,11 +115,15 @@ public List getUsageRecords(Long accountId, Long domainId, Date s if (tId == 0) { tId = null; } - long size = Long.valueOf(rs.getLong(7)); + Long vmId = Long.valueOf(rs.getLong(7)); + if (vmId == 0) { + vmId = null; + } + long size = Long.valueOf(rs.getLong(8)); Date createdDate = null; Date deletedDate = null; - String createdTS = rs.getString(8); - String deletedTS = rs.getString(9); + String createdTS = rs.getString(9); + String deletedTS = rs.getString(10); if (createdTS != null) { createdDate = DateUtil.parseDateString(s_gmtTimeZone, createdTS); @@ -163,7 +132,7 @@ public List getUsageRecords(Long accountId, Long domainId, Date s deletedDate = DateUtil.parseDateString(s_gmtTimeZone, deletedTS); } - usageRecords.add(new UsageVolumeVO(vId, zoneId, acctId, dId, doId, tId, size, createdDate, deletedDate)); + usageRecords.add(new UsageVolumeVO(vId, zoneId, acctId, dId, doId, tId, vmId, size, createdDate, deletedDate)); } } catch (Exception e) { txn.rollback(); @@ -174,4 +143,13 @@ public List getUsageRecords(Long accountId, Long domainId, Date s return usageRecords; } + + @Override + public List listByVolumeId(long volumeId, long accountId) { + SearchCriteria sc = volumeSearch.create(); + sc.setParameters("accountId", accountId); + sc.setParameters("volumeId", volumeId); + sc.setParameters("deleted", null); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDao.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDao.java index a1514aba4cad..5167bf88c485 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDao.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDao.java @@ -24,6 +24,10 @@ public interface UsageVpcDao extends GenericDao { void update(UsageVpcVO usage); + void remove(long vpcId, Date removed); + List getUsageRecords(Long accountId, Date startDate, Date endDate); + + List listAll(long vpcId); } diff --git a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDaoImpl.java b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDaoImpl.java index 70cdadd1629f..b5d8e46ef092 100644 --- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageVpcDaoImpl.java @@ -19,10 +19,12 @@ import com.cloud.usage.UsageVpcVO; import com.cloud.utils.DateUtil; import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.TransactionLegacy; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; @@ -36,6 +38,15 @@ public class UsageVpcDaoImpl extends GenericDaoBase implements " account_id = ? AND ((removed IS NULL AND created <= ?) OR (created BETWEEN ? AND ?) OR (removed BETWEEN ? AND ?) " + " OR ((created <= ?) AND (removed >= ?)))"; + private SearchBuilder usageVpcSearch; + + @PostConstruct + public void init() { + usageVpcSearch = createSearchBuilder(); + usageVpcSearch.and("vpcId", usageVpcSearch.entity().getVpcId(), SearchCriteria.Op.EQ); + usageVpcSearch.done(); + } + @Override public void update(UsageVpcVO usage) { TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); @@ -124,4 +135,11 @@ public List getUsageRecords(Long accountId, Date startDate, Date end return usageRecords; } + + @Override + public List listAll(long vpcId) { + SearchCriteria sc = usageVpcSearch.create(); + sc.setParameters("vpcId", vpcId); + return listBy(sc); + } } diff --git a/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java b/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java index e4fcbad6b02f..7345eeb48539 100644 --- a/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java +++ b/engine/schema/src/main/java/com/cloud/user/UserAccountVO.java @@ -36,7 +36,6 @@ import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import org.apache.commons.lang3.StringUtils; -import com.cloud.utils.db.Encrypt; import com.cloud.utils.db.GenericDao; @Entity @@ -69,13 +68,6 @@ public class UserAccountVO implements UserAccount, InternalIdentity { @Column(name = "state") private String state; - @Column(name = "api_key") - private String apiKey = null; - - @Encrypt - @Column(name = "secret_key") - private String secretKey = null; - @Column(name = GenericDao.CREATED_COLUMN) private Date created; @@ -203,33 +195,11 @@ public void setState(String state) { this.state = state; } - @Override - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - @Override - public String getSecretKey() { - return secretKey; - } - - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - @Override public Date getCreated() { return created; } -// public void setCreated(Date created) { -// this.created = created; -// } - @Override public Date getRemoved() { return removed; diff --git a/engine/schema/src/main/java/com/cloud/user/UserDataVO.java b/engine/schema/src/main/java/com/cloud/user/UserDataVO.java index a8e48ad22b1a..e8864976069d 100644 --- a/engine/schema/src/main/java/com/cloud/user/UserDataVO.java +++ b/engine/schema/src/main/java/com/cloud/user/UserDataVO.java @@ -65,6 +65,9 @@ public UserDataVO() { @Column(name = GenericDao.REMOVED_COLUMN) private Date removed; + @Column(name = "for_cks") + private boolean forCks; + @Override public long getDomainId() { return domainId; @@ -105,6 +108,11 @@ public String getParams() { return params; } + @Override + public boolean isForCks() { + return forCks; + } + public void setAccountId(long accountId) { this.accountId = accountId; } @@ -132,4 +140,6 @@ public void setRemoved(Date removed) { public Date getRemoved() { return removed; } + + public void setForCks(boolean forCks) { this.forCks = forCks; } } diff --git a/engine/schema/src/main/java/com/cloud/user/UserVO.java b/engine/schema/src/main/java/com/cloud/user/UserVO.java index 6e355e102e6c..1b89bc215cf7 100644 --- a/engine/schema/src/main/java/com/cloud/user/UserVO.java +++ b/engine/schema/src/main/java/com/cloud/user/UserVO.java @@ -33,7 +33,6 @@ import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import com.cloud.user.Account.State; -import com.cloud.utils.db.Encrypt; import com.cloud.utils.db.GenericDao; import org.apache.commons.lang3.StringUtils; @@ -71,13 +70,6 @@ public class UserVO implements User, Identity, InternalIdentity { @Enumerated(value = EnumType.STRING) private State state; - @Column(name = "api_key") - private String apiKey = null; - - @Encrypt - @Column(name = "secret_key") - private String secretKey = null; - @Column(name = GenericDao.CREATED_COLUMN) private Date created; @@ -123,8 +115,8 @@ public UserVO() { } public UserVO(long id) { + this(); this.id = id; - this.uuid = UUID.randomUUID().toString(); } public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid, Source source) { @@ -150,8 +142,6 @@ public UserVO(UserVO user) { this.setTimezone(user.getTimezone()); this.setUuid(user.getUuid()); this.setSource(user.getSource()); - this.setApiKey(user.getApiKey()); - this.setSecretKey(user.getSecretKey()); this.setExternalEntity(user.getExternalEntity()); this.setRegistered(user.isRegistered()); this.setRegistrationToken(user.getRegistrationToken()); @@ -243,26 +233,6 @@ public void setState(State state) { this.state = state; } - @Override - public String getApiKey() { - return apiKey; - } - - @Override - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - @Override - public String getSecretKey() { - return secretKey; - } - - @Override - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - @Override public String getTimezone() { if (StringUtils.isEmpty(timezone)) { diff --git a/engine/schema/src/main/java/com/cloud/user/dao/AccountDao.java b/engine/schema/src/main/java/com/cloud/user/dao/AccountDao.java index 17b07496731e..67b70571cb4c 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/AccountDao.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/AccountDao.java @@ -16,23 +16,23 @@ // under the License. package com.cloud.user.dao; +import java.util.Date; +import java.util.List; + import com.cloud.user.Account; import com.cloud.user.AccountVO; -import com.cloud.user.User; import com.cloud.utils.Pair; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDao; -import java.util.Date; -import java.util.List; - public interface AccountDao extends GenericDao { - Pair findUserAccountByApiKey(String apiKey); List findAccountsLike(String accountName); Pair, Integer> findAccountsLike(String accountName, Filter filter); + List findAccountsByName(String accountName); + List findActiveAccounts(Long maxAccountId, Filter filter); List findRecentlyDeletedAccounts(Long maxAccountId, Date earliestRemovedDate, Filter filter); diff --git a/engine/schema/src/main/java/com/cloud/user/dao/AccountDaoImpl.java b/engine/schema/src/main/java/com/cloud/user/dao/AccountDaoImpl.java index 2654b22374f4..48b29fac45eb 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/AccountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/AccountDaoImpl.java @@ -16,13 +16,16 @@ // under the License. package com.cloud.user.dao; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + import com.cloud.user.Account; import com.cloud.user.Account.State; import com.cloud.user.AccountVO; -import com.cloud.user.User; -import com.cloud.user.UserVO; import com.cloud.utils.Pair; -import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; @@ -30,20 +33,9 @@ import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; import com.cloud.utils.db.SearchCriteria.Op; -import org.apache.commons.lang3.StringUtils; -import com.cloud.utils.db.TransactionLegacy; -import org.springframework.stereotype.Component; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.Date; -import java.util.List; @Component public class AccountDaoImpl extends GenericDaoBase implements AccountDao { - private static final String FIND_USER_ACCOUNT_BY_API_KEY = "SELECT u.id, u.username, u.account_id, u.secret_key, u.state, u.api_key_access, " - + "a.id, a.account_name, a.type, a.role_id, a.domain_id, a.state, a.api_key_access " + "FROM `cloud`.`user` u, `cloud`.`account` a " - + "WHERE u.account_id = a.id AND u.api_key = ? and u.removed IS NULL"; protected final SearchBuilder AllFieldsSearch; protected final SearchBuilder AccountTypeSearch; @@ -131,51 +123,6 @@ public List findCleanupsForDisabledAccounts() { return listBy(sc); } - @Override - public Pair findUserAccountByApiKey(String apiKey) { - TransactionLegacy txn = TransactionLegacy.currentTxn(); - PreparedStatement pstmt = null; - Pair userAcctPair = null; - try { - String sql = FIND_USER_ACCOUNT_BY_API_KEY; - pstmt = txn.prepareAutoCloseStatement(sql); - pstmt.setString(1, apiKey); - ResultSet rs = pstmt.executeQuery(); - // TODO: make sure we don't have more than 1 result? ApiKey had better be unique - if (rs.next()) { - User u = new UserVO(rs.getLong(1)); - u.setUsername(rs.getString(2)); - u.setAccountId(rs.getLong(3)); - u.setSecretKey(DBEncryptionUtil.decrypt(rs.getString(4))); - u.setState(State.getValueOf(rs.getString(5))); - boolean apiKeyAccess = rs.getBoolean(6); - if (rs.wasNull()) { - u.setApiKeyAccess(null); - } else { - u.setApiKeyAccess(apiKeyAccess); - } - - AccountVO a = new AccountVO(rs.getLong(7)); - a.setAccountName(rs.getString(8)); - a.setType(Account.Type.getFromValue(rs.getInt(9))); - a.setRoleId(rs.getLong(10)); - a.setDomainId(rs.getLong(11)); - a.setState(State.getValueOf(rs.getString(12))); - apiKeyAccess = rs.getBoolean(13); - if (rs.wasNull()) { - a.setApiKeyAccess(null); - } else { - a.setApiKeyAccess(apiKeyAccess); - } - - userAcctPair = new Pair(u, a); - } - } catch (Exception e) { - logger.warn("Exception finding user/acct by api key: " + apiKey, e); - } - return userAcctPair; - } - @Override public List findAccountsLike(String accountName) { return findAccountsLike(accountName, null).first(); @@ -190,6 +137,16 @@ public Pair, Integer> findAccountsLike(String accountName, Filte return searchAndCount(sc, filter); } + @Override + public List findAccountsByName(String accountName) { + SearchBuilder sb = createSearchBuilder(); + sb.and("accountName", sb.entity().getAccountName(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("accountName", accountName); + return search(sc, null); + } + @Override public Account findEnabledAccount(String accountName, Long domainId) { SearchCriteria sc = AllFieldsSearch.create("accountName", accountName); @@ -330,11 +287,9 @@ public long getDomainIdForGivenAccountId(long id) { domain_id = account_vo.getDomainId(); } catch (Exception e) { - logger.warn("getDomainIdForGivenAccountId: Exception :" + e.getMessage()); - } - finally { - return domain_id; + logger.warn("Can not get DomainId for the given AccountId; exception message : {}", e.getMessage()); } + return domain_id; } @Override diff --git a/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDao.java b/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDao.java index de3b769571e9..e377bbab94ed 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDao.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDao.java @@ -30,6 +30,4 @@ public interface UserAccountDao extends GenericDao { List getUserAccountByEmail(String email, Long domainId); boolean validateUsernameInDomain(String username, Long domainId); - - UserAccount getUserByApiKey(String apiKey); } diff --git a/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDaoImpl.java b/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDaoImpl.java index c9de9a367eed..28392abbff5c 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/UserAccountDaoImpl.java @@ -19,7 +19,6 @@ import com.cloud.user.UserAccount; import com.cloud.user.UserAccountVO; import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import org.springframework.stereotype.Component; @@ -28,14 +27,6 @@ @Component public class UserAccountDaoImpl extends GenericDaoBase implements UserAccountDao { - protected final SearchBuilder userAccountSearch; - - public UserAccountDaoImpl() { - userAccountSearch = createSearchBuilder(); - userAccountSearch.and("apiKey", userAccountSearch.entity().getApiKey(), SearchCriteria.Op.EQ); - userAccountSearch.done(); - } - @Override public List getAllUsersByNameAndEntity(String username, String entity) { if (username == null) { @@ -79,12 +70,4 @@ public boolean validateUsernameInDomain(String username, Long domainId) { } return false; } - - @Override - public UserAccount getUserByApiKey(String apiKey) { - SearchCriteria sc = userAccountSearch.create(); - sc.setParameters("apiKey", apiKey); - return findOneBy(sc); - } - } diff --git a/engine/schema/src/main/java/com/cloud/user/dao/UserDao.java b/engine/schema/src/main/java/com/cloud/user/dao/UserDao.java index 14b074251508..2e160efb9506 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/UserDao.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/UserDao.java @@ -37,13 +37,6 @@ public interface UserDao extends GenericDao { List listByAccount(long accountId); - /** - * Finds a user based on the secret key provided. - * @param secretKey - * @return - */ - UserVO findUserBySecretKey(String secretKey); - /** * Finds a user based on the registration token provided. * @param registrationToken diff --git a/engine/schema/src/main/java/com/cloud/user/dao/UserDaoImpl.java b/engine/schema/src/main/java/com/cloud/user/dao/UserDaoImpl.java index 8baf732c2406..de60e48dff8f 100644 --- a/engine/schema/src/main/java/com/cloud/user/dao/UserDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/user/dao/UserDaoImpl.java @@ -65,10 +65,6 @@ protected UserDaoImpl() { UserIdSearch.and("id", UserIdSearch.entity().getId(), SearchCriteria.Op.EQ); UserIdSearch.done(); - SecretKeySearch = createSearchBuilder(); - SecretKeySearch.and("secretKey", SecretKeySearch.entity().getSecretKey(), SearchCriteria.Op.EQ); - SecretKeySearch.done(); - RegistrationTokenSearch = createSearchBuilder(); RegistrationTokenSearch.and("registrationToken", RegistrationTokenSearch.entity().getRegistrationToken(), SearchCriteria.Op.EQ); RegistrationTokenSearch.done(); @@ -121,13 +117,6 @@ public List findUsersLike(String username) { return listBy(sc); } - @Override - public UserVO findUserBySecretKey(String secretKey) { - SearchCriteria sc = SecretKeySearch.create(); - sc.setParameters("secretKey", secretKey); - return findOneBy(sc); - } - @Override public UserVO findUserByRegistrationToken(String registrationToken) { SearchCriteria sc = RegistrationTokenSearch.create(); diff --git a/engine/schema/src/main/java/com/cloud/vm/ConsoleSessionVO.java b/engine/schema/src/main/java/com/cloud/vm/ConsoleSessionVO.java index ef777be2de94..d8f2838dd477 100644 --- a/engine/schema/src/main/java/com/cloud/vm/ConsoleSessionVO.java +++ b/engine/schema/src/main/java/com/cloud/vm/ConsoleSessionVO.java @@ -19,6 +19,8 @@ package com.cloud.vm; +import org.apache.cloudstack.consoleproxy.ConsoleSession; + import java.util.Date; import javax.persistence.Column; @@ -32,7 +34,7 @@ @Entity @Table(name = "console_session") -public class ConsoleSessionVO { +public class ConsoleSessionVO implements ConsoleSession { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -45,6 +47,9 @@ public class ConsoleSessionVO { @Column(name = "created") private Date created; + @Column(name = "domain_id") + private long domainId; + @Column(name = "account_id") private long accountId; @@ -86,6 +91,7 @@ public void setUuid(String uuid) { this.uuid = uuid; } + @Override public Date getCreated() { return created; } @@ -94,6 +100,16 @@ public void setCreated(Date created) { this.created = created; } + @Override + public long getDomainId() { + return domainId; + } + + public void setDomainId(long domainId) { + this.domainId = domainId; + } + + @Override public long getAccountId() { return accountId; } @@ -102,6 +118,7 @@ public void setAccountId(long accountId) { this.accountId = accountId; } + @Override public long getUserId() { return userId; } @@ -110,6 +127,7 @@ public void setUserId(long userId) { this.userId = userId; } + @Override public long getInstanceId() { return instanceId; } @@ -118,6 +136,7 @@ public void setInstanceId(long instanceId) { this.instanceId = instanceId; } + @Override public long getHostId() { return hostId; } @@ -126,6 +145,7 @@ public void setHostId(long hostId) { this.hostId = hostId; } + @Override public Date getRemoved() { return removed; } @@ -134,6 +154,7 @@ public void setRemoved(Date removed) { this.removed = removed; } + @Override public Date getAcquired() { return acquired; } @@ -142,6 +163,7 @@ public void setAcquired(Date acquired) { this.acquired = acquired; } + @Override public String getConsoleEndpointCreatorAddress() { return consoleEndpointCreatorAddress; } @@ -150,6 +172,7 @@ public void setConsoleEndpointCreatorAddress(String consoleEndpointCreatorAddres this.consoleEndpointCreatorAddress = consoleEndpointCreatorAddress; } + @Override public String getClientAddress() { return clientAddress; } diff --git a/engine/schema/src/main/java/com/cloud/vm/ImportVMTaskVO.java b/engine/schema/src/main/java/com/cloud/vm/ImportVMTaskVO.java new file mode 100644 index 000000000000..9a8a769f0a56 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/vm/ImportVMTaskVO.java @@ -0,0 +1,270 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm; + +import org.apache.cloudstack.vm.ImportVmTask; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; +import java.util.UUID; + +@Entity +@Table(name = "import_vm_task") +public class ImportVMTaskVO implements ImportVmTask { + + public ImportVMTaskVO(long zoneId, long accountId, long userId, String displayName, + String vcenter, String datacenter, String sourceVMName, long convertHostId, long importHostId) { + this.zoneId = zoneId; + this.accountId = accountId; + this.userId = userId; + this.displayName = displayName; + this.vcenter = vcenter; + this.datacenter = datacenter; + this.sourceVMName = sourceVMName; + this.step = Step.Prepare; + this.uuid = UUID.randomUUID().toString(); + this.convertHostId = convertHostId; + this.importHostId = importHostId; + } + + public ImportVMTaskVO() { + } + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "zone_id") + private long zoneId; + + @Column(name = "account_id") + private long accountId; + + @Column(name = "user_id") + private long userId; + + @Column(name = "vm_id") + private Long vmId; + @Column(name = "display_name") + private String displayName; + + @Column(name = "vcenter") + private String vcenter; + + @Column(name = "datacenter") + private String datacenter; + + @Column(name = "source_vm_name") + private String sourceVMName; + + @Column(name = "convert_host_id") + private long convertHostId; + + @Column(name = "import_host_id") + private long importHostId; + + @Column(name = "step") + private Step step; + + @Column(name = "state") + private TaskState state; + + @Column(name = "description") + private String description; + + @Column(name = "duration") + private Long duration; + + @Column(name = "created") + @Temporal(value = TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + private Date updated; + + @Column(name = "removed") + @Temporal(value = TemporalType.TIMESTAMP) + private Date removed; + + @Override + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getZoneId() { + return zoneId; + } + + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + + public long getAccountId() { + return accountId; + } + + public void setAccountId(long accountId) { + this.accountId = accountId; + } + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public Long getVmId() { + return vmId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getVcenter() { + return vcenter; + } + + public void setVcenter(String vcenter) { + this.vcenter = vcenter; + } + + public String getDatacenter() { + return datacenter; + } + + public void setDatacenter(String datacenter) { + this.datacenter = datacenter; + } + + public String getSourceVMName() { + return sourceVMName; + } + + public void setSourceVMName(String sourceVMName) { + this.sourceVMName = sourceVMName; + } + + public long getConvertHostId() { + return convertHostId; + } + + public void setConvertHostId(long convertHostId) { + this.convertHostId = convertHostId; + } + + public long getImportHostId() { + return importHostId; + } + + public void setImportHostId(long importHostId) { + this.importHostId = importHostId; + } + + public Step getStep() { + return step; + } + + public void setStep(Step step) { + this.step = step; + } + + public TaskState getState() { + return state; + } + + public void setState(TaskState state) { + this.state = state; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Long getDuration() { + return duration; + } + + public void setDuration(Long duration) { + this.duration = duration; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getUpdated() { + return updated; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } +} diff --git a/engine/schema/src/main/java/com/cloud/vm/NicVO.java b/engine/schema/src/main/java/com/cloud/vm/NicVO.java index 6c569e22dd95..65946b8d8210 100644 --- a/engine/schema/src/main/java/com/cloud/vm/NicVO.java +++ b/engine/schema/src/main/java/com/cloud/vm/NicVO.java @@ -131,6 +131,9 @@ protected NicVO() { @Column(name = "mtu") Integer mtu; + @Column(name = "enabled") + boolean enabled; + @Transient transient String nsxLogicalSwitchUuid; @@ -143,6 +146,7 @@ public NicVO(String reserver, Long instanceId, long configurationId, VirtualMach this.networkId = configurationId; this.state = State.Allocated; this.vmType = vmType; + this.enabled = true; } @Override @@ -397,6 +401,14 @@ public void setNsxLogicalSwitchPortUuid(String nsxLogicalSwitchPortUuid) { this.nsxLogicalSwitchPortUuid = nsxLogicalSwitchPortUuid; } + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + @Override public int hashCode() { return new HashCodeBuilder(17, 31).append(id).toHashCode(); diff --git a/engine/schema/src/main/java/com/cloud/vm/UserVmDetailVO.java b/engine/schema/src/main/java/com/cloud/vm/VMInstanceDetailVO.java similarity index 90% rename from engine/schema/src/main/java/com/cloud/vm/UserVmDetailVO.java rename to engine/schema/src/main/java/com/cloud/vm/VMInstanceDetailVO.java index 81bb6dd9d4f3..7879aa24556b 100755 --- a/engine/schema/src/main/java/com/cloud/vm/UserVmDetailVO.java +++ b/engine/schema/src/main/java/com/cloud/vm/VMInstanceDetailVO.java @@ -26,8 +26,8 @@ import org.apache.cloudstack.api.ResourceDetail; @Entity -@Table(name = "user_vm_details") -public class UserVmDetailVO implements ResourceDetail { +@Table(name = "vm_instance_details") +public class VMInstanceDetailVO implements ResourceDetail { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -45,10 +45,10 @@ public class UserVmDetailVO implements ResourceDetail { @Column(name = "display") private boolean display = true; - public UserVmDetailVO() { + public VMInstanceDetailVO() { } - public UserVmDetailVO(long vmId, String name, String value, boolean display) { + public VMInstanceDetailVO(long vmId, String name, String value, boolean display) { this.resourceId = vmId; this.name = name; this.value = value; diff --git a/engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java b/engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java index a1d9f4a8089a..9d5e1b0ff500 100644 --- a/engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java +++ b/engine/schema/src/main/java/com/cloud/vm/VMInstanceVO.java @@ -503,7 +503,7 @@ public void setRemoved(Date removed) { @Override public String toString() { - return String.format("VM instance %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "instanceName", "uuid", "type")); + return String.format("VM instance %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "instanceName", "uuid", "type", "state")); } @Override diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDao.java index 95ced889b3db..b8fb9557a356 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDao.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDao.java @@ -19,6 +19,7 @@ package com.cloud.vm.dao; +import com.cloud.utils.Pair; import com.cloud.vm.ConsoleSessionVO; import com.cloud.utils.db.GenericDao; @@ -36,4 +37,9 @@ public interface ConsoleSessionDao extends GenericDao { void acquireSession(String sessionUuid, String clientAddress); int expungeByVmList(List vmIds, Long batchSize); + + Pair, Integer> listConsoleSessions(Long id, List domainIds, Long accountId, Long userId, Long hostId, + Date startDate, Date endDate, Long instanceId, + String consoleEndpointCreatorAddress, String clientAddress, + boolean activeOnly, boolean acquired, Long pageSizeVal, Long startIndex); } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDaoImpl.java index 3d1178946700..562142eecc81 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/ConsoleSessionDaoImpl.java @@ -22,6 +22,8 @@ import java.util.Date; import java.util.List; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; import org.apache.commons.collections.CollectionUtils; import com.cloud.utils.db.GenericDaoBase; @@ -30,13 +32,28 @@ import com.cloud.vm.ConsoleSessionVO; public class ConsoleSessionDaoImpl extends GenericDaoBase implements ConsoleSessionDao { + private static final String ID = "id"; + private static final String DOMAIN_IDS = "domainIds"; + private static final String ACCOUNT_ID = "accountId"; + private static final String USER_ID = "userId"; + private static final String HOST_ID = "hostId"; + private static final String INSTANCE_ID = "instanceId"; + private static final String VM_IDS = "vmIds"; + private static final String START_DATE = "startDate"; + private static final String END_DATE = "endDate"; + private static final String CREATOR_ADDRESS = "creatorAddress"; + private static final String CLIENT_ADDRESS = "clientAddress"; + private static final String ACQUIRED = "acquired"; + private static final String CREATED = "created"; + private static final String REMOVED = "removed"; + private static final String REMOVED_NOT_NULL = "removedNotNull"; private final SearchBuilder searchByRemovedDate; public ConsoleSessionDaoImpl() { searchByRemovedDate = createSearchBuilder(); - searchByRemovedDate.and("removedNotNull", searchByRemovedDate.entity().getRemoved(), SearchCriteria.Op.NNULL); - searchByRemovedDate.and("removed", searchByRemovedDate.entity().getRemoved(), SearchCriteria.Op.LTEQ); + searchByRemovedDate.and(REMOVED_NOT_NULL, searchByRemovedDate.entity().getRemoved(), SearchCriteria.Op.NNULL); + searchByRemovedDate.and(REMOVED, searchByRemovedDate.entity().getRemoved(), SearchCriteria.Op.LTEQ); } @Override @@ -57,7 +74,7 @@ public boolean isSessionAllowed(String sessionUuid) { @Override public int expungeSessionsOlderThanDate(Date date) { SearchCriteria searchCriteria = searchByRemovedDate.create(); - searchCriteria.setParameters("removed", date); + searchCriteria.setParameters(REMOVED, date); return expunge(searchCriteria); } @@ -75,9 +92,66 @@ public int expungeByVmList(List vmIds, Long batchSize) { return 0; } SearchBuilder sb = createSearchBuilder(); - sb.and("vmIds", sb.entity().getInstanceId(), SearchCriteria.Op.IN); + sb.and(VM_IDS, sb.entity().getInstanceId(), SearchCriteria.Op.IN); SearchCriteria sc = sb.create(); - sc.setParameters("vmIds", vmIds.toArray()); + sc.setParameters(VM_IDS, vmIds.toArray()); return batchExpunge(sc, batchSize); } + + @Override + public Pair, Integer> listConsoleSessions(Long id, List domainIds, Long accountId, Long userId, Long hostId, + Date startDate, Date endDate, Long instanceId, + String consoleEndpointCreatorAddress, String clientAddress, + boolean activeOnly, boolean acquired, Long pageSizeVal, Long startIndex) { + Filter filter = new Filter(ConsoleSessionVO.class, CREATED, false, startIndex, pageSizeVal); + SearchCriteria searchCriteria = createListConsoleSessionsSearchCriteria(id, domainIds, accountId, userId, hostId, + startDate, endDate, instanceId, consoleEndpointCreatorAddress, clientAddress, activeOnly, acquired); + + return searchAndCount(searchCriteria, filter, true); + } + + private SearchCriteria createListConsoleSessionsSearchCriteria(Long id, List domainIds, Long accountId, Long userId, Long hostId, + Date startDate, Date endDate, Long instanceId, + String consoleEndpointCreatorAddress, String clientAddress, + boolean activeOnly, boolean acquired) { + SearchCriteria searchCriteria = createListConsoleSessionsSearchBuilder(activeOnly, acquired).create(); + + searchCriteria.setParametersIfNotNull(ID, id); + searchCriteria.setParametersIfNotNull(DOMAIN_IDS, domainIds.toArray()); + searchCriteria.setParametersIfNotNull(ACCOUNT_ID, accountId); + searchCriteria.setParametersIfNotNull(USER_ID, userId); + searchCriteria.setParametersIfNotNull(HOST_ID, hostId); + searchCriteria.setParametersIfNotNull(INSTANCE_ID, instanceId); + searchCriteria.setParametersIfNotNull(START_DATE, startDate); + searchCriteria.setParametersIfNotNull(END_DATE, endDate); + searchCriteria.setParametersIfNotNull(CREATOR_ADDRESS, consoleEndpointCreatorAddress); + searchCriteria.setParametersIfNotNull(CLIENT_ADDRESS, clientAddress); + + return searchCriteria; + } + + private SearchBuilder createListConsoleSessionsSearchBuilder(boolean activeOnly, boolean acquired) { + SearchBuilder searchBuilder = createSearchBuilder(); + + searchBuilder.and(ID, searchBuilder.entity().getId(), SearchCriteria.Op.EQ); + searchBuilder.and(DOMAIN_IDS, searchBuilder.entity().getDomainId(), SearchCriteria.Op.IN); + searchBuilder.and(ACCOUNT_ID, searchBuilder.entity().getAccountId(), SearchCriteria.Op.EQ); + searchBuilder.and(USER_ID, searchBuilder.entity().getUserId(), SearchCriteria.Op.EQ); + searchBuilder.and(HOST_ID, searchBuilder.entity().getHostId(), SearchCriteria.Op.EQ); + searchBuilder.and(INSTANCE_ID, searchBuilder.entity().getInstanceId(), SearchCriteria.Op.EQ); + searchBuilder.and(START_DATE, searchBuilder.entity().getCreated(), SearchCriteria.Op.GTEQ); + searchBuilder.and(END_DATE, searchBuilder.entity().getCreated(), SearchCriteria.Op.LTEQ); + searchBuilder.and(CREATOR_ADDRESS, searchBuilder.entity().getConsoleEndpointCreatorAddress(), SearchCriteria.Op.EQ); + searchBuilder.and(CLIENT_ADDRESS, searchBuilder.entity().getClientAddress(), SearchCriteria.Op.EQ); + + if (activeOnly) { + searchBuilder.and(ACQUIRED, searchBuilder.entity().getAcquired(), SearchCriteria.Op.NNULL); + searchBuilder.and(REMOVED, searchBuilder.entity().getRemoved(), SearchCriteria.Op.NULL); + } else if (acquired) { + searchBuilder.and(ACQUIRED, searchBuilder.entity().getAcquired(), SearchCriteria.Op.NNULL); + } + + searchBuilder.done(); + return searchBuilder; + } } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDao.java new file mode 100644 index 000000000000..a4f0a155da41 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDao.java @@ -0,0 +1,31 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm.dao; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; +import com.cloud.vm.ImportVMTaskVO; +import org.apache.cloudstack.vm.ImportVmTask; +import java.util.List; + +public interface ImportVMTaskDao extends GenericDao { + + Pair, Integer> listImportVMTasks(Long zoneId, Long accountId, String vcenter, Long convertHostId, + ImportVmTask.TaskState state, Long startIndex, Long pageSizeVal); +} diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDaoImpl.java new file mode 100644 index 000000000000..da9c391af9db --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/vm/dao/ImportVMTaskDaoImpl.java @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm.dao; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.vm.ImportVMTaskVO; +import org.apache.cloudstack.vm.ImportVmTask; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.List; + +@Component +public class ImportVMTaskDaoImpl extends GenericDaoBase implements ImportVMTaskDao { + + private SearchBuilder AllFieldsSearch; + + public ImportVMTaskDaoImpl() { + } + + @PostConstruct + void init() { + AllFieldsSearch = createSearchBuilder(); + AllFieldsSearch.and("zoneId", AllFieldsSearch.entity().getZoneId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("vcenter", AllFieldsSearch.entity().getVcenter(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("convertHostId", AllFieldsSearch.entity().getConvertHostId(), SearchCriteria.Op.EQ); + AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ); + AllFieldsSearch.done(); + } + + + @Override + public Pair, Integer> listImportVMTasks(Long zoneId, Long accountId, String vcenter, Long convertHostId, + ImportVmTask.TaskState state, Long startIndex, Long pageSizeVal) { + SearchCriteria sc = AllFieldsSearch.create(); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + if (accountId != null) { + sc.setParameters("accountId", accountId); + } + if (StringUtils.isNotBlank(vcenter)) { + sc.setParameters("vcenter", vcenter); + } + if (convertHostId != null) { + sc.setParameters("convertHostId", convertHostId); + } + if (state != null) { + sc.setParameters("state", state); + } + Filter filter = new Filter(ImportVMTaskVO.class, "created", false, startIndex, pageSizeVal); + return searchAndCount(sc, filter); + } +} diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/NicDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/NicDao.java index d34b03c4cb08..7767b7512b91 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/NicDao.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/NicDao.java @@ -26,6 +26,8 @@ public interface NicDao extends GenericDao { List listByVmId(long instanceId); + int countByVmId(long instanceId); + List listByVmIdOrderByDeviceId(long instanceId); List listIpAddressInNetwork(long networkConfigId); @@ -46,8 +48,12 @@ public interface NicDao extends GenericDao { NicVO findByNetworkIdAndTypeIncludingRemoved(long networkId, VirtualMachine.Type vmType); + NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType); + NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId); + NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId); + NicVO findByNetworkIdAndMacAddress(long networkId, String mac); NicVO findDefaultNicForVM(long instanceId); @@ -91,7 +97,7 @@ public interface NicDao extends GenericDao { List listByVmIdAndKeyword(long instanceId, String keyword); - NicVO findByMacAddress(String macAddress); + NicVO findByMacAddress(String macAddress, long networkId); NicVO findByNetworkIdAndMacAddressIncludingRemoved(long networkId, String mac); diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/NicDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/NicDaoImpl.java index 7d1af1982ae1..6202dabf730e 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/NicDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/NicDaoImpl.java @@ -69,6 +69,7 @@ protected void init() { AllFieldsSearch.and("secondaryip", AllFieldsSearch.entity().getSecondaryIp(), Op.EQ); AllFieldsSearch.and("nicid", AllFieldsSearch.entity().getId(), Op.EQ); AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ); + AllFieldsSearch.and("strategyNEQ", AllFieldsSearch.entity().getReservationStrategy(), Op.NEQ); AllFieldsSearch.and("reserverName",AllFieldsSearch.entity().getReserver(),Op.EQ); AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ); AllFieldsSearch.and("deviceid", AllFieldsSearch.entity().getDeviceId(), Op.EQ); @@ -125,6 +126,13 @@ public List listByVmId(long instanceId) { return listBy(sc); } + @Override + public int countByVmId(long instanceId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instance", instanceId); + return getCount(sc); + } + @Override public List listByVmIdOrderByDeviceId(long instanceId) { SearchCriteria sc = AllFieldsSearch.create(); @@ -195,6 +203,15 @@ public NicVO findByNetworkIdAndTypeIncludingRemoved(long networkId, VirtualMachi return findByNetworkIdAndTypeInternal(networkId, vmType, true); } + @Override + public NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("network", networkId); + sc.setParameters("vmType", vmType); + sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString()); + return findOneBy(sc); + } + @Override public NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway) { SearchCriteria sc = AllFieldsSearch.create(); @@ -222,6 +239,16 @@ public NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId) { return findOneBy(sc); } + @Override + public NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("address", ip4Address); + sc.setParameters("network", networkId); + sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString()); + return findOneBy(sc); + } + + @Override public NicVO findByNetworkIdAndMacAddress(long networkId, String mac) { SearchCriteria sc = AllFieldsSearch.create(); @@ -400,9 +427,10 @@ public List listByVmIdAndKeyword(long instanceId, String keyword) { } @Override - public NicVO findByMacAddress(String macAddress) { + public NicVO findByMacAddress(String macAddress, long networkId) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("macAddress", macAddress); + sc.setParameters("network", networkId); return findOneBy(sc); } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java index cc8b9fc59a8d..761053a89f0c 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java @@ -57,7 +57,7 @@ import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicVO; -import com.cloud.vm.UserVmDetailVO; +import com.cloud.vm.VMInstanceDetailVO; import com.cloud.vm.UserVmVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; @@ -101,7 +101,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use ReservationDao reservationDao; private static final String LIST_PODS_HAVING_VMS_FOR_ACCOUNT = - "SELECT pod_id FROM cloud.vm_instance WHERE data_center_id = ? AND account_id = ? AND pod_id IS NOT NULL AND (state = 'Running' OR state = 'Stopped') " + "SELECT pod_id FROM cloud.vm_instance WHERE data_center_id = ? AND account_id = ? AND pod_id IS NOT NULL AND state IN ('Starting', 'Running', 'Stopped') " + "GROUP BY pod_id HAVING count(id) > 0 ORDER BY count(id) DESC"; private static final String VM_DETAILS = "select vm_instance.id, " @@ -124,13 +124,13 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use + "left join security_group on security_group_vm_map.security_group_id=security_group.id " + "left join nics on vm_instance.id=nics.instance_id " + "left join networks on nics.network_id=networks.id " + "left join user_ip_address on user_ip_address.vm_id=vm_instance.id " + "where vm_instance.id in ("; - private static final String VMS_DETAIL_BY_NAME = "select vm_instance.instance_name, vm_instance.vm_type, vm_instance.id , user_vm_details.value, user_vm_details.name from vm_instance " - + "left join user_vm_details on vm_instance.id = user_vm_details.vm_id where (user_vm_details.name is null or user_vm_details.name = ? ) and vm_instance.instance_name in ("; + private static final String VMS_DETAIL_BY_NAME = "select vm_instance.instance_name, vm_instance.vm_type, vm_instance.id , vm_instance_details.value, vm_instance_details.name from vm_instance " + + "left join vm_instance_details on vm_instance.id = vm_instance_details.vm_id where (vm_instance_details.name is null or vm_instance_details.name = ? ) and vm_instance.instance_name in ("; private static final int VM_DETAILS_BATCH_SIZE = 100; @Inject - protected UserVmDetailsDao _detailsDao; + protected VMInstanceDetailsDao _detailsDao; @Inject protected NicDao _nicDao; @@ -445,10 +445,10 @@ public void saveDetails(UserVmVO vm, List hiddenDetails) { final Map visibilityMap = _detailsDao.listDetailsVisibility(vm.getId()); - List details = new ArrayList(); + List details = new ArrayList(); for (Map.Entry entry : detailsStr.entrySet()) { boolean display = !hiddenDetails.contains(entry.getKey()) && visibilityMap.getOrDefault(entry.getKey(), true); - details.add(new UserVmDetailVO(vm.getId(), entry.getKey(), entry.getValue(), display)); + details.add(new VMInstanceDetailVO(vm.getId(), entry.getKey(), entry.getValue(), display)); } _detailsDao.saveDetails(details); @@ -755,7 +755,7 @@ public List, Pair>> getVmsD while (rs.next()) { vmsDetailByNames.add(new Pair, Pair>(new Pair( rs.getString("vm_instance.instance_name"), VirtualMachine.Type.valueOf(rs.getString("vm_type"))), - new Pair(rs.getLong("vm_instance.id"), rs.getString("user_vm_details.value")))); + new Pair(rs.getLong("vm_instance.id"), rs.getString("vm_instance_details.value")))); } } } catch (SQLException e) { @@ -782,7 +782,7 @@ public List> countVmsBySize(long dcId, int li result.add(new Ternary(rs.getInt(1), rs.getInt(2), rs.getInt(3))); } } catch (Exception e) { - logger.warn("Error counting vms by size for dcId= " + dcId, e); + logger.warn("Error counting Instances by size for Data Center ID = " + dcId, e); } return result; } @@ -821,6 +821,7 @@ public UserVmVO persist(UserVmVO entity) { reservationDao.setResourceId(Resource.ResourceType.user_vm, userVM.getId()); reservationDao.setResourceId(Resource.ResourceType.cpu, userVM.getId()); reservationDao.setResourceId(Resource.ResourceType.memory, userVM.getId()); + reservationDao.setResourceId(Resource.ResourceType.gpu, userVM.getId()); return userVM; }); } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java index 823642d8c3d7..1a5b8cedd9ea 100755 --- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDao.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.Pair; @@ -118,7 +119,7 @@ public interface VMInstanceDao extends GenericDao, StateDao< List listVmsMigratingFromHost(Long hostId); - List listByZoneWithBackups(Long zoneId, Long backupOfferingId); + List listByZoneAndBackupOffering(Long zoneId, Long backupOfferingId); public Long countActiveByHostId(long hostId); @@ -187,4 +188,15 @@ List searchRemovedByRemoveDate(final Date startDate, final Date en Map getNameIdMapForVmIds(Collection ids); + int getVmCountByOfferingId(Long serviceOfferingId); + + int getVmCountByOfferingNotInDomain(Long serviceOfferingId, List domainIds); + + List listByIdsIncludingRemoved(List ids); + + List listDeleteProtectedVmsByAccountId(long accountId); + + List listDeleteProtectedVmsByDomainIds(Set domainIds); + + List listIdsByHostIdForVolumeStats(long hostIds); } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java index ef10af63bae0..ae1e838649ba 100755 --- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java @@ -25,11 +25,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import javax.inject.Inject; +import org.apache.cloudstack.api.ApiConstants; import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; @@ -104,6 +106,10 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem protected SearchBuilder LastHostAndStatesSearch; protected SearchBuilder VmsNotInClusterUsingPool; protected SearchBuilder IdsPowerStateSelectSearch; + GenericSearchBuilder CountByOfferingId; + GenericSearchBuilder CountUserVmNotInDomain; + SearchBuilder DeleteProtectedVmSearchByAccount; + SearchBuilder DeleteProtectedVmSearchByDomainIds; @Inject ResourceTagDao tagsDao; @@ -116,27 +122,37 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem protected Attribute _updateTimeAttr; - private static final String ORDER_CLUSTERS_NUMBER_OF_VMS_FOR_ACCOUNT_PART1 = "SELECT host.cluster_id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) " + + private static final String ORDER_CLUSTERS_NUMBER_OF_VMS_FOR_ACCOUNT_PART1 = "SELECT host.cluster_id, SUM(IF(vm.state IN ('Running', 'Starting') AND vm.account_id = ?, 1, 0)) " + "FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id WHERE "; private static final String ORDER_CLUSTERS_NUMBER_OF_VMS_FOR_ACCOUNT_PART2 = " AND host.type = 'Routing' AND host.removed is null GROUP BY host.cluster_id " + "ORDER BY 2 ASC "; - private static final String ORDER_PODS_NUMBER_OF_VMS_FOR_ACCOUNT = "SELECT pod.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`" + + private static final String ORDER_PODS_NUMBER_OF_VMS_FOR_ACCOUNT = "SELECT pod.id, SUM(IF(vm.state IN ('Running', 'Starting') AND vm.account_id = ?, 1, 0)) FROM `cloud`.`" + "host_pod_ref` pod LEFT JOIN `cloud`.`vm_instance` vm ON pod.id = vm.pod_id WHERE pod.data_center_id = ? AND pod.removed is null " + " GROUP BY pod.id ORDER BY 2 ASC "; private static final String ORDER_HOSTS_NUMBER_OF_VMS_FOR_ACCOUNT = - "SELECT host.id, SUM(IF(vm.state='Running' AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id " + + "SELECT host.id, SUM(IF(vm.state IN ('Running', 'Starting') AND vm.account_id = ?, 1, 0)) FROM `cloud`.`host` host LEFT JOIN `cloud`.`vm_instance` vm ON host.id = vm.host_id " + "WHERE host.data_center_id = ? AND host.type = 'Routing' AND host.removed is null "; private static final String ORDER_HOSTS_NUMBER_OF_VMS_FOR_ACCOUNT_PART2 = " GROUP BY host.id ORDER BY 2 ASC "; - private static final String COUNT_VMS_BASED_ON_VGPU_TYPES1 = + private static final String COUNT_VMS_BASED_ON_VGPU_TYPES1_LEGACY = "SELECT pci, type, SUM(vmcount) FROM (SELECT MAX(IF(offering.name = 'pciDevice',value,'')) AS pci, MAX(IF(offering.name = 'vgpuType', value,'')) " + "AS type, COUNT(DISTINCT vm.id) AS vmcount FROM service_offering_details offering INNER JOIN vm_instance vm ON offering.service_offering_id = vm.service_offering_id " + "INNER JOIN `cloud`.`host` ON vm.host_id = host.id WHERE vm.state = 'Running' AND host.data_center_id = ? "; + private static final String COUNT_VMS_BASED_ON_VGPU_TYPES2_LEGACY = + "GROUP BY vm.service_offering_id) results GROUP BY pci, type"; + + private static final String COUNT_VMS_BASED_ON_VGPU_TYPES1 = + "SELECT CONCAT(gpu_card.vendor_name, ' ', gpu_card.device_name), vgpu_profile.name, COUNT(gpu_device.vm_id) " + + "FROM `cloud`.`gpu_device` " + + "INNER JOIN `cloud`.`host` ON gpu_device.host_id = host.id " + + "INNER JOIN `cloud`.`gpu_card` ON gpu_device.card_id = gpu_card.id " + + "INNER JOIN `cloud`.`vgpu_profile` ON vgpu_profile.id = gpu_device.vgpu_profile_id " + + "WHERE vm_id IS NOT NULL AND host.data_center_id = ? "; private static final String COUNT_VMS_BASED_ON_VGPU_TYPES2 = - "GROUP BY offering.service_offering_id) results GROUP BY pci, type"; + "GROUP BY gpu_card.name, vgpu_profile.name"; private static final String UPDATE_SYSTEM_VM_TEMPLATE_ID_FOR_HYPERVISOR = "UPDATE `cloud`.`vm_instance` SET vm_template_id = ? WHERE type <> 'User' AND hypervisor_type = ? AND removed is NULL"; @@ -342,8 +358,34 @@ protected void init() { IdsPowerStateSelectSearch.entity().getPowerHostId(), IdsPowerStateSelectSearch.entity().getPowerState(), IdsPowerStateSelectSearch.entity().getPowerStateUpdateCount(), - IdsPowerStateSelectSearch.entity().getPowerStateUpdateTime()); + IdsPowerStateSelectSearch.entity().getPowerStateUpdateTime(), + IdsPowerStateSelectSearch.entity().getState()); IdsPowerStateSelectSearch.done(); + + CountByOfferingId = createSearchBuilder(Integer.class); + CountByOfferingId.select(null, Func.COUNT, CountByOfferingId.entity().getId()); + CountByOfferingId.and("serviceOfferingId", CountByOfferingId.entity().getServiceOfferingId(), Op.EQ); + CountByOfferingId.done(); + + CountUserVmNotInDomain = createSearchBuilder(Integer.class); + CountUserVmNotInDomain.select(null, Func.COUNT, CountUserVmNotInDomain.entity().getId()); + CountUserVmNotInDomain.and("serviceOfferingId", CountUserVmNotInDomain.entity().getServiceOfferingId(), Op.EQ); + CountUserVmNotInDomain.and("domainIdsNotIn", CountUserVmNotInDomain.entity().getDomainId(), Op.NIN); + CountUserVmNotInDomain.done(); + + DeleteProtectedVmSearchByAccount = createSearchBuilder(); + DeleteProtectedVmSearchByAccount.selectFields(DeleteProtectedVmSearchByAccount.entity().getUuid()); + DeleteProtectedVmSearchByAccount.and(ApiConstants.ACCOUNT_ID, DeleteProtectedVmSearchByAccount.entity().getAccountId(), Op.EQ); + DeleteProtectedVmSearchByAccount.and(ApiConstants.DELETE_PROTECTION, DeleteProtectedVmSearchByAccount.entity().isDeleteProtection(), Op.EQ); + DeleteProtectedVmSearchByAccount.and(ApiConstants.REMOVED, DeleteProtectedVmSearchByAccount.entity().getRemoved(), Op.NULL); + DeleteProtectedVmSearchByAccount.done(); + + DeleteProtectedVmSearchByDomainIds = createSearchBuilder(); + DeleteProtectedVmSearchByDomainIds.selectFields(DeleteProtectedVmSearchByDomainIds.entity().getUuid()); + DeleteProtectedVmSearchByDomainIds.and(ApiConstants.DOMAIN_IDS, DeleteProtectedVmSearchByDomainIds.entity().getDomainId(), Op.IN); + DeleteProtectedVmSearchByDomainIds.and(ApiConstants.DELETE_PROTECTION, DeleteProtectedVmSearchByDomainIds.entity().isDeleteProtection(), Op.EQ); + DeleteProtectedVmSearchByDomainIds.and(ApiConstants.REMOVED, DeleteProtectedVmSearchByDomainIds.entity().getRemoved(), Op.NULL); + DeleteProtectedVmSearchByDomainIds.done(); } @Override @@ -651,7 +693,7 @@ public List listVmsMigratingFromHost(Long hostId) { } @Override - public List listByZoneWithBackups(Long zoneId, Long backupOfferingId) { + public List listByZoneAndBackupOffering(Long zoneId, Long backupOfferingId) { SearchCriteria sc = BackupSearch.create(); sc.setParameters("zone_id", zoneId); if (backupOfferingId != null) { @@ -794,40 +836,55 @@ public List listHostIdsByVmCount(long dcId, Long podId, Long clusterId, lo @Override public HashMap countVgpuVMs(Long dcId, Long podId, Long clusterId) { + StringBuilder finalQueryLegacy = new StringBuilder(); StringBuilder finalQuery = new StringBuilder(); TransactionLegacy txn = TransactionLegacy.currentTxn(); + PreparedStatement pstmtLegacy = null; PreparedStatement pstmt = null; List resourceIdList = new ArrayList(); HashMap result = new HashMap(); resourceIdList.add(dcId); + finalQueryLegacy.append(COUNT_VMS_BASED_ON_VGPU_TYPES1_LEGACY); finalQuery.append(COUNT_VMS_BASED_ON_VGPU_TYPES1); if (podId != null) { + finalQueryLegacy.append("AND host.pod_id = ? "); finalQuery.append("AND host.pod_id = ? "); resourceIdList.add(podId); } if (clusterId != null) { + finalQueryLegacy.append("AND host.cluster_id = ? "); finalQuery.append("AND host.cluster_id = ? "); resourceIdList.add(clusterId); } + finalQueryLegacy.append(COUNT_VMS_BASED_ON_VGPU_TYPES2_LEGACY); finalQuery.append(COUNT_VMS_BASED_ON_VGPU_TYPES2); try { + pstmtLegacy = txn.prepareAutoCloseStatement(finalQueryLegacy.toString()); + for (int i = 0; i < resourceIdList.size(); i++) { + pstmtLegacy.setLong(1 + i, resourceIdList.get(i)); + } + ResultSet rs = pstmtLegacy.executeQuery(); + while (rs.next()) { + result.put(rs.getString(1).concat(rs.getString(2)), rs.getLong(3)); + } + pstmt = txn.prepareAutoCloseStatement(finalQuery.toString()); for (int i = 0; i < resourceIdList.size(); i++) { pstmt.setLong(1 + i, resourceIdList.get(i)); } - ResultSet rs = pstmt.executeQuery(); + rs = pstmt.executeQuery(); while (rs.next()) { result.put(rs.getString(1).concat(rs.getString(2)), rs.getLong(3)); } return result; } catch (SQLException e) { - throw new CloudRuntimeException("DB Exception on: " + finalQuery, e); + throw new CloudRuntimeException("DB Exception on: " + finalQueryLegacy, e); } catch (Throwable e) { - throw new CloudRuntimeException("Caught: " + finalQuery, e); + throw new CloudRuntimeException("Caught: " + finalQueryLegacy, e); } } @@ -864,7 +921,7 @@ public Long countByZoneAndStateAndHostTag(long dcId, State state, String hostTag return rs.getLong(1); } } catch (Exception e) { - logger.warn(String.format("Error counting vms by host tag for dcId= %s, hostTag= %s", dcId, hostTag), e); + logger.warn("Error counting Instances by host tag for dcId = {}, hostTag = {}", dcId, hostTag, e); } return 0L; } @@ -1049,10 +1106,14 @@ public Map updatePowerState( private boolean isPowerStateInSyncWithInstanceState(final VirtualMachine.PowerState powerState, final long powerHostId, final VMInstanceVO instance) { State instanceState = instance.getState(); + if (instanceState == null) { + logger.warn("VM {} has null instance state during power state sync check, treating as out of sync", instance); + return false; + } if ((powerState == VirtualMachine.PowerState.PowerOff && instanceState == State.Running) || (powerState == VirtualMachine.PowerState.PowerOn && instanceState == State.Stopped)) { HostVO instanceHost = hostDao.findById(instance.getHostId()); - HostVO powerHost = powerHostId == instance.getHostId() ? instanceHost : hostDao.findById(powerHostId); + HostVO powerHost = instance.getHostId() != null && powerHostId == instance.getHostId() ? instanceHost : hostDao.findById(powerHostId); logger.debug("VM: {} on host: {} and power host : {} is in {} state, but power state is {}", instance, instanceHost, powerHost, instanceState, powerState); return false; @@ -1224,4 +1285,71 @@ public Map getNameIdMapForVmIds(Collection ids) { return vms.stream() .collect(Collectors.toMap(VMInstanceVO::getInstanceName, VMInstanceVO::getId)); } + + @Override + public int getVmCountByOfferingId(Long serviceOfferingId) { + if (serviceOfferingId == null) { + return 0; + } + SearchCriteria sc = CountByOfferingId.create(); + sc.setParameters("serviceOfferingId", serviceOfferingId); + List count = customSearch(sc, null); + return count.get(0); + } + + @Override + public int getVmCountByOfferingNotInDomain(Long serviceOfferingId, List domainIds) { + if (serviceOfferingId == null || CollectionUtils.isEmpty(domainIds)) { + return 0; + } + SearchCriteria sc = CountUserVmNotInDomain.create(); + sc.setParameters("serviceOfferingId", serviceOfferingId); + sc.setParameters("domainIdsNotIn", domainIds.toArray()); + List count = customSearch(sc, null); + return count.get(0); + } + + @Override + public List listByIdsIncludingRemoved(List ids) { + SearchBuilder idsSearch = createSearchBuilder(); + idsSearch.and("ids", idsSearch.entity().getId(), SearchCriteria.Op.IN); + idsSearch.done(); + SearchCriteria sc = idsSearch.create(); + sc.setParameters("ids", ids.toArray()); + return listIncludingRemovedBy(sc); + } + + @Override + public List listDeleteProtectedVmsByAccountId(long accountId) { + SearchCriteria sc = DeleteProtectedVmSearchByAccount.create(); + sc.setParameters(ApiConstants.ACCOUNT_ID, accountId); + sc.setParameters(ApiConstants.DELETE_PROTECTION, true); + Filter filter = new Filter(VMInstanceVO.class, null, false, 0L, 10L); + return listBy(sc, filter); + } + + @Override + public List listDeleteProtectedVmsByDomainIds(Set domainIds) { + SearchCriteria sc = DeleteProtectedVmSearchByDomainIds.create(); + sc.setParameters(ApiConstants.DOMAIN_IDS, domainIds.toArray()); + sc.setParameters(ApiConstants.DELETE_PROTECTION, true); + Filter filter = new Filter(VMInstanceVO.class, null, false, 0L, 10L); + return listBy(sc, filter); + } + + @Override + public List listIdsByHostIdForVolumeStats(long hostId) { + GenericSearchBuilder sb = createSearchBuilder(Long.class); + sb.selectFields(sb.entity().getId()); + sb.and().op("host", sb.entity().getHostId(), SearchCriteria.Op.EQ); + sb.or().op("hostNull", sb.entity().getHostId(), Op.NULL); + sb.and("lastHost", sb.entity().getLastHostId(), SearchCriteria.Op.EQ); + sb.cp(); + sb.cp(); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("host", hostId); + sc.setParameters("lastHost", hostId); + return customSearch(sc, null); + } } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDao.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDao.java new file mode 100644 index 000000000000..4cbdc516ba0b --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDao.java @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm.dao; + +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; +import com.cloud.vm.VMInstanceDetailVO; + +public interface VMInstanceDetailsDao extends GenericDao, ResourceDetailsDao { + int removeDetailsWithPrefix(long vmId, String prefix); +} diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDaoImpl.java new file mode 100644 index 000000000000..4c2fdd6f8d45 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDaoImpl.java @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.vm.dao; + + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; + +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.vm.VMInstanceDetailVO; + +@Component +public class VMInstanceDetailsDaoImpl extends ResourceDetailsDaoBase implements VMInstanceDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new VMInstanceDetailVO(resourceId, key, value, display)); + } + + @Override + public int removeDetailsWithPrefix(long vmId, String prefix) { + if (StringUtils.isBlank(prefix)) { + return 0; + } + SearchBuilder sb = createSearchBuilder(); + sb.and("vmId", sb.entity().getResourceId(), SearchCriteria.Op.EQ); + sb.and("prefix", sb.entity().getName(), SearchCriteria.Op.LIKE); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("vmId", vmId); + sc.setParameters("prefix", prefix + "%"); + return super.remove(sc); + } +} diff --git a/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDao.java b/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDao.java index 0143aaa1e735..39ae3d4f2fdd 100644 --- a/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDao.java +++ b/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDao.java @@ -27,6 +27,8 @@ public interface VMSnapshotDao extends GenericDao, StateDao< List findByVm(Long vmId); + List findByVmAndByType(Long vmId, VMSnapshot.Type type); + List listExpungingSnapshot(); List listByInstanceId(Long vmId, VMSnapshot.State... status); @@ -35,9 +37,13 @@ public interface VMSnapshotDao extends GenericDao, StateDao< List listByParent(Long vmSnapshotId); + List listByParentAndStateIn(Long vmSnapshotId, VMSnapshot.State... states); + VMSnapshotVO findByName(Long vmId, String name); List listByAccountId(Long accountId); + List searchByVms(List vmIds); + List searchRemovedByVms(List vmIds, Long batchSize); } diff --git a/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java index 03a978f85469..7f74d2338e43 100644 --- a/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java @@ -42,6 +42,12 @@ public class VMSnapshotDaoImpl extends GenericDaoBase implem private final SearchBuilder SnapshotStatusSearch; private final SearchBuilder AllFieldsSearch; + private SearchBuilder parentIdEqAndStateIn; + + private static final String PARENT = "parent"; + + private static final String STATE = "state"; + protected VMSnapshotDaoImpl() { AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); @@ -71,6 +77,11 @@ protected VMSnapshotDaoImpl() { SnapshotStatusSearch.and("vm_id", SnapshotStatusSearch.entity().getVmId(), SearchCriteria.Op.EQ); SnapshotStatusSearch.and("state", SnapshotStatusSearch.entity().getState(), SearchCriteria.Op.IN); SnapshotStatusSearch.done(); + + parentIdEqAndStateIn = createSearchBuilder(); + parentIdEqAndStateIn.and(PARENT, parentIdEqAndStateIn.entity().getParent(), Op.EQ); + parentIdEqAndStateIn.and(STATE, parentIdEqAndStateIn.entity().getState(), Op.IN); + parentIdEqAndStateIn.done(); } @Override @@ -80,6 +91,14 @@ public List findByVm(Long vmId) { return listBy(sc, null); } + @Override + public List findByVmAndByType(Long vmId, VMSnapshot.Type type) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("vm_id", vmId); + sc.setParameters("vm_snapshot_type", type); + return listBy(sc, null); + } + @Override public List listExpungingSnapshot() { SearchCriteria sc = ExpungingSnapshotSearch.create(); @@ -111,6 +130,14 @@ public List listByParent(Long vmSnapshotId) { return listBy(sc, null); } + @Override + public List listByParentAndStateIn(Long vmSnapshotId, State... states) { + SearchCriteria sc = parentIdEqAndStateIn.create(); + sc.setParameters(PARENT, vmSnapshotId); + sc.setParameters(STATE, (Object[])states); + return listBy(sc, null); + } + @Override public VMSnapshotVO findByName(Long vmId, String name) { SearchCriteria sc = AllFieldsSearch.create(); @@ -176,7 +203,7 @@ public boolean updateState(State currentState, Event event, State nextState, VMS .append("; updatedTime=") .append(oldUpdatedTime); } else { - logger.debug("Unable to update VM snapshot: {}, as there is no such snapshot exists in the database anymore", vo); + logger.debug("Unable to update Instance Snapshot: {}, as there is no such Snapshot exists in the database anymore", vo); } } return rows > 0; diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairPermissionVO.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairPermissionVO.java new file mode 100644 index 000000000000..7972fe6bc624 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairPermissionVO.java @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl; + +import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "api_keypair_permissions") +public class ApiKeyPairPermissionVO extends RolePermissionBaseVO implements ApiKeyPairPermission { + @Column(name = "api_keypair_id") + private long apiKeyPairId; + + @Column(name = "sort_order") + private long sortOrder = 0; + + public ApiKeyPairPermissionVO(long apiKeyPairId, String rule, Permission permission, String description) { + super(rule, permission, description); + this.apiKeyPairId = apiKeyPairId; + } + + public ApiKeyPairPermissionVO(String rule, Permission permission, String description) { + super(rule, permission, description); + } + + public ApiKeyPairPermissionVO() { + } + + public long getApiKeyPairId() { + return this.apiKeyPairId; + } + + public void setApiKeyPairId(long keyPairId) { + this.apiKeyPairId = keyPairId; + } + + public void setSortOrder(long sortOrder) { + this.sortOrder = sortOrder; + } + + public long getSortOrder() { + return sortOrder; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairVO.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairVO.java new file mode 100644 index 000000000000..eb38b08f6151 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairVO.java @@ -0,0 +1,244 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.user.Account; +import com.cloud.utils.db.Encrypt; +import java.time.Instant; +import org.apache.cloudstack.acl.apikeypair.ApiKeyPair; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; +import java.util.Objects; +import java.util.UUID; +import org.joda.time.DateTime; + +@Entity +@Table(name = "api_keypair") +public class ApiKeyPairVO implements ApiKeyPair { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Long id; + + @Column(name = "uuid", nullable = false) + private String uuid = UUID.randomUUID().toString(); + + @Column(name = "user_id", nullable = false) + private Long userId; + + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "domain_id", nullable = false) + private Long domainId; + + @Column(name = "account_id", nullable = false) + private Long accountId; + + @Column(name = "start_date") + @Temporal(value = TemporalType.TIMESTAMP) + private Date startDate; + + @Column(name = "end_date") + @Temporal(value = TemporalType.TIMESTAMP) + private Date endDate; + + @Column(name = "created", nullable = false) + @Temporal(value = TemporalType.TIMESTAMP) + private Date created = Date.from(Instant.now()); + + @Column(name = "description") + private String description = ""; + + @Column(name = "api_key", nullable = false) + private String apiKey; + + @Encrypt + @Column(name = "secret_key", nullable = false) + private String secretKey; + + @Column(name = "removed") + @Temporal(value = TemporalType.TIMESTAMP) + private Date removed; + + public ApiKeyPairVO() { + } + + public ApiKeyPairVO(Long id) { + this.id = id; + } + + public ApiKeyPairVO(Long userId, String description, Date startDate, Date endDate, + String apiKey, String secretKey) { + this.userId = userId; + this.description = description; + this.startDate = startDate; + this.endDate = endDate; + this.apiKey = apiKey; + this.secretKey = secretKey; + } + + public ApiKeyPairVO(String name, Long userId, String description, Date startDate, Date endDate, Account account) { + this.name = Objects.requireNonNullElseGet(name, () -> userId + " - API key pair"); + this.userId = userId; + this.description = description; + this.startDate = startDate; + this.endDate = endDate; + this.domainId = account.getDomainId(); + this.accountId = account.getAccountId(); + } + + public ApiKeyPairVO(Long id, Long userId) { + this.id = id; + this.userId = userId; + } + + public void validateDate() { + Date now = DateTime.now().toDate(); + Date keypairStart = this.getStartDate(); + Date keypairExpiration = this.getEndDate(); + if (keypairStart != null && now.compareTo(keypairStart) <= 0) { + throw new InvalidParameterValueException(String.format("API key pair is not valid yet, start date: %s", keypairStart)); + } + if (keypairExpiration != null && now.compareTo(keypairExpiration) >= 0) { + throw new InvalidParameterValueException(String.format("API key pair is expired, expiration date: %s", keypairExpiration)); + } + } + + public boolean hasEndDatePassed() { + Date now = DateTime.now().toDate(); + Date keypairExpiration = this.getEndDate(); + return keypairExpiration != null && now.compareTo(keypairExpiration) >= 0; + } + + public long getId() { + return id; + } + + public String getUuid() { + return uuid; + } + + public Long getUserId() { + return userId; + } + + public Date getStartDate() { + return startDate; + } + + public Date getEndDate() { + return endDate; + } + + public Date getCreated() { + return created; + } + + public String getDescription() { + return description; + } + + public String getApiKey() { + return apiKey; + } + + public String getSecretKey() { + return secretKey; + } + + public Class getEntityType() { + return ApiKeyPair.class; + } + + public String getName() { + return name; + } + + public Date getRemoved() { + return removed; + } + + @Override + public long getDomainId() { + return this.domainId; + } + + @Override + public long getAccountId() { + return this.accountId; + } + + public void setId(Long id) { this.id = id; } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public void setName(String name) { + this.name = name; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/RolePermissionBaseVO.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/RolePermissionBaseVO.java index f3347ab66305..588fa0299649 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/acl/RolePermissionBaseVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/RolePermissionBaseVO.java @@ -50,6 +50,12 @@ public class RolePermissionBaseVO implements RolePermissionEntity { public RolePermissionBaseVO() { this.uuid = UUID.randomUUID().toString(); } + public RolePermissionBaseVO(final String rule, final Permission permission) { + this(); + this.rule = rule; + this.permission = permission; + } + public RolePermissionBaseVO(final String rule, final Permission permission, final String description) { this(); this.rule = rule; diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDao.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDao.java new file mode 100644 index 000000000000..006c2afbc96e --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDao.java @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.dao; + +import com.cloud.utils.Pair; +import java.util.List; +import org.apache.cloudstack.acl.ApiKeyPairVO; +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.api.command.admin.user.ListUserKeysCmd; + +public interface ApiKeyPairDao extends GenericDao { + ApiKeyPairVO findBySecretKey(String secretKey); + + ApiKeyPairVO findByApiKey(String apiKey); + + ApiKeyPairVO findByUuid(String uuid); + + Pair, Integer> listApiKeysByUserOrApiKeyId(Long userId, Long apiKeyId); + + ApiKeyPairVO getLastApiKeyCreatedByUser(Long userId); + + Pair, Integer> listByUserIdsPaginated(List userIds, ListUserKeysCmd cmd); + +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDaoImpl.java new file mode 100644 index 000000000000..a4895efed9e0 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairDaoImpl.java @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.dao; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import java.util.List; +import org.apache.cloudstack.acl.ApiKeyPairVO; +import org.apache.cloudstack.api.command.admin.user.ListUserKeysCmd; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.stereotype.Component; + +@Component +public class ApiKeyPairDaoImpl extends GenericDaoBase implements ApiKeyPairDao { + private static final String ID = "id"; + private static final String USER_ID = "userId"; + private static final String API_KEY = "apiKey"; + private static final String SECRET_KEY = "secretKey"; + + private final SearchBuilder keyPairSearch; + + ApiKeyPairDaoImpl() { + super(); + + keyPairSearch = createSearchBuilder(); + keyPairSearch.and(API_KEY, keyPairSearch.entity().getApiKey(), SearchCriteria.Op.EQ); + keyPairSearch.and(SECRET_KEY, keyPairSearch.entity().getSecretKey(), SearchCriteria.Op.EQ); + keyPairSearch.and(ID, keyPairSearch.entity().getId(), SearchCriteria.Op.EQ); + keyPairSearch.and(USER_ID, keyPairSearch.entity().getUserId(), SearchCriteria.Op.IN); + keyPairSearch.done(); + } + + @Override + public ApiKeyPairVO findByApiKey(String apiKey) { + SearchCriteria sc = keyPairSearch.create(); + sc.setParameters(API_KEY, apiKey); + return findOneBy(sc); + } + + public ApiKeyPairVO findBySecretKey(String secretKey) { + SearchCriteria sc = keyPairSearch.create(); + sc.setParameters(SECRET_KEY, secretKey); + return findOneBy(sc); + } + + public Pair, Integer> listApiKeysByUserOrApiKeyId(Long userId, Long apiKeyId) { + SearchCriteria sc = keyPairSearch.create(); + sc.setParametersIfNotNull(USER_ID, userId); + sc.setParametersIfNotNull(ID, apiKeyId); + final Filter searchFilter = new Filter(100); + return searchAndCount(sc, searchFilter); + } + + public ApiKeyPairVO getLastApiKeyCreatedByUser(Long userId) { + final SearchCriteria sc = keyPairSearch.create(); + sc.setParametersIfNotNull(USER_ID, userId); + final Filter searchBySorted = new Filter(ApiKeyPairVO.class, ID, false, null, null); + return findOneBy(sc, searchBySorted); + } + + public Pair, Integer> listByUserIdsPaginated(List userIds, ListUserKeysCmd cmd) { + Long pageSizeVal = cmd.getPageSizeVal(); + Long startIndex = cmd.getStartIndex(); + Filter searchFilter = new Filter(ApiKeyPairVO.class, ID, true, startIndex, pageSizeVal); + + final SearchCriteria sc = keyPairSearch.create(); + sc.setParameters(USER_ID, (Object[]) userIds.toArray(new Long[0])); + + Pair, Integer> apiKeyPairVOList = searchAndCount(sc, searchFilter); + if (CollectionUtils.isEmpty(apiKeyPairVOList.first())) { + return new Pair<>(List.of(), 0); + } + return apiKeyPairVOList; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDao.java new file mode 100644 index 000000000000..cbca2fd72747 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDao.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.dao; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.acl.ApiKeyPairPermissionVO; + +import java.util.List; + +public interface ApiKeyPairPermissionsDao extends GenericDao { + List findAllByApiKeyPairId(Long apiKeyPairId); + + List findAllByKeyPairIdSorted(Long apiKeyPairId); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDaoImpl.java new file mode 100644 index 000000000000..4510e0ae2896 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/acl/dao/ApiKeyPairPermissionsDaoImpl.java @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.acl.dao; + +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import java.util.Collections; +import java.util.Objects; +import org.apache.commons.collections.CollectionUtils; +import org.apache.cloudstack.acl.ApiKeyPairPermissionVO; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class ApiKeyPairPermissionsDaoImpl extends GenericDaoBase implements ApiKeyPairPermissionsDao { + private static final String API_KEY_PAIR_ID = "apiKeyPairId"; + private static final String SORT_ORDER = "sortOrder"; + + private final SearchBuilder permissionByApiKeyPairIdSearch; + + public ApiKeyPairPermissionsDaoImpl() { + super(); + + permissionByApiKeyPairIdSearch = createSearchBuilder(); + permissionByApiKeyPairIdSearch.and(API_KEY_PAIR_ID, permissionByApiKeyPairIdSearch.entity().getApiKeyPairId(), SearchCriteria.Op.EQ); + permissionByApiKeyPairIdSearch.done(); + } + + public List findAllByApiKeyPairId(Long apiKeyPairId) { + SearchCriteria sc = permissionByApiKeyPairIdSearch.create(); + sc.setParameters(API_KEY_PAIR_ID, String.valueOf(apiKeyPairId)); + return listBy(sc); + } + + @Override + public ApiKeyPairPermissionVO persist(final ApiKeyPairPermissionVO item) { + item.setSortOrder(0); + final List permissionsList = findAllByKeyPairIdSorted(item.getApiKeyPairId()); + if (!CollectionUtils.isEmpty(permissionsList)) { + ApiKeyPairPermissionVO lastPermission = permissionsList.get(permissionsList.size() - 1); + item.setSortOrder(lastPermission.getSortOrder() + 1); + } + return super.persist(item); + } + + @Override + public List findAllByKeyPairIdSorted(Long apiKeyPairId) { + final SearchCriteria sc = permissionByApiKeyPairIdSearch.create(); + sc.setParameters(API_KEY_PAIR_ID, apiKeyPairId); + final Filter searchBySorted = new Filter(ApiKeyPairPermissionVO.class, SORT_ORDER, true, null, null); + final List apiKeyPairPermissionList = listBy(sc, searchBySorted); + return Objects.requireNonNullElse(apiKeyPairPermissionList, Collections.emptyList()); + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupDetailVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupDetailVO.java new file mode 100644 index 000000000000..aaf63518708c --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupDetailVO.java @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.ResourceDetail; + +@Entity +@Table(name = "backup_details") +public class BackupDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "backup_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 65536) + private String value; + + @Column(name = "display") + private boolean display = true; + + public BackupDetailVO() { + } + + public BackupDetailVO(long backupId, String name, String value, boolean display) { + this.resourceId = backupId; + this.name = name; + this.value = value; + this.display = display; + } + + @Override + public long getId() { + return id; + } + + @Override + public long getResourceId() { + return resourceId; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getValue() { + return value; + } + + @Override + public boolean isDisplay() { + return display; + } + + public void setId(long id) { + this.id = id; + } + + public void setResourceId(long resourceId) { + this.resourceId = resourceId; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java new file mode 100644 index 000000000000..6bdf7602a9d4 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingDetailsVO.java @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.ResourceDetail; + +@Entity +@Table(name = "backup_offering_details") +public class BackupOfferingDetailsVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "backup_offering_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value") + private String value; + + @Column(name = "display") + private boolean display = true; + + protected BackupOfferingDetailsVO() { + } + + public BackupOfferingDetailsVO(long backupOfferingId, String name, String value, boolean display) { + this.resourceId = backupOfferingId; + this.name = name; + this.value = value; + this.display = display; + } + + @Override + public long getResourceId() { + return resourceId; + } + + public void setResourceId(long backupOfferingId) { + this.resourceId = backupOfferingId; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getValue() { + return value; + } + + @Override + public long getId() { + return id; + } + + @Override + public boolean isDisplay() { + return display; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java index d30385af575d..ebeb7d4a2d59 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupOfferingVO.java @@ -17,6 +17,8 @@ package org.apache.cloudstack.backup; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; + import java.util.Date; import java.util.UUID; @@ -131,4 +133,9 @@ public void setDescription(String description) { public Date getCreated() { return created; } + + @Override + public String toString() { + return String.format("Backup offering %s.", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "name", "uuid")); + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupRepositoryVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupRepositoryVO.java index e8364520ed05..1764496a6c0b 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupRepositoryVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupRepositoryVO.java @@ -67,6 +67,9 @@ public class BackupRepositoryVO implements BackupRepository { @Column(name = "capacity_bytes", nullable = true) private Long capacityBytes; + @Column(name = "cross_zone_instance_creation") + private Boolean crossZoneInstanceCreation; + @Column(name = "created") @Temporal(value = TemporalType.TIMESTAMP) private Date created; @@ -79,7 +82,7 @@ public BackupRepositoryVO() { this.uuid = UUID.randomUUID().toString(); } - public BackupRepositoryVO(final long zoneId, final String provider, final String name, final String type, final String address, final String mountOptions, final Long capacityBytes) { + public BackupRepositoryVO(final long zoneId, final String provider, final String name, final String type, final String address, final String mountOptions, final Long capacityBytes, final Boolean crossZoneInstanceCreation) { this(); this.zoneId = zoneId; this.provider = provider; @@ -88,6 +91,7 @@ public BackupRepositoryVO(final long zoneId, final String provider, final String this.address = address; this.mountOptions = mountOptions; this.capacityBytes = capacityBytes; + this.crossZoneInstanceCreation = crossZoneInstanceCreation; this.created = new Date(); } @@ -139,16 +143,41 @@ public String getMountOptions() { return mountOptions; } + @Override + public void setMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + } + @Override public Long getUsedBytes() { return usedBytes; } + @Override + public void setUsedBytes(Long usedBytes) { + this.usedBytes = usedBytes; + } + @Override public Long getCapacityBytes() { return capacityBytes; } + @Override + public Boolean crossZoneInstanceCreationEnabled() { + return crossZoneInstanceCreation; + } + + @Override + public void setCrossZoneInstanceCreation(Boolean crossZoneInstanceCreation) { + this.crossZoneInstanceCreation = crossZoneInstanceCreation; + } + + @Override + public void setCapacityBytes(Long capacityBytes) { + this.capacityBytes = capacityBytes; + } + public Date getCreated() { return created; } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupScheduleVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupScheduleVO.java index 0258c42c52ba..1ee2cff78b65 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupScheduleVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupScheduleVO.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.backup; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -39,6 +40,9 @@ public class BackupScheduleVO implements BackupSchedule { @Column(name = "id") private long id; + @Column(name = "uuid", nullable = false) + private String uuid = UUID.randomUUID().toString(); + @Column(name = "vm_id") private Long vmId; @@ -59,18 +63,30 @@ public class BackupScheduleVO implements BackupSchedule { Long asyncJobId; @Column(name = "max_backups") - Integer maxBackups = 0; + private int maxBackups = 0; + + @Column(name = "quiescevm") + Boolean quiesceVM = false; + + @Column(name = "account_id") + Long accountId; + + @Column(name = "domain_id") + Long domainId; public BackupScheduleVO() { } - public BackupScheduleVO(Long vmId, DateUtil.IntervalType scheduleType, String schedule, String timezone, Date scheduledTimestamp, Integer maxBackups) { + public BackupScheduleVO(Long vmId, DateUtil.IntervalType scheduleType, String schedule, String timezone, Date scheduledTimestamp, int maxBackups, Boolean quiesceVM, Long accountId, Long domainId) { this.vmId = vmId; this.scheduleType = (short) scheduleType.ordinal(); this.schedule = schedule; this.timezone = timezone; this.scheduledTimestamp = scheduledTimestamp; this.maxBackups = maxBackups; + this.quiesceVM = quiesceVM; + this.accountId = accountId; + this.domainId = domainId; } @Override @@ -84,6 +100,11 @@ public long getId() { return id; } + @Override + public String getUuid() { + return uuid; + } + public Long getVmId() { return vmId; } @@ -133,11 +154,47 @@ public void setAsyncJobId(Long asyncJobId) { this.asyncJobId = asyncJobId; } - public Integer getMaxBackups() { + public int getMaxBackups() { return maxBackups; } - public void setMaxBackups(Integer maxBackups) { + public void setMaxBackups(int maxBackups) { this.maxBackups = maxBackups; } + + public void setQuiesceVM(Boolean quiesceVM) { + this.quiesceVM = quiesceVM; + } + + public Boolean getQuiesceVM() { + return quiesceVM; + } + + @Override + public Class getEntityType() { + return BackupSchedule.class; + } + + @Override + public String getName() { + return null; + } + + @Override + public long getDomainId() { + return domainId; + } + + @Override + public long getAccountId() { + return accountId; + } + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupVO.java index 9ef442baff96..d589f9e6bef8 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/BackupVO.java @@ -19,6 +19,7 @@ import com.cloud.utils.db.GenericDao; import com.google.gson.Gson; + import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import org.apache.commons.lang3.StringUtils; @@ -26,6 +27,7 @@ import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Map; import java.util.UUID; import javax.persistence.Column; @@ -38,6 +40,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; @Entity @Table(name = "backups") @@ -47,11 +50,17 @@ public class BackupVO implements Backup { @Column(name = "id") private long id; + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + @Column(name = "uuid") private String uuid; @Column(name = "vm_id") - private long vmId; + private Long vmId; @Column(name = "external_id") private String externalId; @@ -88,12 +97,27 @@ public class BackupVO implements Backup { @Column(name = "zone_id") private long zoneId; - @Column(name = "backup_interval_type") - private short backupIntervalType; - @Column(name = "backed_volumes", length = 65535) protected String backedUpVolumes; + @Column(name = "backup_schedule_id") + private Long backupScheduleId; + + @Column(name = "from_checkpoint_id") + private String fromCheckpointId; + + @Column(name = "to_checkpoint_id") + private String toCheckpointId; + + @Column(name = "checkpoint_create_time") + private Long checkpointCreateTime; + + @Column(name = "host_id") + private Long hostId; + + @Transient + Map details; + public BackupVO() { this.uuid = UUID.randomUUID().toString(); } @@ -115,11 +139,11 @@ public String getUuid() { } @Override - public long getVmId() { + public Long getVmId() { return vmId; } - public void setVmId(long vmId) { + public void setVmId(Long vmId) { this.vmId = vmId; } @@ -211,22 +235,29 @@ public void setZoneId(long zoneId) { this.zoneId = zoneId; } - public short getBackupIntervalType() { - return backupIntervalType; + @Override + public Class getEntityType() { + return Backup.class; + } + + @Override + public String getName() { + return name; } - public void setBackupIntervalType(short backupIntervalType) { - this.backupIntervalType = backupIntervalType; + @Override + public void setName(String name) { + this.name = name; } @Override - public Class getEntityType() { - return Backup.class; + public String getDescription() { + return description; } @Override - public String getName() { - return null; + public void setDescription(String description) { + this.description = description; } public List getBackedUpVolumes() { @@ -240,11 +271,69 @@ public void setBackedUpVolumes(String backedUpVolumes) { this.backedUpVolumes = backedUpVolumes; } + @Override + public Map getDetails() { + return details; + } + + @Override + public String getDetail(String name) { + return this.details.get(name); + } + + public void setDetails(Map details) { + this.details = details; + } + public Date getRemoved() { return removed; } - public void setRemoved(Date removed) { this.removed = removed; } + + @Override + public Long getBackupScheduleId() { + return backupScheduleId; + } + + public void setBackupScheduleId(Long backupScheduleId) { + this.backupScheduleId = backupScheduleId; + } + + @Override + public String getFromCheckpointId() { + return fromCheckpointId; + } + + public void setFromCheckpointId(String fromCheckpointId) { + this.fromCheckpointId = fromCheckpointId; + } + + @Override + public String getToCheckpointId() { + return toCheckpointId; + } + + public void setToCheckpointId(String toCheckpointId) { + this.toCheckpointId = toCheckpointId; + } + + @Override + public Long getCheckpointCreateTime() { + return checkpointCreateTime; + } + + public void setCheckpointCreateTime(Long checkpointCreateTime) { + this.checkpointCreateTime = checkpointCreateTime; + } + + @Override + public Long getHostId() { + return hostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/ImageTransferVO.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/ImageTransferVO.java new file mode 100644 index 000000000000..ec9b927b63e4 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/ImageTransferVO.java @@ -0,0 +1,242 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "image_transfer") +public class ImageTransferVO implements ImageTransfer { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "uuid") + private String uuid; + + @Column(name = "backup_id") + private Long backupId; + + @Column(name = "volume_id") + private long volumeId; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "socket") + private String socket; + + @Column(name = "file") + private String file; + + @Column(name = "transfer_url") + private String transferUrl; + + @Enumerated(value = EnumType.STRING) + @Column(name = "phase") + private Phase phase; + + @Enumerated(value = EnumType.STRING) + @Column(name = "direction") + private Direction direction; + + @Enumerated(value = EnumType.STRING) + @Column(name = "backend") + private Backend backend; + + @Column(name = "signed_ticket_id") + private String signedTicketId; + + @Column(name = "account_id") + Long accountId; + + @Column(name = "domain_id") + Long domainId; + + @Column(name = "data_center_id") + Long dataCenterId; + + @Column(name = "created") + @Temporal(value = TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + private Date updated; + + @Column(name = "removed") + @Temporal(value = TemporalType.TIMESTAMP) + private Date removed; + + public ImageTransferVO() { + } + + private ImageTransferVO(String uuid, long volumeId, long hostId, Phase phase, Direction direction, Long accountId, Long domainId, Long dataCenterId) { + this.uuid = uuid; + this.volumeId = volumeId; + this.hostId = hostId; + this.phase = phase; + this.direction = direction; + this.accountId = accountId; + this.domainId = domainId; + this.dataCenterId = dataCenterId; + this.created = new Date(); + } + + public ImageTransferVO(String uuid, Long backupId, long volumeId, long hostId, String socket, Phase phase, Direction direction, Long accountId, Long domainId, Long dataCenterId) { + this(uuid, volumeId, hostId, phase, direction, accountId, domainId, dataCenterId); + this.backupId = backupId; + this.socket = socket; + this.backend = Backend.nbd; + } + + public ImageTransferVO(String uuid, long volumeId, long hostId, String file, Phase phase, Direction direction, Long accountId, Long domainId, Long dataCenterId) { + this(uuid, volumeId, hostId, phase, direction, accountId, domainId, dataCenterId); + this.file = file; + this.backend = Backend.file; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public Long getBackupId() { + return backupId; + } + + public void setBackupId(long backupId) { + this.backupId = backupId; + } + + @Override + public long getVolumeId() { + return volumeId; + } + + public void setVolumeId(long volumeId) { + this.volumeId = volumeId; + } + + @Override + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + public void setSocket(String socket) { + this.socket = socket; + } + + @Override + public String getTransferUrl() { + return transferUrl; + } + + public void setTransferUrl(String transferUrl) { + this.transferUrl = transferUrl; + } + + @Override + public Phase getPhase() { + return phase; + } + + public void setPhase(Phase phase) { + this.phase = phase; + this.updated = new Date(); + } + + @Override + public Direction getDirection() { + return direction; + } + + public void setDirection(Direction direction) { + this.direction = direction; + } + + @Override + public Backend getBackend() { + return backend; + } + + @Override + public String getSignedTicketId() { + return signedTicketId; + } + + public void setSignedTicketId(String signedTicketId) { + this.signedTicketId = signedTicketId; + } + + @Override + public Class getEntityType() { + return ImageTransfer.class; + } + + @Override + public String getName() { + return null; + } + + @Override + public long getDomainId() { + return domainId; + } + + @Override + public long getAccountId() { + return accountId; + } + + @Override + public long getDataCenterId() { + return dataCenterId; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDao.java index ffd5e5a4a66b..e60e49e1a0c2 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDao.java @@ -19,7 +19,6 @@ import java.util.List; -import org.apache.cloudstack.api.response.BackupResponse; import org.apache.cloudstack.backup.Backup; import org.apache.cloudstack.backup.BackupVO; @@ -33,12 +32,14 @@ public interface BackupDao extends GenericDao { List listByVmId(Long zoneId, Long vmId); List listByAccountId(Long accountId); List syncBackups(Long zoneId, Long vmId, List externalBackups); + List listByVmIdAndOffering(Long zoneId, Long vmId, Long offeringId); + List searchByVmIds(List vmIds); BackupVO getBackupVO(Backup backup); List listByOfferingId(Long backupOfferingId); - - List listBackupsByVMandIntervalType(Long vmId, Backup.Type backupType); - - BackupResponse newBackupResponse(Backup backup); + List listVmIdsWithBackupsInZone(Long zoneId); public Long countBackupsForAccount(long accountId); public Long calculateBackupStorageForAccount(long accountId); + void loadDetails(BackupVO backup); + void saveDetails(BackupVO backup); + List listBySchedule(Long backupScheduleId); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDaoImpl.java index b4e1a7602825..fd29da72c718 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDaoImpl.java @@ -19,29 +19,31 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; +import java.util.Map; import javax.annotation.PostConstruct; import javax.inject.Inject; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericSearchBuilder; -import org.apache.cloudstack.api.response.BackupResponse; + import org.apache.cloudstack.backup.Backup; -import org.apache.cloudstack.backup.BackupOffering; +import org.apache.cloudstack.backup.BackupDetailVO; import org.apache.cloudstack.backup.BackupVO; +import org.apache.commons.collections.CollectionUtils; -import com.cloud.dc.DataCenterVO; import com.cloud.dc.dao.DataCenterDao; -import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; -import com.cloud.user.AccountVO; import com.cloud.user.dao.AccountDao; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; -import com.cloud.vm.VMInstanceVO; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.TransactionCallback; import com.cloud.vm.dao.VMInstanceDao; -import com.google.gson.Gson; +import com.cloud.network.dao.NetworkDao; public class BackupDaoImpl extends GenericDaoBase implements BackupDao { @@ -57,13 +59,26 @@ public class BackupDaoImpl extends GenericDaoBase implements Bac @Inject VMInstanceDao vmInstanceDao; + @Inject + private VMTemplateDao templateDao; + @Inject BackupOfferingDao backupOfferingDao; + @Inject + BackupDetailsDao backupDetailsDao; + + @Inject + ServiceOfferingDao serviceOfferingDao; + + @Inject + NetworkDao networkDao; + private SearchBuilder backupSearch; private GenericSearchBuilder CountBackupsByAccount; private GenericSearchBuilder CalculateBackupStorageByAccount; - private SearchBuilder ListBackupsByVMandIntervalType; + private SearchBuilder listBackupsBySchedule; + private GenericSearchBuilder backupVmSearchInZone; public BackupDaoImpl() { } @@ -77,6 +92,11 @@ protected void init() { backupSearch.and("zone_id", backupSearch.entity().getZoneId(), SearchCriteria.Op.EQ); backupSearch.done(); + backupVmSearchInZone = createSearchBuilder(Long.class); + backupVmSearchInZone.select(null, SearchCriteria.Func.DISTINCT, backupVmSearchInZone.entity().getVmId()); + backupVmSearchInZone.and("zone_id", backupVmSearchInZone.entity().getZoneId(), SearchCriteria.Op.EQ); + backupVmSearchInZone.done(); + CountBackupsByAccount = createSearchBuilder(Long.class); CountBackupsByAccount.select(null, SearchCriteria.Func.COUNT, null); CountBackupsByAccount.and("account", CountBackupsByAccount.entity().getAccountId(), SearchCriteria.Op.EQ); @@ -91,12 +111,11 @@ protected void init() { CalculateBackupStorageByAccount.and("removed", CalculateBackupStorageByAccount.entity().getRemoved(), SearchCriteria.Op.NULL); CalculateBackupStorageByAccount.done(); - ListBackupsByVMandIntervalType = createSearchBuilder(); - ListBackupsByVMandIntervalType.and("vmId", ListBackupsByVMandIntervalType.entity().getVmId(), SearchCriteria.Op.EQ); - ListBackupsByVMandIntervalType.and("intervalType", ListBackupsByVMandIntervalType.entity().getBackupIntervalType(), SearchCriteria.Op.EQ); - ListBackupsByVMandIntervalType.and("status", ListBackupsByVMandIntervalType.entity().getStatus(), SearchCriteria.Op.EQ); - ListBackupsByVMandIntervalType.and("removed", ListBackupsByVMandIntervalType.entity().getRemoved(), SearchCriteria.Op.NULL); - ListBackupsByVMandIntervalType.done(); + listBackupsBySchedule = createSearchBuilder(); + listBackupsBySchedule.and("backup_schedule_id", listBackupsBySchedule.entity().getBackupScheduleId(), SearchCriteria.Op.EQ); + listBackupsBySchedule.and("status", listBackupsBySchedule.entity().getStatus(), SearchCriteria.Op.EQ); + listBackupsBySchedule.and("removed", listBackupsBySchedule.entity().getRemoved(), SearchCriteria.Op.NULL); + listBackupsBySchedule.done(); } @Override @@ -130,6 +149,17 @@ public List listByVmId(Long zoneId, Long vmId) { return new ArrayList<>(listBy(sc)); } + @Override + public List listByVmIdAndOffering(Long zoneId, Long vmId, Long offeringId) { + SearchCriteria sc = backupSearch.create(); + sc.setParameters("vm_id", vmId); + if (zoneId != null) { + sc.setParameters("zone_id", zoneId); + } + sc.setParameters("backup_offering_id", offeringId); + return new ArrayList<>(listBy(sc)); + } + private Backup findByExternalId(Long zoneId, String externalId) { SearchCriteria sc = backupSearch.create(); sc.setParameters("external_id", externalId); @@ -137,6 +167,18 @@ private Backup findByExternalId(Long zoneId, String externalId) { return findOneBy(sc); } + @Override + public List searchByVmIds(List vmIds) { + if (CollectionUtils.isEmpty(vmIds)) { + return new ArrayList<>(); + } + SearchBuilder sb = createSearchBuilder(); + sb.and("vmIds", sb.entity().getVmId(), SearchCriteria.Op.IN); + SearchCriteria sc = sb.create(); + sc.setParameters("vmIds", vmIds.toArray()); + return search(sc, null); + } + public BackupVO getBackupVO(Backup backup) { BackupVO backupVO = new BackupVO(); backupVO.setExternalId(backup.getExternalId()); @@ -158,6 +200,27 @@ public void removeExistingBackups(Long zoneId, Long vmId) { expunge(sc); } + @Override + public BackupVO persist(BackupVO backup) { + return Transaction.execute((TransactionCallback) status -> { + BackupVO backupDb = super.persist(backup); + saveDetails(backup); + loadDetails(backupDb); + return backupDb; + }); + } + + @Override + public boolean update(Long id, BackupVO backup) { + return Transaction.execute((TransactionCallback) status -> { + boolean result = super.update(id, backup); + if (result) { + saveDetails(backup); + } + return result; + }); + } + @Override public List syncBackups(Long zoneId, Long vmId, List externalBackups) { for (Backup backup : externalBackups) { @@ -171,7 +234,7 @@ public List syncBackups(Long zoneId, Long vmId, List externalBac public Long countBackupsForAccount(long accountId) { SearchCriteria sc = CountBackupsByAccount.create(); sc.setParameters("account", accountId); - sc.setParameters("status", Backup.Status.Error, Backup.Status.Failed, Backup.Status.Removed, Backup.Status.Expunged); + sc.setParameters("status", Backup.Status.Failed, Backup.Status.Removed, Backup.Status.Expunged); return customSearch(sc, null).get(0); } @@ -179,58 +242,42 @@ public Long countBackupsForAccount(long accountId) { public Long calculateBackupStorageForAccount(long accountId) { SearchCriteria sc = CalculateBackupStorageByAccount.create(); sc.setParameters("account", accountId); - sc.setParameters("status", Backup.Status.Error, Backup.Status.Failed, Backup.Status.Removed, Backup.Status.Expunged); + sc.setParameters("status", Backup.Status.Failed, Backup.Status.Removed, Backup.Status.Expunged); return customSearch(sc, null).get(0).sum; } @Override - public List listBackupsByVMandIntervalType(Long vmId, Backup.Type backupType) { - SearchCriteria sc = ListBackupsByVMandIntervalType.create(); - sc.setParameters("vmId", vmId); - sc.setParameters("type", backupType.ordinal()); + public List listBySchedule(Long backupScheduleId) { + SearchCriteria sc = listBackupsBySchedule.create(); + sc.setParameters("backup_schedule_id", backupScheduleId); sc.setParameters("status", Backup.Status.BackedUp); - return listBy(sc, null); + return listBy(sc, new Filter(BackupVO.class, "date", true)); + } + + @Override + public void loadDetails(BackupVO backup) { + Map details = backupDetailsDao.listDetailsKeyPairs(backup.getId()); + backup.setDetails(details); } @Override - public BackupResponse newBackupResponse(Backup backup) { - VMInstanceVO vm = vmInstanceDao.findByIdIncludingRemoved(backup.getVmId()); - AccountVO account = accountDao.findByIdIncludingRemoved(vm.getAccountId()); - DomainVO domain = domainDao.findByIdIncludingRemoved(vm.getDomainId()); - DataCenterVO zone = dataCenterDao.findByIdIncludingRemoved(vm.getDataCenterId()); - Long offeringId = backup.getBackupOfferingId(); - if (offeringId == null) { - offeringId = vm.getBackupOfferingId(); + public void saveDetails(BackupVO backup) { + Map detailsStr = backup.getDetails(); + if (detailsStr == null) { + return; } - BackupOffering offering = backupOfferingDao.findByIdIncludingRemoved(offeringId); - - BackupResponse response = new BackupResponse(); - response.setId(backup.getUuid()); - response.setVmId(vm.getUuid()); - response.setVmName(vm.getHostName()); - response.setExternalId(backup.getExternalId()); - response.setType(backup.getType()); - response.setDate(backup.getDate()); - response.setSize(backup.getSize()); - response.setProtectedSize(backup.getProtectedSize()); - response.setStatus(backup.getStatus()); - // ACS 4.20: For backups taken prior this release the backup.backed_volumes column would be empty hence use vm_instance.backup_volumes - String backedUpVolumes; - if (Objects.isNull(backup.getBackedUpVolumes())) { - backedUpVolumes = new Gson().toJson(vm.getBackupVolumeList().toArray(), Backup.VolumeInfo[].class); - } else { - backedUpVolumes = new Gson().toJson(backup.getBackedUpVolumes().toArray(), Backup.VolumeInfo[].class); + List details = new ArrayList(); + for (String key : detailsStr.keySet()) { + BackupDetailVO detail = new BackupDetailVO(backup.getId(), key, detailsStr.get(key), true); + details.add(detail); } - response.setVolumes(backedUpVolumes); - response.setBackupOfferingId(offering.getUuid()); - response.setBackupOffering(offering.getName()); - response.setAccountId(account.getUuid()); - response.setAccount(account.getAccountName()); - response.setDomainId(domain.getUuid()); - response.setDomain(domain.getName()); - response.setZoneId(zone.getUuid()); - response.setZone(zone.getName()); - response.setObjectName("backup"); - return response; + backupDetailsDao.saveDetails(details); + } + + @Override + public List listVmIdsWithBackupsInZone(Long zoneId) { + SearchCriteria sc = backupVmSearchInZone.create(); + sc.setParameters("zone_id", zoneId); + return customSearchIncludingRemoved(sc, null); } } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDao.java similarity index 81% rename from engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDao.java rename to engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDao.java index c22da6b4ff53..664650074bce 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDao.java @@ -14,12 +14,13 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm.dao; +package org.apache.cloudstack.backup.dao; +import org.apache.cloudstack.backup.BackupDetailVO; import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; import com.cloud.utils.db.GenericDao; -import com.cloud.vm.UserVmDetailVO; -public interface UserVmDetailsDao extends GenericDao, ResourceDetailsDao { +public interface BackupDetailsDao extends GenericDao, ResourceDetailsDao { + } diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDaoImpl.java similarity index 79% rename from engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDaoImpl.java rename to engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDaoImpl.java index d8f751842d51..08c7192af909 100644 --- a/engine/schema/src/main/java/com/cloud/vm/dao/UserVmDetailsDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDetailsDaoImpl.java @@ -14,21 +14,18 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm.dao; +package org.apache.cloudstack.backup.dao; -import org.springframework.stereotype.Component; - +import org.apache.cloudstack.backup.BackupDetailVO; import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; - -import com.cloud.vm.UserVmDetailVO; +import org.springframework.stereotype.Component; @Component -public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase implements UserVmDetailsDao { +public class BackupDetailsDaoImpl extends ResourceDetailsDaoBase implements BackupDetailsDao { @Override public void addDetail(long resourceId, String key, String value, boolean display) { - super.addDetail(new UserVmDetailVO(resourceId, key, value, display)); + super.addDetail(new BackupDetailVO(resourceId, key, value, display)); } - } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDao.java index d001de8b6c67..d40e828121e0 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDao.java @@ -24,7 +24,7 @@ import com.cloud.utils.db.GenericDao; public interface BackupOfferingDao extends GenericDao { - BackupOfferingResponse newBackupOfferingResponse(BackupOffering policy); + BackupOfferingResponse newBackupOfferingResponse(BackupOffering policy, Boolean crossZoneInstanceCreation); BackupOffering findByExternalId(String externalId, Long zoneId); BackupOffering findByName(String name, Long zoneId); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java index 0568a0185bba..708faeef4643 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDaoImpl.java @@ -20,6 +20,8 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; +import com.cloud.domain.DomainVO; +import com.cloud.domain.dao.DomainDao; import org.apache.cloudstack.api.response.BackupOfferingResponse; import org.apache.cloudstack.backup.BackupOffering; import org.apache.cloudstack.backup.BackupOfferingVO; @@ -30,10 +32,16 @@ import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import java.util.List; + public class BackupOfferingDaoImpl extends GenericDaoBase implements BackupOfferingDao { @Inject DataCenterDao dataCenterDao; + @Inject + BackupOfferingDetailsDao backupOfferingDetailsDao; + @Inject + DomainDao domainDao; private SearchBuilder backupPoliciesSearch; @@ -50,19 +58,36 @@ protected void init() { } @Override - public BackupOfferingResponse newBackupOfferingResponse(BackupOffering offering) { - DataCenterVO zone = dataCenterDao.findById(offering.getZoneId()); + public BackupOfferingResponse newBackupOfferingResponse(BackupOffering offering, Boolean crossZoneInstanceCreation) { + DataCenterVO zone = dataCenterDao.findById(offering.getZoneId()); + List domainIds = backupOfferingDetailsDao.findDomainIds(offering.getId()); BackupOfferingResponse response = new BackupOfferingResponse(); response.setId(offering.getUuid()); response.setName(offering.getName()); response.setDescription(offering.getDescription()); response.setExternalId(offering.getExternalId()); + response.setProvider(offering.getProvider()); response.setUserDrivenBackups(offering.isUserDrivenBackupAllowed()); if (zone != null) { response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName()); } + if (domainIds != null && !domainIds.isEmpty()) { + String domainUUIDs = domainIds.stream().map(Long::valueOf).map(domainId -> { + DomainVO domain = domainDao.findById(domainId); + return domain != null ? domain.getUuid() : ""; + }).filter(name -> !name.isEmpty()).reduce((a, b) -> a + "," + b).orElse(""); + String domainNames = domainIds.stream().map(Long::valueOf).map(domainId -> { + DomainVO domain = domainDao.findById(domainId); + return domain != null ? domain.getName() : ""; + }).filter(name -> !name.isEmpty()).reduce((a, b) -> a + "," + b).orElse(""); + response.setDomain(domainNames); + response.setDomainId(domainUUIDs); + } + if (crossZoneInstanceCreation) { + response.setCrossZoneInstanceCreation(true); + } response.setCreated(offering.getCreated()); response.setObjectName("backupoffering"); return response; diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java new file mode 100644 index 000000000000..390fcba1e0e7 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDao.java @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup.dao; + +import java.util.List; + +import org.apache.cloudstack.backup.BackupOfferingDetailsVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface BackupOfferingDetailsDao extends GenericDao, ResourceDetailsDao { + List findDomainIds(final long resourceId); + List findZoneIds(final long resourceId); + String getDetail(Long backupOfferingId, String key); + List findOfferingIdsByDomainIds(List domainIds); + void updateBackupOfferingDomainIdsDetail(long backupOfferingId, List filteredDomainIds); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java new file mode 100644 index 000000000000..f052c93f9817 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupOfferingDetailsDaoImpl.java @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.backup.dao; + + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.backup.BackupOfferingDetailsVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +public class BackupOfferingDetailsDaoImpl extends ResourceDetailsDaoBase implements BackupOfferingDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new BackupOfferingDetailsVO(resourceId, key, value, display)); + } + + @Override + public List findDomainIds(long resourceId) { + final List domainIds = new ArrayList<>(); + for (final BackupOfferingDetailsVO detail: findDetails(resourceId, ApiConstants.DOMAIN_ID)) { + final Long domainId = Long.valueOf(detail.getValue()); + if (domainId > 0) { + domainIds.add(domainId); + } + } + return domainIds; + } + + @Override + public List findZoneIds(long resourceId) { + final List zoneIds = new ArrayList<>(); + for (final BackupOfferingDetailsVO detail: findDetails(resourceId, ApiConstants.ZONE_ID)) { + final Long zoneId = Long.valueOf(detail.getValue()); + if (zoneId > 0) { + zoneIds.add(zoneId); + } + } + return zoneIds; + } + + @Override + public String getDetail(Long backupOfferingId, String key) { + String detailValue = null; + BackupOfferingDetailsVO backupOfferingDetail = findDetail(backupOfferingId, key); + if (backupOfferingDetail != null) { + detailValue = backupOfferingDetail.getValue(); + } + return detailValue; + } + + @Override + public List findOfferingIdsByDomainIds(List domainIds) { + Object[] dIds = domainIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList()).toArray(); + return findResourceIdsByNameAndValueIn("domainid", dIds); + } + + @DB + @Override + public void updateBackupOfferingDomainIdsDetail(long backupOfferingId, List filteredDomainIds) { + SearchBuilder sb = createSearchBuilder(); + List detailsVO = new ArrayList<>(); + sb.and("offeringId", sb.entity().getResourceId(), SearchCriteria.Op.EQ); + sb.and("detailName", sb.entity().getName(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("offeringId", String.valueOf(backupOfferingId)); + sc.setParameters("detailName", ApiConstants.DOMAIN_ID); + remove(sc); + for (Long domainId : filteredDomainIds) { + detailsVO.add(new BackupOfferingDetailsVO(backupOfferingId, ApiConstants.DOMAIN_ID, String.valueOf(domainId), false)); + } + if (!detailsVO.isEmpty()) { + for (BackupOfferingDetailsVO detailVO : detailsVO) { + persist(detailVO); + } + } + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDao.java index 0034bfb30ab6..6dec994be0c9 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDao.java @@ -28,4 +28,6 @@ public interface BackupRepositoryDao extends GenericDao listByZoneAndProvider(Long zoneId, String provider); BackupRepository findByBackupOfferingId(Long backupOfferingId); + + boolean updateCapacity(BackupRepository backupRepository, Long capacityBytes, Long usedBytes); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDaoImpl.java index 460b6d8aba45..ea969988e2bb 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupRepositoryDaoImpl.java @@ -64,4 +64,12 @@ public BackupRepository findByBackupOfferingId(Long backupOfferingId) { } return findByUuid(offering.getExternalId()); } + + @Override + public boolean updateCapacity(BackupRepository backupRepository, Long capacityBytes, Long usedBytes) { + BackupRepositoryVO repository = findById(backupRepository.getId()); + repository.setCapacityBytes(capacityBytes); + repository.setUsedBytes(usedBytes); + return update(repository.getId(), repository); + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDao.java index ee1783a9c896..87b7dab1ff7b 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDao.java @@ -21,20 +21,14 @@ import java.util.List; import com.cloud.utils.DateUtil; -import org.apache.cloudstack.api.response.BackupScheduleResponse; -import org.apache.cloudstack.backup.BackupSchedule; import org.apache.cloudstack.backup.BackupScheduleVO; import com.cloud.utils.db.GenericDao; public interface BackupScheduleDao extends GenericDao { - BackupScheduleVO findByVM(Long vmId); - List listByVM(Long vmId); BackupScheduleVO findByVMAndIntervalType(Long vmId, DateUtil.IntervalType intervalType); List getSchedulesToExecute(Date currentTimestamp); - - BackupScheduleResponse newBackupScheduleResponse(BackupSchedule schedule); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDaoImpl.java index aac2e3bf2320..972af73391af 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupScheduleDaoImpl.java @@ -17,28 +17,23 @@ package org.apache.cloudstack.backup.dao; +import java.sql.PreparedStatement; +import java.sql.SQLException; import java.util.Date; import java.util.List; import javax.annotation.PostConstruct; -import javax.inject.Inject; import com.cloud.utils.DateUtil; -import org.apache.cloudstack.api.response.BackupScheduleResponse; -import org.apache.cloudstack.backup.BackupSchedule; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.TransactionLegacy; import org.apache.cloudstack.backup.BackupScheduleVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; -import com.cloud.vm.VMInstanceVO; -import com.cloud.vm.dao.VMInstanceDao; public class BackupScheduleDaoImpl extends GenericDaoBase implements BackupScheduleDao { - - @Inject - VMInstanceDao vmInstanceDao; - private SearchBuilder backupScheduleSearch; private SearchBuilder executableSchedulesSearch; @@ -59,13 +54,6 @@ protected void init() { executableSchedulesSearch.done(); } - @Override - public BackupScheduleVO findByVM(Long vmId) { - SearchCriteria sc = backupScheduleSearch.create(); - sc.setParameters("vm_id", vmId); - return findOneBy(sc); - } - @Override public List listByVM(Long vmId) { SearchCriteria sc = backupScheduleSearch.create(); @@ -88,17 +76,19 @@ public List getSchedulesToExecute(Date currentTimestamp) { return listBy(sc); } + @DB @Override - public BackupScheduleResponse newBackupScheduleResponse(BackupSchedule schedule) { - VMInstanceVO vm = vmInstanceDao.findByIdIncludingRemoved(schedule.getVmId()); - BackupScheduleResponse response = new BackupScheduleResponse(); - response.setVmId(vm.getUuid()); - response.setVmName(vm.getHostName()); - response.setIntervalType(schedule.getScheduleType()); - response.setSchedule(schedule.getSchedule()); - response.setTimezone(schedule.getTimezone()); - response.setMaxBakups(schedule.getMaxBackups()); - response.setObjectName("backupschedule"); - return response; + public boolean remove(Long id) { + String sql = "UPDATE backups SET backup_schedule_id = NULL WHERE backup_schedule_id = ?"; + TransactionLegacy transaction = TransactionLegacy.currentTxn(); + try { + PreparedStatement preparedStatement = transaction.prepareAutoCloseStatement(sql); + preparedStatement.setLong(1, id); + preparedStatement.executeUpdate(); + return super.remove(id); + } catch (SQLException e) { + logger.warn("Unable to clean up backup schedules references from the backups table.", e); + return false; + } } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDao.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDao.java new file mode 100644 index 000000000000..9a9fbeb8814e --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDao.java @@ -0,0 +1,36 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup.dao; + +import java.util.List; + +import org.apache.cloudstack.backup.ImageTransfer; +import org.apache.cloudstack.backup.ImageTransferVO; + +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDao; + +public interface ImageTransferDao extends GenericDao { + List listByBackupId(Long backupId); + ImageTransferVO findByUuid(String uuid); + ImageTransferVO findByVolume(Long volumeId); + ImageTransferVO findUnfinishedByVolume(Long volumeId); + List listByPhaseAndDirection(ImageTransfer.Phase phase, ImageTransfer.Direction direction); + List listByZonesAndOwners(List zoneIds, List accountIds, List domainIds, + Filter filter); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDaoImpl.java new file mode 100644 index 000000000000..2e36f924e4ef --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/backup/dao/ImageTransferDaoImpl.java @@ -0,0 +1,136 @@ +//Licensed to the Apache Software Foundation (ASF) under one +//or more contributor license agreements. See the NOTICE file +//distributed with this work for additional information +//regarding copyright ownership. The ASF licenses this file +//to you under the Apache License, Version 2.0 (the +//"License"); you may not use this file except in compliance +//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 org.apache.cloudstack.backup.dao; + +import java.util.Collections; +import java.util.List; + +import javax.annotation.PostConstruct; + +import org.apache.cloudstack.backup.ImageTransfer; +import org.apache.cloudstack.backup.ImageTransferVO; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class ImageTransferDaoImpl extends GenericDaoBase implements ImageTransferDao { + + private SearchBuilder backupIdSearch; + private SearchBuilder uuidSearch; + private SearchBuilder volumeSearch; + private SearchBuilder volumeUnfinishedSearch; + private SearchBuilder phaseDirectionSearch; + + public ImageTransferDaoImpl() { + } + + @PostConstruct + protected void init() { + backupIdSearch = createSearchBuilder(); + backupIdSearch.and("backupId", backupIdSearch.entity().getBackupId(), SearchCriteria.Op.EQ); + backupIdSearch.done(); + + uuidSearch = createSearchBuilder(); + uuidSearch.and("uuid", uuidSearch.entity().getUuid(), SearchCriteria.Op.EQ); + uuidSearch.done(); + + volumeSearch = createSearchBuilder(); + volumeSearch.and("volumeId", volumeSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); + volumeSearch.done(); + + volumeUnfinishedSearch = createSearchBuilder(); + volumeUnfinishedSearch.and("volumeId", volumeUnfinishedSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); + volumeUnfinishedSearch.and("phase", volumeUnfinishedSearch.entity().getPhase(), SearchCriteria.Op.NEQ); + volumeUnfinishedSearch.done(); + + phaseDirectionSearch = createSearchBuilder(); + phaseDirectionSearch.and("phase", phaseDirectionSearch.entity().getPhase(), SearchCriteria.Op.EQ); + phaseDirectionSearch.and("direction", phaseDirectionSearch.entity().getDirection(), SearchCriteria.Op.EQ); + phaseDirectionSearch.done(); + } + + @Override + public List listByBackupId(Long backupId) { + SearchCriteria sc = backupIdSearch.create(); + sc.setParameters("backupId", backupId); + return listBy(sc); + } + + @Override + public ImageTransferVO findByUuid(String uuid) { + SearchCriteria sc = uuidSearch.create(); + sc.setParameters("uuid", uuid); + return findOneBy(sc); + } + + @Override + public ImageTransferVO findByVolume(Long volumeId) { + SearchCriteria sc = volumeSearch.create(); + sc.setParameters("volumeId", volumeId); + return findOneBy(sc); + } + + @Override + public ImageTransferVO findUnfinishedByVolume(Long volumeId) { + SearchCriteria sc = volumeUnfinishedSearch.create(); + sc.setParameters("volumeId", volumeId); + sc.setParameters("phase", ImageTransferVO.Phase.finished.toString()); + return findOneBy(sc); + } + + @Override + public List listByPhaseAndDirection(ImageTransfer.Phase phase, ImageTransfer.Direction direction) { + SearchCriteria sc = phaseDirectionSearch.create(); + sc.setParameters("phase", phase); + sc.setParameters("direction", direction); + return listBy(sc); + } + + @Override + public List listByZonesAndOwners(List zoneIds, List accountIds, List domainIds, + Filter filter) { + if (CollectionUtils.isEmpty(zoneIds)) { + return Collections.emptyList(); + } + SearchBuilder sb = createSearchBuilder(); + sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.IN); + boolean accountIdsNotEmpty = CollectionUtils.isNotEmpty(accountIds); + boolean domainIdsNotEmpty = CollectionUtils.isNotEmpty(domainIds); + if (accountIdsNotEmpty || domainIdsNotEmpty) { + sb.and().op("account", sb.entity().getAccountId(), SearchCriteria.Op.IN); + sb.or("domain", sb.entity().getDomainId(), SearchCriteria.Op.IN); + sb.cp(); + } + sb.done(); + final SearchCriteria sc = sb.create(); + sc.setParameters("dataCenterId", zoneIds.toArray()); + if (accountIdsNotEmpty) { + sc.setParameters("account", accountIds.toArray()); + } + if (domainIdsNotEmpty) { + sc.setParameters("domain", domainIds.toArray()); + } + + return listBy(sc, filter); + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/command/ReconcileCommandVO.java b/engine/schema/src/main/java/org/apache/cloudstack/command/ReconcileCommandVO.java new file mode 100644 index 000000000000..150c9662ada1 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/command/ReconcileCommandVO.java @@ -0,0 +1,216 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.cloud.agent.api.Command; +import com.cloud.utils.db.GenericDao; + +import org.apache.cloudstack.acl.InfrastructureEntity; +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "reconcile_commands") +public class ReconcileCommandVO implements InfrastructureEntity, InternalIdentity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "management_server_id") + private long managementServerId; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "request_sequence") + private long requestSequence; + + @Column(name = "resource_id") + private long resourceId; + + @Column(name = "resource_type") + private ApiCommandResourceType resourceType; + + @Column(name = "state_by_management") + private Command.State stateByManagement; + + @Column(name = "state_by_agent") + private Command.State stateByAgent; + + @Column(name = "command_name") + private String commandName; + + @Column(name = "command_info", length = 65535) + private String commandInfo; + + @Column(name = "answer_name") + private String answerName; + + @Column(name = "answer_info", length = 65535) + private String answerInfo; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + @Column(name= GenericDao.REMOVED_COLUMN) + private Date removed; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name= "updated") + private Date updated; + + @Column(name= "retry_count") + private Long retryCount = 0L; + + @Override + public long getId() { + return id; + } + + public long getManagementServerId() { + return managementServerId; + } + + public void setManagementServerId(long managementServerId) { + this.managementServerId = managementServerId; + } + + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + public long getRequestSequence() { + return requestSequence; + } + + public void setRequestSequence(long requestSequence) { + this.requestSequence = requestSequence; + } + + public long getResourceId() { + return resourceId; + } + + public void setResourceId(long resourceId) { + this.resourceId = resourceId; + } + + public ApiCommandResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ApiCommandResourceType resourceType) { + this.resourceType = resourceType; + } + + public Command.State getStateByManagement() { + return stateByManagement; + } + + public void setStateByManagement(Command.State stateByManagement) { + this.stateByManagement = stateByManagement; + } + + public Command.State getStateByAgent() { + return stateByAgent; + } + + public void setStateByAgent(Command.State stateByAgent) { + this.stateByAgent = stateByAgent; + } + + public String getCommandName() { + return commandName; + } + + public void setCommandName(String commandName) { + this.commandName = commandName; + } + + public String getCommandInfo() { + return commandInfo; + } + + public void setCommandInfo(String commandInfo) { + this.commandInfo = commandInfo; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getAnswerName() { + return answerName; + } + + public void setAnswerName(String answerName) { + this.answerName = answerName; + } + + public String getAnswerInfo() { + return answerInfo; + } + + public void setAnswerInfo(String answerInfo) { + this.answerInfo = answerInfo; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public Date getUpdated() { + return updated; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + public Long getRetryCount() { + return retryCount; + } + + public void setRetryCount(Long retryCount) { + this.retryCount = retryCount; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDao.java b/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDao.java new file mode 100644 index 000000000000..59c4605d5487 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDao.java @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command.dao; + +import com.cloud.agent.api.Command; +import com.cloud.utils.db.GenericDao; + +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.command.ReconcileCommandVO; + +import java.util.List; + +public interface ReconcileCommandDao extends GenericDao { + + List listByManagementServerId(long managementServerId); + + List listByHostId(long hostId); + + List listByState(Command.State... states); + + void removeCommand(long commandId, String commandName, Command.State state); + + ReconcileCommandVO findCommand(long reqSequence, String commandName); + + void updateCommandsToInterruptedByManagementServerId(long managementServerId); + + void updateCommandsToInterruptedByHostId(long hostId); + + List listByResourceIdAndTypeAndStates(long resourceId, ApiCommandResourceType resourceType, Command.State... states); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDaoImpl.java new file mode 100644 index 000000000000..593f464f9ad4 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/command/dao/ReconcileCommandDaoImpl.java @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.command.dao; + +import java.util.Date; +import java.util.List; + +import org.apache.cloudstack.api.ApiCommandResourceType; +import org.apache.cloudstack.command.ReconcileCommandVO; +import org.springframework.stereotype.Component; + +import com.cloud.agent.api.Command; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.QueryBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +@DB +public class ReconcileCommandDaoImpl extends GenericDaoBase implements ReconcileCommandDao { + + final SearchBuilder updateCommandSearch; + final SearchBuilder resourceSearch; + + public ReconcileCommandDaoImpl() { + + updateCommandSearch = createSearchBuilder(); + updateCommandSearch.and("managementServerId", updateCommandSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); + updateCommandSearch.and("stateByManagement", updateCommandSearch.entity().getStateByManagement(), SearchCriteria.Op.IN); + updateCommandSearch.and("hostId", updateCommandSearch.entity().getHostId(), SearchCriteria.Op.EQ); + updateCommandSearch.and("stateByAgent", updateCommandSearch.entity().getStateByAgent(), SearchCriteria.Op.IN); + updateCommandSearch.and("reqSequence", updateCommandSearch.entity().getRequestSequence(), SearchCriteria.Op.EQ); + updateCommandSearch.and("commandName", updateCommandSearch.entity().getCommandName(), SearchCriteria.Op.EQ); + updateCommandSearch.done(); + + resourceSearch = createSearchBuilder(); + resourceSearch.and("resourceId", resourceSearch.entity().getResourceId(), SearchCriteria.Op.EQ); + resourceSearch.and("resourceType", resourceSearch.entity().getResourceType(), SearchCriteria.Op.EQ); + resourceSearch.and("stateByManagement", resourceSearch.entity().getStateByManagement(), SearchCriteria.Op.IN); + resourceSearch.done(); + } + + @Override + public List listByManagementServerId(long managementServerId) { + QueryBuilder sc = QueryBuilder.create(ReconcileCommandVO.class); + sc.and(sc.entity().getManagementServerId(), SearchCriteria.Op.EQ, managementServerId); + return sc.list(); + } + + @Override + public List listByHostId(long hostId) { + QueryBuilder sc = QueryBuilder.create(ReconcileCommandVO.class); + sc.and(sc.entity().getHostId(), SearchCriteria.Op.EQ, hostId); + return sc.list(); + } + + @Override + public List listByState(Command.State... states) { + QueryBuilder sc = QueryBuilder.create(ReconcileCommandVO.class); + sc.and(sc.entity().getStateByManagement(), SearchCriteria.Op.IN, (Object[]) states); + return sc.list(); + } + + @Override + public void removeCommand(long reqSequence, String commandName, Command.State state) { + SearchCriteria sc = updateCommandSearch.create(); + sc.setParameters("reqSequence", reqSequence); + sc.setParameters("commandName", commandName); + + ReconcileCommandVO vo = createForUpdate(); + if (state != null) { + vo.setStateByManagement(state); + } + vo.setRemoved(new Date()); + update(vo, sc); + } + + @Override + public ReconcileCommandVO findCommand(long reqSequence, String commandName) { + SearchCriteria sc = updateCommandSearch.create(); + sc.setParameters("reqSequence", reqSequence); + sc.setParameters("commandName", commandName); + return findOneBy(sc); + } + + @Override + public void updateCommandsToInterruptedByManagementServerId(long managementServerId) { + SearchCriteria sc = updateCommandSearch.create(); + sc.setParameters("managementServerId", managementServerId); + sc.setParameters("stateByManagement", Command.State.CREATED, Command.State.RECONCILING); + + ReconcileCommandVO vo = createForUpdate(); + vo.setStateByManagement(Command.State.INTERRUPTED); + + update(vo, sc); + } + + @Override + public void updateCommandsToInterruptedByHostId(long hostId) { + SearchCriteria sc = updateCommandSearch.create(); + sc.setParameters("hostId", hostId); + sc.setParameters("stateByAgent", Command.State.STARTED, Command.State.PROCESSING, Command.State.PROCESSING_IN_BACKEND); + + ReconcileCommandVO vo = createForUpdate(); + vo.setStateByAgent(Command.State.INTERRUPTED); + + update(vo, sc); + } + + @Override + public List listByResourceIdAndTypeAndStates(long resourceId, ApiCommandResourceType resourceType, Command.State... states) { + QueryBuilder sc = QueryBuilder.create(ReconcileCommandVO.class); + sc.and(sc.entity().getResourceId(), SearchCriteria.Op.EQ, resourceId); + sc.and(sc.entity().getResourceType(), SearchCriteria.Op.EQ, resourceType); + sc.and(sc.entity().getStateByManagement(), SearchCriteria.Op.IN, (Object[]) states); + return sc.list(); + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetailsVO.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetailsVO.java new file mode 100644 index 000000000000..046a19c59fa0 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeDetailsVO.java @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "gui_themes_details") +public class GuiThemeDetailsVO implements GuiThemeDetails { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Long id; + + @Column(name = "gui_theme_id", nullable = false) + private Long guiThemeId; + + @Column(name = "type", nullable = false, length = 100) + private String type; + + @Column(name = "value", nullable = false, length = 65535) + private String value; + + public GuiThemeDetailsVO() { + } + + public GuiThemeDetailsVO(Long guiThemeId, String type, String value) { + this.guiThemeId = guiThemeId; + this.type = type; + this.value = value; + } + + @Override + public long getId() { + return id; + } + + @Override + public void setId(Long id) { + this.id = id; + } + + @Override + public Long getGuiThemeId() { + return guiThemeId; + } + + @Override + public void setGuiThemeId(Long guiThemeId) { + this.guiThemeId = guiThemeId; + } + + @Override + public String getType() { + return type; + } + + @Override + public void setType(String type) { + this.type = type; + } + + @Override + public String getValue() { + return value; + } + + @Override + public void setValue(String value) { + this.value = value; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoinVO.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoinVO.java new file mode 100644 index 000000000000..2df23b3d1064 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeJoinVO.java @@ -0,0 +1,141 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import com.cloud.utils.db.GenericDao; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; + +@Entity +@Table(name = "gui_themes_view") +public class GuiThemeJoinVO implements GuiThemeJoin { + @Id + @Column(name = "id", nullable = false) + private Long id; + + @Column(name = "uuid", nullable = false) + private String uuid; + + @Column(name = "name", nullable = false, length = 2048) + private String name; + + @Column(name = "description", length = 4096) + private String description; + + @Column(name = "css", nullable = false, length = 65535) + private String css; + + @Column(name = "json_configuration", nullable = false, length = 65535) + private String jsonConfiguration; + + @Column(name = "common_names", length = 65535) + private String commonNames; + + @Column(name = "domains", length = 65535) + private String domains; + + @Column(name = "accounts", length = 65535) + private String accounts; + + @Column(name = "recursive_domains") + private boolean recursiveDomains; + + @Column(name = "is_public") + private boolean isPublic; + + @Column(name = GenericDao.CREATED_COLUMN, nullable = false) + @Temporal(value = TemporalType.TIMESTAMP) + private Date created; + + @Column(name = GenericDao.REMOVED_COLUMN) + @Temporal(value = TemporalType.TIMESTAMP) + private Date removed = null; + + public GuiThemeJoinVO() { + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getCss() { + return css; + } + + @Override + public String getJsonConfiguration() { + return jsonConfiguration; + } + + @Override + public String getCommonNames() { + return commonNames; + } + + @Override + public String getDomains() { + return domains; + } + + @Override + public String getAccounts() { + return accounts; + } + + @Override + public boolean isRecursiveDomains() { + return recursiveDomains; + } + + @Override + public boolean getIsPublic() { + return isPublic; + } + + @Override + public Date getCreated() { + return created; + } + + @Override + public Date getRemoved() { + return removed; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeVO.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeVO.java new file mode 100644 index 000000000000..887e3886f6c6 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/GuiThemeVO.java @@ -0,0 +1,189 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import java.util.Date; +import java.util.UUID; + +@Entity +@Table(name = "gui_themes") +public class GuiThemeVO implements GuiTheme { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Long id; + + @Column(name = "uuid", nullable = false) + private String uuid = UUID.randomUUID().toString(); + + @Column(name = "name", nullable = false, length = 2048) + private String name; + + @Column(name = "description", length = 4096) + private String description; + + @Column(name = "css", length = 65535) + private String css; + + @Column(name = "json_configuration", length = 65535) + private String jsonConfiguration; + + @Column(name = "is_public") + private boolean isPublic; + + @Column(name = "recursive_domains") + private boolean recursiveDomains = false; + + @Column(name = GenericDao.CREATED_COLUMN, nullable = false) + @Temporal(value = TemporalType.TIMESTAMP) + private Date created; + + @Column(name = GenericDao.REMOVED_COLUMN) + @Temporal(value = TemporalType.TIMESTAMP) + private Date removed = null; + + public GuiThemeVO() { + + } + + public GuiThemeVO(String name, String description, String css, String jsonConfiguration, boolean recursiveDomains, boolean isPublic, Date created, Date removed) { + this.name = name; + this.description = description; + this.css = css; + this.jsonConfiguration = jsonConfiguration; + this.recursiveDomains = recursiveDomains; + this.isPublic = isPublic; + this.created = created; + this.removed = removed; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getCss() { + return css; + } + + @Override + public String getJsonConfiguration() { + return jsonConfiguration; + } + + @Override + public Date getCreated() { + return created; + } + + @Override + public Date getRemoved() { + return removed; + } + + @Override + public boolean getIsPublic() { + return isPublic; + } + + @Override + public void setId(Long id) { + this.id = id; + } + + @Override + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public void setName(String name) { + this.name = name; + } + + @Override + public void setDescription(String description) { + this.description = description; + } + + @Override + public void setCss(String css) { + this.css = css; + } + + @Override + public void setJsonConfiguration(String jsonConfiguration) { + this.jsonConfiguration = jsonConfiguration; + } + + @Override + public void setCreated(Date created) { + this.created = created; + } + + @Override + public void setRemoved(Date removed) { + this.removed = removed; + } + + @Override + public void setIsPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + @Override + public boolean isRecursiveDomains() { + return recursiveDomains; + } + + @Override + public void setRecursiveDomains(boolean recursiveDomains) { + this.recursiveDomains = recursiveDomains; + } + + @Override + public String toString() { + return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "uuid", "name", "description", "isPublic", "recursiveDomains"); + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDao.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDao.java new file mode 100644 index 000000000000..c00aedcc7866 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDao.java @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.gui.theme.GuiThemeVO; + +public interface GuiThemeDao extends GenericDao { + +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDaoImpl.java new file mode 100644 index 000000000000..bc58c5f80f30 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDaoImpl.java @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.utils.db.GenericDaoBase; +import org.apache.cloudstack.gui.theme.GuiThemeVO; +import org.springframework.stereotype.Component; + +@Component +public class GuiThemeDaoImpl extends GenericDaoBase implements GuiThemeDao { +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDao.java new file mode 100644 index 000000000000..af243b1ffa46 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDao.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.gui.theme.GuiThemeDetailsVO; + +import java.util.List; + +public interface GuiThemeDetailsDao extends GenericDao { + List listGuiThemeIdsByCommonName(String commonName); + + List listGuiThemeIdsByDomainUuids(String domainUuid); + + void expungeByGuiThemeId(long guiThemeId); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDaoImpl.java new file mode 100644 index 000000000000..b0969833eb01 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeDetailsDaoImpl.java @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.domain.DomainVO; +import com.cloud.domain.dao.DomainDao; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.apache.cloudstack.gui.theme.GuiThemeDetailsVO; +import org.apache.cloudstack.gui.theme.GuiThemeVO; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; + +@Component +public class GuiThemeDetailsDaoImpl extends GenericDaoBase implements GuiThemeDetailsDao { + + @Inject + DomainDao domainDao; + + @Inject + GuiThemeDao guiThemeDao; + + public List listGuiThemeIdsByCommonName(String commonName) { + GenericSearchBuilder detailsDaoSearchBuilder = createSearchBuilder(Long.class); + detailsDaoSearchBuilder.selectFields(detailsDaoSearchBuilder.entity().getGuiThemeId()); + detailsDaoSearchBuilder.and("commonNameType", detailsDaoSearchBuilder.entity().getType(), SearchCriteria.Op.EQ); + detailsDaoSearchBuilder.and().op("firstReplace", detailsDaoSearchBuilder.entity().getValue(), SearchCriteria.Op.LIKE_REPLACE); + detailsDaoSearchBuilder.or("secondReplace", detailsDaoSearchBuilder.entity().getValue(), SearchCriteria.Op.LIKE_REPLACE).cp(); + detailsDaoSearchBuilder.done(); + + SearchCriteria searchCriteria = detailsDaoSearchBuilder.create(); + searchCriteria.setParameters("commonNameType", "commonName"); + searchCriteria.setParameters("firstReplace", commonName, "*", "%"); + searchCriteria.setParameters("secondReplace", commonName, "*.", "%"); + + return customSearch(searchCriteria, null); + } + + public List listGuiThemeIdsByDomainUuids(String domainUuid) { + List guiThemeIds = new ArrayList<>(); + String requestedDomainPath = domainDao.findByUuid(domainUuid).getPath(); + + SearchBuilder domainSearchBuilderPathLike = domainDao.createSearchBuilder(); + domainSearchBuilderPathLike.and("pathLike", domainSearchBuilderPathLike.entity().getPath(), SearchCriteria.Op.LIKE_CONCAT); + + SearchBuilder domainSearchBuilderPathEq = domainDao.createSearchBuilder(); + domainSearchBuilderPathEq.and("pathEq", domainSearchBuilderPathEq.entity().getPath(), SearchCriteria.Op.EQ); + + GenericSearchBuilder detailsSearchBuilderPathLike = createDetailsSearchBuilder(domainSearchBuilderPathLike); + SearchCriteria searchCriteriaDomainPathLike = setParametersDomainPathLike(detailsSearchBuilderPathLike, requestedDomainPath); + + GenericSearchBuilder detailsSearchBuilderPathEq = createDetailsSearchBuilder(domainSearchBuilderPathEq); + SearchCriteria searchCriteriaDomainPathEq = setParametersDomainPathEq(detailsSearchBuilderPathEq, requestedDomainPath); + + guiThemeIds.addAll(customSearch(searchCriteriaDomainPathLike, null)); + guiThemeIds.addAll(customSearch(searchCriteriaDomainPathEq, null)); + return guiThemeIds; + } + + private SearchCriteria setParametersDomainPathLike(GenericSearchBuilder detailsSearchBuilderPathLike, String requestedDomainPath) { + SearchCriteria searchCriteria = detailsSearchBuilderPathLike.create(); + searchCriteria.setParameters("domainUuidType", "domain"); + searchCriteria.setJoinParameters("domainJoin", "pathLike", requestedDomainPath, "%"); + searchCriteria.setJoinParameters("guiThemesJoin", "recursiveDomains", true); + + return searchCriteria; + } + + private SearchCriteria setParametersDomainPathEq(GenericSearchBuilder detailsSearchBuilderPathEq, String requestedDomainPath) { + SearchCriteria searchCriteria = detailsSearchBuilderPathEq.create(); + searchCriteria.setParameters("domainUuidType", "domain"); + searchCriteria.setJoinParameters("domainJoin", "pathEq", requestedDomainPath); + searchCriteria.setJoinParameters("guiThemesJoin", "recursiveDomains", false); + + return searchCriteria; + } + + private GenericSearchBuilder createDetailsSearchBuilder(SearchBuilder domainSearchBuilder) { + SearchBuilder guiThemeDaoSearchBuilder = guiThemeDao.createSearchBuilder(); + guiThemeDaoSearchBuilder.and("recursiveDomains", guiThemeDaoSearchBuilder.entity().isRecursiveDomains(), SearchCriteria.Op.EQ); + + GenericSearchBuilder guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder = createSearchBuilder(Long.class); + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.selectFields(guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.entity().getGuiThemeId()); + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.and("domainUuidType", guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.entity().getType(), SearchCriteria.Op.EQ); + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.join("domainJoin", domainSearchBuilder, domainSearchBuilder.entity().getUuid(), + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.entity().getValue(), JoinBuilder.JoinType.INNER); + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.join("guiThemesJoin", guiThemeDaoSearchBuilder, guiThemeDaoSearchBuilder.entity().getId(), + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.entity().getGuiThemeId(), JoinBuilder.JoinType.INNER); + + domainSearchBuilder.done(); + guiThemeDaoSearchBuilder.done(); + guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder.done(); + + return guiThemesDetailsJoinDomainJoinGuiThemesSearchBuilder; + } + + public void expungeByGuiThemeId(long guiThemeId) { + SearchBuilder searchBuilder = createSearchBuilder(); + searchBuilder.and("guiThemeId", searchBuilder.entity().getGuiThemeId(), SearchCriteria.Op.EQ); + searchBuilder.done(); + + SearchCriteria searchCriteria = searchBuilder.create(); + searchCriteria.setParameters("guiThemeId", guiThemeId); + expunge(searchCriteria); + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDao.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDao.java new file mode 100644 index 000000000000..740199cfca73 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDao.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; +import org.apache.cloudstack.gui.theme.GuiThemeJoinVO; + +import java.util.List; + +public interface GuiThemeJoinDao extends GenericDao { + GuiThemeJoinVO findDefaultTheme(); + + Pair, Integer> listGuiThemesWithNoAuthentication(String commonName); + + Pair, Integer> listGuiThemes(Long id, String name, String commonName, String domainUuid, String accountUuid, boolean listAll, boolean showRemoved, Boolean showPublic); +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDaoImpl.java new file mode 100644 index 000000000000..ce6f70558128 --- /dev/null +++ b/engine/schema/src/main/java/org/apache/cloudstack/gui/theme/dao/GuiThemeJoinDaoImpl.java @@ -0,0 +1,139 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 org.apache.cloudstack.gui.theme.dao; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.gui.theme.GuiThemeJoinVO; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; + +@Component +public class GuiThemeJoinDaoImpl extends GenericDaoBase implements GuiThemeJoinDao { + @Inject + GuiThemeDetailsDao guiThemeDetailsDao; + + public static final Long INVALID_ID = -1L; + + public GuiThemeJoinVO findDefaultTheme() { + SearchBuilder searchBuilder = createSearchBuilder(); + searchBuilder.and("commonNames", searchBuilder.entity().getCommonNames(), SearchCriteria.Op.NULL); + searchBuilder.and("domainUuids", searchBuilder.entity().getDomains(), SearchCriteria.Op.NULL); + searchBuilder.and("accountUuids", searchBuilder.entity().getAccounts(), SearchCriteria.Op.NULL); + searchBuilder.done(); + + SearchCriteria searchCriteria = searchBuilder.create(); + + return findOneBy(searchCriteria); + } + + public Pair, Integer> listGuiThemesWithNoAuthentication(String commonName) { + SearchCriteria searchCriteria = createGuiThemeSearchCriteria(null, null, commonName, null, null, null, false); + return searchOrderByCreatedDate(searchCriteria, false); + } + + public Pair, Integer> listGuiThemes(Long id, String name, String commonName, String domainUuid, String accountUuid, boolean listAll, + boolean showRemoved, Boolean showPublic) { + SearchCriteria searchCriteria = createGuiThemeSearchCriteria(id, name, commonName, domainUuid, accountUuid, showPublic, listAll); + + if (listAll) { + showRemoved = false; + } + + return searchOrderByCreatedDate(searchCriteria, showRemoved); + } + + private Pair, Integer> searchOrderByCreatedDate(SearchCriteria searchCriteria, boolean showRemoved) { + Filter filter = new Filter(GuiThemeJoinVO.class, "created", false); + return searchAndCount(searchCriteria, filter, showRemoved); + } + + private SearchCriteria createGuiThemeSearchCriteria(Long id, String name, String commonName, String domainUuid, String accountUuid, Boolean showPublic, boolean listAll) { + SearchCriteria searchCriteria = createGuiThemeJoinSearchBuilder(listAll, showPublic).create(); + List idList = new ArrayList<>(); + + if (id != null) { + idList.add(id); + } + + searchCriteria.setParametersIfNotNull("name", name); + searchCriteria.setParametersIfNotNull("isPublic", showPublic); + + if (StringUtils.isNotBlank(accountUuid)) { + searchCriteria.setParameters("accountUuid", "%" + accountUuid + "%"); + } + + if (StringUtils.isNotBlank(commonName)) { + setGuiThemeIdsFilteredByType(idList, ApiConstants.COMMON_NAME, commonName); + } + + if (StringUtils.isNotBlank(domainUuid)) { + setGuiThemeIdsFilteredByType(idList, ApiConstants.DOMAIN, domainUuid); + } + + searchCriteria.setParametersIfNotNull("idIn", idList.toArray()); + + return searchCriteria; + } + + /** + * Sets the `id IN ( )` clause of the query. If the informed value of common name or domain ID does not retrieve any GUI theme ID; then, an invalid ID (-1) is passed to the + * list, as not a single entity has this ID. This is necessary as to set the parameter even if it did not find any GUI theme ID; otherwise, the query would not filter the + * common name or domain ID passed. + */ + public void setGuiThemeIdsFilteredByType(List idList, String type, String value) { + List guiThemeIdsFilteredByType = new ArrayList<>(); + + switch (type) { + case ApiConstants.COMMON_NAME: + guiThemeIdsFilteredByType = guiThemeDetailsDao.listGuiThemeIdsByCommonName(value); + break; + case ApiConstants.DOMAIN: + guiThemeIdsFilteredByType = guiThemeDetailsDao.listGuiThemeIdsByDomainUuids(value); + break; + } + + if (CollectionUtils.isNotEmpty(guiThemeIdsFilteredByType)) { + idList.addAll(guiThemeIdsFilteredByType); + return; + } + logger.trace(String.format("No GUI theme with the specified [%s] with UUID [%s] was found, adding an invalid ID for filtering.", type, value)); + idList.add(INVALID_ID); + } + + private SearchBuilder createGuiThemeJoinSearchBuilder(boolean listAll, Boolean showPublic) { + SearchBuilder guiThemeJoinSearchBuilder = createSearchBuilder(); + guiThemeJoinSearchBuilder.and("idIn", guiThemeJoinSearchBuilder.entity().getId(), SearchCriteria.Op.IN); + guiThemeJoinSearchBuilder.and("name", guiThemeJoinSearchBuilder.entity().getName(), SearchCriteria.Op.EQ); + guiThemeJoinSearchBuilder.and("accountUuid", guiThemeJoinSearchBuilder.entity().getAccounts(), SearchCriteria.Op.LIKE); + + if (!listAll && showPublic != null) { + guiThemeJoinSearchBuilder.and("isPublic", guiThemeJoinSearchBuilder.entity().getIsPublic(), SearchCriteria.Op.EQ); + } + + return guiThemeJoinSearchBuilder; + } +} diff --git a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDao.java b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDao.java index 6b6fe200c10d..1102de16e4ea 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDao.java @@ -21,6 +21,7 @@ import org.apache.cloudstack.api.ResourceDetail; +import com.cloud.utils.Pair; import com.cloud.utils.db.GenericDao; public interface ResourceDetailsDao extends GenericDao { @@ -32,6 +33,13 @@ public interface ResourceDetailsDao extends GenericDao */ R findDetail(long resourceId, String name); + /** + * Find details by key + * @param key + * @return + */ + List findDetails(String key); + /** * Find details by resourceId and key * @param resourceId @@ -94,6 +102,8 @@ public interface ResourceDetailsDao extends GenericDao Map listDetailsVisibility(long resourceId); + Pair, Map> listDetailsKeyPairsWithVisibility(long resourceId); + void saveDetails(List details); void addDetail(long resourceId, String key, String value, boolean display); diff --git a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java index 29d3f88fd902..eafaed182abd 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/ResourceDetailsDaoBase.java @@ -23,6 +23,7 @@ import org.apache.commons.collections.CollectionUtils; +import com.cloud.utils.Pair; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.GenericSearchBuilder; @@ -64,6 +65,12 @@ public R findDetail(long resourceId, String name) { return findOneBy(sc); } + public List findDetails(String key) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("name", key); + return listBy(sc); + } + public List findDetails(long resourceId, String key) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); @@ -127,6 +134,19 @@ public Map listDetailsVisibility(long resourceId) { return details; } + @Override + public Pair, Map> listDetailsKeyPairsWithVisibility(long resourceId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("resourceId", resourceId); + List results = search(sc, null); + Map> partitioned = results.stream() + .collect(Collectors.partitioningBy( + R::isDisplay, + Collectors.toMap(R::getName, R::getValue) + )); + return new Pair<>(partitioned.get(true), partitioned.get(false)); + } + public List listDetails(long resourceId) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); diff --git a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/UserDetailVO.java b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/UserDetailVO.java index d0cfcc3d4396..93b49bc20a10 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/UserDetailVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/UserDetailVO.java @@ -48,6 +48,8 @@ public class UserDetailVO implements ResourceDetail { public static final String Setup2FADetail = "2FASetupStatus"; public static final String PasswordResetToken = "PasswordResetToken"; public static final String PasswordResetTokenExpiryDate = "PasswordResetTokenExpiryDate"; + public static final String PasswordChangeRequired = "PasswordChangeRequired"; + public static final String OauthLogin = "OauthLogin"; public UserDetailVO() { } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDao.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDao.java index 7aab5bbf7b31..eda4bcfdaa1f 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDao.java @@ -44,7 +44,7 @@ public interface ImageStoreDao extends GenericDao { List listStoresByZoneId(long zoneId); - List listAllStoresInZone(Long zoneId, String provider, DataStoreRole role); + List listAllStoresInZoneExceptId(Long zoneId, String provider, DataStoreRole role, long storeId); List findByProtocol(String protocol); diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDaoImpl.java index 84b88c215ca6..5f32a3502328 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDaoImpl.java @@ -41,7 +41,7 @@ public class ImageStoreDaoImpl extends GenericDaoBase implem private SearchBuilder nameSearch; private SearchBuilder providerSearch; private SearchBuilder regionSearch; - private SearchBuilder storeSearch; + private SearchBuilder storesExceptIdSearch; private SearchBuilder protocolSearch; private SearchBuilder zoneProtocolSearch; @@ -88,11 +88,12 @@ public boolean configure(String name, Map params) throws Configu regionSearch.and("role", regionSearch.entity().getRole(), SearchCriteria.Op.EQ); regionSearch.done(); - storeSearch = createSearchBuilder(); - storeSearch.and("providerName", storeSearch.entity().getProviderName(), SearchCriteria.Op.EQ); - storeSearch.and("role", storeSearch.entity().getRole(), SearchCriteria.Op.EQ); - storeSearch.and("dataCenterId", storeSearch.entity().getDcId(), SearchCriteria.Op.EQ); - storeSearch.done(); + storesExceptIdSearch = createSearchBuilder(); + storesExceptIdSearch.and("providerName", storesExceptIdSearch.entity().getProviderName(), SearchCriteria.Op.EQ); + storesExceptIdSearch.and("role", storesExceptIdSearch.entity().getRole(), SearchCriteria.Op.EQ); + storesExceptIdSearch.and("dataCenterId", storesExceptIdSearch.entity().getDcId(), SearchCriteria.Op.EQ); + storesExceptIdSearch.and("id", storesExceptIdSearch.entity().getId(), SearchCriteria.Op.NEQ); + storesExceptIdSearch.done(); return true; } @@ -113,11 +114,12 @@ public List findByProvider(String provider) { } @Override - public List listAllStoresInZone(Long zoneId, String provider, DataStoreRole role) { - SearchCriteria sc = storeSearch.create(); + public List listAllStoresInZoneExceptId(Long zoneId, String provider, DataStoreRole role, long id) { + SearchCriteria sc = storesExceptIdSearch.create(); sc.setParameters("providerName", provider); sc.setParameters("role", role); sc.setParameters("dataCenterId", zoneId); + sc.setParameters("id", id); return listBy(sc); } @@ -200,7 +202,7 @@ public ImageStoreVO findOneByZoneAndProtocol(long dataCenterId, String protocol) sc.setParameters("dataCenterId", dataCenterId); sc.setParameters("protocol", protocol); sc.setParameters("role", DataStoreRole.Image); - Filter filter = new Filter(1); + Filter filter = new Filter(1, true); List results = listBy(sc, filter); return results.size() == 0 ? null : results.get(0); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDetailsDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDetailsDaoImpl.java index ec40dc0dd683..d7e88bd31c3f 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDetailsDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ImageStoreDetailsDaoImpl.java @@ -77,7 +77,7 @@ public Map getDetails(long storeId) { for (ImageStoreDetailVO detail : details) { String name = detail.getName(); String value = detail.getValue(); - if (name.equals(ApiConstants.KEY) || name.equals(ApiConstants.S3_SECRET_KEY)) { + if (name.equals(ApiConstants.KEY) || name.equals(ApiConstants.SECRET_KEY)) { value = DBEncryptionUtil.decrypt(value); } detailsMap.put(name, value); diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDao.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDao.java index 94f6b5ec3724..695742823ebe 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDao.java @@ -39,4 +39,6 @@ public interface ObjectStoreDao extends GenericDao { ObjectStoreResponse setObjectStoreResponse(ObjectStoreResponse storeData, ObjectStoreVO store); Integer countAllObjectStores(); + + Boolean updateAllocatedSize(ObjectStoreVO objectStoreVO, long delta); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDaoImpl.java index 51abde013b69..891ac0996aca 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreDaoImpl.java @@ -21,6 +21,10 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.TransactionCallback; +import com.cloud.utils.db.TransactionStatus; + import org.apache.cloudstack.api.response.ObjectStoreResponse; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.springframework.stereotype.Component; @@ -142,6 +146,19 @@ public ObjectStoreResponse newObjectStoreResponse(ObjectStoreVO store) { ObjectStoreResponse osResponse = new ObjectStoreResponse(); osResponse.setId(store.getUuid()); osResponse.setName(store.getName()); + if (store.getTotalSize() != null && store.getTotalSize() != 0L) { + osResponse.setStorageTotal(store.getTotalSize()); + } + if (store.getUsedSize() == null) { + osResponse.setStorageUsed(0L); + } else { + osResponse.setStorageUsed(store.getUsedSize()); + } + if (store.getAllocatedSize() == null) { + osResponse.setStorageAllocated(0L); + } else { + osResponse.setStorageAllocated(store.getAllocatedSize()); + } osResponse.setProviderName(store.getProviderName()); String url = store.getUrl(); osResponse.setUrl(url); @@ -159,4 +176,19 @@ public Integer countAllObjectStores() { SearchCriteria sc = createSearchCriteria(); return getCount(sc); } + + @Override + public Boolean updateAllocatedSize(ObjectStoreVO objectStoreVO, long delta) { + return Transaction.execute(new TransactionCallback() { + @Override + public Boolean doInTransaction(final TransactionStatus status) { + if (objectStoreVO.getAllocatedSize() != null) { + objectStoreVO.setAllocatedSize(objectStoreVO.getAllocatedSize() + delta); + } else { + objectStoreVO.setAllocatedSize(delta); + } + return update(objectStoreVO.getId(), objectStoreVO); + } + }); + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreVO.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreVO.java index 18cc06a65733..23b650acc79c 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/ObjectStoreVO.java @@ -60,8 +60,11 @@ public class ObjectStoreVO implements ObjectStore { @Column(name = "total_size") private Long totalSize; - @Column(name = "used_bytes") - private Long usedBytes; + @Column(name = "used_size") + private Long usedSize; + + @Column(name = "allocated_size") + private Long allocatedSize; @Transient Map details; @@ -130,18 +133,26 @@ public void setTotalSize(Long totalSize) { this.totalSize = totalSize; } - public Long getUsedBytes() { - return usedBytes; + public Long getUsedSize() { + return usedSize; } - public void setUsedBytes(Long usedBytes) { - this.usedBytes = usedBytes; + public void setUsedSize(Long usedSize) { + this.usedSize = usedSize; } public void setDetails(Map details) { this.details = details; } + public Long getAllocatedSize() { + return allocatedSize; + } + + public void setAllocatedSize(Long allocatedSize) { + this.allocatedSize = allocatedSize; + } + @Override public String toString() { return String.format("ObjectStore %s", diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java index f0c235e842c1..57b5f6461c6a 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java @@ -58,7 +58,9 @@ public interface PrimaryDataStoreDao extends GenericDao { */ void updateCapacityIops(long id, long capacityIops); - StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule); + StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule, List storageAccessGroups); + + StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule, boolean displayDetails, List storageAccessGroups); /** * Find pool by name. @@ -82,7 +84,9 @@ public interface PrimaryDataStoreDao extends GenericDao { */ List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details, ScopeType scope); - List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule, long ruleExecuteTimeout); + List findPoolsByTags(long dcId, long podId, Long clusterId, ScopeType scope, String[] tags, boolean validateTagRule, long ruleExecuteTimeout); + + List findPoolsByAccessGroupsForHostConnection(Long dcId, Long podId, Long clusterId, ScopeType scope, String[] storageAccessGroups); List findDisabledPoolsByScope(long dcId, Long podId, Long clusterId, ScopeType scope); @@ -103,6 +107,8 @@ public interface PrimaryDataStoreDao extends GenericDao { void updateDetails(long poolId, Map details); + void removeDetails(long poolId); + Map getDetails(long poolId); List searchForStoragePoolTags(long poolId); @@ -123,6 +129,10 @@ public interface PrimaryDataStoreDao extends GenericDao { List findZoneWideStoragePoolsByTags(long dcId, String[] tags, boolean validateTagRule); + List findZoneWideStoragePoolsByAccessGroupsForHostConnection(long dcId, String[] storageAccessGroups); + + List findZoneWideStoragePoolsByAccessGroupsAndHypervisorTypeForHostConnection(long dcId, String[] storageAccessGroups, HypervisorType type); + List findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType); List findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType, String keyword); @@ -139,6 +149,8 @@ public interface PrimaryDataStoreDao extends GenericDao { void deletePoolTags(long poolId); + void deleteStoragePoolAccessGroups(long poolId); + List listChildStoragePoolsInDatastoreCluster(long poolId); Integer countAll(); @@ -150,8 +162,14 @@ public interface PrimaryDataStoreDao extends GenericDao { List listStoragePoolsWithActiveVolumesByOfferingId(long offeringid); Pair, Integer> searchForIdsAndCount(Long storagePoolId, String storagePoolName, Long zoneId, - String path, Long podId, Long clusterId, String address, ScopeType scopeType, StoragePoolStatus status, - String keyword, Filter searchFilter); + String path, Long podId, Long clusterId, Long hostId, String address, ScopeType scopeType, StoragePoolStatus status, + String keyword, String storageAccessGroup, Filter searchFilter); List listByIds(List ids); + + List findStoragePoolsByEmptyStorageAccessGroups(Long dcId, Long podId, Long clusterId, ScopeType scope, HypervisorType hypervisorType); + + List findPoolsByStorageTypeAndZone(Storage.StoragePoolType storageType, Long zoneId); + + List listByDataCenterIds(List dataCenterIds); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java index cb7313954dc7..b5d6415e3a1a 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java @@ -28,6 +28,8 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.storage.StoragePoolAndAccessGroupMapVO; +import com.cloud.storage.dao.StoragePoolAndAccessGroupMapDao; import org.apache.commons.collections.CollectionUtils; import com.cloud.host.Status; @@ -63,6 +65,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase private final GenericSearchBuilder StatusCountSearch; private final SearchBuilder ClustersSearch; private final SearchBuilder IdsSearch; + private final SearchBuilder DcsSearch; @Inject private StoragePoolDetailsDao _detailsDao; @@ -70,15 +73,25 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase private StoragePoolHostDao _hostDao; @Inject private StoragePoolTagsDao _tagsDao; + @Inject + StoragePoolAndAccessGroupMapDao _storagePoolAccessGroupMapDao; protected final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and storage_pool.scope = ? and ("; protected final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?"; + protected final String DetailsForHostConnectionSqlSuffix = ") GROUP BY storage_pool_details.pool_id"; private final String ZoneWideTagsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_tags ON storage_pool.id = storage_pool_tags.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' AND storage_pool_tags.is_tag_a_rule = 0 and storage_pool.data_center_id = ? and storage_pool.scope = ? and ("; private final String ZoneWideTagsSqlSuffix = ") GROUP BY storage_pool_tags.pool_id HAVING COUNT(storage_pool_tags.tag) >= ?"; + private final String ZoneWideStorageAccessGroupsForHostConnectionSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_and_access_group_map ON storage_pool.id = storage_pool_and_access_group_map.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.data_center_id = ? and storage_pool.scope = ? and ("; + private final String ZoneWideStorageAccessGroupsForHostConnectionSqlSuffix = ") GROUP BY storage_pool_and_access_group_map.pool_id"; + private final String ZoneWideStorageAccessGroupsWithHypervisorTypeSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_and_access_group_map ON storage_pool.id = storage_pool_and_access_group_map.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.hypervisor = ? and storage_pool.data_center_id = ? and storage_pool.scope = ? and ("; + private final String ZoneWideStorageAccessGroupsWithHypervisorTypeSqlSuffix = ") GROUP BY storage_pool_and_access_group_map.pool_id"; // Storage tags are now separate from storage_pool_details, leaving only details on that table protected final String TagsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_tags ON storage_pool.id = storage_pool_tags.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' AND storage_pool_tags.is_tag_a_rule = 0 and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and storage_pool.scope = ? and ("; protected final String TagsSqlSuffix = ") GROUP BY storage_pool_tags.pool_id HAVING COUNT(storage_pool_tags.tag) >= ?"; + protected final String SAGsForHostConnectionSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_and_access_group_map ON storage_pool.id = storage_pool_and_access_group_map.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and storage_pool.scope = ? and ("; + + protected final String SAGsForHostConnectionSqlSuffix = ") GROUP BY storage_pool_and_access_group_map.pool_id"; private static final String GET_STORAGE_POOLS_OF_VOLUMES_WITHOUT_OR_NOT_HAVING_TAGS = "SELECT s.* " + "FROM volumes vol " + @@ -155,6 +168,9 @@ public PrimaryDataStoreDaoImpl() { IdsSearch.and("ids", IdsSearch.entity().getId(), SearchCriteria.Op.IN); IdsSearch.done(); + DcsSearch = createSearchBuilder(); + DcsSearch.and("dataCenterId", DcsSearch.entity().getDataCenterId(), SearchCriteria.Op.IN); + DcsSearch.done(); } @Override @@ -295,21 +311,32 @@ public StoragePoolVO listById(Integer id) { return findOneIncludingRemovedBy(sc); } + @Override + public StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule, List storageAccessGroups) { + return persist(pool, details, tags, isTagARule, true, storageAccessGroups); + } + @Override @DB - public StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule) { + public StoragePoolVO persist(StoragePoolVO pool, Map details, List tags, Boolean isTagARule, boolean displayDetails, List storageAccessGroups) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); pool = super.persist(pool); if (details != null) { for (Map.Entry detail : details.entrySet()) { - StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue(), true); + if (detail.getKey().toLowerCase().contains("password") || detail.getKey().toLowerCase().contains("token")) { + displayDetails = false; + } + StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue(), displayDetails); _detailsDao.persist(vo); } } if (CollectionUtils.isNotEmpty(tags)) { _tagsDao.persist(pool.getId(), tags, isTagARule); } + if (CollectionUtils.isNotEmpty(storageAccessGroups)) { + _storagePoolAccessGroupMapDao.persist(pool.getId(), storageAccessGroups); + } txn.commit(); return pool; } @@ -333,6 +360,56 @@ protected List findPoolsByDetailsOrTagsInternal(long dcId, long p return searchStoragePoolsPreparedStatement(sql, dcId, podId, clusterId, scope, valuesLength); } + protected List findPoolsByDetailsOrTagsForHostConnectionInternal(long dcId, long podId, Long clusterId, ScopeType scope, String sqlValues, ValueType valuesType) { + String sqlPrefix = valuesType.equals(ValueType.DETAILS) ? DetailsSqlPrefix : SAGsForHostConnectionSqlPrefix; + String sqlSuffix = valuesType.equals(ValueType.DETAILS) ? DetailsForHostConnectionSqlSuffix : SAGsForHostConnectionSqlSuffix; + String sql = getSqlPreparedStatement(sqlPrefix, sqlSuffix, sqlValues, clusterId); + return searchStoragePoolsPreparedStatement(sql, dcId, podId, clusterId, scope, null); + } + + /** + * Search storage pools in a transaction + * @param sql prepared statement sql + * @param dcId data center id + * @param podId pod id + * @param clusterId cluster id + * @param scope scope + * @param valuesLength values length + * @return storage pools matching criteria + */ + @DB + protected List searchStoragePoolsWithHypervisorTypesPreparedStatement(String sql, HypervisorType type, long dcId, Long podId, Long clusterId, ScopeType scope, Integer valuesLength) { + TransactionLegacy txn = TransactionLegacy.currentTxn(); + List pools = new ArrayList(); + try (PreparedStatement pstmt = txn.prepareStatement(sql);) { + if (pstmt != null) { + int i = 1; + pstmt.setString(i++, type.toString()); + pstmt.setLong(i++, dcId); + if (podId != null) { + pstmt.setLong(i++, podId); + } + pstmt.setString(i++, scope.toString()); + if (clusterId != null) { + pstmt.setLong(i++, clusterId); + } + if (valuesLength != null) { + pstmt.setInt(i++, valuesLength); + } + try (ResultSet rs = pstmt.executeQuery();) { + while (rs.next()) { + pools.add(toEntityBean(rs, false)); + } + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to execute :" + e.getMessage(), e); + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to execute :" + e.getMessage(), e); + } + return pools; + } + /** * Search storage pools in a transaction * @param sql prepared statement sql @@ -344,7 +421,7 @@ protected List findPoolsByDetailsOrTagsInternal(long dcId, long p * @return storage pools matching criteria */ @DB - protected List searchStoragePoolsPreparedStatement(String sql, long dcId, Long podId, Long clusterId, ScopeType scope, int valuesLength) { + protected List searchStoragePoolsPreparedStatement(String sql, long dcId, Long podId, Long clusterId, ScopeType scope, Integer valuesLength) { TransactionLegacy txn = TransactionLegacy.currentTxn(); List pools = new ArrayList(); try (PreparedStatement pstmt = txn.prepareStatement(sql);) { @@ -358,7 +435,9 @@ protected List searchStoragePoolsPreparedStatement(String sql, lo if (clusterId != null) { pstmt.setLong(i++, clusterId); } - pstmt.setInt(i++, valuesLength); + if (valuesLength != null) { + pstmt.setInt(i++, valuesLength); + } try (ResultSet rs = pstmt.executeQuery();) { while (rs.next()) { pools.add(toEntityBean(rs, false)); @@ -415,6 +494,22 @@ protected String getSqlValuesFromStorageTags(String[] tags) throws NullPointerEx return sqlValues.toString(); } + /** + * Return SQL string from storage pool access group map, to be placed between SQL Prefix and SQL Suffix when creating storage tags PreparedStatement. + * @param storageAccessGroups storage tags array + * @return SQL string containing storage tag values to be placed between Prefix and Suffix when creating PreparedStatement. + * @throws NullPointerException if tags is null + * @throws IndexOutOfBoundsException if tags is not null, but empty + */ + protected String getSqlValuesFromStorageAccessGroups(String[] storageAccessGroups) throws NullPointerException, IndexOutOfBoundsException { + StringBuilder sqlValues = new StringBuilder(); + for (String tag : storageAccessGroups) { + sqlValues.append("(storage_pool_and_access_group_map.storage_access_group='").append(tag).append("') OR "); + } + sqlValues.delete(sqlValues.length() - 4, sqlValues.length()); + return sqlValues.toString(); + } + @DB @Override public List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details, ScopeType scope) { @@ -423,10 +518,10 @@ public List findPoolsByDetails(long dcId, long podId, Long cluste } @Override - public List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule, long ruleExecuteTimeout) { + public List findPoolsByTags(long dcId, long podId, Long clusterId, ScopeType scope, String[] tags, boolean validateTagRule, long ruleExecuteTimeout) { List storagePools = null; if (tags == null || tags.length == 0) { - storagePools = listBy(dcId, podId, clusterId, ScopeType.CLUSTER); + storagePools = listBy(dcId, podId, clusterId, scope); if (validateTagRule) { storagePools = getPoolsWithoutTagRule(storagePools); @@ -434,7 +529,20 @@ public List findPoolsByTags(long dcId, long podId, Long clusterId } else { String sqlValues = getSqlValuesFromStorageTags(tags); - storagePools = findPoolsByDetailsOrTagsInternal(dcId, podId, clusterId, ScopeType.CLUSTER, sqlValues, ValueType.TAGS, tags.length); + storagePools = findPoolsByDetailsOrTagsInternal(dcId, podId, clusterId, scope, sqlValues, ValueType.TAGS, tags.length); + } + + return storagePools; + } + + @Override + public List findPoolsByAccessGroupsForHostConnection(Long dcId, Long podId, Long clusterId, ScopeType scope, String[] storageAccessGroups) { + List storagePools = null; + if (storageAccessGroups == null || storageAccessGroups.length == 0) { + storagePools = listBy(dcId, podId, clusterId, scope); + } else { + String sqlValues = getSqlValuesFromStorageAccessGroups(storageAccessGroups); + storagePools = findPoolsByDetailsOrTagsForHostConnectionInternal(dcId, podId, clusterId, scope, sqlValues, ValueType.TAGS); } return storagePools; @@ -551,6 +659,77 @@ protected List getPoolsWithoutTagRule(List storage return storagePoolsToReturn; } + @Override + public List findZoneWideStoragePoolsByAccessGroupsForHostConnection(long dcId, String[] storageAccessGroups) { + if (storageAccessGroups == null || storageAccessGroups.length == 0) { + QueryBuilder sc = QueryBuilder.create(StoragePoolVO.class); + sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId); + sc.and(sc.entity().getStatus(), Op.EQ, Status.Up); + sc.and(sc.entity().getScope(), Op.EQ, ScopeType.ZONE); + return sc.list(); + } else { + String sqlValues = getSqlValuesFromStorageAccessGroups(storageAccessGroups); + String sql = getSqlPreparedStatement(ZoneWideStorageAccessGroupsForHostConnectionSqlPrefix, ZoneWideStorageAccessGroupsForHostConnectionSqlSuffix, sqlValues, null); + return searchStoragePoolsPreparedStatement(sql, dcId, null, null, ScopeType.ZONE, null); + } + } + + @Override + public List findZoneWideStoragePoolsByAccessGroupsAndHypervisorTypeForHostConnection(long dcId, String[] storageAccessGroups, HypervisorType type) { + if (storageAccessGroups == null || storageAccessGroups.length == 0) { + QueryBuilder sc = QueryBuilder.create(StoragePoolVO.class); + sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId); + sc.and(sc.entity().getStatus(), Op.EQ, Status.Up); + sc.and(sc.entity().getScope(), Op.EQ, ScopeType.ZONE); + sc.and(sc.entity().getHypervisor(), Op.EQ, type); + return sc.list(); + } else { + String sqlValues = getSqlValuesFromStorageAccessGroups(storageAccessGroups); + String sql = getSqlPreparedStatement(ZoneWideStorageAccessGroupsWithHypervisorTypeSqlPrefix, ZoneWideStorageAccessGroupsWithHypervisorTypeSqlSuffix, sqlValues, null); + return searchStoragePoolsWithHypervisorTypesPreparedStatement(sql, type, dcId, null, null, ScopeType.ZONE, null); + } + } + + @Override + public List findStoragePoolsByEmptyStorageAccessGroups(Long dcId, Long podId, Long clusterId, ScopeType scope, HypervisorType hypervisorType) { + SearchBuilder poolSearch = createSearchBuilder(); + SearchBuilder storageAccessGroupsPoolSearch = _storagePoolAccessGroupMapDao.createSearchBuilder(); + // Set criteria for pools + poolSearch.and("scope", poolSearch.entity().getScope(), Op.EQ); + poolSearch.and("removed", poolSearch.entity().getRemoved(), Op.NULL); + poolSearch.and("status", poolSearch.entity().getStatus(), Op.EQ); + poolSearch.and("datacenterid", poolSearch.entity().getDataCenterId(), Op.EQ); + poolSearch.and("podid", poolSearch.entity().getPodId(), Op.EQ); + poolSearch.and("clusterid", poolSearch.entity().getClusterId(), Op.EQ); + poolSearch.and("hypervisortype", poolSearch.entity().getHypervisor(), Op.EQ); + + // Set StoragePoolAccessGroupMapVO.pool_id IS NULL. This ensures only pools without tags are returned + storageAccessGroupsPoolSearch.and("poolid", storageAccessGroupsPoolSearch.entity().getPoolId(), Op.NULL); + poolSearch.join("tagJoin", storageAccessGroupsPoolSearch, poolSearch.entity().getId(), storageAccessGroupsPoolSearch.entity().getPoolId(), JoinBuilder.JoinType.LEFT); + + SearchCriteria sc = poolSearch.create(); + sc.setParameters("scope", scope.toString()); + sc.setParameters("status", Status.Up.toString()); + + if (dcId != null) { + sc.setParameters("datacenterid", dcId); + } + + if (podId != null) { + sc.setParameters("podid", podId); + } + + if (clusterId != null) { + sc.setParameters("clusterid", clusterId); + } + + if (hypervisorType != null) { + sc.setParameters("hypervisortype", hypervisorType); + } + + return listBy(sc); + } + @Override public List searchForStoragePoolTags(long poolId) { return _tagsDao.getStoragePoolTags(poolId); @@ -570,6 +749,11 @@ public void updateDetails(long poolId, Map details) { } } + @Override + public void removeDetails(long poolId) { + _detailsDao.removeDetails(poolId); + } + @Override public Map getDetails(long poolId) { return _detailsDao.listDetailsKeyPairs(poolId); @@ -649,6 +833,11 @@ public void deletePoolTags(long poolId) { _tagsDao.deleteTags(poolId); } + @Override + public void deleteStoragePoolAccessGroups(long poolId) { + _storagePoolAccessGroupMapDao.deleteStorageAccessGroups(poolId); + } + @Override public List listChildStoragePoolsInDatastoreCluster(long poolId) { QueryBuilder sc = QueryBuilder.create(StoragePoolVO.class); @@ -715,9 +904,10 @@ public List listStoragePoolsWithActiveVolumesByOfferingId(long of @Override public Pair, Integer> searchForIdsAndCount(Long storagePoolId, String storagePoolName, Long zoneId, - String path, Long podId, Long clusterId, String address, ScopeType scopeType, StoragePoolStatus status, - String keyword, Filter searchFilter) { - SearchCriteria sc = createStoragePoolSearchCriteria(storagePoolId, storagePoolName, zoneId, path, podId, clusterId, address, scopeType, status, keyword); + String path, Long podId, Long clusterId, Long hostId, String address, ScopeType scopeType, StoragePoolStatus status, + String keyword, String storageAccessGroup, Filter searchFilter) { + SearchCriteria sc = createStoragePoolSearchCriteria(storagePoolId, storagePoolName, zoneId, path, podId, clusterId, + hostId, address, scopeType, status, keyword, storageAccessGroup); Pair, Integer> uniquePair = searchAndCount(sc, searchFilter); List idList = uniquePair.first().stream().map(StoragePoolVO::getId).collect(Collectors.toList()); return new Pair<>(idList, uniquePair.second()); @@ -733,9 +923,27 @@ public List listByIds(List ids) { return listBy(sc); } + @Override + public List findPoolsByStorageTypeAndZone(Storage.StoragePoolType storageType, Long zoneId) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("poolType", storageType); + sc.addAnd("dataCenterId", Op.EQ, zoneId); + return listBy(sc); + } + + @Override + public List listByDataCenterIds(List dataCenterIds) { + if (CollectionUtils.isEmpty(dataCenterIds)) { + return Collections.emptyList(); + } + SearchCriteria sc = DcsSearch.create(); + sc.setParameters("dataCenterId", dataCenterIds.toArray()); + return listBy(sc); + } + private SearchCriteria createStoragePoolSearchCriteria(Long storagePoolId, String storagePoolName, - Long zoneId, String path, Long podId, Long clusterId, String address, ScopeType scopeType, - StoragePoolStatus status, String keyword) { + Long zoneId, String path, Long podId, Long clusterId, Long hostId, String address, ScopeType scopeType, + StoragePoolStatus status, String keyword, String storageAccessGroup) { SearchBuilder sb = createSearchBuilder(); sb.select(null, SearchCriteria.Func.DISTINCT, sb.entity().getId()); // select distinct // ids @@ -750,6 +958,18 @@ private SearchCriteria createStoragePoolSearchCriteria(Long stora sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ); sb.and("parent", sb.entity().getParent(), SearchCriteria.Op.EQ); + if (hostId != null) { + SearchBuilder hostJoin = _hostDao.createSearchBuilder(); + hostJoin.and("hostId", hostJoin.entity().getHostId(), SearchCriteria.Op.EQ); + sb.join("poolHostJoin", hostJoin, sb.entity().getId(), hostJoin.entity().getPoolId(), JoinBuilder.JoinType.INNER); + } + + if (storageAccessGroup != null) { + SearchBuilder storageAccessGroupJoin = _storagePoolAccessGroupMapDao.createSearchBuilder(); + storageAccessGroupJoin.and("storageAccessGroup", storageAccessGroupJoin.entity().getStorageAccessGroup(), SearchCriteria.Op.EQ); + sb.join("poolStorageAccessGroupJoin", storageAccessGroupJoin, sb.entity().getId(), storageAccessGroupJoin.entity().getPoolId(), JoinBuilder.JoinType.INNER); + } + SearchCriteria sc = sb.create(); if (keyword != null) { @@ -798,6 +1018,15 @@ private SearchCriteria createStoragePoolSearchCriteria(Long stora sc.setParameters("status", status.toString()); } sc.setParameters("parent", 0); + + if (hostId != null) { + sc.setJoinParameters("poolHostJoin", "hostId", hostId); + } + + if (storageAccessGroup != null) { + sc.setJoinParameters("poolStorageAccessGroupJoin", "storageAccessGroup", storageAccessGroup); + } + return sc; } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java index 4cd29b465eeb..3329983d711e 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java @@ -19,6 +19,7 @@ import java.util.Date; import java.util.List; +import com.cloud.hypervisor.Hypervisor; import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; @@ -46,16 +47,39 @@ public interface SnapshotDataStoreDao extends GenericDao listBySnapshot(long snapshotId, DataStoreRole role); + SnapshotDataStoreVO findParent(DataStoreRole role, Long storeId, Long zoneId, Long volumeId, boolean kvmIncrementalSnapshot, Hypervisor.HypervisorType hypervisorType); + + SnapshotDataStoreVO findBySnapshotIdAndDataStoreRoleAndState(long snapshotId, DataStoreRole role, ObjectInDataStoreStateMachine.State state); + + List listBySnapshotIdAndDataStoreRoleAndStateIn(long snapshotId, DataStoreRole role, ObjectInDataStoreStateMachine.State... state); + + List listReadyByVolumeIdAndCheckpointPathNotNull(long volumeId); + + SnapshotDataStoreVO findOneBySnapshotId(long snapshotId, long zoneId); + + List listBySnapshotId(long snapshotId); + + List listBySnapshotAndDataStoreRole(long snapshotId, DataStoreRole role); + + List listExtractedSnapshotsBeforeDate(Date beforeDate); + + List listSnapshotsBySnapshotId(long snapshotId); List listReadyBySnapshot(long snapshotId, DataStoreRole role); + List listReadyBySnapshotId(long snapshotId); SnapshotDataStoreVO findBySourceSnapshot(long snapshotId, DataStoreRole role); + List findBySnapshotIdAndNotInDestroyedHiddenState(long snapshotId); + + SnapshotDataStoreVO findBySnapshotIdInAnyState(long snapshotId, DataStoreRole role); + List listDestroyed(long storeId); List findBySnapshotId(long snapshotId); + List findBySnapshotIdWithNonDestroyedState(long snapshotId); + void duplicateCacheRecordsOnRegionStore(long storeId); // delete the snapshot entry on primary data store to make sure that next snapshot will be full snapshot @@ -108,4 +132,18 @@ public interface SnapshotDataStoreDao extends GenericDao snapshotIds, Long batchSize); + + /** + * Returns the total physical size, in bytes, of all snapshots stored on primary + * storage for the specified account that have not yet been backed up to + * secondary storage. + * + *

    If no such snapshots are found, this method returns {@code 0}.

    + * + * @param accountId the ID of the account whose snapshots on primary storage + * should be considered + * @return the total physical size in bytes of matching snapshots on primary + * storage, or {@code 0} if none are found + */ + long getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId(long accountId); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java index 5bf67eb38819..8b7a2b78de7e 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java @@ -16,24 +16,6 @@ // under the License. package org.apache.cloudstack.storage.datastore.db; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; -import javax.naming.ConfigurationException; - -import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; -import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; -import org.apache.commons.collections.CollectionUtils; -import org.springframework.stereotype.Component; - import com.cloud.hypervisor.Hypervisor; import com.cloud.storage.DataStoreRole; import com.cloud.storage.SnapshotVO; @@ -47,6 +29,25 @@ import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.db.UpdateBuilder; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; + +import org.apache.commons.collections.CollectionUtils; + +import org.springframework.stereotype.Component; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; + @Component public class SnapshotDataStoreDaoImpl extends GenericDaoBase implements SnapshotDataStoreDao { private static final String STORE_ID = "store_id"; @@ -58,26 +59,53 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase searchFilteringStoreIdEqStoreRoleEqStateNeqRefCntNeq; protected SearchBuilder searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq; private SearchBuilder stateSearch; - private SearchBuilder idStateNeqSearch; + private SearchBuilder idStateNinSearch; + private SearchBuilder idEqRoleEqStateInSearch; protected SearchBuilder snapshotVOSearch; private SearchBuilder snapshotCreatedSearch; private SearchBuilder dataStoreAndInstallPathSearch; private SearchBuilder storeAndSnapshotIdsSearch; private SearchBuilder storeSnapshotDownloadStatusSearch; + private SearchBuilder searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull; + private SearchBuilder searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore; + private SearchBuilder searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq; + + private SearchBuilder searchBySnapshotId; protected static final List HYPERVISORS_SUPPORTING_SNAPSHOTS_CHAINING = List.of(Hypervisor.HypervisorType.XenServer); @Inject protected SnapshotDao snapshotDao; + @Inject + protected ImageStoreDao imageStoreDao; + private static final String FIND_OLDEST_OR_LATEST_SNAPSHOT = "select store_id, store_role, snapshot_id from cloud.snapshot_store_ref where " + " store_role = ? and volume_id = ? and state = 'Ready'" + " order by created %s " + " limit 1"; + private static final String FIND_SNAPSHOT_IN_ZONE = "SELECT ssr.* FROM " + + "snapshot_store_ref ssr, snapshots s " + + "WHERE ssr.snapshot_id=? AND ssr.snapshot_id = s.id AND s.data_center_id=?;"; + + private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " + + "FROM cloud.snapshot_store_ref s " + + "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " + + "WHERE snapshots.account_id = ? " + + "AND snapshots.removed IS NULL " + + "AND s.state = 'Ready' " + + "AND s.store_role = 'Primary' " + + "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')"; + @Override public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); @@ -119,10 +147,15 @@ public boolean configure(String name, Map params) throws Configu stateSearch.done(); - idStateNeqSearch = createSearchBuilder(); - idStateNeqSearch.and(SNAPSHOT_ID, idStateNeqSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ); - idStateNeqSearch.and(STATE, idStateNeqSearch.entity().getState(), SearchCriteria.Op.NEQ); - idStateNeqSearch.done(); + idStateNinSearch = createSearchBuilder(); + idStateNinSearch.and(SNAPSHOT_ID, idStateNinSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ); + idStateNinSearch.and(STATE, idStateNinSearch.entity().getState(), SearchCriteria.Op.NOTIN); + idStateNinSearch.done(); + + idEqRoleEqStateInSearch = createSearchBuilder(); + idEqRoleEqStateInSearch.and(SNAPSHOT_ID, idEqRoleEqStateInSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ); + idEqRoleEqStateInSearch.and(STORE_ROLE, idEqRoleEqStateInSearch.entity().getRole(), SearchCriteria.Op.EQ); + idEqRoleEqStateInSearch.and(STATE, idEqRoleEqStateInSearch.entity().getState(), SearchCriteria.Op.IN); snapshotVOSearch = snapshotDao.createSearchBuilder(); snapshotVOSearch.and(VOLUME_ID, snapshotVOSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); @@ -151,6 +184,31 @@ public boolean configure(String name, Map params) throws Configu storeSnapshotDownloadStatusSearch.and("downloadState", storeSnapshotDownloadStatusSearch.entity().getDownloadState(), SearchCriteria.Op.IN); storeSnapshotDownloadStatusSearch.done(); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull = createSearchBuilder(); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.and(VOLUME_ID, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.entity().getVolumeId(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.and(STATE, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.entity().getState(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.and(STORE_ROLE, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.entity().getRole(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.and(KVM_CHECKPOINT_PATH, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.entity().getKvmCheckpointPath(), SearchCriteria.Op.NNULL); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.and(STORE_ID, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.entity().getDataStoreId(), SearchCriteria.Op.IN); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.done(); + + searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore = createSearchBuilder(); + searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.and(STATE, searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.entity().getState(), SearchCriteria.Op.EQ); + searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.and(DOWNLOAD_URL, searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.entity().getExtractUrl(), SearchCriteria.Op.NNULL); + searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.and(URL_CREATED_BEFORE, searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.entity().getExtractUrlCreated(), SearchCriteria.Op.LT); + searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.done(); + + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq = createSearchBuilder(); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.and(STATE, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.entity().getState(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.and(VOLUME_ID, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.entity().getVolumeId(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.and(STORE_ROLE, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.entity().getRole(), SearchCriteria.Op.EQ); + searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.and(STORE_ID, searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.entity().getDataStoreId(), SearchCriteria.Op.IN); + + searchBySnapshotId = createSearchBuilder(); + searchBySnapshotId.and(SNAPSHOT_ID, searchBySnapshotId.entity().getSnapshotId(), SearchCriteria.Op.EQ); + searchBySnapshotId.and(STATE, searchBySnapshotId.entity().getState(), SearchCriteria.Op.EQ); + searchBySnapshotId.done(); + return true; } @@ -283,30 +341,106 @@ protected SnapshotDataStoreVO findOldestOrLatestSnapshotForVolume(long volumeId, @Override @DB public SnapshotDataStoreVO findParent(DataStoreRole role, Long storeId, Long volumeId) { - if (!isSnapshotChainingRequired(volumeId)) { + return findParent(role, storeId, null, volumeId, false, null); + } + + @Override + @DB + public SnapshotDataStoreVO findParent(DataStoreRole role, Long storeId, Long zoneId, Long volumeId, boolean kvmIncrementalSnapshot, Hypervisor.HypervisorType hypervisorType) { + if (!isSnapshotChainingRequired(volumeId, kvmIncrementalSnapshot)) { logger.trace(String.format("Snapshot chaining is not required for snapshots of volume [%s]. Returning null as parent.", volumeId)); return null; } - SearchCriteria sc = searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq.create(); + SearchCriteria sc; + if (kvmIncrementalSnapshot && Hypervisor.HypervisorType.KVM.equals(hypervisorType)) { + sc = searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.create(); + } else { + sc = searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEq.create(); + } + sc.setParameters(VOLUME_ID, volumeId); - sc.setParameters(STORE_ROLE, role.toString()); + if (role != null) { + sc.setParameters(STORE_ROLE, role.toString()); + } sc.setParameters(STATE, ObjectInDataStoreStateMachine.State.Ready.name()); - sc.setParameters(STORE_ID, storeId); + if (storeId != null) { + sc.setParameters(STORE_ID, new Long[]{storeId}); + } else if (zoneId != null) { + List imageStores = imageStoreDao.listStoresByZoneId(zoneId); + Object[] imageStoreIds = imageStores.stream().map(ImageStoreVO::getId).toArray(); + sc.setParameters(STORE_ID, imageStoreIds); + } List snapshotList = listBy(sc, new Filter(SnapshotDataStoreVO.class, CREATED, false, null, null)); - if (CollectionUtils.isNotEmpty(snapshotList)) { - return snapshotList.get(0); + if (CollectionUtils.isEmpty(snapshotList)) { + return null; + } + + SnapshotDataStoreVO parent = snapshotList.get(0); + + if (kvmIncrementalSnapshot && parent.getKvmCheckpointPath() == null && Hypervisor.HypervisorType.KVM.equals(hypervisorType)) { + return null; + } + + return parent; + } + + @Override + public SnapshotDataStoreVO findBySnapshotIdAndDataStoreRoleAndState(long snapshotId, DataStoreRole role, State state) { + SearchCriteria sc = createSearchCriteriaBySnapshotIdAndStoreRole(snapshotId, role); + sc.setParameters(STATE, state); + return findOneBy(sc); + } + + @Override + public List listBySnapshotIdAndDataStoreRoleAndStateIn(long snapshotId, DataStoreRole role, State... state) { + SearchCriteria sc = idEqRoleEqStateInSearch.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + sc.setParameters(STORE_ROLE, role); + sc.setParameters(STATE, (Object[])state); + return listBy(sc); + } + + @Override + public SnapshotDataStoreVO findOneBySnapshotId(long snapshotId, long zoneId) { + try (TransactionLegacy transactionLegacy = TransactionLegacy.currentTxn()) { + try (PreparedStatement preparedStatement = transactionLegacy.prepareStatement(FIND_SNAPSHOT_IN_ZONE)) { + preparedStatement.setLong(1, snapshotId); + preparedStatement.setLong(2, zoneId); + + try (ResultSet resultSet = preparedStatement.executeQuery()) { + if (resultSet.next()) { + return toEntityBean(resultSet, false); + } + } + } + } catch (SQLException e) { + logger.warn(String.format("Failed to find %s snapshot in zone %s due to [%s].", snapshotId, zoneId, e.getMessage()), e); } return null; } @Override - public List listBySnapshot(long snapshotId, DataStoreRole role) { + public List listBySnapshotId(long snapshotId) { + SearchCriteria sc = searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + return listBy(sc); + } + + @Override + public List listBySnapshotAndDataStoreRole(long snapshotId, DataStoreRole role) { SearchCriteria sc = createSearchCriteriaBySnapshotIdAndStoreRole(snapshotId, role); return listBy(sc); } + @Override + public List listSnapshotsBySnapshotId(long snapshotId) { + SearchCriteria sc = searchBySnapshotId.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + return listBy(sc); + } + @Override public List listReadyBySnapshot(long snapshotId, DataStoreRole role) { SearchCriteria sc = createSearchCriteriaBySnapshotIdAndStoreRole(snapshotId, role); @@ -314,6 +448,14 @@ public List listReadyBySnapshot(long snapshotId, DataStoreR return listBy(sc); } + @Override + public List listReadyBySnapshotId(long snapshotId) { + SearchCriteria sc = searchBySnapshotId.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + sc.setParameters(STATE, State.Ready); + return listBy(sc); + } + @Override public SnapshotDataStoreVO findBySourceSnapshot(long snapshotId, DataStoreRole role) { SearchCriteria sc = createSearchCriteriaBySnapshotIdAndStoreRole(snapshotId, role); @@ -321,6 +463,12 @@ public SnapshotDataStoreVO findBySourceSnapshot(long snapshotId, DataStoreRole r return findOneBy(sc); } + @Override + public SnapshotDataStoreVO findBySnapshotIdInAnyState(long snapshotId, DataStoreRole role) { + SearchCriteria sc = createSearchCriteriaBySnapshotIdAndStoreRole(snapshotId, role); + return findOneBy(sc); + } + @Override public List listAllByVolumeAndDataStore(long volumeId, DataStoreRole role) { SearchCriteria sc = searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq.create(); @@ -340,9 +488,24 @@ public List findByVolume(long snapshotId, long volumeId, Da @Override public List findBySnapshotId(long snapshotId) { - SearchCriteria sc = idStateNeqSearch.create(); + SearchCriteria sc = searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq.create(); sc.setParameters(SNAPSHOT_ID, snapshotId); - sc.setParameters(STATE, State.Destroyed); + return listBy(sc); + } + + @Override + public List findBySnapshotIdWithNonDestroyedState(long snapshotId) { + SearchCriteria sc = idStateNinSearch.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + sc.setParameters(STATE, State.Destroyed.name()); + return listBy(sc); + } + + @Override + public List findBySnapshotIdAndNotInDestroyedHiddenState(long snapshotId) { + SearchCriteria sc = idStateNinSearch.create(); + sc.setParameters(SNAPSHOT_ID, snapshotId); + sc.setParameters(STATE, State.Destroyed.name(), State.Hidden.name()); return listBy(sc); } @@ -485,13 +648,35 @@ protected SearchCriteria createSearchCriteriaBySnapshotIdAn return sc; } - protected boolean isSnapshotChainingRequired(long volumeId) { + protected boolean isSnapshotChainingRequired(long volumeId, boolean kvmIncrementalSnapshot) { SearchCriteria sc = snapshotVOSearch.create(); sc.setParameters(VOLUME_ID, volumeId); SnapshotVO snapshot = snapshotDao.findOneBy(sc); - return snapshot != null && HYPERVISORS_SUPPORTING_SNAPSHOTS_CHAINING.contains(snapshot.getHypervisorType()); + if (snapshot == null) { + return false; + } + + Hypervisor.HypervisorType hypervisorType = snapshot.getHypervisorType(); + return HYPERVISORS_SUPPORTING_SNAPSHOTS_CHAINING.contains(hypervisorType) || (Hypervisor.HypervisorType.KVM.equals(hypervisorType) && kvmIncrementalSnapshot); + } + + @Override + public List listReadyByVolumeIdAndCheckpointPathNotNull(long volumeId) { + SearchCriteria sc = searchFilteringStoreIdInVolumeIdEqStoreRoleEqStateEqKVMCheckpointNotNull.create(); + sc.setParameters(VOLUME_ID, volumeId); + sc.setParameters(STATE, State.Ready); + return listBy(sc); + } + + @Override + public List listExtractedSnapshotsBeforeDate(Date beforeDate) { + SearchCriteria sc = searchFilterStateAndDownloadUrlNotNullAndDownloadUrlCreatedBefore.create(); + sc.setParameters(URL_CREATED_BEFORE, beforeDate); + sc.setParameters(STATE, State.Ready); + + return listBy(sc); } @Override @@ -571,4 +756,23 @@ public int expungeBySnapshotList(final List snapshotIds, final Long batchS sc.setParameters("snapshotIds", snapshotIds.toArray()); return batchExpunge(sc, batchSize); } + + @Override + public long getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId(long accountId) { + long snapshotsPhysicalSize = 0; + try (TransactionLegacy transactionLegacy = TransactionLegacy.currentTxn()) { + try (PreparedStatement preparedStatement = transactionLegacy.prepareStatement(GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT)) { + preparedStatement.setLong(1, accountId); + + try (ResultSet resultSet = preparedStatement.executeQuery()) { + if (resultSet.next()) { + snapshotsPhysicalSize = resultSet.getLong(1); + } + } + } + } catch (SQLException e) { + logger.warn("Failed to get the snapshots physical size for the account [{}] due to [{}].", accountId, e.getMessage(), e); + } + return snapshotsPhysicalSize; + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java index 7a466c1f5055..44eb7e6c02cb 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreVO.java @@ -29,6 +29,8 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; @@ -80,12 +82,18 @@ public class SnapshotDataStoreVO implements StateObject, StateDao listSharedFSToBeDestroyed(Date date); SharedFSVO findSharedFSByNameAccountDomain(String name, Long accountId, Long domainId); + + SharedFSVO findByVm(long vmId); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/storage/sharedfs/dao/SharedFSDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/storage/sharedfs/dao/SharedFSDaoImpl.java index da6220716715..dd23787f982f 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/storage/sharedfs/dao/SharedFSDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/storage/sharedfs/dao/SharedFSDaoImpl.java @@ -114,4 +114,14 @@ public SharedFSVO findSharedFSByNameAccountDomain(String name, Long accountId, L sc.setParameters("domainId", domainId); return findOneBy(sc); } + + @Override + public SharedFSVO findByVm(long vmId) { + SearchBuilder sb = createSearchBuilder(); + sb.and("vmId", sb.entity().getVmId(), SearchCriteria.Op.EQ); + sb.done(); + SearchCriteria sc = sb.create(); + sc.setParameters("vmId", vmId); + return findOneBy(sc); + } } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/util/CPUArchConverter.java b/engine/schema/src/main/java/org/apache/cloudstack/util/CPUArchConverter.java index e278809fb96b..8e56cce739d8 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/util/CPUArchConverter.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/util/CPUArchConverter.java @@ -21,7 +21,7 @@ import javax.persistence.AttributeConverter; import javax.persistence.Converter; -@Converter +@Converter(autoApply = true) public class CPUArchConverter implements AttributeConverter { @Override diff --git a/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDao.java b/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDao.java index 7b8c01aae6ad..835ac696f26c 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDao.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDao.java @@ -31,4 +31,6 @@ public interface VMScheduledJobDao extends GenericDao { int expungeJobsForSchedules(List scheduleId, Date dateAfter); int expungeJobsBefore(Date currentTimestamp); + + VMScheduledJobVO findByScheduleAndTimestamp(long scheduleId, Date scheduledTimestamp); } diff --git a/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDaoImpl.java b/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDaoImpl.java index 50a2b12fd774..2f08a41b92e4 100644 --- a/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDaoImpl.java +++ b/engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/dao/VMScheduledJobDaoImpl.java @@ -39,6 +39,8 @@ public class VMScheduledJobDaoImpl extends GenericDaoBase expungeJobForScheduleSearch; + private final SearchBuilder scheduleAndTimestampSearch; + static final String SCHEDULED_TIMESTAMP = "scheduled_timestamp"; static final String VM_SCHEDULE_ID = "vm_schedule_id"; @@ -58,6 +60,11 @@ public VMScheduledJobDaoImpl() { expungeJobForScheduleSearch.and(VM_SCHEDULE_ID, expungeJobForScheduleSearch.entity().getVmScheduleId(), SearchCriteria.Op.IN); expungeJobForScheduleSearch.and(SCHEDULED_TIMESTAMP, expungeJobForScheduleSearch.entity().getScheduledTime(), SearchCriteria.Op.GTEQ); expungeJobForScheduleSearch.done(); + + scheduleAndTimestampSearch = createSearchBuilder(); + scheduleAndTimestampSearch.and(VM_SCHEDULE_ID, scheduleAndTimestampSearch.entity().getVmScheduleId(), SearchCriteria.Op.EQ); + scheduleAndTimestampSearch.and(SCHEDULED_TIMESTAMP, scheduleAndTimestampSearch.entity().getScheduledTime(), SearchCriteria.Op.EQ); + scheduleAndTimestampSearch.done(); } /** @@ -92,4 +99,12 @@ public int expungeJobsBefore(Date date) { sc.setParameters(SCHEDULED_TIMESTAMP, date); return expunge(sc); } + + @Override + public VMScheduledJobVO findByScheduleAndTimestamp(long scheduleId, Date scheduledTimestamp) { + SearchCriteria sc = scheduleAndTimestampSearch.create(); + sc.setParameters(VM_SCHEDULE_ID, scheduleId); + sc.setParameters(SCHEDULED_TIMESTAMP, scheduledTimestamp); + return findOneBy(sc); + } } diff --git a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml index d6d72f9228e1..2c6869bd81e3 100644 --- a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml +++ b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-common-daos-between-management-and-usage-context.xml @@ -62,7 +62,8 @@ - + + @@ -70,6 +71,9 @@ - + + + + diff --git a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml index 4f22234d7bf4..26181d3fce0d 100644 --- a/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml +++ b/engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml @@ -116,6 +116,7 @@ + @@ -138,6 +139,7 @@ + @@ -235,13 +237,11 @@ - - @@ -270,7 +270,9 @@ + + @@ -300,4 +302,14 @@ + + + + + + + + + + diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_column.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_column.sql new file mode 100644 index 000000000000..31d5b9f500f0 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_column.sql @@ -0,0 +1,28 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- in cloud +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_DROP_COLUMN`; + +-- Error 1091: Can't DROP column; check that column/key exists +CREATE PROCEDURE `cloud`.`IDEMPOTENT_DROP_COLUMN` ( + IN in_table_name VARCHAR(200), + IN in_column_name VARCHAR(200) +) +BEGIN + + DECLARE CONTINUE HANDLER FOR 1091 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name, ' DROP COLUMN ', in_column_name); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_unique_key.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_unique_key.sql new file mode 100644 index 000000000000..fdcca6fb4089 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_drop_unique_key.sql @@ -0,0 +1,26 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- in cloud +DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_DROP_UNIQUE_KEY`; + +CREATE PROCEDURE `cloud`.`IDEMPOTENT_DROP_UNIQUE_KEY` ( + IN in_table_name VARCHAR(200), + IN in_index_name VARCHAR(200) +) +BEGIN + DECLARE CONTINUE HANDLER FOR 1091, 1025 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name, ' DROP KEY ', in_index_name); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_category_if_not_exists.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_category_if_not_exists.sql new file mode 100644 index 000000000000..a82dc7204c2e --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_category_if_not_exists.sql @@ -0,0 +1,27 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- Add new OS categories if not present +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`; +CREATE PROCEDURE `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`(IN os_name VARCHAR(255)) +BEGIN + IF NOT EXISTS ((SELECT 1 FROM `cloud`.`guest_os_category` WHERE name = os_name)) + THEN + INSERT INTO `cloud`.`guest_os_category` (name, uuid) + VALUES (os_name, UUID()) +; END IF +; END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_details_if_not_exists.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_details_if_not_exists.sql new file mode 100644 index 000000000000..77b162236266 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_details_if_not_exists.sql @@ -0,0 +1,46 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS` ( + IN ext_name VARCHAR(255), + IN action_name VARCHAR(255), + IN param_json TEXT +) +BEGIN + DECLARE action_id BIGINT UNSIGNED +; SELECT `eca`.`id` INTO action_id FROM `cloud`.`extension_custom_action` `eca` + JOIN `cloud`.`extension` `e` ON `e`.`id` = `eca`.`extension_id` + WHERE `eca`.`name` = action_name AND `e`.`name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_custom_action_details` + WHERE `extension_custom_action_id` = action_id + AND `name` = 'parameters' + ) THEN + INSERT INTO `cloud`.`extension_custom_action_details` ( + `extension_custom_action_id`, + `name`, + `value`, + `display` + ) VALUES ( + action_id, + 'parameters', + param_json, + 0 + ) +; END IF +;END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_if_not_exists.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_if_not_exists.sql new file mode 100644 index 000000000000..9dbffa630f84 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_custom_action_if_not_exists.sql @@ -0,0 +1,46 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN action_name VARCHAR(255), + IN action_desc VARCHAR(4096), + IN resource_type VARCHAR(255), + IN allowed_roles INT UNSIGNED, + IN success_msg VARCHAR(4096), + IN error_msg VARCHAR(4096), + IN timeout_seconds INT UNSIGNED +) +BEGIN + DECLARE ext_id BIGINT +; SELECT `id` INTO ext_id FROM `cloud`.`extension` WHERE `name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_custom_action` WHERE `name` = action_name AND `extension_id` = ext_id + ) THEN + INSERT INTO `cloud`.`extension_custom_action` ( + `uuid`, `name`, `description`, `extension_id`, `resource_type`, + `allowed_role_types`, `success_message`, `error_message`, + `enabled`, `timeout`, `created`, `removed` + ) + VALUES ( + UUID(), action_name, action_desc, ext_id, resource_type, + allowed_roles, success_msg, error_msg, + 1, timeout_seconds, NOW(), NULL + ) +; END IF +;END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_detail_if_not_exists.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_detail_if_not_exists.sql new file mode 100644 index 000000000000..f9d6c5da9512 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_detail_if_not_exists.sql @@ -0,0 +1,39 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN detail_key VARCHAR(255), + IN detail_value TEXT, + IN display TINYINT(1) +) +BEGIN + DECLARE ext_id BIGINT +; SELECT `id` INTO ext_id FROM `cloud`.`extension` WHERE `name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_details` + WHERE `extension_id` = ext_id AND `name` = detail_key + ) THEN + INSERT INTO `cloud`.`extension_details` ( + `extension_id`, `name`, `value`, `display` + ) + VALUES ( + ext_id, detail_key, detail_value, display + ) +; END IF +;END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_if_not_exists.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_if_not_exists.sql new file mode 100644 index 000000000000..8d74f9b2a986 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.insert_extension_if_not_exists.sql @@ -0,0 +1,38 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN ext_desc VARCHAR(255), + IN ext_path VARCHAR(255) +) +BEGIN + IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension` WHERE `name` = ext_name + ) THEN + INSERT INTO `cloud`.`extension` ( + `uuid`, `name`, `description`, `type`, + `relative_path`, `path_ready`, + `is_user_defined`, `state`, `created`, `removed` + ) + VALUES ( + UUID(), ext_name, ext_desc, 'Orchestrator', + ext_path, 1, 0, 'Enabled', NOW(), NULL + ) +; END IF +;END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_category_for_guest_oses.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_category_for_guest_oses.sql new file mode 100644 index 000000000000..87f3a85d27ef --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_category_for_guest_oses.sql @@ -0,0 +1,33 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- Move existing guest OS to new categories +DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`; +CREATE PROCEDURE `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`(IN category_name VARCHAR(255), IN os_name VARCHAR(255)) +BEGIN + DECLARE category_id BIGINT +; SELECT `id` INTO category_id + FROM `cloud`.`guest_os_category` + WHERE `name` = category_name + LIMIT 1 +; IF category_id IS NULL THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Category not found' +; END IF +; UPDATE `cloud`.`guest_os` + SET `category_id` = category_id + WHERE `display_name` LIKE CONCAT('%', os_name, '%') +; END; diff --git a/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_new_and_delete_old_category_for_guest_os.sql b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_new_and_delete_old_category_for_guest_os.sql new file mode 100644 index 000000000000..42f7aa738cff --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/procedures/cloud.update_new_and_delete_old_category_for_guest_os.sql @@ -0,0 +1,35 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- Move existing guest OS whose category will be deleted to Other category +DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`; +CREATE PROCEDURE `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`(IN to_category_name VARCHAR(255), IN from_category_name VARCHAR(255)) +BEGIN + DECLARE done INT DEFAULT 0 +; DECLARE to_category_id BIGINT +; SELECT id INTO to_category_id + FROM `cloud`.`guest_os_category` + WHERE `name` = to_category_name + LIMIT 1 +; IF to_category_id IS NULL THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'ToCategory not found' +; END IF +; UPDATE `cloud`.`guest_os` + SET `category_id` = to_category_id + WHERE `category_id` = (SELECT `id` FROM `cloud`.`guest_os_category` WHERE `name` = from_category_name) +; UPDATE `cloud`.`guest_os_category` SET `removed`=now() WHERE `name` = from_category_name +; END; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-307to410.sql b/engine/schema/src/main/resources/META-INF/db/schema-307to410.sql index 55d78b594377..3b0cfa8e6ce3 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-307to410.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-307to410.sql @@ -3,7 +3,7 @@ -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliances +-- "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 diff --git a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql b/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql index 35f73b35d3ca..d62a9bb93034 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql @@ -2305,7 +2305,7 @@ CREATE TABLE `cloud_usage`.`usage_vmsnapshot` ( ) ENGINE=InnoDB CHARSET=utf8; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'healthcheck.update.interval', '600', 'Time Interval to fetch the LB health check states (in sec)'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'kvm.snapshot.enabled', 'false', 'whether snapshot is enabled for KVM hosts'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'kvm.snapshot.enabled', 'true', 'whether snapshot is enabled for KVM hosts'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'eip.use.multiple.netscalers', 'false', 'Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Snapshots', 'DEFAULT', 'SnapshotManager', 'snapshot.backup.rightafter', 'true', 'backup snapshot right after snapshot is taken'); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql index c36b71c2f250..eec4ac3f0280 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql @@ -55,7 +55,7 @@ UPDATE `cloud`.`service_offering` SET ram_size = 512 WHERE unique_name IN ("Clou AND system_use = 1 AND ram_size < 512; -- NSX Plugin -- -CREATE TABLE `cloud`.`nsx_providers` ( +CREATE TABLE IF NOT EXISTS `cloud`.`nsx_providers` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `uuid` varchar(40), `zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID', diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql index bf13e5eee1ac..4405250f2711 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql @@ -19,13 +19,19 @@ -- Schema upgrade from 4.20.0.0 to 4.20.1.0 --; +-- Delete user vm details for guest CPU mode/model which are root admin only +DELETE FROM `cloud`.`user_vm_details` WHERE `name` IN ('guest.cpu.mode','guest.cpu.model'); + +-- Delete template details for guest CPU mode/model which are root admin only +DELETE FROM `cloud`.`vm_template_details` WHERE `name` IN ('guest.cpu.mode','guest.cpu.model'); + -- Add column api_key_access to user and account tables CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user', 'api_key_access', 'boolean DEFAULT NULL COMMENT "is api key access allowed for the user" AFTER `secret_key`'); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.account', 'api_key_access', 'boolean DEFAULT NULL COMMENT "is api key access allowed for the account" '); CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.account', 'api_key_access', 'boolean DEFAULT NULL COMMENT "is api key access allowed for the account" '); -- Create a new group for Usage Server related configurations -INSERT INTO `cloud`.`configuration_group` (`name`, `description`, `precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9); +INSERT IGNORE INTO `cloud`.`configuration_group` (`name`, `description`, `precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9); UPDATE `cloud`.`configuration_subgroup` set `group_id` = (SELECT `id` FROM `cloud`.`configuration_group` WHERE `name` = 'Usage Server'), `precedence` = 1 WHERE `name`='Usage'; UPDATE `cloud`.`configuration` SET `group_id` = (SELECT `id` FROM `cloud`.`configuration_group` WHERE `name` = 'Usage Server') where `subgroup_id` = (SELECT `id` FROM `cloud`.`configuration_subgroup` WHERE `name` = 'Usage'); @@ -47,3 +53,81 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.storage_pool', 'used_iops', 'bigint -- Add reason column for op_ha_work CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.op_ha_work', 'reason', 'varchar(32) DEFAULT NULL COMMENT "Reason for the HA work"'); + +-- Support for XCP-ng 8.3.0 and XenServer 8.4 by adding hypervisor capabilities +-- https://docs.xenserver.com/en-us/xenserver/8/system-requirements/configuration-limits.html +-- https://docs.xenserver.com/en-us/citrix-hypervisor/system-requirements/configuration-limits.html +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported) VALUES (UUID(), 'XenServer', '8.3.0', 1000, 254, 64, 1); +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported) VALUES (UUID(), 'XenServer', '8.4.0', 1000, 240, 64, 1); + +-- Add missing and new Guest OS mappings +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 10 (64-bit)', 'XenServer', '8.2.1', 'Debian Buster 10'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 15 (64-bit)', 'XenServer', '8.2.1', 'SUSE Linux Enterprise 15 (64-bit)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2022 (64-bit)', 'XenServer', '8.2.1', 'Windows Server 2022 (64-bit)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows 11 (64-bit)', 'XenServer', '8.2.1', 'Windows 11'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 20.04 LTS', 'XenServer', '8.2.1', 'Ubuntu Focal Fossa 20.04'); + +-- Copy XS 8.2.1 hypervisor guest OS mappings to XS 8.3 and 8.3 mappings to 8.4 +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '8.3.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.2.1'; + +-- Add new and missing guest os mappings for XS 8.3 +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'Rocky Linux 9', 'XenServer', '8.3.0', 'Rocky Linux 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'Rocky Linux 8', 'XenServer', '8.3.0', 'Rocky Linux 8'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'AlmaLinux 9', 'XenServer', '8.3.0', 'AlmaLinux 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'AlmaLinux 8', 'XenServer', '8.3.0', 'AlmaLinux 8'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 12 (64-bit)', 'XenServer', '8.3.0', 'Debian Bookworm 12'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (3, 'Oracle Linux 9', 'XenServer', '8.3.0', 'Oracle Linux 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (3, 'Oracle Linux 8', 'XenServer', '8.3.0', 'Oracle Linux 8'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Red Hat Enterprise Linux 8.0', 'XenServer', '8.3.0', 'Red Hat Enterprise Linux 8'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Red Hat Enterprise Linux 9.0', 'XenServer', '8.3.0', 'Red Hat Enterprise Linux 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 22.04 LTS', 'XenServer', '8.3.0', 'Ubuntu Jammy Jellyfish 22.04'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 12 SP5 (64-bit)', 'XenServer', '8.3.0', 'SUSE Linux Enterprise Server 12 SP5 (64-bit'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'NeoKylin Linux Server 7', 'XenServer', '8.3.0', 'NeoKylin Linux Server 7'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 9', 'XenServer', '8.3.0', 'CentOS Stream 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Scientific Linux 7', 'XenServer', '8.3.0', 'Scientific Linux 7'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (7, 'Generic Linux UEFI', 'XenServer', '8.3.0', 'Generic Linux UEFI'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (7, 'Generic Linux BIOS', 'XenServer', '8.3.0', 'Generic Linux BIOS'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Gooroom Platform 2.0', 'XenServer', '8.3.0', 'Gooroom Platform 2.0'); + +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '8.4.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.3.0'; + +-- Add new guest os mappings for XS 8.4 and KVM +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2025', 'XenServer', '8.4.0', 'Windows Server 2025'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 24.04 LTS', 'XenServer', '8.4.0', 'Ubuntu Noble Numbat 24.04'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 10 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 10 (64-bit)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 11 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 11 (64-bit)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 12 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 12 (64-bit)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows 11 (64-bit)', 'KVM', 'default', 'Windows 11'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2025', 'KVM', 'default', 'Windows Server 2025'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 24.04 LTS', 'KVM', 'default', 'Ubuntu 24.04 LTS'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 10 (preview)', 'XenServer', '8.4.0', 'CentOS Stream 10 (preview)'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 9', 'XenServer', '8.4.0', 'CentOS Stream 9'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Scientific Linux 7', 'XenServer', '8.4.0', 'Scientific Linux 7'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'NeoKylin Linux Server 7', 'XenServer', '8.4.0', 'NeoKylin Linux Server 7'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 12 SP5 (64-bit)', 'XenServer', '8.4.0', 'SUSE Linux Enterprise Server 12 SP5 (64-bit'); +CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Gooroom Platform 2.0', 'XenServer', '8.4.0', 'Gooroom Platform 2.0'); + +-- Grant access to 2FA APIs for the "Read-Only User - Default" role + +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only User - Default', 'setupUserTwoFactorAuthentication', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only User - Default', 'validateUserTwoFactorAuthenticationCode', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only User - Default', 'listUserTwoFactorAuthenticatorProviders', 'ALLOW'); + +-- Grant access to 2FA APIs for the "Support User - Default" role + +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support User - Default', 'setupUserTwoFactorAuthentication', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support User - Default', 'validateUserTwoFactorAuthenticationCode', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support User - Default', 'listUserTwoFactorAuthenticatorProviders', 'ALLOW'); + +-- Grant access to 2FA APIs for the "Read-Only Admin - Default" role + +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only Admin - Default', 'setupUserTwoFactorAuthentication', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only Admin - Default', 'validateUserTwoFactorAuthenticationCode', 'ALLOW'); + +-- Grant access to 2FA APIs for the "Support Admin - Default" role + +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support Admin - Default', 'setupUserTwoFactorAuthentication', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Support Admin - Default', 'validateUserTwoFactorAuthenticationCode', 'ALLOW'); + +-- Re-apply VPC: update default network offering for vpc tier to conserve_mode=1 (#8309) +UPDATE `cloud`.`network_offerings` SET conserve_mode=1 WHERE name='DefaultIsolatedNetworkOfferingForVpcNetworks'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql b/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql index b01243ad989d..000b54b72078 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql @@ -19,9 +19,13 @@ -- Schema upgrade from 4.20.1.0 to 4.21.0.0 --; --- Add columns max_backup and backup_interval_type to backup table -ALTER TABLE `cloud`.`backup_schedule` ADD COLUMN `max_backups` int(8) default NULL COMMENT 'maximum number of backups to maintain'; -ALTER TABLE `cloud`.`backups` ADD COLUMN `backup_interval_type` int(5) COMMENT 'type of backup, e.g. manual, recurring - hourly, daily, weekly or monthly'; +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule', 'max_backups', 'INT(8) UNSIGNED NOT NULL DEFAULT 0 COMMENT ''Maximum number of backups to be retained'''); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'backup_schedule_id', 'BIGINT(20) UNSIGNED'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule', 'quiescevm', 'tinyint(1) default NULL COMMENT "Quiesce VM before taking backup"'); + +-- Update default value for the config 'vm.network.nic.max.secondary.ipaddresses' (and value to default value if value is null) +UPDATE `cloud`.`configuration` SET default_value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses'; +UPDATE `cloud`.`configuration` SET value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses' AND value IS NULL; -- Add console_endpoint_creator_address column to cloud.console_session table CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.console_session', 'console_endpoint_creator_address', 'VARCHAR(45)'); @@ -34,6 +38,724 @@ INSERT INTO `cloud`.`role_permissions` (uuid, role_id, rule, permission, sort_or SELECT uuid(), role_id, 'quotaCreditsList', permission, sort_order FROM `cloud`.`role_permissions` rp WHERE rp.rule = 'quotaStatement' -AND NOT EXISTS(SELECT 1 FROM cloud.role_permissions rp_ WHERE rp.role_id = rp_.role_id AND rp_.rule = 'quotaCreditsList'); + AND NOT EXISTS(SELECT 1 FROM cloud.role_permissions rp_ WHERE rp.role_id = rp_.role_id AND rp_.rule = 'quotaCreditsList'); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host', 'last_mgmt_server_id', 'bigint unsigned DEFAULT NULL COMMENT "last management server this host is connected to" AFTER `mgmt_server_id`'); + +----------------------------------------------------------- +-- CKS Enhancements: +----------------------------------------------------------- +-- Add for_cks column to the vm_template table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template','for_cks', 'int(1) unsigned DEFAULT "0" COMMENT "if true, the template can be used for CKS cluster deployment"'); + +-- Add support for different node types service offerings on CKS clusters +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','control_node_service_offering_id', 'bigint unsigned COMMENT "service offering ID for Control Node(s)"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','worker_node_service_offering_id', 'bigint unsigned COMMENT "service offering ID for Worker Node(s)"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_service_offering_id', 'bigint unsigned COMMENT "service offering ID for etcd Nodes"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_count', 'bigint unsigned COMMENT "number of etcd nodes to be deployed for the Kubernetes cluster"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','control_node_template_id', 'bigint unsigned COMMENT "template id to be used for Control Node(s)"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','worker_node_template_id', 'bigint unsigned COMMENT "template id to be used for Worker Node(s)"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_template_id', 'bigint unsigned COMMENT "template id to be used for etcd Nodes"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','cni_config_id', 'bigint unsigned COMMENT "user data id representing the associated cni configuration"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','cni_config_details', 'varchar(4096) DEFAULT NULL COMMENT "user data details representing the values required for the cni configuration associated"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','etcd_node', 'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the VM is an etcd node"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','external_node', 'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the node was imported into the Kubernetes cluster"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','manual_upgrade', 'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the node is marked for manual upgrade and excluded from the Kubernetes cluster upgrade operation"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','kubernetes_node_version', 'varchar(40) COMMENT "version of k8s the cluster node is on"'); + +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__control_node_service_offering_id` FOREIGN KEY `fk_cluster__control_node_service_offering_id`(`control_node_service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__worker_node_service_offering_id` FOREIGN KEY `fk_cluster__worker_node_service_offering_id`(`worker_node_service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__etcd_node_service_offering_id` FOREIGN KEY `fk_cluster__etcd_node_service_offering_id`(`etcd_node_service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__control_node_template_id` FOREIGN KEY `fk_cluster__control_node_template_id`(`control_node_template_id`) REFERENCES `vm_template`(`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__worker_node_template_id` FOREIGN KEY `fk_cluster__worker_node_template_id`(`worker_node_template_id`) REFERENCES `vm_template`(`id`) ON DELETE CASCADE; +ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT `fk_cluster__etcd_node_template_id` FOREIGN KEY `fk_cluster__etcd_node_template_id`(`etcd_node_template_id`) REFERENCES `vm_template`(`id`) ON DELETE CASCADE; + +-- Add for_cks column to the user_data table to represent CNI Configuration stored as userdata +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_data','for_cks', 'int(1) unsigned DEFAULT "0" COMMENT "if true, the user data represent CNI configuration meant for CKS use only"'); + +-- Add use VR IP as resolver option on VPC +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc','use_router_ip_resolver', 'tinyint(1) DEFAULT 0 COMMENT "use router ip as resolver instead of dns options"'); +----------------------------------------------------------- +-- END - CKS Enhancements +----------------------------------------------------------- + +-- Add table for reconcile commands +CREATE TABLE IF NOT EXISTS `cloud`.`reconcile_commands` ( + `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT, + `management_server_id` bigint unsigned NOT NULL COMMENT 'node id of the management server', + `host_id` bigint unsigned NOT NULL COMMENT 'id of the host', + `request_sequence` bigint unsigned NOT NULL COMMENT 'sequence of the request', + `resource_id` bigint unsigned DEFAULT NULL COMMENT 'id of the resource', + `resource_type` varchar(255) COMMENT 'type if the resource', + `state_by_management` varchar(255) COMMENT 'state of the command updated by management server', + `state_by_agent` varchar(255) COMMENT 'state of the command updated by cloudstack agent', + `command_name` varchar(255) COMMENT 'name of the command', + `command_info` MEDIUMTEXT COMMENT 'info of the command', + `answer_name` varchar(255) COMMENT 'name of the answer', + `answer_info` MEDIUMTEXT COMMENT 'info of the answer', + `created` datetime COMMENT 'date the reconcile command was created', + `removed` datetime COMMENT 'date the reconcile command was removed', + `updated` datetime COMMENT 'date the reconcile command was updated', + `retry_count` bigint unsigned DEFAULT 0 COMMENT 'The retry count of reconciliation', + PRIMARY KEY(`id`), + INDEX `i_reconcile_command__host_id`(`host_id`), + CONSTRAINT `fk_reconcile_command__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +--- KVM Incremental Snapshots + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.snapshot_store_ref', 'kvm_checkpoint_path', 'varchar(255)'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.snapshot_store_ref', 'end_of_chain', 'int(1) unsigned'); + +-- Create table storage_pool_and_access_group_map +CREATE TABLE IF NOT EXISTS `cloud`.`storage_pool_and_access_group_map` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `pool_id` bigint(20) unsigned NOT NULL COMMENT "pool id", + `storage_access_group` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_storage_pool_and_access_group_map__pool_id` (`pool_id`), + CONSTRAINT `fk_storage_pool_and_access_group_map__pool_id` FOREIGN KEY (`pool_id`) REFERENCES `storage_pool` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the host"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.cluster', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the cluster"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host_pod_ref', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the pod"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the zone"'); + +-- Add featured, sort_key, created, removed columns for guest_os_category +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'featured', 'tinyint(1) NOT NULL DEFAULT 0 COMMENT "whether the category is featured or not" AFTER `uuid`'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'sort_key', 'int NOT NULL DEFAULT 0 COMMENT "sort key used for customising sort method" AFTER `featured`'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'created', 'datetime COMMENT "date on which the category was created" AFTER `sort_key`'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.guest_os_category', 'removed', 'datetime COMMENT "date removed if not null" AFTER `created`'); + +-- Begin: Changes for Guest OS category cleanup +-- Add new OS categories if not present +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`; +CREATE PROCEDURE `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`(IN os_name VARCHAR(255)) +BEGIN + IF NOT EXISTS ((SELECT 1 FROM `cloud`.`guest_os_category` WHERE name = os_name)) + THEN + INSERT INTO `cloud`.`guest_os_category` (name, uuid) + VALUES (os_name, UUID()) +; END IF +; END; + +CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Fedora'); +CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('Rocky Linux'); +CALL `cloud`.`INSERT_CATEGORY_IF_NOT_EXIST`('AlmaLinux'); + +-- Move existing guest OS to new categories +DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`; +CREATE PROCEDURE `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`(IN category_name VARCHAR(255), IN os_name VARCHAR(255)) +BEGIN + DECLARE category_id BIGINT +; SELECT `id` INTO category_id + FROM `cloud`.`guest_os_category` + WHERE `name` = category_name + LIMIT 1 +; IF category_id IS NULL THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Category not found' +; END IF +; UPDATE `cloud`.`guest_os` + SET `category_id` = category_id + WHERE `display_name` LIKE CONCAT('%', os_name, '%') +; END; +CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Rocky Linux', 'Rocky Linux'); +CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('AlmaLinux', 'AlmaLinux'); +CALL `cloud`.`UPDATE_CATEGORY_FOR_GUEST_OSES`('Fedora', 'Fedora'); + +-- Move existing guest OS whose category will be deleted to Other category +DROP PROCEDURE IF EXISTS `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`; +CREATE PROCEDURE `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`(IN to_category_name VARCHAR(255), IN from_category_name VARCHAR(255)) +BEGIN + DECLARE done INT DEFAULT 0 +; DECLARE to_category_id BIGINT +; SELECT id INTO to_category_id + FROM `cloud`.`guest_os_category` + WHERE `name` = to_category_name + LIMIT 1 +; IF to_category_id IS NULL THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'ToCategory not found' +; END IF +; UPDATE `cloud`.`guest_os` + SET `category_id` = to_category_id + WHERE `category_id` = (SELECT `id` FROM `cloud`.`guest_os_category` WHERE `name` = from_category_name) +; UPDATE `cloud`.`guest_os_category` SET `removed`=now() WHERE `name` = from_category_name +; END; +CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Novel'); +CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'None'); +CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Unix'); +CALL `cloud`.`UPDATE_NEW_AND_DELETE_OLD_CATEGORY_FOR_GUEST_OS`('Other', 'Mac'); + +-- Update featured for existing guest OS categories +UPDATE `cloud`.`guest_os_category` SET featured = 1; + +-- Update sort order for all guest OS categories +UPDATE `cloud`.`guest_os_category` +SET `sort_key` = CASE + WHEN `name` = 'Ubuntu' THEN 1 + WHEN `name` = 'Debian' THEN 2 + WHEN `name` = 'Fedora' THEN 3 + WHEN `name` = 'CentOS' THEN 4 + WHEN `name` = 'Rocky Linux' THEN 5 + WHEN `name` = 'AlmaLinux' THEN 6 + WHEN `name` = 'Oracle' THEN 7 + WHEN `name` = 'RedHat' THEN 8 + WHEN `name` = 'SUSE' THEN 9 + WHEN `name` = 'Windows' THEN 10 + WHEN `name` = 'Other' THEN 11 + ELSE `sort_key` +END; +-- End: Changes for Guest OS category cleanup + +-- Update description for configuration: host.capacityType.to.order.clusters +UPDATE `cloud`.`configuration` SET + `description` = 'The host capacity type (CPU, RAM or COMBINED) is used by deployment planner to order clusters during VM resource allocation' +WHERE `name` = 'host.capacityType.to.order.clusters' + AND `description` = 'The host capacity type (CPU or RAM) is used by deployment planner to order clusters during VM resource allocation'; + +-- Whitelabel GUI +CREATE TABLE IF NOT EXISTS `cloud`.`gui_themes` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `uuid` varchar(255) UNIQUE, + `name` varchar(2048) NOT NULL COMMENT 'A name to identify the theme.', + `description` varchar(4096) DEFAULT NULL COMMENT 'A description for the theme.', + `css` text DEFAULT NULL COMMENT 'The CSS to be retrieved and imported into the GUI when matching the theme access configurations.', + `json_configuration` text DEFAULT NULL COMMENT 'The JSON with the configurations to be retrieved and imported into the GUI when matching the theme access configurations.', + `recursive_domains` tinyint(1) DEFAULT 0 COMMENT 'Defines whether the subdomains of the informed domains are considered. Default value is false.', + `is_public` tinyint(1) default 1 COMMENT 'Defines whether a theme can be retrieved by anyone when only the `internet_domains_names` is informed. If the `domain_uuids` or `account_uuids` is informed, it is considered as `false`.', + `created` datetime NOT NULL, + `removed` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +); + +CREATE TABLE IF NOT EXISTS `cloud`.`gui_themes_details` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `gui_theme_id` bigint(20) unsigned NOT NULL COMMENT 'Foreign key referencing the GUI theme on `gui_themes` table.', + `type` varchar(100) NOT NULL COMMENT 'The type of GUI theme details. Valid options are: `account`, `domain` and `commonName`', + `value` text NOT NULL COMMENT 'The value of the `type` details. Can be an UUID (account or domain) or internet common name.', + PRIMARY KEY (`id`), + CONSTRAINT `fk_gui_themes_details__gui_theme_id` FOREIGN KEY (`gui_theme_id`) REFERENCES `gui_themes`(`id`) +); + +-- Create the GPU card table to hold the GPU card information +CREATE TABLE IF NOT EXISTS `cloud`.`gpu_card` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) NOT NULL UNIQUE, + `device_id` varchar(4) NOT NULL COMMENT 'device id of the GPU card', + `device_name` varchar(255) NOT NULL COMMENT 'device name of the GPU card', + `name` varchar(255) NOT NULL COMMENT 'name of the GPU card', + `vendor_name` varchar(255) NOT NULL COMMENT 'vendor name of the GPU card', + `vendor_id` varchar(4) NOT NULL COMMENT 'vendor id of the GPU card', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + UNIQUE KEY (`vendor_id`, `device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='GPU cards supported by CloudStack'; + +-- Create the vGPU profile table to hold the vGPU profile information. +CREATE TABLE IF NOT EXISTS `cloud`.`vgpu_profile` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) NOT NULL UNIQUE, + `name` varchar(255) NOT NULL COMMENT 'name of the vGPU profile', + `description` varchar(255) DEFAULT NULL COMMENT 'description of the vGPU profile', + `card_id` bigint unsigned NOT NULL COMMENT 'id of the GPU card', + `video_ram` bigint unsigned DEFAULT NULL COMMENT 'video RAM of the vGPU profile', + `max_heads` bigint unsigned DEFAULT NULL COMMENT 'maximum number of heads of the vGPU profile', + `max_resolution_x` bigint unsigned DEFAULT NULL COMMENT 'maximum resolution x of the vGPU profile', + `max_resolution_y` bigint unsigned DEFAULT NULL COMMENT 'maximum resolution y of the vGPU profile', + `max_vgpu_per_pgpu` bigint unsigned DEFAULT NULL COMMENT 'Maximum number of vGPUs per physical GPU', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + UNIQUE KEY (`name`, `card_id`), + CONSTRAINT `fk_vgpu_profile_card_id` FOREIGN KEY (`card_id`) REFERENCES `gpu_card`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='vGPU profiles supported by CloudStack'; + +-- Create the GPU device table to hold the GPU device information on different hosts +CREATE TABLE IF NOT EXISTS `cloud`.`gpu_device` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) NOT NULL UNIQUE, + `card_id` bigint unsigned NOT NULL COMMENT 'id of the GPU card', + `vgpu_profile_id` bigint unsigned DEFAULT NULL COMMENT 'id of the vGPU profile.', + `bus_address` varchar(255) NOT NULL COMMENT 'PCI bus address of the GPU device', + `type` varchar(32) NOT NULL COMMENT 'type of the GPU device. PCI or MDEV', + `host_id` bigint unsigned NOT NULL COMMENT 'id of the host where GPU is installed', + `vm_id` bigint unsigned DEFAULT NULL COMMENT 'id of the VM using this GPU device', + `numa_node` varchar(255) DEFAULT NULL COMMENT 'NUMA node of the GPU device', + `pci_root` varchar(255) DEFAULT NULL COMMENT 'PCI root of the GPU device', + `parent_gpu_device_id` bigint unsigned DEFAULT NULL COMMENT 'id of the parent GPU device. null if it is a physical GPU device and for vGPUs points to the actual GPU', + `state` varchar(32) NOT NULL COMMENT 'state of the GPU device', + `managed_state` varchar(32) NOT NULL COMMENT 'resource state of the GPU device', + PRIMARY KEY (`id`), + UNIQUE KEY (`bus_address`, `host_id`), + CONSTRAINT `fk_gpu_devices__card_id` FOREIGN KEY (`card_id`) REFERENCES `gpu_card` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_gpu_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_gpu_devices__vm_id` FOREIGN KEY (`vm_id`) REFERENCES `vm_instance` (`id`) ON DELETE SET NULL, + CONSTRAINT `fk_gpu_devices__parent_gpu_device_id` FOREIGN KEY (`parent_gpu_device_id`) REFERENCES `gpu_device` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='GPU devices installed on hosts'; + +-- Add references to GPU tables +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.service_offering', 'vgpu_profile_id', 'bigint unsigned DEFAULT NULL COMMENT "vgpu profile ID"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.service_offering', 'gpu_count', 'int unsigned DEFAULT NULL COMMENT "number of GPUs"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.service_offering', 'gpu_display', 'boolean DEFAULT false COMMENT "enable GPU display"'); +CALL `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`('cloud.service_offering','fk_service_offering__vgpu_profile_id'); +CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.service_offering', 'fk_service_offering__vgpu_profile_id', '(vgpu_profile_id)', '`vgpu_profile`(`id`)'); + +-- Netris Plugin +CREATE TABLE IF NOT EXISTS `cloud`.`netris_providers` ( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `uuid` varchar(40), + `zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID', + `host_id` bigint unsigned NOT NULL COMMENT 'Host ID', + `name` varchar(40), + `url` varchar(255) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `site_name` varchar(255) NOT NULL, + `tenant_name` varchar(255) NOT NULL, + `netris_tag` varchar(255) NOT NULL, + `created` datetime NOT NULL COMMENT 'created date', + `removed` datetime COMMENT 'removed date if not null', + PRIMARY KEY (`id`), + CONSTRAINT `fk_netris_providers__zone_id` FOREIGN KEY `fk_netris_providers__zone_id` (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, + INDEX `i_netris_providers__zone_id`(`zone_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Drop the Tungsten and NSX columns from the network offerings (replaced by checking the provider on the ntwk_offering_service_map table) +CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.network_offerings', 'for_tungsten'); +CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.network_offerings', 'for_nsx'); + +-- Drop the Tungsten and NSX columns from the VPC offerings (replaced by checking the provider on the vpc_offering_service_map table) +CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.vpc_offerings', 'for_nsx'); + +-- Add next_hop to the static_routes table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.static_routes', 'next_hop', 'varchar(50) COMMENT "next hop of the static route" AFTER `vpc_gateway_id`'); + +-- Add `for_router` to `user_ip_address` table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_ip_address', 'for_router', 'tinyint(1) DEFAULT 0 COMMENT "True if the ip address is used by Domain Router to expose services"'); + +-- Add Netris Autoscaling rules +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW()); +INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW()); + +-- Rename user_vm_details to vm_instance_details +ALTER TABLE `cloud`.`user_vm_details` RENAME TO `cloud`.`vm_instance_details`; +ALTER TABLE `cloud`.`vm_instance_details` DROP FOREIGN KEY `fk_user_vm_details__vm_id`; +ALTER TABLE `cloud`.`vm_instance_details` ADD CONSTRAINT `fk_vm_instance_details__vm_id` FOREIGN KEY (vm_id) REFERENCES vm_instance(id) ON DELETE CASCADE; + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule', 'uuid', 'VARCHAR(40) NOT NULL'); +UPDATE `cloud`.`backup_schedule` SET uuid = UUID(); + +-- Extension framework +UPDATE `cloud`.`configuration` SET value = CONCAT(value, ',External') WHERE name = 'hypervisor.list'; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(40) NOT NULL UNIQUE, + `name` varchar(255) NOT NULL, + `description` varchar(4096), + `type` varchar(255) NOT NULL COMMENT 'Type of the extension: Orchestrator, etc', + `relative_path` varchar(2048) NOT NULL COMMENT 'Path for the extension relative to the root extensions directory', + `path_ready` tinyint(1) DEFAULT '0' COMMENT 'True if the extension path is in ready state across management servers', + `is_user_defined` tinyint(1) DEFAULT '0' COMMENT 'True if the extension is added by admin', + `state` char(32) NOT NULL COMMENT 'State of the extension - Enabled or Disabled', + `created` datetime NOT NULL, + `removed` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension_details` ( + `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT COMMENT 'id', + `extension_id` bigint unsigned NOT NULL COMMENT 'extension to which the detail is related to', + `name` varchar(255) NOT NULL COMMENT 'name of the detail', + `value` varchar(255) NOT NULL COMMENT 'value of the detail', + `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_extension_details__extension_id` FOREIGN KEY (`extension_id`) + REFERENCES `extension` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension_resource_map` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `extension_id` bigint(20) unsigned NOT NULL, + `resource_id` bigint(20) unsigned NOT NULL, + `resource_type` char(255) NOT NULL, + `created` datetime NOT NULL, + `removed` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_extension_resource_map__extension_id` FOREIGN KEY (`extension_id`) + REFERENCES `cloud`.`extension`(`id`) ON DELETE CASCADE, + INDEX `idx_extension_resource` (`resource_id`, `resource_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension_resource_map_details` ( + `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT COMMENT 'id', + `extension_resource_map_id` bigint unsigned NOT NULL COMMENT 'mapping to which the detail is related', + `name` varchar(255) NOT NULL COMMENT 'name of the detail', + `value` varchar(255) NOT NULL COMMENT 'value of the detail', + `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_extension_resource_map_details__map_id` FOREIGN KEY (`extension_resource_map_id`) + REFERENCES `extension_resource_map` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension_custom_action` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) NOT NULL UNIQUE, + `name` varchar(255) NOT NULL, + `description` varchar(4096), + `extension_id` bigint(20) unsigned NOT NULL, + `resource_type` varchar(255), + `allowed_role_types` int unsigned NOT NULL DEFAULT '1', + `success_message` varchar(4096), + `error_message` varchar(4096), + `enabled` boolean DEFAULT true, + `timeout` int unsigned NOT NULL DEFAULT '5' COMMENT 'The timeout in seconds to wait for the action to complete before failing', + `created` datetime NOT NULL, + `removed` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_extension_custom_action__extension_id` FOREIGN KEY (`extension_id`) + REFERENCES `cloud`.`extension`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`extension_custom_action_details` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `extension_custom_action_id` bigint(20) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `value` TEXT NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`), + CONSTRAINT `fk_custom_action_details__action_id` FOREIGN KEY (`extension_custom_action_id`) + REFERENCES `cloud`.`extension_custom_action`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template', 'extension_id', 'bigint unsigned DEFAULT NULL COMMENT "id of the extension"'); + +-- Add built-in Extensions and Custom Actions + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN ext_desc VARCHAR(255), + IN ext_path VARCHAR(255) +) +BEGIN + IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension` WHERE `name` = ext_name + ) THEN + INSERT INTO `cloud`.`extension` ( + `uuid`, `name`, `description`, `type`, + `relative_path`, `path_ready`, + `is_user_defined`, `state`, `created`, `removed` + ) + VALUES ( + UUID(), ext_name, ext_desc, 'Orchestrator', + ext_path, 1, 0, 'Enabled', NOW(), NULL + ) +; END IF +;END; + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN detail_key VARCHAR(255), + IN detail_value TEXT, + IN display TINYINT(1) +) +BEGIN + DECLARE ext_id BIGINT +; SELECT `id` INTO ext_id FROM `cloud`.`extension` WHERE `name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_details` + WHERE `extension_id` = ext_id AND `name` = detail_key + ) THEN + INSERT INTO `cloud`.`extension_details` ( + `extension_id`, `name`, `value`, `display` + ) + VALUES ( + ext_id, detail_key, detail_value, display + ) +; END IF +;END; + +CALL `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`('Proxmox', 'Sample extension for Proxmox written in bash', 'Proxmox/proxmox.sh'); +CALL `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`('Proxmox', 'orchestratorrequirespreparevm', 'true', 0); + +CALL `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`('HyperV', 'Sample extension for HyperV written in python', 'HyperV/hyperv.py'); + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`( + IN ext_name VARCHAR(255), + IN action_name VARCHAR(255), + IN action_desc VARCHAR(4096), + IN resource_type VARCHAR(255), + IN allowed_roles INT UNSIGNED, + IN success_msg VARCHAR(4096), + IN error_msg VARCHAR(4096), + IN timeout_seconds INT UNSIGNED +) +BEGIN + DECLARE ext_id BIGINT +; SELECT `id` INTO ext_id FROM `cloud`.`extension` WHERE `name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_custom_action` WHERE `name` = action_name AND `extension_id` = ext_id + ) THEN + INSERT INTO `cloud`.`extension_custom_action` ( + `uuid`, `name`, `description`, `extension_id`, `resource_type`, + `allowed_role_types`, `success_message`, `error_message`, + `enabled`, `timeout`, `created`, `removed` + ) + VALUES ( + UUID(), action_name, action_desc, ext_id, resource_type, + allowed_roles, success_msg, error_msg, + 1, timeout_seconds, NOW(), NULL + ) +; END IF +;END; + +DROP PROCEDURE IF EXISTS `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`; +CREATE PROCEDURE `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS` ( + IN ext_name VARCHAR(255), + IN action_name VARCHAR(255), + IN param_json TEXT +) +BEGIN + DECLARE action_id BIGINT UNSIGNED +; SELECT `eca`.`id` INTO action_id FROM `cloud`.`extension_custom_action` `eca` + JOIN `cloud`.`extension` `e` ON `e`.`id` = `eca`.`extension_id` + WHERE `eca`.`name` = action_name AND `e`.`name` = ext_name LIMIT 1 +; IF NOT EXISTS ( + SELECT 1 FROM `cloud`.`extension_custom_action_details` + WHERE `extension_custom_action_id` = action_id + AND `name` = 'parameters' + ) THEN + INSERT INTO `cloud`.`extension_custom_action_details` ( + `extension_custom_action_id`, + `name`, + `value`, + `display` + ) VALUES ( + action_id, + 'parameters', + param_json, + 0 + ) +; END IF +;END; + +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('Proxmox', 'ListSnapshots', 'List Instance snapshots', 'VirtualMachine', 15, 'Snapshots fetched for {{resourceName}} in {{extensionName}}', 'List Snapshots failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('Proxmox', 'CreateSnapshot', 'Create an Instance snapshot', 'VirtualMachine', 15, 'Snapshot created for {{resourceName}} in {{extensionName}}', 'Snapshot creation failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('Proxmox', 'RestoreSnapshot', 'Restore Instance to the specific snapshot', 'VirtualMachine', 15, 'Successfully restored snapshot for {{resourceName}} in {{extensionName}}', 'Restore snapshot failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('Proxmox', 'DeleteSnapshot', 'Delete the specified snapshot', 'VirtualMachine', 15, 'Successfully deleted snapshot for {{resourceName}} in {{extensionName}}', 'Delete snapshot failed for {{resourceName}}', 60); + +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'Proxmox', + 'ListSnapshots', + '[]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'Proxmox', + 'CreateSnapshot', + '[ + { + "name": "snap_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + }, + { + "name": "snap_description", + "type": "STRING", + "validationformat": "NONE", + "required": false + }, + { + "name": "snap_save_memory", + "type": "BOOLEAN", + "validationformat": "NONE", + "required": false + } + ]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'Proxmox', + 'RestoreSnapshot', + '[ + { + "name": "snap_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + } + ]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'Proxmox', + 'DeleteSnapshot', + '[ + { + "name": "snap_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + } + ]' +); + +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'ListSnapshots', 'List checkpoints/snapshots for the Instance', 'VirtualMachine', 15, 'Snapshots fetched for {{resourceName}} in {{extensionName}}', 'List Snapshots failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'CreateSnapshot', 'Create a checkpoint/snapshot for the Instance', 'VirtualMachine', 15, 'Snapshot created for {{resourceName}} in {{extensionName}}', 'Snapshot creation failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'RestoreSnapshot', 'Restore Instance to the specified snapshot', 'VirtualMachine', 15, 'Successfully restored snapshot for {{resourceName}} in {{extensionName}}', 'Restore snapshot failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'DeleteSnapshot', 'Delete the specified snapshot', 'VirtualMachine', 15, 'Successfully deleted snapshot for {{resourceName}} in {{extensionName}}', 'Delete snapshot failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'Suspend', 'Suspend the Instance by freezing its current state in RAM', 'VirtualMachine', 15, 'Successfully suspended {{resourceName}} in {{extensionName}}', 'Suspend failed for {{resourceName}}', 60); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_IF_NOT_EXISTS`('HyperV', 'Resume', 'Resumes a suspended Instance, restoring CPU execution from memory.', 'VirtualMachine', 15, 'Successfully resumed {{resourceName}} in {{extensionName}}', 'Resume failed for {{resourceName}}', 60); + +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'ListSnapshots', + '[]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'CreateSnapshot', + '[ + { + "name": "snapshot_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + } + ]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'RestoreSnapshot', + '[ + { + "name": "snapshot_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + } + ]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'DeleteSnapshot', + '[ + { + "name": "snapshot_name", + "type": "STRING", + "validationformat": "NONE", + "required": true + } + ]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'Suspend', + '[]' +); +CALL `cloud`.`INSERT_EXTENSION_CUSTOM_ACTION_DETAILS_IF_NOT_EXISTS`( + 'HyperV', + 'Resume', + '[]' +); + +ALTER TABLE `cloud`.`networks` MODIFY COLUMN `cidr` varchar(255) DEFAULT NULL COMMENT 'CloudStack managed vms get IP address from cidr.In general this cidr also serves as the network CIDR. But in case IP reservation feature is being used by a Guest network, networkcidr is the Effective network CIDR for that network'; +ALTER TABLE `cloud`.`networks` MODIFY COLUMN `gateway` varchar(255) DEFAULT NULL COMMENT 'gateway(s) for this network configuration'; +ALTER TABLE `cloud`.`networks` MODIFY COLUMN `ip6_cidr` varchar(1024) DEFAULT NULL COMMENT 'IPv6 cidr(s) for this network'; +ALTER TABLE `cloud`.`networks` MODIFY COLUMN `ip6_gateway` varchar(1024) DEFAULT NULL COMMENT 'IPv6 gateway(s) for this network'; + +-- Add columns name, description and backup_interval_type to backup table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'name', 'VARCHAR(255) NULL COMMENT "name of the backup"'); +UPDATE `cloud`.`backups` backup INNER JOIN `cloud`.`vm_instance` vm ON backup.vm_id = vm.id SET backup.name = vm.name; +ALTER TABLE `cloud`.`backups` MODIFY COLUMN `name` VARCHAR(255) NOT NULL; +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'description', 'VARCHAR(1024) COMMENT "description for the backup"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'backup_interval_type', 'int(5) COMMENT "type of backup, e.g. manual, recurring - hourly, daily, weekly or monthly"'); + +-- Create backup details table +CREATE TABLE IF NOT EXISTS `cloud`.`backup_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `backup_id` bigint unsigned NOT NULL COMMENT 'backup id', + `name` varchar(255) NOT NULL, + `value` TEXT NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_backup_details__backup_id` FOREIGN KEY `fk_backup_details__backup_id`(`backup_id`) REFERENCES `backups`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Add diskOfferingId, deviceId, minIops and maxIops to backed_volumes in backups table +UPDATE `cloud`.`backups` b +INNER JOIN `cloud`.`vm_instance` vm ON b.vm_id = vm.id +SET b.backed_volumes = ( + SELECT COALESCE( + CAST( + JSON_ARRAYAGG( + JSON_OBJECT( + 'uuid', v.uuid, + 'type', v.volume_type, + 'size', v.size, + 'path', v.path, + 'deviceId', v.device_id, + 'diskOfferingId', doff.uuid, + 'minIops', v.min_iops, + 'maxIops', v.max_iops + ) + ) AS CHAR + ), + '[]' + ) + FROM `cloud`.`volumes` v + LEFT JOIN `cloud`.`disk_offering` doff ON v.disk_offering_id = doff.id + WHERE v.instance_id = vm.id +); + +-- Add diskOfferingId, deviceId, minIops and maxIops to backup_volumes in vm_instance table +UPDATE `cloud`.`vm_instance` vm +SET vm.backup_volumes = ( + SELECT COALESCE( + CAST( + JSON_ARRAYAGG( + JSON_OBJECT( + 'uuid', v.uuid, + 'type', v.volume_type, + 'size', v.size, + 'path', v.path, + 'deviceId', v.device_id, + 'diskOfferingId', doff.uuid, + 'minIops', v.min_iops, + 'maxIops', v.max_iops + ) + ) AS CHAR + ), + '[]' + ) + FROM `cloud`.`volumes` v + LEFT JOIN `cloud`.`disk_offering` doff ON v.disk_offering_id = doff.id + WHERE v.instance_id = vm.id +) +WHERE vm.backup_offering_id IS NOT NULL; + +-- Add column allocated_size to object_store table. Rename column 'used_bytes' to 'used_size' +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.object_store', 'allocated_size', 'bigint unsigned COMMENT "allocated size in bytes"'); +ALTER TABLE `cloud`.`object_store` CHANGE COLUMN `used_bytes` `used_size` BIGINT UNSIGNED COMMENT 'used size in bytes'; +ALTER TABLE `cloud`.`object_store` MODIFY COLUMN `total_size` bigint unsigned COMMENT 'total size in bytes'; +UPDATE `cloud`.`object_store` +JOIN ( + SELECT object_store_id, SUM(quota) AS total_quota + FROM `cloud`.`bucket` + WHERE removed IS NULL + GROUP BY object_store_id +) buckets_quota_sum_view ON `object_store`.id = buckets_quota_sum_view.object_store_id +SET `object_store`.allocated_size = buckets_quota_sum_view.total_quota; + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.console_session', 'domain_id', 'bigint(20) unsigned NOT NULL'); + +UPDATE `cloud`.`console_session` `cs` +SET `cs`.`domain_id` = ( + SELECT `acc`.`domain_id` + FROM `cloud`.`account` `acc` + WHERE `acc`.`id` = `cs`.`account_id` +); + +-- Re-apply VPC: update default network offering for vpc tier to conserve_mode=1 (#8309) +UPDATE `cloud`.`network_offerings` SET conserve_mode = 1 WHERE name = 'DefaultIsolatedNetworkOfferingForVpcNetworks'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42020to42030.sql b/engine/schema/src/main/resources/META-INF/db/schema-42020to42030.sql new file mode 100644 index 000000000000..5eec97278bad --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42020to42030.sql @@ -0,0 +1,28 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade from 4.20.2.0 to 4.20.3.0 +--; + +ALTER TABLE `cloud`.`template_store_ref` MODIFY COLUMN `download_url` varchar(2048); + +UPDATE `cloud`.`alert` SET type = 33 WHERE name = 'ALERT.VR.PUBLIC.IFACE.MTU'; +UPDATE `cloud`.`alert` SET type = 34 WHERE name = 'ALERT.VR.PRIVATE.IFACE.MTU'; + +-- Update configuration 'kvm.ssh.to.agent' description and is_dynamic fields +UPDATE `cloud`.`configuration` SET description = 'True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations', is_dynamic = 1 WHERE name = 'kvm.ssh.to.agent'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql new file mode 100644 index 000000000000..0546613dfa34 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200-cleanup.sql @@ -0,0 +1,20 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade cleanup from 4.21.0.0 to 4.22.0.0 +--; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql new file mode 100644 index 000000000000..fbb2fd079f9c --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42100to42200.sql @@ -0,0 +1,93 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade from 4.21.0.0 to 4.22.0.0 +--; + +-- health check status as enum +CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('router_health_check', 'check_result', 'check_result', 'varchar(16) NOT NULL COMMENT "check executions result: SUCCESS, FAILURE, WARNING, UNKNOWN"'); + +-- Increase length of scripts_version column to 128 due to md5sum to sha512sum change +CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('cloud.domain_router', 'scripts_version', 'scripts_version', 'VARCHAR(128)'); + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.snapshot_policy','domain_id', 'BIGINT(20) DEFAULT NULL'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.snapshot_policy','account_id', 'BIGINT(20) DEFAULT NULL'); + +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule','domain_id', 'BIGINT(20) DEFAULT NULL'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_schedule','account_id', 'BIGINT(20) DEFAULT NULL'); + +-- Increase the cache_mode column size from cloud.disk_offering table +CALL `cloud`.`IDEMPOTENT_CHANGE_COLUMN`('cloud.disk_offering', 'cache_mode', 'cache_mode', 'varchar(18) DEFAULT "none" COMMENT "The disk cache mode to use for disks created with this offering"'); + +-- Add uuid column to ldap_configuration table +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.ldap_configuration', 'uuid', 'VARCHAR(40) NOT NULL'); + +-- Populate uuid for existing rows where uuid is NULL or empty +UPDATE `cloud`.`ldap_configuration` SET uuid = UUID() WHERE uuid IS NULL OR uuid = ''; + +-- Add the column cross_zone_instance_creation to cloud.backup_repository. if enabled it means that new Instance can be created on all Zones from Backups on this Repository. +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backup_repository', 'cross_zone_instance_creation', 'TINYINT(1) DEFAULT NULL COMMENT ''Backup Repository can be used for disaster recovery on another zone'''); + +-- Updated display to false for password/token detail of the storage pool details +UPDATE `cloud`.`storage_pool_details` SET display = 0 WHERE name LIKE '%password%'; +UPDATE `cloud`.`storage_pool_details` SET display = 0 WHERE name LIKE '%token%'; + +-- Add csi_enabled column to kubernetes_cluster table to indicate if the cluster is using csi or not +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster', 'csi_enabled', 'TINYINT(1) unsigned NOT NULL DEFAULT 0 COMMENT "true if kubernetes cluster is using csi, false otherwise" '); + +-- VMware to KVM migration improvements +CREATE TABLE IF NOT EXISTS `cloud`.`import_vm_task`( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `uuid` varchar(40), + `zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID', + `account_id` bigint unsigned NOT NULL COMMENT 'Account ID', + `user_id` bigint unsigned NOT NULL COMMENT 'User ID', + `vm_id` bigint unsigned COMMENT 'VM ID', + `display_name` varchar(255) COMMENT 'Display VM Name', + `vcenter` varchar(255) COMMENT 'VCenter', + `datacenter` varchar(255) COMMENT 'VCenter Datacenter name', + `source_vm_name` varchar(255) COMMENT 'Source VM name on vCenter', + `convert_host_id` bigint unsigned COMMENT 'Convert Host ID', + `import_host_id` bigint unsigned COMMENT 'Import Host ID', + `step` varchar(20) COMMENT 'Importing VM Task Step', + `state` varchar(20) COMMENT 'Importing VM Task State', + `description` varchar(255) COMMENT 'Importing VM Task Description', + `duration` bigint unsigned COMMENT 'Duration in milliseconds for the completed tasks', + `created` datetime NOT NULL COMMENT 'date created', + `updated` datetime COMMENT 'date updated if not null', + `removed` datetime COMMENT 'date removed if not null', + PRIMARY KEY (`id`), + CONSTRAINT `fk_import_vm_task__zone_id` FOREIGN KEY `fk_import_vm_task__zone_id` (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_import_vm_task__account_id` FOREIGN KEY `fk_import_vm_task__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_import_vm_task__user_id` FOREIGN KEY `fk_import_vm_task__user_id` (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_import_vm_task__vm_id` FOREIGN KEY `fk_import_vm_task__vm_id` (`vm_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_import_vm_task__convert_host_id` FOREIGN KEY `fk_import_vm_task__convert_host_id` (`convert_host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_import_vm_task__import_host_id` FOREIGN KEY `fk_import_vm_task__import_host_id` (`import_host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, + INDEX `i_import_vm_task__zone_id`(`zone_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CALL `cloud`.`INSERT_EXTENSION_IF_NOT_EXISTS`('MaaS', 'Baremetal Extension for Canonical MaaS written in Python', 'MaaS/maas.py'); +CALL `cloud`.`INSERT_EXTENSION_DETAIL_IF_NOT_EXISTS`('MaaS', 'orchestratorrequirespreparevm', 'true', 0); + +CALL `cloud`.`IDEMPOTENT_DROP_UNIQUE_KEY`('counter', 'uc_counter__provider__source__value'); +CALL `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY`('cloud.counter', 'uc_counter__provider__source__value__removed', '(provider, source, value, removed)'); + +-- Change scope for configuration - 'use.https.to.upload from' from StoragePool to Zone +UPDATE `cloud`.`configuration` SET `scope` = 2 WHERE `name` = 'use.https.to.upload'; +-- Delete the configuration for 'use.https.to.upload' from StoragePool +DELETE FROM `cloud`.`storage_pool_details` WHERE `name` = 'use.https.to.upload'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42200to42210-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-42200to42210-cleanup.sql new file mode 100644 index 000000000000..2f104568c140 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42200to42210-cleanup.sql @@ -0,0 +1,26 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade cleanup from 4.22.0.0 to 4.22.1.0 +--; + +-- Entries remaining on `cloud`.`resource_reservation` during the upgrade process are stale, so delete them. +-- This script was added to normalize volume/primary storage reservations that got stuck due to a bug on VM deployment, +-- but it is more interesting to introduce a smarter logic to clean these stale reservations in the future without the need +-- for upgrades (for instance, by having a heartbeat_time column for the reservations and automatically cleaning old entries). +DELETE FROM `cloud`.`resource_reservation`; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql b/engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql new file mode 100644 index 000000000000..baa20e9f0ad5 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql @@ -0,0 +1,61 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade from 4.22.0.0 to 4.22.1.0 +--; + +-- Add vm_id column to usage_event table for volume usage events +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.usage_event','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with volume usage events"'); +CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.usage_event','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with volume usage events"'); + +-- Add vm_id column to cloud_usage.usage_volume table +CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.usage_volume','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with the volume usage"'); + +ALTER TABLE `cloud`.`template_store_ref` MODIFY COLUMN `download_url` varchar(2048); + +UPDATE `cloud`.`alert` SET type = 33 WHERE name = 'ALERT.VR.PUBLIC.IFACE.MTU'; +UPDATE `cloud`.`alert` SET type = 34 WHERE name = 'ALERT.VR.PRIVATE.IFACE.MTU'; + +-- Update configuration 'kvm.ssh.to.agent' description and is_dynamic fields +UPDATE `cloud`.`configuration` SET description = 'True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations', is_dynamic = 1 WHERE name = 'kvm.ssh.to.agent'; + +-- Sanitize legacy network-level addressing fields for Public networks +UPDATE `cloud`.`networks` +SET `broadcast_uri` = NULL, + `gateway` = NULL, + `cidr` = NULL, + `ip6_gateway` = NULL, + `ip6_cidr` = NULL +WHERE `traffic_type` = 'Public'; + +UPDATE `cloud`.`vm_template` SET guest_os_id = 99 WHERE name = 'kvm-default-vm-import-dummy-template'; + +-- Update existing vm_template records with NULL type to "USER" +UPDATE `cloud`.`vm_template` SET `type` = 'USER' WHERE `type` IS NULL; + +-- remove unused config item +DELETE FROM `cloud`.`configuration` WHERE name = 'consoleproxy.cmd.port'; + +-- Drops the unused "backup_interval_type" column of the "cloud.backups" table +ALTER TABLE `cloud`.`backups` DROP COLUMN `backup_interval_type`; + +-- Update `user.password.reset.mail.template` configuration value to match new logic +UPDATE `cloud`.`configuration` +SET value = CONCAT_WS('\n', 'Hello {{username}}!', 'You have requested to reset your password. Please click the following link to reset your password:', '{{{resetLink}}}', 'If you did not request a password reset, please ignore this email.', '', 'Regards,', 'The CloudStack Team') +WHERE name = 'user.password.reset.mail.template' + AND value IN (CONCAT_WS('\n', 'Hello {{username}}!', 'You have requested to reset your password. Please click the following link to reset your password:', 'http://{{{resetLink}}}', 'If you did not request a password reset, please ignore this email.', '', 'Regards,', 'The CloudStack Team'), CONCAT_WS('\n', 'Hello {{username}}!', 'You have requested to reset your password. Please click the following link to reset your password:', '{{{domainUrl}}}{{{resetLink}}}', 'If you did not request a password reset, please ignore this email.', '', 'Regards,', 'The CloudStack Team')); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql new file mode 100644 index 000000000000..e2b066af7800 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300-cleanup.sql @@ -0,0 +1,20 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade cleanup from 4.22.1.0 to 4.23.0.0 +--; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql new file mode 100644 index 000000000000..2d25b3355d8e --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql @@ -0,0 +1,210 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +--; +-- Schema upgrade from 4.22.1.0 to 4.23.0.0 +--; + +CREATE TABLE `cloud`.`backup_offering_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `backup_offering_id` bigint unsigned NOT NULL COMMENT 'Backup offering id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Should detail be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_offering_details__backup_offering_id` FOREIGN KEY `fk_offering_details__backup_offering_id`(`backup_offering_id`) REFERENCES `backup_offering`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Update value to random for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_random +-- Update value to firstfit for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_firstfit +UPDATE `cloud`.`configuration` SET value='random' WHERE name IN ('vm.allocation.algorithm', 'volume.allocation.algorithm') AND value='userconcentratedpod_random'; +UPDATE `cloud`.`configuration` SET value='firstfit' WHERE name IN ('vm.allocation.algorithm', 'volume.allocation.algorithm') AND value='userconcentratedpod_firstfit'; + +-- Create kubernetes_cluster_affinity_group_map table for CKS per-node-type affinity groups +CREATE TABLE IF NOT EXISTS `cloud`.`kubernetes_cluster_affinity_group_map` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `cluster_id` bigint unsigned NOT NULL COMMENT 'kubernetes cluster id', + `node_type` varchar(32) NOT NULL COMMENT 'CONTROL, WORKER, or ETCD', + `affinity_group_id` bigint unsigned NOT NULL COMMENT 'affinity group id', + PRIMARY KEY (`id`), + CONSTRAINT `fk_kubernetes_cluster_ag_map__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `kubernetes_cluster`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_kubernetes_cluster_ag_map__ag_id` FOREIGN KEY (`affinity_group_id`) REFERENCES `affinity_group`(`id`) ON DELETE CASCADE, + INDEX `i_kubernetes_cluster_ag_map__cluster_id`(`cluster_id`), + INDEX `i_kubernetes_cluster_ag_map__ag_id`(`affinity_group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Create webhook_filter table +DROP TABLE IF EXISTS `cloud`.`webhook_filter`; +CREATE TABLE IF NOT EXISTS `cloud`.`webhook_filter` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id of the webhook filter', + `uuid` varchar(255) COMMENT 'uuid of the webhook filter', + `webhook_id` bigint unsigned NOT NULL COMMENT 'id of the webhook', + `type` varchar(20) COMMENT 'type of the filter', + `mode` varchar(20) COMMENT 'mode of the filter', + `match_type` varchar(20) COMMENT 'match type of the filter', + `value` varchar(256) NOT NULL COMMENT 'value of the filter used for matching', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + INDEX `i_webhook_filter__webhook_id`(`webhook_id`), + CONSTRAINT `fk_webhook_filter__webhook_id` FOREIGN KEY(`webhook_id`) REFERENCES `webhook`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- "api_keypair" table for API and secret keys +CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `uuid` varchar(40) UNIQUE NOT NULL, + `name` varchar(255) NOT NULL, + `domain_id` bigint(20) unsigned NOT NULL, + `account_id` bigint(20) unsigned NOT NULL, + `user_id` bigint(20) unsigned NOT NULL, + `start_date` datetime, + `end_date` datetime, + `description` varchar(100), + `api_key` varchar(255) NOT NULL, + `secret_key` varchar(255) NOT NULL, + `created` datetime NOT NULL, + `removed` datetime, + PRIMARY KEY (`id`), + CONSTRAINT `fk_api_keypair__user_id` FOREIGN KEY(`user_id`) REFERENCES `cloud`.`user`(`id`), + CONSTRAINT `fk_api_keypair__account_id` FOREIGN KEY(`account_id`) REFERENCES `cloud`.`account`(`id`), + CONSTRAINT `fk_api_keypair__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `cloud`.`domain`(`id`) +); + +-- "api_keypair_permissions" table for API key pairs permissions +CREATE TABLE IF NOT EXISTS `cloud`.`api_keypair_permissions` ( + `id` bigint(20) unsigned NOT NULL auto_increment, + `uuid` varchar(40) UNIQUE, + `sort_order` bigint(20) unsigned NOT NULL DEFAULT 0, + `rule` varchar(255) NOT NULL, + `api_keypair_id` bigint(20) unsigned NOT NULL, + `permission` varchar(255) NOT NULL, + `description` varchar(255), + PRIMARY KEY (`id`), + CONSTRAINT `fk_keypair_permissions__api_keypair_id` FOREIGN KEY(`api_keypair_id`) REFERENCES `cloud`.`api_keypair`(`id`) +); + +-- Populate "api_keypair" table with existing user API keys +INSERT INTO `cloud`.`api_keypair` (uuid, user_id, domain_id, account_id, api_key, secret_key, created, name) +SELECT UUID(), user.id, account.domain_id, account.id, user.api_key, user.secret_key, NOW(), 'Active key pair' +FROM `cloud`.`user` AS user +JOIN `cloud`.`account` AS account ON user.account_id = account.id +WHERE user.api_key IS NOT NULL AND user.secret_key IS NOT NULL; + +-- Drop API keys from user table +ALTER TABLE `cloud`.`user` DROP COLUMN api_key, DROP COLUMN secret_key; + +-- Grant access to the "deleteUserKeys" API to the "User", "Domain Admin" and "Resource Admin" roles, similarly to the "registerUserKeys" API +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('User', 'deleteUserKeys', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Domain Admin', 'deleteUserKeys', 'ALLOW'); +CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Resource Admin', 'deleteUserKeys', 'ALLOW'); + +-- Add conserve mode for VPC offerings +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','conserve_mode', 'tinyint(1) unsigned NULL DEFAULT 0 COMMENT ''True if the VPC offering is IP conserve mode enabled, allowing public IP services to be used across multiple VPC tiers'' '); + +--- Disable/enable NICs +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.nics','enabled', 'TINYINT(1) NOT NULL DEFAULT 1 COMMENT ''Indicates whether the NIC is enabled or not'' '); + +--- Quota tariff/usage mapping +CREATE TABLE IF NOT EXISTS `cloud_usage`.`quota_tariff_usage` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `tariff_id` bigint(20) unsigned NOT NULL COMMENT 'ID of the tariff of the Quota usage detail calculated, foreign key to quota_tariff table', + `quota_usage_id` bigint(20) unsigned NOT NULL COMMENT 'ID of the aggregation of Quota usage details, foreign key to quota_usage table', + `quota_used` decimal(20,8) NOT NULL COMMENT 'Amount of quota used', + PRIMARY KEY (`id`), + CONSTRAINT `fk_quota_tariff_usage__tariff_id` FOREIGN KEY (`tariff_id`) REFERENCES `cloud_usage`.`quota_tariff` (`id`), + CONSTRAINT `fk_quota_tariff_usage__quota_usage_id` FOREIGN KEY (`quota_usage_id`) REFERENCES `cloud_usage`.`quota_usage` (`id`)); + +-- Add the 'keep_mac_address_on_public_nic' column to the 'cloud.networks' and 'cloud.vpc' tables +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.networks', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc', 'keep_mac_address_on_public_nic', 'TINYINT(1) NOT NULL DEFAULT 1'); + +-- Creates the 'kvm.memory.dynamic.scaling.capacity' and, for already active ACS environments, +-- initializes it with the value of the setting 'vm.serviceoffering.ram.size.max' +INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `updated`, `scope`, `is_dynamic`, `group_id`, `subgroup_id`, `display_text`, `description`) +SELECT 'Advanced', 'DEFAULT', 'CapacityManager', 'kvm.memory.dynamic.scaling.capacity', `cfg`.`value`, 0, NULL, 4, 1, 6, 27, + 'KVM memory dynamic scaling capacity', 'Defines the maximum memory capacity in MiB for which VMs can be dynamically scaled to with KVM. The ''kvm.memory.dynamic.scaling.capacity'' setting''s value will be used to define the value of the '''' element of domain XMLs. If it is set to a value less than or equal to ''0'', then the host''s memory capacity will be considered.' +FROM `cloud`.`configuration` `cfg` +WHERE NOT EXISTS (SELECT 1 FROM `cloud`.`configuration` WHERE `name` = 'kvm.memory.dynamic.scaling.capacity') + AND `cfg`.`name` = 'vm.serviceoffering.ram.size.max'; + +-- Creates the 'kvm.cpu.dynamic.scaling.capacity' and, for already active ACS environments, +-- initializes it with the value of the setting 'vm.serviceoffering.cpu.cores.max' +INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `updated`, `scope`, `is_dynamic`, `group_id`, `subgroup_id`, `display_text`, `description`) +SELECT 'Advanced', 'DEFAULT', 'CapacityManager', 'kvm.cpu.dynamic.scaling.capacity', `cfg`.`value`, 0, NULL, 4, 1, 6, 27, + 'KVM CPU dynamic scaling capacity', 'Defines the maximum vCPU capacity for which VMs can be dynamically scaled to with KVM. The ''kvm.cpu.dynamic.scaling.capacity'' setting''s value will be used to define the value of the '''' element of domain XMLs. If it is set to a value less than or equal to ''0'', then the host''s CPU cores capacity will be considered.' +FROM `cloud`.`configuration` `cfg` +WHERE NOT EXISTS (SELECT 1 FROM `cloud`.`configuration` WHERE `name` = 'kvm.cpu.dynamic.scaling.capacity') + AND `cfg`.`name` = 'vm.serviceoffering.cpu.cores.max'; + +-- Remove stale realhostip.com default values; domain has been dead since ~2015. +UPDATE `cloud`.`configuration` + SET value = NULL + WHERE name IN ('consoleproxy.url.domain', 'secstorage.ssl.cert.domain') + AND value IN ('realhostip.com', '*.realhostip.com'); + +-- Add management_server_details table to allow ManagementServer scope configs +CREATE TABLE IF NOT EXISTS `management_server_details` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `management_server_id` bigint unsigned NOT NULL COMMENT 'management server the detail is related to', + `name` varchar(255) NOT NULL COMMENT 'name of the detail', + `value` varchar(255) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_management_server_details__management_server_id` FOREIGN KEY `fk_management_server_details__management_server_id`(`management_server_id`) REFERENCES `mshost`(`id`) ON DELETE CASCADE, + KEY `i_management_server_details__name__value` (`name`(128),`value`(128)) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Add checkpoint tracking fields to backups table for incremental backup support +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'from_checkpoint_id', 'VARCHAR(255) DEFAULT NULL COMMENT "Previous active checkpoint id for incremental backups"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'to_checkpoint_id', 'VARCHAR(255) DEFAULT NULL COMMENT "New checkpoint id created for the next incremental backup"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'checkpoint_create_time', 'BIGINT DEFAULT NULL COMMENT "Checkpoint creation timestamp from libvirt"'); +CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.backups', 'host_id', 'BIGINT UNSIGNED DEFAULT NULL COMMENT "Host where backup is running"'); + +-- Create image_transfer table for per-disk image transfers +CREATE TABLE IF NOT EXISTS `cloud`.`image_transfer`( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `uuid` varchar(40) NOT NULL COMMENT 'uuid', + `account_id` bigint unsigned NOT NULL COMMENT 'Account ID', + `domain_id` bigint unsigned NOT NULL COMMENT 'Domain ID', + `data_center_id` bigint unsigned NOT NULL COMMENT 'Data Center ID', + `backup_id` bigint unsigned COMMENT 'Backup ID', + `volume_id` bigint unsigned NOT NULL COMMENT 'Volume ID', + `host_id` bigint unsigned NOT NULL COMMENT 'Host ID', + `transfer_url` varchar(255) COMMENT 'ImageIO transfer URL', + `file` varchar(255) COMMENT 'File for the file backend', + `phase` varchar(20) NOT NULL COMMENT 'Transfer phase: initializing, transferring, finished, failed', + `socket` varchar(255) COMMENT 'Unix socket for nbd backend', + `direction` varchar(20) NOT NULL COMMENT 'Direction: upload, download', + `backend` varchar(20) NOT NULL COMMENT 'Backend: nbd, file', + `progress` int COMMENT 'Transfer progress percentage (0-100)', + `signed_ticket_id` varchar(255) COMMENT 'Signed ticket ID from ImageIO', + `created` datetime NOT NULL COMMENT 'date created', + `updated` datetime COMMENT 'date updated if not null', + `removed` datetime COMMENT 'date removed if not null', + PRIMARY KEY (`id`), + UNIQUE KEY `uuid` (`uuid`), + CONSTRAINT `fk_image_transfer__backup_id` FOREIGN KEY (`backup_id`) REFERENCES `backups`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_image_transfer__volume_id` FOREIGN KEY (`volume_id`) REFERENCES `volumes`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_image_transfer__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, + INDEX `i_image_transfer__backup_id`(`backup_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +--- Quota resource statement +INSERT INTO cloud.role_permissions (uuid, role_id, rule, permission, sort_order) +SELECT uuid(), role_id, 'quotaResourceStatement', permission, sort_order +FROM cloud.role_permissions rp +WHERE rule = 'quotaStatement' AND NOT EXISTS(SELECT 1 FROM cloud.role_permissions rp_ WHERE rp.role_id = rp_.role_id AND rp_.rule = 'quotaResourceStatement'); diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.account_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.account_view.sql index 6092fe8e845a..edc164c40cbd 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.account_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.account_view.sql @@ -64,6 +64,8 @@ select `cpucount`.`count` AS `cpuTotal`, `memorylimit`.`max` AS `memoryLimit`, `memorycount`.`count` AS `memoryTotal`, + `gpulimit`.`max` AS `gpuLimit`, + `gpucount`.`count` AS `gpuTotal`, `primary_storage_limit`.`max` AS `primaryStorageLimit`, `primary_storage_count`.`count` AS `primaryStorageTotal`, `secondary_storage_limit`.`max` AS `secondaryStorageLimit`, @@ -156,6 +158,12 @@ from `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id and memorycount.type = 'memory' and memorycount.tag IS NULL left join + `cloud`.`resource_limit` gpulimit ON account.id = gpulimit.account_id + and gpulimit.type = 'gpu' and gpulimit.tag IS NULL + left join + `cloud`.`resource_count` gpucount ON account.id = gpucount.account_id + and gpucount.type = 'gpu' and gpucount.tag IS NULL + left join `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id and primary_storage_limit.type = 'primary_storage' and primary_storage_limit.tag IS NULL left join diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.data_center_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.data_center_view.sql index c34df4f1cbf5..46aea863fc5e 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.data_center_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.data_center_view.sql @@ -42,6 +42,7 @@ select data_center.type, data_center.removed, data_center.sort_key, + data_center.storage_access_groups, domain.id domain_id, domain.uuid domain_uuid, domain.name domain_name, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_router_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_router_view.sql index 70394e8fd6d3..d5f17606cb41 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_router_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_router_view.sql @@ -58,6 +58,7 @@ select host.resource_state host_resource_state, vm_template.id template_id, vm_template.uuid template_uuid, + vm_template.arch arch, service_offering.id service_offering_id, service_offering.uuid service_offering_uuid, service_offering.name service_offering_name, @@ -75,6 +76,7 @@ select nics.broadcast_uri broadcast_uri, nics.isolation_uri isolation_uri, nics.mtu mtu, + nics.enabled is_nic_enabled, vpc.id vpc_id, vpc.uuid vpc_uuid, vpc.name vpc_name, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_view.sql index c9f7bfc51e43..14fd87536aa1 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.domain_view.sql @@ -55,6 +55,8 @@ select `cpucount`.`count` AS `cpuTotal`, `memorylimit`.`max` AS `memoryLimit`, `memorycount`.`count` AS `memoryTotal`, + `gpulimit`.`max` AS `gpuLimit`, + `gpucount`.`count` AS `gpuTotal`, `primary_storage_limit`.`max` AS `primaryStorageLimit`, `primary_storage_count`.`count` AS `primaryStorageTotal`, `secondary_storage_limit`.`max` AS `secondaryStorageLimit`, @@ -130,6 +132,12 @@ from `cloud`.`resource_count` memorycount ON domain.id = memorycount.domain_id and memorycount.type = 'memory' and memorycount.tag IS NULL left join + `cloud`.`resource_limit` gpulimit ON domain.id = gpulimit.domain_id + and gpulimit.type = 'gpu' and gpulimit.tag IS NULL + left join + `cloud`.`resource_count` gpucount ON domain.id = gpucount.domain_id + and gpucount.type = 'gpu' and gpucount.tag IS NULL + left join `cloud`.`resource_limit` primary_storage_limit ON domain.id = primary_storage_limit.domain_id and primary_storage_limit.type = 'primary_storage' and primary_storage_limit.tag IS NULL left join diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.gui_themes_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.gui_themes_view.sql new file mode 100644 index 000000000000..3173274623ed --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.gui_themes_view.sql @@ -0,0 +1,38 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- VIEW `cloud`.`gui_themes_view`; + +DROP VIEW IF EXISTS `cloud`.`gui_themes_view`; + +CREATE VIEW `cloud`.`gui_themes_view` AS +SELECT + `cloud`.`gui_themes`.`id` AS `id`, + `cloud`.`gui_themes`.`uuid` AS `uuid`, + `cloud`.`gui_themes`.`name` AS `name`, + `cloud`.`gui_themes`.`description` AS `description`, + `cloud`.`gui_themes`.`css` AS `css`, + `cloud`.`gui_themes`.`json_configuration` AS `json_configuration`, + (SELECT group_concat(gtd.`value` separator ',') FROM `cloud`.`gui_themes_details` gtd WHERE gtd.`type` = 'commonName' AND gtd.gui_theme_id = `cloud`.`gui_themes`.`id`) common_names, + (SELECT group_concat(gtd.`value` separator ',') FROM `cloud`.`gui_themes_details` gtd WHERE gtd.`type` = 'domain' AND gtd.gui_theme_id = `cloud`.`gui_themes`.`id`) domains, + (SELECT group_concat(gtd.`value` separator ',') FROM `cloud`.`gui_themes_details` gtd WHERE gtd.`type` = 'account' AND gtd.gui_theme_id = `cloud`.`gui_themes`.`id`) accounts, + `cloud`.`gui_themes`.`recursive_domains` AS `recursive_domains`, + `cloud`.`gui_themes`.`is_public` AS `is_public`, + `cloud`.`gui_themes`.`created` AS `created`, + `cloud`.`gui_themes`.`removed` AS `removed` +FROM `cloud`.`gui_themes` LEFT JOIN `cloud`.`gui_themes_details` ON `cloud`.`gui_themes_details`.`gui_theme_id` = `cloud`.`gui_themes`.`id` +GROUP BY `cloud`.`gui_themes`.`id`; diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql index 6fc8fb803862..d9f4e2671595 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql @@ -42,17 +42,21 @@ SELECT host.speed, host.ram, host.arch, + host.storage_access_groups, cluster.id cluster_id, cluster.uuid cluster_uuid, cluster.name cluster_name, cluster.cluster_type, + cluster.storage_access_groups AS cluster_storage_access_groups, data_center.id data_center_id, data_center.uuid data_center_uuid, data_center.name data_center_name, + data_center.storage_access_groups AS zone_storage_access_groups, data_center.networktype data_center_type, host_pod_ref.id pod_id, host_pod_ref.uuid pod_uuid, host_pod_ref.name pod_name, + host_pod_ref.storage_access_groups AS pod_storage_access_groups, GROUP_CONCAT(DISTINCT(host_tags.tag)) AS tag, GROUP_CONCAT(DISTINCT(explicit_host_tags.tag)) AS explicit_tag, GROUP_CONCAT(DISTINCT(implicit_host_tags.tag)) AS implicit_tag, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.network_offering_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.network_offering_view.sql index 640b2397a461..368566c32b32 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.network_offering_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.network_offering_view.sql @@ -59,8 +59,6 @@ SELECT `network_offerings`.`supports_public_access` AS `supports_public_access`, `network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`, `network_offerings`.`for_vpc` AS `for_vpc`, - `network_offerings`.`for_tungsten` AS `for_tungsten`, - `network_offerings`.`for_nsx` AS `for_nsx`, `network_offerings`.`network_mode` AS `network_mode`, `network_offerings`.`service_package_id` AS `service_package_id`, `network_offerings`.`routing_mode` AS `routing_mode`, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.service_offering_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.service_offering_view.sql index c894429adf80..eb987af3ffb6 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.service_offering_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.service_offering_view.sql @@ -71,6 +71,20 @@ SELECT `service_offering`.`dynamic_scaling_enabled` AS `dynamic_scaling_enabled`, `service_offering`.`disk_offering_strictness` AS `disk_offering_strictness`, `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, + `lease_duration_details`.`value` AS `lease_duration`, + `lease_expiry_action_details`.`value` AS `lease_expiry_action`, + `gpu_card`.`id` AS `gpu_card_id`, + `gpu_card`.`uuid` AS `gpu_card_uuid`, + `gpu_card`.`name` AS `gpu_card_name`, + `vgpu_profile`.`id` AS `vgpu_profile_id`, + `vgpu_profile`.`uuid` AS `vgpu_profile_uuid`, + `vgpu_profile`.`name` AS `vgpu_profile_name`, + `vgpu_profile`.`video_ram` AS `vgpu_profile_video_ram`, + `vgpu_profile`.`max_heads` AS `vgpu_profile_max_heads`, + `vgpu_profile`.`max_resolution_x` AS `vgpu_profile_max_resolution_x`, + `vgpu_profile`.`max_resolution_y` AS `vgpu_profile_max_resolution_y`, + `service_offering`.`gpu_count` AS `gpu_count`, + `service_offering`.`gpu_display` AS `gpu_display`, GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id, GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid, GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name, @@ -87,6 +101,10 @@ FROM INNER JOIN `cloud`.`disk_offering` ON service_offering.disk_offering_id = disk_offering.id LEFT JOIN + `cloud`.`vgpu_profile` ON service_offering.vgpu_profile_id = vgpu_profile.id + LEFT JOIN + `cloud`.`gpu_card` ON vgpu_profile.card_id = gpu_card.id + LEFT JOIN `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `service_offering`.`id` AND `domain_details`.`name`='domainid' LEFT JOIN `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) @@ -109,5 +127,11 @@ FROM LEFT JOIN `cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `service_offering`.`id` AND `vsphere_storage_policy`.`name` = 'storagepolicy' + LEFT JOIN + `cloud`.`service_offering_details` AS `lease_duration_details` ON `lease_duration_details`.`service_offering_id` = `service_offering`.`id` + AND `lease_duration_details`.`name` = 'leaseduration' + LEFT JOIN + `cloud`.`service_offering_details` AS `lease_expiry_action_details` ON `lease_expiry_action_details`.`service_offering_id` = `service_offering`.`id` + AND `lease_expiry_action_details`.`name` = 'leaseexpiryaction' GROUP BY `service_offering`.`id`; diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.storage_pool_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.storage_pool_view.sql index 5d7585baa3b4..641017bdd5ba 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.storage_pool_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.storage_pool_view.sql @@ -51,6 +51,7 @@ SELECT `host_pod_ref`.`name` AS `pod_name`, `storage_pool_tags`.`tag` AS `tag`, `storage_pool_tags`.`is_tag_a_rule` AS `is_tag_a_rule`, + `storage_pool_and_access_group_map`.`storage_access_group` AS `storage_access_group`, `op_host_capacity`.`used_capacity` AS `disk_used_capacity`, `op_host_capacity`.`reserved_capacity` AS `disk_reserved_capacity`, `async_job`.`id` AS `job_id`, @@ -58,13 +59,16 @@ SELECT `async_job`.`job_status` AS `job_status`, `async_job`.`account_id` AS `job_account_id` FROM - ((((((`cloud`.`storage_pool` - LEFT JOIN `cloud`.`cluster` ON ((`storage_pool`.`cluster_id` = `cluster`.`id`))) - LEFT JOIN `cloud`.`data_center` ON ((`storage_pool`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `cloud`.`host_pod_ref` ON ((`storage_pool`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `cloud`.`storage_pool_tags` ON (((`storage_pool_tags`.`pool_id` = `storage_pool`.`id`)))) - LEFT JOIN `cloud`.`op_host_capacity` ON (((`storage_pool`.`id` = `op_host_capacity`.`host_id`) - AND (`op_host_capacity`.`capacity_type` IN (3 , 9))))) - LEFT JOIN `cloud`.`async_job` ON (((`async_job`.`instance_id` = `storage_pool`.`id`) - AND (`async_job`.`instance_type` = 'StoragePool') - AND (`async_job`.`job_status` = 0)))); + `cloud`.`storage_pool` + LEFT JOIN `cloud`.`cluster` ON `storage_pool`.`cluster_id` = `cluster`.`id` + LEFT JOIN `cloud`.`data_center` ON `storage_pool`.`data_center_id` = `data_center`.`id` + LEFT JOIN `cloud`.`host_pod_ref` ON `storage_pool`.`pod_id` = `host_pod_ref`.`id` + LEFT JOIN `cloud`.`storage_pool_tags` ON `storage_pool_tags`.`pool_id` = `storage_pool`.`id` + LEFT JOIN `cloud`.`storage_pool_and_access_group_map` ON `storage_pool_and_access_group_map`.`pool_id` = `storage_pool`.`id` + LEFT JOIN `cloud`.`op_host_capacity` + ON `storage_pool`.`id` = `op_host_capacity`.`host_id` + AND `op_host_capacity`.`capacity_type` IN (3, 9) + LEFT JOIN `cloud`.`async_job` + ON `async_job`.`instance_id` = `storage_pool`.`id` + AND `async_job`.`instance_type` = 'StoragePool' + AND `async_job`.`job_status` = 0; diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.template_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.template_view.sql index 339e43860d88..76a8be16bda6 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.template_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.template_view.sql @@ -41,6 +41,7 @@ SELECT `vm_template`.`guest_os_id` AS `guest_os_id`, `guest_os`.`uuid` AS `guest_os_uuid`, `guest_os`.`display_name` AS `guest_os_name`, + `guest_os`.`category_id` AS `guest_os_category_id`, `vm_template`.`bootable` AS `bootable`, `vm_template`.`prepopulate` AS `prepopulate`, `vm_template`.`cross_zones` AS `cross_zones`, @@ -100,11 +101,15 @@ SELECT IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, `vm_template`.`direct_download` AS `direct_download`, `vm_template`.`deploy_as_is` AS `deploy_as_is`, + `vm_template`.`for_cks` AS `for_cks`, `user_data`.`id` AS `user_data_id`, `user_data`.`uuid` AS `user_data_uuid`, `user_data`.`name` AS `user_data_name`, `user_data`.`params` AS `user_data_params`, - `vm_template`.`user_data_link_policy` AS `user_data_policy` + `vm_template`.`user_data_link_policy` AS `user_data_policy`, + `extension`.`id` AS `extension_id`, + `extension`.`uuid` AS `extension_uuid`, + `extension`.`name` AS `extension_name` FROM (((((((((((((`vm_template` JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) @@ -127,6 +132,7 @@ FROM OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) LEFT JOIN `user_data` ON ((`user_data`.`id` = `vm_template`.`user_data_id`)) + LEFT JOIN `extension` ON ((`extension`.`id` = `vm_template`.`extension_id`)) LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) AND ((`resource_tags`.`resource_type` = 'Template') OR (`resource_tags`.`resource_type` = 'ISO'))))); diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_view.sql index 340cfa9055fb..dcba71e10985 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_view.sql @@ -29,8 +29,6 @@ select user.lastname, user.email, user.state, - user.api_key, - user.secret_key, user.created, user.removed, user.timezone, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql index 97cb7b735cfc..d77ba27689be 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql @@ -56,6 +56,7 @@ SELECT `vm_instance`.`display_vm` AS `display_vm`, `vm_instance`.`delete_protection` AS `delete_protection`, `guest_os`.`uuid` AS `guest_os_uuid`, + `guest_os`.`display_name` AS `guest_os_display_name`, `vm_instance`.`pod_id` AS `pod_id`, `host_pod_ref`.`uuid` AS `pod_uuid`, `vm_instance`.`private_ip_address` AS `private_ip_address`, @@ -79,10 +80,12 @@ SELECT `vm_template`.`format` AS `template_format`, `vm_template`.`display_text` AS `template_display_text`, `vm_template`.`enable_password` AS `password_enabled`, + `vm_template`.`extension_id` AS `template_extension_id`, `iso`.`id` AS `iso_id`, `iso`.`uuid` AS `iso_uuid`, `iso`.`name` AS `iso_name`, `iso`.`display_text` AS `iso_display_text`, + `vm_template`.`arch` AS `arch`, `service_offering`.`id` AS `service_offering_id`, `service_offering`.`uuid` AS `service_offering_uuid`, `disk_offering`.`uuid` AS `disk_offering_uuid`, @@ -102,6 +105,17 @@ SELECT `backup_offering`.`uuid` AS `backup_offering_uuid`, `backup_offering`.`id` AS `backup_offering_id`, `service_offering`.`name` AS `service_offering_name`, + `service_offering`.`vgpu_profile_id` AS `vgpu_profile_id`, + `vgpu_profile`.`uuid` AS `vgpu_profile_uuid`, + `vgpu_profile`.`name` AS `vgpu_profile_name`, + `vgpu_profile`.`video_ram` AS `vgpu_profile_video_ram`, + `vgpu_profile`.`max_heads` AS `vgpu_profile_max_heads`, + `vgpu_profile`.`max_resolution_x` AS `vgpu_profile_max_resolution_x`, + `vgpu_profile`.`max_resolution_y` AS `vgpu_profile_max_resolution_y`, + `gpu_card`.`id` AS `gpu_card_id`, + `gpu_card`.`uuid` AS `gpu_card_uuid`, + `gpu_card`.`name` AS `gpu_card_name`, + `service_offering`.`gpu_count` AS `gpu_count`, `disk_offering`.`name` AS `disk_offering_name`, `backup_offering`.`name` AS `backup_offering_name`, `storage_pool`.`id` AS `pool_id`, @@ -129,6 +143,7 @@ SELECT `nics`.`mac_address` AS `mac_address`, `nics`.`broadcast_uri` AS `broadcast_uri`, `nics`.`isolation_uri` AS `isolation_uri`, + `nics`.`enabled` AS `is_nic_enabled`, `vpc`.`id` AS `vpc_id`, `vpc`.`uuid` AS `vpc_uuid`, `networks`.`uuid` AS `network_uuid`, @@ -168,9 +183,12 @@ SELECT `user_data`.`uuid` AS `user_data_uuid`, `user_data`.`name` AS `user_data_name`, `user_vm`.`user_data_details` AS `user_data_details`, - `vm_template`.`user_data_link_policy` AS `user_data_policy` + `vm_template`.`user_data_link_policy` AS `user_data_policy`, + `lease_expiry_date`.`value` AS `lease_expiry_date`, + `lease_expiry_action`.`value` AS `lease_expiry_action`, + `lease_action_execution`.`value` AS `lease_action_execution` FROM - (((((((((((((((((((((((((((((((((((`user_vm` + (((((((((((((((((((((((((((((((((((((`user_vm` JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) AND ISNULL(`vm_instance`.`removed`)))) JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) @@ -188,6 +206,8 @@ FROM LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`volumes`.`disk_offering_id` = `svc_disk_offering`.`id`))) LEFT JOIN `disk_offering` ON ((`volumes`.`disk_offering_id` = `disk_offering`.`id`))) + LEFT JOIN `vgpu_profile` ON ((`service_offering`.`vgpu_profile_id` = `vgpu_profile`.`id`))) + LEFT JOIN `gpu_card` ON ((`vgpu_profile`.`card_id` = `gpu_card`.`id`))) LEFT JOIN `backup_offering` ON ((`vm_instance`.`backup_offering_id` = `backup_offering`.`id`))) LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) @@ -199,7 +219,7 @@ FROM LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) AND ISNULL(`vpc`.`removed`)))) LEFT JOIN `user_ip_address` FORCE INDEX(`fk_user_ip_address__vm_id`) ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) + LEFT JOIN `vm_instance_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) AND (`ssh_details`.`name` = 'SSH.KeyPairNames')))) LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) AND (`resource_tags`.`resource_type` = 'UserVm')))) @@ -210,9 +230,15 @@ FROM LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) LEFT JOIN `autoscale_vmgroup_vm_map` ON ((`autoscale_vmgroup_vm_map`.`instance_id` = `vm_instance`.`id`))) LEFT JOIN `autoscale_vmgroups` ON ((`autoscale_vmgroup_vm_map`.`vmgroup_id` = `autoscale_vmgroups`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) + LEFT JOIN `vm_instance_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) + LEFT JOIN `vm_instance_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); + LEFT JOIN `vm_instance_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) + AND (`custom_ram_size`.`name` = 'memory'))) + LEFT JOIN `vm_instance_details` `lease_expiry_date` ON ((`lease_expiry_date`.`vm_id` = `vm_instance`.`id`) + AND (`lease_expiry_date`.`name` = 'leaseexpirydate')) + LEFT JOIN `vm_instance_details` `lease_action_execution` ON ((`lease_action_execution`.`vm_id` = `vm_instance`.`id`) + AND (`lease_action_execution`.`name` = 'leaseactionexecution')) + LEFT JOIN `vm_instance_details` `lease_expiry_action` ON (((`lease_expiry_action`.`vm_id` = `vm_instance`.`id`) + AND (`lease_expiry_action`.`name` = 'leaseexpiryaction')))); diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql index c74d50590de5..3669bb10122b 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql @@ -28,7 +28,6 @@ select `vpc_offerings`.`display_text` AS `display_text`, `vpc_offerings`.`state` AS `state`, `vpc_offerings`.`default` AS `default`, - `vpc_offerings`.`for_nsx` AS `for_nsx`, `vpc_offerings`.`network_mode` AS `network_mode`, `vpc_offerings`.`created` AS `created`, `vpc_offerings`.`removed` AS `removed`, @@ -39,6 +38,7 @@ select `vpc_offerings`.`sort_key` AS `sort_key`, `vpc_offerings`.`routing_mode` AS `routing_mode`, `vpc_offerings`.`specify_as_number` AS `specify_as_number`, + `vpc_offerings`.`conserve_mode` AS `conserve_mode`, group_concat(distinct `domain`.`id` separator ',') AS `domain_id`, group_concat(distinct `domain`.`uuid` separator ',') AS `domain_uuid`, group_concat(distinct `domain`.`name` separator ',') AS `domain_name`, diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_summary_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_summary_view.sql new file mode 100644 index 000000000000..0646c3b6f919 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_summary_view.sql @@ -0,0 +1,48 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- cloud_usage.quota_summary_view source + +-- Create view for quota summary +DROP VIEW IF EXISTS `cloud_usage`.`quota_summary_view`; +CREATE VIEW `cloud_usage`.`quota_summary_view` AS +SELECT + cloud_usage.quota_account.account_id AS account_id, + cloud_usage.quota_account.quota_balance AS quota_balance, + cloud_usage.quota_account.quota_balance_date AS quota_balance_date, + cloud_usage.quota_account.quota_enforce AS quota_enforce, + cloud_usage.quota_account.quota_min_balance AS quota_min_balance, + cloud_usage.quota_account.quota_alert_date AS quota_alert_date, + cloud_usage.quota_account.quota_alert_type AS quota_alert_type, + cloud_usage.quota_account.last_statement_date AS last_statement_date, + cloud.account.uuid AS account_uuid, + cloud.account.account_name AS account_name, + cloud.account.state AS account_state, + cloud.account.removed AS account_removed, + cloud.domain.id AS domain_id, + cloud.domain.uuid AS domain_uuid, + cloud.domain.name AS domain_name, + cloud.domain.path AS domain_path, + cloud.domain.removed AS domain_removed, + cloud.projects.uuid AS project_uuid, + cloud.projects.name AS project_name, + cloud.projects.removed AS project_removed +FROM + cloud_usage.quota_account + INNER JOIN cloud.account ON (cloud.account.id = cloud_usage.quota_account.account_id) + INNER JOIN cloud.domain ON (cloud.domain.id = cloud.account.domain_id) + LEFT JOIN cloud.projects ON (cloud.account.type = 5 AND cloud.account.id = cloud.projects.project_account_id); diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_usage_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_usage_view.sql new file mode 100644 index 000000000000..7ac001384e8e --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud_usage.quota_usage_view.sql @@ -0,0 +1,35 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- VIEW `cloud_usage`.`quota_usage_view`; + +DROP VIEW IF EXISTS `cloud_usage`.`quota_usage_view`; +CREATE VIEW `cloud_usage`.`quota_usage_view` AS +SELECT qu.id, + qu.usage_item_id, + qu.zone_id, + qu.account_id, + qu.domain_id, + qu.usage_type, + qu.quota_used, + qu.start_date, + qu.end_date, + cu.usage_id AS resource_id, + cu.network_id as network_id, + cu.offering_id as offering_id +FROM `cloud_usage`.`quota_usage` qu +INNER JOIN `cloud_usage`.`cloud_usage` cu ON (cu.id = qu.usage_item_id); diff --git a/engine/schema/src/test/java/com/cloud/capacity/dao/CapacityDaoImplTest.java b/engine/schema/src/test/java/com/cloud/capacity/dao/CapacityDaoImplTest.java index 76c1092546a6..f9528d5d57ff 100644 --- a/engine/schema/src/test/java/com/cloud/capacity/dao/CapacityDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/capacity/dao/CapacityDaoImplTest.java @@ -16,40 +16,67 @@ // under the License. package com.cloud.capacity.dao; +import com.cloud.capacity.CapacityVO; +import com.cloud.host.Host; +import com.cloud.utils.Pair; +import com.cloud.utils.Ternary; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.TransactionLegacy; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mockito; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; - -import com.cloud.capacity.CapacityVO; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - @RunWith(MockitoJUnitRunner.class) public class CapacityDaoImplTest { @Spy @InjectMocks CapacityDaoImpl capacityDao = new CapacityDaoImpl(); + @Mock + private CapacityVO mockEntity; + + @Mock + private TransactionLegacy txn; + @Mock + private PreparedStatement pstmt; + @Mock + private ResultSet resultSet; + private MockedStatic mockedTransactionLegacy; + private SearchBuilder searchBuilder; private SearchCriteria searchCriteria; + private List capacityTypes; + private List expectedCapacities; @Before public void setUp() { @@ -59,6 +86,27 @@ public void setUp() { searchCriteria = mock(SearchCriteria.class); doReturn(searchBuilder).when(capacityDao).createSearchBuilder(); when(searchBuilder.create()).thenReturn(searchCriteria); + + mockedTransactionLegacy = Mockito.mockStatic(TransactionLegacy.class); + mockedTransactionLegacy.when(TransactionLegacy::currentTxn).thenReturn(txn); + + // Setup common test data + capacityTypes = Arrays.asList((short) 1, (short) 2, (short) 3); + expectedCapacities = Arrays.asList(mock(CapacityVO.class), mock(CapacityVO.class)); + doReturn(expectedCapacities).when(capacityDao).listBy(searchCriteria); + } + + private CapacityVO createMockCapacityVO(Long id) { + CapacityVO capacity = mock(CapacityVO.class); + when(capacity.getId()).thenReturn(id); + return capacity; + } + + @After + public void tearDown() { + if (mockedTransactionLegacy != null) { + mockedTransactionLegacy.close(); + } } @Test @@ -96,4 +144,410 @@ public void testListByHostIdTypesEmptyResult() { verify(capacityDao).listBy(searchCriteria); assertTrue(result.isEmpty()); } + + @Test + public void testListClustersCrossingThresholdEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + List result = capacityDao.listClustersCrossingThreshold((short)1, 1L, "cpu.threshold", 5000L); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testFindCapacityByZoneAndHostTagNoResults() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + Ternary result = capacityDao.findCapacityByZoneAndHostTag(1L, "host-tag"); + assertNotNull(result); + assertEquals(Long.valueOf(0L), result.first()); + assertEquals(Long.valueOf(0L), result.second()); + assertEquals(Long.valueOf(0L), result.third()); + } + @Test + public void testFindByHostIdType() { + CapacityVO capacity = new CapacityVO(); + capacity.setHostId(1L); + capacity.setCapacityType((short) 1); + + doReturn(capacity).when(capacityDao).findOneBy(any()); + + CapacityVO found = capacityDao.findByHostIdType(1L, (short) 1); + assertNotNull(found); + assertEquals(Long.valueOf(1L), found.getHostOrPoolId()); + } + + @Test + public void testUpdateAllocatedAddition() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + doNothing().when(txn).start(); + when(txn.commit()).thenReturn(true); + + capacityDao.updateAllocated(1L, 1000L, (short)1, true); + + verify(txn, times(1)).start(); + verify(txn, times(1)).commit(); + verify(pstmt, times(1)).executeUpdate(); + } + + @Test + public void testUpdateAllocatedSubtraction() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + doNothing().when(txn).start(); + when(txn.commit()).thenReturn(true); + + capacityDao.updateAllocated(1L, 500L, (short)1, false); + + verify(txn, times(1)).start(); + verify(txn, times(1)).commit(); + verify(pstmt, times(1)).executeUpdate(); + } + + @Test + public void testFindFilteredCapacityByEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + List result = capacityDao.findFilteredCapacityBy(null, null, null, null, Collections.emptyList(), Collections.emptyList()); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testListClustersInZoneOrPodByHostCapacitiesEmpty() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List resultZone = capacityDao.listClustersInZoneOrPodByHostCapacities(1L, 123L, 2, 2048L, true); + assertNotNull(resultZone); + assertTrue(resultZone.isEmpty()); + + List resultPod = capacityDao.listClustersInZoneOrPodByHostCapacities(1L, 123L, 2, 2048L, false); + assertNotNull(resultPod); + assertTrue(resultPod.isEmpty()); + } + + + @Test + public void testListHostsWithEnoughCapacityEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List result = capacityDao.listHostsWithEnoughCapacity(1, 100L, 200L, Host.Type.Routing.toString()); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + + @Test + public void testOrderClustersByAggregateCapacityEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + Pair, Map> result = capacityDao.orderClustersByAggregateCapacity(1L, 1L, (short) 1, true); + assertNotNull(result); + assertTrue(result.first().isEmpty()); + assertTrue(result.second().isEmpty()); + } + + + @Test + public void testOrderPodsByAggregateCapacityEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + Pair, Map> result = capacityDao.orderPodsByAggregateCapacity(1L, (short) 1); + assertNotNull(result); + assertTrue(result.first().isEmpty()); + assertTrue(result.second().isEmpty()); + } + + + @Test + public void testUpdateCapacityState() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeUpdate()).thenReturn(1); + + capacityDao.updateCapacityState(1L, 1L, 1L, 1L, "Enabled", new short[]{1}); + + verify(pstmt, times(1)).executeUpdate(); + } + + + @Test + public void testFindClusterConsumption() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(true); + when(resultSet.getFloat(1)).thenReturn(0.5f); + + float result = capacityDao.findClusterConsumption(1L, (short) 1, 1000L); + assertEquals(0.5f, result, 0.0f); + } + + @Test + public void testListPodsByHostCapacitiesEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List result = capacityDao.listPodsByHostCapacities(1L, 2, 1024L); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testOrderHostsByFreeCapacityEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + Pair, Map> result = capacityDao.orderHostsByFreeCapacity(1L, 1L, (short) 0); + assertNotNull(result); + assertTrue(result.first().isEmpty()); + } + + @Test + public void testFindByClusterPodZoneEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List result = capacityDao.findByClusterPodZone(1L, 1L, 1L); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testListCapacitiesGroupedByLevelAndTypeEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List result = capacityDao.listCapacitiesGroupedByLevelAndType(0, 1L, + 1L, 1L, 0, Collections.emptyList(), Collections.emptyList(), 1L); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testFindCapacityByEmptyResult() throws Exception { + when(txn.prepareAutoCloseStatement(anyString())).thenReturn(pstmt); + when(pstmt.executeQuery()).thenReturn(resultSet); + when(resultSet.next()).thenReturn(false); + + List result = capacityDao.findCapacityBy(1, 1L, 1L, 1L); + assertNotNull(result); + assertTrue(result.isEmpty()); + } + + @Test + public void testListHostCapacityByCapacityTypes_WithAllParameters() { + // Given + Long zoneId = 100L; + Long clusterId = 200L; + + // When + List result = capacityDao.listHostCapacityByCapacityTypes(zoneId, clusterId, capacityTypes); + + // Then + verify(searchBuilder).and("zoneId", mockEntity.getDataCenterId(), SearchCriteria.Op.EQ); + verify(searchBuilder).and("clusterId", mockEntity.getClusterId(), SearchCriteria.Op.EQ); + verify(searchBuilder).and("capacityTypes", mockEntity.getCapacityType(), SearchCriteria.Op.IN); + verify(searchBuilder).and("capacityState", mockEntity.getCapacityState(), SearchCriteria.Op.EQ); + + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria).setParameters("zoneId", zoneId); + verify(searchCriteria).setParameters("clusterId", clusterId); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + verify(capacityDao).listBy(searchCriteria); + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListHostCapacityByCapacityTypes_WithNullZoneId() { + // Given + Long clusterId = 200L; + + // When + List result = capacityDao.listHostCapacityByCapacityTypes(null, clusterId, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria, Mockito.times(0)).setParameters(eq("zoneId"), any()); + verify(searchCriteria).setParameters("clusterId", clusterId); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListHostCapacityByCapacityTypes_WithNullClusterId() { + // Given + Long zoneId = 100L; + + // When + List result = capacityDao.listHostCapacityByCapacityTypes(zoneId, null, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria).setParameters("zoneId", zoneId); + verify(searchCriteria, never()).setParameters(eq("clusterId"), any()); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListHostCapacityByCapacityTypes_WithEmptyCapacityTypes() { + // Given + Long zoneId = 100L; + Long clusterId = 200L; + List emptyCapacityTypes = Collections.emptyList(); + + // When + List result = capacityDao.listHostCapacityByCapacityTypes(zoneId, clusterId, emptyCapacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityTypes", emptyCapacityTypes.toArray()); + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListPodCapacityByCapacityTypes_WithAllParameters() { + // Given + Long zoneId = 100L; + + // When + List result = capacityDao.listPodCapacityByCapacityTypes(zoneId, capacityTypes); + + // Then + verify(searchBuilder).and("zoneId", mockEntity.getDataCenterId(), SearchCriteria.Op.EQ); + verify(searchBuilder).and("capacityTypes", mockEntity.getCapacityType(), SearchCriteria.Op.IN); + verify(searchBuilder).and("capacityState", mockEntity.getCapacityState(), SearchCriteria.Op.EQ); + + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria).setParameters("zoneId", zoneId); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListPodCapacityByCapacityTypes_WithNullZoneId() { + // When + List result = capacityDao.listPodCapacityByCapacityTypes(null, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria, never()).setParameters(eq("zoneId"), any()); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListClusterCapacityByCapacityTypes_WithAllParameters() { + // Given + Long zoneId = 100L; + Long podId = 300L; + + // When + List result = capacityDao.listClusterCapacityByCapacityTypes(zoneId, podId, capacityTypes); + + // Then + verify(searchBuilder).and("zoneId", mockEntity.getDataCenterId(), SearchCriteria.Op.EQ); + verify(searchBuilder).and("podId", mockEntity.getPodId(), SearchCriteria.Op.EQ); + verify(searchBuilder).and("capacityTypes", mockEntity.getCapacityType(), SearchCriteria.Op.IN); + verify(searchBuilder).and("capacityState", mockEntity.getCapacityState(), SearchCriteria.Op.EQ); + + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria).setParameters("zoneId", zoneId); + verify(searchCriteria).setParameters("podId", podId); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListClusterCapacityByCapacityTypes_WithNullZoneId() { + // Given + Long podId = 300L; + + // When + List result = capacityDao.listClusterCapacityByCapacityTypes(null, podId, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria, never()).setParameters(eq("zoneId"), any()); + verify(searchCriteria).setParameters("podId", podId); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListClusterCapacityByCapacityTypes_WithNullPodId() { + // Given + Long zoneId = 100L; + + // When + List result = capacityDao.listClusterCapacityByCapacityTypes(zoneId, null, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria).setParameters("zoneId", zoneId); + verify(searchCriteria, never()).setParameters(eq("podId"), any()); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testListClusterCapacityByCapacityTypes_WithBothIdsNull() { + // When + List result = capacityDao.listClusterCapacityByCapacityTypes(null, null, capacityTypes); + + // Then + verify(searchCriteria).setParameters("capacityState", "Enabled"); + verify(searchCriteria, never()).setParameters(eq("zoneId"), any()); + verify(searchCriteria, never()).setParameters(eq("podId"), any()); + verify(searchCriteria).setParameters("capacityTypes", capacityTypes.toArray()); + + assertEquals("Should return expected capacities", expectedCapacities, result); + } + + @Test + public void testAllMethods_VerifySearchBuilderSetup() { + // Test that all methods properly set up the search builder + Long zoneId = 100L; + Long clusterId = 200L; + Long podId = 300L; + + // Test host capacity method + capacityDao.listHostCapacityByCapacityTypes(zoneId, clusterId, capacityTypes); + + // Test pod capacity method + capacityDao.listPodCapacityByCapacityTypes(zoneId, capacityTypes); + + // Test cluster capacity method + capacityDao.listClusterCapacityByCapacityTypes(zoneId, podId, capacityTypes); + + // Verify createSearchBuilder was called 3 times + verify(capacityDao, times(3)).createSearchBuilder(); + + // Verify done() was called 3 times + verify(searchBuilder, times(3)).done(); + + // Verify listBy was called 3 times + verify(capacityDao, times(3)).listBy(searchCriteria); + } } diff --git a/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java b/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java index a513809be057..c1a558a72b33 100644 --- a/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/dc/dao/ClusterDaoImplTest.java @@ -17,6 +17,7 @@ package com.cloud.dc.dao; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doReturn; @@ -36,9 +37,13 @@ import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import com.cloud.cpu.CPU; import com.cloud.dc.ClusterVO; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.utils.Pair; import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; @RunWith(MockitoJUnitRunner.class) public class ClusterDaoImplTest { @@ -75,4 +80,39 @@ public void testListAllIdsEmptyResult() { verify(clusterDao).customSearch(genericSearchBuilder.create(), null); assertTrue(result.isEmpty()); } + + @Test + public void listDistinctHypervisorsArchAcrossClusters_WithZone() { + Long zoneId = 123L; + ClusterVO cluster1 = mock(ClusterVO.class); + when(cluster1.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.XenServer); + when(cluster1.getArch()).thenReturn(CPU.CPUArch.amd64); + ClusterVO cluster2 = mock(ClusterVO.class); + when(cluster2.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + when(cluster2.getArch()).thenReturn(CPU.CPUArch.arm64); + List dummyHosts = Arrays.asList(cluster1, cluster2); + doReturn(dummyHosts).when(clusterDao).search(any(SearchCriteria.class), isNull()); + List> result = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); + assertNotNull(result); + assertEquals(2, result.size()); + assertEquals(Hypervisor.HypervisorType.XenServer, result.get(0).first()); + assertEquals(CPU.CPUArch.amd64, result.get(0).second()); + assertEquals(Hypervisor.HypervisorType.KVM, result.get(1).first()); + assertEquals(CPU.CPUArch.arm64, result.get(1).second()); + } + + @Test + public void listDistinctHypervisorsArchAcrossClusters_WithoutZone() { + Long zoneId = null; + ClusterVO cluster = mock(ClusterVO.class); + when(cluster.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.VMware); + when(cluster.getArch()).thenReturn(CPU.CPUArch.amd64); + List dummyHosts = Collections.singletonList(cluster); + doReturn(dummyHosts).when(clusterDao).search(any(SearchCriteria.class), isNull()); + List> result = clusterDao.listDistinctHypervisorsAndArchExcludingExternalType(zoneId); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(Hypervisor.HypervisorType.VMware, result.get(0).first()); + assertEquals(CPU.CPUArch.amd64, result.get(0).second()); + } } diff --git a/engine/schema/src/test/java/com/cloud/gpu/dao/GpuCardDaoImplTest.java b/engine/schema/src/test/java/com/cloud/gpu/dao/GpuCardDaoImplTest.java new file mode 100644 index 000000000000..e0a283add992 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/gpu/dao/GpuCardDaoImplTest.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuCardVO; +import com.cloud.utils.db.SearchCriteria; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +@RunWith(MockitoJUnitRunner.class) +public class GpuCardDaoImplTest { + + @Spy + @InjectMocks + GpuCardDaoImpl gpuCardDaoImpl = new GpuCardDaoImpl(); + + @Test + public void findByVendorIdAndDeviceId() { + doReturn(mock(GpuCardVO.class)).when(gpuCardDaoImpl).findOneBy(any(SearchCriteria.class)); + + GpuCardVO gpuCard = gpuCardDaoImpl.findByVendorIdAndDeviceId("0d1a", "1a3b"); + Assert.assertNotNull("Expected non-null gpu card", gpuCard); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuCardDaoImpl).findOneBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", + "gpu_card.vendor_id = ? AND gpu_card.device_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } +} diff --git a/engine/schema/src/test/java/com/cloud/gpu/dao/GpuDeviceDaoImplTest.java b/engine/schema/src/test/java/com/cloud/gpu/dao/GpuDeviceDaoImplTest.java new file mode 100644 index 000000000000..1780fbd3df38 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/gpu/dao/GpuDeviceDaoImplTest.java @@ -0,0 +1,277 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.GpuDeviceVO; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.SearchCriteria; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.Collections; +import java.util.List; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class GpuDeviceDaoImplTest { + + @Spy + @InjectMocks + GpuDeviceDaoImpl gpuDeviceDao = new GpuDeviceDaoImpl(); + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void listByIds_emptyList() { + List devices = gpuDeviceDao.listByIds(null); + Assert.assertTrue("Expected empty list", devices.isEmpty()); + devices = gpuDeviceDao.listByIds(Collections.emptyList()); + Assert.assertTrue("Expected empty list", devices.isEmpty()); + } + + @Test + public void listByIds() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List devices = gpuDeviceDao.listByIds(List.of(1L, 2L, 3L)); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + SearchCriteria sc = scCaptor.getValue(); + Assert.assertEquals("Expected correct where clause", "gpu_device.id IN (?,?,?)", sc.getWhereClause().trim()); + } + + @Test + public void findByHostIdAndBusAddress() { + doReturn(mock(GpuDeviceVO.class)).when(gpuDeviceDao).findOneBy(any(SearchCriteria.class)); + + GpuDeviceVO device = gpuDeviceDao.findByHostIdAndBusAddress(1L, "0000:00:1f.6"); + + Assert.assertNotNull("Expected non-null device", device); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).findOneBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.host_id = ? AND gpu_device.bus_address = ?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void listByHostId() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List devices = gpuDeviceDao.listByHostId(1L); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.host_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void listByVmId() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List devices = gpuDeviceDao.listByVmId(1L); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + + Assert.assertEquals("Expected correct where clause", "gpu_device.vm_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void isVgpuProfileInUse() { + doReturn(1).when(gpuDeviceDao).getCount(any(SearchCriteria.class)); + + boolean vgpuProfileInUse = gpuDeviceDao.isVgpuProfileInUse(1L); + + Assert.assertTrue("Expected vGPU profile to be in use", vgpuProfileInUse); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).getCount(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.vgpu_profile_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void isGpuCardInUse() { + doReturn(1).when(gpuDeviceDao).getCount(any(SearchCriteria.class)); + + boolean vgpuProfileInUse = gpuDeviceDao.isGpuCardInUse(1L); + + Assert.assertTrue("Expected GPU Card to be in use", vgpuProfileInUse); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).getCount(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.card_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void listByHostAndVm() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).search(any(SearchCriteria.class), any()); + + List devices = gpuDeviceDao.listByHostAndVm(1L, 2L); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + ArgumentCaptor filterCaptor = ArgumentCaptor.forClass(Filter.class); + verify(gpuDeviceDao).search(scCaptor.capture(), filterCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.host_id = ? AND gpu_device.vm_id = ?", + scCaptor.getValue().getWhereClause().trim()); + Assert.assertNull("Expected no filter", filterCaptor.getValue()); + } + + @Test + public void listDevicesForAllocation() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).search(any(SearchCriteria.class), any()); + + List devices = gpuDeviceDao.listDevicesForAllocation(1L, 2L); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + ArgumentCaptor filterCaptor = ArgumentCaptor.forClass(Filter.class); + verify(gpuDeviceDao).search(scCaptor.capture(), filterCaptor.capture()); + Assert.assertEquals("Expected correct where clause", + "gpu_device.host_id = ? AND gpu_device.vgpu_profile_id=? AND gpu_device.state = ? AND gpu_device" + + ".managed_state = ? AND gpu_device.type != ?", + scCaptor.getValue().getWhereClause().trim()); + Assert.assertNull("Expected no filter", filterCaptor.getValue()); + } + + @Test + public void searchAndCountGpuDevices() { + } + + @Test + public void getDistinctGpuCardIds_no_devices() { + doReturn(null).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List cardIds = gpuDeviceDao.getDistinctGpuCardIds(); + + Assert.assertTrue("Expected empty list", cardIds.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "", scCaptor.getValue().getWhereClause().trim()); + } + + + @Test + public void getDistinctGpuCardIds() { + GpuDeviceVO device1 = mock(GpuDeviceVO.class); + GpuDeviceVO device2 = mock(GpuDeviceVO.class); + GpuDeviceVO device3 = mock(GpuDeviceVO.class); + when(device1.getCardId()).thenReturn(1L); + when(device2.getCardId()).thenReturn(2L); + when(device3.getCardId()).thenReturn(1L); + + doReturn(List.of(device1, device2, device3)).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List cardIds = gpuDeviceDao.getDistinctGpuCardIds(); + + Assert.assertEquals("Expected 2 card IDs", 2, cardIds.size()); + + Assert.assertTrue("Expected card ID 1 in list", cardIds.contains(1L)); + Assert.assertTrue("Expected card ID 2 in list", cardIds.contains(2L)); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "", scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void getDistinctVgpuProfileIds_no_devices() { + doReturn(null).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List cardIds = gpuDeviceDao.getDistinctVgpuProfileIds(); + + Assert.assertTrue("Expected empty list", cardIds.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "", scCaptor.getValue().getWhereClause().trim()); + } + + + @Test + public void getDistinctVgpuProfileIds() { + GpuDeviceVO device1 = mock(GpuDeviceVO.class); + GpuDeviceVO device2 = mock(GpuDeviceVO.class); + GpuDeviceVO device3 = mock(GpuDeviceVO.class); + when(device1.getVgpuProfileId()).thenReturn(1L); + when(device2.getVgpuProfileId()).thenReturn(2L); + when(device3.getVgpuProfileId()).thenReturn(1L); + + doReturn(List.of(device1, device2, device3)).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List cardIds = gpuDeviceDao.getDistinctVgpuProfileIds(); + + Assert.assertEquals("Expected 2 VgpuProfile IDs", 2, cardIds.size()); + + Assert.assertTrue("Expected VgpuProfile ID 1 in list", cardIds.contains(1L)); + Assert.assertTrue("Expected VgpuProfile ID 2 in list", cardIds.contains(2L)); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "", scCaptor.getValue().getWhereClause().trim()); + } + + + @Test + public void listByParentGpuDeviceId() { + doReturn(List.of(mock(GpuDeviceVO.class))).when(gpuDeviceDao).listBy(any(SearchCriteria.class)); + + List devices = gpuDeviceDao.listByParentGpuDeviceId(1L); + + Assert.assertFalse("Expected non empty list", devices.isEmpty()); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(gpuDeviceDao).listBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "gpu_device.parent_gpu_device_id = ?", + scCaptor.getValue().getWhereClause().trim()); + } +} diff --git a/engine/schema/src/test/java/com/cloud/gpu/dao/VgpuProfileDaoImplTest.java b/engine/schema/src/test/java/com/cloud/gpu/dao/VgpuProfileDaoImplTest.java new file mode 100644 index 000000000000..cd7199d020f3 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/gpu/dao/VgpuProfileDaoImplTest.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 com.cloud.gpu.dao; + +import com.cloud.gpu.VgpuProfileVO; +import com.cloud.utils.db.SearchCriteria; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +@RunWith(MockitoJUnitRunner.class) +public class VgpuProfileDaoImplTest { + + @Spy + @InjectMocks + VgpuProfileDaoImpl vgpuProfileDaoImpl = new VgpuProfileDaoImpl(); + + @Test + public void findByNameAndCardId() { + doReturn(mock(VgpuProfileVO.class)).when(vgpuProfileDaoImpl).findOneBy(any(SearchCriteria.class)); + + VgpuProfileVO vgpuProfile = vgpuProfileDaoImpl.findByNameAndCardId("test-profile", 1L); + Assert.assertNotNull("Expected non-null vgpu profile", vgpuProfile); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(vgpuProfileDaoImpl).findOneBy(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", + "vgpu_profile.name = ? AND vgpu_profile.card_id=?", + scCaptor.getValue().getWhereClause().trim()); + } + + @Test + public void removeByCardId() { + doReturn(1).when(vgpuProfileDaoImpl).remove(any(SearchCriteria.class)); + + int removed = vgpuProfileDaoImpl.removeByCardId(123L); + Assert.assertEquals("Expected one vgpu profile removed", 1, removed); + + ArgumentCaptor scCaptor = ArgumentCaptor.forClass(SearchCriteria.class); + verify(vgpuProfileDaoImpl).remove(scCaptor.capture()); + Assert.assertEquals("Expected correct where clause", "vgpu_profile.card_id=?", + scCaptor.getValue().getWhereClause().trim()); + } +} diff --git a/engine/schema/src/test/java/com/cloud/host/dao/HostDaoImplTest.java b/engine/schema/src/test/java/com/cloud/host/dao/HostDaoImplTest.java index 8f41162f2429..c76eedb01e93 100644 --- a/engine/schema/src/test/java/com/cloud/host/dao/HostDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/host/dao/HostDaoImplTest.java @@ -16,7 +16,18 @@ // under the License. package com.cloud.host.dao; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import org.junit.Assert; import org.junit.Test; @@ -26,6 +37,7 @@ import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import com.cloud.cpu.CPU; import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.Status; @@ -52,10 +64,10 @@ public class HostDaoImplTest { public void testCountUpAndEnabledHostsInZone() { long testZoneId = 100L; hostDao.HostTypeCountSearch = mockSearchBuilder; - Mockito.when(mockSearchBuilder.create()).thenReturn(mockSearchCriteria); - Mockito.doNothing().when(mockSearchCriteria).setParameters(Mockito.anyString(), Mockito.any()); + when(mockSearchBuilder.create()).thenReturn(mockSearchCriteria); + Mockito.doNothing().when(mockSearchCriteria).setParameters(Mockito.anyString(), any()); int expected = 5; - Mockito.doReturn(expected).when(hostDao).getCount(mockSearchCriteria); + doReturn(expected).when(hostDao).getCount(mockSearchCriteria); Integer count = hostDao.countUpAndEnabledHostsInZone(testZoneId); Assert.assertSame(expected, count); Mockito.verify(mockSearchCriteria).setParameters("type", Host.Type.Routing); @@ -70,16 +82,16 @@ public void testCountAllHostsAndCPUSocketsByType() { GenericDaoBase.SumCount mockSumCount = new GenericDaoBase.SumCount(); mockSumCount.count = 10; mockSumCount.sum = 20; - HostVO host = Mockito.mock(HostVO.class); - GenericSearchBuilder sb = Mockito.mock(GenericSearchBuilder.class); - Mockito.when(sb.entity()).thenReturn(host); - Mockito.doReturn(sb).when(hostDao).createSearchBuilder(GenericDaoBase.SumCount.class); - SearchCriteria sc = Mockito.mock(SearchCriteria.class); - Mockito.when(sb.create()).thenReturn(sc); - Mockito.doReturn(List.of(mockSumCount)).when(hostDao).customSearch(Mockito.any(SearchCriteria.class), Mockito.any()); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + doReturn(sb).when(hostDao).createSearchBuilder(GenericDaoBase.SumCount.class); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + doReturn(List.of(mockSumCount)).when(hostDao).customSearch(any(SearchCriteria.class), any()); Pair result = hostDao.countAllHostsAndCPUSocketsByType(type); - Assert.assertEquals(10, result.first().intValue()); - Assert.assertEquals(20, result.second().intValue()); + assertEquals(10, result.first().intValue()); + assertEquals(20, result.second().intValue()); Mockito.verify(sc).setParameters("type", type); } @@ -87,13 +99,13 @@ public void testCountAllHostsAndCPUSocketsByType() { public void testIsHostUp() { long testHostId = 101L; List statuses = List.of(Status.Up); - HostVO host = Mockito.mock(HostVO.class); - GenericSearchBuilder sb = Mockito.mock(GenericSearchBuilder.class); - Mockito.when(sb.entity()).thenReturn(host); - SearchCriteria sc = Mockito.mock(SearchCriteria.class); - Mockito.when(sb.create()).thenReturn(sc); - Mockito.doReturn(sb).when(hostDao).createSearchBuilder(Status.class); - Mockito.doReturn(statuses).when(hostDao).customSearch(Mockito.any(SearchCriteria.class), Mockito.any()); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + doReturn(sb).when(hostDao).createSearchBuilder(Status.class); + doReturn(statuses).when(hostDao).customSearch(any(SearchCriteria.class), any()); boolean result = hostDao.isHostUp(testHostId); Assert.assertTrue("Host should be up", result); Mockito.verify(sc).setParameters("id", testHostId); @@ -109,17 +121,17 @@ public void testFindHostIdsByZoneClusterResourceStateTypeAndHypervisorType() { List types = List.of(Host.Type.Routing); List hypervisorTypes = List.of(Hypervisor.HypervisorType.KVM); List mockResults = List.of(1001L, 1002L); // Mocked result - HostVO host = Mockito.mock(HostVO.class); - GenericSearchBuilder sb = Mockito.mock(GenericSearchBuilder.class); - Mockito.when(sb.entity()).thenReturn(host); - SearchCriteria sc = Mockito.mock(SearchCriteria.class); - Mockito.when(sb.create()).thenReturn(sc); - Mockito.when(sb.and()).thenReturn(sb); - Mockito.doReturn(sb).when(hostDao).createSearchBuilder(Long.class); - Mockito.doReturn(mockResults).when(hostDao).customSearch(Mockito.any(SearchCriteria.class), Mockito.any()); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + when(sb.and()).thenReturn(sb); + doReturn(sb).when(hostDao).createSearchBuilder(Long.class); + doReturn(mockResults).when(hostDao).customSearch(any(SearchCriteria.class), any()); List hostIds = hostDao.findHostIdsByZoneClusterResourceStateTypeAndHypervisorType( zoneId, clusterId, msId, resourceStates, types, hypervisorTypes); - Assert.assertEquals(mockResults, hostIds); + assertEquals(mockResults, hostIds); Mockito.verify(sc).setParameters("zoneId", zoneId); Mockito.verify(sc).setParameters("clusterId", clusterId); Mockito.verify(sc).setParameters("msId", msId); @@ -132,15 +144,16 @@ public void testFindHostIdsByZoneClusterResourceStateTypeAndHypervisorType() { public void testListDistinctHypervisorTypes() { Long zoneId = 1L; List mockResults = List.of(Hypervisor.HypervisorType.KVM, Hypervisor.HypervisorType.XenServer); - HostVO host = Mockito.mock(HostVO.class); - GenericSearchBuilder sb = Mockito.mock(GenericSearchBuilder.class); - Mockito.when(sb.entity()).thenReturn(host); - SearchCriteria sc = Mockito.mock(SearchCriteria.class); - Mockito.when(sb.create()).thenReturn(sc); - Mockito.doReturn(sb).when(hostDao).createSearchBuilder(Hypervisor.HypervisorType.class); - Mockito.doReturn(mockResults).when(hostDao).customSearch(Mockito.any(SearchCriteria.class), Mockito.any()); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + doReturn(sb).when(hostDao).createSearchBuilder(String.class); + doReturn(mockResults.stream().map(h -> h.name()).collect(Collectors.toList())).when(hostDao) + .customSearch(any(SearchCriteria.class), any()); List hypervisorTypes = hostDao.listDistinctHypervisorTypes(zoneId); - Assert.assertEquals(mockResults, hypervisorTypes); + assertEquals(mockResults, hypervisorTypes); Mockito.verify(sc).setParameters("zoneId", zoneId); Mockito.verify(sc).setParameters("type", Host.Type.Routing); } @@ -148,12 +161,12 @@ public void testListDistinctHypervisorTypes() { @Test public void testListByIds() { List ids = List.of(101L, 102L); - List mockResults = List.of(Mockito.mock(HostVO.class), Mockito.mock(HostVO.class)); + List mockResults = List.of(mock(HostVO.class), mock(HostVO.class)); hostDao.IdsSearch = mockSearchBuilder; - Mockito.when(mockSearchBuilder.create()).thenReturn(mockSearchCriteria); - Mockito.doReturn(mockResults).when(hostDao).search(Mockito.any(SearchCriteria.class), Mockito.any()); + when(mockSearchBuilder.create()).thenReturn(mockSearchCriteria); + doReturn(mockResults).when(hostDao).search(any(SearchCriteria.class), any()); List hosts = hostDao.listByIds(ids); - Assert.assertEquals(mockResults, hosts); + assertEquals(mockResults, hosts); Mockito.verify(mockSearchCriteria).setParameters("id", ids.toArray()); Mockito.verify(hostDao).search(mockSearchCriteria, null); } @@ -166,15 +179,15 @@ public void testListIdsBy() { Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.KVM; Long zoneId = 1L, podId = 2L, clusterId = 3L; List mockResults = List.of(1001L, 1002L); - HostVO host = Mockito.mock(HostVO.class); - GenericSearchBuilder sb = Mockito.mock(GenericSearchBuilder.class); - Mockito.when(sb.entity()).thenReturn(host); - SearchCriteria sc = Mockito.mock(SearchCriteria.class); - Mockito.when(sb.create()).thenReturn(sc); - Mockito.doReturn(sb).when(hostDao).createSearchBuilder(Long.class); - Mockito.doReturn(mockResults).when(hostDao).customSearch(Mockito.any(SearchCriteria.class), Mockito.any()); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + doReturn(sb).when(hostDao).createSearchBuilder(Long.class); + doReturn(mockResults).when(hostDao).customSearch(any(SearchCriteria.class), any()); List hostIds = hostDao.listIdsBy(type, status, resourceState, hypervisorType, zoneId, podId, clusterId); - Assert.assertEquals(mockResults, hostIds); + assertEquals(mockResults, hostIds); Mockito.verify(sc).setParameters("type", type); Mockito.verify(sc).setParameters("status", status); Mockito.verify(sc).setParameters("resourceState", resourceState); @@ -183,4 +196,57 @@ public void testListIdsBy() { Mockito.verify(sc).setParameters("podId", podId); Mockito.verify(sc).setParameters("clusterId", clusterId); } + + @Test + public void testListDistinctHypervisorArchTypes_WithZone() { + Long zoneId = 123L; + HostVO host1 = mock(HostVO.class); + when(host1.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.XenServer); + when(host1.getArch()).thenReturn(CPU.CPUArch.amd64); + HostVO host2 = mock(HostVO.class); + when(host2.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + when(host2.getArch()).thenReturn(CPU.CPUArch.arm64); + List dummyHosts = Arrays.asList(host1, host2); + doReturn(dummyHosts).when(hostDao).search(any(SearchCriteria.class), isNull()); + List> result = hostDao.listDistinctHypervisorArchTypes(zoneId); + assertNotNull(result); + assertEquals(2, result.size()); + assertEquals(Hypervisor.HypervisorType.XenServer, result.get(0).first()); + assertEquals(CPU.CPUArch.amd64, result.get(0).second()); + assertEquals(Hypervisor.HypervisorType.KVM, result.get(1).first()); + assertEquals(CPU.CPUArch.arm64, result.get(1).second()); + } + + @Test + public void testListDistinctHypervisorArchTypes_WithoutZone() { + Long zoneId = null; + HostVO host1 = mock(HostVO.class); + when(host1.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.VMware); + when(host1.getArch()).thenReturn(CPU.CPUArch.amd64); + List dummyHosts = Collections.singletonList(host1); + doReturn(dummyHosts).when(hostDao).search(any(SearchCriteria.class), isNull()); + List> result = hostDao.listDistinctHypervisorArchTypes(zoneId); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(Hypervisor.HypervisorType.VMware, result.get(0).first()); + assertEquals(CPU.CPUArch.amd64, result.get(0).second()); + } + + @Test + public void testListDistinctArchTypes() { + Long clusterId = 1L; + List mockResults = List.of(CPU.CPUArch.amd64, CPU.CPUArch.arm64); + HostVO host = mock(HostVO.class); + GenericSearchBuilder sb = mock(GenericSearchBuilder.class); + when(sb.entity()).thenReturn(host); + SearchCriteria sc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + doReturn(sb).when(hostDao).createSearchBuilder(String.class); + doReturn(mockResults.stream().map(h -> h.getType()).collect(Collectors.toList())).when(hostDao) + .customSearch(any(SearchCriteria.class), any()); + List hypervisorTypes = hostDao.listDistinctArchTypes(clusterId); + assertEquals(mockResults, hypervisorTypes); + Mockito.verify(sc).setParameters("clusterId", clusterId); + Mockito.verify(sc).setParameters("type", Host.Type.Routing); + } } diff --git a/engine/schema/src/test/java/com/cloud/network/dao/LoadBalancerVOTest.java b/engine/schema/src/test/java/com/cloud/network/dao/LoadBalancerVOTest.java new file mode 100644 index 000000000000..8f84ecac3dda --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/network/dao/LoadBalancerVOTest.java @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.network.dao; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class LoadBalancerVOTest { + @Test + public void testSetCidrList() { + LoadBalancerVO loadBalancer = new LoadBalancerVO(); + String cidrList = "192.168.1.0/24,10.0.0.0/16"; + loadBalancer.setCidrList(cidrList); + assertEquals(cidrList, loadBalancer.getCidrList()); + } + + @Test + public void testSetCidrListEmpty() { + LoadBalancerVO loadBalancer = new LoadBalancerVO(); + loadBalancer.setCidrList(""); + assertEquals("", loadBalancer.getCidrList()); + } + + @Test + public void testSetCidrListNull() { + LoadBalancerVO loadBalancer = new LoadBalancerVO(); + loadBalancer.setCidrList(null); + assertNull(loadBalancer.getCidrList()); + } +} diff --git a/engine/schema/src/test/java/com/cloud/network/dao/NetworkDaoImplTest.java b/engine/schema/src/test/java/com/cloud/network/dao/NetworkDaoImplTest.java index ab5f43521052..a78eab568af0 100644 --- a/engine/schema/src/test/java/com/cloud/network/dao/NetworkDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/network/dao/NetworkDaoImplTest.java @@ -22,7 +22,6 @@ import com.cloud.network.Networks; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.TransactionLegacy; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,7 +29,6 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; - import java.util.List; @RunWith(MockitoJUnitRunner.class) @@ -46,26 +44,21 @@ public class NetworkDaoImplTest { List listNetworkVoMock; @Test - public void listByPhysicalNetworkTrafficTypeTestSetParametersValidation() throws Exception { + public void listByPhysicalNetworkTrafficTypeTestSetParametersValidation() { NetworkDaoImpl networkDaoImplSpy = Mockito.spy(NetworkDaoImpl.class); - TransactionLegacy txn = TransactionLegacy.open("runNetworkDaoImplTest"); - try { - networkDaoImplSpy.AllFieldsSearch = searchBuilderNetworkVoMock; - Mockito.doReturn(searchCriteriaNetworkVoMock).when(searchBuilderNetworkVoMock).create(); - Mockito.doNothing().when(searchCriteriaNetworkVoMock).setParameters(Mockito.anyString(), Mockito.any()); - Mockito.doReturn(listNetworkVoMock).when(networkDaoImplSpy).listBy(Mockito.any(SearchCriteria.class)); - - long expectedPhysicalNetwork = 2513l; + networkDaoImplSpy.AllFieldsSearch = searchBuilderNetworkVoMock; + Mockito.doReturn(searchCriteriaNetworkVoMock).when(searchBuilderNetworkVoMock).create(); + Mockito.doNothing().when(searchCriteriaNetworkVoMock).setParameters(Mockito.anyString(), Mockito.any()); + Mockito.doReturn(listNetworkVoMock).when(networkDaoImplSpy).listBy(Mockito.any(SearchCriteria.class)); - for (Networks.TrafficType trafficType : Networks.TrafficType.values()) { - List result = networkDaoImplSpy.listByPhysicalNetworkTrafficType(expectedPhysicalNetwork, trafficType); - Assert.assertEquals(listNetworkVoMock, result); - Mockito.verify(searchCriteriaNetworkVoMock).setParameters("trafficType", trafficType); - } + long expectedPhysicalNetwork = 2513l; - Mockito.verify(searchCriteriaNetworkVoMock, Mockito.times(Networks.TrafficType.values().length)).setParameters("physicalNetwork", expectedPhysicalNetwork); - } finally { - txn.close(); + for (Networks.TrafficType trafficType : Networks.TrafficType.values()) { + List result = networkDaoImplSpy.listByPhysicalNetworkTrafficType(expectedPhysicalNetwork, trafficType); + Assert.assertEquals(listNetworkVoMock, result); + Mockito.verify(searchCriteriaNetworkVoMock).setParameters("trafficType", trafficType); } + + Mockito.verify(searchCriteriaNetworkVoMock, Mockito.times(Networks.TrafficType.values().length)).setParameters("physicalNetworkId", expectedPhysicalNetwork); } } diff --git a/engine/schema/src/test/java/com/cloud/storage/dao/VMTemplateDaoImplTest.java b/engine/schema/src/test/java/com/cloud/storage/dao/VMTemplateDaoImplTest.java new file mode 100644 index 000000000000..5cff77869be8 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/storage/dao/VMTemplateDaoImplTest.java @@ -0,0 +1,421 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.storage.dao; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import com.cloud.cpu.CPU; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.storage.Storage; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VMTemplateZoneVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@RunWith(MockitoJUnitRunner.class) +public class VMTemplateDaoImplTest { + + @Mock + HostDao hostDao; + + @Mock + VMTemplateZoneDao templateZoneDao; + + @Spy + @InjectMocks + VMTemplateDaoImpl templateDao = new VMTemplateDaoImpl(); + + @Test + public void testFindLatestTemplateByName_ReturnsTemplate() { + VMTemplateVO expectedTemplate = new VMTemplateVO(); + List returnedList = Collections.singletonList(expectedTemplate); + doReturn(returnedList).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + VMTemplateVO result = templateDao.findLatestTemplateByName("test", Hypervisor.HypervisorType.KVM, + CPU.CPUArch.getDefault()); + assertNotNull("Expected a non-null template", result); + assertEquals("Expected the returned template to be the first element", expectedTemplate, result); + } + + @Test + public void testFindLatestTemplateByName_ReturnsNullWhenNoTemplateFound() { + List emptyList = Collections.emptyList(); + doReturn(emptyList).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + VMTemplateVO result = templateDao.findLatestTemplateByName("test", Hypervisor.HypervisorType.VMware, + CPU.CPUArch.getDefault()); + assertNull("Expected null when no templates are found", result); + } + + @Test + public void testFindLatestTemplateByName_NullArch() { + VMTemplateVO expectedTemplate = new VMTemplateVO(); + List returnedList = Collections.singletonList(expectedTemplate); + doReturn(returnedList).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + VMTemplateVO result = templateDao.findLatestTemplateByName("test", Hypervisor.HypervisorType.XenServer, + null); + assertNotNull("Expected a non-null template even if arch is null", result); + assertEquals("Expected the returned template to be the first element", expectedTemplate, result); + } + + @Test + public void testGetSortedTemplatesListWithPreferredArch_PreferredProvided() { + VMTemplateVO templatePreferred = Mockito.mock(VMTemplateVO.class); + when(templatePreferred.getArch()).thenReturn(CPU.CPUArch.amd64); + VMTemplateVO templateOther = Mockito.mock(VMTemplateVO.class); + when(templateOther.getArch()).thenReturn(CPU.CPUArch.arm64); + + Map, VMTemplateVO> uniqueTemplates = new HashMap<>(); + uniqueTemplates.put(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64), templatePreferred); + uniqueTemplates.put(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64), templateOther); + List sortedList = templateDao.getSortedTemplatesListWithPreferredArch(uniqueTemplates, + CPU.CPUArch.amd64.getType()); + assertEquals(2, sortedList.size()); + assertEquals(templatePreferred, sortedList.get(0)); + assertEquals(templateOther, sortedList.get(1)); + } + + @Test + public void testGetSortedTemplatesListWithPreferredArch_NoPreferred() { + VMTemplateVO template1 = Mockito.mock(VMTemplateVO.class); + when(template1.getId()).thenReturn(1L); + VMTemplateVO template2 = Mockito.mock(VMTemplateVO.class); + when(template2.getId()).thenReturn(2L); + Map, VMTemplateVO> uniqueTemplates = new HashMap<>(); + uniqueTemplates.put(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64), template1); + uniqueTemplates.put(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64), template2); + List sortedList = templateDao.getSortedTemplatesListWithPreferredArch(uniqueTemplates, ""); + assertEquals(2, sortedList.size()); + assertEquals(template2, sortedList.get(0)); + assertEquals(template1, sortedList.get(1)); + } + + @Test + public void testFindSystemVMReadyTemplates() { + long zoneId = 1L; + Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.KVM; + String preferredArch = CPU.CPUArch.arm64.getType(); + List> availableHypervisors = new ArrayList<>(); + availableHypervisors.add(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64)); + availableHypervisors.add(new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64)); + doReturn(availableHypervisors).when(hostDao).listDistinctHypervisorArchTypes(zoneId); + VMTemplateVO template1 = Mockito.mock(VMTemplateVO.class); + when(template1.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + when(template1.getArch()).thenReturn(CPU.CPUArch.amd64); + VMTemplateVO template2 = Mockito.mock(VMTemplateVO.class); + when(template2.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + when(template2.getArch()).thenReturn(CPU.CPUArch.arm64); + List templatesFromDb = Arrays.asList(template1, template2); + doReturn(templatesFromDb).when(templateDao).listBy(any(), any()); + SearchBuilder sb = mock(SearchBuilder.class); + templateDao.readySystemTemplateSearch = sb; + when(sb.create()).thenReturn(mock(SearchCriteria.class)); + List result = templateDao.findSystemVMReadyTemplates(zoneId, hypervisorType, preferredArch); + assertNotNull(result); + assertEquals(2, result.size()); + assertEquals(template2, result.get(0)); + assertEquals(template1, result.get(1)); + } + + @Test + public void testFindRoutingTemplates() { + Hypervisor.HypervisorType hType = Hypervisor.HypervisorType.KVM; + String templateName = "TestRouting"; + String preferredArch = CPU.CPUArch.amd64.getType(); + VMTemplateVO template = Mockito.mock(VMTemplateVO.class); + when(template.getArch()).thenReturn(CPU.CPUArch.amd64); + List templatesFromDb = Collections.singletonList(template); + doReturn(templatesFromDb).when(templateDao).listBy(any(), any()); + SearchBuilder sb = mock(SearchBuilder.class); + when(sb.create()).thenReturn(mock(SearchCriteria.class)); + templateDao.tmpltTypeHyperSearch2 = sb; + List result = templateDao.findRoutingTemplates(hType, templateName, preferredArch); + assertNotNull(result); + assertEquals(1, result.size()); + assertEquals(template, result.get(0)); + } + + @Test + public void testFindLatestTemplateByTypeAndHypervisorAndArch_Found() { + Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.KVM; + CPU.CPUArch arch = CPU.CPUArch.amd64; + Storage.TemplateType type = Storage.TemplateType.SYSTEM; + VMTemplateVO template = Mockito.mock(VMTemplateVO.class); + List templatesFromDb = Collections.singletonList(template); + doReturn(templatesFromDb).when(templateDao).listBy(any(), any()); + VMTemplateVO result = templateDao.findLatestTemplateByTypeAndHypervisorAndArch(hypervisorType, arch, type); + assertNotNull(result); + assertEquals(template, result); + } + + @Test + public void testFindLatestTemplateByTypeAndHypervisorAndArch_NotFound() { + Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.KVM; + CPU.CPUArch arch = CPU.CPUArch.x86; + Storage.TemplateType type = Storage.TemplateType.SYSTEM; + doReturn(Collections.emptyList()).when(templateDao).listBy(any(), any()); + VMTemplateVO result = templateDao.findLatestTemplateByTypeAndHypervisorAndArch(hypervisorType, arch, type); + assertNull(result); + } + + private void mockTemplateZoneJoin() { + VMTemplateZoneVO templateZoneVO = mock(VMTemplateZoneVO.class); + SearchBuilder templateZoneVOSearchBuilder = mock(SearchBuilder.class); + when(templateZoneVOSearchBuilder.entity()).thenReturn(templateZoneVO); + when(templateZoneDao.createSearchBuilder()).thenReturn(templateZoneVOSearchBuilder); + } + + @Test + public void testListTemplateIsoByArchAndZone_WithDataCenterId() { + Long dataCenterId = 1L; + CPU.CPUArch arch = CPU.CPUArch.getDefault(); + Boolean isIso = true; + VMTemplateVO templateVO = mock(VMTemplateVO.class); + GenericSearchBuilder searchBuilder = mock(GenericSearchBuilder.class); + when(searchBuilder.entity()).thenReturn(templateVO); + SearchCriteriasearchCriteria = mock(SearchCriteria.class); + when(templateDao.createSearchBuilder(Long.class)).thenReturn(searchBuilder); + when(searchBuilder.create()).thenReturn(searchCriteria); + mockTemplateZoneJoin(); + doReturn(new ArrayList<>()).when(templateDao).customSearch(searchCriteria, null); + List result = templateDao.listTemplateIsoByArchVnfAndZone(dataCenterId, arch, isIso, false); + assertNotNull(result); + verify(searchBuilder, times(1)).select(null, SearchCriteria.Func.DISTINCT, templateVO.getGuestOSId()); + verify(searchBuilder, times(1)).and(eq("state"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("type"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("arch"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).and(eq("isIso"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).join(eq("templateZoneSearch"), any(), any(), any(), eq(JoinBuilder.JoinType.INNER)); + verify(templateDao, times(1)).customSearch(searchCriteria, null); + } + + @Test + public void testListTemplateIsoByArchAndZone_WithoutDataCenterId() { + Long dataCenterId = null; + CPU.CPUArch arch = CPU.CPUArch.getDefault(); + Boolean isIso = false; + VMTemplateVO templateVO = mock(VMTemplateVO.class); + GenericSearchBuilder searchBuilder = mock(GenericSearchBuilder.class); + when(searchBuilder.entity()).thenReturn(templateVO); + SearchCriteriasearchCriteria = mock(SearchCriteria.class); + when(templateDao.createSearchBuilder(Long.class)).thenReturn(searchBuilder); + when(searchBuilder.create()).thenReturn(searchCriteria); + doReturn(new ArrayList<>()).when(templateDao).customSearch(searchCriteria, null); + List result = templateDao.listTemplateIsoByArchVnfAndZone(dataCenterId, arch, isIso, false); + assertNotNull(result); + verify(searchBuilder, times(1)).select(null, SearchCriteria.Func.DISTINCT, templateVO.getGuestOSId()); + verify(searchBuilder, times(1)).and(eq("state"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("type"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("arch"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).and(eq("isIso"), any(), eq(SearchCriteria.Op.NEQ)); + verify(searchBuilder, never()).join(eq("templateZoneSearch"), any(), any(), any(), eq(JoinBuilder.JoinType.INNER)); + verify(templateDao, times(1)).customSearch(searchCriteria, null); + } + + @Test + public void testListTemplateIsoByArchAndZone_WithoutArch() { + Long dataCenterId = 1L; + CPU.CPUArch arch = null; + Boolean isIso = true; + VMTemplateVO templateVO = mock(VMTemplateVO.class); + GenericSearchBuilder searchBuilder = mock(GenericSearchBuilder.class); + when(searchBuilder.entity()).thenReturn(templateVO); + SearchCriteriasearchCriteria = mock(SearchCriteria.class); + when(templateDao.createSearchBuilder(Long.class)).thenReturn(searchBuilder); + when(searchBuilder.create()).thenReturn(searchCriteria); + mockTemplateZoneJoin(); + doReturn(new ArrayList<>()).when(templateDao).customSearch(searchCriteria, null); + List result = templateDao.listTemplateIsoByArchVnfAndZone(dataCenterId, arch, isIso, false); + assertNotNull(result); + verify(searchBuilder, times(1)).select(null, SearchCriteria.Func.DISTINCT, templateVO.getGuestOSId()); + verify(searchBuilder, times(1)).and(eq("state"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("type"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("arch"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).and(eq("isIso"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).join(eq("templateZoneSearch"), any(), any(), any(), eq(JoinBuilder.JoinType.INNER)); + verify(templateDao, times(1)).customSearch(searchCriteria, null); + } + + @Test + public void testListTemplateIsoByArchAndZone_WithoutIsIso() { + Long dataCenterId = 1L; + CPU.CPUArch arch = CPU.CPUArch.getDefault(); + Boolean isIso = null; + VMTemplateVO templateVO = mock(VMTemplateVO.class); + GenericSearchBuilder searchBuilder = mock(GenericSearchBuilder.class); + when(searchBuilder.entity()).thenReturn(templateVO); + SearchCriteriasearchCriteria = mock(SearchCriteria.class); + when(templateDao.createSearchBuilder(Long.class)).thenReturn(searchBuilder); + when(searchBuilder.create()).thenReturn(searchCriteria); + mockTemplateZoneJoin(); + doReturn(new ArrayList<>()).when(templateDao).customSearch(searchCriteria, null); + List result = templateDao.listTemplateIsoByArchVnfAndZone(dataCenterId, arch, isIso, false); + assertNotNull(result); + verify(searchBuilder, times(1)).select(null, SearchCriteria.Func.DISTINCT, templateVO.getGuestOSId()); + verify(searchBuilder, times(1)).and(eq("state"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("type"), any(), eq(SearchCriteria.Op.IN)); + verify(searchBuilder, times(1)).and(eq("arch"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, never()).and(eq("isIso"), any(), eq(SearchCriteria.Op.NEQ)); + verify(searchBuilder, never()).and(eq("isIso"), any(), eq(SearchCriteria.Op.EQ)); + verify(searchBuilder, times(1)).join(eq("templateZoneSearch"), any(), any(), any(), eq(JoinBuilder.JoinType.INNER)); + verify(templateDao, times(1)).customSearch(searchCriteria, null); + } + + @Test + public void testListIdsByExtensionId_ReturnsIds() { + long extensionId = 42L; + List expectedIds = Arrays.asList(1L, 2L, 3L); + GenericSearchBuilder searchBuilder = mock(GenericSearchBuilder.class); + SearchCriteria searchCriteria = mock(SearchCriteria.class); + when(templateDao.createSearchBuilder(Long.class)).thenReturn(searchBuilder); + when(searchBuilder.entity()).thenReturn(mock(VMTemplateVO.class)); + when(searchBuilder.create()).thenReturn(searchCriteria); + doReturn(expectedIds).when(templateDao).customSearchIncludingRemoved(eq(searchCriteria), isNull()); + List result = templateDao.listIdsByExtensionId(extensionId); + assertEquals(expectedIds, result); + verify(searchCriteria).setParameters("extensionId", extensionId); + verify(templateDao).customSearchIncludingRemoved(eq(searchCriteria), isNull()); + } + + @Test + public void testFindSystemVMReadyTemplate() { + Long zoneId = 1L; + VMTemplateVO systemVmTemplate1 = mock(VMTemplateVO.class); + Mockito.when(systemVmTemplate1.getArch()).thenReturn(CPU.CPUArch.x86); + VMTemplateVO systemVmTemplate2 = mock(VMTemplateVO.class); + Mockito.when(systemVmTemplate2.getArch()).thenReturn(CPU.CPUArch.x86); + VMTemplateVO systemVmTemplate3 = mock(VMTemplateVO.class); + Mockito.when(systemVmTemplate3.getArch()).thenReturn(CPU.CPUArch.arm64); + Mockito.when(systemVmTemplate3.getHypervisorType()).thenReturn(Hypervisor.HypervisorType.KVM); + List templates = Arrays.asList(systemVmTemplate1, systemVmTemplate2, systemVmTemplate3); + Mockito.when(hostDao.listDistinctHypervisorTypes(zoneId)).thenReturn(Arrays.asList(Hypervisor.HypervisorType.KVM)); + SearchBuilder sb = mock(SearchBuilder.class); + templateDao.readySystemTemplateSearch = sb; + when(sb.create()).thenReturn(mock(SearchCriteria.class)); + doReturn(templates).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + VMTemplateVO readyTemplate = templateDao.findSystemVMReadyTemplate(zoneId, Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64.getType()); + Assert.assertEquals(CPU.CPUArch.arm64, readyTemplate.getArch()); + } + + @Test + public void findActiveSystemTemplateByHypervisorArchAndUrlPath_ReturnsTemplate() { + VMTemplateVO expectedTemplate = mock(VMTemplateVO.class); + SearchBuilder sb = mock(SearchBuilder.class); + when(sb.entity()).thenReturn(expectedTemplate); + SearchCriteriasc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + when(templateDao.createSearchBuilder()).thenReturn(sb); + List templates = Collections.singletonList(expectedTemplate); + doReturn(templates).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + + VMTemplateVO result = templateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath( + Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64, "testPath"); + + assertNotNull(result); + assertEquals(expectedTemplate, result); + } + + @Test + public void findActiveSystemTemplateByHypervisorArchAndUrlPath_ReturnsNullWhenNoTemplatesFound() { + VMTemplateVO template = mock(VMTemplateVO.class); + SearchBuilder sb = mock(SearchBuilder.class); + when(sb.entity()).thenReturn(template); + SearchCriteriasc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + when(templateDao.createSearchBuilder()).thenReturn(sb); + doReturn(Collections.emptyList()).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + + VMTemplateVO result = templateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath( + Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64, "testPath"); + + assertNull(result); + } + + @Test + public void findActiveSystemTemplateByHypervisorArchAndUrlPath_NullHypervisor() { + VMTemplateVO expectedTemplate = mock(VMTemplateVO.class); + SearchBuilder sb = mock(SearchBuilder.class); + when(sb.entity()).thenReturn(expectedTemplate); + SearchCriteriasc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + when(templateDao.createSearchBuilder()).thenReturn(sb); + List templates = Collections.singletonList(expectedTemplate); + doReturn(templates).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + + VMTemplateVO result = templateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath( + null, CPU.CPUArch.amd64, "testPath"); + + assertNotNull(result); + assertEquals(expectedTemplate, result); + } + + @Test + public void findActiveSystemTemplateByHypervisorArchAndUrlPath_NullArch() { + VMTemplateVO expectedTemplate = mock(VMTemplateVO.class); + SearchBuilder sb = mock(SearchBuilder.class); + when(sb.entity()).thenReturn(expectedTemplate); + SearchCriteriasc = mock(SearchCriteria.class); + when(sb.create()).thenReturn(sc); + when(templateDao.createSearchBuilder()).thenReturn(sb); + List templates = Collections.singletonList(expectedTemplate); + doReturn(templates).when(templateDao).listBy(any(SearchCriteria.class), any(Filter.class)); + + VMTemplateVO result = templateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath( + Hypervisor.HypervisorType.KVM, null, "testPath"); + + assertNotNull(result); + assertEquals(expectedTemplate, result); + } + + @Test + public void findActiveSystemTemplateByHypervisorArchAndUrlPath_EmptyUrlPathSuffix() { + VMTemplateVO result = templateDao.findActiveSystemTemplateByHypervisorArchAndUrlPath( + Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64, ""); + + assertNull(result); + } +} diff --git a/engine/schema/src/test/java/com/cloud/storage/dao/VolumeDaoImplTest.java b/engine/schema/src/test/java/com/cloud/storage/dao/VolumeDaoImplTest.java index 9445efeb089c..6f153727ab76 100644 --- a/engine/schema/src/test/java/com/cloud/storage/dao/VolumeDaoImplTest.java +++ b/engine/schema/src/test/java/com/cloud/storage/dao/VolumeDaoImplTest.java @@ -41,6 +41,7 @@ import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import com.cloud.storage.Volume; import com.cloud.storage.VolumeVO; import com.cloud.utils.db.Filter; import com.cloud.utils.db.SearchBuilder; @@ -113,6 +114,69 @@ public void testListPoolIdsByVolumeCount_without_cluster_details() throws SQLExc verify(preparedStatementMock, times(1)).executeQuery(); } + @Test + public void findByInstanceAndNotState_queriesWithInstanceIdAndExcludedStates() { + SearchBuilder sb = Mockito.mock(SearchBuilder.class); + SearchCriteria sc = Mockito.mock(SearchCriteria.class); + Mockito.when(sb.create()).thenReturn(sc); + Mockito.doReturn(new ArrayList<>()).when(volumeDao).listBy(sc); + Mockito.when(volumeDao.createSearchBuilder()).thenReturn(sb); + VolumeVO mockedVO = Mockito.mock(VolumeVO.class); + Mockito.when(sb.entity()).thenReturn(mockedVO); + + volumeDao.findByInstanceAndNotStates(42L, Volume.State.Ready); + + Mockito.verify(sc).setParameters("instanceId", 42L); + Mockito.verify(sc).setParameters("state", (Object[]) new Volume.State[]{Volume.State.Ready}); + } + + @Test + public void findByInstanceAndNotStates_withMultipleExcludedStates_passesAllStatesToCriteria() { + SearchBuilder sb = Mockito.mock(SearchBuilder.class); + SearchCriteria sc = Mockito.mock(SearchCriteria.class); + Mockito.when(sb.create()).thenReturn(sc); + Mockito.doReturn(new ArrayList<>()).when(volumeDao).listBy(sc); + Mockito.when(volumeDao.createSearchBuilder()).thenReturn(sb); + VolumeVO mockedVO = Mockito.mock(VolumeVO.class); + Mockito.when(sb.entity()).thenReturn(mockedVO); + + volumeDao.findByInstanceAndNotStates(7L, Volume.State.Destroy, Volume.State.Expunged); + + Mockito.verify(sc).setParameters("instanceId", 7L); + Mockito.verify(sc).setParameters("state", + (Object[]) new Volume.State[]{Volume.State.Destroy, Volume.State.Expunged}); + } + + @Test + public void findByInstanceAndNotStates_returnsResultFromDao() { + SearchBuilder sb = Mockito.mock(SearchBuilder.class); + SearchCriteria sc = Mockito.mock(SearchCriteria.class); + Mockito.when(sb.create()).thenReturn(sc); + VolumeVO vol = Mockito.mock(VolumeVO.class); + Mockito.doReturn(List.of(vol)).when(volumeDao).listBy(sc); + Mockito.when(volumeDao.createSearchBuilder()).thenReturn(sb); + Mockito.when(sb.entity()).thenReturn(Mockito.mock(VolumeVO.class)); + + List result = volumeDao.findByInstanceAndNotStates(1L, Volume.State.Ready); + + Assert.assertEquals(1, result.size()); + Assert.assertSame(vol, result.get(0)); + } + + @Test + public void findByInstanceAndNotStates_noMatchingVolumes_returnsEmptyList() { + SearchBuilder sb = Mockito.mock(SearchBuilder.class); + SearchCriteria sc = Mockito.mock(SearchCriteria.class); + Mockito.when(sb.create()).thenReturn(sc); + Mockito.doReturn(new ArrayList<>()).when(volumeDao).listBy(sc); + Mockito.when(volumeDao.createSearchBuilder()).thenReturn(sb); + Mockito.when(sb.entity()).thenReturn(Mockito.mock(VolumeVO.class)); + + List result = volumeDao.findByInstanceAndNotStates(99L, Volume.State.Ready); + + Assert.assertTrue(result.isEmpty()); + } + @Test public void testSearchRemovedByVmsNoVms() { Assert.assertTrue(CollectionUtils.isEmpty(volumeDao.searchRemovedByVms( @@ -141,5 +205,4 @@ public void testSearchRemovedByVms() { Mockito.any(SearchCriteria.class), Mockito.any(Filter.class), Mockito.eq(null), Mockito.eq(false)); } - } diff --git a/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerDoUpgradesTest.java b/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerDoUpgradesTest.java new file mode 100644 index 000000000000..6241bd7cede0 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerDoUpgradesTest.java @@ -0,0 +1,173 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import com.cloud.upgrade.dao.VersionDao; +import com.cloud.upgrade.dao.VersionDaoImpl; +import com.cloud.upgrade.dao.VersionVO; +import com.cloud.utils.db.GlobalLock; +import org.junit.Test; + +public class DatabaseUpgradeCheckerDoUpgradesTest { + + static class StubVersionDao extends VersionDaoImpl implements VersionDao { + private final String currentVersion; + + StubVersionDao(String currentVersion) { + this.currentVersion = currentVersion; + } + + @Override + public VersionVO findByVersion(String version, VersionVO.Step step) { + return null; + } + + @Override + public String getCurrentVersion() { + return currentVersion; + } + + } + + private static class TestableChecker extends DatabaseUpgradeChecker { + boolean initializeCalled = false; + boolean upgradeCalled = false; + boolean clusterHandlerCalled = false; + String implVersionOverride = null; + String sysVmMetadataOverride = "4.8.0"; + boolean standaloneOverride = true; + + TestableChecker(String daoVersion) { + // set a stub DAO + this._dao = new StubVersionDao(daoVersion); + } + + @Override + protected void initializeDatabaseEncryptors() { + initializeCalled = true; + // noop instead of doing DB work + } + + @Override + protected String getImplementationVersion() { + return implVersionOverride; + } + + @Override + protected String parseSystemVmMetadata() { + return sysVmMetadataOverride; + } + + @Override + boolean isStandalone() { + return standaloneOverride; + } + + @Override + protected void upgrade(org.apache.cloudstack.utils.CloudStackVersion dbVersion, org.apache.cloudstack.utils.CloudStackVersion currentVersion) { + upgradeCalled = true; + } + + @Override + protected void handleClusteredUpgradeRequired() { + clusterHandlerCalled = true; + } + } + + @Test + public void testDoUpgrades_noImplementationVersion_returnsEarly() { + TestableChecker checker = new TestableChecker("4.8.0"); + checker.implVersionOverride = ""; // blank -> should return early + + GlobalLock lock = GlobalLock.getInternLock("test-noimpl"); + try { + // acquire lock so doUpgrades can safely call unlock in finally + lock.lock(1); + checker.doUpgrades(lock); + } finally { + // ensure lock released if still held + lock.releaseRef(); + } + + assertTrue("initializeDatabaseEncryptors should be called before returning", checker.initializeCalled); + assertFalse("upgrade should not be called when implementation version is blank", checker.upgradeCalled); + assertFalse("cluster handler should not be called", checker.clusterHandlerCalled); + } + + @Test + public void testDoUpgrades_dbUpToDate_noUpgrade() { + // DB version = code version -> no upgrade + TestableChecker checker = new TestableChecker("4.8.1"); + checker.implVersionOverride = "4.8.1"; + checker.sysVmMetadataOverride = "4.8.1"; + + GlobalLock lock = GlobalLock.getInternLock("test-uptodate"); + try { + lock.lock(1); + checker.doUpgrades(lock); + } finally { + lock.releaseRef(); + } + + assertTrue(checker.initializeCalled); + assertFalse(checker.upgradeCalled); + assertFalse(checker.clusterHandlerCalled); + } + + @Test + public void testDoUpgrades_requiresUpgrade_standalone_invokesUpgrade() { + TestableChecker checker = new TestableChecker("4.8.0"); + checker.implVersionOverride = "4.8.2"; // code is newer than DB + checker.sysVmMetadataOverride = "4.8.2"; + checker.standaloneOverride = true; + + GlobalLock lock = GlobalLock.getInternLock("test-upgrade-standalone"); + try { + lock.lock(1); + checker.doUpgrades(lock); + } finally { + lock.releaseRef(); + } + + assertTrue(checker.initializeCalled); + assertTrue("upgrade should be invoked in standalone mode", checker.upgradeCalled); + assertFalse(checker.clusterHandlerCalled); + } + + @Test + public void testDoUpgrades_requiresUpgrade_clustered_invokesHandler() { + TestableChecker checker = new TestableChecker("4.8.0"); + checker.implVersionOverride = "4.8.2"; // code is newer than DB + checker.sysVmMetadataOverride = "4.8.2"; + checker.standaloneOverride = false; + + GlobalLock lock = GlobalLock.getInternLock("test-upgrade-clustered"); + try { + lock.lock(1); + checker.doUpgrades(lock); + } finally { + lock.releaseRef(); + } + + assertTrue(checker.initializeCalled); + assertFalse("upgrade should not be invoked in clustered mode", checker.upgradeCalled); + assertTrue("cluster handler should be invoked in clustered mode", checker.clusterHandlerCalled); + } +} diff --git a/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java b/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java index 1a9372f73eaf..ab64e4698f01 100644 --- a/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java +++ b/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java @@ -16,14 +16,24 @@ // under the License. package com.cloud.upgrade; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import java.sql.SQLException; +import java.lang.reflect.Field; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; -import java.util.Arrays; +import javax.sql.DataSource; import org.apache.cloudstack.utils.CloudStackVersion; import org.junit.Test; +import org.junit.Before; +import org.junit.After; +import org.junit.runner.RunWith; + +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import com.cloud.upgrade.DatabaseUpgradeChecker.NoopDbUpgrade; import com.cloud.upgrade.dao.DbUpgrade; @@ -34,6 +44,7 @@ import com.cloud.upgrade.dao.Upgrade41120to41200; import com.cloud.upgrade.dao.Upgrade41510to41520; import com.cloud.upgrade.dao.Upgrade41610to41700; +import com.cloud.upgrade.dao.Upgrade42010to42100; import com.cloud.upgrade.dao.Upgrade452to453; import com.cloud.upgrade.dao.Upgrade453to460; import com.cloud.upgrade.dao.Upgrade460to461; @@ -43,8 +54,51 @@ import com.cloud.upgrade.dao.Upgrade480to481; import com.cloud.upgrade.dao.Upgrade490to4910; +import com.cloud.utils.db.TransactionLegacy; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertArrayEquals; + + +@RunWith(MockitoJUnitRunner.class) public class DatabaseUpgradeCheckerTest { + @Mock + DataSource dataSource; + + @Mock + Connection connection; + + @Mock + PreparedStatement preparedStatement; + + @Mock + ResultSet resultSet; + + private DataSource backupDataSource; + + @Before + public void setup() throws Exception { + Field dsField = TransactionLegacy.class.getDeclaredField("s_ds"); + dsField.setAccessible(true); + backupDataSource = (DataSource) dsField.get(null); + dsField.set(null, dataSource); + + Mockito.when(dataSource.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(ArgumentMatchers.anyString())).thenReturn(preparedStatement); + Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet); + } + + @After + public void cleanup() throws Exception { + Field dsField = TransactionLegacy.class.getDeclaredField("s_ds"); + dsField.setAccessible(true); + dsField.set(null, backupDataSource); + } + @Test public void testCalculateUpgradePath480to481() { @@ -79,7 +133,7 @@ public void testCalculateUpgradePath490to4910() { assertTrue(upgrades.length >= 1); assertTrue(upgrades[0] instanceof Upgrade490to4910); - assertTrue(Arrays.equals(new String[] {"4.9.0", currentVersion.toString()}, upgrades[0].getUpgradableVersionRange())); + assertArrayEquals(new String[]{"4.9.0", currentVersion.toString()}, upgrades[0].getUpgradableVersionRange()); assertEquals(currentVersion.toString(), upgrades[0].getUpgradedVersion()); } @@ -104,7 +158,7 @@ public void testCalculateUpgradePath410to412() { assertTrue(upgrades[3] instanceof Upgrade41120to41130); assertTrue(upgrades[4] instanceof Upgrade41120to41200); - assertTrue(Arrays.equals(new String[] {"4.11.0.0", "4.11.1.0"}, upgrades[1].getUpgradableVersionRange())); + assertArrayEquals(new String[]{"4.11.0.0", "4.11.1.0"}, upgrades[1].getUpgradableVersionRange()); assertEquals(currentVersion.toString(), upgrades[4].getUpgradedVersion()); } @@ -151,12 +205,12 @@ public void testFindUpgradePath452to490() { assertTrue(upgrades[5] instanceof Upgrade471to480); assertTrue(upgrades[6] instanceof Upgrade480to481); - assertTrue(Arrays.equals(new String[] {"4.8.1", currentVersion.toString()}, upgrades[upgrades.length - 1].getUpgradableVersionRange())); + assertArrayEquals(new String[]{"4.8.1", currentVersion.toString()}, upgrades[upgrades.length - 1].getUpgradableVersionRange()); assertEquals(currentVersion.toString(), upgrades[upgrades.length - 1].getUpgradedVersion()); } @Test - public void testCalculateUpgradePathUnkownDbVersion() { + public void testCalculateUpgradePathUnknownDbVersion() { final CloudStackVersion dbVersion = CloudStackVersion.parse("4.99.0.0"); assertNotNull(dbVersion); @@ -173,7 +227,7 @@ public void testCalculateUpgradePathUnkownDbVersion() { } @Test - public void testCalculateUpgradePathFromKownDbVersion() { + public void testCalculateUpgradePathFromKnownDbVersion() { final CloudStackVersion dbVersion = CloudStackVersion.parse("4.17.0.0"); assertNotNull(dbVersion); @@ -306,4 +360,44 @@ public void testCalculateUpgradePathFromSecurityReleaseToNextSecurityRelease() { assertEquals(upgrades.length + 1, upgradesFromSecurityReleaseToNext.length); assertTrue(upgradesFromSecurityReleaseToNext[upgradesFromSecurityReleaseToNext.length - 1] instanceof NoopDbUpgrade); } + + @Test + public void isStandalone() throws SQLException { + // simulate zero 'UP' hosts -> standalone + Mockito.when(resultSet.next()).thenReturn(true); + Mockito.when(resultSet.getInt(1)).thenReturn(0); + + final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); + assertTrue("DatabaseUpgradeChecker should be a standalone component", checker.isStandalone()); + } + + @Test + public void isNotStandalone() throws SQLException { + // simulate at least one 'UP' host -> not standalone + Mockito.when(resultSet.next()).thenReturn(true); + Mockito.when(resultSet.getInt(1)).thenReturn(1); + + final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); + assertFalse("DatabaseUpgradeChecker should not be a standalone component", checker.isStandalone()); + } + + @Test + public void testCalculateUpgradePath42010to42100() { + + final CloudStackVersion dbVersion = CloudStackVersion.parse("4.20.1.0"); + assertNotNull(dbVersion); + + final CloudStackVersion currentVersion = CloudStackVersion.parse("4.21.0.0"); + assertNotNull(currentVersion); + + final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); + final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion); + + assertNotNull(upgrades); + assertEquals(1, upgrades.length); + assertTrue(upgrades[0] instanceof Upgrade42010to42100); + + assertArrayEquals(new String[]{"4.20.1.0", "4.21.0.0"}, upgrades[0].getUpgradableVersionRange()); + assertEquals(currentVersion.toString(), upgrades[0].getUpgradedVersion()); + } } diff --git a/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java b/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java new file mode 100644 index 000000000000..51db952eb613 --- /dev/null +++ b/engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java @@ -0,0 +1,1641 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 com.cloud.upgrade; + +import static com.cloud.upgrade.SystemVmTemplateRegistration.DEFAULT_SYSTEM_VM_GUEST_OS_NAME; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.cloudstack.framework.config.impl.ConfigurationVO; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; +import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; +import org.apache.cloudstack.storage.datastore.db.ImageStoreVO; +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; +import org.apache.cloudstack.utils.security.DigestHelper; +import org.apache.commons.lang3.StringUtils; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; + +import com.cloud.cpu.CPU; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.DataCenterDetailsDao; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.storage.DataStoreRole; +import com.cloud.storage.GuestOSVO; +import com.cloud.storage.Storage; +import com.cloud.storage.VMTemplateStorageResourceAssoc; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VMTemplateZoneVO; +import com.cloud.storage.dao.GuestOSDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplateZoneDao; +import com.cloud.template.VirtualMachineTemplate; +import com.cloud.utils.HttpUtils; +import com.cloud.utils.Pair; +import com.cloud.utils.UriUtils; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; +import com.cloud.vm.dao.VMInstanceDao; + +@RunWith(MockitoJUnitRunner.class) +public class SystemVmTemplateRegistrationTest { + + @Mock + ClusterDao clusterDao; + + @Mock + VMTemplateDao vmTemplateDao; + + @Mock + GuestOSDao guestOSDao; + + @Mock + TemplateDataStoreDao templateDataStoreDao; + + @Mock + ConfigurationDao configurationDao; + + @Mock + DataCenterDao dataCenterDao; + + @Mock + DataCenterDetailsDao dataCenterDetailsDao; + + @Mock + VMTemplateZoneDao vmTemplateZoneDao; + + @Mock + ImageStoreDao imageStoreDao; + + @Mock + ImageStoreDetailsDao imageStoreDetailsDao; + + @Mock + VMInstanceDao vmInstanceDao; + + @Spy + @InjectMocks + SystemVmTemplateRegistration systemVmTemplateRegistration = new SystemVmTemplateRegistration(); + + @Before + public void setup() { + SystemVmTemplateRegistration.METADATA_TEMPLATE_LIST.clear(); + } + + private void setupMetadataFile(MockedStatic mockedStatic, String content) { + try { + String location = "metadata.ini"; + if (StringUtils.isNotBlank(content)) { + File tempFile = File.createTempFile("metadata", ".ini"); + location = tempFile.getAbsolutePath(); + Files.write(Paths.get(location), content.getBytes()); + tempFile.deleteOnExit(); + } + mockedStatic.when(SystemVmTemplateRegistration::getMetadataFilePath).thenReturn(location); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void test_parseMetadataFile_noFile() { + try (MockedStatic mockedStatic = + Mockito.mockStatic(SystemVmTemplateRegistration.class, Mockito.CALLS_REAL_METHODS)) { + setupMetadataFile(mockedStatic, null); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, + SystemVmTemplateRegistration::parseMetadataFile); + assertTrue(exception.getMessage().contains("Failed to parse system VM Template metadata file")); + } + } + + @Test + public void test_parseMetadataFile_invalidContent() { + try (MockedStatic mockedStatic = + Mockito.mockStatic(SystemVmTemplateRegistration.class, Mockito.CALLS_REAL_METHODS)) { + setupMetadataFile(mockedStatic, "abc"); + CloudRuntimeException exception = assertThrows(CloudRuntimeException.class, + SystemVmTemplateRegistration::parseMetadataFile); + assertTrue(exception.getMessage().contains("Failed to parse system VM Template metadata file")); + } + } + + @Test + public void test_parseMetadataFile_success() { + String metadataFileContent = "[default]\n" + + "version = x.y.z.0\n" + + "\n" + + "[kvm-x86_64]\n" + + "templatename = systemvm-kvm-x.y.z\n" + + "checksum = abc1\n" + + "downloadurl = https://download.cloudstack.org/systemvm/x.y/systemvmtemplate-x.y.z-kvm.qcow2.bz2\n" + + "filename = systemvmtemplate-x.y.z-kvm.qcow2.bz2\n" + + "\n" + + "[kvm-aarch64]\n" + + "templatename = systemvm-kvm-x.y.z\n" + + "checksum = abc2\n" + + "downloadurl = https://download.cloudstack.org/systemvm/x.y/systemvmtemplate-x.y.z-kvm.qcow2.bz2\n" + + "filename = systemvmtemplate-x.y.z-kvm.qcow2.bz2\n" + + "\n" + + "[vmware]\n" + + "templatename = systemvm-vmware-x.y.z\n" + + "checksum = abc3\n" + + "downloadurl = https://download.cloudstack.org/systemvm/x.y/systemvmtemplate-x.y.z-vmware.ova\n" + + "filename = systemvmtemplate-x.y.z-vmware.ova\n"; + try (MockedStatic mockedStatic = + Mockito.mockStatic(SystemVmTemplateRegistration.class, Mockito.CALLS_REAL_METHODS)) { + setupMetadataFile(mockedStatic, metadataFileContent); + String version = SystemVmTemplateRegistration.parseMetadataFile(); + assertEquals("x.y.z.0", version); + } + assertNull(SystemVmTemplateRegistration.getMetadataTemplateDetails(Hypervisor.HypervisorType.XenServer, + CPU.CPUArch.getDefault())); + SystemVmTemplateRegistration.MetadataTemplateDetails templateDetails = + SystemVmTemplateRegistration.getMetadataTemplateDetails(Hypervisor.HypervisorType.KVM, + CPU.CPUArch.amd64); + assertNotNull(templateDetails); + assertEquals(CPU.CPUArch.amd64, templateDetails.getArch()); + assertEquals(Hypervisor.HypervisorType.KVM, templateDetails.getHypervisorType()); + templateDetails = + SystemVmTemplateRegistration.getMetadataTemplateDetails(Hypervisor.HypervisorType.KVM, + CPU.CPUArch.arm64); + assertNotNull(templateDetails); + assertEquals(CPU.CPUArch.arm64, templateDetails.getArch()); + assertEquals(Hypervisor.HypervisorType.KVM, templateDetails.getHypervisorType()); + templateDetails = + SystemVmTemplateRegistration.getMetadataTemplateDetails(Hypervisor.HypervisorType.VMware, + CPU.CPUArch.getDefault()); + assertNotNull(templateDetails); + assertEquals(CPU.CPUArch.getDefault(), templateDetails.getArch()); + assertEquals(Hypervisor.HypervisorType.VMware, templateDetails.getHypervisorType()); + } + + @Test + public void testMountStore_nullStoreUrl() throws Exception { + try (MockedStatic - + + @@ -58,7 +109,7 @@ - +
    @@ -73,18 +124,18 @@

    no
    + title="Move/Drag viewport"> - + + title="Show extra keys">
    no
    - + title="Full screen"> @@ -255,10 +306,10 @@

    no

    -

    - +
    + - + @@ -273,7 +324,7 @@

    no
    - +
    @@ -288,7 +339,7 @@

    no
    - +
    @@ -298,21 +349,21 @@

    no
    The server has provided the following identifying information:

    - Fingerprint: + Fingerprint:
    Please verify that the information is correct and press "Approve". Otherwise press "Reject".
    -
    - - +
    + +
    - +
    @@ -326,17 +377,17 @@

    no

    -
    - +
    +
    - +
    - +
    diff --git a/systemvm/agent/noVNC/vnc_lite.html b/systemvm/agent/noVNC/vnc_lite.html index 1eea46022224..8e6aaeabdecf 100644 --- a/systemvm/agent/noVNC/vnc_lite.html +++ b/systemvm/agent/noVNC/vnc_lite.html @@ -7,7 +7,7 @@ This is a self-contained file which doesn't import WebUtil or external CSS. - Copyright (C) 2019 The noVNC Authors + Copyright (C) 2019 The noVNC authors noVNC is licensed under the MPL 2.0 (see LICENSE.txt) This file is licensed under the 2-Clause BSD license (see LICENSE.txt). @@ -87,7 +87,7 @@ // When this function is called, the server requires // credentials to authenticate function credentialsAreRequired(e) { - const password = prompt("Password Required:"); + const password = prompt("Password required:"); rfb.sendCredentials({ password: password }); } @@ -119,20 +119,14 @@ // query string. If the variable isn't defined in the URL // it returns the default value instead. function readQueryVariable(name, defaultValue) { - // A URL with a query parameter can look like this (But will most probably get logged on the http server): + // A URL with a query parameter can look like this: // https://www.example.com?myqueryparam=myvalue // - // For privacy (Using a hastag #, the parameters will not be sent to the server) - // the url can be requested in the following way: - // https://www.example.com#myqueryparam=myvalue&password=secreatvalue - // - // Even Mixing public and non public parameters will work: - // https://www.example.com?nonsecretparam=example.com#password=secreatvalue - // // Note that we use location.href instead of location.search // because Firefox < 53 has a bug w.r.t location.search const re = new RegExp('.*[?&]' + name + '=([^&#]*)'), - match = ''.concat(document.location.href, window.location.hash).match(re); + match = document.location.href.match(re); + if (typeof defaultValue === 'undefined') { defaultValue = null; } if (match) { diff --git a/systemvm/agent/scripts/_run.sh b/systemvm/agent/scripts/_run.sh index 11158ecf5bd1..bb024f71c08b 100755 --- a/systemvm/agent/scripts/_run.sh +++ b/systemvm/agent/scripts/_run.sh @@ -60,4 +60,4 @@ if [ "$(uname -m | grep '64')" == "" ]; then fi fi -java -Djavax.net.ssl.trustStore=./certs/realhostip.keystore -Djdk.tls.ephemeralDHKeySize=2048 -Dlog.home=$LOGHOME -mx${maxmem}m -cp $CP com.cloud.agent.AgentShell $keyvalues $@ +java -Djavax.net.ssl.trustStore=./certs/systemvm.keystore -Djdk.tls.ephemeralDHKeySize=2048 -Dlog.home=$LOGHOME -mx${maxmem}m -cp $CP com.cloud.agent.AgentShell $keyvalues $@ diff --git a/systemvm/agent/scripts/config_ssl.sh b/systemvm/agent/scripts/config_ssl.sh index e9340b099f62..3968b2617f21 100755 --- a/systemvm/agent/scripts/config_ssl.sh +++ b/systemvm/agent/scripts/config_ssl.sh @@ -52,13 +52,13 @@ cflag= cpkflag= cpcflag= cccflag= -customPrivKey=$(dirname $0)/certs/realhostip.key -customPrivCert=$(dirname $0)/certs/realhostip.crt +customPrivKey=$(dirname $0)/certs/systemvm.key +customPrivCert=$(dirname $0)/certs/systemvm.crt customCertChain= customCACert= publicIp= hostName= -keyStore=$(dirname $0)/certs/realhostip.keystore +keyStore=$(dirname $0)/certs/systemvm.keystore defaultJavaKeyStoreFile=/etc/ssl/certs/java/cacerts defaultJavaKeyStorePass="changeit" aliasName="CPVMCertificate" diff --git a/systemvm/agent/scripts/run-proxy.sh b/systemvm/agent/scripts/run-proxy.sh old mode 100644 new mode 100755 index f26f54b12b53..40e7c8f64479 --- a/systemvm/agent/scripts/run-proxy.sh +++ b/systemvm/agent/scripts/run-proxy.sh @@ -33,16 +33,4 @@ do CP=${CP}:$file done -#CMDLINE=$(cat /proc/cmdline) -#for i in $CMDLINE -# do -# KEY=$(echo $i | cut -d= -f1) -# VALUE=$(echo $i | cut -d= -f2) -# case $KEY in -# mgmt_host) -# MGMT_HOST=$VALUE -# ;; -# esac -# done - java -mx700m -cp $CP:./conf com.cloud.consoleproxy.ConsoleProxy $@ diff --git a/systemvm/agent/scripts/ssvm-check.sh b/systemvm/agent/scripts/ssvm-check.sh old mode 100644 new mode 100755 index f5d69cb45488..86cecb75719c --- a/systemvm/agent/scripts/ssvm-check.sh +++ b/systemvm/agent/scripts/ssvm-check.sh @@ -41,7 +41,7 @@ isCifs() { # ping dns server echo ================================================ -DNSSERVER=`egrep '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1` +DNSSERVER=`grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1` echo "First DNS server is " $DNSSERVER ping -c 2 $DNSSERVER if [ $? -eq 0 ] diff --git a/systemvm/agent/scripts/utils.sh b/systemvm/agent/scripts/utils.sh old mode 100644 new mode 100755 diff --git a/systemvm/agent/ui/viewer.ftl b/systemvm/agent/ui/viewer.ftl index e6b12071111e..fef0d7e0b68e 100644 --- a/systemvm/agent/ui/viewer.ftl +++ b/systemvm/agent/ui/viewer.ftl @@ -18,10 +18,10 @@ under the License. --> - - - - + + + + ${title} @@ -44,7 +44,7 @@ under the License.
    -
    diff --git a/tools/apidoc/images/cloudstack.png b/tools/apidoc/images/cloudstack.png index 2f3d899701af..ef2828295597 100644 Binary files a/tools/apidoc/images/cloudstack.png and b/tools/apidoc/images/cloudstack.png differ diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml index 4f22f1eff64a..b0e081df97f4 100644 --- a/tools/apidoc/pom.xml +++ b/tools/apidoc/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/tools/appliance/README.md b/tools/appliance/README.md index bc5b2014a59c..022bddbcd8f1 100644 --- a/tools/appliance/README.md +++ b/tools/appliance/README.md @@ -1,3 +1,4 @@ + # Introduction diff --git a/tools/appliance/cks/ubuntu/22.04/cks-ubuntu-2204.json b/tools/appliance/cks/ubuntu/22.04/cks-ubuntu-2204.json new file mode 100644 index 000000000000..edaa11f96ce6 --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/cks-ubuntu-2204.json @@ -0,0 +1,56 @@ +{ + "_license": "Apache License 2.0", + "builders": [ + { + "accelerator": "kvm", + "boot_command": [ + "clinux /casper/vmlinuz --- autoinstall ds='nocloud-net;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/'", + "", + "initrd /casper/initrd", + "", + "boot", + "" + ], + "vm_name": "cks-ubuntu-2204", + "iso_checksum": "sha256:5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931", + "iso_url": "https://old-releases.ubuntu.com/releases/jammy/ubuntu-22.04.2-live-server-amd64.iso", + "shutdown_command": "sudo shutdown -P now", + "net_device": "virtio-net", + "output_directory": "../dist", + "format": "qcow2", + "headless": true, + "http_directory": "http", + "ssh_password": "cloud", + "ssh_timeout": "30m", + "ssh_username": "cloud", + "type": "qemu", + "disk_interface": "virtio", + "disk_size": "5000M", + "qemuargs": [ + [ + "-m", + "2048M" + ], + [ + "-smp", + "1" + ] + ] + } + ], + "description": "CloudStack SystemVM template", + "provisioners": [ + { + "execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}", + "scripts": [ + "scripts/apt_upgrade.sh", + "scripts/configure_networking.sh", + "scripts/configure-cloud-init.sh", + "scripts/setup-interfaces.sh", + "scripts/add-interface-rule.sh", + "scripts/cleanup.sh" + ], + "type": "shell" + } + ] +} diff --git a/test/selenium/browser/__init__.py b/tools/appliance/cks/ubuntu/22.04/http/meta-data similarity index 100% rename from test/selenium/browser/__init__.py rename to tools/appliance/cks/ubuntu/22.04/http/meta-data diff --git a/tools/appliance/cks/ubuntu/22.04/http/user-data b/tools/appliance/cks/ubuntu/22.04/http/user-data new file mode 100644 index 000000000000..15a7f8f32354 --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/http/user-data @@ -0,0 +1,103 @@ +#cloud-config +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +autoinstall: + version: 1 + # Disable ssh server during installation, otherwise packer tries to connect and exceed max attempts + early-commands: + - systemctl stop ssh + # Configure the locale + locale: en_US + keyboard: + layout: us + refresh-installer: + update: yes + channel: stable + # Create a single-partition with no swap space. Kubernetes + # really dislikes the idea of anyone else managing memory. + # For more information on how partitioning is configured, + # please refer to https://curtin.readthedocs.io/en/latest/topics/storage.html. + storage: + swap: + size: 0 + grub: + replace_linux_default: false + config: + - type: disk + id: disk-0 + size: smallest + grub_device: true + preserve: false + ptable: msdos + wipe: superblock + - type: partition + id: partition-0 + device: disk-0 + size: -1 + number: 1 + preserve: false + flag: boot + - type: format + id: format-0 + volume: partition-0 + fstype: ext4 + preserve: false + - type: mount + id: mount-0 + device: format-0 + path: / + updates: 'all' + ssh: + install-server: true + allow-pw: true + # Customize the list of packages installed. + packages: + - open-vm-tools + - openssh-server + - cloud-init + - wget + - tasksel + # Create the default user. + # Ensures the "cloud" user doesn't require a password to use sudo. + user-data: + disable_root: false + timezone: UTC + users: + - name: cloud + # openssl passwd -6 -stdin <<< cloud + passwd: $6$pAFEBhaCDzN4ZmrO$kMmUuxhPMx447lJ8Mtas8n6uqkojh94nQ7I8poI6Kl4vRGeZKE57utub1cudS1fGyG8HUxK9YHIygd7vCpRFN0 + groups: [adm, cdrom, dip, plugdev, lxd, sudo] + lock-passwd: false + sudo: ALL=(ALL) NOPASSWD:ALL + shell: /bin/bash + + # This command runs after all other steps; it: + # 1. Disables swapfiles + # 2. Removes the existing swapfile + # 3. Removes the swapfile entry from /etc/fstab + # 4. Removes snapd, https://bugs.launchpad.net/subiquity/+bug/1946609 + # 5. Cleans up any packages that are no longer required + # 6. Removes the cached list of packages + late-commands: + - curtin in-target --target=/target -- swapoff -a + - curtin in-target --target=/target -- rm -f /swap.img + - curtin in-target --target=/target -- sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab + - chroot /target apt-get purge -y snapd + - curtin in-target --target=/target -- apt-get purge --auto-remove -y + - curtin in-target --target=/target -- apt-get clean + - curtin in-target --target=/target -- rm -rf /var/lib/apt/lists/* diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/add-interface-rule.sh b/tools/appliance/cks/ubuntu/22.04/scripts/add-interface-rule.sh new file mode 100755 index 000000000000..7a28f0e55cbe --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/add-interface-rule.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# File and rule definition +RULE_FILE="/etc/udev/rules.d/90-new-interface.rules" +RULE='ACTION=="add|change|remove", SUBSYSTEM=="net", DRIVERS=="?*", RUN+="/bin/systemctl --no-block start update-netplan.service"' + +# Ensure the file exists, or create it +if [[ ! -f $RULE_FILE ]]; then + touch "$RULE_FILE" + echo "Created $RULE_FILE." +fi + +# Check if the rule already exists to prevent duplication +if grep -Fxq "$RULE" "$RULE_FILE"; then + echo "Rule already exists in $RULE_FILE." +else + # Add the rule to the file + echo "$RULE" | tee -a "$RULE_FILE" > /dev/null + echo "Rule added to $RULE_FILE." +fi + +# Reload udev rules and apply the changes +udevadm control --reload-rules +udevadm trigger +echo "Udev rules reloaded and triggered." diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/apt_upgrade.sh b/tools/appliance/cks/ubuntu/22.04/scripts/apt_upgrade.sh new file mode 100755 index 000000000000..22d25d628efa --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/apt_upgrade.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +set -e +set -x + +function apt_upgrade() { + DEBIAN_FRONTEND=noninteractive + DEBIAN_PRIORITY=critical + + rm -fv /root/*.iso + apt-get -q -y update + + apt-get -q -y upgrade + apt-get -q -y dist-upgrade + + apt-get -y autoremove --purge + apt-get autoclean + apt-get clean +} + +return 2>/dev/null || apt_upgrade diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/cleanup.sh b/tools/appliance/cks/ubuntu/22.04/scripts/cleanup.sh new file mode 100755 index 000000000000..ab0ceb628611 --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/cleanup.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +set -e + +function cleanup_apt() { + export DEBIAN_FRONTEND=noninteractive + apt-get -y remove --purge dictionaries-common busybox \ + task-english task-ssh-server tasksel tasksel-data laptop-detect wamerican sharutils \ + nano util-linux-locales krb5-locales + + apt-get -y autoremove --purge + apt-get autoclean + apt-get clean +} + +# Removing leftover leases and persistent rules +function cleanup_dhcp() { + rm -f /var/lib/dhcp/* +} + +# Make sure Udev doesn't block our network +function cleanup_dev() { + echo "cleaning up udev rules" + rm -f /etc/udev/rules.d/70-persistent-net.rules + rm -rf /dev/.udev/ + rm -f /lib/udev/rules.d/75-persistent-net-generator.rules +} + +function cleanup_misc() { + # Scripts + rm -fr /home/cloud/cloud_scripts* + rm -f /usr/share/cloud/cloud-scripts.tar + rm -f /root/.rnd + rm -f /var/www/html/index.html + # Logs + rm -f /var/log/*.log + rm -f /var/log/apache2/* + rm -f /var/log/messages + rm -f /var/log/syslog + rm -f /var/log/messages + rm -fr /var/log/apt + rm -fr /var/log/installer + # Docs and data files + rm -fr /var/lib/apt/* + rm -fr /var/cache/apt/* + rm -fr /var/cache/debconf/*old + rm -fr /usr/share/doc + rm -fr /usr/share/man + rm -fr /usr/share/info + rm -fr /usr/share/lintian + rm -fr /usr/share/apache2/icons + find /usr/share/locale -type f | grep -v en_US | xargs rm -fr + find /usr/share/zoneinfo -type f | grep -v UTC | xargs rm -fr + rm -fr /tmp/* +} + +function cleanup() { + cleanup_apt + cleanup_dhcp + cleanup_dev + cleanup_misc +} + +return 2>/dev/null || cleanup diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/configure-cloud-init.sh b/tools/appliance/cks/ubuntu/22.04/scripts/configure-cloud-init.sh new file mode 100755 index 000000000000..4e4979c936f3 --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/configure-cloud-init.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +function install_packages() { + apt-get install -y qemu-guest-agent rsyslog logrotate cron net-tools ifupdown cloud-guest-utils conntrack apt-transport-https ca-certificates curl \ + gnupg gnupg-agent software-properties-common gnupg lsb-release + apt-get install -y python3-json-pointer python3-jsonschema cloud-init resolvconf + + sudo mkdir -p /etc/apt/keyrings + echo "Creating /opt/bin directory" + sudo mkdir -p /opt/bin + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + apt update + apt install containerd.io + + systemctl start containerd + systemctl enable containerd +} + +function configure_services() { + install_packages + + systemctl daemon-reload +cat < /etc/cloud/cloud.cfg.d/cloudstack.cfg +datasource_list: ['CloudStack'] +datasource: + CloudStack: + max_wait: 120 + timeout: 50 +EOF +} + +configure_services diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/configure_networking.sh b/tools/appliance/cks/ubuntu/22.04/scripts/configure_networking.sh new file mode 100755 index 000000000000..a5e4179a4416 --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/configure_networking.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +set -e +set -x + +HOSTNAME=cksnode + +function configure_resolv_conf() { + grep 8.8.8.8 /etc/resolv.conf && grep 8.8.4.4 /etc/resolv.conf && return + + cat > /etc/resolv.conf << EOF +nameserver 8.8.8.8 +nameserver 8.8.4.4 +EOF +} + +# Delete entry in /etc/hosts derived from dhcp +function delete_dhcp_ip() { + result=$(grep 127.0.1.1 /etc/hosts || true) + [ "${result}" == "" ] && return + + sed -i '/127.0.1.1/d' /etc/hosts +} + +function configure_hostname() { + sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub + + echo "$HOSTNAME" > /etc/hostname + hostname $HOSTNAME +} + +function configure_interfaces() { + cat > /etc/network/interfaces << EOF +source /etc/network/interfaces.d/* + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto ens35 +iface ens35 inet dhcp + +EOF + +echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf +sysctl -p /etc/sysctl.conf +} + +function configure_networking() { + configure_interfaces + configure_resolv_conf + delete_dhcp_ip + configure_hostname +} + +return 2>/dev/null || configure_networking diff --git a/tools/appliance/cks/ubuntu/22.04/scripts/setup-interfaces.sh b/tools/appliance/cks/ubuntu/22.04/scripts/setup-interfaces.sh new file mode 100755 index 000000000000..4dd2caead56e --- /dev/null +++ b/tools/appliance/cks/ubuntu/22.04/scripts/setup-interfaces.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# Create the script in the /opt/bin directory +SCRIPT_PATH="/usr/local/bin/update-netplan.sh" + +cat <<'EOF' > $SCRIPT_PATH +#!/bin/bash + +echo "New interface detected: $INTERFACE" >> /var/log/interface-events.log +CONFIG_FILE="/etc/netplan/config.yaml" + +# Generate a new netplan configuration +echo "network:" > $CONFIG_FILE +echo " ethernets:" >> $CONFIG_FILE + +# Loop through all available interfaces +for iface in $(ls /sys/class/net | grep -vE '^lo$'); do +cat <> $CONFIG_FILE + $iface: + dhcp4: true +EOL +done + +chmod 600 $CONFIG_FILE + +netplan apply +EOF + +tee /etc/systemd/system/update-netplan.service < ~/.ssh/authorized_keys +else + echo "Please place Management server public key in the variables" + exit 1 +fi diff --git a/tools/appliance/cks/ubuntu/build.sh b/tools/appliance/cks/ubuntu/build.sh new file mode 100755 index 000000000000..c58668434781 --- /dev/null +++ b/tools/appliance/cks/ubuntu/build.sh @@ -0,0 +1,346 @@ +#!/bin/bash -l +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# build script which wraps around packer and virtualbox to create the CKS template + +function usage() { + cat <&2 +} + +function error() { + log ERROR $@ + exit 1 +} + +# cleanup code support +declare -a on_exit_items + +function on_exit() { + for (( i=${#on_exit_items[@]}-1 ; i>=0 ; i-- )) ; do + sleep 2 + log DEBUG "on_exit: ${on_exit_items[i]}" + eval ${on_exit_items[i]} + done +} + +function add_on_exit() { + local n=${#on_exit_items[*]} + on_exit_items[${n}]="$*" + if [ ${n} -eq 0 ]; then + log DEBUG "Setting trap" + trap on_exit EXIT + fi +} + +# retry code support +function retry() { + local times=$1 + shift + local count=0 + while [ ${count} -lt ${times} ]; do + "$@" && break + count=$(( $count + 1 )) + sleep ${count} + done + + if [ ${count} -eq ${times} ]; then + error "Failed ${times} times: $@" + fi +} + +### +### Script logic +### + +function prepare() { + log INFO "preparing for build" + rm -rf dist *.ova *.vhd *.vdi *.qcow* *.bz2 *.vmdk *.ovf +} + +function packer_build() { + log INFO "building new image with packer" + #cd ${appliance_build_name} && packer build template.json && cd .. + cd 22.04 && packer build ${appliance_build_name}.json && cd .. +} + +function stage_vmx() { + cat << VMXFILE > "${1}.vmx" +.encoding = "UTF-8" +displayname = "${1}" +annotation = "${1}" +guestos = "otherlinux-64" +virtualHW.version = "11" +config.version = "8" +numvcpus = "1" +cpuid.coresPerSocket = "1" +memsize = "256" +pciBridge0.present = "TRUE" +pciBridge4.present = "TRUE" +pciBridge4.virtualDev = "pcieRootPort" +pciBridge4.functions = "8" +pciBridge5.present = "TRUE" +pciBridge5.virtualDev = "pcieRootPort" +pciBridge5.functions = "8" +pciBridge6.present = "TRUE" +pciBridge6.virtualDev = "pcieRootPort" +pciBridge6.functions = "8" +pciBridge7.present = "TRUE" +pciBridge7.virtualDev = "pcieRootPort" +pciBridge7.functions = "8" +vmci0.present = "TRUE" +floppy0.present = "FALSE" +ide0:0.clientDevice = "FALSE" +ide0:0.present = "TRUE" +ide0:0.deviceType = "atapi-cdrom" +ide0:0.autodetect = "TRUE" +ide0:0.startConnected = "FALSE" +mks.enable3d = "false" +svga.autodetect = "false" +svga.vramSize = "4194304" +scsi0:0.present = "TRUE" +scsi0:0.deviceType = "disk" +scsi0:0.fileName = "$2" +scsi0:0.mode = "persistent" +scsi0:0.writeThrough = "false" +scsi0.virtualDev = "lsilogic" +scsi0.present = "TRUE" +vmci0.unrestricted = "false" +vcpu.hotadd = "false" +vcpu.hotremove = "false" +firmware = "bios" +mem.hotadd = "false" +VMXFILE +} + +function xen_server_export() { + log INFO "creating xen server export" + set +e + which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1 + local result=$? + set -e + if [ ${result} == 0 ]; then + qemu-img convert -f qcow2 -O raw "dist/${appliance}" img.raw + vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd + faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o "${appliance_build_name}-xen.vhd" + rm -f *.bak + bzip2 "${appliance_build_name}-xen.vhd" + mv "${appliance_build_name}-xen.vhd.bz2" dist/ + log INFO "${appliance} exported for XenServer: dist/${appliance_build_name}-xen.vhd.bz2" + else + log WARN "** Skipping ${appliance_build_name} export for XenServer: faketime or vhd-util command is missing. **" + log WARN "** faketime source code is available from https://github.com/wolfcw/libfaketime **" + fi +} + +function ovm_export() { + log INFO "creating OVM export" + qemu-img convert -f qcow2 -O raw "dist/${appliance}" "dist/${appliance_build_name}-ovm.raw" + cd dist && bzip2 "${appliance_build_name}-ovm.raw" && cd .. + log INFO "${appliance} exported for OracleVM: dist/${appliance_build_name}-ovm.raw.bz2" +} + +function kvm_export() { + log INFO "creating kvm export" + set +e + qemu-img convert -o compat=0.10 -f qcow2 -c -O qcow2 "dist/${appliance}" "dist/${appliance_build_name}-kvm.qcow2" + local qemuresult=$? + cd dist && bzip2 "${appliance_build_name}-kvm.qcow2" && cd .. + log INFO "${appliance} exported for KVM: dist/${appliance_build_name}-kvm.qcow2.bz2" +} + +function vmware_export() { + log INFO "creating vmware export" + qemu-img convert -f qcow2 -O vmdk "dist/${appliance}" "dist/${appliance_build_name}-vmware.vmdk" + + if ! ovftool_loc="$(type -p "ovftool")" || [ -z "$ovftool_loc" ]; then + log INFO "ovftool not found, skipping ova generation for VMware" + return + fi + + log INFO "ovftool found, using it to export ova file" + CDIR=$PWD + cd dist + chmod 666 ${appliance_build_name}-vmware.vmdk + stage_vmx ${appliance_build_name}-vmware ${appliance_build_name}-vmware.vmdk + ovftool ${appliance_build_name}-vmware.vmx ${appliance_build_name}-vmware.ova + rm -f *vmx *vmdk + cd $CDIR + log INFO "${appliance} exported for VMWare: dist/${appliance_build_name}-vmware.ova" +} + +function hyperv_export() { + log INFO "creating hyperv export" + qemu-img convert -f qcow2 -O vpc "dist/${appliance}" "dist/${appliance_build_name}-hyperv.vhd" + CDIR=$PWD + cd dist + zip "${appliance_build_name}-hyperv.vhd.zip" "${appliance_build_name}-hyperv.vhd" + rm -f *vhd + cd $CDIR + log INFO "${appliance} exported for HyperV: dist/${appliance_build_name}-hyperv.vhd.zip" +} + +### +### Main invocation +### + +function main() { + prepare + + packer_build + + # process the disk at dist + kvm_export + ovm_export + xen_server_export + vmware_export + hyperv_export + rm -f "dist/${appliance}" + cd dist && chmod +r * && cd .. + cd dist && md5sum * > md5sum.txt && cd .. + cd dist && sha512sum * > sha512sum.txt && cd .. + add_on_exit log INFO "BUILD SUCCESSFUL" +} + +# we only run main() if not source-d +return 2>/dev/null || main diff --git a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/authorized_keys.sh b/tools/appliance/systemvmtemplate/scripts/authorized_keys.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/cleanup.sh b/tools/appliance/systemvmtemplate/scripts/cleanup.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_acpid.sh b/tools/appliance/systemvmtemplate/scripts/configure_acpid.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_conntrack.sh b/tools/appliance/systemvmtemplate/scripts/configure_conntrack.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_locale.sh b/tools/appliance/systemvmtemplate/scripts/configure_locale.sh old mode 100644 new mode 100755 index 8db7e4e55985..f5477506cfda --- a/tools/appliance/systemvmtemplate/scripts/configure_locale.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_locale.sh @@ -22,13 +22,15 @@ set -x function configure_locale() { grep LANG=en_US.UTF-8 /etc/default/locale && \ grep LC_ALL=en_US.UTF-8 /etc/default/locale && \ - grep "en_US.UTF-8 UTF-8" /etc/locale.gen && + grep "^en_US.UTF-8 UTF-8" /etc/locale.gen && return cat >> /etc/default/locale << EOF LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 EOF + + grep "^en_US.UTF-8 UTF-8" /etc/locale.gen || \ cat >> /etc/locale.gen << EOF en_US.UTF-8 UTF-8 EOF diff --git a/tools/appliance/systemvmtemplate/scripts/configure_login.sh b/tools/appliance/systemvmtemplate/scripts/configure_login.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_networking.sh b/tools/appliance/systemvmtemplate/scripts/configure_networking.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_persistent_config.sh b/tools/appliance/systemvmtemplate/scripts/configure_persistent_config.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh old mode 100644 new mode 100755 index 4467e2fff789..8bc71d29c1c0 --- a/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_systemvm_services.sh @@ -19,7 +19,7 @@ set -e set -x -CLOUDSTACK_RELEASE=4.21.0 +CLOUDSTACK_RELEASE=4.22.0 function configure_apache2() { # Enable ssl, rewrite and auth @@ -78,7 +78,7 @@ function install_cloud_scripts() { function do_signature() { mkdir -p /var/cache/cloud/ /usr/share/cloud/ (cd ./cloud_scripts/; tar -cvf - * | gzip > /usr/share/cloud/cloud-scripts.tgz) - md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature + sha512sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release } @@ -133,7 +133,7 @@ function configure_services() { systemctl disable containerd # Disable cloud init by default -cat < /etc/cloud/cloud.cfg.d/cloudstack.cfg + cat < /etc/cloud/cloud.cfg.d/cloudstack.cfg datasource_list: ['CloudStack'] datasource: CloudStack: diff --git a/tools/appliance/systemvmtemplate/scripts/finalize.sh b/tools/appliance/systemvmtemplate/scripts/finalize.sh old mode 100644 new mode 100755 index e5d15ecb61c9..507d4a4133ab --- a/tools/appliance/systemvmtemplate/scripts/finalize.sh +++ b/tools/appliance/systemvmtemplate/scripts/finalize.sh @@ -68,6 +68,7 @@ function zero_disk() { } function finalize() { + depmod -a configure_misc configure_rundisk_size configure_sudoers diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh old mode 100644 new mode 100755 diff --git a/tools/appliance/systemvmtemplate/template-base_aarch64-target_aarch64.json b/tools/appliance/systemvmtemplate/template-base_aarch64-target_aarch64.json index e2b4d3bce923..f15552ca5cc4 100644 --- a/tools/appliance/systemvmtemplate/template-base_aarch64-target_aarch64.json +++ b/tools/appliance/systemvmtemplate/template-base_aarch64-target_aarch64.json @@ -32,8 +32,8 @@ "format": "qcow2", "headless": true, "http_directory": "http", - "iso_checksum": "sha512:04a2a128852c2dff8bb71779ad325721385051eb1264d897bdb5918ab207a9b1de636ded149c56c61a09eb8c7f428496815e70d3be31b1b1cf4c70bf6427cedd", - "iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso", + "iso_checksum": "sha512:55ab206cd8b0da2898767c3eb6ab5ebef101e3925ec91b3b5f0a286136195b7072588f6ac2d059c545c6938978704ae78cd18d7d9d2a86a7380e46ce27ee4e7b", + "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/arm64/iso-cd/debian-12.12.0-arm64-netinst.iso", "net_device": "virtio-net", "output_directory": "../dist", "qemu_binary": "qemu-system-aarch64", diff --git a/tools/appliance/systemvmtemplate/template-base_x86_64-target_aarch64.json b/tools/appliance/systemvmtemplate/template-base_x86_64-target_aarch64.json index b1cd7c69e2c4..c16bf1fb2a29 100644 --- a/tools/appliance/systemvmtemplate/template-base_x86_64-target_aarch64.json +++ b/tools/appliance/systemvmtemplate/template-base_x86_64-target_aarch64.json @@ -31,8 +31,8 @@ "format": "qcow2", "headless": true, "http_directory": "http", - "iso_checksum": "sha512:04a2a128852c2dff8bb71779ad325721385051eb1264d897bdb5918ab207a9b1de636ded149c56c61a09eb8c7f428496815e70d3be31b1b1cf4c70bf6427cedd", - "iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso", + "iso_checksum": "sha512:55ab206cd8b0da2898767c3eb6ab5ebef101e3925ec91b3b5f0a286136195b7072588f6ac2d059c545c6938978704ae78cd18d7d9d2a86a7380e46ce27ee4e7b", + "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/arm64/iso-cd/debian-12.12.0-arm64-netinst.iso", "net_device": "virtio-net", "output_directory": "../dist", "qemu_binary": "qemu-system-aarch64", diff --git a/tools/appliance/systemvmtemplate/template-base_x86_64-target_x86_64.json b/tools/appliance/systemvmtemplate/template-base_x86_64-target_x86_64.json index 322d1620e03f..941eea9dcd7b 100644 --- a/tools/appliance/systemvmtemplate/template-base_x86_64-target_x86_64.json +++ b/tools/appliance/systemvmtemplate/template-base_x86_64-target_x86_64.json @@ -27,8 +27,8 @@ "format": "qcow2", "headless": true, "http_directory": "http", - "iso_checksum": "sha512:9ebe405c3404a005ce926e483bc6c6841b405c4d85e0c8a7b1707a7fe4957c617ae44bd807a57ec3e5c2d3e99f2101dfb26ef36b3720896906bdc3aaeec4cd80", - "iso_url": "https://cdimage.debian.org/mirror/cdimage/release/12.9.0/amd64/iso-cd/debian-12.9.0-amd64-netinst.iso", + "iso_checksum": "sha512:c93055182057dd19a334260671c7e10880541b7721ad9c8df87be47e0a11d5bbf85018350ff224ff6a5f6a68320b07e95d539cef9dc020c93966bfaa86d4b2ce", + "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/amd64/iso-cd/debian-12.12.0-amd64-netinst.iso", "net_device": "virtio-net", "output_directory": "../dist", "qemuargs": [ diff --git a/tools/build/installer/debinstall_full.sh b/tools/build/installer/debinstall_full.sh old mode 100644 new mode 100755 diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml index d3119d4f73b8..63f840d64f21 100644 --- a/tools/checkstyle/pom.xml +++ b/tools/checkstyle/pom.xml @@ -22,7 +22,7 @@ Apache CloudStack Developer Tools - Checkstyle Configuration org.apache.cloudstack checkstyle - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT UTF-8 diff --git a/tools/checkstyle/src/main/resources/cloud-pmd.xml b/tools/checkstyle/src/main/resources/cloud-pmd.xml index 66a4ec08294a..78d394ea15eb 100644 --- a/tools/checkstyle/src/main/resources/cloud-pmd.xml +++ b/tools/checkstyle/src/main/resources/cloud-pmd.xml @@ -19,11 +19,8 @@ under the License. --> - + Ruleset that brings all the rulesets we want from the pmd jar, because @@ -31,16 +28,16 @@ to add our own future rulesets, if any. - - - - - + + + + + - + @@ -50,35 +47,35 @@ - + - + - - - - - - - + + + + + + + - + - - - - - - - + + + + + + + diff --git a/tools/devcloud-kvm/README.md b/tools/devcloud-kvm/README.md index 3261fbe4b8e6..fb1405916dfb 100644 --- a/tools/devcloud-kvm/README.md +++ b/tools/devcloud-kvm/README.md @@ -1,3 +1,4 @@ + This directory hosts configs for setting up the devcloud-kvm environment. diff --git a/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg b/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg index b1a3418e5d30..ce3ec91bbcfb 100644 --- a/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg +++ b/tools/devcloud-kvm/devcloud-kvm-advanced-fusion.cfg @@ -1,21 +1,19 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# 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. -# - +# 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. { "zones": [ diff --git a/tools/devcloud-kvm/devcloud-kvm-advanced.cfg b/tools/devcloud-kvm/devcloud-kvm-advanced.cfg index a3a41da874f0..60ad8b58b9ff 100644 --- a/tools/devcloud-kvm/devcloud-kvm-advanced.cfg +++ b/tools/devcloud-kvm/devcloud-kvm-advanced.cfg @@ -1,21 +1,19 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# 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. -# - +# 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. { "zones": [ diff --git a/tools/devcloud-kvm/devcloud-kvm.cfg b/tools/devcloud-kvm/devcloud-kvm.cfg index ffd23504ffec..5ac417a13dc7 100644 --- a/tools/devcloud-kvm/devcloud-kvm.cfg +++ b/tools/devcloud-kvm/devcloud-kvm.cfg @@ -1,20 +1,20 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# 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. + # This is a stock devcloud config converted from the file # tools/devcloud/devcloud.cfg. diff --git a/tools/devcloud-kvm/pom.xml b/tools/devcloud-kvm/pom.xml index 12744442f783..35cf828a27b6 100644 --- a/tools/devcloud-kvm/pom.xml +++ b/tools/devcloud-kvm/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml @@ -56,7 +56,7 @@ org.codehaus.mojo properties-maven-plugin - 1.0-alpha-2 + 1.2.1 initialize diff --git a/tools/devcloud4/README.md b/tools/devcloud4/README.md index 96d33c914d4f..d940f79630d9 100644 --- a/tools/devcloud4/README.md +++ b/tools/devcloud4/README.md @@ -1,3 +1,22 @@ + + # Devcloud 4 ## Introduction diff --git a/tools/devcloud4/advanced/README.md b/tools/devcloud4/advanced/README.md index 986653fbc3b4..229e93857538 100644 --- a/tools/devcloud4/advanced/README.md +++ b/tools/devcloud4/advanced/README.md @@ -1,3 +1,22 @@ + + ### Configure virtualbox 1. Open virtualbox and navigate to its preferences/settings window. @@ -52,7 +71,7 @@ vagrant up ```bash cd /path/to/cloudstack/repo - wget http://download.cloudstack.org/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ + wget https://download.cloudstack.org/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ chmod +x scripts/vm/hypervisor/xenserver/vhd-util ``` diff --git a/tools/devcloud4/advanced/marvin.cfg b/tools/devcloud4/advanced/marvin.cfg index 222dc65d0452..7b6e656e6204 100644 --- a/tools/devcloud4/advanced/marvin.cfg +++ b/tools/devcloud4/advanced/marvin.cfg @@ -1,21 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# 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. { "zones": [ diff --git a/tools/devcloud4/basic/README.md b/tools/devcloud4/basic/README.md index b0bfdaaa4120..91fa81462d62 100644 --- a/tools/devcloud4/basic/README.md +++ b/tools/devcloud4/basic/README.md @@ -1,3 +1,22 @@ + + ### Configure virtualbox 1. Open virtualbox and navigate to its preferences/settings window. @@ -42,7 +61,7 @@ vagrant up ```bash cd /path/to/cloudstack/repo - wget http://download.cloudstack.org/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ + wget https://download.cloudstack.org/tools/vhd-util -P scripts/vm/hypervisor/xenserver/ chmod +x scripts/vm/hypervisor/xenserver/vhd-util ``` diff --git a/tools/devcloud4/basic/marvin.cfg b/tools/devcloud4/basic/marvin.cfg index 1c8ee547b265..9b7d73c381b1 100644 --- a/tools/devcloud4/basic/marvin.cfg +++ b/tools/devcloud4/basic/marvin.cfg @@ -1,21 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# 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. { "zones": [ diff --git a/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb index bd65d3d01723..999dc47dc34a 100644 --- a/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb +++ b/tools/devcloud4/binary-installation-advanced/marvin.cfg.erb @@ -5,9 +5,9 @@ # to you 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 diff --git a/tools/devcloud4/binary-installation-basic/marvin.cfg.erb b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb index 721fc07d6c79..03e0dd6562b5 100644 --- a/tools/devcloud4/binary-installation-basic/marvin.cfg.erb +++ b/tools/devcloud4/binary-installation-basic/marvin.cfg.erb @@ -5,9 +5,9 @@ # to you 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 diff --git a/tools/devcloud4/common/binary-installation/README.md b/tools/devcloud4/common/binary-installation/README.md index e69de29bb2d1..ef14affc68c6 100644 --- a/tools/devcloud4/common/binary-installation/README.md +++ b/tools/devcloud4/common/binary-installation/README.md @@ -0,0 +1,18 @@ + diff --git a/tools/devcloud4/common/configure-network.sh b/tools/devcloud4/common/configure-network.sh old mode 100644 new mode 100755 index bcab6602d92f..06d67d80b7e5 --- a/tools/devcloud4/common/configure-network.sh +++ b/tools/devcloud4/common/configure-network.sh @@ -1,23 +1,23 @@ #!/bin/bash -# Usage ./reset-network.sh interface ip netmask -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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 + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 # -# 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. +# 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. + +# Usage ./reset-network.sh interface ip netmask [ $# -lt 3 ] && { echo -e "Missing arguments\nUsage: ./reset-network interface ip netmask label"; exit 1; } diff --git a/tools/devcloud4/common/development-installation/README.md b/tools/devcloud4/common/development-installation/README.md index e69de29bb2d1..ef14affc68c6 100644 --- a/tools/devcloud4/common/development-installation/README.md +++ b/tools/devcloud4/common/development-installation/README.md @@ -0,0 +1,18 @@ + diff --git a/tools/devcloud4/common/development-installation/files/default/createtmplt.sh b/tools/devcloud4/common/development-installation/files/default/createtmplt.sh index 2f8f3421350a..ca5022bae4f0 100755 --- a/tools/devcloud4/common/development-installation/files/default/createtmplt.sh +++ b/tools/devcloud4/common/development-installation/files/default/createtmplt.sh @@ -75,6 +75,8 @@ is_compressed() { ;; ZIP) ctype="zip" ;; + XZ) ctype="xz" + ;; *) echo "File $1 does not appear to be compressed" >&2 return 1 ;; @@ -94,6 +96,8 @@ uncompress() { ;; ZIP) unzip -q -p $1 | cat > $tmpfile ;; + XZ) xz -d -c $1 > $tmpfile + ;; *) printf "$1" return 0 ;; diff --git a/tools/devcloud4/pom.xml b/tools/devcloud4/pom.xml index c9a53b805cef..385b49ad88c7 100644 --- a/tools/devcloud4/pom.xml +++ b/tools/devcloud4/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml @@ -56,7 +56,7 @@ org.codehaus.mojo properties-maven-plugin - 1.0-alpha-2 + 1.2.1 initialize diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 300a3080a8a7..dcadfb3fead6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -19,7 +19,7 @@ FROM ubuntu:22.04 -LABEL Vendor="Apache.org" License="ApacheV2" Version="4.21.0.0-SNAPSHOT" Author="Apache CloudStack " +LABEL Vendor="Apache.org" License="ApacheV2" Version="4.23.0.0-SNAPSHOT" Author="Apache CloudStack " ARG DEBIAN_FRONTEND=noninteractive @@ -58,7 +58,7 @@ RUN mvn -Pdeveloper -Dsimulator -DskipTests clean install RUN find /var/lib/mysql -type f -exec touch {} \; && \ (/usr/bin/mysqld_safe &) && \ sleep 5; \ - mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by ''" --connect-expired-password; \ + mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password by ''" --connect-expired-password; \ mvn -Pdeveloper -pl developer -Ddeploydb; \ mvn -Pdeveloper -pl developer -Ddeploydb-simulator; \ MARVIN_FILE=`find /root/tools/marvin/dist/ -name "Marvin*.tar.gz"`; \ diff --git a/tools/docker/Dockerfile.marvin b/tools/docker/Dockerfile.marvin index a70ec90fbdad..f0a55109402a 100644 --- a/tools/docker/Dockerfile.marvin +++ b/tools/docker/Dockerfile.marvin @@ -19,11 +19,11 @@ # build for cloudstack_home_dir not this folder FROM python:2 -LABEL Vendor="Apache.org" License="ApacheV2" Version="4.21.0.0-SNAPSHOT" Author="Apache CloudStack " +LABEL Vendor="Apache.org" License="ApacheV2" Version="4.23.0.0-SNAPSHOT" Author="Apache CloudStack " ENV WORK_DIR=/marvin -ENV PKG_URL=https://builds.cloudstack.org/job/build-master-marvin/lastSuccessfulBuild/artifact/tools/marvin/dist/Marvin-4.21.0.0-SNAPSHOT.tar.gz +ENV PKG_URL=https://builds.cloudstack.org/job/build-master-marvin/lastSuccessfulBuild/artifact/tools/marvin/dist/Marvin-4.23.0.0-SNAPSHOT.tar.gz RUN apt-get update && apt-get install -y vim RUN pip install --upgrade paramiko nose requests diff --git a/tools/docker/Dockerfile.s390x b/tools/docker/Dockerfile.s390x new file mode 100644 index 000000000000..7e8c49fb3866 --- /dev/null +++ b/tools/docker/Dockerfile.s390x @@ -0,0 +1,90 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# CloudStack-simulator build + +FROM ubuntu:22.04 + +LABEL Vendor="Apache.org" License="ApacheV2" Version="4.23.0.0-SNAPSHOT" Author="Apache CloudStack " + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && apt-get install -y \ + genisoimage \ + libffi-dev \ + libssl-dev \ + curl \ + gcc-10 \ + git \ + sudo \ + ipmitool \ + iproute2 \ + maven \ + openjdk-11-jdk \ + python3-dev \ + python-is-python3 \ + python3-setuptools \ + python3-pip \ + python3-mysql.connector \ + # Required on s390x as pre-built wheels for bcrypt, cryptography, and cffi are unavailable, necessitating source builds. + python3-bcrypt \ + python3-cryptography \ + python3-cffi \ + supervisor + +RUN apt-get install -qqy mysql-server && \ + apt-get clean all && \ + mkdir -p /var/run/mysqld; \ + chown mysql /var/run/mysqld + +RUN echo '''sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"''' >> /etc/mysql/mysql.conf.d/mysqld.cnf + +COPY tools/docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY . ./root +WORKDIR /root + +RUN mvn -Pdeveloper -Dsimulator -DskipTests clean install + +RUN find /var/lib/mysql -type f -exec touch {} \; && \ + (/usr/bin/mysqld_safe &) && \ + sleep 5; \ + mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by ''" --connect-expired-password; \ + mvn -Pdeveloper -pl developer -Ddeploydb; \ + mvn -Pdeveloper -pl developer -Ddeploydb-simulator; \ + MARVIN_FILE=`find /root/tools/marvin/dist/ -name "Marvin*.tar.gz"`; \ + rm -rf /usr/bin/s390x-linux-gnu-gcc && \ + ln -s /usr/bin/gcc-10 /usr/bin/s390x-linux-gnu-gcc && \ + pip3 install maturin && \ + pip3 install $MARVIN_FILE + +RUN apt-get install -y nodejs npm build-essential python3 g++ make + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \ + . /root/.nvm/nvm.sh && \ + nvm install 16 && \ + nvm use 16 && \ + NVM_BIN="$(dirname "$(nvm which node)")" && \ + ln -sf "$NVM_BIN/node" /usr/local/bin/node && \ + ln -sf "$NVM_BIN/npm" /usr/local/bin/npm && \ + cd ui && npm rebuild node-sass && npm install + + +VOLUME /var/lib/mysql + +EXPOSE 8080 8096 5050 + +CMD ["/usr/bin/supervisord"] diff --git a/tools/docker/Dockerfile.smokedev b/tools/docker/Dockerfile.smokedev index f929294c2ce3..b4c55b309677 100644 --- a/tools/docker/Dockerfile.smokedev +++ b/tools/docker/Dockerfile.smokedev @@ -88,7 +88,6 @@ COPY test/conf /root/test/conf COPY test/metadata /root/test/metadata COPY test/pom.xml /root/test/pom.xml COPY test/scripts /root/test/scripts -COPY test/selenium /root/test/selenium COPY test/systemvm /root/test/systemvm COPY test/target /root/test/target COPY tools/pom.xml /root/tools/pom.xml diff --git a/tools/docker/README.md b/tools/docker/README.md index 0977b8966068..676101c32d63 100644 --- a/tools/docker/README.md +++ b/tools/docker/README.md @@ -1,3 +1,22 @@ + + # Docker Files for Apache CloudStack Dockerfiles used to build CloudStack images are available on Docker hub. @@ -58,7 +77,7 @@ docker run -ti --name cloudstack --link cloudstack-mysql:mysql -d -p 8080:8080 - ### Marvin Use marvin to deploy or test your CloudStack environment. -Use Marvin with cloudstack connection thru the API port (8096) +Use Marvin with cloudstack connection through the API port (8096) ``` docker pull cloudstack/marvin @@ -99,7 +118,7 @@ tag:latest = main branch docker build -f Dockerfile.centos6 -t cloudstack/management_centos6 . ``` -2. on jenkins, database and systemvm.iso are pre-deployed. the inital start require privileged container to +2. on jenkins, database and systemvm.iso are pre-deployed. the initial start require privileged container to mount systemvm.iso and copy ssh_rsa.pub into it. ``` diff --git a/tools/docker/docker-compose.yml b/tools/docker/docker-compose.yml index 86934f6407f1..8179be28af6c 100644 --- a/tools/docker/docker-compose.yml +++ b/tools/docker/docker-compose.yml @@ -5,9 +5,9 @@ # to you 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 @@ -24,7 +24,7 @@ services: - db:/var/lib/mysql environment: MYSQL_DATABASE: cloud -# MYSQL_ROOT_PASSWORD: root + # MYSQL_ROOT_PASSWORD: root MYSQL_ALLOW_EMPTY_PASSWORD: 1 MYSQL_USER: cloud MYSQL_PASSWORD: cloud diff --git a/tools/docker/docker_run_tests.sh b/tools/docker/docker_run_tests.sh old mode 100644 new mode 100755 diff --git a/tools/eclipse/set-eclipse-profile.sh b/tools/eclipse/set-eclipse-profile.sh old mode 100644 new mode 100755 diff --git a/tools/logo/apache_cloudstack.png b/tools/logo/apache_cloudstack.png index d0fde45ac28e..89bf57007aea 100644 Binary files a/tools/logo/apache_cloudstack.png and b/tools/logo/apache_cloudstack.png differ diff --git a/tools/marvin/README.md b/tools/marvin/README.md new file mode 100644 index 000000000000..0d43605fc0a3 --- /dev/null +++ b/tools/marvin/README.md @@ -0,0 +1,29 @@ + +# Marvin + +Marvin is the Apache CloudStack Python client written for running smoke tests. + +## Overview + +Marvin provides a Python-based client for Apache CloudStack. It offers utilities for testing and interacting with CloudStack deployments. + +## License + +Licensed under the Apache License, Version 2.0. See the LICENSE.txt file for details. diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 5b438daceb72..d64046b7f97c 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -164,9 +164,10 @@ def __sendPostReqToCS(self, url, payload): ''' try: response = requests.post(url, - params=payload, + data=payload, cert=self.certPath, verify=self.httpsFlag) + self.logger.debug("=======Got POST response : %s=======" % response) return response except Exception as e: self.__lastError = e diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index 8c5a0d6e6123..fb2afc19d2e3 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -148,32 +148,24 @@ def __createApiClient(self): "Client Creation Failed") return FAILED + user_id = list_user_res[0].id getuser_keys = getUserKeys.getUserKeysCmd() - getuser_keys.id = list_user_res[0].id + getuser_keys.id = user_id getuser_keys_res = self.__apiClient.getUserKeys(getuser_keys) - if getuser_keys_res is None : - self.__logger.error("__createApiClient: API " - "Client Creation Failed") - return FAILED - - api_key = getuser_keys_res.apikey - security_key = getuser_keys_res.secretkey - user_id = list_user_res[0].id - if api_key is None: + if getuser_keys_res['apikey'] is None: ret = self.__getKeys(user_id) - if ret != FAILED: - mgmt_details.apiKey = ret[0] - mgmt_details.securityKey = ret[1] - else: + if ret == FAILED: self.__logger.error("__createApiClient: API Client " "Creation Failed while " "Registering User") return FAILED + mgmt_details.apiKey = ret[0] + mgmt_details.securityKey = ret[1] else: mgmt_details.port = 8080 - mgmt_details.apiKey = api_key - mgmt_details.securityKey = security_key + mgmt_details.apiKey = getuser_keys_res['apikey'] + mgmt_details.securityKey = getuser_keys_res['secretkey'] ''' Now Create the Connection objects and Api Client using new details @@ -216,6 +208,7 @@ def __getKeys(self, userid): try: register_user = registerUserKeys.registerUserKeysCmd() register_user.id = userid + register_user.name = f"keypair-{userid}" register_user_res = \ self.__apiClient.registerUserKeys(register_user) if not register_user_res: @@ -224,13 +217,13 @@ def __getKeys(self, userid): getuser_keys = getUserKeys.getUserKeysCmd() getuser_keys.id = userid getuser_keys_res = self.__apiClient.getUserKeys(getuser_keys) - if getuser_keys_res is None : + if getuser_keys_res is None: self.__logger.error("__createApiClient: API " - "Client Creation Failed") + "Client Creation Failed") return FAILED - api_key = getuser_keys_res.apikey - security_key = getuser_keys_res.secretkey + api_key = getuser_keys_res['apikey'] + security_key = getuser_keys_res['secretkey'] return (api_key, security_key) except Exception as e: self.__logger.exception("Exception Occurred Under __geKeys : " diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 3485eeb8b184..e3d4022cf0f9 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -1068,8 +1068,8 @@ "displaytext": "ubuntu 22.04 kvm", "format": "raw", "hypervisor": "kvm", - "ostype": "Other Linux (64-bit)", - "url": "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img", + "ostype": "Ubuntu 22.04 LTS", + "url": "https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64.img", "requireshvm": "True", "ispublic": "True", "isextractable": "False" @@ -1080,7 +1080,7 @@ "format": "vhd", "hypervisor": "xenserver", "ostype": "Other Linux (64-bit)", - "url": "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64-azure.vhd.tar.gz", + "url": "https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64-azure.vhd.tar.gz", "requireshvm": "True", "ispublic": "True", "isextractable": "True" @@ -1091,10 +1091,10 @@ "format": "ova", "hypervisor": "vmware", "ostype": "Other Linux (64-bit)", - "url": "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.ova", + "url": "https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64.ova", "requireshvm": "True", "ispublic": "True", - "deployasis": "True" + "deployasis": "False" }, }, "test_ovf_templates": [ diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 557434ea2ee3..636c73209a3f 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -335,6 +335,7 @@ def list(cls, apiclient, **kwargs): def registerUserKeys(cls, apiclient, userid): cmd = registerUserKeys.registerUserKeysCmd() cmd.id = userid + cmd.name = f"keypair-{userid}" return apiclient.registerUserKeys(cmd) def update(self, apiclient, **kwargs): @@ -401,7 +402,8 @@ def __init__(self, items, services): self.ssh_port = 22 self.ssh_client = None # extract out the ipaddress - self.ipaddress = self.nic[0].ipaddress + if self.nic: + self.ipaddress = self.nic[0].ipaddress @classmethod def ssh_access_group(cls, apiclient, cmd): @@ -516,6 +518,43 @@ def access_ssh_over_nat( virtual_machine.ssh_ip = nat_rule.ipaddress virtual_machine.public_ip = nat_rule.ipaddress + @classmethod + def program_ssh_access( + cls, apiclient, services, mode, networkids, virtual_machine, allow_egress=False, vpcid=None): + """ + Program SSH access to the VM + """ + # program ssh access over NAT via PF + retries = 5 + interval = 30 + while retries > 0: + try: + if mode.lower() == 'advanced': + cls.access_ssh_over_nat( + apiclient, + services, + virtual_machine, + allow_egress=allow_egress, + networkid=networkids[0] if networkids else None, + vpcid=vpcid) + elif mode.lower() == 'basic': + if virtual_machine.publicip is not None: + # EIP/ELB (netscaler) enabled zone + vm_ssh_ip = virtual_machine.publicip + else: + # regular basic zone with security group + vm_ssh_ip = virtual_machine.nic[0].ipaddress + virtual_machine.ssh_ip = vm_ssh_ip + virtual_machine.public_ip = vm_ssh_ip + break + except Exception as e: + if retries >= 0: + retries = retries - 1 + time.sleep(interval) + continue + raise Exception( + "The following exception appeared while programming ssh access - %s" % e) + @classmethod def create(cls, apiclient, services, templateid=None, accountid=None, domainid=None, zoneid=None, networkids=None, @@ -527,7 +566,9 @@ def create(cls, apiclient, services, templateid=None, accountid=None, customcpuspeed=None, custommemory=None, rootdisksize=None, rootdiskcontroller=None, vpcid=None, macaddress=None, datadisktemplate_diskoffering_list={}, properties=None, nicnetworklist=None, bootmode=None, boottype=None, dynamicscalingenabled=None, - userdataid=None, userdatadetails=None, extraconfig=None, size=None, overridediskofferingid=None): + userdataid=None, userdatadetails=None, extraconfig=None, size=None, overridediskofferingid=None, + leaseduration=None, leaseexpiryaction=None, volumeid=None, snapshotid=None): + """Create the instance""" cmd = deployVirtualMachine.deployVirtualMachineCmd() @@ -691,6 +732,18 @@ def create(cls, apiclient, services, templateid=None, accountid=None, if extraconfig: cmd.extraconfig = extraconfig + if leaseduration: + cmd.leaseduration = leaseduration + + if leaseexpiryaction: + cmd.leaseexpiryaction = leaseexpiryaction + + if volumeid: + cmd.volumeid = volumeid + + if snapshotid: + cmd.snapshotid = snapshotid + virtual_machine = apiclient.deployVirtualMachine(cmd, method=method) if 'password' in list(virtual_machine.__dict__.keys()): @@ -702,36 +755,7 @@ def create(cls, apiclient, services, templateid=None, accountid=None, virtual_machine.public_ip = virtual_machine.nic[0].ipaddress return VirtualMachine(virtual_machine.__dict__, services) - # program ssh access over NAT via PF - retries = 5 - interval = 30 - while retries > 0: - time.sleep(interval) - try: - if mode.lower() == 'advanced': - cls.access_ssh_over_nat( - apiclient, - services, - virtual_machine, - allow_egress=allow_egress, - networkid=cmd.networkids[0] if cmd.networkids else None, - vpcid=vpcid) - elif mode.lower() == 'basic': - if virtual_machine.publicip is not None: - # EIP/ELB (netscaler) enabled zone - vm_ssh_ip = virtual_machine.publicip - else: - # regular basic zone with security group - vm_ssh_ip = virtual_machine.nic[0].ipaddress - virtual_machine.ssh_ip = vm_ssh_ip - virtual_machine.public_ip = vm_ssh_ip - break - except Exception as e: - if retries >= 0: - retries = retries - 1 - continue - raise Exception( - "The following exception appeared while programming ssh access - %s" % e) + cls.program_ssh_access(apiclient, services, mode, cmd.networkids, virtual_machine, allow_egress, vpcid) return VirtualMachine(virtual_machine.__dict__, services) @@ -1061,7 +1085,7 @@ def scale(self, apiclient, serviceOfferingId, return apiclient.scaleVirtualMachine(cmd) def unmanage(self, apiclient): - """Unmanage a VM from CloudStack (currently VMware only)""" + """Unmanage a VM from CloudStack""" cmd = unmanageVirtualMachine.unmanageVirtualMachineCmd() cmd.id = self.id return apiclient.unmanageVirtualMachine(cmd) @@ -1127,7 +1151,7 @@ def __init__(self, items): @classmethod def create(cls, apiclient, services, zoneid=None, account=None, - domainid=None, diskofferingid=None, projectid=None, size=None): + domainid=None, diskofferingid=None, projectid=None, size=None, snapshotid=None): """Create Volume""" cmd = createVolume.createVolumeCmd() cmd.name = "-".join([services["diskname"], random_gen()]) @@ -1158,6 +1182,9 @@ def create(cls, apiclient, services, zoneid=None, account=None, if size: cmd.size = size + if snapshotid: + cmd.snapshotid = snapshotid + return Volume(apiclient.createVolume(cmd).__dict__) def update(self, apiclient, **kwargs): @@ -1208,12 +1235,15 @@ def create_custom_disk(cls, apiclient, services, account=None, @classmethod def create_from_snapshot(cls, apiclient, snapshot_id, services, - account=None, domainid=None, projectid=None): + account=None, domainid=None, projectid=None, zoneid=None, disk_offering=None, size=None): """Create Volume from snapshot""" cmd = createVolume.createVolumeCmd() cmd.name = "-".join([services["diskname"], random_gen()]) cmd.snapshotid = snapshot_id - cmd.zoneid = services["zoneid"] + if zoneid: + cmd.zoneid = zoneid + elif "zoneid" in services: + cmd.zoneid = services["zoneid"] if "size" in services: cmd.size = services["size"] if "ispublic" in services: @@ -1232,6 +1262,12 @@ def create_from_snapshot(cls, apiclient, snapshot_id, services, if projectid: cmd.projectid = projectid + if disk_offering: + cmd.diskofferingid = disk_offering + + if size: + cmd.size = size + return Volume(apiclient.createVolume(cmd).__dict__) @classmethod @@ -1364,7 +1400,7 @@ def __init__(self, items): @classmethod def create(cls, apiclient, volume_id, account=None, - domainid=None, projectid=None, locationtype=None, asyncbackup=None): + domainid=None, projectid=None, locationtype=None, asyncbackup=None, zoneids=None, pool_ids=None, usestoragereplication=None): """Create Snapshot""" cmd = createSnapshot.createSnapshotCmd() cmd.volumeid = volume_id @@ -1378,12 +1414,20 @@ def create(cls, apiclient, volume_id, account=None, cmd.locationtype = locationtype if asyncbackup: cmd.asyncbackup = asyncbackup + if zoneids: + cmd.zoneids = zoneids + if pool_ids: + cmd.storageids = pool_ids + if usestoragereplication: + cmd.usestoragereplication = usestoragereplication return Snapshot(apiclient.createSnapshot(cmd).__dict__) - def delete(self, apiclient): + def delete(self, apiclient, zone_id=None): """Delete Snapshot""" cmd = deleteSnapshot.deleteSnapshotCmd() cmd.id = self.id + if zone_id: + cmd.zoneid = zone_id apiclient.deleteSnapshot(cmd) @classmethod @@ -1396,6 +1440,22 @@ def list(cls, apiclient, **kwargs): cmd.listall = True return (apiclient.listSnapshots(cmd)) + @classmethod + def copy(cls, apiclient, snapshotid, zone_ids=None, source_zone_id=None, pool_ids=None, usestoragereplication=None): + """ Copy snapshot to another zone or a primary storage in another zone""" + cmd = copySnapshot.copySnapshotCmd() + cmd.id = snapshotid + if source_zone_id: + cmd.sourcezoneid = source_zone_id + if zone_ids: + cmd.destzoneids = zone_ids + if pool_ids: + cmd.storageids = pool_ids + if usestoragereplication: + cmd.usestoragereplication = usestoragereplication + return Snapshot(apiclient.copySnapshot(cmd).__dict__) + + def validateState(self, apiclient, snapshotstate, timeout=600): """Check if snapshot is in required state returnValue: List[Result, Reason] @@ -1431,7 +1491,7 @@ def __init__(self, items): @classmethod def create(cls, apiclient, services, volumeid=None, - account=None, domainid=None, projectid=None, randomise=True): + account=None, domainid=None, projectid=None, randomise=True, snapshotid=None, zoneid=None): """Create template from Volume""" # Create template from Virtual machine and Volume ID cmd = createTemplate.createTemplateCmd() @@ -1477,6 +1537,12 @@ def create(cls, apiclient, services, volumeid=None, if projectid: cmd.projectid = projectid + + if snapshotid: + cmd.snapshotid = snapshotid + + if zoneid: + cmd.zoneid = zoneid return Template(apiclient.createTemplate(cmd).__dict__) @classmethod @@ -1554,6 +1620,8 @@ def register(cls, apiclient, services, zoneid=None, cmd.directdownload = services["directdownload"] if "checksum" in services: cmd.checksum = services["checksum"] + if "extensionid" in services: + cmd.extensionid = services["extensionid"] # Register Template template = apiclient.registerTemplate(cmd) @@ -1658,11 +1726,12 @@ def download(self, apiclient, retries=300, interval=5): # If template is ready, # template.status = Download Complete # Downloading - x% Downloaded + # Processing - Initial status # Error - Any other string if template.status == 'Download Complete' and template.isready: return - elif 'Downloaded' in template.status: + elif 'Downloaded' in template.status or template.status == 'Processing': retries = retries - 1 continue @@ -2689,6 +2758,13 @@ def create(cls, apiclient, services, tags=None, domainid=None, cacheMode=None, * if "diskofferingid" in services: cmd.diskofferingid = services["diskofferingid"] + if "vgpuprofileid" in services: + cmd.vgpuprofileid = services["vgpuprofileid"] + cmd.gpucount = 1 + + if "gpucount" in services: + cmd.gpucount = services["gpucount"] + # Service Offering private to that domain if domainid: cmd.domainid = domainid @@ -2729,10 +2805,13 @@ def __init__(self, items): self.__dict__.update(items) @classmethod - def create(cls, apiclient, services, tags=None, custom=False, domainid=None, cacheMode=None, **kwargs): + def create(cls, apiclient, services, tags=None, custom=False, domainid=None, cacheMode=None, displaytext=None, **kwargs): """Create Disk offering""" cmd = createDiskOffering.createDiskOfferingCmd() - cmd.displaytext = services["displaytext"] + if displaytext: + cmd.displaytext = displaytext + else: + cmd.displaytext = services["displaytext"] cmd.name = services["name"] if custom: cmd.customized = True @@ -3004,6 +3083,9 @@ def create(cls, apiclient, services, ipaddressid=None, accountid=None, if "openfirewall" in services: cmd.openfirewall = services["openfirewall"] + if "protocol" in services: + cmd.protocol = services["protocol"] + if projectid: cmd.projectid = projectid @@ -3112,6 +3194,22 @@ def listLoadBalancerRuleInstances(cls, apiclient, id, lbvmips=False, applied=Non [setattr(cmd, k, v) for k, v in list(kwargs.items())] return apiclient.listLoadBalancerRuleInstances(cmd) + def assignCert(self, apiclient, certId, forced=None): + """""" + cmd = assignCertToLoadBalancer.assignCertToLoadBalancerCmd() + cmd.lbruleid = self.id + cmd.certid = certId + if forced is not None: + cmd.forced = forced + return apiclient.assignCertToLoadBalancer(cmd) + + def removeCert(self, apiclient): + """Removes a certificate from a load balancer rule""" + + cmd = removeCertFromLoadBalancer.removeCertFromLoadBalancerCmd() + cmd.lbruleid = self.id + return apiclient.removeCertFromLoadBalancer(cmd) + class Cluster: """Manage Cluster life cycle""" @@ -3306,6 +3404,14 @@ def delete(self, apiclient): apiclient.deleteHost(cmd) return + def discoverGpuDevices(self, apiclient): + """Discover GPU devices on the host""" + # Host must be in maintenance mode before deletion + cmd = discoverGpuDevices.discoverGpuDevicesCmd() + cmd.id = self.id + apiclient.discoverGpuDevices(cmd) + return + @classmethod def enableMaintenance(cls, apiclient, id): """enables maintenance mode Host""" @@ -4576,6 +4682,7 @@ class Project: def __init__(self, items): self.__dict__.update(items) + @classmethod def create(cls, apiclient, services, account=None, domainid=None, userid=None, accountid=None): """Create project""" @@ -5120,6 +5227,8 @@ def create(cls, apiclient, services): cmd.networkmode = services["networkmode"] if "routingmode" in services: cmd.routingmode = services["routingmode"] + if "conservemode" in services: + cmd.conservemode = services["conservemode"] return VpcOffering(apiclient.createVPCOffering(cmd).__dict__) def update(self, apiclient, name=None, displaytext=None, state=None): @@ -6113,11 +6222,13 @@ def __init__(self, items): self.__dict__.update(items) @classmethod - def create(self, apiclient, vmid): + def create(cls, apiclient, vmid, name=None): """Create VM backup""" cmd = createBackup.createBackupCmd() cmd.virtualmachineid = vmid + if name: + cmd.name = name return Backup(apiclient.createBackup(cmd).__dict__) @classmethod @@ -6131,11 +6242,12 @@ def delete(self, apiclient, id, forced=None): return (apiclient.deleteBackup(cmd)) @classmethod - def list(self, apiclient, vmid): + def list(self, apiclient, vmid=None): """List VM backups""" cmd = listBackups.listBackupsCmd() - cmd.virtualmachineid = vmid + if vmid: + cmd.virtualmachineid = vmid cmd.listall = True return (apiclient.listBackups(cmd)) @@ -6157,6 +6269,25 @@ def restoreVolumeFromBackupAndAttachToVM(self, apiclient, backupid, volumeid, vi cmd.virtualmachineid = virtualmachineid return (apiclient.restoreVolumeFromBackupAndAttachToVM(cmd)) + @classmethod + def createVMFromBackup(cls, apiclient, services, mode, backupid, accountname, domainid, zoneid, vmname=None, networkids=None, templateid=None): + """Create new VM from backup + """ + cmd = createVMFromBackup.createVMFromBackupCmd() + cmd.backupid = backupid + cmd.account = accountname + cmd.domainid = domainid + cmd.zoneid = zoneid + if vmname: + cmd.name = vmname + if networkids: + cmd.networkids = networkids + if templateid: + cmd.templateid = templateid + response = apiclient.createVMFromBackup(cmd) + virtual_machine = VirtualMachine(response.__dict__, []) + VirtualMachine.program_ssh_access(apiclient, services, mode, cmd.networkids, virtual_machine) + return virtual_machine class BackupSchedule: @@ -6199,6 +6330,45 @@ def update(self, apiclient, vmid, **kwargs): return (apiclient.updateBackupSchedule(cmd)) +class BackupRepository: + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def add(cls, apiclient, zoneid, name, address, provider, type): + """Add backup repository""" + + cmd = addBackupRepository.addBackupRepositoryCmd() + cmd.zoneid = zoneid + cmd.name = name + cmd.address = address + cmd.provider = provider + cmd.type = type + response = apiclient.addBackupRepository(cmd) + return BackupRepository(response.__dict__) + + def delete(self, apiclient): + """Delete backup repository""" + + cmd = deleteBackupRepository.deleteBackupRepositoryCmd() + cmd.id = self.id + return (apiclient.deleteBackupRepository(cmd)) + + def update(self, apiclient, crosszoneinstancecreation): + """Update backup repository""" + + cmd = updateBackupRepository.updateBackupRepositoryCmd() + cmd.id = self.id + cmd.crosszoneinstancecreation = crosszoneinstancecreation + return (apiclient.updateBackupRepository(cmd)) + + def list(self, apiclient): + """List backup repository""" + + cmd = listBackupRepositories.listBackupRepositoriesCmd() + return (apiclient.listBackupRepository(cmd)) + class ProjectRole: def __init__(self, items): @@ -6720,7 +6890,7 @@ def list(cls, apiclient, id=None, name=None, **kwargs): class GuestOS: """Manage Guest OS""" - def __init__(self, items, services): + def __init__(self, items): self.__dict__.update(items) @classmethod @@ -6735,7 +6905,7 @@ def add(cls, apiclient, osdisplayname=None, if details is not None: cmd.details = details - return (apiclient.addGuestOs(cmd)) + return GuestOS(apiclient.addGuestOs(cmd).__dict__) @classmethod def remove(cls, apiclient, id): @@ -6772,10 +6942,13 @@ def list(cls, apiclient, id=None, oscategoryid=None, description=None, **kwargs) return (apiclient.listOsTypes(cmd)) + def delete(self, apiclient): + self.remove(apiclient, self.id) + class GuestOsMapping: """Manage Guest OS Mappings""" - def __init__(self, items, services): + def __init__(self, items): self.__dict__.update(items) @classmethod @@ -6793,7 +6966,7 @@ def add(cls, apiclient, ostypeid=None, if forced is not None: cmd.forced = forced - return (apiclient.addGuestOsMapping(cmd)) + return GuestOsMapping(apiclient.addGuestOsMapping(cmd).__dict__) @classmethod def remove(cls, apiclient, id): @@ -6837,6 +7010,9 @@ def list(cls, apiclient, id=None, ostypeid=None, osdisplayname=None, return (apiclient.listGuestOsMapping(cmd)) + def delete(self, apiclient): + self.remove(apiclient, self.id) + class VMSchedule: def __init__(self, items): @@ -7329,6 +7505,129 @@ def delete_deliveries(self, apiclient, **kwargs): [setattr(cmd, k, v) for k, v in list(kwargs.items())] return apiclient.deleteWebhookDelivery(cmd) +class Extension: + """Manage Extension Life cycle""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def create(cls, apiclient, name, type, **kwargs): + """Create Extension""" + cmd = createExtension.createExtensionCmd() + cmd.name = name + cmd.type = type + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + + return Extension(apiclient.createExtension(cmd).__dict__) + + @classmethod + def list(cls, apiclient, **kwargs): + cmd = listExtensions.listExtensionsCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.listExtensions(cmd) + + def delete(self, apiclient, unregisterresources=True, removeactions=True, cleanup=True): + """Delete Extension""" + if unregisterresources: + cmd = listExtensions.listExtensionsCmd() + cmd.id = self.id + extension = apiclient.listExtensions(cmd)[0] + if extension is not None and extension.resources is not None and len(extension.resources) > 0: + for resource in extension.resources: + self.unregister(apiclient, resource.id, resource.type) + if unregisterresources: + actions = self.list_custom_actions(apiclient) + if actions is not None and len(actions) > 0: + for action in actions: + cmd = deleteCustomAction.deleteCustomActionCmd() + cmd.id = action.id + apiclient.deleteCustomAction(cmd) + cmd = deleteExtension.deleteExtensionCmd() + cmd.id = self.id + cmd.cleanup=cleanup + apiclient.deleteExtension(cmd) + + def update(self, apiclient, **kwargs): + """Update Extension""" + + cmd = updateExtension.updateExtensionCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.updateExtension(cmd) + + def list_custom_actions(self, apiclient, **kwargs): + """List Extension Custom Actions""" + + cmd = listCustomActions.listCustomActionsCmd() + cmd.extensionid = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.listCustomActions(cmd) + + def register(self, apiclient, resource_id, resource_type, **kwargs): + """Register Extension""" + + cmd = registerExtension.registerExtensionCmd() + cmd.extensionid = self.id + cmd.resourceid = resource_id + cmd.resourcetype = resource_type + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.registerExtension(cmd) + + def unregister(self, apiclient, resource_id, resource_type, **kwargs): + """Unregister Extension""" + + cmd = unregisterExtension.unregisterExtensionCmd() + cmd.extensionid = self.id + cmd.resourceid = resource_id + cmd.resourcetype = resource_type + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.unregisterExtension(cmd) + +class ExtensionCustomAction: + """Manage Extension Custom Action Life cycle""" + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def create(cls, apiclient, extensionid, name, **kwargs): + """Create Custom Action""" + cmd = addCustomAction.addCustomActionCmd() + cmd.extensionid = extensionid + cmd.name = name + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + + return ExtensionCustomAction(apiclient.addCustomAction(cmd).__dict__) + + @classmethod + def list(cls, apiclient, **kwargs): + cmd = listCustomActions.listCustomActionsCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.listCustomActions(cmd) + + def delete(self, apiclient): + """Delete CustomAction""" + cmd = deleteCustomAction.deleteCustomActionCmd() + cmd.id = self.id + apiclient.deleteCustomAction(cmd) + + def update(self, apiclient, **kwargs): + """Update CustomAction""" + + cmd = updateCustomAction.updateCustomActionCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.updateCustomAction(cmd) + + def run(self, apiclient, resourceid, **kwargs): + """Run CustomAction""" + + cmd = runCustomAction.runCustomActionCmd() + cmd.customactionid = self.id + cmd.resourceid = resourceid + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return apiclient.runCustomAction(cmd) class ZoneIpv4Subnet: """Manage IPv4 Subnet for Zone""" @@ -7673,3 +7972,140 @@ def changediskoffering(self, apiclient, diskofferingid=None, size=None): cmd.diskofferingid = diskofferingid cmd.size = size return (apiclient.changeSharedFileSystemDiskOffering(cmd)) + +class GpuDevice: + + def __init__(self, items): + self.__dict__.update(items) + + """Manage GPU Device""" + @classmethod + def create(cls, apiclient, services, name, description=None, hostid=None, busaddress=None, gpuCardId=None, vgpuProfileId=None, type=None, parentGpuDeviceId=None, numaNode=None, pciRoot=None): + """Create GPU Device""" + cmd = createGpuDevice.createGpuDeviceCmd() + cmd.name = name + + if description: + cmd.description = description + + + if hostid: + cmd.hostid = hostid + elif "hostid" in services: + cmd.hostid = services["hostid"] + + if busaddress: + cmd.busaddress = busaddress + elif "busaddress" in services: + cmd.busaddress = services["busaddress"] + + if gpuCardId: + cmd.gpuCardId = gpuCardId + elif "gpuCardId" in services: + cmd.gpuCardId = services["gpuCardId"] + + if vgpuProfileId: + cmd.vgpuProfileId = vgpuProfileId + elif "vgpuProfileId" in services: + cmd.vgpuProfileId = services["vgpuProfileId"] + + if type: + cmd.type = type + elif "type" in services: + cmd.type = services["type"] + + if parentGpuDeviceId: + cmd.parentGpuDeviceId = parentGpuDeviceId + elif "parentGpuDeviceId" in services: + cmd.parentGpuDeviceId = services["parentGpuDeviceId"] + + if numaNode: + cmd.numaNode = numaNode + elif "numaNode" in services: + cmd.numaNode = services["numaNode"] + + if pciRoot: + cmd.pciRoot = pciRoot + elif "pciRoot" in services: + cmd.pciRoot = services["pciRoot"] + + return GpuDevice(apiclient.createGpuDevice(cmd).__dict__) + + def delete(self, apiclient, expunge=True, forced=True): + """Delete GPU Device""" + cmd = deleteGpuDevice.deleteGpuDeviceCmd() + cmd.id = self.id + cmd.expunge = expunge + cmd.forced = forced + apiclient.deleteGpuDevice(cmd) + + + @classmethod + def list(cls, apiclient, **kwargs): + cmd = listGpuDevices.listGpuDevicesCmd() + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.listGpuDevices(cmd)) + + def update(self, apiclient, **kwargs): + """Update GPU Device""" + cmd = updateGpuDevice.updateGpuDeviceCmd() + cmd.id = self.id + [setattr(cmd, k, v) for k, v in list(kwargs.items())] + return (apiclient.updateGpuDevice(cmd)) + + +class SslCertificate: + + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def create(cls, apiclient, services, name, certificate=None, privatekey=None, + certchain=None, password=None, enabledrevocationcheck=None, + account=None, domainid=None, projectid=None): + """Upload SSL certificate""" + cmd = uploadSslCert.uploadSslCertCmd() + cmd.name = name + + if certificate: + cmd.certificate = certificate + elif "certificate" in services: + cmd.certificate = services["certificate"] + + if privatekey: + cmd.privatekey = privatekey + elif "privatekey" in services: + cmd.privatekey = services["privatekey"] + + if certchain: + cmd.certchain = certchain + elif "certchain" in services: + cmd.certchain = services["certchain"] + + if password: + cmd.password = password + elif "password" in services: + cmd.password = services["password"] + + if enabledrevocationcheck is not None: + cmd.enabledrevocationcheck = enabledrevocationcheck + elif "enabledrevocationcheck" in services: + cmd.enabledrevocationcheck = services["enabledrevocationcheck"] + + if account: + cmd.account = account + + if projectid: + cmd.projectid = projectid + + if domainid: + cmd.domainid = domainid + + return SslCertificate(apiclient.uploadSslCert(cmd, method='POST').__dict__) + + def delete(self, apiclient): + """Delete SSL Certificate""" + + cmd = deleteSslCert.deleteSslCertCmd() + cmd.id = self.id + apiclient.deleteSslCert(cmd) diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py index f80eccf11590..c822a587dfc1 100644 --- a/tools/marvin/marvin/lib/utils.py +++ b/tools/marvin/marvin/lib/utils.py @@ -300,12 +300,63 @@ def get_hypervisor_version(apiclient): assert hosts_list_validation_result[0] == PASS, "host list validation failed" return hosts_list_validation_result[1].hypervisorversion +def is_snapshot_on_powerflex(apiclient, dbconn, config, zoneid, snapshotid): + """ + Checks whether a snapshot with id (not UUID) `snapshotid` is present on the powerflex storage + + @param apiclient: api client connection + @param dbconn: connection to the cloudstack db + @param config: marvin configuration file + @param zoneid: uuid of the zone on which the secondary nfs storage pool is mounted + @param snapshotid: uuid of the snapshot + @return: True if snapshot is found, False otherwise + """ + + qresultset = dbconn.execute( + "SELECT id FROM snapshots WHERE uuid = '%s';" \ + % str(snapshotid) + ) + if len(qresultset) == 0: + raise Exception( + "No snapshot found in cloudstack with id %s" % snapshotid) + + + snapshotid = qresultset[0][0] + qresultset = dbconn.execute( + "SELECT install_path, store_id FROM snapshot_store_ref WHERE snapshot_id='%s' AND store_role='Primary';" % snapshotid + ) + + assert isinstance(qresultset, list), "Invalid db query response for snapshot %s" % snapshotid + + if len(qresultset) == 0: + #Snapshot does not exist + return False + + from .base import StoragePool + #pass store_id to get the exact storage pool where snapshot is stored + primaryStores = StoragePool.list(apiclient, zoneid=zoneid, id=int(qresultset[0][1])) + + assert isinstance(primaryStores, list), "Not a valid response for listStoragePools" + assert len(primaryStores) != 0, "No storage pools found in zone %s" % zoneid + + primaryStore = primaryStores[0] + + if str(primaryStore.provider).lower() != "powerflex": + raise Exception( + "is_snapshot_on_powerflex works only against powerflex storage pool. found %s" % str(primaryStore.provider)) + + snapshotPath = str(qresultset[0][0]) + if not snapshotPath: + return False + + return True + def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): """ Checks whether a snapshot with id (not UUID) `snapshotid` is present on the nfs storage @param apiclient: api client connection - @param @dbconn: connection to the cloudstack db + @param dbconn: connection to the cloudstack db @param config: marvin configuration file @param zoneid: uuid of the zone on which the secondary nfs storage pool is mounted @param snapshotid: uuid of the snapshot diff --git a/tools/marvin/marvin/misc/build/CI.md b/tools/marvin/marvin/misc/build/CI.md index 390932cfd36d..07fc45406c5a 100644 --- a/tools/marvin/marvin/misc/build/CI.md +++ b/tools/marvin/marvin/misc/build/CI.md @@ -17,8 +17,7 @@ specific language governing permissions and limitations under the License. --> -about -===== +# about This document talks about the *evolving* continuous test infrastructure used to setup, deploy, configure and test Apache CloudStack. Information here is useful for anyone involved in build, test, continuous integration even operators of CloudStack. @@ -72,7 +71,7 @@ systems - these are virtual/physical infrastructure mapped to cobbler profiles b When a new image needs to be added we create a 'distro' in cobbler and associate that with a profile's kickstart. Any new systems to be hooked-up to be serviced by the profile can then be added easily by cmd line. -b. Puppet master - Cobbler reimages machines on-demand but it is upto puppet recipes to do configuration management within them. The configuration management is required for kvm hypervisors (kvm agent for eg:) and for the cloudstack management server which needs mysql, cloudstack, etc. The puppetmasterd daemon on the driver-vm is responsible for 'kicking' nodes to initiate configuration management on themselves when they come alive. +b. Puppet master - Cobbler reimages machines on-demand, but it is upto puppet recipes to do configuration management within them. The configuration management is required for kvm hypervisors (kvm agent for eg:) and for the cloudstack management server which needs mysql, cloudstack, etc. The puppetmasterd daemon on the driver-vm is responsible for 'kicking' nodes to initiate configuration management on themselves when they come alive. So the driver-vm is also the repository of all the puppet recipes for various modules that need to be configured for the test infrastructure to work. The modules are placed in /etc/puppet and bear the same structure as our GitHub repo. When we need to affect a configuration change on any of our systems we only change the GitHub repo and the systems in place are affected upon next run. @@ -80,7 +79,7 @@ c. dnsmasq - DNS is controlled by cobbler but its configuration of hosts is set d. dhcp - DHCP is also done by dnsmasq. All configuration is in /etc/dnsmasq.conf. static mac-ip-name mappings are given for hypervisors while the virtual instances get dynamic ips -e. ipmitool - ipmi for power management is setup on all the test servers and the ipmitool provides a convienient cli for booting the machines on the network into PXEing. +e. ipmitool - ipmi for power management is setup on all the test servers and the ipmitool provides a convenient cli for booting the machines on the network into PXEing. f. jenkins-slave - jenkins slave.jar is placed on the driver-vm as a service in /etc/init.d to react to jenkins schedules and to post reports to. The slave runs in headless mode as the driver-vm does not run X. @@ -96,22 +95,19 @@ b. multiple cluster c. inter-zone tests d. multi-pod tests -marvin integration -================== +## marvin integration -once cloudstack has been installed and the hypervisors prepared we are ready to use marvin to stitch together zones, pods, clusters and compute and storage to put together a 'cloud'. once configured - we perform a cursory health check to see if we have all systemVMs running in all zones and that built-in templates are downloaded in all zones. Subsequently we are able to launch tests on this environment +once cloudstack has been installed and the hypervisors prepared we are ready to use marvin to stitch together zones, pods, clusters and compute and storage to put together a 'cloud'. once configured - we perform a cursory health check to see if we have all systemVMs running in all zones and that built-in templates are downloaded in all zones. Subsequently, we are able to launch tests on this environment Only the latest tests from git are run on the setup. This allows us to test in a pseudo-continuous fashion with a nightly build deployed on the environment. Each test run takes a few hours to finish. -control via github -================== +## control via github there are two GitHub repositories controlling the test infrastructure. a. The puppet recipes at gh:acs-infra-test b. The gh:cloud-autodeploy repo that has the scripts to orchestrate the overall workflow -workflow -======== +## workflow When jenkins triggers the job following sequence of actions occur on the test infrastructure @@ -121,7 +117,7 @@ When jenkins triggers the job following sequence of actions occur on the test in 3. we fetch the last successful marvin build from builds.a.o and install it within this virtualenv. installing a new marvin on each run helps us test with the latest APIs available. -4. we fetch the latest version of the driver script from github:cloud-autodeploy. fetching the latest allows us to make adjustments to the infra without having to copy scripts in to the test infrastrcuture. +4. we fetch the latest version of the driver script from github:cloud-autodeploy. fetching the latest allows us to make adjustments to the infra without having to copy scripts in to the test infrastructure. 5. based on the hypervisor chosen we choose a profile for cobbler to reimage the hosts in the infrastructure. if xen is chosen we bring up the profile of the latest xen kickstart available in cobbler. currently - this is at xen 6.0.2. if kvm is chosen we can pick between ubuntu and rhel based host OS kickstarts. @@ -149,11 +145,10 @@ The $distro argument chooses the hostOS of the mgmt server - this can be ubuntu 12. Tests are run using the nose test runner with the marvin plugin and reports are recorded by jenkins. -limitations -=========== +## limitations + +## enhancements -enhancements -============ - packaging tests - puppetize the cobbler appliance - dogfooding @@ -164,14 +159,12 @@ enhancements - external devices (LB, VPX, FW) - mcollective? -future -====== +## future + - not everyone deploys cloudstack the same - multiple hv environments with multiple hv configurations - multiple storage configurations -troubleshooting -=============== +## troubleshooting -acknowledgements -================ +## acknowledgements diff --git a/tools/marvin/marvin/misc/build/configure.py b/tools/marvin/marvin/misc/build/configure.py index c88a0c1ae3f4..e5ab5c571df0 100644 --- a/tools/marvin/marvin/misc/build/configure.py +++ b/tools/marvin/marvin/misc/build/configure.py @@ -164,7 +164,7 @@ def cleanPrimaryStorage(cscfg): def seedSecondaryStorage(cscfg, hypervisor): """ erase secondary store and seed system VM template via puppet. The - secseeder.sh script is executed on mgmt server bootup which will mount and + secseeder.sh script is executed on mgmt server boot up which will mount and place the system VM templates on the NFS """ mgmt_server = cscfg.mgtSvr[0].mgtSvrIp diff --git a/tools/marvin/mvn-setup.py b/tools/marvin/mvn-setup.py index cabcf0dc6596..0eab94955120 100755 --- a/tools/marvin/mvn-setup.py +++ b/tools/marvin/mvn-setup.py @@ -33,7 +33,7 @@ def replaceVersion(fname, version): """replace VERSION in setup.py""" with open(fname, 'r') as f: content = f.read() - needle = '\nVERSION\s*=\s*[\'"][^\'"]*[\'"]' + needle = r'\nVERSION\s*=\s*[\'"][^\'"]*[\'"]' # Ensure the version is PEP440 compliant version = version.replace('-', '+', 1) replacement = '\nVERSION = "%s"' % version diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index d39985b677a5..8e81a394685c 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloud-tools - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py index 11a63a96aced..e126622930bb 100644 --- a/tools/marvin/setup.py +++ b/tools/marvin/setup.py @@ -27,7 +27,7 @@ raise RuntimeError("python setuptools is required to build Marvin") -VERSION = "4.21.0.0-SNAPSHOT" +VERSION = "4.23.0.0" setup(name="Marvin", version=VERSION, @@ -38,7 +38,7 @@ maintainer_email="dev@cloudstack.apache.org", long_description="Marvin is the Apache CloudStack python " "client written around the unittest framework", - platforms=("Any",), + platforms=["Any"], url="https://builds.apache.org/job/cloudstack-marvin/", packages=["marvin", "marvin.cloudstackAPI", "marvin.lib", "marvin.config", "marvin.sandbox", @@ -46,7 +46,7 @@ "marvin.sandbox.basic"], license="LICENSE.txt", install_requires=[ - "mysql-connector-python <= 8.0.30", + "mysql-connector-python <= 8.4.0", "requests >= 2.2.1", "paramiko >= 1.13.0", "nose >= 1.3.3", diff --git a/tools/ngui/precache.py b/tools/ngui/precache.py index e8f23011ccbb..fe63fdc93a96 100644 --- a/tools/ngui/precache.py +++ b/tools/ngui/precache.py @@ -16,4 +16,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -apicache = {u'authorize': {u'securitygroupingress': {u'name': u'authorizeSecurityGroupIngress', u'related': [u'authorizeSecurityGroupEgress'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this ingress rule'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this ingress rule'}], u'requiredparams': [], u'description': u'Authorizes a particular ingress rule for this security group'}, u'securitygroupegress': {u'name': u'authorizeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this egress rule'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this egress rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}], u'requiredparams': [], u'description': u'Authorizes a particular egress rule for this security group'}}, u'restore': {u'virtualmachine': {u'name': u'restoreVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Restore a VM to original template or specific snapshot'}}, u'suspend': {u'project': {u'name': u'suspendProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be suspended'}], u'requiredparams': [u'id'], u'description': u'Suspends a project'}}, u'revoke': {u'securitygroupingress': {u'name': u'revokeSecurityGroupIngress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the ingress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular ingress rule from this security group'}, u'securitygroupegress': {u'name': u'revokeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the egress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular egress rule from this security group'}}, u'disassociate': {u'ipaddress': {u'name': u'disassociateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of the public ip address to disassociate'}], u'requiredparams': [u'id'], u'description': u'Disassociates an ip address from the account.'}}, u'migrate': {u'volume': {u'name': u'migrateVolume', u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'volumeid', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'storageid', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'destination storage pool ID to migrate the volume to'}], u'requiredparams': [u'volumeid', u'storageid'], u'description': u'Migrate volume'}, u'systemvm': {u'name': u'migrateSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to migrate VM to'}], u'requiredparams': [u'virtualmachineid', u'hostid'], u'description': u'Attempts Migration of a system virtual machine to the host specified.'}, u'virtualmachine': {u'name': u'migrateVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'long', u'description': u'Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Destination Host ID to migrate VM to. Required for live migrating a VM from host to host'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool'}}, u'lock': {u'account': {u'name': u'lockAccount', u'related': [u'markDefaultZoneForAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Locks the specified account on this domain.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Locks the specified account.'}], u'requiredparams': [u'domainid', u'account'], u'description': u'Locks an account'}, u'user': {u'name': u'lockUser', u'related': [u'listUsers'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'Locks user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Locks a user account'}}, u'dissociate': {u'lun': {u'name': u'dissociateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN.'}, {u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'iqn', u'path'], u'description': u'Dissociate a LUN'}}, u'activate': {u'project': {u'name': u'activateProject', u'related': [u'createProject', u'listProjectAccounts'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}], u'requiredparams': [u'id'], u'description': u'Activates a project'}}, u'reconnect': {u'host': {u'name': u'reconnectHost', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'reconnectHost', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Reconnects a host.'}}, u'cancel': {u'hostmaintenance': {u'name': u'cancelHostMaintenance', u'related': [u'listSwifts', u'addHost', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Cancels host maintenance.'}, u'storagemaintenance': {u'name': u'cancelStorageMaintenance', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Cancels maintenance for primary storage'}}, u'query': {u'asyncjobresult': {u'name': u'queryAsyncJobResult', u'related': [], u'isasync': False, u'params': [{u'name': u'jobid', u'required': True, u'related': [u'queryAsyncJobResult'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the asynchronous job'}], u'requiredparams': [u'jobid'], u'description': u'Retrieves the current status of asynchronous job.'}}, u'recover': {u'virtualmachine': {u'name': u'recoverVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Recovers a virtual machine.'}}, u'extract': {u'volume': {u'name': u'extractVolume', u'related': [u'extractTemplate', u'extractIso'], u'isasync': True, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the volume would be extracted'}, {u'name': u'id', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the volume is located'}], u'requiredparams': [u'id', u'mode', u'zoneid'], u'description': u'Extracts volume'}, u'iso': {u'name': u'extractIso', u'related': [u'extractTemplate'], u'isasync': True, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts an ISO'}, u'template': {u'name': u'extractTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts a template'}}, u'copy': {u'iso': {u'name': u'copyIso', u'related': [u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies an iso from one zone to another.'}, u'template': {u'name': u'copyTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyTemplate', u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies a template from one zone to another.'}}, u'prepare': {u'hostformaintenance': {u'name': u'prepareHostForMaintenance', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Prepares a host for maintenance.'}, u'template': {u'name': u'prepareTemplate', u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone ID of the template to be prepared in primary storage(s).'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'template ID of the template to be prepared in primary storage(s).'}], u'requiredparams': [u'zoneid', u'templateid'], u'description': u'load template into primary storage'}}, u'attach': {u'volume': {u'name': u'attachVolume', u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the ID of the device to map the volume to within the guest OS. If no deviceId is passed in, the next available deviceId will be chosen. Possible values for a Linux OS are:* 1 - /dev/xvdb* 2 - /dev/xvdc* 4 - /dev/xvde* 5 - /dev/xvdf* 6 - /dev/xvdg* 7 - /dev/xvdh* 8 - /dev/xvdi* 9 - /dev/xvdj'}, {u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u' the ID of the virtual machine'}], u'requiredparams': [u'id', u'virtualmachineid'], u'description': u'Attaches a disk volume to a virtual machine.'}, u'iso': {u'name': u'attachIso', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'virtualmachineid', u'id'], u'description': u'Attaches an ISO to a virtual machine.'}}, u'create': {u'loadbalancerrule': {u'name': u'createLoadBalancerRule', u'related': [u'updateLoadBalancerRule'], u'isasync': True, u'params': [{u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when LB rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the load balancer. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the load balancer'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm'}, {u'name': u'publicipid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id from where the network traffic will be load balanced from'}, {u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the load balancer rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the public port from where the network traffic will be load balanced from'}, {u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the private port of the private ip address/virtual machine where the network traffic will be load balanced to'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'algorithm', u'name', u'publicport', u'privateport'], u'description': u'Creates a load balancer rule'}, u'domain': {u'name': u'createDomain', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'creates domain with this name'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Domain UUID, required for adding domain from another Region'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain for networks in the domain'}, {u'name': u'parentdomainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.'}], u'requiredparams': [u'name'], u'description': u'Creates a domain'}, u'snapshotpolicy': {u'name': u'createSnapshotPolicy', u'related': [u'listSnapshotPolicies'], u'isasync': False, u'params': [{u'name': u'intervaltype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY'}, {u'name': u'maxsnaps', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of snapshots to retain'}, {u'name': u'schedule', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'time the snapshot is scheduled to be taken. Format is:* if HOURLY, MM* if DAILY, MM:HH* if WEEKLY, MM:HH:DD (1-7)* if MONTHLY, MM:HH:DD (1-28)'}, {u'name': u'timezone', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}], u'requiredparams': [u'intervaltype', u'maxsnaps', u'schedule', u'timezone', u'volumeid'], u'description': u'Creates a snapshot policy for the account.'}, u'diskoffering': {u'name': u'createDiskOffering', u'related': [u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'customized', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'whether disk offering is custom or not'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'alternate display text of the disk offering'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'disksize', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'size of the disk offering in GB'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the disk offering. Values are local and shared.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'tags for the disk offering'}], u'requiredparams': [u'displaytext', u'name'], u'description': u'Creates a disk offering.'}, u'securitygroup': {u'name': u'createSecurityGroup', u'related': [u'listSecurityGroups'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the security group'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the security group'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}], u'requiredparams': [u'name'], u'description': u'Creates a security group'}, u'portforwardingrule': {u'name': u'createPortForwardingRule', u'related': [u'listIpForwardingRules'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's private port range"}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}, {u'name': u'privateendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}, {u'name': u'publicendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's public port range"}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}], u'requiredparams': [u'privateport', u'ipaddressid', u'protocol', u'virtualmachineid', u'publicport'], u'description': u'Creates a port forwarding rule'}, u'pod': {u'name': u'createPod', u'related': [u'updatePod', u'listPods'], u'isasync': False, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID in which the Pod will be created'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Pod for allocation of new resources'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}], u'requiredparams': [u'startip', u'name', u'zoneid', u'netmask', u'gateway'], u'description': u'Creates a new Pod.'}, u'ipforwardingrule': {u'name': u'createIpForwardingRule', u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the end port for the rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the forwarding rule, already associated via associateIp'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'startport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the start port for the rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the rule. Valid values are TCP or UDP.'}], u'requiredparams': [u'ipaddressid', u'startport', u'protocol'], u'description': u'Creates an ip forwarding rule'}, u'vpnconnection': {u'name': u'createVpnConnection', u'related': [u'listVpnConnections', u'resetVpnConnection'], u'isasync': True, u'params': [{u'name': u's2svpngatewayid', u'required': True, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u's2scustomergatewayid', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}], u'requiredparams': [u's2svpngatewayid', u's2scustomergatewayid'], u'description': u'Create site to site vpn connection'}, u'vpncustomergateway': {u'name': u'createVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr list of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}], u'requiredparams': [u'gateway', u'esppolicy', u'ikepolicy', u'cidrlist', u'ipsecpsk'], u'description': u'Creates site to site vpn customer gateway'}, u'lbstickinesspolicy': {u'name': u'createLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'lbruleid', u'required': True, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy'}, {u'name': u'methodname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy method, possible values can be obtained from ListNetworks API '}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the LB Stickiness policy'}, {u'name': u'param', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'param list. Example: param[0].name=cookiename¶m[0].value=LBCookie '}], u'requiredparams': [u'lbruleid', u'name', u'methodname'], u'description': u'Creates a Load Balancer stickiness policy '}, u'vpcoffering': {u'name': u'createVPCOffering', u'related': [u'listVPCOfferings'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the vpc offering'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the vpc offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the vpc offering'}], u'requiredparams': [u'displaytext', u'supportedservices', u'name'], u'description': u'Creates VPC offering'}, u'network': {u'name': u'createNetwork', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all Isolated networks - Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'subdomainaccess', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Defines whether to allow subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the network IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the network'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the network'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the network IP range. If not specified, will be defaulted to startIP'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the network'}, {u'name': u'networkofferingid', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the network offering id'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'networkofferingid'], u'description': u'Creates a network'}, u'zone': {u'name': u'createZone', u'related': [u'listZones'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public zones'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone'}, {u'name': u'internaldns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}, {u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is security group enabled, false otherwise'}, {u'name': u'networktype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'network type of the zone, can be Basic or Advanced'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Zone for allocation of new resources'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}], u'requiredparams': [u'name', u'internaldns1', u'networktype', u'dns1'], u'description': u'Creates a Zone.'}, u'remoteaccessvpn': {u'name': u'createRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the VPN. Must be used with domainId.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the VPN. If the account parameter is used, domainId must also be used.'}, {u'name': u'iprange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Creates a l2tp/ipsec remote access vpn'}, u'instancegroup': {u'name': u'createInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the instance group. The account parameter must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The project of the instance group'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the instance group'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the instance group'}], u'requiredparams': [u'name'], u'description': u'Creates a vm group'}, u'autoscalepolicy': {u'name': u'createAutoScalePolicy', u'related': [u'updateAutoScalePolicy'], u'isasync': True, u'params': [{u'name': u'action', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}, {u'name': u'duration', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}], u'requiredparams': [u'action', u'conditionids', u'duration'], u'description': u'Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.'}, u'tags': {u'name': u'createTags', u'related': [], u'isasync': True, u'params': [{u'name': u'tags', u'required': True, u'related': [], u'length': 255, u'type': u'map', u'description': u'Map of tags (key/value pairs)'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the resource'}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally"}, {u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of resources to create the tags for'}], u'requiredparams': [u'tags', u'resourcetype', u'resourceids'], u'description': u'Creates resource tag(s)'}, u'serviceoffering': {u'name': u'createServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the service offering. Values are local and shared.'}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'cpunumber', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU number of the service offering'}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "domainrouter", "consoleproxy" and "secondarystoragevm".'}, {u'name': u'limitcpuuse', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'restrict the CPU usage to committed service offering'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host tag for this service offering.'}, {u'name': u'offerha', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the HA for the service offering'}, {u'name': u'memory', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the total memory of the service offering in MB'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'cpuspeed', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU speed of the service offering in MHz.'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having "domainrouter" systemvmtype'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for this service offering.'}], u'requiredparams': [u'name', u'cpunumber', u'memory', u'cpuspeed', u'displaytext'], u'description': u'Creates a service offering.'}, u'condition': {u'name': u'createCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'threshold', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'Threshold value.'}, {u'name': u'counterid', u'required': True, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'relationaloperator', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Relational Operator to be used with threshold.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the condition. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of the account.'}], u'requiredparams': [u'threshold', u'counterid', u'relationaloperator'], u'description': u'Creates a condition'}, u'storagepool': {u'name': u'createStoragePool', u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'clusterid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the storage pool'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for the storage pool'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of the storage pool'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the storage pool'}], u'requiredparams': [u'clusterid', u'zoneid', u'name', u'podid', u'url'], u'description': u'Creates a storage pool.'}, u'vpngateway': {u'name': u'createVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vpcid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn gateway'}], u'requiredparams': [u'vpcid'], u'description': u'Creates site to site vpn local gateway'}, u'autoscalevmgroup': {u'name': u'createAutoScaleVmGroup', u'related': [u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'vmprofileid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the autoscale profile that contains information about the vms in the vm group.'}, {u'name': u'scaledownpolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'scaleuppolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.'}, {u'name': u'lbruleid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'vmprofileid', u'scaledownpolicyids', u'scaleuppolicyids', u'minmembers', u'maxmembers', u'lbruleid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}, u'networkacl': {u'name': u'createNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of ACL'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to allow traffic from/to'}, {u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the ACL will be created for'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of ACL'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a ACL rule the given network (the network has to belong to VPC)'}, u'template': {u'name': u'createTemplate', u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bit'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a public template, false otherwise'}, {u'name': u'volumeid', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template requires HVM, false otherwise'}], u'requiredparams': [u'ostypeid', u'displaytext', u'name'], u'description': u'Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.'}, u'privategateway': {u'name': u'createPrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vlan', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the Vlan for the private gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the Private gateway'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Private gateway'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'vpcid', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address of the Private gateaway'}], u'requiredparams': [u'vlan', u'gateway', u'netmask', u'vpcid', u'ipaddress'], u'description': u'Creates a private gateway'}, u'volumeonfiler': {u'name': u'createVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}, {u'name': u'snapshotpolicy', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'snapshot policy.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password.'}, {u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'volume size.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'user name.'}, {u'name': u'snapshotreservation', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'snapshot reservation.'}], u'requiredparams': [u'volumename', u'aggregatename', u'poolname', u'ipaddress', u'password', u'size', u'username'], u'description': u'Create a volume'}, u'staticroute': {u'name': u'createStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'gatewayid', u'required': True, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'the gateway id we are creating static route for'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'static route cidr'}], u'requiredparams': [u'gatewayid', u'cidr'], u'description': u'Creates a static route'}, u'volume': {u'name': u'createVolume', u'related': [u'detachVolume', u'uploadVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'the project associated with the volume. Mutually exclusive with account parameter'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the disk volume. Must be used with the domainId parameter.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Arbitrary volume size'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.'}], u'requiredparams': [u'name'], u'description': u'Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.'}, u'user': {u'name': u'createUser', u'related': [u'lockUser', u'listUsers'], u'isasync': False, u'params': [{u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain. Has to be accompanied with the account parameter'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}], u'requiredparams': [u'account', u'username', u'email', u'lastname', u'password', u'firstname'], u'description': u'Creates a user for an account that already exists'}, u'vpc': {u'name': u'createVPC', u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}, {u'name': u'vpcofferingid', u'required': True, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'VPC network domain. All networks inside the VPC will belong to this domain'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u"the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the VPC. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the VPC. If used with the account parameter returns the VPC associated with the account for the specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'create VPC for the project'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'vpcofferingid', u'cidr'], u'description': u'Creates a VPC'}, u'storagenetworkiprange': {u'name': u'createStorageNetworkIpRange', u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'isasync': True, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. The vlan the ip range sits on, default to Null when it is not specified which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'UUID of pod where the ip range belongs to'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for storage network'}], u'requiredparams': [u'startip', u'podid', u'netmask', u'gateway'], u'description': u'Creates a Storage network IP range.'}, u'pool': {u'name': u'createPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'name'], u'description': u'Create a pool'}, u'autoscalevmprofile': {u'name': u'createAutoScaleVmProfile', u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the auto deployed virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering of the auto deployed virtual machine'}, {u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}], u'requiredparams': [u'zoneid', u'serviceofferingid', u'templateid'], u'description': u'Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.'}, u'account': {u'name': u'createAccount', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'getUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'accounttype', u'required': True, u'related': [], u'length': 255, u'type': u'short', u'description': u'Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks"}, {u'name': u'accountid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Account UUID, required for adding account from external provisioning system'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain.'}], u'requiredparams': [u'lastname', u'accounttype', u'username', u'password', u'firstname', u'email'], u'description': u'Creates an account'}, u'firewallrule': {u'name': u'createFirewallRule', u'related': [u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'protocol', u'ipaddressid'], u'description': u'Creates a firewall rule for a given ip address'}, u'networkoffering': {u'name': u'createNetworkOffering', u'related': [u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'serviceproviderlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network'}, {u'name': u'serviceofferingid', u'required': False, u'related': [u'updateHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID used by virtual router provider'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the network offering'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed'}, {u'name': u'ispersistent', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports persistent networks; defaulted to false if not specified'}, {u'name': u'servicecapabilitylist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'desired service capabilities as part of network offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the tags for the network offering.'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'conservemode', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the network offering is IP conserve mode enabled'}, {u'name': u'guestiptype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest type of the network offering: Shared or Isolated'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the network offering. Supported type in current release is GUEST only'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports vlans'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Optional'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to false if not specified'}], u'requiredparams': [u'supportedservices', u'name', u'displaytext', u'guestiptype', u'traffictype'], u'description': u'Creates a network offering.'}, u'vlaniprange': {u'name': u'createVlanIpRange', u'related': [u'listVlanIpRanges'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a VLAN'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. If not specified, will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Have to be specified for Direct Untagged vlan only.'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the VLAN IP range'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the VLAN IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the VLAN IP range'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the VLAN IP range'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the physical network id'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}], u'requiredparams': [], u'description': u'Creates a VLAN IP range.'}, u'counter': {u'name': u'createCounter', u'related': [u'listCounters'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'source', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'value', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Value of the counter e.g. oid in case of snmp.'}], u'requiredparams': [u'name', u'source', u'value'], u'description': u'Adds metric counter'}, u'lunonfiler': {u'name': u'createLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'LUN size.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'size', u'name'], u'description': u'Create a LUN from a pool'}, u'project': {u'name': u'createProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will be Admin for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the project'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a project'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}], u'requiredparams': [u'name', u'displaytext'], u'description': u'Creates a project'}, u'physicalnetwork': {u'name': u'createPhysicalNetwork', u'related': [u'listPhysicalNetworks'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the physical network'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a physical network'}, {u'name': u'broadcastdomainrange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic'}, {u'name': u'isolationmethods', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the isolation method for the physical network[VLAN/L3/GRE]'}], u'requiredparams': [u'name', u'zoneid'], u'description': u'Creates a physical network'}, u'snapshot': {u'name': u'createSnapshot', u'related': [u'listSnapshots'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The account of the snapshot. The account parameter must be used with the domainId parameter.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}, {u'name': u'policyid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'policy id of the snapshot, if this is null, then use MANUAL_POLICY.'}], u'requiredparams': [u'volumeid'], u'description': u'Creates an instant snapshot of a volume.'}, u'virtualrouterelement': {u'name': u'createVirtualRouterElement', u'related': [], u'isasync': True, u'params': [{u'name': u'nspid', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the network service provider ID of the virtual router element'}], u'requiredparams': [u'nspid'], u'description': u'Create a virtual router element.'}, u'egressfirewallrule': {u'name': u'createEgressFirewallRule', u'related': [u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a egress firewall rule for a given network '}, u'sshkeypair': {u'name': u'createSSHKeyPair', u'related': [u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'name'], u'description': u'Create a new keypair and returns the private key'}}, u'deploy': {u'virtualmachine': {u'name': u'deployVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'keypair', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor on which to deploy the virtual machine'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering for the virtual machine'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ip address for default vm's network"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the virtual machine. Must be used with domainId.'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}, {u'name': u'iptonetworklist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u"ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid"}, {u'name': u'ip6address', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ipv6 address for default vm's network"}, {u'name': u'keyboard', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u"list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter"}, {u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional user generated name for the virtual machine'}, {u'name': u'securitygroupnames', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter'}, {u'name': u'templateid', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template for the virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the virtual machine'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional group for the virtual machine'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'host name for the virtual machine'}, {u'name': u'startvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to true if not specified'}], u'requiredparams': [u'serviceofferingid', u'templateid', u'zoneid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}}, u'restart': {u'network': {u'name': u'restartNetwork', u'related': [u'associateIpAddress'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The id of the network to restart.'}, {u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If cleanup old network elements'}], u'requiredparams': [u'id'], u'description': u'Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules'}, u'vpc': {u'name': u'restartVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}], u'requiredparams': [], u'description': u'Restarts a VPC'}}, u'reboot': {u'systemvm': {u'name': u'rebootSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a system VM.'}, u'router': {u'name': u'rebootRouter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'rebootVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a virtual machine.'}}, u'mark': {u'defaultzoneforaccount': {u'name': u'markDefaultZoneForAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': True, u'related': [u'markDefaultZoneForAccount'], u'length': 255, u'type': u'string', u'description': u'Name of the account that is to be marked.'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Marks the account that belongs to the specified domain.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The Zone ID with which the account is to be marked.'}], u'requiredparams': [u'account', u'domainid', u'zoneid'], u'description': u'Marks a default zone for this account'}}, u'start': {u'systemvm': {u'name': u'startSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Starts a system virtual machine.'}, u'router': {u'name': u'startRouter', u'related': [u'destroyRouter', u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'startVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}], u'requiredparams': [u'id'], u'description': u'Starts a virtual machine.'}}, u'add': {u'trafficmonitor': {u'name': u'addTrafficMonitor', u'related': [u'listTrafficMonitors'], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the traffic monitor Host'}, {u'name': u'includezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will be metered'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'excludezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will not be metered'}], u'requiredparams': [u'url', u'zoneid'], u'description': u'Adds Traffic Monitor Host for Direct Network Usage'}, u'secondarystorage': {u'name': u'addSecondaryStorage', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the secondary storage'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for the secondary storage'}], u'requiredparams': [u'url'], u'description': u'Adds secondary storage.'}, u'nictovirtualmachine': {u'name': u'addNicToVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'Network ID'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'IP Address for the new network'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'networkid', u'virtualmachineid'], u'description': u'Adds VM to specified network by creating a NIC'}, u'netscalerloadbalancer': {u'name': u'addNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the netscaler load balancer appliance.'}], u'requiredparams': [u'password', u'physicalnetworkid', u'username', u'networkdevicetype', u'url'], u'description': u'Adds a netscaler load balancer device'}, u'cluster': {u'name': u'addCluster', u'related': [u'listClusters', u'updateCluster'], u'isasync': False, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'vsmpassword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the VSM associated with this cluster'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'vsmipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ipaddress of the VSM associated with this cluster'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator'}, {u'name': u'vsmusername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the VSM associated with this cluster'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the cluster'}, {u'name': u'clustertype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the cluster: CloudManaged, ExternalManaged'}, {u'name': u'clustername', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the cluster'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}], u'requiredparams': [u'podid', u'hypervisor', u'clustertype', u'clustername', u'zoneid'], u'description': u'Adds a new cluster'}, u's3': {u'name': u'addS3', u'related': [], u'isasync': False, u'params': [{u'name': u'connectiontimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'connection timeout (milliseconds)'}, {u'name': u'accesskey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 access key'}, {u'name': u'bucket', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the template storage bucket'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 host name'}, {u'name': u'secretkey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 secret key'}, {u'name': u'sockettimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'socket timeout (milliseconds)'}, {u'name': u'maxerrorretry', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of times to retry on error'}, {u'name': u'usehttps', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'connect to the S3 endpoint via HTTPS?'}], u'requiredparams': [u'accesskey', u'bucket', u'secretkey'], u'description': u'Adds S3'}, u'accounttoproject': {u'name': u'addAccountToProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be added to the project'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email to which invitation to the project is going to be sent'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to add the account to'}], u'requiredparams': [u'projectid'], u'description': u'Adds acoount to a project'}, u'region': {u'name': u'addRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the region'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of the Region'}, {u'name': u'endpoint', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Region service endpoint'}], u'requiredparams': [u'name', u'id', u'endpoint'], u'description': u'Adds a Region'}, u'externalloadbalancer': {u'name': u'addExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external load balancer appliance.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external load balancer appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external load balancer appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external load balancer appliance.'}], u'requiredparams': [u'username', u'url', u'password', u'zoneid'], u'description': u'Adds F5 external load balancer appliance.'}, u'vpnuser': {u'name': u'addVpnUser', u'related': [u'listVpnUsers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password for the username'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'add vpn user to the specific project'}], u'requiredparams': [u'password', u'username'], u'description': u'Adds vpn users'}, u'baremetalhost': {u'name': u'addBaremetalHost', u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address intentionally allocated to this host after provisioning'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}], u'requiredparams': [u'url', u'username', u'zoneid', u'hypervisor', u'podid', u'password'], u'description': u'add a baremetal host'}, u'traffictype': {u'name': u'addTrafficType', u'related': [u'updateTrafficType'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The VLAN id to be used for Management traffic by VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the trafficType to be added to the physical network'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}], u'requiredparams': [u'traffictype', u'physicalnetworkid'], u'description': u'Adds traffic type to a physical network'}, u'niciranvpdevice': {u'name': u'addNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the Nicira NVP Controller.'}, {u'name': u'l3gatewayserviceuuid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The L3 Gateway Service UUID configured on the Nicira Controller'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}, {u'name': u'transportzoneuuid', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The Transportzone UUID configured on the Nicira Controller'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}], u'requiredparams': [u'physicalnetworkid', u'hostname', u'username', u'transportzoneuuid', u'password'], u'description': u'Adds a Nicira NVP device'}, u'host': {u'name': u'addHost', u'related': [u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}], u'requiredparams': [u'username', u'podid', u'zoneid', u'url', u'password', u'hypervisor'], u'description': u'Adds a new host.'}, u'f5loadbalancer': {u'name': u'addF5LoadBalancer', u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only F5BigIpLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the F5 load balancer appliance.'}], u'requiredparams': [u'password', u'username', u'physicalnetworkid', u'networkdevicetype', u'url'], u'description': u'Adds a F5 BigIP load balancer device'}, u'networkdevice': {u'name': u'addNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}], u'requiredparams': [], u'description': u'Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer'}, u'bigswitchvnsdevice': {u'name': u'addBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the BigSwitch VNS Controller.'}], u'requiredparams': [u'physicalnetworkid', u'hostname'], u'description': u'Adds a BigSwitch VNS device'}, u'srxfirewall': {u'name': u'addSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only JuniperSRXFirewall'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the SRX appliance.'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [u'password', u'networkdevicetype', u'username', u'url', u'physicalnetworkid'], u'description': u'Adds a SRX firewall device'}, u'swift': {u'name': u'addSwift', u'related': [u'listSwifts', u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account for swift'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for swift'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for swift'}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u' key for the user for swift'}], u'requiredparams': [u'url'], u'description': u'Adds Swift.'}, u'externalfirewall': {u'name': u'addExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external firewall appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external firewall appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external firewall appliance.'}], u'requiredparams': [u'url', u'password', u'zoneid', u'username'], u'description': u'Adds an external firewall appliance'}, u'networkserviceprovider': {u'name': u'addNetworkServiceProvider', u'related': [u'updateNetworkServiceProvider'], u'isasync': True, u'params': [{u'name': u'destinationphysicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the destination Physical Network ID to bridge to'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the physical network service provider'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID to add the provider to'}], u'requiredparams': [u'name', u'physicalnetworkid'], u'description': u'Adds a network serviceProvider to a physical network'}}, u'verbs': [u'authorize', u'restore', u'suspend', u'revoke', u'disassociate', u'migrate', u'lock', u'dissociate', u'activate', u'reconnect', u'cancel', u'query', u'recover', u'extract', u'detach', u'prepare', u'start', u'create', u'associate', u'reboot', u'mark', u'attach', u'add', u'change', u'deploy', u'ldap', u'destroy', u'enable', u'configure', u'get', u'modify', u'stop', u'update', u'disable', u'resize', u'copy', u'generate', u'restart', u'reset', u'register', u'list', u'upload', u'remove', u'assign', u'delete'], u'resize': {u'volume': {u'name': u'resizeVolume', u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'new disk offering id'}, {u'name': u'id', u'required': False, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'shrinkok', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Verify OK to Shrink'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'New volume size in G'}], u'requiredparams': [], u'description': u'Resizes a volume'}}, u'ldap': {u'config': {u'name': u'ldapConfig', u'related': [u'ldapRemove'], u'isasync': False, u'params': [{u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname or ip address of the ldap server eg: my.ldap.com'}, {u'name': u'ssl', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Check Use SSL if the external LDAP server is configured for LDAP over SSL.'}, {u'name': u'truststore', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the path to trust certificates store.'}, {u'name': u'queryfilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'You specify a query filter here, which narrows down the users, who can be part of this domain.'}, {u'name': u'searchbase', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.'}, {u'name': u'port', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Specify the LDAP port if required, default is 389.'}, {u'name': u'binddn', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specify the distinguished name of a user with the search permission on the directory.'}, {u'name': u'truststorepass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password for trust store.'}, {u'name': u'bindpass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password.'}], u'requiredparams': [u'hostname', u'queryfilter', u'searchbase'], u'description': u'Configure the LDAP context for this site.'}, u'remove': {u'name': u'ldapRemove', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Remove the LDAP context for this site.'}}, u'destroy': {u'systemvm': {u'name': u'destroySystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'destroySystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroyes a system virtual machine.'}, u'router': {u'name': u'destroyRouter', u'related': [u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Destroys a router.'}, u'volumeonfiler': {u'name': u'destroyVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}], u'requiredparams': [u'volumename', u'ipaddress', u'aggregatename'], u'description': u'Destroy a Volume'}, u'lunonfiler': {u'name': u'destroyLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'path'], u'description': u'Destroy a LUN'}, u'virtualmachine': {u'name': u'destroyVirtualMachine', u'related': [u'listVirtualMachines'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroys a virtual machine. Once destroyed, only the administrator can recover it.'}}, u'get': {u'apilimit': {u'name': u'getApiLimit', u'related': [u'resetApiLimit'], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Get API limit count for the caller'}, u'vmpassword': {u'name': u'getVMPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Returns an encrypted password for the VM'}, u'user': {u'name': u'getUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'userapikey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'API key of the user'}], u'requiredparams': [u'userapikey'], u'description': u'Find user account by API key'}, u'cloudidentifier': {u'name': u'getCloudIdentifier', u'related': [], u'isasync': False, u'params': [{u'name': u'userid', u'required': True, u'related': [u'lockUser', u'listUsers', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the user ID for the cloud identifier'}], u'requiredparams': [u'userid'], u'description': u'Retrieves a cloud identifier.'}}, u'count': 355, u'enable': {u'account': {u'name': u'enableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Enables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'enableAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enables specified account.'}], u'requiredparams': [], u'description': u'Enables an account'}, u'storagemaintenance': {u'name': u'enableStorageMaintenance', u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'Primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Puts storage pool into maintenance state'}, u'cisconexusvsm': {u'name': u'enableCiscoNexusVSM', u'related': [u'disableCiscoNexusVSM'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be enabled'}], u'requiredparams': [u'id'], u'description': u'Enable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'enableStaticNat', u'related': [], u'isasync': False, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being enabled'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for enabling static nat feature'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the static nat will be enabled for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'ipaddressid', u'virtualmachineid'], u'description': u'Enables static nat for given ip address'}, u'user': {u'name': u'enableUser', u'related': [u'lockUser', u'listUsers', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Enables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Enables a user account'}, u'autoscalevmgroup': {u'name': u'enableAutoScaleVmGroup', u'related': [u'createAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Enables an AutoScale Vm Group'}}, u'configure': {u'srxfirewall': {u'name': u'configureSrxFirewall', u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [u'listSrxFirewalls', u'configureSrxFirewall', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}, {u'name': u'fwdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the firewall device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'fwdeviceid'], u'description': u'Configures a SRX firewall device'}, u'f5loadbalancer': {u'name': u'configureF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'F5 load balancer device ID'}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a F5 load balancer device'}, u'netscalerloadbalancer': {u'name': u'configureNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers'], u'isasync': True, u'params': [{u'name': u'podids', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'list', u'description': u"Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device."}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'Netscaler load balancer device ID'}, {u'name': u'inline', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall'}, {u'name': u'lbdevicededicated', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a netscaler load balancer device'}, u'virtualrouterelement': {u'name': u'configureVirtualRouterElement', u'related': [u'createVirtualRouterElement'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual router provider'}, {u'name': u'enabled', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Enabled/Disabled the service provider'}], u'requiredparams': [u'id', u'enabled'], u'description': u'Configures a virtual router element.'}}, u'associate': {u'ipaddress': {u'name': u'associateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network this ip address should be associated to.'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the VPC you want the ip address to be associated with'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account to associate with this IP address'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone you want to acquire an public IP address from'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain to associate with this IP address'}], u'requiredparams': [], u'description': u'Acquires and associates a public IP to an account.'}, u'lun': {u'name': u'associateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN to which the LUN associate.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN name.'}], u'requiredparams': [u'iqn', u'name'], u'description': u'Associate a LUN with a guest IQN'}}, u'stop': {u'systemvm': {u'name': u'stopSystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Stops a system VM.'}, u'router': {u'name': u'stopRouter', u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Stops a router.'}, u'virtualmachine': {u'name': u'stopVirtualMachine', u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend). The caller knows the VM is stopped.'}], u'requiredparams': [u'id'], u'description': u'Stops a virtual machine.'}}, u'modify': {u'pool': {u'name': u'modifyPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'poolname'], u'description': u'Modify pool'}}, u'update': {u'loadbalancerrule': {u'name': u'updateLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of the load balancer rule to update'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'algorithm', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}], u'requiredparams': [u'id'], u'description': u'Updates load balancer'}, u'domain': {u'name': u'updateDomain', u'related': [u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the domain's networks; empty string will update domainName with NULL value"}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates domain with this name'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to update'}], u'requiredparams': [u'id'], u'description': u'Updates a domain with a new name'}, u'projectinvitation': {u'name': u'updateProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'accept', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, accept the invitation, decline if false. True by default'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to join'}, {u'name': u'token', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations for specified account; this parameter has to be specified with domainId'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account that is joining the project'}], u'requiredparams': [u'projectid'], u'description': u'Accepts or declines project invitation'}, u'diskoffering': {u'name': u'updateDiskOffering', u'related': [u'createDiskOffering', u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'updates alternate display text of the disk offering with this value'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the disk offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates name of the disk offering with this value'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'virtualmachine': {u'name': u'updateVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'user generated name'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'group of the virtual machine'}, {u'name': u'haenable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if high-availability is enabled for the virtual machine, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents this VM.'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}], u'requiredparams': [u'id'], u'description': u'Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.'}, u'portforwardingrule': {u'name': u'updatePortForwardingRule', u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private port of the port forwarding rule'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the public port of the port forwarding rule'}, {u'name': u'privateip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private IP address of the port forwarding rule'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}], u'requiredparams': [u'privateport', u'publicport', u'ipaddressid', u'protocol'], u'description': u'Updates a port forwarding rule. Only the private port and the virtual machine can be updated.'}, u'cluster': {u'name': u'updateCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}, {u'name': u'id', u'required': True, u'related': [u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Cluster'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}], u'requiredparams': [u'id'], u'description': u'Updates an existing cluster'}, u'hostpassword': {u'name': u'updateHostPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new password for the host/cluster'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host/cluster'}], u'requiredparams': [u'password', u'username'], u'description': u'Update password of a host/pool on management server.'}, u'pod': {u'name': u'updatePod', u'related': [], u'isasync': False, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'id', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Pod'}], u'requiredparams': [u'id'], u'description': u'Updates a Pod.'}, u'isopermissions': {u'name': u'updateIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'projectids', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'Updates iso permissions'}, u'resourcelimit': {u'name': u'updateResourceLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource for a specified account. Must be used with the domainId parameter.'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'max', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u' Maximum resource limit.'}], u'requiredparams': [u'resourcetype'], u'description': u'Updates resource limits for an account or domain.'}, u'vpcoffering': {u'name': u'updateVPCOffering', u'related': [u'listVPCOfferings', u'createVPCOffering'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the VPC offering; supported states - Enabled/Disabled'}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering', u'updateVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC offering'}], u'requiredparams': [], u'description': u'Updates VPC offering'}, u'network': {u'name': u'updateNetwork', u'related': [u'listNetscalerLoadBalancerNetworks'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}, {u'name': u'networkofferingid', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'network offering ID'}, {u'name': u'changecidr', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force update even if cidr type is different'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new name for the network'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new display text for the network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}], u'requiredparams': [u'id'], u'description': u'Updates a network'}, u'zone': {u'name': u'updateZone', u'related': [u'listZones', u'createZone'], u'isasync': False, u'params': [{u'name': u'internaldns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'dnssearchorder', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the dns search order list'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone; empty string will update domain with NULL value'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'updates a private zone to public if set, but not vice-versa'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dhcpprovider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the dhcp Provider for the Zone'}, {u'name': u'dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates a Zone.'}, u'instancegroup': {u'name': u'updateInstanceGroup', u'related': [u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'Instance group ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new instance group name'}], u'requiredparams': [u'id'], u'description': u'Updates a vm group'}, u'autoscalepolicy': {u'name': u'updateAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale policy.'}, u'serviceoffering': {u'name': u'updateServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the service offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering to be updated'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering to be updated'}, {u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering to be updated'}], u'requiredparams': [u'id'], u'description': u'Updates a service offering.'}, u'storagepool': {u'name': u'updateStoragePool', u'related': [u'cancelStorageMaintenance', u'createStoragePool', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the Id of the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma-separated list of tags for the storage pool'}], u'requiredparams': [u'id'], u'description': u'Updates a storage pool.'}, u'hypervisorcapabilities': {u'name': u'updateHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'set true to enable security group for this hypervisor.'}, {u'name': u'maxguestslimit', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the max number of Guest VMs per host for this hypervisor.'}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}], u'requiredparams': [], u'description': u'Updates a hypervisor capabilities.'}, u'template': {u'name': u'updateTemplate', u'related': [u'registerIso', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'ostypeid', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}], u'requiredparams': [u'id'], u'description': u'Updates attributes of a template.'}, u'defaultnicforvirtualmachine': {u'name': u'updateDefaultNicForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Changes the default NIC on a VM'}, u'traffictype': {u'name': u'updateTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}], u'requiredparams': [u'id'], u'description': u'Updates traffic type of a physical network'}, u'host': {u'name': u'updateHost', u'related': [u'listHosts'], u'isasync': False, u'params': [{u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable'}, {u'name': u'oscategoryid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of Os category to update the host with'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'id', u'required': True, u'related': [u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the host to update'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new uri for the secondary storage: nfs://host/path'}], u'requiredparams': [u'id'], u'description': u'Updates a host.'}, u'user': {u'name': u'updateUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'User uuid'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'usersecretkey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The secret key for the user. Must be specified with userApiKey'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username'}, {u'name': u'firstname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'first name'}, {u'name': u'lastname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'last name'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter'}, {u'name': u'userapikey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The API key for the user. Must be specified with userSecretKey'}], u'requiredparams': [u'id'], u'description': u'Updates a user account'}, u'vpc': {u'name': u'updateVPC', u'related': [u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}], u'requiredparams': [], u'description': u'Updates a VPC'}, u'resourcecount': {u'name': u'updateResourceCount', u'related': [], u'isasync': False, u'params': [{u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource count for a specified account. Must be used with the domainId parameter.'}], u'requiredparams': [u'domainid'], u'description': u'Recalculate and update resource count for an account or domain.'}, u'storagenetworkiprange': {u'name': u'updateStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. the vlan the ip range sits on'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'id', u'required': True, u'related': [u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'UUID of storage network ip range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}], u'requiredparams': [u'id'], u'description': u'Update a Storage network IP range, only allowed when no IPs in this range have been allocated.'}, u'configuration': {u'name': u'updateConfiguration', u'related': [u'listConfigurations'], u'isasync': False, u'params': [{u'name': u'value', u'required': False, u'related': [], u'length': 4095, u'type': u'string', u'description': u'the value of the configuration'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the configuration'}], u'requiredparams': [u'name'], u'description': u'Updates a configuration.'}, u'templatepermissions': {u'name': u'updateTemplatePermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'projectids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}], u'requiredparams': [u'id'], u'description': u'Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.'}, u'autoscalevmprofile': {u'name': u'updateAutoScaleVmProfile', u'related': [u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}, {u'name': u'templateid', u'required': False, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm profile.'}, u'account': {u'name': u'updateAccount', u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain where the account exists'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks; empty string will update domainName with NULL value"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the current account name'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'newname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'new name for the account'}], u'requiredparams': [u'newname'], u'description': u'Updates account information for the authenticated user'}, u'networkoffering': {u'name': u'updateNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the network offering, integer'}, {u'name': u'id', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the network offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the network offering'}], u'requiredparams': [], u'description': u'Updates a network offering.'}, u'vpncustomergateway': {u'name': u'updateVpnCustomerGateway', u'related': [u'createVpnCustomerGateway'], u'isasync': True, u'params': [{u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'id', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr of the customer gateway'}], u'requiredparams': [u'id', u'ikepolicy', u'esppolicy', u'gateway', u'ipsecpsk', u'cidrlist'], u'description': u'Update site to site vpn customer gateway'}, u'region': {u'name': u'updateRegion', u'related': [u'addRegion', u'listRegions'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this name'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this end point'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of region to update'}], u'requiredparams': [u'id'], u'description': u'Updates a region'}, u'project': {u'name': u'updateProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new Admin account for the project'}], u'requiredparams': [u'id'], u'description': u'Updates a project'}, u'physicalnetwork': {u'name': u'updatePhysicalNetwork', u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'id', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'physical network id'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled'}], u'requiredparams': [u'id'], u'description': u'Updates a physical network'}, u'iso': {u'name': u'updateIso', u'related': [u'listIsos'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates an ISO file.'}, u'networkserviceprovider': {u'name': u'updateNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled/Shutdown the physical network service provider'}, {u'name': u'id', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'network service provider id'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}], u'requiredparams': [u'id'], u'description': u'Updates a network serviceProvider of a physical network'}, u'autoscalevmgroup': {u'name': u'updateAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'scaledownpolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}, {u'name': u'scaleuppolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm group.'}}, u'disable': {u'account': {u'name': u'disableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'isasync': True, u'params': [{u'name': u'lock', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If true, only lock the account; else disable the account'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Disables specified account.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Disables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'lock'], u'description': u'Disables an account'}, u'autoscalevmgroup': {u'name': u'disableAutoScaleVmGroup', u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Disables an AutoScale Vm Group'}, u'cisconexusvsm': {u'name': u'disableCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u'disable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'disableStaticNat', u'related': [], u'isasync': True, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being disableed'}], u'requiredparams': [u'ipaddressid'], u'description': u'Disables static rule for given ip address'}, u'user': {u'name': u'disableUser', u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Disables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Disables a user account'}}, u'detach': {u'volume': {u'name': u'detachVolume', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the device ID on the virtual machine where volume is detached from'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine where the volume is detached from'}], u'requiredparams': [], u'description': u'Detaches a disk volume from a virtual machine.'}, u'iso': {u'name': u'detachIso', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Detaches any ISO file (if any) currently attached to a virtual machine.'}}, u'generate': {u'usagerecords': {u'name': u'generateUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List events for the specified domain.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed'}}, u'change': {u'serviceforvirtualmachine': {u'name': u'changeServiceForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the virtual machine'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.'}, u'serviceforsystemvm': {u'name': u'changeServiceForSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms'], u'isasync': False, u'params': [{u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the system vm'}, {u'name': u'id', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system vm'}], u'requiredparams': [u'serviceofferingid', u'id'], u'description': u'Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect.'}, u'serviceforrouter': {u'name': u'changeServiceForRouter', u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the router'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the domain router'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Upgrades domain router to a new service offering'}}, u'reset': {u'apilimit': {u'name': u'resetApiLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the acount whose limit to be reset'}], u'requiredparams': [], u'description': u'Reset api count'}, u'sshkeyforvirtualmachine': {u'name': u'resetSSHKeyForVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'keypair', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'keypair', u'id'], u'description': u'Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]'}, u'passwordforvirtualmachine': {u'name': u'resetPasswordForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async]'}, u'vpnconnection': {u'name': u'resetVpnConnection', u'related': [u'listVpnConnections'], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for connection. Must be used with domainId.'}, {u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for connection. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'id'], u'description': u'Reset site to site vpn connection'}}, u'register': {u'userkeys': {u'name': u'registerUserKeys', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'User id'}], u'requiredparams': [u'id'], u'description': u'This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user'}, u'iso': {u'name': u'registerIso', u'related': [u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this ISO'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the ISO'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is bootable. If not passed explicitly its assumed to be true'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Register iso for the project'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to register the ISO to be publicly available to all users, false otherwise.'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone you wish to register the ISO to.'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the iso or its derivatives are extractable; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the ISO. This is usually used for display purposes.'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want this ISO to be featured'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL to where the ISO is currently being hosted'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account name. Must be used with domainId.'}], u'requiredparams': [u'name', u'zoneid', u'displaytext', u'url'], u'description': u'Registers an existing ISO into the CloudStack Cloud.'}, u'sshkeypair': {u'name': u'registerSSHKeyPair', u'related': [u'createSSHKeyPair', u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'publickey', u'required': True, u'related': [], u'length': 5120, u'type': u'string', u'description': u'Public key material of the keypair'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'publickey', u'name'], u'description': u'Register a public key in a keypair under a certain name'}, u'template': {u'name': u'registerTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template or its derivatives are extractable; default is false'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the template is to be hosted on'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this template'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template is available to all accounts; default is true'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'sshkeyenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the sshkey upload feature; default is false'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'Register template for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the template. Possible values include QCOW2, RAW, and VHD.'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template requires HVM'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the template is hosted. Possible URL include http:// and https://'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bits support. 64 by default'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}], u'requiredparams': [u'zoneid', u'displaytext', u'name', u'format', u'ostypeid', u'hypervisor', u'url'], u'description': u'Registers an existing template into the CloudStack cloud. '}}, u'list': {u'instancegroups': {u'name': u'listInstanceGroups', u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listInstanceGroups', u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'list instance groups by ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list instance groups by name'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists vm groups'}, u'physicalnetworks': {u'name': u'listPhysicalNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list physical network by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'search by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists physical networks'}, u'networks': {u'name': u'listNetworks', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is system, false otherwise'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list networks by ACL (access control list) type. Supported values are Account and Domain'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only networks which support specifying ip ranges'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the network'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks by restartRequired'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of the network. Supported values are: Isolated and Shared'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'list networks by physical network id'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list networks supporting certain services'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the traffic'}, {u'name': u'id', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list networks by id'}, {u'name': u'canusefordeploy', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks available for vm deployment'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network belongs to vpc'}], u'requiredparams': [], u'description': u'Lists all available networks.'}, u'capabilities': {u'name': u'listCapabilities', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Lists capabilities'}, u'clusters': {u'name': u'listClusters', u'related': [u'updateCluster'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listClusters', u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by the cluster ID'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by hypervisor type'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by allocation state'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Zone ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by the cluster name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by cluster type'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the clusters'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Pod ID'}], u'requiredparams': [], u'description': u'Lists clusters.'}, u'resourcelimits': {u'name': u'listResourceLimits', u'related': [u'updateResourceLimit'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lists resource limits by ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists resource limits.'}, u'firewallrules': {u'name': u'listFirewallRules', u'related': [u'createEgressFirewallRule', u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddressid', u'required': False, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all firewall rules for an IP address.'}, u'supportednetworkservices': {u'name': u'listSupportedNetworkServices', u'related': [], u'isasync': False, u'params': [{u'name': u'service', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service name to list providers and capabilities of'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'provider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service provider name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all network services provided by CloudStack or for the given Provider.'}, u'loadbalancerrules': {u'name': u'listLoadBalancerRules', u'related': [u'createLoadBalancerRule', u'updateLoadBalancerRule'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine of the load balancer rule'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'publicipid', u'required': False, u'related': [u'restartNetwork', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the load balancer rule '}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists load balancer rules.'}, u'autoscalepolicies': {u'name': u'listAutoScalePolicies', u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'isasync': False, u'params': [{u'name': u'action', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'id', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'vmgroupid', u'required': False, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'conditionid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists autoscale policies.'}, u'niciranvpdevices': {u'name': u'listNiciraNvpDevices', u'related': [u'addNiciraNvpDevice'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': False, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists Nicira NVP devices'}, u'f5loadbalancernetworks': {u'name': u'listF5LoadBalancerNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer', u'addF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a F5 load balancer device'}, u'templatepermissions': {u'name': u'listTemplatePermissions', u'related': [u'listIsoPermissions'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions', u'listTemplatePermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List template visibility and all accounts that have permissions to view this template.'}, u'projects': {u'name': u'listProjects', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List projects by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list projects by project ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by display text'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'systemvms': {u'name': u'listSystemVms', u'related': [u'rebootSystemVm'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the system VM'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the system VM'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the system VM'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy" and "secondarystoragevm".'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the system VM'}, {u'name': u'id', u'required': False, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the system VM'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the system VM'}], u'requiredparams': [], u'description': u'List system virtual machines.'}, u'portforwardingrules': {u'name': u'listPortForwardingRules', u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the port forwarding services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all port forwarding rules for an IP address.'}, u'hypervisors': {u'name': u'listHypervisors', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the zone id for listing hypervisors.'}], u'requiredparams': [], u'description': u'List hypervisors'}, u'publicipaddresses': {u'name': u'listPublicIpAddresses', u'related': [u'restartNetwork', u'associateIpAddress'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by Zone ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'allocatedonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'limits search results to allocated public IP addresses'}, {u'name': u'id', u'required': False, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'lists ip address by id'}, {u'name': u'forloadbalancing', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only ips used for load balancing'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isstaticnat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only static nat ip addresses'}, {u'name': u'issourcenat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only source nat ip addresses'}, {u'name': u'vlanid', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by VLAN ID'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists the specified IP address'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by physical network id'}, {u'name': u'associatednetworkid', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses associated to the network specified'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the virtual network for the IP address'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List ips belonging to the VPC'}], u'requiredparams': [], u'description': u'Lists all public ip addresses'}, u'vpngateways': {u'name': u'listVpnGateways', u'related': [u'createVpnGateway'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists site 2 site vpn gateways'}, u'loadbalancerruleinstances': {u'name': u'listLoadBalancerRuleInstances', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'applied', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if listing all virtual machines currently applied to the load balancer rule; default is true'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'List all virtual machine instances that are assigned to a load balancer rule.'}, u'hosts': {u'name': u'listHosts', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the host'}, {u'name': u'resourcestate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the host'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'virtualmachineid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts existing in particular cluster'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host type'}, {u'name': u'id', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the id of the host'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]'}, {u'name': u'hahost', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only hosts dedicated to HA'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists hosts.'}, u'pools': {u'name': u'listPools', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Pool'}, u'counters': {u'name': u'listCounters', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'source', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listCounters'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the counters'}, u'configurations': {u'name': u'listConfigurations', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configuration by name'}, {u'name': u'category', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configurations by category'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all configurations.'}, u'usagerecords': {u'name': u'listUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List usage records for the specified usage type'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for specified project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List usage records for the specified user.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified domain.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accountid', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified account'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Lists usage records for accounts'}, u'storagepools': {u'name': u'listStoragePools', u'related': [u'cancelStorageMaintenance'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'path', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage pool path'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list storage pools belongig to the specific cluster'}, {u'name': u'id', u'required': False, u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the storage pool'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address for the storage pool'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the storage pool'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists storage pools.'}, u'vpncustomergateways': {u'name': u'listVpnCustomerGateways', u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists site to site vpn customer gateways'}, u'zones': {u'name': u'listZones', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'available', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the zone'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the zone'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the zones'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists zones'}, u'serviceofferings': {u'name': u'listServiceOfferings', u'related': [u'updateHypervisorCapabilities'], u'isasync': False, u'params': [{u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy", "secondarystoragevm" or "domainrouter".'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the service offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the service offering'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'id', u'required': False, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the service offering'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available service offerings.'}, u'externalfirewalls': {u'name': u'listExternalFirewalls', u'related': [u'addExternalFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'zoneid'], u'description': u'List external firewall appliances.'}, u'networkserviceproviders': {u'name': u'listNetworkServiceProviders', u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by state'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by name'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists network serviceproviders for a given physical network.'}, u'capacity': {u'name': u'listCapacity', u'related': [], u'isasync': False, u'params': [{u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'lists capacity by type* CAPACITY_TYPE_MEMORY = 0* CAPACITY_TYPE_CPU = 1* CAPACITY_TYPE_STORAGE = 2* CAPACITY_TYPE_STORAGE_ALLOCATED = 3* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4* CAPACITY_TYPE_PRIVATE_IP = 5* CAPACITY_TYPE_SECONDARY_STORAGE = 6* CAPACITY_TYPE_VLAN = 7* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8* CAPACITY_TYPE_LOCAL_STORAGE = 9.'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Cluster ID'}, {u'name': u'sortby', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Sort the results. Available values: Usage'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fetchlatest', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'recalculate capacities and fetch the latest'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Zone ID'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Pod ID'}], u'requiredparams': [], u'description': u'Lists all the system wide capacities.'}, u'diskofferings': {u'name': u'listDiskOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain of the disk offering.'}], u'requiredparams': [], u'description': u'Lists all available disk offerings.'}, u'lbstickinesspolicies': {u'name': u'listLBStickinessPolicies', u'related': [u'createLBStickinessPolicy'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbruleid', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'lbruleid'], u'description': u'Lists LBStickiness policies.'}, u'srxfirewallnetworks': {u'name': u'listSrxFirewallNetworks', u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using SRX firewall device'}, u'securitygroups': {u'name': u'listSecurityGroups', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'list the security group by the id provided'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists security groups by name'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'lists security groups by virtual machine id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists security groups'}, u'conditions': {u'name': u'listConditions', u'related': [u'listCounters', u'createCounter'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the Condition.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'counterid', u'required': False, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'Counter-id of the condition.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List Conditions for the specific user'}, u'swifts': {u'name': u'listSwifts', u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the id of the swift'}], u'requiredparams': [], u'description': u'List Swift.'}, u'hypervisorcapabilities': {u'name': u'listHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all hypervisor capabilities.'}, u'tags': {u'name': u'listTags', u'related': [], u'isasync': False, u'params': [{u'name': u'resourceid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource type'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by key'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by customer name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'value', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by value'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'List resource tag(s)'}, u'routers': {u'name': u'listRouters', u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the router'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the router'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the router'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the router'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the router'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk router'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true is passed for this parameter, list only VPC routers'}], u'requiredparams': [], u'description': u'List routers.'}, u'traffictypes': {u'name': u'listTrafficTypes', u'related': [u'addNetworkServiceProvider', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'physicalnetworkid'], u'description': u'Lists traffic types of a given physical network.'}, u'projectinvitations': {u'name': u'listProjectInvitations', u'related': [], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'activeonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only active invitations - having Pending state and ones that are not timed out yet'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by project id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations by state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'list invitations by id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'isos': {u'name': u'listIsos', u'related': [], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is bootable, false otherwise'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list all isos by name'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list ISO by id'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is publicly available to all users, false otherwise.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isofilter', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isready', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is ready to be deployed'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available ISO files.'}, u'users': {u'name': u'listUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List user by the username'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.'}, {u'name': u'id', u'required': False, u'related': [u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'List user by ID.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List users by state of the user account.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists user accounts'}, u'sshkeypairs': {u'name': u'listSSHKeyPairs', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'fingerprint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A public key fingerprint to look for'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A key pair name to look for'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}], u'requiredparams': [], u'description': u'List registered keypairs'}, u'privategateways': {u'name': u'listPrivateGateways', u'related': [u'createPrivateGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'list private gateway by id'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by ip address'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list gateways by vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by state'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by vlan'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List private gateways'}, u'usagetypes': {u'name': u'listUsageTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Usage Types'}, u'domainchildren': {u'name': u'listDomainChildren', u'related': [u'createDomain'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list children domains by name'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list children domain by parent domain ID.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'to return the entire tree, use the value "true". To return the first level children, use the value "false".'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all children domains belonging to a specified domain'}, u'domains': {u'name': u'listDomains', u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List domain by domain ID.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List domain by domain name.'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List domains by domain level.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'Lists domains and provides detailed information for listed domains'}, u'externalloadbalancers': {u'name': u'listExternalLoadBalancers', u'related': [u'addHost', u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists F5 external load balancer appliances added in a zone.'}, u'netscalerloadbalancers': {u'name': u'listNetscalerLoadBalancers', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'lists netscaler load balancer devices'}, u's3s': {u'name': u'listS3s', u'related': [u'addS3'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists S3s'}, u'bigswitchvnsdevices': {u'name': u'listBigSwitchVnsDevices', u'related': [u'addBigSwitchVnsDevice'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vnsdeviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'bigswitch vns device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [], u'description': u'Lists BigSwitch Vns devices'}, u'accounts': {u'name': u'listAccounts', u'related': [u'markDefaultZoneForAccount', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts by state. Valid states are enabled, disabled, and locked.'}, {u'name': u'iscleanuprequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list accounts by cleanuprequred attribute (values are true or false)'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'list account by account ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list account by account name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists accounts and provides detailed account information for listed accounts'}, u'networkdevice': {u'name': u'listNetworkDevice', u'related': [u'addNetworkDevice'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List network devices'}, u'vlanipranges': {u'name': u'listVlanIpRanges', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'network id of the VLAN IP range'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.'}, {u'name': u'id', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VLAN IP range'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'physical network id of the VLAN IP range'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account with which the VLAN IP range is associated. Must be used with the domainId parameter.'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. Default is an "untagged" VLAN.'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the VLAN IP range'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}], u'requiredparams': [], u'description': u'Lists all VLAN IP ranges.'}, u'traffictypeimplementors': {u'name': u'listTrafficTypeImplementors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists implementors of implementor of a network traffic type or implementors of all network traffic types'}, u'storagenetworkiprange': {u'name': u'listStorageNetworkIpRange', u'related': [u'updateStorageNetworkIpRange'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.'}], u'requiredparams': [], u'description': u'List a storage network IP range.'}, u'isopermissions': {u'name': u'listIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List iso visibility and all accounts that have permissions to view this iso.'}, u'snapshotpolicies': {u'name': u'listSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'volumeid'], u'description': u'Lists snapshot policies.'}, u'autoscalevmgroups': {u'name': u'listAutoScaleVmGroups', u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': False, u'params': [{u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'vmprofileid', u'required': False, u'related': [u'updateAutoScaleVmProfile', u'createAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the profile'}, {u'name': u'lbruleid', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the loadbalancer'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists autoscale vm groups.'}, u'projectaccounts': {u'name': u'listProjectAccounts', u'related': [u'createProject'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'id of the project'}, {u'name': u'role', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by role'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by account name'}], u'requiredparams': [u'projectid'], u'description': u"Lists project's accounts"}, u'autoscalevmprofiles': {u'name': u'listAutoScaleVmProfiles', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'templateid', u'required': False, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the templateid of the autoscale vm profile'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the otherdeployparameters of the autoscale vm profile'}], u'requiredparams': [], u'description': u'Lists autoscale vm profiles.'}, u'apis': {u'name': u'listApis', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'API name'}], u'requiredparams': [], u'description': u'lists all available apis on the server, provided by the Api Discovery plugin'}, u'vpcs': {u'name': u'listVPCs', u'related': [u'restartVPC'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by name of the VPC'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list VPCs by restartRequired option'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPCs by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'list VPC by id'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by zone'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC supporting certain services'}, {u'name': u'vpcofferingid', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'list by ID of the VPC offering'}], u'requiredparams': [], u'description': u'Lists VPCs'}, u'f5loadbalancers': {u'name': u'listF5LoadBalancers', u'related': [u'configureF5LoadBalancer'], u'isasync': False, u'params': [{u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'lists F5 load balancer devices'}, u'snapshots': {u'name': u'listSnapshots', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'lists snapshot by snapshot ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'intervaltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists snapshot by snapshot name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'snapshottype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are MANUAL or RECURRING.'}], u'requiredparams': [], u'description': u'Lists all available snapshots for the account.'}, u'networkofferings': {u'name': u'listNetworkOfferings', u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default network offerings. Default value is false'}, {u'name': u'sourcenatsupported', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only netwok offerings where source nat is supported, false otherwise'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list network offerings supporting certain services'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only network offerings which support specifying ip ranges'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by name'}, {u'name': u'id', u'required': False, u'related': [u'listNetworkOfferings', u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'list network offerings by id'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the tags for the network offering.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list netowrk offerings available for network creation in specific zone'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network offering can be used only for network creation inside the VPC'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by traffic type'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'guestiptype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by guest type: Shared or Isolated'}, {u'name': u'istagged', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if offering has tags specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'list network offerings by tags'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by display text'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by state'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required'}], u'requiredparams': [], u'description': u'Lists all available network offerings.'}, u'virtualmachines': {u'name': u'listVirtualMachines', u'related': [], u'isasync': False, u'params': [{u'name': u'templateid', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list vms by template'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'storageid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'isoid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list vms by iso'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'list vms by vpc'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the pod ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the virtual machine'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'groupid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the group ID'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'hostid', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'id', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list by network type; true if need to list vms using Virtual Network, false otherwise'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'state of the virtual machine'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the virtual machines owned by the account.'}, u'netscalerloadbalancernetworks': {u'name': u'listNetscalerLoadBalancerNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a netscaler load balancer device'}, u'oscategories': {u'name': u'listOsCategories', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list Os category by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os category by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all supported OS categories for this cloud.'}, u'virtualrouterelements': {u'name': u'listVirtualRouterElements', u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'nspid', u'required': False, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by network service provider id'}, {u'name': u'id', u'required': False, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement', u'listVirtualRouterElements'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'enabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list network offerings by enabled state'}], u'requiredparams': [], u'description': u'Lists all available virtual router elements.'}, u'lunsonfiler': {u'name': u'listLunsOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List LUN'}, u'asyncjobs': {u'name': u'listAsyncJobs', u'related': [u'queryAsyncJobResult'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'tzdate', u'description': u'the start date of the async job'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all pending asynchronous jobs for the account.'}, u'ostypes': {u'name': u'listOsTypes', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'list by Os type Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'oscategoryid', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list by Os Category id'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os by description'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all supported OS types for this cloud.'}, u'networkacls': {u'name': u'listNetworkACLs', u'related': [u'createNetworkACL'], u'isasync': False, u'params': [{u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network ACLs by traffic type - Ingress or Egress'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists network ACL with the specified ID.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list network ACLs by network Id'}], u'requiredparams': [], u'description': u'Lists all network ACLs'}, u'volumesonfiler': {u'name': u'listVolumesOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List Volumes'}, u'eventtypes': {u'name': u'listEventTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Event Types'}, u'remoteaccessvpns': {u'name': u'listRemoteAccessVpns', u'related': [u'createRemoteAccessVpn'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'publicipid', u'required': True, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [u'publicipid'], u'description': u'Lists remote access vpns'}, u'alerts': {u'name': u'listAlerts', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by alert type'}, {u'name': u'id', u'required': False, u'related': [u'listAlerts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the alert'}], u'requiredparams': [], u'description': u'Lists all alerts.'}, u'regions': {u'name': u'listRegions', u'related': [u'addRegion'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List Region by region ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List Region by region name.'}], u'requiredparams': [], u'description': u'Lists Regions'}, u'vpcofferings': {u'name': u'listVPCOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings'], u'length': 255, u'type': u'uuid', u'description': u'list VPC offerings by id'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by state'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC offerings supporting certain services'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by display text'}, {u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default VPC offerings. Default value is false'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists VPC offerings'}, u'niciranvpdevicenetworks': {u'name': u'listNiciraNvpDeviceNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'nvpdeviceid'], u'description': u'lists network that are using a nicira nvp device'}, u'events': {u'name': u'listEvents', u'related': [], u'isasync': False, u'params': [{u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the start date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'enddate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the end date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration of the event'}, {u'name': u'id', u'required': False, u'related': [u'listEvents'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the event'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event level (INFO, WARN, ERROR)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'entrytime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time the event was entered'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event type (see event types)'}], u'requiredparams': [], u'description': u'A command to list events.'}, u'templates': {u'name': u'listTemplates', u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'templatefilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the template name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list templates by zoneId'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [u'templatefilter'], u'description': u'List all public, private, and privileged templates.'}, u'cisconexusvsms': {u'name': u'listCiscoNexusVSMs', u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}], u'requiredparams': [], u'description': u'Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster'}, u'ipforwardingrules': {u'name': u'listIpForwardingRules', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Lists all rules applied to the specified Vm.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list the rule belonging to this public ip address'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'List the ip forwarding rules'}, u'srxfirewalls': {u'name': u'listSrxFirewalls', u'related': [u'addSrxFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fwdeviceid', u'required': False, u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}], u'requiredparams': [], u'description': u'lists SRX firewall devices in a physical network'}, u'vpnconnections': {u'name': u'listVpnConnections', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'listVpnConnections'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn connection'}], u'requiredparams': [], u'description': u'Lists site to site vpn connection gateways'}, u'trafficmonitors': {u'name': u'listTrafficMonitors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}], u'requiredparams': [u'zoneid'], u'description': u'List traffic monitor Hosts.'}, u'vpnusers': {u'name': u'listVpnUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVpnUsers'], u'length': 255, u'type': u'uuid', u'description': u'The uuid of the Vpn user'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username of the vpn user.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists vpn users'}, u'egressfirewallrules': {u'name': u'listEgressFirewallRules', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id network network for the egress firwall services'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [], u'description': u'Lists all egress firewall rules for network id.'}, u'staticroutes': {u'name': u'listStaticRoutes', u'related': [u'createStaticRoute'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'gatewayid', u'required': False, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by gateway id'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by vpc id'}, {u'name': u'id', u'required': False, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'list static route by id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists all static routes'}, u'volumes': {u'name': u'listVolumes', u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'list volumes on specified host'}, {u'name': u'id', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of disk volume'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the pod id the disk volume belongs to'}], u'requiredparams': [], u'description': u'Lists all volumes.'}, u'pods': {u'name': u'listPods', u'related': [u'updatePod'], u'isasync': False, u'params': [{u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the pods'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list pods by allocation state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list Pods by Zone ID'}, {u'name': u'id', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'list Pods by ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list Pods by name'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all Pods.'}}, u'upload': {u'volume': {u'name': u'uploadVolume', u'related': [u'detachVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the volume'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the volume. Possible values include QCOW2, OVA, and VHD.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the volume is hosted. Possible URL include http:// and https://'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this volume'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the volume is to be hosted on'}], u'requiredparams': [u'name', u'format', u'url', u'zoneid'], u'description': u'Uploads a data disk.'}, u'customcertificate': {u'name': u'uploadCustomCertificate', u'related': [], u'isasync': True, u'params': [{u'name': u'domainsuffix', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'DNS domain suffix that the certificate is granted for.'}, {u'name': u'certificate', u'required': True, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The certificate to be uploaded.'}, {u'name': u'privatekey', u'required': False, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The private key for the attached certificate.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A name / alias for the certificate.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'An integer providing the location in a chain that the certificate will hold. Usually, this can be left empty. When creating a chain, the top level certificate should have an ID of 1, with each step in the chain incrementing by one. Example, CA with id = 1, Intermediate CA with id = 2, Site certificate with ID = 3'}], u'requiredparams': [u'domainsuffix', u'certificate'], u'description': u'Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.'}}, u'remove': {u'region': {u'name': u'removeRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'ID of the region to delete'}], u'requiredparams': [u'id'], u'description': u'Removes specified region'}, u'nicfromvirtualmachine': {u'name': u'removeNicFromVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Removes VM from specified network by deleting a NIC'}, u'fromloadbalancerrule': {u'name': u'removeFromLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the load balancer rule'}, {u'name': u'virtualmachineids', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)'}], u'requiredparams': [u'id', u'virtualmachineids'], u'description': u'Removes a virtual machine or a list of virtual machines from a load balancer rule.'}, u'vpnuser': {u'name': u'removeVpnUser', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'remove vpn user from the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}], u'requiredparams': [u'username'], u'description': u'Removes vpn user'}}, u'asyncapis': [u'createCondition', u'reconnectHost', u'copyTemplate', u'deleteBigSwitchVnsDevice', u'addNicToVirtualMachine', u'extractVolume', u'addAccountToProject', u'deleteEgressFirewallRule', u'deleteCiscoNexusVSM', u'createVpnConnection', u'suspendProject', u'addF5LoadBalancer', u'deleteAutoScaleVmGroup', u'authorizeSecurityGroupIngress', u'addNetscalerLoadBalancer', u'deleteDomain', u'configureNetscalerLoadBalancer', u'disableAutoScaleVmGroup', u'authorizeSecurityGroupEgress', u'createTemplate', u'migrateVolume', u'updatePhysicalNetwork', u'prepareHostForMaintenance', u'deletePrivateGateway', u'deleteStaticRoute', u'deleteTrafficType', u'deleteLoadBalancerRule', u'attachIso', u'destroySystemVm', u'deletePortForwardingRule', u'enableStorageMaintenance', u'stopRouter', u'configureSrxFirewall', u'attachVolume', u'updateVPCOffering', u'resetSSHKeyForVirtualMachine', u'updateProjectInvitation', u'createTags', u'enableAutoScaleVmGroup', u'deleteTags', u'deleteAccountFromProject', u'removeVpnUser', u'updateVpnCustomerGateway', u'stopSystemVm', u'uploadCustomCertificate', u'restartNetwork', u'createAutoScaleVmProfile', u'rebootVirtualMachine', u'enableCiscoNexusVSM', u'cancelHostMaintenance', u'deleteStorageNetworkIpRange', u'deleteFirewallRule', u'deleteVpnConnection', u'startSystemVm', u'deleteF5LoadBalancer', u'deleteNiciraNvpDevice', u'updateProject', u'deleteNetwork', u'deleteProject', u'deleteNetscalerLoadBalancer', u'deleteIpForwardingRule', u'addTrafficType', u'disableUser', u'resizeVolume', u'configureVirtualRouterElement', u'createStaticRoute', u'deleteProjectInvitation', u'migrateSystemVm', u'activateProject', u'removeNicFromVirtualMachine', u'revokeSecurityGroupIngress', u'updateDefaultNicForVirtualMachine', u'disableStaticNat', u'createNetworkACL', u'createVPC', u'configureF5LoadBalancer', u'disassociateIpAddress', u'createIpForwardingRule', u'createVolume', u'resetPasswordForVirtualMachine', u'assignToLoadBalancerRule', u'startRouter', u'extractIso', u'deleteRemoteAccessVpn', u'resetVpnConnection', u'createRemoteAccessVpn', u'extractTemplate', u'startVirtualMachine', u'detachIso', u'updateVPC', u'deleteAccount', u'associateIpAddress', u'updateAutoScaleVmProfile', u'disableAccount', u'updatePortForwardingRule', u'migrateVirtualMachine', u'createStorageNetworkIpRange', u'cancelStorageMaintenance', u'deployVirtualMachine', u'removeFromLoadBalancerRule', u'revokeSecurityGroupEgress', u'deleteCondition', u'createPortForwardingRule', u'addVpnUser', u'createVPCOffering', u'createEgressFirewallRule', u'deleteLBStickinessPolicy', u'destroyRouter', u'createPrivateGateway', u'disableCiscoNexusVSM', u'deleteAutoScaleVmProfile', u'updateTrafficType', u'deleteSnapshot', u'createProject', u'createLoadBalancerRule', u'addSrxFirewall', u'addNiciraNvpDevice', u'createAutoScalePolicy', u'restoreVirtualMachine', u'copyIso', u'uploadVolume', u'createLBStickinessPolicy', u'stopVirtualMachine', u'createCounter', u'createSnapshot', u'destroyVirtualMachine', u'updateNetwork', u'deleteVpnGateway', u'createAutoScaleVmGroup', u'rebootRouter', u'deleteNetworkServiceProvider', u'deleteIso', u'createVpnCustomerGateway', u'createFirewallRule', u'deleteAutoScalePolicy', u'deleteSrxFirewall', u'addNetworkServiceProvider', u'rebootSystemVm', u'detachVolume', u'deleteNetworkACL', u'markDefaultZoneForAccount', u'deleteVPC', u'restartVPC', u'updateAutoScaleVmGroup', u'updateLoadBalancerRule', u'createPhysicalNetwork', u'deleteTemplate', u'deletePhysicalNetwork', u'deleteVpnCustomerGateway', u'deleteVPCOffering', u'createVirtualRouterElement', u'updateAutoScalePolicy', u'addBigSwitchVnsDevice', u'createVpnGateway', u'updateNetworkServiceProvider', u'deleteCounter', u'updateStorageNetworkIpRange'], u'assign': {u'toloadbalancerrule': {u'name': u'assignToLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineids', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'virtualmachineids', u'id'], u'description': u'Assigns virtual machine or a list of virtual machines to a load balancer rule.'}, u'virtualmachine': {u'name': u'assignVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u'list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.'}, {u'name': u'domainid', u'required': True, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain id of the new VM owner.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'account name of the new VM owner.'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'id of the VM to be moved'}], u'requiredparams': [u'domainid', u'account', u'virtualmachineid'], u'description': u'Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.'}}, u'delete': {u'loadbalancerrule': {u'name': u'deleteLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a load balancer rule.'}, u'domain': {u'name': u'deleteDomain', u'related': [], u'isasync': True, u'params': [{u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes a specified domain'}, u'instancegroup': {u'name': u'deleteInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the instance group'}], u'requiredparams': [u'id'], u'description': u'Deletes a vm group'}, u'diskoffering': {u'name': u'deleteDiskOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'externalloadbalancer': {u'name': u'deleteExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external loadbalancer appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes a F5 external load balancer appliance added in a zone.'}, u'securitygroup': {u'name': u'deleteSecurityGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the security group'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with name parameter'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The ID of the security group. Mutually exclusive with id parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the security group. Must be specified with domain ID'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project of the security group'}], u'requiredparams': [], u'description': u'Deletes security group'}, u'portforwardingrule': {u'name': u'deletePortForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the port forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a port forwarding rule'}, u'cluster': {u'name': u'deleteCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}], u'requiredparams': [u'id'], u'description': u'Deletes a cluster.'}, u'accountfromproject': {u'name': u'deleteAccountFromProject', u'related': [], u'isasync': True, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to remove the account from'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be removed from the project'}], u'requiredparams': [u'projectid', u'account'], u'description': u'Deletes account from the project'}, u'networkdevice': {u'name': u'deleteNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of network device to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes network device.'}, u'firewallrule': {u'name': u'deleteFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a firewall rule'}, u'pod': {u'name': u'deletePod', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}], u'requiredparams': [u'id'], u'description': u'Deletes a Pod.'}, u'ipforwardingrule': {u'name': u'deleteIpForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the id of the forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ip forwarding rule'}, u'vpnconnection': {u'name': u'deleteVpnConnection', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn connection'}, u'lbstickinesspolicy': {u'name': u'deleteLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createLBStickinessPolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the LB stickiness policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a LB stickiness policy.'}, u'vpcoffering': {u'name': u'deleteVPCOffering', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}], u'requiredparams': [u'id'], u'description': u'Deletes VPC offering'}, u'network': {u'name': u'deleteNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}], u'requiredparams': [u'id'], u'description': u'Deletes a network'}, u'zone': {u'name': u'deleteZone', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}], u'requiredparams': [u'id'], u'description': u'Deletes a Zone.'}, u'remoteaccessvpn': {u'name': u'deleteRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Destroys a l2tp/ipsec remote access vpn'}, u'storagenetworkiprange': {u'name': u'deleteStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listStorageNetworkIpRange', u'createStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'the uuid of the storage network ip range'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage network IP Range.'}, u'bigswitchvnsdevice': {u'name': u'deleteBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'vnsdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'BigSwitch device ID'}], u'requiredparams': [u'vnsdeviceid'], u'description': u' delete a bigswitch vns device'}, u'projectinvitation': {u'name': u'deleteProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'id of the invitation'}], u'requiredparams': [u'id'], u'description': u'Accepts or declines project invitation'}, u'autoscalepolicy': {u'name': u'deleteAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale policy.'}, u'niciranvpdevice': {u'name': u'deleteNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'Nicira device ID'}], u'requiredparams': [u'nvpdeviceid'], u'description': u' delete a nicira nvp device'}, u'serviceoffering': {u'name': u'deleteServiceOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a service offering.'}, u'condition': {u'name': u'deleteCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition.'}], u'requiredparams': [u'id'], u'description': u'Removes a condition'}, u'storagepool': {u'name': u'deleteStoragePool', u'related': [], u'isasync': False, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy storage pool (force expunge volumes in Destroyed state as a part of pool removal)'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Storage pool id'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage pool.'}, u'vpngateway': {u'name': u'deleteVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVpnGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn gateway'}, u'snapshot': {u'name': u'deleteSnapshot', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the snapshot'}], u'requiredparams': [u'id'], u'description': u'Deletes a snapshot of a disk volume.'}, u'autoscalevmgroup': {u'name': u'deleteAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm group.'}, u'trafficmonitor': {u'name': u'deleteTrafficMonitor', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Traffic Monitor Host.'}], u'requiredparams': [u'id'], u'description': u'Deletes an traffic monitor host.'}, u'networkacl': {u'name': u'deleteNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network ACL'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network ACL'}, u'template': {u'name': u'deleteTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of zone of the template'}], u'requiredparams': [u'id'], u'description': u'Deletes a template from the system. All virtual machines using the deleted template will not be affected.'}, u'tags': {u'name': u'deleteTags', u'related': [], u'isasync': True, u'params': [{u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'Delete tags for resource id(s)'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Delete tags matching key/value pairs'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Delete tag by resource type'}], u'requiredparams': [u'resourceids', u'resourcetype'], u'description': u'Deleting resource tag(s)'}, u'snapshotpolicies': {u'name': u'deleteSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Id of the snapshot policy'}, {u'name': u'ids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of snapshots policy IDs separated by comma'}], u'requiredparams': [], u'description': u'Deletes snapshot policies for the account.'}, u'privategateway': {u'name': u'deletePrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the private gateway'}], u'requiredparams': [u'id'], u'description': u'Deletes a Private gateway'}, u'traffictype': {u'name': u'deleteTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addTrafficType', u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}], u'requiredparams': [u'id'], u'description': u'Deletes traffic type of a physical network'}, u'host': {u'name': u'deleteHost', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'forcedestroylocalstorage', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy local storage on this host. All VMs created on this local storage will be destroyed'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped'}], u'requiredparams': [u'id'], u'description': u'Deletes a host.'}, u'staticroute': {u'name': u'deleteStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the static route'}], u'requiredparams': [u'id'], u'description': u'Deletes a static route'}, u'vpc': {u'name': u'deleteVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC'}], u'requiredparams': [u'id'], u'description': u'Deletes a VPC'}, u'srxfirewall': {u'name': u'deleteSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'srx firewall device ID'}], u'requiredparams': [u'fwdeviceid'], u'description': u' delete a SRX firewall device'}, u'externalfirewall': {u'name': u'deleteExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external firewall appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes an external firewall appliance.'}, u'pool': {u'name': u'deletePool', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'Delete a pool'}, u'autoscalevmprofile': {u'name': u'deleteAutoScaleVmProfile', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale profile'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm profile.'}, u'volume': {u'name': u'deleteVolume', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}], u'requiredparams': [u'id'], u'description': u'Deletes a detached disk volume.'}, u'account': {u'name': u'deleteAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'id'], u'description': u'Deletes a account, and all users associated with this account'}, u'cisconexusvsm': {u'name': u'deleteCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'listCiscoNexusVSMs', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u' delete a Cisco Nexus VSM device'}, u'netscalerloadbalancer': {u'name': u'deleteNetscalerLoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a netscaler load balancer device'}, u'networkoffering': {u'name': u'deleteNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a network offering.'}, u'vpncustomergateway': {u'name': u'deleteVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn customer gateway'}, u'counter': {u'name': u'deleteCounter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the counter'}], u'requiredparams': [u'id'], u'description': u'Deletes a counter'}, u'physicalnetwork': {u'name': u'deletePhysicalNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Physical network'}], u'requiredparams': [u'id'], u'description': u'Deletes a Physical Network.'}, u'project': {u'name': u'deleteProject', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a project'}, u'vlaniprange': {u'name': u'deleteVlanIpRange', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VLAN IP range'}], u'requiredparams': [u'id'], u'description': u'Creates a VLAN IP range.'}, u'f5loadbalancer': {u'name': u'deleteF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a F5 load balancer device'}, u'iso': {u'name': u'deleteIso', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones'}], u'requiredparams': [u'id'], u'description': u'Deletes an ISO file.'}, u'egressfirewallrule': {u'name': u'deleteEgressFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ggress firewall rule'}, u'networkserviceprovider': {u'name': u'deleteNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network service provider'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network Service Provider.'}, u'sshkeypair': {u'name': u'deleteSSHKeyPair', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project associated with keypair'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the keypair'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the keypair. Must be used with the domainId parameter.'}], u'requiredparams': [u'name'], u'description': u'Deletes a keypair by name'}, u'user': {u'name': u'deleteUser', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'id of the user to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a user for an account'}}} +apicache = {u'authorize': {u'securitygroupingress': {u'name': u'authorizeSecurityGroupIngress', u'related': [u'authorizeSecurityGroupEgress'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this ingress rule'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this ingress rule'}], u'requiredparams': [], u'description': u'Authorizes a particular ingress rule for this security group'}, u'securitygroupegress': {u'name': u'authorizeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The name of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'securitygroupid', u'required': False, u'related': [u'createSecurityGroup', u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with securityGroupName parameter'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'protocol', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'TCP is default. UDP is the other supported protocol'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'an optional project of the security group'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'end port for this egress rule'}, {u'name': u'usersecuritygrouplist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'user to security group mapping'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'start port for this egress rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list associated'}], u'requiredparams': [], u'description': u'Authorizes a particular egress rule for this security group'}}, u'restore': {u'virtualmachine': {u'name': u'restoreVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Restore a VM to original template or specific snapshot'}}, u'suspend': {u'project': {u'name': u'suspendProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be suspended'}], u'requiredparams': [u'id'], u'description': u'Suspends a project'}}, u'revoke': {u'securitygroupingress': {u'name': u'revokeSecurityGroupIngress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the ingress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular ingress rule from this security group'}, u'securitygroupegress': {u'name': u'revokeSecurityGroupEgress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the egress rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a particular egress rule from this security group'}}, u'disassociate': {u'ipaddress': {u'name': u'disassociateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of the public ip address to disassociate'}], u'requiredparams': [u'id'], u'description': u'Disassociates an ip address from the account.'}}, u'migrate': {u'volume': {u'name': u'migrateVolume', u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'volumeid', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'storageid', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'destination storage pool ID to migrate the volume to'}], u'requiredparams': [u'volumeid', u'storageid'], u'description': u'Migrate volume'}, u'systemvm': {u'name': u'migrateSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to migrate VM to'}], u'requiredparams': [u'virtualmachineid', u'hostid'], u'description': u'Attempts Migration of a system virtual machine to the host specified.'}, u'virtualmachine': {u'name': u'migrateVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'long', u'description': u'Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Destination Host ID to migrate VM to. Required for live migrating a VM from host to host'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool'}}, u'lock': {u'account': {u'name': u'lockAccount', u'related': [u'markDefaultZoneForAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Locks the specified account on this domain.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Locks the specified account.'}], u'requiredparams': [u'domainid', u'account'], u'description': u'Locks an account'}, u'user': {u'name': u'lockUser', u'related': [u'listUsers'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'Locks user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Locks a user account'}}, u'dissociate': {u'lun': {u'name': u'dissociateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN.'}, {u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'iqn', u'path'], u'description': u'Dissociate a LUN'}}, u'activate': {u'project': {u'name': u'activateProject', u'related': [u'createProject', u'listProjectAccounts'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}], u'requiredparams': [u'id'], u'description': u'Activates a project'}}, u'reconnect': {u'host': {u'name': u'reconnectHost', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'reconnectHost', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Reconnects a host.'}}, u'cancel': {u'hostmaintenance': {u'name': u'cancelHostMaintenance', u'related': [u'listSwifts', u'addHost', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Cancels host maintenance.'}, u'storagemaintenance': {u'name': u'cancelStorageMaintenance', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Cancels maintenance for primary storage'}}, u'query': {u'asyncjobresult': {u'name': u'queryAsyncJobResult', u'related': [], u'isasync': False, u'params': [{u'name': u'jobid', u'required': True, u'related': [u'queryAsyncJobResult'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the asynchronous job'}], u'requiredparams': [u'jobid'], u'description': u'Retrieves the current status of asynchronous job.'}}, u'recover': {u'virtualmachine': {u'name': u'recoverVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Recovers a virtual machine.'}}, u'extract': {u'volume': {u'name': u'extractVolume', u'related': [u'extractTemplate', u'extractIso'], u'isasync': True, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the volume would be extracted'}, {u'name': u'id', u'required': True, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the volume'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the volume is located'}], u'requiredparams': [u'id', u'mode', u'zoneid'], u'description': u'Extracts volume'}, u'iso': {u'name': u'extractIso', u'related': [u'extractTemplate'], u'isasync': True, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts an ISO'}, u'template': {u'name': u'extractTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'mode', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD'}, {u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the url to which the ISO would be extracted'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone where the ISO is originally located'}], u'requiredparams': [u'mode', u'id'], u'description': u'Extracts a template'}}, u'copy': {u'iso': {u'name': u'copyIso', u'related': [u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies an iso from one zone to another.'}, u'template': {u'name': u'copyTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'copyTemplate', u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'registerTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'Template ID.'}, {u'name': u'destzoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is being copied to.'}, {u'name': u'sourcezoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'ID of the zone the template is currently hosted on.'}], u'requiredparams': [u'id', u'destzoneid', u'sourcezoneid'], u'description': u'Copies a template from one zone to another.'}}, u'prepare': {u'hostformaintenance': {u'name': u'prepareHostForMaintenance', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}], u'requiredparams': [u'id'], u'description': u'Prepares a host for maintenance.'}, u'template': {u'name': u'prepareTemplate', u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone ID of the template to be prepared in primary storage(s).'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'template ID of the template to be prepared in primary storage(s).'}], u'requiredparams': [u'zoneid', u'templateid'], u'description': u'load template into primary storage'}}, u'attach': {u'volume': {u'name': u'attachVolume', u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the ID of the device to map the volume to within the guest OS. If no deviceId is passed in, the next available deviceId will be chosen. Possible values for a Linux OS are:* 1 - /dev/xvdb* 2 - /dev/xvdc* 4 - /dev/xvde* 5 - /dev/xvdf* 6 - /dev/xvdg* 7 - /dev/xvdh* 8 - /dev/xvdi* 9 - /dev/xvdj'}, {u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u' the ID of the virtual machine'}], u'requiredparams': [u'id', u'virtualmachineid'], u'description': u'Attaches a disk volume to a virtual machine.'}, u'iso': {u'name': u'attachIso', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}], u'requiredparams': [u'virtualmachineid', u'id'], u'description': u'Attaches an ISO to a virtual machine.'}}, u'create': {u'loadbalancerrule': {u'name': u'createLoadBalancerRule', u'related': [u'updateLoadBalancerRule'], u'isasync': True, u'params': [{u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end public port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when LB rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the load balancer. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the load balancer'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm'}, {u'name': u'publicipid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id from where the network traffic will be load balanced from'}, {u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the load balancer rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the public port from where the network traffic will be load balanced from'}, {u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the private port of the private ip address/virtual machine where the network traffic will be load balanced to'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'algorithm', u'name', u'publicport', u'privateport'], u'description': u'Creates a load balancer rule'}, u'domain': {u'name': u'createDomain', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'creates domain with this name'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Domain UUID, required for adding domain from another Region'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain for networks in the domain'}, {u'name': u'parentdomainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'assigns new domain a parent domain by domain ID of the parent. If no parent domain is specied, the ROOT domain is assumed.'}], u'requiredparams': [u'name'], u'description': u'Creates a domain'}, u'snapshotpolicy': {u'name': u'createSnapshotPolicy', u'related': [u'listSnapshotPolicies'], u'isasync': False, u'params': [{u'name': u'intervaltype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY'}, {u'name': u'maxsnaps', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of snapshots to retain'}, {u'name': u'schedule', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'time the snapshot is scheduled to be taken. Format is:* if HOURLY, MM* if DAILY, MM:HH* if WEEKLY, MM:HH:DD (1-7)* if MONTHLY, MM:HH:DD (1-28)'}, {u'name': u'timezone', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}], u'requiredparams': [u'intervaltype', u'maxsnaps', u'schedule', u'timezone', u'volumeid'], u'description': u'Creates a snapshot policy for the account.'}, u'diskoffering': {u'name': u'createDiskOffering', u'related': [u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'customized', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'whether disk offering is custom or not'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'alternate display text of the disk offering'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'disksize', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'size of the disk offering in GB'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the disk offering. Values are local and shared.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'tags for the disk offering'}], u'requiredparams': [u'displaytext', u'name'], u'description': u'Creates a disk offering.'}, u'securitygroup': {u'name': u'createSecurityGroup', u'related': [u'listSecurityGroups'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the security group. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the security group. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the security group'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the security group'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}], u'requiredparams': [u'name'], u'description': u'Creates a security group'}, u'portforwardingrule': {u'name': u'createPortForwardingRule', u'related': [u'listIpForwardingRules'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's private port range"}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. If not specified 1) defaulted to false when PF rule is being created for VPC guest network 2) in all other cases defaulted to true'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}, {u'name': u'privateendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the Port Forwarding rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}, {u'name': u'publicendport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the ending port of port forwarding rule's private port range"}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u"the starting port of port forwarding rule's public port range"}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}], u'requiredparams': [u'privateport', u'ipaddressid', u'protocol', u'virtualmachineid', u'publicport'], u'description': u'Creates a port forwarding rule'}, u'pod': {u'name': u'createPod', u'related': [u'updatePod', u'listPods'], u'isasync': False, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID in which the Pod will be created'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Pod for allocation of new resources'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}], u'requiredparams': [u'startip', u'name', u'zoneid', u'netmask', u'gateway'], u'description': u'Creates a new Pod.'}, u'ipforwardingrule': {u'name': u'createIpForwardingRule', u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the end port for the rule'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the forwarding rule, already associated via associateIp'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'startport', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the start port for the rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the rule. Valid values are TCP or UDP.'}], u'requiredparams': [u'ipaddressid', u'startport', u'protocol'], u'description': u'Creates an ip forwarding rule'}, u'vpnconnection': {u'name': u'createVpnConnection', u'related': [u'listVpnConnections', u'resetVpnConnection'], u'isasync': True, u'params': [{u'name': u's2svpngatewayid', u'required': True, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u's2scustomergatewayid', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}], u'requiredparams': [u's2svpngatewayid', u's2scustomergatewayid'], u'description': u'Create site to site vpn connection'}, u'vpncustomergateway': {u'name': u'createVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr list of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}], u'requiredparams': [u'gateway', u'esppolicy', u'ikepolicy', u'cidrlist', u'ipsecpsk'], u'description': u'Creates site to site vpn customer gateway'}, u'lbstickinesspolicy': {u'name': u'createLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'lbruleid', u'required': True, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy'}, {u'name': u'methodname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the LB Stickiness policy method, possible values can be obtained from ListNetworks API '}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the description of the LB Stickiness policy'}, {u'name': u'param', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'param list. Example: param[0].name=cookiename¶m[0].value=LBCookie '}], u'requiredparams': [u'lbruleid', u'name', u'methodname'], u'description': u'Creates a Load Balancer stickiness policy '}, u'vpcoffering': {u'name': u'createVPCOffering', u'related': [u'listVPCOfferings'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the vpc offering'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the vpc offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the vpc offering'}], u'requiredparams': [u'displaytext', u'supportedservices', u'name'], u'description': u'Creates VPC offering'}, u'network': {u'name': u'createNetwork', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all Isolated networks - Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'subdomainaccess', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Defines whether to allow subdomains to use networks dedicated to their parent domain(s). Should be used with aclType=Domain, defaulted to allow.subdomain.network.access global config if not specified'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the network IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the network'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the network'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the network IP range. If not specified, will be defaulted to startIP'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the network'}, {u'name': u'networkofferingid', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the network offering id'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'networkofferingid'], u'description': u'Creates a network'}, u'zone': {u'name': u'createZone', u'related': [u'listZones'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public zones'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone'}, {u'name': u'internaldns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}, {u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is security group enabled, false otherwise'}, {u'name': u'networktype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'network type of the zone, can be Basic or Advanced'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Zone for allocation of new resources'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dns1', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}], u'requiredparams': [u'name', u'internaldns1', u'networktype', u'dns1'], u'description': u'Creates a Zone.'}, u'remoteaccessvpn': {u'name': u'createRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the VPN. Must be used with domainId.'}, {u'name': u'openfirewall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default'}, {u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the VPN. If the account parameter is used, domainId must also be used.'}, {u'name': u'iprange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the range of ip addresses to allocate to vpn clients. The first ip in the range will be taken by the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Creates a l2tp/ipsec remote access vpn'}, u'instancegroup': {u'name': u'createInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the instance group. The account parameter must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The project of the instance group'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the instance group'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the instance group'}], u'requiredparams': [u'name'], u'description': u'Creates a vm group'}, u'autoscalepolicy': {u'name': u'createAutoScalePolicy', u'related': [u'updateAutoScalePolicy'], u'isasync': True, u'params': [{u'name': u'action', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}, {u'name': u'duration', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}], u'requiredparams': [u'action', u'conditionids', u'duration'], u'description': u'Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.'}, u'tags': {u'name': u'createTags', u'related': [], u'isasync': True, u'params': [{u'name': u'tags', u'required': True, u'related': [], u'length': 255, u'type': u'map', u'description': u'Map of tags (key/value pairs)'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the resource'}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"identifies client specific tag. When the value is not null, the tag can't be used by cloudStack code internally"}, {u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of resources to create the tags for'}], u'requiredparams': [u'tags', u'resourcetype', u'resourceids'], u'description': u'Creates resource tag(s)'}, u'serviceoffering': {u'name': u'createServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering'}, {u'name': u'storagetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage type of the service offering. Values are local and shared.'}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'cpunumber', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU number of the service offering'}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "domainrouter", "consoleproxy" and "secondarystoragevm".'}, {u'name': u'limitcpuuse', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'restrict the CPU usage to committed service offering'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host tag for this service offering.'}, {u'name': u'offerha', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the HA for the service offering'}, {u'name': u'memory', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the total memory of the service offering in MB'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the containing domain, null for public offerings'}, {u'name': u'cpuspeed', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'the CPU speed of the service offering in MHz.'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having "domainrouter" systemvmtype'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for this service offering.'}], u'requiredparams': [u'name', u'cpunumber', u'memory', u'cpuspeed', u'displaytext'], u'description': u'Creates a service offering.'}, u'condition': {u'name': u'createCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'threshold', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'Threshold value.'}, {u'name': u'counterid', u'required': True, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'relationaloperator', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Relational Operator to be used with threshold.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the condition. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of the account.'}], u'requiredparams': [u'threshold', u'counterid', u'relationaloperator'], u'description': u'Creates a condition'}, u'storagepool': {u'name': u'createStoragePool', u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'clusterid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the storage pool'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tags for the storage pool'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of the storage pool'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the storage pool'}], u'requiredparams': [u'clusterid', u'zoneid', u'name', u'podid', u'url'], u'description': u'Creates a storage pool.'}, u'vpngateway': {u'name': u'createVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vpcid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn gateway'}], u'requiredparams': [u'vpcid'], u'description': u'Creates site to site vpn local gateway'}, u'autoscalevmgroup': {u'name': u'createAutoScaleVmGroup', u'related': [u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'vmprofileid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the autoscale profile that contains information about the vms in the vm group.'}, {u'name': u'scaledownpolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'scaleuppolicyids', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.'}, {u'name': u'lbruleid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'vmprofileid', u'scaledownpolicyids', u'scaleuppolicyids', u'minmembers', u'maxmembers', u'lbruleid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}, u'networkacl': {u'name': u'createNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of ACL'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the ACL,can be Ingress or Egress, defaulted to Ingress if not specified'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to allow traffic from/to'}, {u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the ACL will be created for'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the ACL rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of ACL'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a ACL rule the given network (the network has to belong to VPC)'}, u'template': {u'name': u'createTemplate', u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bit'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a public template, false otherwise'}, {u'name': u'volumeid', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume the template is being created from. Either this parameter, or snapshotId has to be passed in'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the snapshot the template is being created from. Either this parameter, or volumeId has to be passed in'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Optional, VM ID. If this presents, it is going to create a baremetal template for VM this ID refers to. This is only for VM whose hypervisor type is BareMetal'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional, only for baremetal hypervisor. The directory name where template stored on CIFS server'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template requires HVM, false otherwise'}], u'requiredparams': [u'ostypeid', u'displaytext', u'name'], u'description': u'Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.'}, u'privategateway': {u'name': u'createPrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'vlan', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the Vlan for the private gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the Private gateway'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Private gateway'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID the network belongs to'}, {u'name': u'vpcid', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the VPC network belongs to'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address of the Private gateaway'}], u'requiredparams': [u'vlan', u'gateway', u'netmask', u'vpcid', u'ipaddress'], u'description': u'Creates a private gateway'}, u'volumeonfiler': {u'name': u'createVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}, {u'name': u'snapshotpolicy', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'snapshot policy.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password.'}, {u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'volume size.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'user name.'}, {u'name': u'snapshotreservation', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'snapshot reservation.'}], u'requiredparams': [u'volumename', u'aggregatename', u'poolname', u'ipaddress', u'password', u'size', u'username'], u'description': u'Create a volume'}, u'staticroute': {u'name': u'createStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'gatewayid', u'required': True, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'the gateway id we are creating static route for'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'static route cidr'}], u'requiredparams': [u'gatewayid', u'cidr'], u'description': u'Creates a static route'}, u'volume': {u'name': u'createVolume', u'related': [u'detachVolume', u'uploadVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'the project associated with the volume. Mutually exclusive with account parameter'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering. Either diskOfferingId or snapshotId must be passed in.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the disk volume. Must be used with the domainId parameter.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Arbitrary volume size'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the disk offering. If used with the account parameter returns the disk volume associated with the account for the specified domain.'}, {u'name': u'snapshotid', u'required': False, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'the snapshot ID for the disk volume. Either diskOfferingId or snapshotId must be passed in.'}], u'requiredparams': [u'name'], u'description': u'Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.'}, u'user': {u'name': u'createUser', u'related': [u'lockUser', u'listUsers'], u'isasync': False, u'params': [{u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain. Has to be accompanied with the account parameter'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}], u'requiredparams': [u'account', u'username', u'email', u'lastname', u'password', u'firstname'], u'description': u'Creates a user for an account that already exists'}, u'vpc': {u'name': u'createVPC', u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}, {u'name': u'vpcofferingid', u'required': True, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'VPC network domain. All networks inside the VPC will belong to this domain'}, {u'name': u'cidr', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u"the cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the VPC. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the VPC. If used with the account parameter returns the VPC associated with the account for the specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'create VPC for the project'}], u'requiredparams': [u'displaytext', u'zoneid', u'name', u'vpcofferingid', u'cidr'], u'description': u'Creates a VPC'}, u'storagenetworkiprange': {u'name': u'createStorageNetworkIpRange', u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'isasync': True, u'params': [{u'name': u'startip', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. The vlan the ip range sits on, default to Null when it is not specified which means you network is not on any Vlan. This is mainly for Vmware as other hypervisors can directly reterive bridge from pyhsical network traffic type table'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'UUID of pod where the ip range belongs to'}, {u'name': u'netmask', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for storage network'}], u'requiredparams': [u'startip', u'podid', u'netmask', u'gateway'], u'description': u'Creates a Storage network IP range.'}, u'pool': {u'name': u'createPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'name'], u'description': u'Create a pool'}, u'autoscalevmprofile': {u'name': u'createAutoScaleVmProfile', u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'parameters other than zoneId/serviceOfferringId/templateId of the auto deployed virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the auto deployed virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering of the auto deployed virtual machine'}, {u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}, {u'name': u'templateid', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}], u'requiredparams': [u'zoneid', u'serviceofferingid', u'templateid'], u'description': u'Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.'}, u'account': {u'name': u'createAccount', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'getUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'lastname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'lastname'}, {u'name': u'accounttype', u'required': True, u'related': [], u'length': 255, u'type': u'short', u'description': u'Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (Default is MD5). If you wish to use any other hashing algorithm, you would need to write a custom authentication adapter See Docs section.'}, {u'name': u'firstname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'firstname'}, {u'name': u'userid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'User UUID, required for adding account from external provisioning system'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Creates the user under the specified account. If no account is specified, the username will be used as the account name.'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'email', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks"}, {u'name': u'accountid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Account UUID, required for adding account from external provisioning system'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Creates the user under the specified domain.'}], u'requiredparams': [u'lastname', u'accounttype', u'username', u'password', u'firstname', u'email'], u'description': u'Creates an account'}, u'firewallrule': {u'name': u'createFirewallRule', u'related': [u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'protocol', u'ipaddressid'], u'description': u'Creates a firewall rule for a given ip address'}, u'networkoffering': {u'name': u'createNetworkOffering', u'related': [u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'serviceproviderlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network'}, {u'name': u'serviceofferingid', u'required': False, u'related': [u'updateHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID used by virtual router provider'}, {u'name': u'supportedservices', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'services supported by the network offering'}, {u'name': u'networkrate', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'data transfer rate in megabits per second allowed'}, {u'name': u'ispersistent', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports persistent networks; defaulted to false if not specified'}, {u'name': u'servicecapabilitylist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'desired service capabilities as part of network offering'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the tags for the network offering.'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'conservemode', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the network offering is IP conserve mode enabled'}, {u'name': u'guestiptype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest type of the network offering: Shared or Isolated'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the traffic type for the network offering. Supported type in current release is GUEST only'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports vlans'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Optional'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to false if not specified'}], u'requiredparams': [u'supportedservices', u'name', u'displaytext', u'guestiptype', u'traffictype'], u'description': u'Creates a network offering.'}, u'vlaniprange': {u'name': u'createVlanIpRange', u'related': [u'listVlanIpRanges'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a VLAN'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. If not specified, will be defaulted to the vlan of the network or if vlan of the network is null - to Untagged'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Have to be specified for Direct Untagged vlan only.'}, {u'name': u'ip6cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the CIDR of IPv6 network, must be at least /64'}, {u'name': u'endipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IPv6 address in the IPv6 network range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address in the VLAN IP range'}, {u'name': u'startipv6', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IPv6 address in the IPv6 network range'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the VLAN IP range'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the VLAN IP range'}, {u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address in the VLAN IP range'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will own the VLAN. If VLAN is Zone wide, this parameter should be ommited'}, {u'name': u'ip6gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway of the IPv6 network. Required for Shared networks and Isolated networks when it belongs to VPC'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the physical network id'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}], u'requiredparams': [], u'description': u'Creates a VLAN IP range.'}, u'counter': {u'name': u'createCounter', u'related': [u'listCounters'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'source', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'value', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Value of the counter e.g. oid in case of snmp.'}], u'requiredparams': [u'name', u'source', u'value'], u'description': u'Adds metric counter'}, u'lunonfiler': {u'name': u'createLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'size', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'LUN size.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'size', u'name'], u'description': u'Create a LUN from a pool'}, u'project': {u'name': u'createProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account who will be Admin for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the project'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a project'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}], u'requiredparams': [u'name', u'displaytext'], u'description': u'Creates a project'}, u'physicalnetwork': {u'name': u'createPhysicalNetwork', u'related': [u'listPhysicalNetworks'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the physical network'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'domain ID of the account owning a physical network'}, {u'name': u'broadcastdomainrange', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the broadcast domain range for the physical network[Pod or Zone]. In Acton release it can be Zone only in Advance zone, and Pod in Basic'}, {u'name': u'isolationmethods', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the isolation method for the physical network[VLAN/L3/GRE]'}], u'requiredparams': [u'name', u'zoneid'], u'description': u'Creates a physical network'}, u'snapshot': {u'name': u'createSnapshot', u'related': [u'listSnapshots'], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The domain ID of the snapshot. If used with the account parameter, specifies a domain for the account associated with the disk volume.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The account of the snapshot. The account parameter must be used with the domainId parameter.'}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}, {u'name': u'policyid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'policy id of the snapshot, if this is null, then use MANUAL_POLICY.'}], u'requiredparams': [u'volumeid'], u'description': u'Creates an instant snapshot of a volume.'}, u'virtualrouterelement': {u'name': u'createVirtualRouterElement', u'related': [], u'isasync': True, u'params': [{u'name': u'nspid', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the network service provider ID of the virtual router element'}], u'requiredparams': [u'nspid'], u'description': u'Create a virtual router element.'}, u'egressfirewallrule': {u'name': u'createEgressFirewallRule', u'related': [u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the network id of the port forwarding rule'}, {u'name': u'startport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the starting port of firewall rule'}, {u'name': u'icmpcode', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'error code for this icmp message'}, {u'name': u'icmptype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'type of the icmp message being sent'}, {u'name': u'cidrlist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the cidr list to forward traffic from'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of firewallrule: system/user'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.'}, {u'name': u'endport', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the ending port of firewall rule'}], u'requiredparams': [u'networkid', u'protocol'], u'description': u'Creates a egress firewall rule for a given network '}, u'sshkeypair': {u'name': u'createSSHKeyPair', u'related': [u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'name'], u'description': u'Create a new keypair and returns the private key'}}, u'deploy': {u'virtualmachine': {u'name': u'deployVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'keypair', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor on which to deploy the virtual machine'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId'}, {u'name': u'diskofferingid', u'required': False, u'related': [u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering for the virtual machine'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ip address for default vm's network"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the virtual machine. Must be used with domainId.'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}, {u'name': u'iptonetworklist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u"ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid"}, {u'name': u'ip6address', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"the ipv6 address for default vm's network"}, {u'name': u'keyboard', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u"list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter"}, {u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional user generated name for the virtual machine'}, {u'name': u'securitygroupnames', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter'}, {u'name': u'templateid', u'required': True, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template for the virtual machine'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'availability zone for the virtual machine'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional group for the virtual machine'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'host name for the virtual machine'}, {u'name': u'startvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network offering supports specifying ip ranges; defaulted to true if not specified'}], u'requiredparams': [u'serviceofferingid', u'templateid', u'zoneid'], u'description': u'Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.'}}, u'restart': {u'network': {u'name': u'restartNetwork', u'related': [u'associateIpAddress'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The id of the network to restart.'}, {u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If cleanup old network elements'}], u'requiredparams': [u'id'], u'description': u'Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules'}, u'vpc': {u'name': u'restartVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}], u'requiredparams': [], u'description': u'Restarts a VPC'}}, u'reboot': {u'systemvm': {u'name': u'rebootSystemVm', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a system VM.'}, u'router': {u'name': u'rebootRouter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'rebootVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Reboots a virtual machine.'}}, u'mark': {u'defaultzoneforaccount': {u'name': u'markDefaultZoneForAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': True, u'related': [u'markDefaultZoneForAccount'], u'length': 255, u'type': u'string', u'description': u'Name of the account that is to be marked.'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Marks the account that belongs to the specified domain.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The Zone ID with which the account is to be marked.'}], u'requiredparams': [u'account', u'domainid', u'zoneid'], u'description': u'Marks a default zone for this account'}}, u'start': {u'systemvm': {u'name': u'startSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Starts a system virtual machine.'}, u'router': {u'name': u'startRouter', u'related': [u'destroyRouter', u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Starts a router.'}, u'virtualmachine': {u'name': u'startVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'destination Host ID to deploy the VM to - parameter available for root admin only'}], u'requiredparams': [u'id'], u'description': u'Starts a virtual machine.'}}, u'add': {u'trafficmonitor': {u'name': u'addTrafficMonitor', u'related': [u'listTrafficMonitors'], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the traffic monitor Host'}, {u'name': u'includezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will be metered'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'excludezones', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Traffic going into the listed zones will not be metered'}], u'requiredparams': [u'url', u'zoneid'], u'description': u'Adds Traffic Monitor Host for Direct Network Usage'}, u'secondarystorage': {u'name': u'addSecondaryStorage', u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the secondary storage'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for the secondary storage'}], u'requiredparams': [u'url'], u'description': u'Adds secondary storage.'}, u'nictovirtualmachine': {u'name': u'addNicToVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'networkid', u'required': True, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'Network ID'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'IP Address for the new network'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'networkid', u'virtualmachineid'], u'description': u'Adds VM to specified network by creating a NIC'}, u'netscalerloadbalancer': {u'name': u'addNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach netscaler load balancer device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Netscaler device type supports NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the netscaler load balancer appliance.'}], u'requiredparams': [u'password', u'physicalnetworkid', u'username', u'networkdevicetype', u'url'], u'description': u'Adds a netscaler load balancer device'}, u'cluster': {u'name': u'addCluster', u'related': [u'listClusters', u'updateCluster'], u'isasync': False, u'params': [{u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'vsmpassword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the VSM associated with this cluster'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'vsmipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ipaddress of the VSM associated with this cluster'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator'}, {u'name': u'vsmusername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the VSM associated with this cluster'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the cluster'}, {u'name': u'clustertype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the cluster: CloudManaged, ExternalManaged'}, {u'name': u'clustername', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the cluster'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}], u'requiredparams': [u'podid', u'hypervisor', u'clustertype', u'clustername', u'zoneid'], u'description': u'Adds a new cluster'}, u's3': {u'name': u'addS3', u'related': [], u'isasync': False, u'params': [{u'name': u'connectiontimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'connection timeout (milliseconds)'}, {u'name': u'accesskey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 access key'}, {u'name': u'bucket', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the template storage bucket'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 host name'}, {u'name': u'secretkey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'S3 secret key'}, {u'name': u'sockettimeout', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'socket timeout (milliseconds)'}, {u'name': u'maxerrorretry', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'maximum number of times to retry on error'}, {u'name': u'usehttps', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'connect to the S3 endpoint via HTTPS?'}], u'requiredparams': [u'accesskey', u'bucket', u'secretkey'], u'description': u'Adds S3'}, u'accounttoproject': {u'name': u'addAccountToProject', u'related': [], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be added to the project'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email to which invitation to the project is going to be sent'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to add the account to'}], u'requiredparams': [u'projectid'], u'description': u'Adds account to a project'}, u'region': {u'name': u'addRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the region'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of the Region'}, {u'name': u'endpoint', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Region service endpoint'}], u'requiredparams': [u'name', u'id', u'endpoint'], u'description': u'Adds a Region'}, u'externalloadbalancer': {u'name': u'addExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external load balancer appliance.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external load balancer appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external load balancer appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external load balancer appliance.'}], u'requiredparams': [u'username', u'url', u'password', u'zoneid'], u'description': u'Adds F5 external load balancer appliance.'}, u'vpnuser': {u'name': u'addVpnUser', u'related': [u'listVpnUsers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'password for the username'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'add vpn user to the specific project'}], u'requiredparams': [u'password', u'username'], u'description': u'Adds vpn users'}, u'baremetalhost': {u'name': u'addBaremetalHost', u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address intentionally allocated to this host after provisioning'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}, {u'name': u'podid', u'required': True, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}], u'requiredparams': [u'url', u'username', u'zoneid', u'hypervisor', u'podid', u'password'], u'description': u'add a baremetal host'}, u'traffictype': {u'name': u'addTrafficType', u'related': [u'updateTrafficType'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The VLAN id to be used for Management traffic by VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}, {u'name': u'traffictype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the trafficType to be added to the physical network'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}], u'requiredparams': [u'traffictype', u'physicalnetworkid'], u'description': u'Adds traffic type to a physical network'}, u'niciranvpdevice': {u'name': u'addNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the Nicira NVP Controller.'}, {u'name': u'l3gatewayserviceuuid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The L3 Gateway Service UUID configured on the Nicira Controller'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}, {u'name': u'transportzoneuuid', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The Transportzone UUID configured on the Nicira Controller'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to access the Nicira Controller API'}], u'requiredparams': [u'physicalnetworkid', u'hostname', u'username', u'transportzoneuuid', u'password'], u'description': u'Adds a Nicira NVP device'}, u'host': {u'name': u'addHost', u'related': [u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host'}, {u'name': u'podid', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name for the host'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host URL'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID for the host'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the password for the host'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this Host for allocation of new resources'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the host'}], u'requiredparams': [u'username', u'podid', u'zoneid', u'url', u'password', u'hypervisor'], u'description': u'Adds a new host.'}, u'f5loadbalancer': {u'name': u'addF5LoadBalancer', u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach F5 BigIP load balancer device'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only F5BigIpLoadBalancer'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the F5 load balancer appliance.'}], u'requiredparams': [u'password', u'username', u'physicalnetworkid', u'networkdevicetype', u'url'], u'description': u'Adds a F5 BigIP load balancer device'}, u'networkdevice': {u'name': u'addNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}], u'requiredparams': [], u'description': u'Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer'}, u'bigswitchvnsdevice': {u'name': u'addBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'physicalnetworkid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname of ip address of the BigSwitch VNS Controller.'}], u'requiredparams': [u'physicalnetworkid', u'hostname'], u'description': u'Adds a BigSwitch VNS device'}, u'srxfirewall': {u'name': u'addSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'networkdevicetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'supports only JuniperSRXFirewall'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Credentials to reach SRX firewall device'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the SRX appliance.'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [u'password', u'networkdevicetype', u'username', u'url', u'physicalnetworkid'], u'description': u'Adds a SRX firewall device'}, u'swift': {u'name': u'addSwift', u'related': [u'listSwifts', u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account for swift'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL for swift'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for swift'}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u' key for the user for swift'}], u'requiredparams': [u'url'], u'description': u'Adds Swift.'}, u'externalfirewall': {u'name': u'addExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'URL of the external firewall appliance.'}, {u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Password of the external firewall appliance.'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Zone in which to add the external firewall appliance.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Username of the external firewall appliance.'}], u'requiredparams': [u'url', u'password', u'zoneid', u'username'], u'description': u'Adds an external firewall appliance'}, u'networkserviceprovider': {u'name': u'addNetworkServiceProvider', u'related': [u'updateNetworkServiceProvider'], u'isasync': True, u'params': [{u'name': u'destinationphysicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the destination Physical Network ID to bridge to'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name for the physical network service provider'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID to add the provider to'}], u'requiredparams': [u'name', u'physicalnetworkid'], u'description': u'Adds a network serviceProvider to a physical network'}}, u'verbs': [u'authorize', u'restore', u'suspend', u'revoke', u'disassociate', u'migrate', u'lock', u'dissociate', u'activate', u'reconnect', u'cancel', u'query', u'recover', u'extract', u'detach', u'prepare', u'start', u'create', u'associate', u'reboot', u'mark', u'attach', u'add', u'change', u'deploy', u'ldap', u'destroy', u'enable', u'configure', u'get', u'modify', u'stop', u'update', u'disable', u'resize', u'copy', u'generate', u'restart', u'reset', u'register', u'list', u'upload', u'remove', u'assign', u'delete'], u'resize': {u'volume': {u'name': u'resizeVolume', u'related': [u'detachVolume', u'uploadVolume', u'createVolume'], u'isasync': True, u'params': [{u'name': u'diskofferingid', u'required': False, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'new disk offering id'}, {u'name': u'id', u'required': False, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'shrinkok', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Verify OK to Shrink'}, {u'name': u'size', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'New volume size in G'}], u'requiredparams': [], u'description': u'Resizes a volume'}}, u'ldap': {u'config': {u'name': u'ldapConfig', u'related': [u'ldapRemove'], u'isasync': False, u'params': [{u'name': u'hostname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hostname or ip address of the ldap server eg: my.ldap.com'}, {u'name': u'ssl', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Check Use SSL if the external LDAP server is configured for LDAP over SSL.'}, {u'name': u'truststore', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the path to trust certificates store.'}, {u'name': u'queryfilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'You specify a query filter here, which narrows down the users, who can be part of this domain.'}, {u'name': u'searchbase', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.'}, {u'name': u'port', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Specify the LDAP port if required, default is 389.'}, {u'name': u'binddn', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specify the distinguished name of a user with the search permission on the directory.'}, {u'name': u'truststorepass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password for trust store.'}, {u'name': u'bindpass', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enter the password.'}], u'requiredparams': [u'hostname', u'queryfilter', u'searchbase'], u'description': u'Configure the LDAP context for this site.'}, u'remove': {u'name': u'ldapRemove', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Remove the LDAP context for this site.'}}, u'destroy': {u'systemvm': {u'name': u'destroySystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'destroySystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroyes a system virtual machine.'}, u'router': {u'name': u'destroyRouter', u'related': [u'rebootRouter'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'destroyRouter', u'rebootRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Destroys a router.'}, u'volumeonfiler': {u'name': u'destroyVolumeOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'volumename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'volume name.'}, {u'name': u'ipaddress', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ip address.'}, {u'name': u'aggregatename', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'aggregate name.'}], u'requiredparams': [u'volumename', u'ipaddress', u'aggregatename'], u'description': u'Destroy a Volume'}, u'lunonfiler': {u'name': u'destroyLunOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'path', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN path.'}], u'requiredparams': [u'path'], u'description': u'Destroy a LUN'}, u'virtualmachine': {u'name': u'destroyVirtualMachine', u'related': [u'listVirtualMachines'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Destroys a virtual machine. Once destroyed, only the administrator can recover it.'}}, u'get': {u'apilimit': {u'name': u'getApiLimit', u'related': [u'resetApiLimit'], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Get API limit count for the caller'}, u'vmpassword': {u'name': u'getVMPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Returns an encrypted password for the VM'}, u'user': {u'name': u'getUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'isasync': False, u'params': [{u'name': u'userapikey', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'API key of the user'}], u'requiredparams': [u'userapikey'], u'description': u'Find user account by API key'}, u'cloudidentifier': {u'name': u'getCloudIdentifier', u'related': [], u'isasync': False, u'params': [{u'name': u'userid', u'required': True, u'related': [u'lockUser', u'listUsers', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the user ID for the cloud identifier'}], u'requiredparams': [u'userid'], u'description': u'Retrieves a cloud identifier.'}}, u'count': 355, u'enable': {u'account': {u'name': u'enableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Enables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'enableAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enables specified account.'}], u'requiredparams': [], u'description': u'Enables an account'}, u'storagemaintenance': {u'name': u'enableStorageMaintenance', u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'enableStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'Primary storage ID'}], u'requiredparams': [u'id'], u'description': u'Puts storage pool into maintenance state'}, u'cisconexusvsm': {u'name': u'enableCiscoNexusVSM', u'related': [u'disableCiscoNexusVSM'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be enabled'}], u'requiredparams': [u'id'], u'description': u'Enable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'enableStaticNat', u'related': [], u'isasync': False, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being enabled'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for enabling static nat feature'}, {u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network of the vm the static nat will be enabled for. Required when public Ip address is not associated with any Guest network yet (VPC case)'}], u'requiredparams': [u'ipaddressid', u'virtualmachineid'], u'description': u'Enables static nat for given ip address'}, u'user': {u'name': u'enableUser', u'related': [u'lockUser', u'listUsers', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Enables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Enables a user account'}, u'autoscalevmgroup': {u'name': u'enableAutoScaleVmGroup', u'related': [u'createAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Enables an AutoScale Vm Group'}}, u'configure': {u'srxfirewall': {u'name': u'configureSrxFirewall', u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [u'listSrxFirewalls', u'configureSrxFirewall', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}, {u'name': u'fwdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the firewall device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'fwdeviceid'], u'description': u'Configures a SRX firewall device'}, u'f5loadbalancer': {u'name': u'configureF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'F5 load balancer device ID'}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a F5 load balancer device'}, u'netscalerloadbalancer': {u'name': u'configureNetscalerLoadBalancer', u'related': [u'listNetscalerLoadBalancers'], u'isasync': True, u'params': [{u'name': u'podids', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'list', u'description': u"Used when NetScaler device is provider of EIP service. This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to route pod's subnet IP to a NetScaler device."}, {u'name': u'lbdevicecapacity', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'capacity of the device, Capacity will be interpreted as number of networks device can handle'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers', u'configureNetscalerLoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'Netscaler load balancer device ID'}, {u'name': u'inline', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if netscaler load balancer is intended to be used in in-line with firewall, false if netscaler load balancer will side-by-side with firewall'}, {u'name': u'lbdevicededicated', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this netscaler device to dedicated for a account, false if the netscaler device will be shared by multiple accounts'}], u'requiredparams': [u'lbdeviceid'], u'description': u'configures a netscaler load balancer device'}, u'virtualrouterelement': {u'name': u'configureVirtualRouterElement', u'related': [u'createVirtualRouterElement'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual router provider'}, {u'name': u'enabled', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Enabled/Disabled the service provider'}], u'requiredparams': [u'id', u'enabled'], u'description': u'Configures a virtual router element.'}}, u'associate': {u'ipaddress': {u'name': u'associateIpAddress', u'related': [], u'isasync': True, u'params': [{u'name': u'networkid', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'The network this ip address should be associated to.'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the VPC you want the ip address to be associated with'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account to associate with this IP address'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone you want to acquire an public IP address from'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Deploy vm for the project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain to associate with this IP address'}], u'requiredparams': [], u'description': u'Acquires and associates a public IP to an account.'}, u'lun': {u'name': u'associateLun', u'related': [], u'isasync': False, u'params': [{u'name': u'iqn', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Guest IQN to which the LUN associate.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'LUN name.'}], u'requiredparams': [u'iqn', u'name'], u'description': u'Associate a LUN with a guest IQN'}}, u'stop': {u'systemvm': {u'name': u'stopSystemVm', u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'startSystemVm', u'rebootSystemVm', u'listSystemVms', u'stopSystemVm', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system virtual machine'}], u'requiredparams': [u'id'], u'description': u'Stops a system VM.'}, u'router': {u'name': u'stopRouter', u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': True, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM. The caller knows the VM is stopped.'}, {u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the router'}], u'requiredparams': [u'id'], u'description': u'Stops a router.'}, u'virtualmachine': {u'name': u'stopVirtualMachine', u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force stop the VM (vm is marked as Stopped even when command fails to be send to the backend). The caller knows the VM is stopped.'}], u'requiredparams': [u'id'], u'description': u'Stops a virtual machine.'}}, u'modify': {u'pool': {u'name': u'modifyPool', u'related': [], u'isasync': False, u'params': [{u'name': u'algorithm', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'algorithm.'}, {u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'algorithm', u'poolname'], u'description': u'Modify pool'}}, u'update': {u'loadbalancerrule': {u'name': u'updateLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'description', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the description of the load balancer rule'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of the load balancer rule to update'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'algorithm', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'load balancer algorithm (source, roundrobin, leastconn)'}], u'requiredparams': [u'id'], u'description': u'Updates load balancer'}, u'domain': {u'name': u'updateDomain', u'related': [u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the domain's networks; empty string will update domainName with NULL value"}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates domain with this name'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to update'}], u'requiredparams': [u'id'], u'description': u'Updates a domain with a new name'}, u'projectinvitation': {u'name': u'updateProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'accept', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, accept the invitation, decline if false. True by default'}, {u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to join'}, {u'name': u'token', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations for specified account; this parameter has to be specified with domainId'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'account that is joining the project'}], u'requiredparams': [u'projectid'], u'description': u'Accepts or declines project invitation'}, u'diskoffering': {u'name': u'updateDiskOffering', u'related': [u'createDiskOffering', u'listDiskOfferings'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'updates alternate display text of the disk offering with this value'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the disk offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates name of the disk offering with this value'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'virtualmachine': {u'name': u'updateVirtualMachine', u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'displayname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'user generated name'}, {u'name': u'group', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'group of the virtual machine'}, {u'name': u'haenable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if high-availability is enabled for the virtual machine, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents this VM.'}, {u'name': u'userdata', u'required': False, u'related': [], u'length': 2048, u'type': u'string', u'description': u'an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding.'}], u'requiredparams': [u'id'], u'description': u'Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.'}, u'portforwardingrule': {u'name': u'updatePortForwardingRule', u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'isasync': True, u'params': [{u'name': u'privateport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private port of the port forwarding rule'}, {u'name': u'publicport', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the public port of the port forwarding rule'}, {u'name': u'privateip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the private IP address of the port forwarding rule'}, {u'name': u'ipaddressid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the IP address id of the port forwarding rule'}, {u'name': u'protocol', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the protocol for the port fowarding rule. Valid values are TCP or UDP.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine for the port forwarding rule'}], u'requiredparams': [u'privateport', u'publicport', u'ipaddressid', u'protocol'], u'description': u'Updates a port forwarding rule. Only the private port and the virtual machine can be updated.'}, u'cluster': {u'name': u'updateCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}, {u'name': u'id', u'required': True, u'related': [u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Cluster'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'clustername', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the cluster name'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'hypervisor type of the cluster'}], u'requiredparams': [u'id'], u'description': u'Updates an existing cluster'}, u'hostpassword': {u'name': u'updateHostPassword', u'related': [], u'isasync': False, u'params': [{u'name': u'password', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new password for the host/cluster'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username for the host/cluster'}], u'requiredparams': [u'password', u'username'], u'description': u'Update password of a host/pool on management server.'}, u'pod': {u'name': u'updatePod', u'related': [], u'isasync': False, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address for the Pod'}, {u'name': u'gateway', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the gateway for the Pod'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'id', u'required': True, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Pod'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the starting IP address for the Pod'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask of the Pod'}], u'requiredparams': [u'id'], u'description': u'Updates a Pod.'}, u'isopermissions': {u'name': u'updateIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'projectids', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'Updates iso permissions'}, u'resourcelimit': {u'name': u'updateResourceLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource for a specified account. Must be used with the domainId parameter.'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for all accounts in specified domain. If used with the account parameter, updates resource limits for a specified account in specified domain.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'max', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u' Maximum resource limit.'}], u'requiredparams': [u'resourcetype'], u'description': u'Updates resource limits for an account or domain.'}, u'vpcoffering': {u'name': u'updateVPCOffering', u'related': [u'listVPCOfferings', u'createVPCOffering'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the VPC offering; supported states - Enabled/Disabled'}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering', u'updateVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC offering'}], u'requiredparams': [], u'description': u'Updates VPC offering'}, u'network': {u'name': u'updateNetwork', u'related': [u'listNetscalerLoadBalancerNetworks'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}, {u'name': u'networkofferingid', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'network offering ID'}, {u'name': u'changecidr', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force update even if cidr type is different'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new name for the network'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new display text for the network'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network domain'}], u'requiredparams': [u'id'], u'description': u'Updates a network'}, u'zone': {u'name': u'updateZone', u'related': [u'listZones', u'createZone'], u'isasync': False, u'params': [{u'name': u'internaldns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first internal DNS for the Zone'}, {u'name': u'dnssearchorder', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the dns search order list'}, {u'name': u'internaldns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second internal DNS for the Zone'}, {u'name': u'domain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network domain name for the networks in the zone; empty string will update domain with NULL value'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'the details for the Zone'}, {u'name': u'ip6dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for IPv6 network in the Zone'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Allocation state of this cluster for allocation of new resources'}, {u'name': u'ip6dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for IPv6 network in the Zone'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the Zone'}, {u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'updates a private zone to public if set, but not vice-versa'}, {u'name': u'dns2', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the second DNS for the Zone'}, {u'name': u'guestcidraddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the guest CIDR address for the Zone'}, {u'name': u'dhcpprovider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the dhcp Provider for the Zone'}, {u'name': u'dns1', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the first DNS for the Zone'}, {u'name': u'localstorageenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if local storage offering enabled, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates a Zone.'}, u'instancegroup': {u'name': u'updateInstanceGroup', u'related': [u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'Instance group ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new instance group name'}], u'requiredparams': [u'id'], u'description': u'Updates a vm group'}, u'autoscalepolicy': {u'name': u'updateAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration for which the conditions have to be true before action is taken'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'quiettime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the cool down period for which the policy should not be evaluated after the action has been taken'}, {u'name': u'conditionids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the conditions that are being evaluated on every interval'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale policy.'}, u'serviceoffering': {u'name': u'updateServiceOffering', u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the service offering, integer'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the service offering to be updated'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the service offering to be updated'}, {u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering to be updated'}], u'requiredparams': [u'id'], u'description': u'Updates a service offering.'}, u'storagepool': {u'name': u'updateStoragePool', u'related': [u'cancelStorageMaintenance', u'createStoragePool', u'listStoragePools'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'cancelStorageMaintenance', u'updateStoragePool', u'createStoragePool', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the Id of the storage pool'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma-separated list of tags for the storage pool'}], u'requiredparams': [u'id'], u'description': u'Updates a storage pool.'}, u'hypervisorcapabilities': {u'name': u'updateHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'securitygroupenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'set true to enable security group for this hypervisor.'}, {u'name': u'maxguestslimit', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the max number of Guest VMs per host for this hypervisor.'}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}], u'requiredparams': [], u'description': u'Updates a hypervisor capabilities.'}, u'template': {u'name': u'updateTemplate', u'related': [u'registerIso', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'ostypeid', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'registerIso', u'updateTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}], u'requiredparams': [u'id'], u'description': u'Updates attributes of a template.'}, u'defaultnicforvirtualmachine': {u'name': u'updateDefaultNicForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Changes the default NIC on a VM'}, u'traffictype': {u'name': u'updateTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}, {u'name': u'xennetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a XenServer host'}, {u'name': u'vmwarenetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a VMware host'}, {u'name': u'kvmnetworklabel', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The network name label of the physical device dedicated to this traffic on a KVM host'}], u'requiredparams': [u'id'], u'description': u'Updates traffic type of a physical network'}, u'host': {u'name': u'updateHost', u'related': [u'listHosts'], u'isasync': False, u'params': [{u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Change resource state of host, valid values are [Enable, Disable]. Operation may failed if host in states not allowing Enable/Disable'}, {u'name': u'oscategoryid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of Os category to update the host with'}, {u'name': u'hosttags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of tags to be added to the host'}, {u'name': u'id', u'required': True, u'related': [u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the host to update'}, {u'name': u'url', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the new uri for the secondary storage: nfs://host/path'}], u'requiredparams': [u'id'], u'description': u'Updates a host.'}, u'user': {u'name': u'updateUser', u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser', u'updateUser'], u'length': 255, u'type': u'uuid', u'description': u'User uuid'}, {u'name': u'timezone', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Specifies a timezone for this command. For more information on the timezone parameter, see Time Zone Format.'}, {u'name': u'email', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'email'}, {u'name': u'usersecretkey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The secret key for the user. Must be specified with userApiKey'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Unique username'}, {u'name': u'firstname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'first name'}, {u'name': u'lastname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'last name'}, {u'name': u'password', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Hashed password (default is MD5). If you wish to use any other hasing algorithm, you would need to write a custom authentication adapter'}, {u'name': u'userapikey', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The API key for the user. Must be specified with userSecretKey'}], u'requiredparams': [u'id'], u'description': u'Updates a user account'}, u'vpc': {u'name': u'updateVPC', u'related': [u'restartVPC', u'listVPCs'], u'isasync': True, u'params': [{u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VPC'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the VPC'}], u'requiredparams': [], u'description': u'Updates a VPC'}, u'resourcecount': {u'name': u'updateResourceCount', u'related': [], u'isasync': False, u'params': [{u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Update resource limits for project'}, {u'name': u'domainid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Update resource count for a specified account. Must be used with the domainId parameter.'}], u'requiredparams': [u'domainid'], u'description': u'Recalculate and update resource count for an account or domain.'}, u'storagenetworkiprange': {u'name': u'updateStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'endip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ending IP address'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Optional. the vlan the ip range sits on'}, {u'name': u'netmask', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the netmask for storage network'}, {u'name': u'id', u'required': True, u'related': [u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'UUID of storage network ip range'}, {u'name': u'startip', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the beginning IP address'}], u'requiredparams': [u'id'], u'description': u'Update a Storage network IP range, only allowed when no IPs in this range have been allocated.'}, u'configuration': {u'name': u'updateConfiguration', u'related': [u'listConfigurations'], u'isasync': False, u'params': [{u'name': u'value', u'required': False, u'related': [], u'length': 4095, u'type': u'string', u'description': u'the value of the configuration'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the configuration'}], u'requiredparams': [u'name'], u'description': u'Updates a configuration.'}, u'templatepermissions': {u'name': u'updateTemplatePermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for featured template/iso, false otherwise'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template/iso is extractable, false other wise. Can be set only by root admin'}, {u'name': u'projectids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of projects. If specified, "op" parameter has to be passed in.'}, {u'name': u'op', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'permission operator (add, remove, reset)'}, {u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true for public template/iso, false for private templates/isos'}, {u'name': u'accounts', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'a comma delimited list of accounts. If specified, "op" parameter has to be passed in.'}], u'requiredparams': [u'id'], u'description': u'Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.'}, u'autoscalevmprofile': {u'name': u'updateAutoScaleVmProfile', u'related': [u'listAutoScaleVmProfiles'], u'isasync': True, u'params': [{u'name': u'expungevmgraceperiod', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time allowed for existing connections to get closed before a vm is destroyed'}, {u'name': u'autoscaleuserid', u'required': False, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the user used to launch and destroy the VMs'}, {u'name': u'templateid', u'required': False, u'related': [u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template of the auto deployed virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'counterparam', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'counterparam list. Example: counterparam[0].name=snmpcommunity&counterparam[0].value=public&counterparam[1].name=snmpport&counterparam[1].value=161'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm profile.'}, u'account': {u'name': u'updateAccount', u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain where the account exists'}, {u'name': u'networkdomain', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"Network domain for the account's networks; empty string will update domainName with NULL value"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the current account name'}, {u'name': u'accountdetails', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'details for account used to store specific parameters'}, {u'name': u'newname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'new name for the account'}], u'requiredparams': [u'newname'], u'description': u'Updates account information for the authenticated user'}, u'networkoffering': {u'name': u'updateNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the network offering, integer'}, {u'name': u'id', u'required': False, u'related': [u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the id of the network offering'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the display text of the network offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the network offering'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required for Guest Virtual network offering; Optional for Guest Direct network offering'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'update state for the network offering'}], u'requiredparams': [], u'description': u'Updates a network offering.'}, u'vpncustomergateway': {u'name': u'updateVpnCustomerGateway', u'related': [u'createVpnCustomerGateway'], u'isasync': True, u'params': [{u'name': u'ikelifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 1 VPN connection to the customer gateway, in seconds'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the gateway. If used with the account parameter returns the gateway associated with the account for the specified domain.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of this customer gateway'}, {u'name': u'id', u'required': True, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}, {u'name': u'esplifetime', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lifetime of phase 2 VPN connection to the customer gateway, in seconds'}, {u'name': u'ikepolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IKE policy of the customer gateway'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the gateway. Must be used with the domainId parameter.'}, {u'name': u'esppolicy', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'ESP policy of the customer gateway'}, {u'name': u'gateway', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'public ip address id of the customer gateway'}, {u'name': u'ipsecpsk', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'IPsec Preshared-Key of the customer gateway'}, {u'name': u'dpd', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If DPD is enabled for VPN connection'}, {u'name': u'cidrlist', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'guest cidr of the customer gateway'}], u'requiredparams': [u'id', u'ikepolicy', u'esppolicy', u'gateway', u'ipsecpsk', u'cidrlist'], u'description': u'Update site to site vpn customer gateway'}, u'region': {u'name': u'updateRegion', u'related': [u'addRegion', u'listRegions'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this name'}, {u'name': u'endpoint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'updates region with this end point'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Id of region to update'}], u'requiredparams': [u'id'], u'description': u'Updates a region'}, u'project': {u'name': u'updateProject', u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be modified'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'display text of the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'new Admin account for the project'}], u'requiredparams': [u'id'], u'description': u'Updates a project'}, u'physicalnetwork': {u'name': u'updatePhysicalNetwork', u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'isasync': True, u'params': [{u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the VLAN for the physical network'}, {u'name': u'id', u'required': True, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'physical network id'}, {u'name': u'networkspeed', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the speed for the physical network[1G/10G]'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'Tag the physical network'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled'}], u'requiredparams': [u'id'], u'description': u'Updates a physical network'}, u'iso': {u'name': u'updateIso', u'related': [u'listIsos'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the image file'}, {u'name': u'id', u'required': True, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the image file'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the image'}, {u'name': u'format', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the image'}, {u'name': u'sortkey', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'sort key of the template, integer'}, {u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS type that best represents the OS of this image.'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the image supports the password reset feature; default is false'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if image is bootable, false otherwise'}], u'requiredparams': [u'id'], u'description': u'Updates an ISO file.'}, u'networkserviceprovider': {u'name': u'updateNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Enabled/Disabled/Shutdown the physical network service provider'}, {u'name': u'id', u'required': True, u'related': [u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'network service provider id'}, {u'name': u'servicelist', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'the list of services to be enabled for this physical network service provider'}], u'requiredparams': [u'id'], u'description': u'Updates a network serviceProvider of a physical network'}, u'autoscalevmgroup': {u'name': u'updateAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'scaledownpolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaledown autoscale policies'}, {u'name': u'interval', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the frequency at which the conditions have to be evaluated'}, {u'name': u'minmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the minimum number of members in the vmgroup, the number of instances in the vm group will be equal to or more than this number.'}, {u'name': u'maxmembers', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the maximum number of members in the vmgroup, The number of instances in the vm group will be equal to or less than this number.'}, {u'name': u'id', u'required': True, u'related': [u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}, {u'name': u'scaleuppolicyids', u'required': False, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'list', u'description': u'list of scaleup autoscale policies'}], u'requiredparams': [u'id'], u'description': u'Updates an existing autoscale vm group.'}}, u'disable': {u'account': {u'name': u'disableAccount', u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'isasync': True, u'params': [{u'name': u'lock', u'required': True, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'If true, only lock the account; else disable the account'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Disables specified account.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'Disables specified account in this domain.'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'lock'], u'description': u'Disables an account'}, u'autoscalevmgroup': {u'name': u'disableAutoScaleVmGroup', u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Disables an AutoScale Vm Group'}, u'cisconexusvsm': {u'name': u'disableCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u'disable a Cisco Nexus VSM device'}, u'staticnat': {u'name': u'disableStaticNat', u'related': [], u'isasync': True, u'params': [{u'name': u'ipaddressid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id for which static nat feature is being disableed'}], u'requiredparams': [u'ipaddressid'], u'description': u'Disables static rule for given ip address'}, u'user': {u'name': u'disableUser', u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableUser', u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'Disables user by user ID.'}], u'requiredparams': [u'id'], u'description': u'Disables a user account'}}, u'detach': {u'volume': {u'name': u'detachVolume', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': False, u'related': [u'detachVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'deviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the device ID on the virtual machine where volume is detached from'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine where the volume is detached from'}], u'requiredparams': [], u'description': u'Detaches a disk volume from a virtual machine.'}, u'iso': {u'name': u'detachIso', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'virtualmachineid'], u'description': u'Detaches any ISO file (if any) currently attached to a virtual machine.'}}, u'generate': {u'usagerecords': {u'name': u'generateUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List events for the specified domain.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed'}}, u'change': {u'serviceforvirtualmachine': {u'name': u'changeServiceForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the virtual machine'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.'}, u'serviceforsystemvm': {u'name': u'changeServiceForSystemVm', u'related': [u'rebootSystemVm', u'listSystemVms'], u'isasync': False, u'params': [{u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the system vm'}, {u'name': u'id', u'required': True, u'related': [u'rebootSystemVm', u'listSystemVms', u'changeServiceForSystemVm'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the system vm'}], u'requiredparams': [u'serviceofferingid', u'id'], u'description': u'Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a "Stopped" state for this command to take effect.'}, u'serviceforrouter': {u'name': u'changeServiceForRouter', u'related': [u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'changeServiceForRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the router'}, {u'name': u'serviceofferingid', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings', u'createServiceOffering', u'updateServiceOffering'], u'length': 255, u'type': u'uuid', u'description': u'the service offering ID to apply to the domain router'}], u'requiredparams': [u'id', u'serviceofferingid'], u'description': u'Upgrades domain router to a new service offering'}}, u'reset': {u'apilimit': {u'name': u'resetApiLimit', u'related': [], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the acount whose limit to be reset'}], u'requiredparams': [], u'description': u'Reset api count'}, u'sshkeyforvirtualmachine': {u'name': u'resetSSHKeyForVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'keypair', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the ssh key pair used to login to the virtual machine'}, {u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'keypair', u'id'], u'description': u'Resets the SSH Key for virtual machine. The virtual machine must be in a "Stopped" state. [async]'}, u'passwordforvirtualmachine': {u'name': u'resetPasswordForVirtualMachine', u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the virtual machine'}], u'requiredparams': [u'id'], u'description': u'Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async]'}, u'vpnconnection': {u'name': u'resetVpnConnection', u'related': [u'listVpnConnections'], u'isasync': True, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for connection. Must be used with domainId.'}, {u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for connection. If the account parameter is used, domainId must also be used.'}], u'requiredparams': [u'id'], u'description': u'Reset site to site vpn connection'}}, u'register': {u'userkeys': {u'name': u'registerUserKeys', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers', u'enableUser', u'createUser'], u'length': 255, u'type': u'uuid', u'description': u'User id'}], u'requiredparams': [u'id'], u'description': u'This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user'}, u'iso': {u'name': u'registerIso', u'related': [u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'ostypeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this ISO'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the ISO'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is bootable. If not passed explicitly its assumed to be true'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'Register iso for the project'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to register the ISO to be publicly available to all users, false otherwise.'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone you wish to register the ISO to.'}, {u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the iso or its derivatives are extractable; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the ISO. This is usually used for display purposes.'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want this ISO to be featured'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL to where the ISO is currently being hosted'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account name. Must be used with domainId.'}], u'requiredparams': [u'name', u'zoneid', u'displaytext', u'url'], u'description': u'Registers an existing ISO into the CloudStack Cloud.'}, u'sshkeypair': {u'name': u'registerSSHKeyPair', u'related': [u'createSSHKeyPair', u'listSSHKeyPairs'], u'isasync': False, u'params': [{u'name': u'publickey', u'required': True, u'related': [], u'length': 5120, u'type': u'string', u'description': u'Public key material of the keypair'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the ssh key. If the account parameter is used, domainId must also be used.'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'an optional project for the ssh key'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the ssh key. Must be used with domainId.'}], u'requiredparams': [u'publickey', u'name'], u'description': u'Register a public key in a keypair under a certain name'}, u'template': {u'name': u'registerTemplate', u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'isextractable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template or its derivatives are extractable; default is false'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the template is to be hosted on'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this template'}, {u'name': u'templatetag', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the tag for this template.'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template is available to all accounts; default is true'}, {u'name': u'passwordenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the password reset feature; default is false'}, {u'name': u'displaytext', u'required': True, u'related': [], u'length': 4096, u'type': u'string', u'description': u'the display text of the template. This is usually used for display purposes.'}, {u'name': u'sshkeyenabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the template supports the sshkey upload feature; default is false'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'Register template for the project'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the template'}, {u'name': u'isfeatured', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template is a featured template, false otherwise'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the template. Possible values include QCOW2, RAW, and VHD.'}, {u'name': u'requireshvm', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this template requires HVM'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'ostypeid', u'required': True, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the OS Type that best represents the OS of this template.'}, {u'name': u'hypervisor', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the template is hosted. Possible URL include http:// and https://'}, {u'name': u'bits', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'32 or 64 bits support. 64 by default'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Template details in key/value pairs.'}], u'requiredparams': [u'zoneid', u'displaytext', u'name', u'format', u'ostypeid', u'hypervisor', u'url'], u'description': u'Registers an existing template into the CloudStack cloud. '}}, u'list': {u'instancegroups': {u'name': u'listInstanceGroups', u'related': [u'updateInstanceGroup', u'createInstanceGroup'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listInstanceGroups', u'updateInstanceGroup', u'createInstanceGroup'], u'length': 255, u'type': u'uuid', u'description': u'list instance groups by ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list instance groups by name'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists vm groups'}, u'physicalnetworks': {u'name': u'listPhysicalNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the physical network'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list physical network by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'search by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists physical networks'}, u'networks': {u'name': u'listNetworks', u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if network is system, false otherwise'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'acltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list networks by ACL (access control list) type. Supported values are Account and Domain'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only networks which support specifying ip ranges'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the network'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks by restartRequired'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of the network. Supported values are: Isolated and Shared'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'list networks by physical network id'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list networks supporting certain services'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'type of the traffic'}, {u'name': u'id', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list networks by id'}, {u'name': u'canusefordeploy', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list networks available for vm deployment'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network belongs to vpc'}], u'requiredparams': [], u'description': u'Lists all available networks.'}, u'capabilities': {u'name': u'listCapabilities', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'Lists capabilities'}, u'clusters': {u'name': u'listClusters', u'related': [u'updateCluster'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listClusters', u'updateCluster'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by the cluster ID'}, {u'name': u'managedstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'whether this cluster is managed by cloudstack'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by hypervisor type'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by allocation state'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Zone ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by the cluster name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clustertype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists clusters by cluster type'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the clusters'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists clusters by Pod ID'}], u'requiredparams': [], u'description': u'Lists clusters.'}, u'resourcelimits': {u'name': u'listResourceLimits', u'related': [u'updateResourceLimit'], u'isasync': False, u'params': [{u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. 1 - IP. Number of public IP addresses a user can own. 2 - Volume. Number of disk volumes a user can create.3 - Snapshot. Number of snapshots a user can create.4 - Template. Number of templates that a user can register/create.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'Lists resource limits by ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists resource limits.'}, u'firewallrules': {u'name': u'listFirewallRules', u'related': [u'createEgressFirewallRule', u'createFirewallRule', u'listEgressFirewallRules'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddressid', u'required': False, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all firewall rules for an IP address.'}, u'supportednetworkservices': {u'name': u'listSupportedNetworkServices', u'related': [], u'isasync': False, u'params': [{u'name': u'service', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service name to list providers and capabilities of'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'provider', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'network service provider name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all network services provided by CloudStack or for the given Provider.'}, u'loadbalancerrules': {u'name': u'listLoadBalancerRules', u'related': [u'createLoadBalancerRule', u'updateLoadBalancerRule'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine of the load balancer rule'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'publicipid', u'required': False, u'related': [u'restartNetwork', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'the public IP address id of the load balancer rule '}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the load balancer rule'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists load balancer rules.'}, u'autoscalepolicies': {u'name': u'listAutoScalePolicies', u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'isasync': False, u'params': [{u'name': u'action', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the action to be executed if all the conditions evaluate to true for the specified duration.'}, {u'name': u'id', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'vmgroupid', u'required': False, u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'conditionid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists autoscale policies.'}, u'niciranvpdevices': {u'name': u'listNiciraNvpDevices', u'related': [u'addNiciraNvpDevice'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': False, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists Nicira NVP devices'}, u'f5loadbalancernetworks': {u'name': u'listF5LoadBalancerNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer', u'addF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a F5 load balancer device'}, u'templatepermissions': {u'name': u'listTemplatePermissions', u'related': [u'listIsoPermissions'], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions', u'listTemplatePermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List template visibility and all accounts that have permissions to view this template.'}, u'projects': {u'name': u'listProjects', u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List projects by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list projects by project ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list projects by display text'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'systemvms': {u'name': u'listSystemVms', u'related': [u'rebootSystemVm'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the system VM'}, {u'name': u'hostid', u'required': False, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the system VM'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the system VM'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'storageid', u'required': False, u'related': [u'cancelStorageMaintenance'], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy" and "secondarystoragevm".'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the system VM'}, {u'name': u'id', u'required': False, u'related': [u'rebootSystemVm', u'listSystemVms'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the system VM'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the system VM'}], u'requiredparams': [], u'description': u'List system virtual machines.'}, u'portforwardingrules': {u'name': u'listPortForwardingRules', u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the port forwarding services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all port forwarding rules for an IP address.'}, u'hypervisors': {u'name': u'listHypervisors', u'related': [], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the zone id for listing hypervisors.'}], u'requiredparams': [], u'description': u'List hypervisors'}, u'publicipaddresses': {u'name': u'listPublicIpAddresses', u'related': [u'restartNetwork', u'associateIpAddress'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by Zone ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'allocatedonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'limits search results to allocated public IP addresses'}, {u'name': u'id', u'required': False, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'lists ip address by id'}, {u'name': u'forloadbalancing', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only ips used for load balancing'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isstaticnat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only static nat ip addresses'}, {u'name': u'issourcenat', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list only source nat ip addresses'}, {u'name': u'vlanid', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by VLAN ID'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists the specified IP address'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses by physical network id'}, {u'name': u'associatednetworkid', u'required': False, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'lists all public IP addresses associated to the network specified'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the virtual network for the IP address'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List ips belonging to the VPC'}], u'requiredparams': [], u'description': u'Lists all public ip addresses'}, u'vpngateways': {u'name': u'listVpnGateways', u'related': [u'createVpnGateway'], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'createVpnGateway', u'listVpnGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn gateway'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists site 2 site vpn gateways'}, u'loadbalancerruleinstances': {u'name': u'listLoadBalancerRuleInstances', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'applied', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if listing all virtual machines currently applied to the load balancer rule; default is true'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'List all virtual machine instances that are assigned to a load balancer rule.'}, u'hosts': {u'name': u'listHosts', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the host'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the host'}, {u'name': u'resourcestate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list hosts by resource state. Resource state represents current state determined by admin of host, valule can be one of [Enabled, Disabled, Unmanaged, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error]'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the host'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the host'}, {u'name': u'virtualmachineid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists hosts existing in particular cluster'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the host type'}, {u'name': u'id', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the id of the host'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [ min, all, capacity, events, stats]'}, {u'name': u'hahost', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only hosts dedicated to HA'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists hosts.'}, u'pools': {u'name': u'listPools', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Pool'}, u'counters': {u'name': u'listCounters', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'source', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Source of the counter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listCounters'], u'length': 255, u'type': u'uuid', u'description': u'ID of the Counter.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the counter.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the counters'}, u'configurations': {u'name': u'listConfigurations', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configuration by name'}, {u'name': u'category', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists configurations by category'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all configurations.'}, u'usagerecords': {u'name': u'listUsageRecords', u'related': [], u'isasync': False, u'params': [{u'name': u'enddate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.'}, {u'name': u'startdate', u'required': True, u'related': [], u'length': 255, u'type': u'date', u'description': u'Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List usage records for the specified usage type'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for specified project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List usage records for the specified user.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified domain.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accountid', u'required': False, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'List usage records for the specified account'}], u'requiredparams': [u'enddate', u'startdate'], u'description': u'Lists usage records for accounts'}, u'storagepools': {u'name': u'listStoragePools', u'related': [u'cancelStorageMaintenance'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID for the storage pool'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'path', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the storage pool path'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list storage pools belongig to the specific cluster'}, {u'name': u'id', u'required': False, u'related': [u'cancelStorageMaintenance', u'listStoragePools'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the storage pool'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the IP address for the storage pool'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the storage pool'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID for the storage pool'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists storage pools.'}, u'vpncustomergateways': {u'name': u'listVpnCustomerGateways', u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateVpnCustomerGateway', u'createVpnCustomerGateway', u'listVpnCustomerGateways'], u'length': 255, u'type': u'uuid', u'description': u'id of the customer gateway'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists site to site vpn customer gateways'}, u'zones': {u'name': u'listZones', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'available', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if you want to retrieve all available Zones. False if you only want to return the Zones from which you have at least one VM. Default is false.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the zone'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the zone'}, {u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the zones'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists zones'}, u'serviceofferings': {u'name': u'listServiceOfferings', u'related': [u'updateHypervisorCapabilities'], u'isasync': False, u'params': [{u'name': u'systemvmtype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the system VM type. Possible types are "consoleproxy", "secondarystoragevm" or "domainrouter".'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain associated with the service offering'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the service offering'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine. Pass this in if you want to see the available service offering that a virtual machine can be changed to.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'issystem', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'is this a system vm offering'}, {u'name': u'id', u'required': False, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the service offering'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available service offerings.'}, u'externalfirewalls': {u'name': u'listExternalFirewalls', u'related': [u'addExternalFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'listZones'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'zoneid'], u'description': u'List external firewall appliances.'}, u'networkserviceproviders': {u'name': u'listNetworkServiceProviders', u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by state'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list providers by name'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists network serviceproviders for a given physical network.'}, u'capacity': {u'name': u'listCapacity', u'related': [], u'isasync': False, u'params': [{u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'lists capacity by type* CAPACITY_TYPE_MEMORY = 0* CAPACITY_TYPE_CPU = 1* CAPACITY_TYPE_STORAGE = 2* CAPACITY_TYPE_STORAGE_ALLOCATED = 3* CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = 4* CAPACITY_TYPE_PRIVATE_IP = 5* CAPACITY_TYPE_SECONDARY_STORAGE = 6* CAPACITY_TYPE_VLAN = 7* CAPACITY_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 8* CAPACITY_TYPE_LOCAL_STORAGE = 9.'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Cluster ID'}, {u'name': u'sortby', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Sort the results. Available values: Usage'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fetchlatest', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'recalculate capacities and fetch the latest'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Zone ID'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'lists capacity by the Pod ID'}], u'requiredparams': [], u'description': u'Lists all the system wide capacities.'}, u'diskofferings': {u'name': u'listDiskOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the disk offering'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the domain of the disk offering.'}], u'requiredparams': [], u'description': u'Lists all available disk offerings.'}, u'lbstickinesspolicies': {u'name': u'listLBStickinessPolicies', u'related': [u'createLBStickinessPolicy'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbruleid', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'lbruleid'], u'description': u'Lists LBStickiness policies.'}, u'srxfirewallnetworks': {u'name': u'listSrxFirewallNetworks', u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'isasync': False, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using SRX firewall device'}, u'securitygroups': {u'name': u'listSecurityGroups', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'id', u'required': False, u'related': [u'listSecurityGroups'], u'length': 255, u'type': u'uuid', u'description': u'list the security group by the id provided'}, {u'name': u'securitygroupname', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists security groups by name'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'lists security groups by virtual machine id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists security groups'}, u'conditions': {u'name': u'listConditions', u'related': [u'listCounters', u'createCounter'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'ID of the Condition.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'counterid', u'required': False, u'related': [u'listConditions', u'listCounters', u'createCounter'], u'length': 255, u'type': u'uuid', u'description': u'Counter-id of the condition.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List Conditions for the specific user'}, u'swifts': {u'name': u'listSwifts', u'related': [u'addHost', u'updateHost', u'listHosts', u'listExternalLoadBalancers'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'the id of the swift'}], u'requiredparams': [], u'description': u'List Swift.'}, u'hypervisorcapabilities': {u'name': u'listHypervisorCapabilities', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listHypervisorCapabilities'], u'length': 255, u'type': u'uuid', u'description': u'ID of the hypervisor capability'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all hypervisor capabilities.'}, u'tags': {u'name': u'listTags', u'related': [], u'isasync': False, u'params': [{u'name': u'resourceid', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'resourcetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by resource type'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'key', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by key'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'customer', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by customer name'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'value', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by value'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'List resource tag(s)'}, u'routers': {u'name': u'listRouters', u'related': [u'changeServiceForRouter', u'stopRouter', u'destroyRouter', u'rebootRouter', u'startRouter'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the state of the router'}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'List networks by VPC'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the router'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'the host ID of the router'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the router'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the router'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'addNicToVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk router'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true is passed for this parameter, list only VPC routers'}], u'requiredparams': [], u'description': u'List routers.'}, u'traffictypes': {u'name': u'listTrafficTypes', u'related': [u'addNetworkServiceProvider', u'updateNetworkServiceProvider'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': True, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'physicalnetworkid'], u'description': u'Lists traffic types of a given physical network.'}, u'projectinvitations': {u'name': u'listProjectInvitations', u'related': [], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'activeonly', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'if true, list only active invitations - having Pending state and ones that are not timed out yet'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by project id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list invitations by state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'list invitations by id'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists projects and provides detailed information for listed projects'}, u'isos': {u'name': u'listIsos', u'related': [], u'isasync': False, u'params': [{u'name': u'bootable', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is bootable, false otherwise'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list all isos by name'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list ISO by id'}, {u'name': u'ispublic', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if the ISO is publicly available to all users, false otherwise.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isofilter', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isready', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if this ISO is ready to be deployed'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all available ISO files.'}, u'users': {u'name': u'listUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List user by the username'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.'}, {u'name': u'id', u'required': False, u'related': [u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'List user by ID.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List users by state of the user account.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists user accounts'}, u'sshkeypairs': {u'name': u'listSSHKeyPairs', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'fingerprint', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A public key fingerprint to look for'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A key pair name to look for'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}], u'requiredparams': [], u'description': u'List registered keypairs'}, u'privategateways': {u'name': u'listPrivateGateways', u'related': [u'createPrivateGateway'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'list private gateway by id'}, {u'name': u'ipaddress', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by ip address'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list gateways by vpc'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by state'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list gateways by vlan'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'List private gateways'}, u'usagetypes': {u'name': u'listUsageTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Usage Types'}, u'domainchildren': {u'name': u'listDomainChildren', u'related': [u'createDomain'], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list children domains by name'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list children domain by parent domain ID.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'to return the entire tree, use the value "true". To return the first level children, use the value "false".'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all children domains belonging to a specified domain'}, u'domains': {u'name': u'listDomains', u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'List domain by domain ID.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List domain by domain name.'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List domains by domain level.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}], u'requiredparams': [], u'description': u'Lists domains and provides detailed information for listed domains'}, u'externalloadbalancers': {u'name': u'listExternalLoadBalancers', u'related': [u'addHost', u'updateHost', u'listHosts'], u'isasync': False, u'params': [{u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists F5 external load balancer appliances added in a zone.'}, u'netscalerloadbalancers': {u'name': u'listNetscalerLoadBalancers', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'lists netscaler load balancer devices'}, u's3s': {u'name': u'listS3s', u'related': [u'addS3'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists S3s'}, u'bigswitchvnsdevices': {u'name': u'listBigSwitchVnsDevices', u'related': [u'addBigSwitchVnsDevice'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vnsdeviceid', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'bigswitch vns device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}], u'requiredparams': [], u'description': u'Lists BigSwitch Vns devices'}, u'accounts': {u'name': u'listAccounts', u'related': [u'markDefaultZoneForAccount', u'lockAccount'], u'isasync': False, u'params': [{u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts by state. Valid states are enabled, disabled, and locked.'}, {u'name': u'iscleanuprequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list accounts by cleanuprequred attribute (values are true or false)'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'accounttype', u'required': False, u'related': [], u'length': 255, u'type': u'long', u'description': u'list accounts by account type. Valid account types are 1 (admin), 2 (domain-admin), and 0 (user).'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'markDefaultZoneForAccount', u'listAccounts', u'lockAccount'], u'length': 255, u'type': u'uuid', u'description': u'list account by account ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list account by account name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [], u'description': u'Lists accounts and provides detailed account information for listed accounts'}, u'networkdevice': {u'name': u'listNetworkDevice', u'related': [u'addNetworkDevice'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'networkdevicetype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall'}, {u'name': u'networkdeviceparameterlist', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'parameters for network device'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List network devices'}, u'vlanipranges': {u'name': u'listVlanIpRanges', u'related': [], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'network id of the VLAN IP range'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID with which the VLAN IP range is associated. If used with the account parameter, returns all VLAN IP ranges for that account in the specified domain.'}, {u'name': u'id', u'required': False, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VLAN IP range'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks'], u'length': 255, u'type': u'uuid', u'description': u'physical network id of the VLAN IP range'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'project who will own the VLAN'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account with which the VLAN IP range is associated. Must be used with the domainId parameter.'}, {u'name': u'vlan', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the ID or VID of the VLAN. Default is an "untagged" VLAN.'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the Pod ID of the VLAN IP range'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Zone ID of the VLAN IP range'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if VLAN is of Virtual type, false if Direct'}], u'requiredparams': [], u'description': u'Lists all VLAN IP ranges.'}, u'traffictypeimplementors': {u'name': u'listTrafficTypeImplementors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'Optional. The network traffic type, if specified, return its implementor. Otherwise, return all traffic types with their implementor'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists implementors of implementor of a network traffic type or implementors of all network traffic types'}, u'storagenetworkiprange': {u'name': u'listStorageNetworkIpRange', u'related': [u'updateStorageNetworkIpRange'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Zone uuid, if specicied and both pod uuid and range uuid are absent, using it to search the range.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Storaget network IP range uuid, if specicied, using it to search the range.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'optional parameter. Pod uuid, if specicied and range uuid is absent, using it to search the range.'}], u'requiredparams': [], u'description': u'List a storage network IP range.'}, u'isopermissions': {u'name': u'listIsoPermissions', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsoPermissions'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}], u'requiredparams': [u'id'], u'description': u'List iso visibility and all accounts that have permissions to view this iso.'}, u'snapshotpolicies': {u'name': u'listSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': True, u'related': [u'detachVolume', u'uploadVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [u'volumeid'], u'description': u'Lists snapshot policies.'}, u'autoscalevmgroups': {u'name': u'listAutoScaleVmGroups', u'related': [u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'isasync': False, u'params': [{u'name': u'policyid', u'required': False, u'related': [u'createAutoScalePolicy', u'updateAutoScalePolicy', u'listAutoScalePolicies'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the policy'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'vmprofileid', u'required': False, u'related': [u'updateAutoScaleVmProfile', u'createAutoScaleVmProfile', u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the profile'}, {u'name': u'lbruleid', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the loadbalancer'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm group'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists autoscale vm groups.'}, u'projectaccounts': {u'name': u'listProjectAccounts', u'related': [u'createProject'], u'isasync': False, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts'], u'length': 255, u'type': u'uuid', u'description': u'id of the project'}, {u'name': u'role', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by role'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list accounts of the project by account name'}], u'requiredparams': [u'projectid'], u'description': u"Lists project's accounts"}, u'autoscalevmprofiles': {u'name': u'listAutoScaleVmProfiles', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale vm profile'}, {u'name': u'templateid', u'required': False, u'related': [u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the templateid of the autoscale vm profile'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'otherdeployparams', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the otherdeployparameters of the autoscale vm profile'}], u'requiredparams': [], u'description': u'Lists autoscale vm profiles.'}, u'apis': {u'name': u'listApis', u'related': [], u'isasync': False, u'params': [{u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'API name'}], u'requiredparams': [], u'description': u'lists all available apis on the server, provided by the Api Discovery plugin'}, u'vpcs': {u'name': u'listVPCs', u'related': [u'restartVPC'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'domainid', u'required': False, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by name of the VPC'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'cidr', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u"list by cidr of the VPC. All VPC guest networks' cidrs should be within this CIDR"}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'restartrequired', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list VPCs by restartRequired option'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPCs by state'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by display text of the VPC'}, {u'name': u'id', u'required': False, u'related': [u'restartVPC', u'listVPCs'], u'length': 255, u'type': u'uuid', u'description': u'list VPC by id'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by zone'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC supporting certain services'}, {u'name': u'vpcofferingid', u'required': False, u'related': [u'listVPCOfferings', u'createVPCOffering'], u'length': 255, u'type': u'uuid', u'description': u'list by ID of the VPC offering'}], u'requiredparams': [], u'description': u'Lists VPCs'}, u'f5loadbalancers': {u'name': u'listF5LoadBalancers', u'related': [u'configureF5LoadBalancer'], u'isasync': False, u'params': [{u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'updatePhysicalNetwork', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': False, u'related': [u'configureF5LoadBalancer', u'listF5LoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'f5 load balancer device ID'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'lists F5 load balancer devices'}, u'snapshots': {u'name': u'listSnapshots', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'id', u'required': False, u'related': [u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'lists snapshot by snapshot ID'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'intervaltype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are HOURLY, DAILY, WEEKLY, and MONTHLY.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'volumeid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'lists snapshot by snapshot name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'snapshottype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'valid values are MANUAL or RECURRING.'}], u'requiredparams': [], u'description': u'Lists all available snapshots for the account.'}, u'networkofferings': {u'name': u'listNetworkOfferings', u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'isasync': False, u'params': [{u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default network offerings. Default value is false'}, {u'name': u'sourcenatsupported', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only netwok offerings where source nat is supported, false otherwise'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list network offerings supporting certain services'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.'}, {u'name': u'specifyipranges', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only network offerings which support specifying ip ranges'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by name'}, {u'name': u'id', u'required': False, u'related': [u'listNetworkOfferings', u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'list network offerings by id'}, {u'name': u'specifyvlan', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the tags for the network offering.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list netowrk offerings available for network creation in specific zone'}, {u'name': u'forvpc', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'the network offering can be used only for network creation inside the VPC'}, {u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by traffic type'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'guestiptype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by guest type: Shared or Isolated'}, {u'name': u'istagged', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if offering has tags specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 4096, u'type': u'string', u'description': u'list network offerings by tags'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by display text'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network offerings by state'}, {u'name': u'availability', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the availability of network offering. Default value is Required'}], u'requiredparams': [], u'description': u'Lists all available network offerings.'}, u'virtualmachines': {u'name': u'listVirtualMachines', u'related': [], u'isasync': False, u'params': [{u'name': u'templateid', u'required': False, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'list vms by template'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list by network id'}, {u'name': u'storageid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u"the storage ID where vm's volumes belong to"}, {u'name': u'isoid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list vms by iso'}, {u'name': u'vpcid', u'required': False, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'list vms by vpc'}, {u'name': u'podid', u'required': False, u'related': [u'updatePod'], u'length': 255, u'type': u'uuid', u'description': u'the pod ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the virtual machine'}, {u'name': u'details', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the target hypervisor for the template'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'groupid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the group ID'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the availability zone ID'}, {u'name': u'hostid', u'required': False, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'id', u'required': False, u'related': [u'listVirtualMachines'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'forvirtualnetwork', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list by network type; true if need to list vms using Virtual Network, false otherwise'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'state of the virtual machine'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'List the virtual machines owned by the account.'}, u'netscalerloadbalancernetworks': {u'name': u'listNetscalerLoadBalancerNetworks', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'lbdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u'lists network that are using a netscaler load balancer device'}, u'oscategories': {u'name': u'listOsCategories', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list Os category by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os category by name'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists all supported OS categories for this cloud.'}, u'virtualrouterelements': {u'name': u'listVirtualRouterElements', u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'nspid', u'required': False, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by network service provider id'}, {u'name': u'id', u'required': False, u'related': [u'createVirtualRouterElement', u'configureVirtualRouterElement', u'listVirtualRouterElements'], u'length': 255, u'type': u'uuid', u'description': u'list virtual router elements by id'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'enabled', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'list network offerings by enabled state'}], u'requiredparams': [], u'description': u'Lists all available virtual router elements.'}, u'lunsonfiler': {u'name': u'listLunsOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List LUN'}, u'asyncjobs': {u'name': u'listAsyncJobs', u'related': [u'queryAsyncJobResult'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'tzdate', u'description': u'the start date of the async job'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}], u'requiredparams': [], u'description': u'Lists all pending asynchronous jobs for the account.'}, u'ostypes': {u'name': u'listOsTypes', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [u'listOsTypes'], u'length': 255, u'type': u'uuid', u'description': u'list by Os type Id'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'oscategoryid', u'required': False, u'related': [u'listOsCategories'], u'length': 255, u'type': u'uuid', u'description': u'list by Os Category id'}, {u'name': u'description', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list os by description'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all supported OS types for this cloud.'}, u'networkacls': {u'name': u'listNetworkACLs', u'related': [u'createNetworkACL'], u'isasync': False, u'params': [{u'name': u'traffictype', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list network ACLs by traffic type - Ingress or Egress'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'Lists network ACL with the specified ID.'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'networkid', u'required': False, u'related': [u'createNetwork', u'listNiciraNvpDeviceNetworks', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'length': 255, u'type': u'uuid', u'description': u'list network ACLs by network Id'}], u'requiredparams': [], u'description': u'Lists all network ACLs'}, u'volumesonfiler': {u'name': u'listVolumesOnFiler', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'List Volumes'}, u'eventtypes': {u'name': u'listEventTypes', u'related': [], u'isasync': False, u'params': [], u'requiredparams': [], u'description': u'List Event Types'}, u'remoteaccessvpns': {u'name': u'listRemoteAccessVpns', u'related': [u'createRemoteAccessVpn'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'publicipid', u'required': True, u'related': [u'restartNetwork', u'listPublicIpAddresses', u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}], u'requiredparams': [u'publicipid'], u'description': u'Lists remote access vpns'}, u'alerts': {u'name': u'listAlerts', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list by alert type'}, {u'name': u'id', u'required': False, u'related': [u'listAlerts'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the alert'}], u'requiredparams': [], u'description': u'Lists all alerts.'}, u'regions': {u'name': u'listRegions', u'related': [u'addRegion'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'List Region by region ID.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List Region by region name.'}], u'requiredparams': [], u'description': u'Lists Regions'}, u'vpcofferings': {u'name': u'listVPCOfferings', u'related': [], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVPCOfferings'], u'length': 255, u'type': u'uuid', u'description': u'list VPC offerings by id'}, {u'name': u'state', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by state'}, {u'name': u'supportedservices', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list VPC offerings supporting certain services'}, {u'name': u'displaytext', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by display text'}, {u'name': u'isdefault', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if need to list only default VPC offerings. Default value is false'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list VPC offerings by name'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists VPC offerings'}, u'niciranvpdevicenetworks': {u'name': u'listNiciraNvpDeviceNetworks', u'related': [u'createNetwork', u'updateNetwork', u'listF5LoadBalancerNetworks', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks', u'listNetworks'], u'isasync': False, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'nicira nvp device ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [u'nvpdeviceid'], u'description': u'lists network that are using a nicira nvp device'}, u'events': {u'name': u'listEvents', u'related': [], u'isasync': False, u'params': [{u'name': u'startdate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the start date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'enddate', u'required': False, u'related': [], u'length': 255, u'type': u'date', u'description': u'the end date range of the list you want to retrieve (use format "yyyy-MM-dd" or the new format "yyyy-MM-dd HH:mm:ss")'}, {u'name': u'duration', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the duration of the event'}, {u'name': u'id', u'required': False, u'related': [u'listEvents'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the event'}, {u'name': u'level', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event level (INFO, WARN, ERROR)'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'entrytime', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'the time the event was entered'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the event type (see event types)'}], u'requiredparams': [], u'description': u'A command to list events.'}, u'templates': {u'name': u'listTemplates', u'related': [u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'isasync': False, u'params': [{u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'templatefilter', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'possible values are "featured", "self", "selfexecutable","sharedexecutable","executable", and "community". * featured : templates that have been marked as featured and public. * self : templates that have been registered or created by the calling user. * selfexecutable : same as self, but only returns templates that can be used to deploy a new VM. * sharedexecutable : templates ready to be deployed that have been granted to the calling user by another user. * executable : templates that are owned by the calling user, or public templates, that can be used to deploy a VM. * community : templates that have been marked as public but not featured. * all : all templates (only usable by admins).'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listTemplates', u'registerIso', u'updateTemplate', u'prepareTemplate', u'copyIso', u'updateIso', u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the template ID'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the template name'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'hypervisor', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the hypervisor for which to restrict the search'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'list templates by zoneId'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [u'templatefilter'], u'description': u'List all public, private, and privileged templates.'}, u'cisconexusvsms': {u'name': u'listCiscoNexusVSMs', u'related': [u'disableCiscoNexusVSM', u'enableCiscoNexusVSM'], u'isasync': False, u'params': [{u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'clusterid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'Id of the CloudStack cluster in which the Cisco Nexus 1000v VSM appliance.'}], u'requiredparams': [], u'description': u'Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster'}, u'ipforwardingrules': {u'name': u'listIpForwardingRules', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'id', u'required': False, u'related': [u'listIpForwardingRules'], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'listVirtualMachines', u'destroyVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Lists all rules applied to the specified Vm.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list the rule belonging to this public ip address'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'List the ip forwarding rules'}, u'srxfirewalls': {u'name': u'listSrxFirewalls', u'related': [u'addSrxFirewall'], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'physicalnetworkid', u'required': False, u'related': [u'listPhysicalNetworks', u'createPhysicalNetwork'], u'length': 255, u'type': u'uuid', u'description': u'the Physical Network ID'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'fwdeviceid', u'required': False, u'related': [u'listSrxFirewalls', u'addSrxFirewall'], u'length': 255, u'type': u'uuid', u'description': u'SRX firewall device ID'}], u'requiredparams': [], u'description': u'lists SRX firewall devices in a physical network'}, u'vpnconnections': {u'name': u'listVpnConnections', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of vpc'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'id', u'required': False, u'related': [u'listVpnConnections'], u'length': 255, u'type': u'uuid', u'description': u'id of the vpn connection'}], u'requiredparams': [], u'description': u'Lists site to site vpn connection gateways'}, u'trafficmonitors': {u'name': u'listTrafficMonitors', u'related': [], u'isasync': False, u'params': [{u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'zoneid', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'zone Id'}], u'requiredparams': [u'zoneid'], u'description': u'List traffic monitor Hosts.'}, u'vpnusers': {u'name': u'listVpnUsers', u'related': [], u'isasync': False, u'params': [{u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'id', u'required': False, u'related': [u'listVpnUsers'], u'length': 255, u'type': u'uuid', u'description': u'The uuid of the Vpn user'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'username', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the username of the vpn user.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}], u'requiredparams': [], u'description': u'Lists vpn users'}, u'egressfirewallrules': {u'name': u'listEgressFirewallRules', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'networkid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id network network for the egress firwall services'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Lists rule with the specified ID.'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'ipaddressid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the id of IP address of the firwall services'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}], u'requiredparams': [], u'description': u'Lists all egress firewall rules for network id.'}, u'staticroutes': {u'name': u'listStaticRoutes', u'related': [u'createStaticRoute'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'gatewayid', u'required': False, u'related': [u'createPrivateGateway'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by gateway id'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'vpcid', u'required': False, u'related': [u'updateVPC', u'restartVPC', u'listVPCs', u'createVPC'], u'length': 255, u'type': u'uuid', u'description': u'list static routes by vpc id'}, {u'name': u'id', u'required': False, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'list static route by id'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}], u'requiredparams': [], u'description': u'Lists all static routes'}, u'volumes': {u'name': u'listVolumes', u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'uploadVolume', u'createVolume'], u'isasync': False, u'params': [{u'name': u'isrecursive', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the disk volume'}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'listProjects', u'suspendProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'list objects by project'}, {u'name': u'hostid', u'required': False, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addSecondaryStorage', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers', u'prepareHostForMaintenance'], u'length': 255, u'type': u'uuid', u'description': u'list volumes on specified host'}, {u'name': u'id', u'required': False, u'related': [u'migrateVolume', u'detachVolume', u'resizeVolume', u'attachVolume', u'listVolumes', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the disk volume'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'List resources by tags (key/value pairs)'}, {u'name': u'zoneid', u'required': False, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the availability zone'}, {u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'list only resources belonging to the domain specified'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list resources by account. Must be used with the domainId parameter.'}, {u'name': u'virtualmachineid', u'required': False, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'rebootVirtualMachine', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'attachIso', u'listLoadBalancerRuleInstances', u'deployVirtualMachine', u'detachIso', u'resetSSHKeyForVirtualMachine', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the virtual machine'}, {u'name': u'type', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the type of disk volume'}, {u'name': u'listall', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"}, {u'name': u'podid', u'required': False, u'related': [u'createPod', u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the pod id the disk volume belongs to'}], u'requiredparams': [], u'description': u'Lists all volumes.'}, u'pods': {u'name': u'listPods', u'related': [u'updatePod'], u'isasync': False, u'params': [{u'name': u'showcapacities', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'flag to display the capacity of the pods'}, {u'name': u'allocationstate', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list pods by allocation state'}, {u'name': u'pagesize', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'list Pods by Zone ID'}, {u'name': u'id', u'required': False, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'list Pods by ID'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'list Pods by name'}, {u'name': u'page', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u''}, {u'name': u'keyword', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'List by keyword'}], u'requiredparams': [], u'description': u'Lists all Pods.'}}, u'upload': {u'volume': {u'name': u'uploadVolume', u'related': [u'detachVolume'], u'isasync': True, u'params': [{u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the name of the volume'}, {u'name': u'format', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the format for the volume. Possible values include QCOW2, OVA, and VHD.'}, {u'name': u'url', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'the URL of where the volume is hosted. Possible URL include http:// and https://'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional accountName. Must be used with domainId.'}, {u'name': u'domainid', u'required': False, u'related': [u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId. If the account parameter is used, domainId must also be used.'}, {u'name': u'checksum', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the MD5 checksum value of this volume'}, {u'name': u'zoneid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone the volume is to be hosted on'}], u'requiredparams': [u'name', u'format', u'url', u'zoneid'], u'description': u'Uploads a data disk.'}, u'customcertificate': {u'name': u'uploadCustomCertificate', u'related': [], u'isasync': True, u'params': [{u'name': u'domainsuffix', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'DNS domain suffix that the certificate is granted for.'}, {u'name': u'certificate', u'required': True, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The certificate to be uploaded.'}, {u'name': u'privatekey', u'required': False, u'related': [], u'length': 65535, u'type': u'string', u'description': u'The private key for the attached certificate.'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'A name / alias for the certificate.'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'integer', u'description': u'An integer providing the location in a chain that the certificate will hold. Usually, this can be left empty. When creating a chain, the top level certificate should have an ID of 1, with each step in the chain incrementing by one. Example, CA with id = 1, Intermediate CA with id = 2, Site certificate with ID = 3'}], u'requiredparams': [u'domainsuffix', u'certificate'], u'description': u'Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.'}}, u'remove': {u'region': {u'name': u'removeRegion', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'integer', u'description': u'ID of the region to delete'}], u'requiredparams': [u'id'], u'description': u'Removes specified region'}, u'nicfromvirtualmachine': {u'name': u'removeNicFromVirtualMachine', u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': True, u'params': [{u'name': u'nicid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'NIC ID'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'startVirtualMachine', u'updateDefaultNicForVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'resetPasswordForVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'removeNicFromVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'Virtual Machine ID'}], u'requiredparams': [u'nicid', u'virtualmachineid'], u'description': u'Removes VM from specified network by deleting a NIC'}, u'fromloadbalancerrule': {u'name': u'removeFromLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIpForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the load balancer rule'}, {u'name': u'virtualmachineids', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)'}], u'requiredparams': [u'id', u'virtualmachineids'], u'description': u'Removes a virtual machine or a list of virtual machines from a load balancer rule.'}, u'vpnuser': {u'name': u'removeVpnUser', u'related': [], u'isasync': True, u'params': [{u'name': u'domainid', u'required': False, u'related': [u'updateDomain', u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.'}, {u'name': u'projectid', u'required': False, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'remove vpn user from the project'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'an optional account for the vpn user. Must be used with domainId.'}, {u'name': u'username', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'username for the vpn user'}], u'requiredparams': [u'username'], u'description': u'Removes vpn user'}}, u'asyncapis': [u'createCondition', u'reconnectHost', u'copyTemplate', u'deleteBigSwitchVnsDevice', u'addNicToVirtualMachine', u'extractVolume', u'addAccountToProject', u'deleteEgressFirewallRule', u'deleteCiscoNexusVSM', u'createVpnConnection', u'suspendProject', u'addF5LoadBalancer', u'deleteAutoScaleVmGroup', u'authorizeSecurityGroupIngress', u'addNetscalerLoadBalancer', u'deleteDomain', u'configureNetscalerLoadBalancer', u'disableAutoScaleVmGroup', u'authorizeSecurityGroupEgress', u'createTemplate', u'migrateVolume', u'updatePhysicalNetwork', u'prepareHostForMaintenance', u'deletePrivateGateway', u'deleteStaticRoute', u'deleteTrafficType', u'deleteLoadBalancerRule', u'attachIso', u'destroySystemVm', u'deletePortForwardingRule', u'enableStorageMaintenance', u'stopRouter', u'configureSrxFirewall', u'attachVolume', u'updateVPCOffering', u'resetSSHKeyForVirtualMachine', u'updateProjectInvitation', u'createTags', u'enableAutoScaleVmGroup', u'deleteTags', u'deleteAccountFromProject', u'removeVpnUser', u'updateVpnCustomerGateway', u'stopSystemVm', u'uploadCustomCertificate', u'restartNetwork', u'createAutoScaleVmProfile', u'rebootVirtualMachine', u'enableCiscoNexusVSM', u'cancelHostMaintenance', u'deleteStorageNetworkIpRange', u'deleteFirewallRule', u'deleteVpnConnection', u'startSystemVm', u'deleteF5LoadBalancer', u'deleteNiciraNvpDevice', u'updateProject', u'deleteNetwork', u'deleteProject', u'deleteNetscalerLoadBalancer', u'deleteIpForwardingRule', u'addTrafficType', u'disableUser', u'resizeVolume', u'configureVirtualRouterElement', u'createStaticRoute', u'deleteProjectInvitation', u'migrateSystemVm', u'activateProject', u'removeNicFromVirtualMachine', u'revokeSecurityGroupIngress', u'updateDefaultNicForVirtualMachine', u'disableStaticNat', u'createNetworkACL', u'createVPC', u'configureF5LoadBalancer', u'disassociateIpAddress', u'createIpForwardingRule', u'createVolume', u'resetPasswordForVirtualMachine', u'assignToLoadBalancerRule', u'startRouter', u'extractIso', u'deleteRemoteAccessVpn', u'resetVpnConnection', u'createRemoteAccessVpn', u'extractTemplate', u'startVirtualMachine', u'detachIso', u'updateVPC', u'deleteAccount', u'associateIpAddress', u'updateAutoScaleVmProfile', u'disableAccount', u'updatePortForwardingRule', u'migrateVirtualMachine', u'createStorageNetworkIpRange', u'cancelStorageMaintenance', u'deployVirtualMachine', u'removeFromLoadBalancerRule', u'revokeSecurityGroupEgress', u'deleteCondition', u'createPortForwardingRule', u'addVpnUser', u'createVPCOffering', u'createEgressFirewallRule', u'deleteLBStickinessPolicy', u'destroyRouter', u'createPrivateGateway', u'disableCiscoNexusVSM', u'deleteAutoScaleVmProfile', u'updateTrafficType', u'deleteSnapshot', u'createProject', u'createLoadBalancerRule', u'addSrxFirewall', u'addNiciraNvpDevice', u'createAutoScalePolicy', u'restoreVirtualMachine', u'copyIso', u'uploadVolume', u'createLBStickinessPolicy', u'stopVirtualMachine', u'createCounter', u'createSnapshot', u'destroyVirtualMachine', u'updateNetwork', u'deleteVpnGateway', u'createAutoScaleVmGroup', u'rebootRouter', u'deleteNetworkServiceProvider', u'deleteIso', u'createVpnCustomerGateway', u'createFirewallRule', u'deleteAutoScalePolicy', u'deleteSrxFirewall', u'addNetworkServiceProvider', u'rebootSystemVm', u'detachVolume', u'deleteNetworkACL', u'markDefaultZoneForAccount', u'deleteVPC', u'restartVPC', u'updateAutoScaleVmGroup', u'updateLoadBalancerRule', u'createPhysicalNetwork', u'deleteTemplate', u'deletePhysicalNetwork', u'deleteVpnCustomerGateway', u'deleteVPCOffering', u'createVirtualRouterElement', u'updateAutoScalePolicy', u'addBigSwitchVnsDevice', u'createVpnGateway', u'updateNetworkServiceProvider', u'deleteCounter', u'updateStorageNetworkIpRange'], u'assign': {u'toloadbalancerrule': {u'name': u'assignToLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'virtualmachineids', u'required': True, u'related': [u'startVirtualMachine', u'updateVirtualMachine', u'stopVirtualMachine', u'recoverVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'migrateVirtualMachine', u'changeServiceForVirtualMachine', u'deployVirtualMachine', u'detachIso', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'list', u'description': u'the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)'}, {u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'virtualmachineids', u'id'], u'description': u'Assigns virtual machine or a list of virtual machines to a load balancer rule.'}, u'virtualmachine': {u'name': u'assignVirtualMachine', u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'isasync': False, u'params': [{u'name': u'networkids', u'required': False, u'related': [u'updateNetwork', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'list', u'description': u'list of new network ids in which the moved VM will participate. In case no network ids are provided the VM will be part of the default network for that zone. In case there is no network yet created for the new account the default network will be created.'}, {u'name': u'domainid', u'required': True, u'related': [u'listDomainChildren', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'domain id of the new VM owner.'}, {u'name': u'securitygroupids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of security group ids to be applied on the virtual machine. In case no security groups are provided the VM is part of the default security group.'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'account name of the new VM owner.'}, {u'name': u'virtualmachineid', u'required': True, u'related': [u'updateVirtualMachine', u'stopVirtualMachine', u'assignVirtualMachine', u'listVirtualMachines', u'destroyVirtualMachine', u'restoreVirtualMachine'], u'length': 255, u'type': u'uuid', u'description': u'id of the VM to be moved'}], u'requiredparams': [u'domainid', u'account', u'virtualmachineid'], u'description': u'Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.'}}, u'delete': {u'loadbalancerrule': {u'name': u'deleteLoadBalancerRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the load balancer rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a load balancer rule.'}, u'domain': {u'name': u'deleteDomain', u'related': [], u'isasync': True, u'params': [{u'name': u'cleanup', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise'}, {u'name': u'id', u'required': True, u'related': [u'updateDomain', u'listDomainChildren', u'listDomains', u'createDomain'], u'length': 255, u'type': u'uuid', u'description': u'ID of domain to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes a specified domain'}, u'instancegroup': {u'name': u'deleteInstanceGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the instance group'}], u'requiredparams': [u'id'], u'description': u'Deletes a vm group'}, u'diskoffering': {u'name': u'deleteDiskOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateDiskOffering', u'createDiskOffering', u'listDiskOfferings'], u'length': 255, u'type': u'uuid', u'description': u'ID of the disk offering'}], u'requiredparams': [u'id'], u'description': u'Updates a disk offering.'}, u'externalloadbalancer': {u'name': u'deleteExternalLoadBalancer', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listSwifts', u'addHost', u'cancelHostMaintenance', u'addBaremetalHost', u'updateHost', u'addSwift', u'listHosts', u'listExternalLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external loadbalancer appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes a F5 external load balancer appliance added in a zone.'}, u'securitygroup': {u'name': u'deleteSecurityGroup', u'related': [], u'isasync': False, u'params': [{u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID of account owning the security group'}, {u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'The ID of the security group. Mutually exclusive with name parameter'}, {u'name': u'name', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'The ID of the security group. Mutually exclusive with id parameter'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account of the security group. Must be specified with domain ID'}, {u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project of the security group'}], u'requiredparams': [], u'description': u'Deletes security group'}, u'portforwardingrule': {u'name': u'deletePortForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the port forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a port forwarding rule'}, u'cluster': {u'name': u'deleteCluster', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the cluster ID'}], u'requiredparams': [u'id'], u'description': u'Deletes a cluster.'}, u'accountfromproject': {u'name': u'deleteAccountFromProject', u'related': [], u'isasync': True, u'params': [{u'name': u'projectid', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject', u'updateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to remove the account from'}, {u'name': u'account', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'name of the account to be removed from the project'}], u'requiredparams': [u'projectid', u'account'], u'description': u'Deletes account from the project'}, u'networkdevice': {u'name': u'deleteNetworkDevice', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'addHost', u'updateHost', u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of network device to delete'}], u'requiredparams': [u'id'], u'description': u'Deletes network device.'}, u'firewallrule': {u'name': u'deleteFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes a firewall rule'}, u'pod': {u'name': u'deletePod', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePod', u'listPods'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Pod'}], u'requiredparams': [u'id'], u'description': u'Deletes a Pod.'}, u'ipforwardingrule': {u'name': u'deleteIpForwardingRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the id of the forwarding rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ip forwarding rule'}, u'vpnconnection': {u'name': u'deleteVpnConnection', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVpnConnections', u'resetVpnConnection'], u'length': 255, u'type': u'uuid', u'description': u'id of vpn connection'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn connection'}, u'lbstickinesspolicy': {u'name': u'deleteLBStickinessPolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createLBStickinessPolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the LB stickiness policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a LB stickiness policy.'}, u'vpcoffering': {u'name': u'deleteVPCOffering', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC offering'}], u'requiredparams': [u'id'], u'description': u'Deletes VPC offering'}, u'network': {u'name': u'deleteNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateNetwork', u'listSrxFirewallNetworks', u'listNetscalerLoadBalancerNetworks'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network'}], u'requiredparams': [u'id'], u'description': u'Deletes a network'}, u'zone': {u'name': u'deleteZone', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateZone', u'listZones', u'createZone'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Zone'}], u'requiredparams': [u'id'], u'description': u'Deletes a Zone.'}, u'remoteaccessvpn': {u'name': u'deleteRemoteAccessVpn', u'related': [], u'isasync': True, u'params': [{u'name': u'publicipid', u'required': True, u'related': [u'associateIpAddress'], u'length': 255, u'type': u'uuid', u'description': u'public ip address id of the vpn server'}], u'requiredparams': [u'publicipid'], u'description': u'Destroys a l2tp/ipsec remote access vpn'}, u'storagenetworkiprange': {u'name': u'deleteStorageNetworkIpRange', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listStorageNetworkIpRange', u'createStorageNetworkIpRange', u'updateStorageNetworkIpRange'], u'length': 255, u'type': u'uuid', u'description': u'the uuid of the storage network ip range'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage network IP Range.'}, u'bigswitchvnsdevice': {u'name': u'deleteBigSwitchVnsDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'vnsdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'long', u'description': u'BigSwitch device ID'}], u'requiredparams': [u'vnsdeviceid'], u'description': u' delete a bigswitch vns device'}, u'projectinvitation': {u'name': u'deleteProjectInvitation', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listProjectInvitations'], u'length': 255, u'type': u'uuid', u'description': u'id of the invitation'}], u'requiredparams': [u'id'], u'description': u'Accepts or declines project invitation'}, u'autoscalepolicy': {u'name': u'deleteAutoScalePolicy', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateAutoScalePolicy'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale policy'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale policy.'}, u'niciranvpdevice': {u'name': u'deleteNiciraNvpDevice', u'related': [], u'isasync': True, u'params': [{u'name': u'nvpdeviceid', u'required': True, u'related': [u'addNiciraNvpDevice', u'listNiciraNvpDevices'], u'length': 255, u'type': u'uuid', u'description': u'Nicira device ID'}], u'requiredparams': [u'nvpdeviceid'], u'description': u' delete a nicira nvp device'}, u'serviceoffering': {u'name': u'deleteServiceOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'updateHypervisorCapabilities', u'listServiceOfferings'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the service offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a service offering.'}, u'condition': {u'name': u'deleteCondition', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the condition.'}], u'requiredparams': [u'id'], u'description': u'Removes a condition'}, u'storagepool': {u'name': u'deleteStoragePool', u'related': [], u'isasync': False, u'params': [{u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy storage pool (force expunge volumes in Destroyed state as a part of pool removal)'}, {u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'Storage pool id'}], u'requiredparams': [u'id'], u'description': u'Deletes a storage pool.'}, u'vpngateway': {u'name': u'deleteVpnGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createVpnGateway'], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn gateway'}, u'snapshot': {u'name': u'deleteSnapshot', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createSnapshot', u'listSnapshots'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the snapshot'}], u'requiredparams': [u'id'], u'description': u'Deletes a snapshot of a disk volume.'}, u'autoscalevmgroup': {u'name': u'deleteAutoScaleVmGroup', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmGroups', u'createAutoScaleVmGroup', u'disableAutoScaleVmGroup', u'enableAutoScaleVmGroup', u'updateAutoScaleVmGroup'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale group'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm group.'}, u'trafficmonitor': {u'name': u'deleteTrafficMonitor', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Traffic Monitor Host.'}], u'requiredparams': [u'id'], u'description': u'Deletes an traffic monitor host.'}, u'networkacl': {u'name': u'deleteNetworkACL', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network ACL'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network ACL'}, u'template': {u'name': u'deleteTemplate', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the template'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of zone of the template'}], u'requiredparams': [u'id'], u'description': u'Deletes a template from the system. All virtual machines using the deleted template will not be affected.'}, u'tags': {u'name': u'deleteTags', u'related': [], u'isasync': True, u'params': [{u'name': u'resourceids', u'required': True, u'related': [], u'length': 255, u'type': u'list', u'description': u'Delete tags for resource id(s)'}, {u'name': u'tags', u'required': False, u'related': [], u'length': 255, u'type': u'map', u'description': u'Delete tags matching key/value pairs'}, {u'name': u'resourcetype', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Delete tag by resource type'}], u'requiredparams': [u'resourceids', u'resourcetype'], u'description': u'Deleting resource tag(s)'}, u'snapshotpolicies': {u'name': u'deleteSnapshotPolicies', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the Id of the snapshot policy'}, {u'name': u'ids', u'required': False, u'related': [], u'length': 255, u'type': u'list', u'description': u'list of snapshots policy IDs separated by comma'}], u'requiredparams': [], u'description': u'Deletes snapshot policies for the account.'}, u'privategateway': {u'name': u'deletePrivateGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createPrivateGateway', u'listPrivateGateways'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the private gateway'}], u'requiredparams': [u'id'], u'description': u'Deletes a Private gateway'}, u'traffictype': {u'name': u'deleteTrafficType', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addTrafficType', u'updateTrafficType'], u'length': 255, u'type': u'uuid', u'description': u'traffic type id'}], u'requiredparams': [u'id'], u'description': u'Deletes traffic type of a physical network'}, u'host': {u'name': u'deleteHost', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the host ID'}, {u'name': u'forcedestroylocalstorage', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force destroy local storage on this host. All VMs created on this local storage will be destroyed'}, {u'name': u'forced', u'required': False, u'related': [], u'length': 255, u'type': u'boolean', u'description': u'Force delete the host. All HA enabled vms running on the host will be put to HA; HA disabled ones will be stopped'}], u'requiredparams': [u'id'], u'description': u'Deletes a host.'}, u'staticroute': {u'name': u'deleteStaticRoute', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createStaticRoute', u'listStaticRoutes'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the static route'}], u'requiredparams': [u'id'], u'description': u'Deletes a static route'}, u'vpc': {u'name': u'deleteVPC', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'restartVPC'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the VPC'}], u'requiredparams': [u'id'], u'description': u'Deletes a VPC'}, u'srxfirewall': {u'name': u'deleteSrxFirewall', u'related': [], u'isasync': True, u'params': [{u'name': u'fwdeviceid', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'srx firewall device ID'}], u'requiredparams': [u'fwdeviceid'], u'description': u' delete a SRX firewall device'}, u'externalfirewall': {u'name': u'deleteExternalFirewall', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listHosts'], u'length': 255, u'type': u'uuid', u'description': u'Id of the external firewall appliance.'}], u'requiredparams': [u'id'], u'description': u'Deletes an external firewall appliance.'}, u'pool': {u'name': u'deletePool', u'related': [], u'isasync': False, u'params': [{u'name': u'poolname', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'pool name.'}], u'requiredparams': [u'poolname'], u'description': u'Delete a pool'}, u'autoscalevmprofile': {u'name': u'deleteAutoScaleVmProfile', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listAutoScaleVmProfiles'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the autoscale profile'}], u'requiredparams': [u'id'], u'description': u'Deletes a autoscale vm profile.'}, u'volume': {u'name': u'deleteVolume', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'detachVolume', u'resizeVolume', u'uploadVolume', u'createVolume'], u'length': 255, u'type': u'uuid', u'description': u'The ID of the disk volume'}], u'requiredparams': [u'id'], u'description': u'Deletes a detached disk volume.'}, u'account': {u'name': u'deleteAccount', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'markDefaultZoneForAccount', u'updateAccount', u'listAccounts', u'lockAccount', u'disableAccount'], u'length': 255, u'type': u'uuid', u'description': u'Account id'}], u'requiredparams': [u'id'], u'description': u'Deletes a account, and all users associated with this account'}, u'cisconexusvsm': {u'name': u'deleteCiscoNexusVSM', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'disableCiscoNexusVSM', u'listCiscoNexusVSMs', u'enableCiscoNexusVSM'], u'length': 255, u'type': u'uuid', u'description': u'Id of the Cisco Nexus 1000v VSM device to be deleted'}], u'requiredparams': [u'id'], u'description': u' delete a Cisco Nexus VSM device'}, u'netscalerloadbalancer': {u'name': u'deleteNetscalerLoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'listNetscalerLoadBalancers'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a netscaler load balancer device'}, u'networkoffering': {u'name': u'deleteNetworkOffering', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'createNetworkOffering', u'updateNetworkOffering'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network offering'}], u'requiredparams': [u'id'], u'description': u'Deletes a network offering.'}, u'vpncustomergateway': {u'name': u'deleteVpnCustomerGateway', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'id of customer gateway'}], u'requiredparams': [u'id'], u'description': u'Delete site to site vpn customer gateway'}, u'counter': {u'name': u'deleteCounter', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the counter'}], u'requiredparams': [u'id'], u'description': u'Deletes a counter'}, u'physicalnetwork': {u'name': u'deletePhysicalNetwork', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the Physical network'}], u'requiredparams': [u'id'], u'description': u'Deletes a Physical Network.'}, u'project': {u'name': u'deleteProject', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'createProject', u'listProjectAccounts', u'activateProject'], u'length': 255, u'type': u'uuid', u'description': u'id of the project to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a project'}, u'vlaniprange': {u'name': u'deleteVlanIpRange', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'listVlanIpRanges'], u'length': 255, u'type': u'uuid', u'description': u'the id of the VLAN IP range'}], u'requiredparams': [u'id'], u'description': u'Creates a VLAN IP range.'}, u'f5loadbalancer': {u'name': u'deleteF5LoadBalancer', u'related': [], u'isasync': True, u'params': [{u'name': u'lbdeviceid', u'required': True, u'related': [u'configureF5LoadBalancer'], u'length': 255, u'type': u'uuid', u'description': u'netscaler load balancer device ID'}], u'requiredparams': [u'lbdeviceid'], u'description': u' delete a F5 load balancer device'}, u'iso': {u'name': u'deleteIso', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'listIsos'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the ISO file'}, {u'name': u'zoneid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones'}], u'requiredparams': [u'id'], u'description': u'Deletes an ISO file.'}, u'egressfirewallrule': {u'name': u'deleteEgressFirewallRule', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'updatePortForwardingRule', u'listIpForwardingRules', u'createIpForwardingRule', u'listPortForwardingRules', u'createPortForwardingRule'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the firewall rule'}], u'requiredparams': [u'id'], u'description': u'Deletes an ggress firewall rule'}, u'networkserviceprovider': {u'name': u'deleteNetworkServiceProvider', u'related': [], u'isasync': True, u'params': [{u'name': u'id', u'required': True, u'related': [u'addNetworkServiceProvider', u'listTrafficTypes', u'updateNetworkServiceProvider'], u'length': 255, u'type': u'uuid', u'description': u'the ID of the network service provider'}], u'requiredparams': [u'id'], u'description': u'Deletes a Network Service Provider.'}, u'sshkeypair': {u'name': u'deleteSSHKeyPair', u'related': [], u'isasync': False, u'params': [{u'name': u'projectid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the project associated with keypair'}, {u'name': u'domainid', u'required': False, u'related': [], u'length': 255, u'type': u'uuid', u'description': u'the domain ID associated with the keypair'}, {u'name': u'name', u'required': True, u'related': [], u'length': 255, u'type': u'string', u'description': u'Name of the keypair'}, {u'name': u'account', u'required': False, u'related': [], u'length': 255, u'type': u'string', u'description': u'the account associated with the keypair. Must be used with the domainId parameter.'}], u'requiredparams': [u'name'], u'description': u'Deletes a keypair by name'}, u'user': {u'name': u'deleteUser', u'related': [], u'isasync': False, u'params': [{u'name': u'id', u'required': True, u'related': [u'lockUser', u'listUsers'], u'length': 255, u'type': u'uuid', u'description': u'id of the user to be deleted'}], u'requiredparams': [u'id'], u'description': u'Deletes a user for an account'}}} diff --git a/tools/ngui/static/bootstrap/img/glyphicons-halflings-white.png b/tools/ngui/static/bootstrap/img/glyphicons-halflings-white.png index 3bf6484a29d8..484e020c0ac5 100644 Binary files a/tools/ngui/static/bootstrap/img/glyphicons-halflings-white.png and b/tools/ngui/static/bootstrap/img/glyphicons-halflings-white.png differ diff --git a/tools/ngui/static/bootstrap/img/glyphicons-halflings.png b/tools/ngui/static/bootstrap/img/glyphicons-halflings.png index a9969993201f..b794a671407e 100644 Binary files a/tools/ngui/static/bootstrap/img/glyphicons-halflings.png and b/tools/ngui/static/bootstrap/img/glyphicons-halflings.png differ diff --git a/tools/ngui/templates/index.html b/tools/ngui/templates/index.html index 1dab6555d653..661a8f439990 100644 --- a/tools/ngui/templates/index.html +++ b/tools/ngui/templates/index.html @@ -1,19 +1,23 @@ -#Licensed to the Apache Software Foundation (ASF) under one -#or more contributor license agreements. See the NOTICE file -#distributed with this work for additional information -#regarding copyright ownership. The ASF licenses this file -#to you 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. + + + @@ -102,41 +106,41 @@

    CloudStack UI using Angular.js and Twitter Bootstrap

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/pom.xml b/tools/pom.xml index 6e06bcd1649b..00f055a42d4a 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -25,7 +25,7 @@ org.apache.cloudstack cloudstack - 4.21.0.0-SNAPSHOT + 4.23.0.0-SNAPSHOT ../pom.xml diff --git a/tools/utils/cloud-image-downloader.sh b/tools/utils/cloud-image-downloader.sh new file mode 100755 index 000000000000..90f234906e1a --- /dev/null +++ b/tools/utils/cloud-image-downloader.sh @@ -0,0 +1,259 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +#------------------------------------------------------------------------------- +# Configuration +#------------------------------------------------------------------------------- +# This section contains the variables you might want to change. + +# The temporary directory where files will be downloaded. +# It's a good practice to create a unique temporary directory for each script run. +TEMP_DIR=$(mktemp -d) + +# The BASE destination directory for the downloaded image files. +# Subdirectories for each distro will be created inside this one. +# Make sure this directory exists before running the script. +# Must be executed by the cloudstack user on machine hosting the public download site. +# It will be publicly available at https://download.cloudstack.org/templates/cloud-images/ +DEST_DIR="${HOME}/repository/templates/cloud-images" + +# The directory where log files will be stored. +# Make sure this directory exists. +LOG_DIR="${HOME}/log/cloud-image-downloader" +LOG_FILE="${LOG_DIR}/cloud-image-downloader_$(date +%Y%m%d_%H%M%S).log" +LOG_RETENTION_DAYS=30 + +LOGGER_TAG="cloud-image-downloader" +LOGGER_FACILITY="user" +LOGGER_AVAILABLE=false + +log_message() { + local priority=$1 + shift + local message="$*" + local timestamp=$(date +'%Y-%m-%d %H:%M:%S') + + # Log to file + echo "${timestamp} [${priority}] ${message}" | tee -a "${LOG_FILE}" + + # Log to syslog using logger utility + if [ "${LOGGER_AVAILABLE}" = true ]; then + logger -t "${LOGGER_TAG}" -p "${LOGGER_FACILITY}.${priority}" -- "${message}" + fi +} + +log_info() { + log_message "info" "$@" +} + +log_warn() { + log_message "warning" "$@" +} + +log_error() { + log_message "err" "$@" +} + +cleanup_old_logs() { + log_info "Cleaning up log files older than ${LOG_RETENTION_DAYS} days..." + + if [ ! -d "$LOG_DIR" ]; then + log_warn "Log directory does not exist: $LOG_DIR" + return + fi + + local deleted_count=0 + + # Find and delete log files older than retention period + while IFS= read -r -d '' log_file; do + rm -f "$log_file" + deleted_count=$((deleted_count + 1)) + done < <(find "$LOG_DIR" -name "*.log" -type f -mtime +${LOG_RETENTION_DAYS} -print0 2>/dev/null) + + if [ $deleted_count -gt 0 ]; then + log_info "Deleted $deleted_count old log file(s)" + else + log_info "No old log files to delete" + fi +} + +#------------------------------------------------------------------------------- +# Image Definitions +#------------------------------------------------------------------------------- +# To add a new image, you must add an entry to BOTH arrays below. + +# 1. Add the destination filename and the download URL. +declare -A IMAGE_URLS=( + ["Rocky-9-GenericCloud.latest.x86_64.qcow2"]="https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2" + ["Rocky-9-GenericCloud.latest.aarch64.qcow2"]="https://dl.rockylinux.org/pub/rocky/9/images/aarch64/Rocky-9-GenericCloud.latest.aarch64.qcow2" + ["Rocky-8-GenericCloud.latest.x86_64.qcow2"]="https://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-GenericCloud.latest.x86_64.qcow2" + ["Rocky-8-GenericCloud.latest.aarch64.qcow2"]="https://dl.rockylinux.org/pub/rocky/8/images/aarch64/Rocky-8-GenericCloud.latest.aarch64.qcow2" + ["openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2"]="https://download.opensuse.org/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2" + ["openSUSE-Leap-15.5-Minimal-VM.aarch64-Cloud.qcow2"]="https://download.opensuse.org/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.aarch64-Cloud.qcow2" + ["debian-12-genericcloud-amd64.qcow2"]="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2" + ["debian-12-genericcloud-arm64.qcow2"]="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-arm64.qcow2" + ["ubuntu-24.04-server-cloudimg-amd64.img"]="https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img" + ["ubuntu-24.04-server-cloudimg-arm64.img"]="https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img" + ["ubuntu-22.04-server-cloudimg-amd64.img"]="https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img" + ["ubuntu-22.04-server-cloudimg-arm64.img"]="https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img" + ["ubuntu-20.04-server-cloudimg-amd64.img"]="https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img" + ["ubuntu-20.04-server-cloudimg-arm64.img"]="https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-arm64.img" + ["OL9U5_x86_64-kvm-b259.qcow2"]="https://yum.oracle.com/templates/OracleLinux/OL9/u5/x86_64/OL9U5_x86_64-kvm-b259.qcow2" + ["OL9U5_aarch64-kvm-b126.qcow2"]="https://yum.oracle.com/templates/OracleLinux/OL9/u5/aarch64/OL9U5_aarch64-kvm-b126.qcow2" + ["OL8U10_x86_64-kvm-b258.qcow2"]="https://yum.oracle.com/templates/OracleLinux/OL8/u10/x86_64/OL8U10_x86_64-kvm-b258.qcow2" + ["OL8U10_aarch64-kvm-b122.qcow2"]="https://yum.oracle.com/templates/OracleLinux/OL8/u10/aarch64/OL8U10_aarch64-kvm-b122.qcow2" +) + +# 2. Add the destination filename and its corresponding distribution subdirectory name. +declare -A IMAGE_DISTROS=( + ["Rocky-9-GenericCloud.latest.x86_64.qcow2"]="rockylinux" + ["Rocky-9-GenericCloud.latest.aarch64.qcow2"]="rockylinux" + ["Rocky-8-GenericCloud.latest.x86_64.qcow2"]="rockylinux" + ["Rocky-8-GenericCloud.latest.aarch64.qcow2"]="rockylinux" + ["openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2"]="opensuse" + ["openSUSE-Leap-15.5-Minimal-VM.aarch64-Cloud.qcow2"]="opensuse" + ["debian-12-genericcloud-amd64.qcow2"]="debian" + ["debian-12-genericcloud-arm64.qcow2"]="debian" + ["ubuntu-24.04-server-cloudimg-amd64.img"]="ubuntu" + ["ubuntu-24.04-server-cloudimg-arm64.img"]="ubuntu" + ["ubuntu-22.04-server-cloudimg-amd64.img"]="ubuntu" + ["ubuntu-22.04-server-cloudimg-arm64.img"]="ubuntu" + ["ubuntu-20.04-server-cloudimg-amd64.img"]="ubuntu" + ["ubuntu-20.04-server-cloudimg-arm64.img"]="ubuntu" + ["OL9U5_x86_64-kvm-b259.qcow2"]="oraclelinux" + ["OL9U5_aarch64-kvm-b126.qcow2"]="oraclelinux" + ["OL8U10_x86_64-kvm-b258.qcow2"]="oraclelinux" + ["OL8U10_aarch64-kvm-b122.qcow2"]="oraclelinux" +) + +#------------------------------------------------------------------------------- +# Cleanup Handler +#------------------------------------------------------------------------------- + +cleanup_on_exit() { + local exit_code=$? + if [ -d "$TEMP_DIR" ]; then + rm -rf "$TEMP_DIR" + log_info "Temporary directory $TEMP_DIR removed." + fi + + if [ $exit_code -ne 0 ]; then + log_error "Script exited with error code: $exit_code" + fi +} + +trap cleanup_on_exit EXIT INT TERM + +#------------------------------------------------------------------------------- +# Main Script Logic +#------------------------------------------------------------------------------- + +if command -v logger &> /dev/null; then + LOGGER_AVAILABLE=true +fi + +# Ensure base destination and log directories exist +mkdir -p "$DEST_DIR" +mkdir -p "$LOG_DIR" + +# Clean up old logs first +cleanup_old_logs + +log_info "Starting image download process." +log_info "Temporary directory: $TEMP_DIR" +log_info "Base destination directory: $DEST_DIR" +log_info "Log file: $LOG_FILE" + +# Inform about logger status +if [ "${LOGGER_AVAILABLE}" = true ]; then + log_info "Syslog logging enabled (tag: ${LOGGER_TAG})" +else + log_warn "Syslog logging disabled - logger utility not found" +fi + +# Loop through the image URLs +for filename in "${!IMAGE_URLS[@]}"; do + url="${IMAGE_URLS[$filename]}" + distro="${IMAGE_DISTROS[$filename]}" + + # Check if a distro is defined for the file + if [ -z "$distro" ]; then + log_error "No distribution directory defined for $filename. Skipping." + continue + fi + + distro_dest_dir="${DEST_DIR}/${distro}" + temp_filepath="${TEMP_DIR}/${filename}" + dest_filepath="${distro_dest_dir}/${filename}" + + log_info "--------------------------------------------------" + log_info "Starting download for: $filename" + log_info "URL: $url" + + # Download the file to the temporary directory + wget --progress=bar:force:noscroll -O "$temp_filepath" "$url" + download_status=$? + + if [ $download_status -ne 0 ]; then + # Handle download failure + log_error "Failed to download $filename from $url. wget exit code: $download_status" + else + # Handle download success + log_info "Successfully downloaded $filename to temporary location." + + # Ensure the specific distro directory exists + log_info "Ensuring destination directory exists: $distro_dest_dir" + mkdir -p "$distro_dest_dir" + + # Move the file to the destination directory, replacing any existing file + log_info "Moving $filename to $dest_filepath" + mv -f "$temp_filepath" "$dest_filepath" + move_status=$? + + if [ $move_status -ne 0 ]; then + log_error "Failed to move $filename to $dest_filepath. mv exit code: $move_status" + else + log_info "Successfully moved $filename." + fi + fi +done + +log_info "Generate checksum" +# Create md5 checksum +checksum_file="md5sum.txt" +sha512_checksum_file="sha512sum.txt" + +cd "$DEST_DIR" +find . -type f ! -iname '*.txt' -exec md5sum {} \; > "$checksum_file" +checksum_status=$? +if [ $checksum_status -ne 0 ]; then + log_error "Failed to create md5 checksum. md5sum exit code: $checksum_status" +else + log_info "Successfully created checksum file: $checksum_file" +fi + +find . -type f ! -iname '*.txt' -exec sha512sum {} \; > "$sha512_checksum_file" +sha512_checksum_status=$? +if [ $sha512_checksum_status -ne 0 ]; then + log_error "Failed to create sha512 checksum. sha512sum exit code: $sha512_checksum_status" +else + log_info "Successfully created checksum file: $sha512_checksum_file" +fi + +log_info "--------------------------------------------------" +log_info "Image download process finished." diff --git a/tools/utils/database_comparision_during_upgrade/README b/tools/utils/database_comparision_during_upgrade/README index 45c55eaf38b3..ace71379a11a 100644 --- a/tools/utils/database_comparision_during_upgrade/README +++ b/tools/utils/database_comparision_during_upgrade/README @@ -15,14 +15,14 @@ What this tool is capable to do is The usage is as follows 1. First run fresh_install_data_collection.sh file to generate data from fresh install setup . - This will be used for comparing between fresh install and upgrade setup. + This will be used for comparing between fresh install and upgrade setup. This is a onetime activity and need to be repeated only when there is some DB changes for that release . - Output of this script will come in a base_data folder + Output of this script will come in a base_data folder 2. Just before upgrade you need to run before_upgrade_data_collection.sh file to collect required data needed to compare before upgrade and after upgrade setup data The output of this script will come in folder data_before_upgrade -3. After upgrade run cloud_schema_comparision.sh to compare cloud database all tables schema between fresh and upgraded setup. +3. After upgrade run cloud_schema_comparision.sh to compare cloud database all tables schema between fresh and upgraded setup. NOTE: this script requires step 1 output in current working directory 4. After upgrade run usage_schema_comparision.sh to compare cloud usage all tables schema between fresh and upgraded setup @@ -41,4 +41,4 @@ The usage is as follows • Database user • Database user password -8. Result will be shown in the form of files . +8. Result will be shown in the form of files . diff --git a/tools/utils/database_comparision_during_upgrade/before_upgrade_data_collection.sh b/tools/utils/database_comparision_during_upgrade/before_upgrade_data_collection.sh old mode 100644 new mode 100755 diff --git a/tools/utils/database_comparision_during_upgrade/cloud_schema_comparision.sh b/tools/utils/database_comparision_during_upgrade/cloud_schema_comparision.sh old mode 100644 new mode 100755 diff --git a/tools/utils/database_comparision_during_upgrade/fresh_install_data_collection.sh b/tools/utils/database_comparision_during_upgrade/fresh_install_data_collection.sh old mode 100644 new mode 100755 diff --git a/tools/utils/database_comparision_during_upgrade/test_config_before_and_after_upgrade.sh b/tools/utils/database_comparision_during_upgrade/test_config_before_and_after_upgrade.sh old mode 100644 new mode 100755 diff --git a/tools/utils/database_comparision_during_upgrade/test_config_between_fresh_and_upgraded_setup.sh b/tools/utils/database_comparision_during_upgrade/test_config_between_fresh_and_upgraded_setup.sh old mode 100644 new mode 100755 diff --git a/tools/utils/database_comparision_during_upgrade/usage_schema_comparison.sh b/tools/utils/database_comparision_during_upgrade/usage_schema_comparison.sh old mode 100644 new mode 100755 diff --git a/ui/.env.qa b/ui/.env.qa new file mode 100644 index 000000000000..d32df4035d7a --- /dev/null +++ b/ui/.env.qa @@ -0,0 +1 @@ +CS_URL=https://qa.cloudstack.cloud/simulator/pr/10580 diff --git a/ui/README.md b/ui/README.md index b7ce7b5cc2b0..c5c5c778e833 100644 --- a/ui/README.md +++ b/ui/README.md @@ -1,3 +1,22 @@ + + # CloudStack UI A modern role-based progressive CloudStack UI based on Vue.js and Ant Design. @@ -8,18 +27,18 @@ A modern role-based progressive CloudStack UI based on Vue.js and Ant Design. Install node: (Debian/Ubuntu) - curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - + curl -sL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt-get install -y nodejs # Or use distro provided: sudo apt-get install npm nodejs Install node: (CentOS/Fedora/RHEL) - curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash - + curl -sL https://rpm.nodesource.com/setup_24.x | sudo bash - sudo yum install nodejs Install node: (Mac OS) - brew install node@16 + brew install node@24 Optionally, you may also install system-wide dev tools: @@ -44,6 +63,10 @@ To use the community Simulator QA server you can do this: echo "CS_URL=https://qa.cloudstack.cloud" > .env.local +This may be required for newer npm versions: + + export NODE_OPTIONS=--openssl-legacy-provider + Build and run: npm run serve @@ -62,7 +85,7 @@ Fix issues and vulnerabilities: npm audit -A basic development guide and explaination of the basic components can be found +A basic development guide and explanation of the basic components can be found [here](docs/development.md) ## Production @@ -157,7 +180,6 @@ The UI uses the following: - [Ant Design Vue](https://vue.ant.design/) - [Ant Design Pro Vue](https://github.com/sendya/ant-design-pro-vue) - [Fontawesome](https://github.com/FortAwesome/vue-fontawesome) -- [ViserJS](https://viserjs.github.io/docs.html#/viser/guide/installation) - [Icons](https://www.iconfinder.com/iconsets/cat-force) by [Iconka](https://iconka.com/en/downloads/cat-power/) ## History diff --git a/ui/docs/customize.md b/ui/docs/customize.md index 1e0688e33703..5a3807e41d72 100644 --- a/ui/docs/customize.md +++ b/ui/docs/customize.md @@ -1,3 +1,22 @@ + + # UI customization Use a `public/config.json` (or `dist/config.json` after build) file for customizing theme, logos,... diff --git a/ui/docs/development.md b/ui/docs/development.md index 8b1f67b7c427..43b346fad8f4 100644 --- a/ui/docs/development.md +++ b/ui/docs/development.md @@ -1,3 +1,22 @@ + + # UI Development The modern CloudStack UI is role-based progressive app that uses Vue.js and Ant Design. @@ -13,7 +32,7 @@ The following tree shows the basic UI codebase filesystem: ```bash src - ├── assests # sprites, icons, images + ├── assets # sprites, icons, images ├── components # Shared vue files used to render various generic / widely used components ├── config # Contains the layout details of the various routes / sections available in the UI ├── locales # Custom translation keys for the various supported languages diff --git a/ui/docs/full-test-plan.template.md b/ui/docs/full-test-plan.template.md index bced2703701a..259ec5d98580 100644 --- a/ui/docs/full-test-plan.template.md +++ b/ui/docs/full-test-plan.template.md @@ -33,7 +33,7 @@ Note: for User role test exclude after Account/User feature, for DomainAdmin rol - [ ] Create new instance **Compute > Kubernetes** -This requires configuring and setting up CKS: http://docs.cloudstack.apache.org/en/latest/plugins/cloudstack-kubernetes-service.html +This requires configuring and setting up CKS: https://docs.cloudstack.apache.org/en/latest/plugins/cloudstack-kubernetes-service.html - [ ] Basic search - [ ] Extended search - [ ] Sort @@ -484,7 +484,7 @@ This requires configuring and setting up CKS: http://docs.cloudstack.apache.org/ - [ ] Disable/enable host - [ ] Enable/cancel maintenance mode - [ ] Enable/disable out-of-band management -- [ ] Enable/disale HA +- [ ] Enable/disable HA - [ ] Delete host (only if disabled) **Infrastructure > Primary Storage** diff --git a/ui/docs/screenshot-dashboard.png b/ui/docs/screenshot-dashboard.png index 875bc2c5c134..a0143d5fc1e4 100644 Binary files a/ui/docs/screenshot-dashboard.png and b/ui/docs/screenshot-dashboard.png differ diff --git a/ui/docs/smoke-test-plan.template.md b/ui/docs/smoke-test-plan.template.md index cc065ed7bf78..ca1e1fbd42e0 100644 --- a/ui/docs/smoke-test-plan.template.md +++ b/ui/docs/smoke-test-plan.template.md @@ -17,7 +17,7 @@ Note: for User role test exclude after Account/User feature, for DomainAdmin rol - [ ] Add/delete secondary IP address **Compute > Kubernetes** -This requires configuring and setting up CKS: http://docs.cloudstack.apache.org/en/latest/plugins/cloudstack-kubernetes-service.html +This requires configuring and setting up CKS: https://docs.cloudstack.apache.org/en/latest/plugins/cloudstack-kubernetes-service.html - [ ] Add Kubernetes cluster - [ ] Start/stop a Kubernetes cluster - [ ] Scale Kubernetes cluster @@ -58,7 +58,7 @@ This requires configuring and setting up CKS: http://docs.cloudstack.apache.org/ **VPC** - [ ] Add VPC -- [ ] VPC actions - updat, restart, delete +- [ ] VPC actions - update, restart, delete - [ ] Add security group - [ ] Add/delete ingress/egress rule diff --git a/ui/package-lock.json b/ui/package-lock.json index f3087d1bf98b..c9f90b6552a4 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -2816,6 +2816,12 @@ "@types/node": "*" } }, + "@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "optional": true + }, "@types/uglify-js": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.16.0.tgz", @@ -9035,6 +9041,14 @@ } } }, + "dompurify": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz", + "integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==", + "requires": { + "@types/trusted-types": "^2.0.7" + } + }, "domutils": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", diff --git a/ui/package.json b/ui/package.json index df8c5d5f82b7..9801c1b18153 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,7 +1,7 @@ { "name": "cloudstack-ui", "description": "Modern role-based Apache CloudStack UI", - "version": "4.19.0", + "version": "4.22.0", "homepage": "https://cloudstack.apache.org/", "repository": { "type": "git", @@ -49,6 +49,7 @@ "chartjs-adapter-moment": "^1.0.0", "core-js": "^3.21.1", "cronstrue": "^2.26.0", + "dompurify": "^3.2.6", "enquire.js": "^2.1.6", "js-cookie": "^2.2.1", "lodash": "^4.17.15", @@ -100,6 +101,8 @@ "eslint-plugin-vue": "^7.0.0", "less": "^3.0.4", "less-loader": "^5.0.0", + "nan": "2.18.0", + "node-gyp": "10.0.1", "sass": "^1.49.9", "sass-loader": "^8.0.2", "uglifyjs-webpack-plugin": "^2.2.0", @@ -107,6 +110,9 @@ "vue-svg-loader": "^0.17.0-beta.2", "webpack": "^4.46.0" }, + "resolutions": { + "nan": "2.18.0" + }, "eslintConfig": { "root": true, "env": { diff --git a/ui/public/assets/403.png b/ui/public/assets/403.png index 5ce416c1e646..49e7daa8c43d 100644 Binary files a/ui/public/assets/403.png and b/ui/public/assets/403.png differ diff --git a/ui/public/assets/404.png b/ui/public/assets/404.png index 4720b6840b0e..36d5ee460c2e 100644 Binary files a/ui/public/assets/404.png and b/ui/public/assets/404.png differ diff --git a/ui/public/assets/500.png b/ui/public/assets/500.png index bdb941817aa8..d4c6c222dadd 100644 Binary files a/ui/public/assets/500.png and b/ui/public/assets/500.png differ diff --git a/ui/public/assets/asf-logo.svg b/ui/public/assets/asf-logo.svg new file mode 100644 index 000000000000..d69e8d7ebb89 --- /dev/null +++ b/ui/public/assets/asf-logo.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/public/assets/bg-what-is-cloudstack.png b/ui/public/assets/bg-what-is-cloudstack.png index db657dcf6078..d4d7a03c0b32 100644 Binary files a/ui/public/assets/bg-what-is-cloudstack.png and b/ui/public/assets/bg-what-is-cloudstack.png differ diff --git a/ui/public/assets/error.png b/ui/public/assets/error.png index 25d69745eeea..a1f39d4cc318 100644 Binary files a/ui/public/assets/error.png and b/ui/public/assets/error.png differ diff --git a/ui/public/assets/feather.svg b/ui/public/assets/feather.svg new file mode 100644 index 000000000000..95cc5b2c07ac --- /dev/null +++ b/ui/public/assets/feather.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/public/assets/success.png b/ui/public/assets/success.png index fdfef8cd72b0..613acfb344f4 100644 Binary files a/ui/public/assets/success.png and b/ui/public/assets/success.png differ diff --git a/ui/public/cloud-image-templates.json b/ui/public/cloud-image-templates.json new file mode 100644 index 000000000000..395477166f56 --- /dev/null +++ b/ui/public/cloud-image-templates.json @@ -0,0 +1,110 @@ +[ + { + "id": 1, + "name": "Ubuntu 24.04", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-24.04-server-cloudimg-amd64.img" + }, + { + "id": 2, + "name": "Ubuntu 22.04", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-22.04-server-cloudimg-amd64.img" + }, + { + "id": 3, + "name": "Ubuntu 20.04", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-20.04-server-cloudimg-amd64.img" + }, + { + "id": 4, + "name": "Debian GNU/Linux 12 (64-bit)", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/debian/debian-12-genericcloud-amd64.qcow2" + }, + { + "id": 5, + "name": "Rocky Linux 8", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/rockylinux/Rocky-8-GenericCloud.latest.x86_64.qcow2" + }, + { + "id": 6, + "name": "Rocky Linux 9", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/rockylinux/Rocky-9-GenericCloud.latest.x86_64.qcow2" + }, + { + "id": 7, + "name": "OpenSUSE 15.5", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/opensuse/openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2" + }, + { + "id": 8, + "name": "Ubuntu 24.04", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-24.04-server-cloudimg-arm64.img" + }, + { + "id": 9, + "name": "Ubuntu 22.04", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-22.04-server-cloudimg-arm64.img" + }, + { + "id": 10, + "name": "Ubuntu 20.04", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/ubuntu/ubuntu-20.04-server-cloudimg-arm64.img" + }, + { + "id": 11, + "name": "Debian GNU/Linux 12 (64-bit)", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/debian/debian-12-genericcloud-arm64.qcow2" + }, + { + "id": 12, + "name": "Rocky Linux 8", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/rockylinux/Rocky-8-GenericCloud.latest.aarch64.qcow2" + }, + { + "id": 13, + "name": "Rocky Linux 9", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/rockylinux/Rocky-9-GenericCloud.latest.aarch64.qcow2" + }, + { + "id": 14, + "name": "OpenSUSE 15.5", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/opensuse/openSUSE-Leap-15.5-Minimal-VM.aarch64-Cloud.qcow2" + }, + { + "id": 15, + "name": "Oracle Linux 8", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/oraclelinux/OL8U10_aarch64-kvm-b122.qcow2" + }, + { + "id": 16, + "name": "Oracle Linux 8", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/oraclelinux/OL8U10_x86_64-kvm-b258.qcow2" + }, + { + "id": 17, + "name": "Oracle Linux 9", + "arch": "aarch64", + "url": "https://download.cloudstack.org/templates/cloud-images/oraclelinux/OL9U5_aarch64-kvm-b126.qcow2" + }, + { + "id": 18, + "name": "Oracle Linux 9", + "arch": "x86_64", + "url": "https://download.cloudstack.org/templates/cloud-images/oraclelinux/OL9U5_x86_64-kvm-b259.qcow2" + } +] diff --git a/ui/public/config.json b/ui/public/config.json index 38d1fd9bbe71..81d3938a5dee 100644 --- a/ui/public/config.json +++ b/ui/public/config.json @@ -17,6 +17,7 @@ "logo": "assets/logo.svg", "minilogo": "assets/mini-logo.svg", "banner": "assets/banner.svg", + "favicon": "cloud.ico", "error": { "403": "assets/403.png", "404": "assets/404.png", @@ -60,9 +61,11 @@ "uk": "label.uk.keyboard", "fr": "label.french.azerty.keyboard", "jp": "label.japanese.keyboard", - "sc": "label.simplified.chinese.keyboard" + "sc": "label.simplified.chinese.keyboard", + "es-latam": "Spanish Latin American Keyboard" }, "userCard": { + "enabled": true, "title": "label.help", "icon": "question-circle-outlined", "links": [ @@ -93,9 +96,27 @@ ] }, "plugins": [], + "allowMakingRouterRedundant": false, "apidocs": true, "basicZoneEnabled": true, "multipleServer": false, "allowSettingTheme": true, - "docHelpMappings": {} + "displayProjectFieldOnLogin": false, + "imageSelectionInterface": "modern", + "showUserCategoryForModernImageSelection": true, + "showAllCategoryForModernImageSelection": false, + "docHelpMappings": {}, + "notifyLatestCSVersion": true, + "showSearchFilters": true, + "announcementBanner": { + "enabled": false, + "showIcon": false, + "closable": true, + "persistDismissal": true, + "type": "info", + "message": "🤔 Sample Announcement: New Feature Available: Check out our latest dashboard improvements! Learn more", + "startDate": "2025-06-01T00:00:00Z", + "endDate": "2025-07-16T00:00:00Z" + }, + "defaultLanguage": "en" } diff --git a/ui/public/css/apache-theme.css b/ui/public/css/apache-theme.css new file mode 100644 index 000000000000..573c062c5138 --- /dev/null +++ b/ui/public/css/apache-theme.css @@ -0,0 +1,1169 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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. +*/ + +@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); + +:root { + --main-verde: #3E7C59; + --main-vermelho: #ae0000; + --main-normal:#327355; + --main-exception:#ae0000; + --main-primary-claro: #db4e2d22; + --main-primary-escuro: #db4e2d; + --main-secondary-claro: #E9782622; + --main-secondary-escuro: #E97826; + --main-grey-claro: #eee; + --main-grey-escuro: #6D6E71; + --main-image-menu: url("../assets/asf-logo.svg"); + --main-image-login: url("../assets/asf-logo.svg"); + --main-image-icon: url("../assets/feather.svg"); + --main-linear-cora: #ddd; + --main-linear-corb: #ddd; +} + +#app > div > form > img.user-layout-logo{ + display:none !important; +} + +#app > div > form{ + background-image:var(--main-image-login); + background-repeat:no-repeat; + background-size:250px; + background-position:top center; + padding-top:120px; +} + +.userLayout .user-layout-header{ + min-height:100px; + background-image:var(--main-image-login); + background-repeat:no-repeat; + background-size:250px; + background-position:top center; +} + +.ant-layout-sider.light.ant-fixed-sidemenu > div > div{ + height: 100px !important; + background-image:var(--main-image-menu); + background-repeat:no-repeat; + background-size:200px; + background-position:25px 25px; + margin-bottom:20px; +} + +.ant-layout-sider.light.ant-fixed-sidemenu.ant-layout-sider-collapsed > div > div{ + height: 70px !important; + background-image:var(--main-image-icon); + background-repeat:no-repeat; + background-size:30px; + background-position:25px 20px; +} + +.sider.light .ant-menu-light a, +.sider.light .ant-menu-submenu > .ant-menu-submenu-title { + color:#000 !important; +} + +.sider.light .ant-menu-light a path{ + +} + +.ant-menu:not(.ant-menu-horizontal) span.ant-menu-title-content .custom-icon path{ + transition:fill 1s easyin; +} + +.ant-menu:not(.ant-menu-horizontal) span.ant-menu-title-content:hover .custom-icon path{ + fill:#fff !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-active:hover a, +.ant-menu:not(.ant-menu-horizontal) .ant-menu-submenu .ant-menu-submenu-title:hover{ + color:#fff !important; +} + +.ant-menu-submenu ul a, +.ant-menu-submenu ul .ant-menu-item-active.ant-menu-item-selected a span{ + color:#fff !important; +} + +.ant-menu-submenu ul .ant-menu-item-selected a span{ + color:#000 !important; +} + +*{ + font-family: 'Poppins' , Courier !important; +} + +aside, +.ant-menu-submenu ul{ + background: linear-gradient(var(--main-linear-cora), var(--main-linear-corb)) !important; +} + +html{ + background-color: var(--main-secondary-escuro); +} + +/* HEADER */ +.layout.ant-layout .header{ + background: linear-gradient(var(--main-linear-cora), var(--main-linear-corb)) !important; + box-shadow: 0px 0px 10px #00000055; +} + +.layout.ant-layout .header .user-menu > span.ant-dropdown-open{ + background-color:var(--main-primary-claro) !important; + border-bottom:5px solid var(--main-primary-escuro) !important; +} + +.layout.ant-layout .header .anticon-menu-unfold:hover, +.layout.ant-layout .header .anticon-menu-fold:hover, +.layout.ant-layout .header .user-menu > span:hover{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +.layout.ant-layout .header .user-menu > span:hover *{ + color:#fff !important; +} +.layout.ant-layout .header .user-menu > span *{ + color:#000 !important; +} + +.layout.ant-layout .header .anticon-menu-unfold, +.layout.ant-layout .header .anticon-menu-fold{ + color:#000; +} + +.header-notice-opener{ + padding-left:15px; +} + + +.ant-table-tbody > .ant-table-row:hover td{ + background-color:var(--main-secondary-claro) !important; +} + +/* SIDE BAR */ + +.vm-info-card .ant-card-body .ant-card-bordered{ + border-top:2px solid var(--main-primary-escuro) !important; + margin-bottom:50px; +} + +.vm-info-card .ant-card-body .ant-card-bordered .ant-card-head, +.vm-info-card .ant-card-body .ant-card-bordered .ant-card-grid{ + padding:10px 0px !important; +} + +.vm-info-card .ant-card-body .ant-card-bordered .resource-detail-item{ + margin-bottom:20px; +} + +.vm-info-card .ant-card-body .ant-card-bordered .resource-detail-item .resource-detail-item__label{ + font-weight:900; +} + +/* USER LOGIN SCREEN */ + +.ant-tabs-tab, +.user-layout{ + background-color:var(--main-grey-claro) !important; +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:0px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-secondary-escuro) !important; + color: #fff; + border-bottom:3px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:3px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-nav{ + width:100%; +} + +.user-layout .ant-tabs-nav > div > div{ + width:50%; +} + +/* IMAGES LOGO */ +.userLayout .user-layout-logo{ + display:none; +} + +.ant-layout-sider.light.ant-fixed-sidemenu > div > div > img{ + display:none !important; +} + +/* PROGRESS */ +.ant-progress.ant-progress-status-active .ant-progress-inner, +.ant-progress.ant-progress-status-normal .ant-progress-inner{ + background-color:var(--main-grey-claro) !important; +} + +.ant-progress.ant-progress-status-active .ant-progress-inner .ant-progress-bg, +.ant-progress.ant-progress-status-normal .ant-progress-inner .ant-progress-bg{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-progress .ant-progress-text{ + color:var(--main-grey-escuro) !important; + font-weight:900; +} + +.ant-progress.ant-progress-status-exception .ant-progress-inner .ant-progress-bg{ + background-color:var(--main-exception) !important; +} + +/* FORMS */ +.ant-select-selector, +.ant-input{ + background-color:white !important; +} + +.ant-select.ant-select-focused .ant-select-arrow .anticon{ + color:var(--main-grey-claro); +} + +.ant-select-selector .ant-select-selection-placeholder, +.ant-select, +.ant-input::placeholder{ + color:var(--main-grey-escuro) !important; +} + +.ant-select-selector:hover, .ant-select-selector:focus, +.ant-input:hover, .ant-input:focus{ + box-shadow: 0px 0px 3px var(--main-primary-escuro); + border-color:var(--main-primary-escuro) !important; +} + +.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector { + border-color: var(--main-primary-escuro); + border-right-width: 1px !important; + box-shadow: 0 0 0 2px var(--main-primary-claro); +} + +.ant-select-dropdown .ant-select-item.ant-select-item-option-selected, +.ant-select-dropdown .ant-select-item:hover{ + background-color:var(--main-primary-claro) !important; +} + +/* PAGINATION */ +.ant-pagination .ant-pagination-item.ant-pagination-item-active{ + background-color:var(--main-primary-escuro) !important; + border-color:#fff; +} + +.ant-pagination .ant-pagination-item.ant-pagination-item-active a{ + color:#fff !important; + font-weight:bold; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active){ + background-color:#fff !important; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active):hover{ + background-color:var(--main-secondary-escuro) !important; + border-color:#fff; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active):hover a{ + color:#fff !important; + font-weight:bold; +} + +.ant-pagination .ant-pagination-next span, +.ant-pagination .ant-pagination-prev span{ + color:var(--main-grey-escuro) !important; +} + +.ant-pagination .ant-pagination-next span:hover, +.ant-pagination .ant-pagination-prev span:hover{ + color:var(--main-secondary-escuro) !important; +} + + +/* RADIO GROUP */ +.ant-radio-group label.ant-radio-button-wrapper-checked{ + background-color:var(--main-primary-escuro) !important; + border-color:var(--main-primary-escuro) !important; +} + +.ant-radio-group label:not(.ant-radio-button-wrapper-checked):hover{ + color:#000 !important; + background-color:var(--main-primary-claro) !important; +} + +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)::before { + background-color:var(--main-primary-escuro) !important; +} + +/* TABLES */ +.ant-table{ + font-size:16px !important; +} + +.ant-table th{ + border-bottom:5px solid var(--main-primary-claro) !important; +} + +.ant-table th.ant-table-column-has-sorters:hover{ + border-bottom:5px solid var(--main-primary-escuro) !important; +} + +.ant-table thead.ant-table-thead{ + background-color:Red !important; + border-bottom:5px solid var(--main-primary-escuro) !important; +} + +.anticon.ant-table-column-sorter-up.on *, +.anticon.ant-table-column-sorter-down.on *{ + color: var(--main-primary-escuro) !important; +} + +/* PAGE TABS LEFT */ +.ant-tabs-left-bar .ant-tabs-nav-scroll { + border-right:3px solid var(--main-primary-escuro); +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + margin:0px; + padding:10px 15px; + border-right:3px solid transparent; + transform: all 1s easyin !important; + background-color:#fff !important; +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active, +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-right:3px solid var(--main-primary-escuro); +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-ink-bar{ + display:none !important; + width:0px !important; + background-color:var(--main-primary-escuro) !important; +} + +/* PAGE TABS TOP */ +.ant-tabs-tab-next, +.ant-tabs-tab-prev{ + color:var(--main-primary-escuro) !important; +} + +.ant-tabs-tab-next svg, +.ant-tabs-tab-prev svg{ + transform: scale(1.5); +} + +.ant-tabs-tab-next:not(.ant-tabs-tab-btn-disabled):hover, +.ant-tabs-tab-prev:not(.ant-tabs-tab-btn-disabled):hover{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +.ant-tabs-tab-next.ant-tabs-tab-btn-disabled, +.ant-tabs-tab-prev.ant-tabs-tab-btn-disabled{ + color:var(--main-primary-claro) !important; +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll { + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + margin:0px; + padding:14px 30px; + border-bottom:3px solid transparent; + transform: all 1s easyin !important; + background-color:#fff !important; +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active, +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-ink-bar{ + height:0px !important; + background-color:var(--main-primary-escuro) !important; +} + +/* LINKS */ +a{ + color: var(--main-primary-escuro); +} + +a:hover{ + color: var(--main-secondary-escuro); +} + +.ant-breadcrumb-link a:hover{ + color: var(--main-primary-escuro) !important;; +} + +.ant-breadcrumb-link .anticon{ + margin-top:5px !important; +} + +.ant-breadcrumb-link .ant-select-arrow .anticon{ + margin-top:0px !important; +} + +/* USER MENU */ +.user-menu > span{ + border-bottom:5px solid transparent; +} + +.user-menu > span:hover{ + border-bottom:5px solid var(--main-primary-escuro); + background-color:var(--main-grey-claro) !important; +} + +.ant-dropdown .ant-dropdown-menu-item:hover{ + background-color:var(--main-primary-claro) !important; +} + +.ant-dropdown .ant-dropdown-menu-item:hover *{ + color:#000; +} + +.ant-dropdown .ant-dropdown-menu-item.ant-dropdown-menu-item-selected, +.ant-dropdown .ant-dropdown-menu-item.ant-dropdown-menu-item-selected:hover *{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +/* CHECKBOXES */ +.ant-checkbox-checked .ant-checkbox-inner { + background-color: var(--main-primary-escuro) !important; + border-color: var(--main-primary-escuro) !important; +} + +.ant-checkbox .ant-checkbox-inner { + border-color: var(--main-primary-escuro) !important; +} + +.ant-checkbox-indeterminate .ant-checkbox-inner::after{ + background-color: var(--main-primary-escuro) !important; +} + +/* SEARCH */ +/* +.ant-input-search .ant-input-wrapper.ant-input-group{ + display:flex; + justify-content: flex-end; + padding-right:2%; + +} + +.ant-input-search.ant-input-affix-wrapper{ + width:300px !important; + transform: width 1s easyin; + border:0px; +} + +.ant-input-search.ant-input-affix-wrapper-focused{ + width:98% !important; + border:0px !important; + border-color:transparent !important; +} +*/ + +.breadcrumb-card > .ant-card-body >.ant-row{ + display:flex; + align-items: end; + height:90px; +} + +.ant-breadcrumb > span:last-child label, +.ant-breadcrumb-link .router-link-exact-active{ + font-size:35px; + position:absolute; + left:10px; + top:-65px; + /*! width:100vh !important; */ +} + +.ant-card-head .ant-card-head-title{ + font-size:35px; +} + +.breadcrumb-card > .ant-card-body >.ant-row .ant-col:last-child{ + padding-bottom:7px; +} + +.ant-input-search .ant-input-group-addon{ + padding:0px !important; + width:30px !important; +} + +.ant-input-search .ant-input-group-addon button{ + height:30px !important; + width:30px; + border-radius:7px 0px 0px 7px; + border:2px solid var(--main-primary-claro) !important; +} + +.ant-select.project-select > .ant-select-selector, +.ant-input-affix-wrapper, +.ant-input-affix-wrapper input, +.ant-input-search .ant-input-search.input-search, +.ant-input-search .ant-input-search.input-search input{ + background-color:white !important; +} + +.ant-select.project-select.ant-select-focused > .ant-select-selector, +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused, +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused input, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused input{ + background-color: var(--main-grey-escuro) !important; + color:#fff !important; +} + +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused .anticon{ + background-color:red !important; +} + +.user-layout .ant-input-affix-wrapper-focused .ant-input-prefix, +.user-layout .ant-input-affix-wrapper-focused .ant-input-suffix{ + color:#fff !important; +} + +/* +.ant-select.project-select.ant-select-focused .anticon path{ + color:#fff !important; + stroke:#fff !important; +} +*/ + +.ant-input-search .ant-input-search.input-search input::placeholder { + color: #666; +} + +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused input::placeholder, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused input::placeholder{ + color:#ffffffDD !important; +} + +.ant-input-search .ant-input-search.input-search{ + border-radius:0px 7px 7px 0px; +} + +.anticon-search.ant-input-search-icon{ + background-color:var(--main-primary-escuro) !important; + position:absolute; + height:30px; + width:30px; + border-radius:0px 7px 7px 0px; + display:flex; + justify-content: center; + align-items: center; + color:#fff; + right:0; +} + +.anticon-search.ant-input-search-icon:hover{ + background-color:var(--main-secondary-escuro) !important; +} + +/* SWITCH E BOTAO */ +button.ant-btn:not(.ant-btn-icon-only){ + background-color:var(--main-primary-escuro) !important; + color:#fff; + border:0px; +} + +button.ant-btn:not(.ant-btn-icon-only):hover{ + background-color:var(--main-secondary-escuro) !important; + color:#fff; +} + +.ant-radio .ant-radio-inner{ + border-color:var(--main-primary-escuro) !important; +} + +.ant-radio .ant-radio-inner:after{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-switch{ + background-color:var(--main-primary-claro); + border-color:var(--main-primary-escuro) !important; + height:24px; + /*! position:absolute; */ +} + +.ant-switch-loading-icon, .ant-switch::after{ + height:20px; +} + +.ant-switch-checked{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-switch span{ + color:#444; +} + +.ant-switch-checked span{ + color:#fff; +} + +.ant-slider-handle, +.ant-slider-handle .ant-tooltip-open{ + background-color: #fff; + border: solid 2px var(--main-primary-escuro); + border-radius: 50%; + box-shadow: 0; +} + +.ant-slider-handle.ant-tooltip-open{ + box-shadow: 0px 0px 5px var(--main-grey-claro) !important; + border: solid 2px var(--main-primary-escuro); +} + +.ant-slider:hover .ant-slider-handle, +.ant-slider-handle:hover, +.ant-slider-handle:focus{ + background-color: var(--main-primary-escuro); + border: solid 2px var(--main-primary-escuro) !important; + border-radius: 50%; + box-shadow: 0; + box-shadow: 0px 0px 5px var(--main-grey-claro) !important; +} + +.ant-slider-track{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-slider-rail{ + background-color:var(--main-primary-claro) !important; +} + + +/* HEADER */ +.layout.ant-layout .header{ + background-color:#fff !important; +} + +/* MENU ACTIVE */ +.ant-menu-vertical .ant-menu-item::after, .ant-menu-vertical-left .ant-menu-item::after, .ant-menu-vertical-right .ant-menu-item::after, .ant-menu-inline .ant-menu-item::after { + border-color:var(--main-primary-escuro) !important; + /*! color: red !important; */ +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item a, +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected a{ + color:#000 !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item.ant-menu-item-selected { + background-color: var(--main-primary-claro) !important; +} + +/* MENU LIGHT */ +.sider.light .ant-menu-light, +.sider.light .ant-menu-submenu > .ant-menu{ + background-color:var(--main-secondary-escuro); + background-color:transparent; +} + + +.sider.light .ant-menu-dark{ + background-color:green; +} + +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::before, +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::after{ + background-color: #000 !important; +} + +.ant-menu-submenu-inline:hover .ant-menu-submenu-title .ant-menu-submenu-arrow::before, +.ant-menu-submenu-inline:hover .ant-menu-submenu-title .ant-menu-submenu-arrow::after{ + background-color: #fff !important; +} + +/* MENU ITEM */ +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item:hover, +.ant-menu:not(.ant-menu-horizontal) .ant-menu-submenu div:hover{ + background-color: var(--main-primary-escuro) !important; +} + +.ant-menu-inline-collapsed .ant-menu-submenu-title{ + margin:0px !important; +} + + +/* CARDS DASHBOARD */ +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card{ + background-color:var(--main-vermelho) !important; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card{ + background-color:var(--main-verde) !important; +} + +.usage-dashboard-chart-card-inner h2, +.usage-dashboard-chart-card-inner h3{ + color:#fff !important; +} + +/* CHARTS */ + +.ant-progress .ant-progress-status-normal path{ + stroke:var(--main-exception) !important; +} + +.ant-progress-circle.ant-progress-status-normal .ant-progress-text{ + color:var(--main-normal) !important; + font-weight: bold +} + +.ant-progress.ant-progress-status-normal path.ant-progress-circle-path{ + stroke:var(--main-normal) !important; +} + +.ant-progress.ant-progress-status-exception path.ant-progress-circle-path, +.ant-progress.ant-progress-status-active path.ant-progress-circle-path{ + stroke:var(--main-exception) !important; +} + +.ant-progress path.ant-progress-circle-trail{ + stroke:var(--main-grey-claro) !important; +} + +.ant-progress-circle.ant-progress-status-exception .ant-progress-text, +.ant-progress-circle.ant-progress-status-active .ant-progress-text{ + color:var(--main-exception) !important; + font-weight: bold +} + +/* LIST TABLES */ +.ant-list .ant-list-item{ + border-left:5px solid transparent !important; + padding-left:10px; +} + +.ant-list .ant-list-item:hover{ + background-color:var(--main-grey-claro) !important; + border-left:5px solid var(--main-primary-escuro) !important; +} + +.ant-list .ant-list-item .ant-btn{ + border-color:var(--main-grey-escuro) !important; + background-color:var(--main-grey-claro) !important; + color:var(--main-grey-escuro) !important; + +} + +.ant-list .ant-list-item:hover .ant-btn{ + border-color:red!important; + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +.ant-list .ant-list-item:hover .ant-btn:hover{ + border-color:var(--main-secondary-escuro) !important; + background-color:var(--main-secondary-escuro) !important; +} + +/* OTHERS */ + +.ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected{ + background-color:var(--main-primary-claro) +} + +/* MODAL */ +.ant-modal .ant-modal-header{ + background-color:var(--main-secondary-escuro); +} + +.ant-modal .ant-modal-header *{ + color:#fff; +} + +.ant-modal .ant-row.ant-form-item{ + margin-bottom:20px !important; +} + +.ant-modal .ant-row.ant-form-item .ant-form-item-label{ + padding-bottom:0px !important; +} + +.ant-row.ant-form-item{ + margin-bottom:20px !important; +} + +.ant-steps-item .ant-form.ant-form-vertical{ + margin-top:20px !important; +} + +.ant-row.ant-form-item .ant-form-item-label{ + padding-bottom:0px !important; +} + +.ant-modal .ant-modal-title{ + font-size:20px +} + +.ant-modal .ant-modal-title .anticon{ + font-size:15px +} + +.ant-modal .ant-modal-body .anticon:not(.anticon-cloud-upload){ + position:absolute; + transform: scale(0.9); + margin-left:5px; +} + +.ant-select-selector .anticon{ + position: relative !important; + margin-left:0px !important; +} + +.ant-modal .anticon:hover{ + color:var(--main-primary-escuro); +} + +.ant-modal .ant-modal-close{ + color:#fff; + height:54px; + transition:all 1s easyin; + background-color:transparent; +} + +.ant-modal .ant-modal-close:hover{ + background-color:var(--main-primary-escuro); +} + +.ant-modal .ant-modal-close-x:hover svg{ + color:#fff; +} + +.ant-modal .ant-modal-close-x svg{ + transform: scale(1.3); +} + +/* REGISTRATIONS FORMS AND ADDS */ +.ant-steps-item-tail{ + margin-top:15px; +} + +.ant-steps-item-tail:after{ + background-color:var(--main-grey-claro) !important; +} + +.ant-steps-item-icon{ + background-color:var(--main-primary-escuro) !important; + border-color:var(--main-primary-escuro) !important; + margin-top:10px +} + +.ant-steps-item .ant-card-head{ + padding:0px; +} + +.ant-steps-item .ant-radio-group .ant-card-grid{ + box-shadow: ;none; + border:2px solid var(--main-grey-claro) +} + +.ant-steps-item .ant-card-meta-description{ + color:var(--main-grey-escuro) !important; +} + +.ant-steps-item .ant-card-body .ant-tabs-nav > div .ant-tabs-tab, +.ant-steps-item .ant-card-contain-tabs .ant-card-body{ + background-color:var(--main-grey-claro) !important; +} + +.ant-steps-item .ant-card-grid .ant-radio-wrapper{ + width:100%; + border-radius:7px; + padding:10px; +} + +.ant-steps-item .ant-radio-wrapper:hover{ + background-color:green !important; +} + +.ant-steps-item .ant-card-grid .ant-radio-wrapper:hover{ + background-color: blue !important; +} + +.ant-steps-item .ant-radio-group label:not(.ant-radio-button-wrapper-checked):hover{ + background-color:transparent !important; +} + +.ant-steps-item #zoneid .ant-card-grid .ant-radio-wrapper{ + background-color: var(--main-grey-claro) !important; +} + +.ant-steps-item #zoneid .ant-card-grid .ant-radio-wrapper:hover{ + background-color: var(--main-primary-claro) !important; +} + +.ant-steps-item .ant-card-grid .ant-radio-wrapper .anticon{ + margin-left:0px !important; + width:100%; + margin-top:0px !important; +} + +.ant-steps-item .ant-list .ant-list-item:hover{ + background-color:var(--main-primary-claro) !important; + border-left:5px solid transparent !important; +} + +.ant-steps-item{ + margin-bottom:30px; + margin-top:0px; +} + +.ant-table-body, +.ant-list-vertical.form-item-scroll .ant-spin-container{ + max-height:none !important;; +} + +.ant-steps-item-title{ + width:100%; + height:40px; + display: flex; + align-items: center; + border-top:2px solid var(--main-primary-claro) !important; + font-weight:00 !important; + font-size:22px !important; +} + + +.ant-menu-submenu-arrow:after{ + /*! color:red !important; */ +} + +button.ant-btn.ant-btn-dangerous:not(.ant-btn-icon-only) +{ + background-color:var(--main-vermelho) !important; +} + +.resource-detail-item{ + border-bottom: 1px solid #ddd; + padding-bottom: 20px; +} + +.account-center-tags .ant-divider-horizontal{ + display:none +} + +.ant-table tr.ant-table-row-selected td{ + background-color:var(--main-secondary-claro); +} + +/* MODAL Steps */ + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item-title{ + font-size:14px !important; + border-top:0px !important; + justify-content: center; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-wait .ant-steps-item-icon{ + background-color:#ddd !important; + border-color:#999 !important; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-wait .ant-steps-item-icon span{ + color:#999; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-finish .ant-steps-item-icon{ + background-color:#555 !important; + border-color:#555 !important; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-finish .ant-steps-item-icon span{ + color:white !important; + right:-3px; + top:9px; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item-container .ant-steps-item-icon{ + background-color:var(--main-primary-claro) !important; + margin-top:0px; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-active .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-wait .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-primary-claro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-finish .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-secondary-escuro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-finish .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + color:white !important; + left:0px !important; + top:0px; +} + +.ant-modal-body .ant-table-body .ant-tag span{ + position:relative !important; +} + +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle{ + padding-top:15px !important; +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous{ + background-color:var( --main-vermelho); + border-color:var( --main-vermelho); +} + +.ant-modal-body .ant-form-item-control-input .anticon.anticon-close-circle{ + top:0px !important; + bottom:0px !important; + left:-10px !important; +} + +.ant-modal-body .ant-form-item-control-input .ant-select-arrow{ + right:15px +} + +.ant-form-item-has-feedback .ant-form-item-control-input :not(.ant-input-group-addon) > .ant-select .ant-select-arrow{ + right:40px +} + +.ant-modal-body .ant-form-item-control-input .ant-select-clear{ + background-color:transparent !important; + top:13px; + right:-20px !important; +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous .anticon{ + /*! left:2px; */ + /*! top:7px; */ +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous:hover, +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle:hover{ + background-color:var(--main-secondary-escuro); + border-color:var(--main-secondary-escuro); +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous .anticon, +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle:hover svg{ + color:#fff; +} + +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle > span{ + top:4px; + left:-1px; +} + +.ant-modal-body .traffic-select-item .ant-select-arrow .anticon.anticon-down{ + margin-left:0px !important; +} + +.ant-modal-body .ant-form-item-control-input .anticon.anticon-close-circle, +.ant-modal-body .ant-form-item-control-input .anticon.anticon-check-circle{ + left:5px; + top:4px !important; +} + +.ant-modal-body .card-waiting-launch .anticon-check-circle{ + font-size:40px !important; + left:60px; + top:40px +} + +.ant-modal-body .anticon-rocket{ + left:1px; + bottom:7px; +} + +.ant-modal-body .anticon-rocket:hover{ + color:inherit !important; +} + +.anticon-loading{ + top:0px; +} + +.card-launch-content .ant-steps-item-finish .anticon.anticon-check.ant-steps-finish-icon{ + right:-6px; + color:#fff; + top:19px +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon .ant-steps-icon .anticon{ + left:-10px +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon{ + min-width:23px !important; +} + +.card-launch-content .anticon.anticon-close-circle{ + left:-15px !important; +} + +.card-launch-content .anticon.anticon-loading{ + top:1px +} + + +.ant-modal-body .ant-table-bordered .ant-table-body .ant-table-row-cell-break-word .ant-btn-circle.ant-btn-dangerous{ + background-color:var(--main-vermelho) !important; + + &:hover{ + background-color:var(--main-secondary-escuro) !important; + } + +} + +.ant-modal-body .ant-table-bordered .ant-table-body .ant-table-row-cell-break-word .ant-btn-circle.ant-btn-dangerous span{ + background-color: transparent; + margin-right:5px !important; +} + +.ant-alert:not(.ant-alert-no-icon) .ant-alert-message{ + margin-left:40px; +} + +.ant-btn-dangerous.ant-btn-primary.ant-btn-dangerous{ + background:var(--main-vermelho); + border-color:var(--main-vermelho); +} diff --git a/ui/public/css/dark-theme.css b/ui/public/css/dark-theme.css new file mode 100644 index 000000000000..3af275b966f0 --- /dev/null +++ b/ui/public/css/dark-theme.css @@ -0,0 +1,1592 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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. +*/ + +@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); + +:root { + --main-verde: #3E7C59; + --main-vermelho: #ae0000; + --main-normal:#b2e061; + --main-exception:#fd7f6f; + --main-primary-claro: #0094F055; + --main-primary-text: #A1E4F0; + --main-primary-escuro: #B08A2A; + --main-secondary-claro: #B08A2A22; + --main-secondary-escuro: #7eb0d5; + --main-grey-claro: #ccc; + --main-grey-escuro: #444; + --main-image-menu: url("../assets/logo.svg"); + --main-image-login: url("../assets/banner.svg"); + --main-image-icon: url("../assets/mini-logo.svg"); + --main-linear-cora: #333; + --main-linear-corb: #333; +} + +#app{ + background-color: var(--main-linear-cora); +} + +#app > div > form.ant-form.ant-form-horizontal h1, +#app > div > form.ant-form.ant-form-horizontal p{ + color:#fff !important; +} + +#app > div > form > img.user-layout-logo{ + display:none !important; +} + +#app > div > form{ + background-image:var(--main-image-login); + background-repeat:no-repeat; + background-size:250px; + background-position:top center; + padding-top:120px; +} + +.userLayout .user-layout-header{ + min-height:130px; + background-image:var(--main-image-login); + background-repeat:no-repeat; + background-size:400px; + background-position:top center; + margin-bottom:20px; +} + +.ant-layout-sider.light.ant-fixed-sidemenu > div > div{ + height: 90px; + background-image:var(--main-image-menu); + background-repeat:no-repeat; + background-size:150px; + background-position:25px 25px; + margin-bottom:20px; +} + +.ant-layout-sider.light.ant-fixed-sidemenu.ant-layout-sider-collapsed > div > div{ + height: 80px; + background-image:var(--main-image-icon); + background-repeat:no-repeat; + background-size:60px; + background-position:10px 20px; +} + +.sider.light .ant-menu-light a, +.sider.light .ant-menu-submenu > .ant-menu-submenu-title { + color:#fff !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-active:hover a, +.ant-menu:not(.ant-menu-horizontal) .ant-menu-submenu span.ant-menu-title-content:hover{ + color:#fff !important; +} + +.ant-menu-submenu ul a, +.ant-menu-submenu ul .ant-menu-item-selected a span{ + color:#000 !important; +} + +/* USER MENU DARK */ +*{ + font-family: 'Poppins' , Courier !important; +} + +aside, +.ant-menu-submenu ul{ + background: linear-gradient(var(--main-linear-cora), var(--main-linear-corb)) !important; +} + +.ant-menu-submenu ul a, +.ant-menu-submenu ul .ant-menu-item-selected a span{ + color:#fff !important; +} + +html{ + background-color: var(--main-secondary-escuro); +} + +/* HEADER */ +.layout.ant-layout .header{ + background: linear-gradient(var(--main-linear-cora), var(--main-linear-corb)) !important; + box-shadow: 0px 0px 10px #00000055; +} + +.layout.ant-layout .header .user-menu > span.ant-dropdown-open{ + background-color:var(--main-primary-claro) !important; + border-bottom:5px solid var(--main-primary-escuro) !important; +} + +.layout.ant-layout .header .anticon-menu-unfold:hover, +.layout.ant-layout .header .anticon-menu-fold:hover, +.layout.ant-layout .header .user-menu > span:hover{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +.layout.ant-layout .header .user-menu > span:hover *, +.layout.ant-layout .header .user-menu > span *{ + color:#fff !important; +} + +.layout.ant-layout .header .anticon-menu-unfold, +.layout.ant-layout .header .anticon-menu-fold{ + color:#fff; +} + +.header-notice-opener{ + padding-left:15px; +} + + +.ant-table-tbody > .ant-table-row:hover td{ + background-color:var(--main-secondary-claro) !important; +} + +/* SIDE BAR */ +.ant-card { + background-color: var(--main-linear-cora) !important; +} + +.vm-info-card .ant-card-body .ant-card-bordered{ + border-top:2px solid var(--main-primary-escuro) !important; + margin-bottom:50px; +} + +.vm-info-card .ant-card-body .ant-card-bordered .ant-card-head, +.vm-info-card .ant-card-body .ant-card-bordered .ant-card-grid{ + padding:10px 0px !important; +} + +.vm-info-card .ant-card-body .ant-card-bordered .resource-detail-item{ + margin-bottom:20px; +} + +.vm-info-card .ant-card-body .ant-card-bordered .resource-detail-item .resource-detail-item__label{ + font-weight:900; +} + +/* USER LOGIN SCREEN */ + +.ant-tabs-tab, +.user-layout{ + background-color:var(--main-grey-claro) !important; +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:0px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-secondary-escuro) !important; + color: #fff; + border-bottom:3px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:3px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-nav{ + width:100%; +} + +.user-layout .ant-tabs-nav > div > div{ + width:50%; +} + +/* IMAGES LOGO */ +.userLayout .user-layout-logo{ + display:none; +} + +.ant-layout-sider.light.ant-fixed-sidemenu > div > div > img{ + display:none !important; +} + +/* PROGRESS */ +.ant-progress.ant-progress-status-active .ant-progress-inner, +.ant-progress.ant-progress-status-normal .ant-progress-inner{ + background-color:var(--main-grey-claro) !important; +} + +.ant-progress.ant-progress-status-active .ant-progress-inner .ant-progress-bg, +.ant-progress.ant-progress-status-normal .ant-progress-inner .ant-progress-bg{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-progress .ant-progress-text{ + color:var(--main-grey-claro) !important; + font-weight:700; +} + +.ant-progress.ant-progress-status-exception .ant-progress-inner .ant-progress-bg{ + background-color:var(--main-exception) !important; +} + +/* FORMS */ +.ant-input-number-input{ + color:#000; +} + +.ant-input-number-disabled .ant-input-number-input{ + color:#666; +} + +.ant-select-selector, +.ant-input{ + background-color:white !important; + color:var(--main-grey-escuro) !important; +} + +.ant-select.ant-select-focused .ant-select-arrow .anticon{ + color:var(--main-grey-claro); +} + +.ant-select-selector .ant-select-selection-placeholder, +.ant-select, +.ant-input::placeholder{ + color:var(--main-grey-escuro) !important; +} + + +.ant-select-selector:hover, .ant-select-selector:focus, +.ant-input:hover, .ant-input:focus{ + box-shadow: 0px 0px 3px var(--main-primary-escuro); + border-color:var(--main-primary-escuro) !important; +} + +.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector { + border-color: var(--main-primary-escuro); + border-right-width: 1px !important; + box-shadow: 0 0 0 2px var(--main-primary-claro); +} + +.ant-select-dropdown .ant-select-item.ant-select-item-option-selected, +.ant-select-dropdown .ant-select-item:hover{ + background-color:var(--main-primary-claro) !important; +} + +/* PAGINATION */ +.ant-pagination .ant-pagination-item.ant-pagination-item-active{ + background-color:var(--main-primary-escuro) !important; + border-color:#fff; +} + +.ant-pagination .ant-pagination-item.ant-pagination-item-active a{ + color:#fff !important; + font-weight:bold; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active){ + background-color:#fff !important; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active):hover{ + background-color:var(--main-secondary-escuro) !important; + border-color:#666; +} + +.ant-pagination .ant-pagination-item:not(.ant-pagination-item-active):hover a{ + color:#666 !important; + font-weight:bold; +} + +.ant-pagination .ant-pagination-next span, +.ant-pagination .ant-pagination-prev span{ + color:var(--main-grey-escuro) !important; +} + +.ant-pagination .ant-pagination-next span:hover, +.ant-pagination .ant-pagination-prev span:hover{ + color:var(--main-secondary-escuro) !important; +} + + +/* RADIO GROUP */ +.ant-radio-group label.ant-radio-button-wrapper-checked{ + background-color:var(--main-primary-escuro) !important; + border-color:var(--main-primary-escuro) !important; +} + +.ant-radio-group label:not(.ant-radio-button-wrapper-checked):hover{ + color:#000 !important; + background-color:var(--main-primary-claro) !important; +} + +.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)::before { + background-color:var(--main-primary-escuro) !important; +} + +/* TABLES */ +.ant-table{ + font-size:16px !important; + background:var(--main-linear-cora) !important; +} + +.ant-table th{ + border-bottom:5px solid #ffffff55!important; +} + +.ant-table th.ant-table-column-has-sorters:hover{ + border-bottom:5px solid var(--main-primary-escuro) !important; + background-color:#ffffff22 !important; +} + +.ant-table thead.ant-table-thead{ + border-bottom:5px solid var(--main-primary-escuro) !important; +} + +.anticon.ant-table-column-sorter-up.on *, +.anticon.ant-table-column-sorter-down.on *{ + color: var(--main-primary-escuro) !important; +} + +.anticon.anticon-camera.upload-icon{ + background:#ffffff33 !important; + border:0px; +} + +.anticon.anticon-camera.upload-icon:hover{ + background:var(--main-secondary-escuro) !important; +} + +.anticon.anticon-camera.upload-icon{ + background: !important; +} + +/* PAGE TABS LEFT */ +.ant-tabs-left-bar .ant-tabs-nav-scroll { + border-right:3px solid var(--main-primary-escuro); +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + margin:0px; + padding:10px 15px; + border-right:3px solid transparent; + transition: all 1s ease !important; + background-color:var(--main-linear-cora) !important; +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active, +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:#ffffff33 !important; + color: var(--main-primary-escuro); + border-right:3px solid var(--main-primary-escuro); +} + +.ant-tabs-left-bar .ant-tabs-nav-scroll .ant-tabs-ink-bar{ + display:none !important; + width:0px !important; + background-color:var(--main-primary-escuro) !important; +} + +/* PAGE TABS TOP */ +.ant-tabs-tab-next, +.ant-tabs-tab-prev{ + color:var(--main-primary-escuro) !important; +} + +.ant-tabs-tab-next svg, +.ant-tabs-tab-prev svg{ + transform: scale(1.5); +} + +.ant-tabs-tab-next:not(.ant-tabs-tab-btn-disabled):hover, +.ant-tabs-tab-prev:not(.ant-tabs-tab-btn-disabled):hover{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +.ant-tabs-tab-next.ant-tabs-tab-btn-disabled, +.ant-tabs-tab-prev.ant-tabs-tab-btn-disabled{ + color:var(--main-primary-claro) !important; +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll { + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + margin:0px; + padding:14px 30px; + border-bottom:3px solid transparent; + transform: all 1s easyin !important; + background-color:#fff !important; +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active, +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-grey-claro) !important; + color: var(--main-primary-escuro); + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-ink-bar{ + height:0px !important; + background-color:var(--main-primary-escuro) !important; +} + +/* LINKS */ +a{ + color: var(--main-primary-escuro); +} + +a:hover{ + color: var(--main-secondary-escuro); +} + +.ant-breadcrumb-link a:hover{ + color: var(--main-primary-escuro) !important;; +} + +.ant-breadcrumb-link .anticon{ + margin-top:5px !important; +} + +.ant-breadcrumb-link .ant-select-arrow .anticon{ + margin-top:0px !important; +} + + +/* USER MENU */ +.user-menu > span{ + border-bottom:5px solid transparent; +} + +.user-menu > span:hover{ + border-bottom:5px solid var(--main-primary-escuro); + background-color:var(--main-grey-claro) !important; +} + +.ant-dropdown .ant-dropdown-menu-item:hover{ + background-color:var(--main-primary-claro) !important; +} + +.ant-dropdown .ant-dropdown-menu-item:hover *{ + color:#000; +} + +.ant-dropdown .ant-dropdown-menu-item.ant-dropdown-menu-item-selected, +.ant-dropdown .ant-dropdown-menu-item.ant-dropdown-menu-item-selected:hover *{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; +} + +/* CHECKBOXES */ +.ant-checkbox-checked .ant-checkbox-inner { + background-color: var(--main-primary-escuro) !important; + border-color: var(--main-primary-escuro) !important; +} + +.ant-checkbox .ant-checkbox-inner { + border-color: var(--main-primary-escuro) !important; +} + +.ant-checkbox-indeterminate .ant-checkbox-inner::after{ + background-color: var(--main-primary-escuro) !important; +} + +/* SEARCH */ +/* +.ant-input-search .ant-input-wrapper.ant-input-group{ + display:flex; + justify-content: flex-end; + padding-right:2%; + +} + +.ant-input-search.ant-input-affix-wrapper{ + width:300px !important; + transform: width 1s easyin; + border:0px; +} + +.ant-input-search.ant-input-affix-wrapper-focused{ + width:98% !important; + border:0px !important; + border-color:transparent !important; +} +*/ + +.breadcrumb-card > .ant-card-body >.ant-row{ + display:flex; + align-items: end; + height:90px; +} + +.ant-breadcrumb > span:last-child label, +.ant-breadcrumb-link .router-link-exact-active{ + font-size:35px; + position:absolute; + left:10px; + top:-65px; + /*! width:100vh !important; */ +} + +.ant-card-head{ + background-color:var(--main-linear-cora); + color:#fff; +} + +.ant-card-head .ant-card-head-title{ + font-size:35px; +} + +.breadcrumb-card > .ant-card-body >.ant-row .ant-col:last-child{ + padding-bottom:7px; +} + +.ant-input-search .ant-input-group-addon{ + padding:0px !important; + width:30px !important; +} + +.ant-input-search .ant-input-group-addon button{ + height:30px !important; + width:30px; + border-radius:7px 0px 0px 7px; + border:2px solid var(--main-primary-escuro) !important; +} + +.ant-select.project-select > .ant-select-selector, +.ant-input-affix-wrapper, +.ant-input-affix-wrapper input, +.ant-input-search .ant-input-search.input-search, +.ant-input-search .ant-input-search.input-search input{ + background-color:white !important; +} + +.ant-input-affix-wrapper{ + border-radius: 7px; +} + +.ant-select.project-select.ant-select-focused > .ant-select-selector, +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused, +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused input, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused input{ + background-color: var(--main-grey-claro) !important; + color: var(--main-grey-escuro) !important; +} + +.user-layout .ant-input-affix-wrapper-focused .ant-input-prefix, +.user-layout .ant-input-affix-wrapper-focused .ant-input-suffix{ + color:#333 !important; +} + +/* +.ant-select.project-select.ant-select-focused .anticon path{ + color:#fff !important; + stroke:#fff !important; +} +*/ + +.ant-input-search .ant-input-search.input-search input::placeholder { + color: #666; +} + +.ant-input-affix-wrapper.ant-input-affix-wrapper-focused input::placeholder, +.ant-input-search .ant-input-search.input-search.ant-input-affix-wrapper-focused input::placeholder{ + color:var(--main-grey-escuro) !important; +} + +.ant-input-search .ant-input-search.input-search{ + border-radius:0px 7px 7px 0px; +} + +.anticon-search.ant-input-search-icon{ + background-color:var(--main-primary-escuro) !important; + position:absolute; + height:30px; + width:30px; + border-radius:0px 7px 7px 0px; + display:flex; + justify-content: center; + align-items: center; + color:#fff; + right:0; +} + +.anticon-search.ant-input-search-icon:hover{ + background-color:var(--main-secondary-escuro) !important; +} + +/* SWITCH E BOTAO */ +button.ant-btn{ + background-color:var(--main-primary-escuro) !important; + color:#fff; + border:0px; +} + +button.ant-btn:hover{ + background-color:var(--main-secondary-escuro) !important; + color:#fff; +} + +.ant-radio .ant-radio-inner{ + border-color:var(--main-primary-escuro) !important; +} + +.ant-radio .ant-radio-inner:after{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-tabs-tabpane .ant-radio-button-wrapper{ + background-color:var(--main-linear-cora); +} + +.ant-switch{ + background-color:var(--main-primary-claro); + border-color:var(--main-primary-escuro) !important; + height:24px; + /*! position:absolute; */ +} + +.ant-switch-loading-icon, .ant-switch::after{ + height:20px; +} + +.ant-switch-disabled, +.ant-switch-checked{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-switch span{ + color:#444; +} + +.ant-switch-checked span{ + color:#fff; +} + +.ant-slider-handle, +.ant-slider-handle .ant-tooltip-open{ + background-color: #fff; + border: solid 2px var(--main-primary-escuro); + border-radius: 50%; + box-shadow: 0; +} + +.ant-slider-handle.ant-tooltip-open{ + box-shadow: 0px 0px 5px var(--main-grey-claro) !important; + border: solid 2px var(--main-primary-escuro); +} + +.ant-slider:hover .ant-slider-handle, +.ant-slider-handle:hover, +.ant-slider-handle:focus{ + background-color: var(--main-primary-escuro); + border: solid 2px var(--main-primary-escuro) !important; + border-radius: 50%; + box-shadow: 0; + box-shadow: 0px 0px 5px var(--main-grey-claro) !important; +} + +.ant-slider-track{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-slider-rail{ + background-color:var(--main-primary-claro) !important; +} + +.ant-avatar-icon{ + background-color:transparent; +} + + +/* HEADER */ +.layout.ant-layout .header{ + background-color:#fff !important; +} + +/* MENU ACTIVE */ +.ant-menu-vertical .ant-menu-item::after, .ant-menu-vertical-left .ant-menu-item::after, .ant-menu-vertical-right .ant-menu-item::after, .ant-menu-inline .ant-menu-item::after { + border-color:var(--main-primary-escuro) !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected a{ + color:#000 !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item.ant-menu-item-selected { + background-color: var(--main-primary-claro) !important; +} + +/* MENU LIGHT */ +.sider.light .ant-menu-light, +.sider.light .ant-menu-submenu > .ant-menu{ + background-color:transparent; +} + +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::before, +.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow::after{ + background-color: #fff !important; +} + +/* MENU ITEM */ +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item:hover, +.ant-menu:not(.ant-menu-horizontal) .ant-menu-submenu div:hover{ + background-color: var(--main-primary-escuro) !important; +} + +.ant-menu-inline-collapsed .ant-menu-submenu-title{ + margin:0px !important; +} + + +/* CARDS DASHBOARD */ +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card{ + background-color:var(--main-vermelho) !important; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card{ + background-color:var(--main-verde) !important; +} + +.usage-dashboard-chart-card-inner h2, +.usage-dashboard-chart-card-inner h3{ + color:#fff !important; +} + +/* CHARTS */ + +.ant-progress .ant-progress-status-normal path{ + stroke:var(--main-exception) !important; +} + +.ant-progress-circle.ant-progress-status-normal .ant-progress-text{ + color:var(--main-normal) !important; + font-weight: bold +} + +.ant-progress.ant-progress-status-normal path.ant-progress-circle-path{ + stroke:var(--main-normal) !important; +} + +.ant-progress.ant-progress-status-exception path.ant-progress-circle-path, +.ant-progress.ant-progress-status-active path.ant-progress-circle-path{ + stroke:var(--main-exception) !important; +} + +.ant-progress path.ant-progress-circle-trail{ + stroke:var(--main-grey-claro) !important; +} + +.ant-progress-circle.ant-progress-status-exception .ant-progress-text, +.ant-progress-circle.ant-progress-status-active .ant-progress-text{ + color:var(--main-exception) !important; + font-weight: bold +} + +/* LIST TABLES */ +.ant-list .ant-list-item{ + border-left:5px solid transparent !important; + padding-left:10px; +} + +.ant-list .ant-list-item:hover{ + background-color:#ffffff33 !important; + border-left:5px solid var(--main-primary-escuro) !important; +} + +.ant-list.ant-list-split .ant-list-item:hover{ + background-color:transparent !important; + +} + +.ant-list .ant-list-item .ant-btn{ + opacity:0; +} + +.ant-list .ant-list-item:hover .ant-btn{ + background-color:var(--main-primary-escuro) !important; + color:#fff !important; + opacity:1; +} + +.ant-list .ant-list-item-action-split{ + opacity:0; +} + +.ant-list .ant-list-item:hover .ant-btn:hover{ + border-color:var(--main-secondary-escuro) !important; + background-color:var(--main-secondary-escuro) !important; +} + +/* OTHERS */ + +.ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected{ + background-color:var(--main-primary-claro) +} + +/* MODAL */ +.ant-modal .ant-modal-header{ + background-color:var(--main-primary-claro); +} + +.ant-modal .ant-modal-header *{ + color:#fff; +} + +.ant-modal .ant-row.ant-form-item{ + margin-bottom:20px !important; +} + +.ant-modal .ant-row.ant-form-item .ant-form-item-label{ + padding-bottom:0px !important; +} + +.ant-row.ant-form-item{ + margin-bottom:20px !important; +} + +.ant-steps-item .ant-form.ant-form-vertical{ + margin-top:20px !important; +} + +.ant-row.ant-form-item .ant-form-item-label{ + padding-bottom:0px !important; +} + +.ant-modal .ant-modal-title{ + font-size:20px +} + +.ant-modal .ant-modal-title .anticon{ + font-size:15px +} + +.ant-modal .ant-modal-body .anticon{ + /* position:absolute; */ + transform: scale(0.9); + margin-left:5px; +} + +.ant-select-selector .anticon{ + position: relative !important; + margin-left:0px !important; +} + +.ant-modal .anticon:hover{ + color:var(--main-primary-escuro); +} + +.ant-modal .ant-modal-close{ + color:#fff; + height:54px; + transition:all 1s easyin; + background-color:transparent; +} + +.ant-modal .ant-modal-close:hover{ + background-color:var(--main-primary-escuro); +} + +.ant-modal .ant-modal-close-x:hover svg{ + color:#fff; +} + +.ant-modal .ant-modal-close-x svg{ + transform: scale(1.3); +} + +/* REGISTRATIONS FORMS AND ADDS */ +.ant-steps-item-tail{ + margin-top:15px; +} + +.ant-steps-item-tail:after{ + background-color:var(--main-grey-claro) !important; +} + +.ant-steps-item-icon{ + background-color:var(--main-primary-escuro) !important; + border-color:var(--main-primary-escuro) !important; + margin-top:10px +} + +.ant-steps-item .ant-card-head{ + padding:0px; +} + +.ant-steps-item .ant-radio-group .ant-card-grid{ + box-shadow: ;none; + border:2px solid var(--main-grey-claro) +} + +.ant-steps-item .ant-card-meta-description{ + color:var(--main-grey-claro) !important; +} + +.ant-steps-item .ant-card-body .ant-tabs-nav > div .ant-tabs-tab, +.ant-steps-item .ant-card-contain-tabs .ant-card-body{ + background-color:var(--main-linear-cora) !important; +} + +.ant-steps-item .ant-card-grid .ant-radio-wrapper{ + width:100%; + border-radius:7px; + padding:10px; +} + +.ant-steps-item .ant-radio-wrapper:hover{ + background-color:green !important; +} + + +.ant-steps-item .ant-card-grid .ant-radio-wrapper:hover{ + background-color: blue !important; +} + +.ant-steps-item .ant-radio-group label:not(.ant-radio-button-wrapper-checked):hover{ + background-color:transparent !important; +} + +.ant-steps-item #zoneid .ant-card-grid .ant-radio-wrapper{ + background-color: var(--main-grey-escuro) !important; +} + +.ant-steps-item #zoneid .ant-card-grid .ant-radio-wrapper:hover{ + background-color: var(--main-primary-claro) !important; +} + +.ant-steps-item .ant-card-grid .ant-radio-wrapper .anticon{ + margin-left:0px !important; + width:100%; + margin-top:0px !important; +} + +.ant-steps-item .ant-list .ant-list-item:hover{ + background-color:var(--main-primary-claro) !important; + border-left:5px solid transparent !important; +} + +.ant-steps-item{ + margin-bottom:30px; + margin-top:0px; +} + +.ant-table-body, +.ant-list-vertical.form-item-scroll .ant-spin-container{ + max-height:none !important;; +} + +.ant-steps-item-title{ + width:100%; + height:40px; + display: flex; + align-items: center; + border-top:0px solid #ffffff55 !important; + font-weight:00 !important; + font-size:22px !important; +} + +/* DARK HOME */ +body #userLayout{ + background-color:var(--main-linear-cora) !important; +} + +.userLayout .user-layout-header{ + margin-bottom:20px; +} + +.userLayout .anticon-translation{ + color:#FFF; +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active{ + background-color:var(--main-primary-escuro) !important; + color: #fff; + border-bottom:3px solid var(--main-primary-escuro); +} + +.user-layout .ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + background-color:var(--main-linear-cora) !important; + color: #fff; + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-layout-footer *{ + color:#fff !important; +} + +.ant-card{ + border:0px !important; +} + +.ant-card-body *:not(a):not(.ant-tag):not(.ant-tag *):not(input):not(.ant-select-selection-item span):not(div.ant-select *), +.ant-table *:not(a):not(.ant-tag):not(.ant-tag *):not(input):not(.ant-select-selection-item span){ + color:#fff; +} + +.ant-input-suffix .anticon:not(.anticon-search ) *{ + color:#000 !important; +} + +.ant-alert-info *{ + color:#000 !important; +} + +.anticon.anticon-delete{ + background-color:var(--main-vermelho); + padding:0px; + border-radius:50px; +} + +.ant-popover-inner-content .anticon.anticon-delete{ + padding:0px; +} + +.anticon.anticon-delete svg path:first-child{ + fill:transparent; +} + +.anticon.anticon-delete svg path:last-child{ + fill:#fff; +} + +.ant-pagination .ant-select-item-option-content span{ + color:#000 !important; +} + +.ant-select-selection-item{ + color:#000 !important; +} + +.ant-table a{ + color:var(--main-primary-escuro) !important; +} + + +.ant-table tr, +.ant-table th, +.ant-table-footer, +.ant-card-body, +.ant-layout, +.ant-layout-footer{ + background-color:var(--main-linear-cora) !important; +} + +.ant-table tr.ant-table-row-selected td{ + background-color:var(--main-secondary-claro); +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card .ant-card-body{ + background-color:var(--main-verde) !important; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card .ant-card-body{ + background-color:var(--main-vermelho) !important; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col .ant-card.usage-dashboard-chart-card .ant-card-body{ + background-color:#fff !important; +} + +.usage-dashboard-chart-card-inner h2, +.usage-dashboard-chart-card-inner h3, +.usage-dashboard-chart-card-inner svg{ + color:#000 !important; + fill:#000; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner svg, +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner svg, +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner h2, +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner h2, +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner h3, +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(1) .ant-card.usage-dashboard-chart-card .ant-card-body .usage-dashboard-chart-card-inner h3{ + color:#fff !important; + fill:#fff; +} + +.usage-dashboard .ant-card-body .ant-row .ant-col:nth-child(2) .ant-card.usage-dashboard-chart-card .ant-card-body{ + background-color:var(--main-vermelho) !important; +} + +.ant-table tr a, +.ant-table th a{ + color:var(--main-primary-text) !important; +} + +.ant-pagination{ + color:#fff; +} + +.ant-tabs-tabpane .ant-table tr, +.ant-tabs-tabpane .ant-table-footer, +.ant-tabs-tabpane .ant-table th{ + background-color:var(--main-linear-cora) !important; +} + +.usage-dashboard .ant-tabs-tabpane .ant-table table, +.usage-dashboard .ant-tabs-tabpane .ant-table tr, +.usage-dashboard .ant-tabs-tabpane .ant-table-footer, +.usage-dashboard .ant-tabs-tabpane .ant-table th{ + background-color:var(--main-linear-cora) !important; +} + +.ant-tabs-tabpane .ant-table tr, +.ant-tabs-tabpane .ant-table th{ + background-color: var(--main-linear-cora) !important; +} + +.ant-tabs-tabpane .ant-pagination{ + color:#000; +} + +.ant-tabs .ant-tabs-left-content{ + border-left: 0px !important; +} + +.ant-tabs .ant-tabs-bar{ + border-color:transparent; +} + +.ant-layout-content .page-header-wrapper-grid-content-main .ant-row .ant-col-lg-16 .ant-card-body{ + background-color:var(--main-linear-cora) !important; +} + +.ant-select-selection-item, +.ant-select-selector, +.ant-select-selector *{ + color:#666 !important; +} + +.ant-layout-content .page-header-wrapper-grid-content-main .ant-row .ant-col-lg-16 .ant-card-body *:not(a):not(input):not(.ant-radio-button-wrapper-checked span):not(button *):not(.ant-select-selector *):not(.ant-select-item-option-content){ + color:#fff; +} + +.ant-layout-content .page-header-wrapper-grid-content-main .ant-row .ant-col-lg-16 .ant-card-body p.ant-empty-description:not(.ant-radio-button-wrapper-checked span):not(button *){ + color:#fff !important; +} + +.input-search .ant-input-group-addon{ + border:0px; +} + +.ant-select-arrow path{ + color:#666 !important; +} + +.ant-input-search, +.ant-input-search .ant-input-search-icon{ + border:0px !important; +} + +.ant-progress.ant-progress-status-active .ant-progress-inner, +.ant-progress.ant-progress-status-normal .ant-progress-inner{ + background-color:#ffffff33 !important; +} + +.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected a{ + color:#fff !important; +} + +.ant-menu span.ant-menu-title-content .custom-icon path, +.ant-menu span.ant-menu-title-content:hover .custom-icon path{ + fill:#fff !important; +} + +.ant-menu-submenu-popup.ant-menu-light, .ant-menu-light > .ant-menu, +.ant-menu-submenu ul, +.ant-menu-submenu ul .ant-menu-item { + background:var(--main-grey-escuro) !important; +} + +.ant-pagination .ant-pagination-item.ant-pagination-item-active{ + border:0px; +} + +.ant-pagination .ant-pagination-item{ + border:0px; + margin-left:2px !important; +} + +.ant-table-placeholder{ + background:var(--main-linear-cora) +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab{ + margin:0px; + padding:14px 30px; + border-bottom:3px solid transparent; + transform: all 1s easyin !important; + background-color:var(--main-linear-cora) !important; + font-weight: 600; +} + +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab.ant-tabs-tab-active, +.ant-tabs-top-bar .ant-tabs-nav-scroll .ant-tabs-tab:hover{ + background-color:var(--main-primary-escuro) !important; + color: #fff; + border-bottom:3px solid var(--main-primary-escuro); +} + +.ant-table .ant-table-body .ant-btn{ + background:var(--main-primary-escuro) !important; +} + +.ant-table .ant-table-body .ant-btn:hover{ + background:var(--main-primary-claro) !important; +} + +.ant-input-group-addon{ + background-color:transparent; +} + +/* FIM DARKMODE */ + +button.ant-btn.ant-btn-dangerous:not(.ant-btn-icon-only) +{ + background-color:var(--main-vermelho) !important; +} + +/* TREE FILES */ +.ant-tree-icon__customize, +.ant-tree.ant-tree-show-line li span.ant-tree-switcher{ + background-color:transparent; +} + +.ant-tree .ant-tree-node-content-wrapper:hover{ + background-color:inherit !important; +} + +.ant-tree .ant-tree-node-content-wrapper:hover span{ + color:var(--main-primary-escuro) !important; +} + + + + + + +.ant-dropdown-placement-bottomRight ul{ + background-color:#fff;; +} + + +.ant-dropdown-placement-bottomRight li *{ + color:#000 !important; +} + +.ant-table .ant-table-row-expand-icon{ + border-radius:50px; +} + +.ant-table .ant-table-expanded-row.ant-table-expanded-row-level-1:hover td, +.ant-table .ant-table-expanded-row.ant-table-expanded-row-level-1 td:hover{ + background-color:transparent !important; +} + +.ant-table .ant-table-row-expand-icon:after{ + color:#000; + display:flex; + justify-content: center; + align-items: center; + height:100%; + width:100%; +} + +.vm-info-card .resource-detail-item__details a, .vm-info-card .resource-detail-item a { + color: var(--main-primary-escuro); + cursor: default; + pointer-events: none; +} + +/* Modal */ +.ant-modal-content{ + background-color:var(--main-linear-cora); + border:1px solid #fff; +} + +.ant-modal-content .ant-radio-group.ant-radio-group-solid span{ + color:#000 !important; +} + +.ant-modal-content .ant-radio-group.ant-radio-group-solid label{ + background-color:#fff; +} + +.ant-modal-content .ant-radio-group.ant-radio-group-solid .ant-radio-button-wrapper-checked span, +.ant-modal-content .ant-radio-group.ant-radio-group-solid label:hover span{ + color:#fff !important; +} + +.ant-modal-content label{ + color:#fff; +} + +.ant-modal-content .ant-tabs-nav .ant-tabs-tab{ + color:#fff; +} + +.resource-detail-item{ + border-bottom: 1px solid #777; + padding-bottom: 20px; +} + +.account-center-tags .ant-divider-horizontal{ + display:none +} + + +/* MODAL Steps */ + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item-title{ + font-size:14px !important; + border-top:0px !important; + justify-content: center; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-wait .ant-steps-item-icon{ + background-color:#ddd !important; + border-color:#999 !important; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-wait .ant-steps-item-icon span{ + color:#999; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-finish .ant-steps-item-icon{ + background-color:#555 !important; + border-color:#555 !important; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-finish .ant-steps-item-icon span{ + color:white !important; + right:-3px; + top:9px; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item-container .ant-steps-item-icon{ + background-color:var(--main-primary-claro) !important; + margin-top:0px; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-active .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-primary-escuro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-wait .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-primary-claro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-finish .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + background-color:var(--main-secondary-escuro) !important; +} + +.ant-modal-body .ant-steps.ant-steps-dot .ant-steps-item.ant-steps-item-finish .ant-steps-item-container .ant-steps-item-icon .ant-steps-icon-dot{ + color:white !important; + left:0px !important; + top:0px; +} + +.ant-modal-body .ant-table-body .ant-tag span{ + position:relative !important; +} + +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle{ + padding-top:15px !important; +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous{ + background-color:var( --main-vermelho); + border-color:var( --main-vermelho); +} + +.ant-modal-body .ant-form-item-control-input .anticon.anticon-close-circle{ + top:0px !important; + bottom:0px !important; + left:-10px !important; +} + +.ant-modal-body .ant-form-item-control-input .ant-select-arrow{ + right:15px +} + +.ant-form-item-has-feedback .ant-form-item-control-input :not(.ant-input-group-addon) > .ant-select .ant-select-arrow{ + right:40px +} + +.ant-modal-body .ant-form-item-control-input .ant-select-clear{ + background-color:transparent !important; + top:13px; + right:-20px !important; +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous .anticon{ + /* left:2px; + top:7px; */ +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous:hover, +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle:hover{ + background-color:var(--main-secondary-escuro); + border-color:var(--main-secondary-escuro); +} + +.ant-modal-body .ant-table-body button.ant-btn-circle.ant-btn-dangerous .anticon, +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle:hover svg{ + color:#fff; +} + +.ant-modal-body .ant-table-body .traffic-select-item > span button.ant-btn-circle > span{ + top:4px; + left:-1px; +} + +.ant-modal-body .traffic-select-item .ant-select-arrow .anticon.anticon-down{ + margin-left:0px !important; +} + +.ant-modal-body .ant-form-item-control-input .anticon.anticon-close-circle, +.ant-modal-body .ant-form-item-control-input .anticon.anticon-check-circle{ + left:5px; + top:4px !important; +} + +.ant-modal-body .card-waiting-launch .anticon-check-circle{ + position: absolute; + font-size:40px !important; + left:60px; + top:40px +} + +.ant-modal-body .anticon-rocket{ + left:1px; + bottom:7px; +} + +.ant-modal-body .anticon-rocket:hover{ + color:inherit !important; +} + +.card-launch-content .ant-steps-item-finish .anticon.anticon-check.ant-steps-finish-icon{ + right:-6px; + color:#fff; + top:19px +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon .ant-steps-icon .anticon{ + left:-10px +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon .ant-steps-icon .anticon.ant-steps-finish-icon{ + position: absolute; +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon{ + min-width:23px !important; +} + +.card-launch-content .anticon.anticon-close-circle{ + left:-15px !important; +} + +.card-launch-content .anticon.anticon-loading{ + top:1px +} + +/* NOVAS ENTRADAS */ +.ant-spin-nested-loading .ant-table-bordered .ant-table-body .ant-table-row-cell-break-word .ant-btn-circle{ + +} + +.ant-modal-body .ant-table-bordered .ant-table-body .ant-table-row-cell-break-word .ant-btn-circle.ant-btn-dangerous{ + background-color:var(--main-vermelho) !important; + + &:hover{ + background-color:var(--main-secondary-escuro) !important; + } + +} + +.ant-alert .ant-alert-message{ + margin-left:40px; +} + +.ant-alert:not(.ant-alert-no-icon) .ant-alert-message{ + margin-left:40px; +} + +.ant-btn-dangerous.ant-btn-primary.ant-btn-dangerous{ + background:var(--main-vermelho); + border-color:var(--main-vermelho); +} + + +/* DARK ONLY */ +.ant-modal-body .ant-table-bordered .ant-table-body .ant-table-row-cell-break-word .ant-btn-circle.ant-btn-dangerous span{ + background-color: transparent; + margin-right:5px !important; +} + +.ant-steps-item-content .ant-card.ant-card-bordered .ant-card-body{ + border:1px solid var(--main-primary-escuro) !important; + border-radius: 0px; +} + +.ant-modal-body .ant-form.ant-form-horizontal.form-content{ + background-color:transparent !important; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item-title{ + color:#fff; +} +.ant-modal-body .zone-support{ + background:transparent !important; +} + +.ant-card-bordered:not(:last-child){ + border-bottom:1px solid rgba(255,255,255,0.5) !important; +} + +.ant-steps-item-description .ant-card-bordered:not(:last-child){ + border-bottom:0px !important; +} + +.ant-card-bordered.ant-form-text{ + background-color:var(--main-grey-escuro); + border-bottom:0px !important; + color:#fff; +} + +.ant-modal-body .ant-steps.ant-steps-horizontal .ant-steps-item.ant-steps-item-finish .ant-steps-item-icon span{ + color:white !important; + right:3px; + top:0px; +} + +.ant-steps-item-icon{ + background-color:var(--main-primary-escuro) !important; + border-color:var(--main-primary-escuro) !important; + margin-top:10px +} + +.card-launch-content .ant-steps-item .ant-steps-item-icon{ + background-color:transparent !important; +} + +form.ant-form .ant-form-item-explain.ant-form-item-explain-error{ + color:pink !important; +} diff --git a/ui/public/example.html b/ui/public/example.html index df59d49086d3..2992eae80c79 100644 --- a/ui/public/example.html +++ b/ui/public/example.html @@ -16,7 +16,7 @@ specific language governing permissions and limitations under the License. --> - + diff --git a/ui/public/index.html b/ui/public/index.html index b681ad6a9028..0f0bfe59397b 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -16,7 +16,7 @@ specific language governing permissions and limitations under the License. --> - + @@ -54,12 +54,4 @@
    - diff --git a/ui/public/locales/ar.json b/ui/public/locales/ar.json index 20499c63e044..e8e4db66cb59 100644 --- a/ui/public/locales/ar.json +++ b/ui/public/locales/ar.json @@ -14,12 +14,12 @@ "label.account.specific": "Account-Specific", "label.accounts": "Accounts", "label.accounttype": "Account Type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Name", +"label.acl.rule.name": "ACL Name", "label.acquire.new.ip": "Acquire New IP", "label.acquire.new.secondary.ip": "Acquire new secondary IP", "label.action": "Action", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Active Sessions", "label.add": "Add", "label.add.account": "Add Account", -"label.add.acl": "\u0625\u0636\u0627\u0641\u0629 ACL", -"label.add.acl.list": "Add ACL List", +"label.add.acl.rule": "\u0625\u0636\u0627\u0641\u0629 ACL", +"label.add.acl": "Add ACL", "label.add.affinity.group": "Add new affinity group", "label.add.baremetal.dhcp.device": "Add Baremetal DHCP Device", "label.add.bigswitchbcf.device": "Add BigSwitch BCF Controller", @@ -142,12 +142,12 @@ "label.add.ip.range": "Add IP Range", "label.add.isolated.network": "Add Isolated Network", "label.add.ldap.account": "Add LDAP account", -"label.add.list.name": "ACL List Name", +"label.add.acl.name": "ACL Name", "label.add.more": "Add More", "label.add.netscaler.device": "Add Netscaler device", "label.add.network": "Add Network", "label.add.network.acl": "\u0625\u0636\u0627\u0641\u0629 \u0634\u0628\u0643\u0629 ACL", -"label.add.network.acl.list": "Add Network ACL List", +"label.add.network.acl": "Add Network ACL", "label.add.network.offering": "Add network offering", "label.add.new.gateway": "\u0623\u0636\u0641 \u0628\u0648\u0627\u0628\u0629 \u062c\u062f\u064a\u062f\u0629", "label.add.new.tier": "\u0625\u0636\u0627\u0641\u0629 \u0637\u0628\u0642\u0629 \u062c\u062f\u064a\u062f\u0629", @@ -334,7 +334,7 @@ "label.default.use": "Default Use", "label.default.view": "\u0637\u0631\u064a\u0642\u0629 \u0627\u0644\u0639\u0631\u0636 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629", "label.delete": "Delete", -"label.delete.acl.list": "Delete ACL List", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "Delete Affinity Group", "label.delete.alerts": "Delete alerts", "label.delete.bigswitchbcf": "Remove BigSwitch BCF Controller", @@ -419,7 +419,7 @@ "label.dpd": "\u0643\u0634\u0641 \u0627\u0644\u0642\u0631\u064a\u0646 \u0627\u0644\u0645\u0641\u0642\u0648\u062f", "label.driver": "Driver", "label.edit": "Edit", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.project.details": "\u0627\u0636\u0627\u0641\u0629 \u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0645\u0634\u0631\u0648\u0639", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "Remove VPC offering", "label.removing": "Removing", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL List", "label.required": "Required", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires Upgrade", @@ -1150,8 +1149,7 @@ "label.usehttps": "\u0627\u0633\u062a\u062e\u062f\u0645 HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "User", -"label.userdata": "Userdata", -"label.userdatal2": "User Data", +"label.user.data": "User Data", "label.username": "Username", "label.users": "Users", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Please confirm you would like to archive the selected alerts", "message.confirm.archive.selected.events": "Please confirm you would like to archive the selected events", "message.confirm.attach.disk": "Are you sure you want to attach disk?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v", diff --git a/ui/public/locales/ca.json b/ui/public/locales/ca.json index 30ed3161448e..d3e417eb821e 100644 --- a/ui/public/locales/ca.json +++ b/ui/public/locales/ca.json @@ -14,12 +14,12 @@ "label.account.specific": "Account-Specific", "label.accounts": "Accounts", "label.accounttype": "Account Type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Name", +"label.acl.rule.name": "ACL Name", "label.acquire.new.ip": "Acquire New IP", "label.acquire.new.secondary.ip": "Acquire new secondary IP", "label.action": "Action", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Active Sessions", "label.add": "Add", "label.add.account": "Add Account", +"label.add.acl.rule": "Add ACL rule", "label.add.acl": "Add ACL", -"label.add.acl.list": "Add ACL List", "label.add.affinity.group": "Add new affinity group", "label.add.baremetal.dhcp.device": "Add Baremetal DHCP Device", "label.add.bigswitchbcf.device": "Add BigSwitch BCF Controller", @@ -142,12 +142,12 @@ "label.add.ip.range": "Add IP Range", "label.add.isolated.network": "Add Isolated Network", "label.add.ldap.account": "Add LDAP account", -"label.add.list.name": "ACL List Name", +"label.add.acl.name": "ACL Name", "label.add.more": "Add More", "label.add.netscaler.device": "Add Netscaler device", "label.add.network": "Add Network", "label.add.network.acl": "Add network ACL", -"label.add.network.acl.list": "Add Network ACL List", +"label.add.network.acl": "Add Network ACL", "label.add.network.offering": "Add network offering", "label.add.new.gateway": "Add new gateway", "label.add.new.tier": "Add new tier", @@ -334,7 +334,7 @@ "label.default.use": "Default Use", "label.default.view": "Default View", "label.delete": "Delete", -"label.delete.acl.list": "Delete ACL List", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "Delete Affinity Group", "label.delete.alerts": "Delete alerts", "label.delete.bigswitchbcf": "Remove BigSwitch BCF Controller", @@ -419,7 +419,7 @@ "label.dpd": "Dead Peer Detection", "label.driver": "Driver", "label.edit": "Edit", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.project.details": "Editar detalls del projecte", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "Remove VPC offering", "label.removing": "Esborrant", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL List", "label.required": "Required", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires Upgrade", @@ -1150,8 +1149,7 @@ "label.usehttps": "Use HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "User", -"label.userdata": "Userdata", -"label.userdatal2": "User Data", +"label.user.data": "User Data", "label.username": "Username", "label.users": "Users", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Please confirm you would like to archive the selected alerts", "message.confirm.archive.selected.events": "Please confirm you would like to archive the selected events", "message.confirm.attach.disk": "Are you sure you want to attach disk?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v", diff --git a/ui/public/locales/de_DE.json b/ui/public/locales/de_DE.json index c20bf175826e..2fee92021638 100644 --- a/ui/public/locales/de_DE.json +++ b/ui/public/locales/de_DE.json @@ -26,12 +26,12 @@ "label.account.specific": "Besonderheiten des Benutzerkontos", "label.accounts": "Benutzerkonten", "label.accounttype": "Benutzerkontotyp", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL-Kennung", -"label.acl.list.rules": "ACL-Listenregeln", +"label.acl.rules": "ACL-Listenregeln", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL-Name", +"label.acl.rule.name": "ACL-Name", "label.acquire.new.ip": "Neue IP erwerben", "label.acquire.new.secondary.ip": "Neue sekundäre IP anfordern", "label.acquiring.ip": "IP anfordern", @@ -144,8 +144,8 @@ "label.activeviewersessions": "Aktive Sitzungen", "label.add": "Hinzufügen", "label.add.account": "Konto hinzufügen", -"label.add.acl": "ACL hinzufügen", -"label.add.acl.list": "ACL-Liste hinzufügen", +"label.add.acl.rule": "ACL hinzufügen", +"label.add.acl": "ACL-Liste hinzufügen", "label.add.affinity.group": "Neue Affinitätsgruppe hinzufügen", "label.add.baremetal.dhcp.device": "Baremetal DHCP-Gerät hinzufügen", "label.add.bigswitchbcf.device": "Füge BigSwitch BCF Controller hinzu", @@ -169,12 +169,12 @@ "label.add.isolated.network": "Isoliertes Netzwerk hinzufügen", "label.add.kubernetes.cluster": "Kubernetes Cluster hinzufügen", "label.add.ldap.account": "LDAP-Konto hinzufügen", -"label.add.list.name": "ACL-Listename", +"label.add.acl.name": "ACL-Listename", "label.add.more": "Mehr hinzufügen", "label.add.netscaler.device": "Netscaler-Gerät hinzufügen", "label.add.network": "Netzwerk hinzufügen", "label.add.network.acl": "Netzwerk-ACL hinzufügen", -"label.add.network.acl.list": "Netzwerk-ACL-Liste hinzufügen", +"label.add.network.acl": "Netzwerk-ACL-Liste hinzufügen", "label.add.network.offering": "Netzwerkangebot hinzufügen", "label.add.new.gateway": "Neues Gateway hinzufügen", "label.add.new.tier": "Neue Ebene hinzufügen", @@ -259,6 +259,7 @@ "label.available": "Verfügbar", "label.back": "Zurück", "label.backup": "Backup", +"label.backups": "Backup", "label.backup.attach.restore": "Backup-Volume wiederherstellen und anhängen", "label.backup.offering.assign": "VM zum Backup-Angebot zuordnen", "label.backup.offering.remove": "VM vom Backup-Angebot entfernen", @@ -417,7 +418,7 @@ "label.default.view": "Standardansicht", "label.defaultnetwork": "Standard-Netzwerk", "label.delete": "Löschen", -"label.delete.acl.list": "ACL-Liste ersetzen", +"label.delete.acl": "ACL-Liste ersetzen", "label.delete.affinity.group": "Affinitätsgruppe entfernen", "label.delete.alerts": "Alarme löschen", "label.delete.backup": "Backup löschen", @@ -525,7 +526,7 @@ "label.driver": "Treiber", "label.dynamicscalingenabled": "Dynamische Skalierung aktiviert", "label.edit": "Bearbeiten", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "ACL-Regel bearbeiten", "label.edit.project.details": "Projektdetails bearbeiten", "label.edit.role": "Rolle bearbeiten", @@ -948,7 +949,7 @@ "label.netscaler.vpx": "NetScaler VPX LoadBalancer", "label.network": "Netzwerk", "label.network.acl": "Netzwerk-ACL", -"label.network.acl.lists": "Netzwerk ACL Listen", +"label.network.acls": "Netzwerk ACL Listen", "label.network.addvm": "Netzwerk zur VM hinzufügen", "label.network.desc": "Netzwerkbeschreibung", "label.network.domain": "Netzwerk-Domain", @@ -1198,7 +1199,6 @@ "label.remove.vpc.offering": "VPC-Angebot entfernen", "label.removing": "am Entfernen", "label.replace.acl": "ACL ersetzen", -"label.replace.acl.list": "ACL-Liste ersetzen", "label.report.bug": "Fehler melden", "label.required": "Erforderlich", "label.requireshvm": "HVM", @@ -1492,8 +1492,7 @@ "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Benutzer", "label.user.conflict": "Konflikt", -"label.userdata": "Benutzerdaten", -"label.userdatal2": "Benutzerdaten", +"label.user.data": "Benutzerdaten", "label.username": "Benutzername", "label.users": "Benutzer", "label.usersource": "Benutzertyp", @@ -1733,7 +1732,7 @@ "message.confirm.archive.selected.alerts": "Bitte bestätigen Sie, dass Sie die ausgewählten Alarme archivieren möchten", "message.confirm.archive.selected.events": "Bitte bestätigen Sie, dass Sie die ausgewählten Vorgänge archivieren möchten", "message.confirm.attach.disk": "Sind Sie sicher, dass Sie eine Platte hinzufügen möchten?", -"message.confirm.delete.acl.list": "Sind Sie sicher, dass Sie diese ACL-Liste löschen möchten?", +"message.confirm.delete.acl": "Sind Sie sicher, dass Sie diese ACL-Liste löschen möchten?", "message.confirm.delete.bigswitchbcf": "Bitte bestätigen Sie, dass Sie diesen BigSwitch BCF Controller löschen möchten", "message.confirm.delete.brocadevcs": "Bitte bestätigen Sie, dass Sie Brocade Vcs Switch löschen möchten", "message.confirm.delete.ciscoasa1000v": "Bitte bestätigen Sie, dass Sie CiscoASA1000v löschen möchten", @@ -2079,7 +2078,7 @@ "message.success.create.internallb": "Interne LB erfolgreich erstellt", "message.success.create.isolated.network": "Isoliertes Netzwerk erfolgreich erstellt", "message.success.create.keypair": "SSH-Schlüsselpaar erfolgreich erstellt", -"message.success.create.kubernetes.cluter": "Kubernetes Cluster erfolgreich erstellt", +"message.success.create.kubernetes.cluster": "Kubernetes Cluster erfolgreich erstellt", "message.success.create.l2.network": "L2 Netzwerk erfolgreich erstellt", "message.success.create.volume": "Speicher erfolgreich erstellt", "message.success.delete": "Erfolgreich gelöscht", diff --git a/ui/public/locales/el_GR.json b/ui/public/locales/el_GR.json index f072dd43c09c..566e182b8fad 100644 --- a/ui/public/locales/el_GR.json +++ b/ui/public/locales/el_GR.json @@ -33,10 +33,10 @@ "label.access.kubernetes.nodes": "Πρόσβαση στους κόμβους Κυβερνητών", "label.acl.export": "Εξαγωγή Λίστας Πρόσβασης", "label.acl.id": "Αναγνωριστικό Λίστας Πρόσβασης", -"label.acl.list.rules": "Κανόνες λίστας Πρόσωασης", +"label.acl.rules": "Κανόνες λίστας Πρόσωασης", "label.acl.reason.description": "Εισαγάγετε αιτιολογία για τον κανόνα", "label.aclid": "Λίστα πρόσβασης", -"label.aclname": "Όνομα Λίστας Πρόσβασης", +"label.acl.rule.name": "Όνομα Λίστας Πρόσβασης", "label.acquire.new.ip": "Απόκτηση νέας διεύθυνση IP", "label.acquire.new.secondary.ip": "Απόκτηση νέας δευτερεύουσας διεύθυνσης IP", "label.acquiring.ip": "Απόδοση IP", @@ -173,7 +173,7 @@ "label.action.unmanage.virtualmachine": "Μη διαχείριση εικονικής μηχανής", "label.action.update.offering.access": "Ενημέρωση πρόσβασης για προσφορές", "label.action.update.resource.count": "Ενημέρωση πλήθους πόρων", -"label.action.userdata.reset": "Επαναφορά δεδομένων χρήστη", +"label.action.user.data.reset": "Επαναφορά δεδομένων χρήστη", "label.action.vmsnapshot.create": "Λήψη στιγμιότυπου εικονικής μηχανής", "label.action.vmsnapshot.delete": "Διαγραφή στιγμιότυπου εικονικής μηχανής", "label.action.vmsnapshot.revert": "Επαναφορά στο στιγμιότυπο εικονικής μηχανής", @@ -183,8 +183,8 @@ "label.activeviewersessions": "Ενεργές περίοδοι λειτουργίας", "label.add": "Προσθήκη", "label.add.account": "Προσθήκη λογαριασμού", -"label.add.acl": "Προσθήκη εγγραφής στην λίστα πρόσβασης", -"label.add.acl.list": "Προσθήκη λίστας πρόσβασης", +"label.add.acl.rule": "Προσθήκη εγγραφής στην λίστα πρόσβασης", +"label.add.acl": "Προσθήκη λίστας πρόσβασης", "label.add.affinity.group": "Προσθήκη νέας ομάδας συνάφειας", "label.add.baremetal.dhcp.device": "Προσθήκη συσκευής DHCP baremetal", "label.add.bigswitchbcf.device": "Προσθήκη ελεγκτή BCF BigSwitch", @@ -209,12 +209,12 @@ "label.add.isolated.network": "Προσθήκη απομονωμένου δικτύου", "label.add.kubernetes.cluster": "Προσθήκη ομάδας Κυβερνητών", "label.add.ldap.account": "Προσθήκη λογαριασμού LDAP", -"label.add.list.name": "Όνομα λίστας Πρόσβασης", +"label.add.acl.name": "Όνομα λίστας Πρόσβασης", "label.add.more": "Προσθήκη περισσότερων", "label.add.netscaler.device": "Προσθήκη συσκευής Netsccaler", "label.add.network": "Προσθήκη δικτύου", "label.add.network.acl": "Προσθήκη εγγραφής πρόσβασης δικτύου", -"label.add.network.acl.list": "Προσθήκη λίστας πρόσβασης δικτύου", +"label.add.network.acl": "Προσθήκη λίστας πρόσβασης δικτύου", "label.add.network.offering": "Προσθήκη προσφοράς υπηρεσίας δικτύου", "label.add.network.permission": "Προσθήκη δικαιωμάτων δικτύου", "label.add.new.gateway": "Προσθήκη νέας πύλης", @@ -317,6 +317,7 @@ "label.availableprocessors": "Διαθέσιμοι πυρήνες επεξεργαστή", "label.back": "Πίσω", "label.backup": "Αντίγραφα ασφαλείας", +"label.backups": "Αντίγραφα ασφαλείας", "label.backup.attach.restore": "Επαναφορά και επισύναψη τόμου αντιγράφου ασφαλείας", "label.backup.offering.assign": "Αντιστοίχιση εικονικής μηχανής με προσφορά δημιουργίας αντιγράφων ασφαλείας", "label.backup.offering.remove": "Κατάργηση εικονικής μηχανής από την προσφορά δημιουργίας αντιγράφων ασφαλείας", @@ -516,7 +517,7 @@ "label.default.view": "Προεπιλεγμένη προβολή", "label.defaultnetwork": "Προεπιλεγμένο δίκτυο", "label.delete": "Διαγραφή", -"label.delete.acl.list": "Διαγραφή λίστας πρόσβασης", +"label.delete.acl": "Διαγραφή λίστας πρόσβασης", "label.delete.affinity.group": "Διαγραφή ομάδας συνάφειας", "label.delete.alerts": "Διαγραφή ειδοποιήσεων", "label.delete.backup": "Διαγραφή αντιγράφου ασφαλείας", @@ -649,7 +650,7 @@ "label.dynamicscalingenabled": "Δυναμική αναπροσαρμογή Ενεργοποίημένη", "label.dynamicscalingenabled.tooltip": "Η εικονική μηχανή μπορεί να αναπροσαρμόζεται δυναμικά μόνο αν το πρότυπο, η προσφερόμενη υπηρεσία και οι γενικές ρυθμίσεις έχουν την επιλογή δυναμικής αναπροσαρμογής ενεργοποιήμενη.", "label.edit": "Επεξεργασία", -"label.edit.acl.list": "Επεξεργασία λίστας Πρόσβασης", +"label.edit.acl": "Επεξεργασία λίστας Πρόσβασης", "label.edit.acl.rule": "Επεξεργασία κανόνα Λίστας Πρόσβασης", "label.edit.project.details": "Επεξεργασία λεπτομερειών έργου", "label.edit.project.role": "Επεξεργασία ρόλου έργου", @@ -1142,7 +1143,7 @@ "label.netscaler.vpx": "Εξισορρόπηση φόρτου VPX του NetScaler", "label.network": "Δίκτυο", "label.network.acl": "ACL δικτύου", -"label.network.acl.lists": "Λίστες Λίστα Πρόσβασης δικτύου", +"label.network.acls": "Λίστες Λίστα Πρόσβασης δικτύου", "label.network.addvm": "Προσθήκη δικτύου για την εικονική μηχανή", "label.network.addvm": "Προσθήκη δικτύου σε εικονική μηχανή", "label.network.desc": "Δίκτυο Desc", @@ -1436,7 +1437,6 @@ "label.remove.vpc.offering": "Κατάργηση προσφοράς υπηρεσίας Εικον. Ιδιωτ. Νέφους", "label.removing": "Αφαίρεση", "label.replace.acl": "Αντικατάσταση λίστας Πρόσβασης", -"label.replace.acl.list": "Αντικατάσταση λίστας Πρόσβασης", "label.report.bug": "Θέμα αναφοράς", "label.required": "Απαιτείται", "label.requireshvm": "HVM", @@ -1455,7 +1455,7 @@ "label.reset.config.value": "Επαναφορά στις τιμές προεπιλογής", "label.reset.ssh.key.pair": "Επαναφορά ζεύγους κλειδιών SSH", "label.reset.to.default": "Επαναφορά στην τιμή προεπιλογής", -"label.reset.userdata.on.vm": "Επαναφορά δεδομένων χρήστη της εικονικής μηχανής", +"label.reset.user.data.on.vm": "Επαναφορά δεδομένων χρήστη της εικονικής μηχανής", "label.reset.vpn.connection": "Επαναφορά σύνδεσης Εικον. Ιδιωτ. Δικτύου", "label.resource": "Πόρος", "label.resource.limit.exceeded": "Υπέρβαση ορίου πόρων", @@ -1811,19 +1811,17 @@ "label.usenewdiskoffering": "Αντικατάσταση προσφοράς υπηρεσίας δίσκου;", "label.user": "Χρήστη", "label.user.conflict": "Σύγκρουση", -"label.user.data": "Δεδομένα χρηστών", -"label.userdata": "Δεδομένα χρήστη", -"label.userdata.do.append": "Πρόσθεση δεδομένων χρήστη", -"label.userdata.do.override": "Παράκαμψη δεδομένων χρήστη", -"label.userdata.registered": "Εγγεγραμένα δεδομένα χρήστη", -"label.userdata.text": "Κείμενο δεδομένων χρήστη", -"label.userdatadetails": "Λεπτομέρειες δεδομένων χρήστη", -"label.userdataid": "Αναγνωριστικό δεδομένων χρήστη", -"label.userdatal2": "Δεδομένα χρήστη", -"label.userdataname": "Όνομα δεδομένων χρήστη", -"label.userdataparams": "Παράμετροι δεδομένων χρήστη", -"label.userdatapolicy": "Συνδεμένες πολιτικές δεδομένων χρήστη", -"label.userdatapolicy.tooltip": "Τα δεδομένα χρήστη που έχουν συνδεθεί στο πρότυπο μπορούν να παρακαμφθούν απο τα δεδομένα χρηστών που ορίστηκαν κατα την δημιουργία της vm. Διαλέξτε την πολιτική παράκαμψης ανάλογα με τις απαιτήσεις.", +"label.user.data": "Δεδομένα χρήστη", +"label.user.data.do.append": "Πρόσθεση δεδομένων χρήστη", +"label.user.data.do.override": "Παράκαμψη δεδομένων χρήστη", +"label.user.data.registered": "Εγγεγραμένα δεδομένα χρήστη", +"label.user.data.text": "Κείμενο δεδομένων χρήστη", +"label.user.data.details": "Λεπτομέρειες δεδομένων χρήστη", +"label.user.data.id": "Αναγνωριστικό δεδομένων χρήστη", +"label.user.data.name": "Όνομα δεδομένων χρήστη", +"label.user.data.params": "Παράμετροι δεδομένων χρήστη", +"label.user.data.policy": "Συνδεμένες πολιτικές δεδομένων χρήστη", +"label.user.data.policy.tooltip": "Τα δεδομένα χρήστη που έχουν συνδεθεί στο πρότυπο μπορούν να παρακαμφθούν απο τα δεδομένα χρηστών που ορίστηκαν κατα την δημιουργία της vm. Διαλέξτε την πολιτική παράκαμψης ανάλογα με τις απαιτήσεις.", "label.username": "Όνομα χρήστη", "label.users": "Χρήστες", "label.usersource": "Τύπος χρήστη", @@ -2116,7 +2114,7 @@ "message.confirm.attach.disk": "Είστε βέβαιοι ότι θέλετε να επισυνάψετε το δίσκο;", "message.confirm.change.offering.for.volume": "Παρακαλώ επιβεβαιώστε ότι επιθυμείτε την αλλαγή της προσφοράς δίσκου για αυτόν τον τόμο", "message.confirm.configure.ovs": "Είστε βέβαιοι ότι θέλετε να ρυθμίσετε τις παραμέτρους του Ovs;", -"message.confirm.delete.acl.list": "Είστε βέβαιοι ότι θέλετε να διαγράψετε αυτήν τη λίστα Λίστα Πρόσβασης;", +"message.confirm.delete.acl": "Είστε βέβαιοι ότι θέλετε να διαγράψετε αυτήν τη λίστα Λίστα Πρόσβασης;", "message.confirm.delete.bigswitchbcf": "Επιβεβαιώστε ότι θέλετε να διαγράψετε αυτόν τον ελεγκτή BigSwitch BCF", "message.confirm.delete.brocadevcs": "Επιβεβαιώστε ότι θέλετε να διαγράψετε το εναλλάκτη Brocade Vcs", "message.confirm.delete.ciscoasa1000v": "Παρακαλώ επιβεβαιώστε ότι θέλετε να διαγράψετε CiscoASA1000v", @@ -2272,8 +2270,6 @@ "message.error.enable.saml": "Δεν είναι δυνατή η εύρεση των id χρηστών για την ενεργοποίηση του Saml σύνδεση μιας φοράς, παρακαλούμε να το ενεργοποιήσετε με μη αυτόματο τρόπο.", "message.error.end.date.and.time": "Παρακαλώ, εισάγετε την τελική ημερομηνία και ώρα!", "message.error.endip": "Πληκτρολογήστε End IP", -"message.error.fixed.offering.kvm": "Δεν είναι δυνατό να κλιμωκαθούν οι εικονές μηχανές που χρησιμοποιούν τον επόπτη KVM με ένα σταθερό υπολογισμό προσφοράς υπηρεσίας.", -"message.error.fixed.offering.kvm": "Δεν είναι εφικτή η κλιμάκωση προς τα πάνω της εικονικής μηχανής ενώ ανήκει σε μία σταθερή προσφορά νέφους.", "message.error.gateway": "Πληκτρολογήστε Πύλη", "message.error.host.name": "Πληκτρολογήστε το όνομα του κεντρικού υπολογιστή", "message.error.host.password": "Πληκτρολογήστε τον κωδικό πρόσβασης κεντρικού υπολογιστή", @@ -2350,7 +2346,7 @@ "message.error.upload.template": "Η αποστολή του προτύπου απέτυχε", "message.error.upload.template.description": "Μόνο ένα πρότυπο μπορεί να αποσταλεί κάθε φορά", "message.error.url": "Πληκτρολογήστε διεύθυνση URL", -"message.error.userdata": "Εισάγωγή δεδομένων χρηστών", +"message.error.user.data": "Εισάγωγή δεδομένων χρηστών", "message.error.username": "Εισάγετε το όνομα χρήστη σας", "message.error.valid.iops.range": "Εισαγεται ένα σωστό εύρος εργασίων εισαγ./εξαγ ανα δευτ.", "message.error.vcenter.datacenter": "Πληκτρολογήστε vCenter Datacenter", @@ -2572,7 +2568,7 @@ "message.success.create.internallb": "Η εσωτερική lb ολοκληρώθηκε με επιτυχία", "message.success.create.isolated.network": "Δημιουργήθηκε με επιτυχία απομονωμένο δίκτυο", "message.success.create.keypair": "Δημιουργήθηκε με επιτυχία ζεύγος κλειδιών SSH", -"message.success.create.kubernetes.cluter": "Δημιουργήθηκε με επιτυχία την ομάδαΚυβερνητών", +"message.success.create.kubernetes.cluster": "Δημιουργήθηκε με επιτυχία την ομάδαΚυβερνητών", "message.success.create.l2.network": "Δημιουργήθηκε με επιτυχία το δίκτυο L2", "message.success.create.snapshot.from.vmsnapshot": "Επιτυχής δημιουργία στιγμιότυπου από στιγμιότυπο εικονικής μηχανής", "message.success.create.user": "Ο χρήστης δημιουργήθηκε με επιτυχία", diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 2df2ebf5903f..3a16d613f37a 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -1,23 +1,25 @@ { -"alert.service.domainrouter": "Domain router", +"message.delete.account.not.disabled": "Please disable the account before attempting to delete it.", +"alert.service.domainrouter": "Domain Router", "error.dedicate.bgp.peer.failed":"Failed to dedicate BGP peer", -"error.dedicate.cluster.failed": "Failed to dedicate cluster.", -"error.dedicate.host.failed": "Failed to dedicate host.", +"error.dedicate.cluster.failed": "Failed to dedicate Cluster.", +"error.dedicate.host.failed": "Failed to dedicate Host.", "error.dedicate.ipv4.subnet.failed": "Failed to dedicate IPv4 subnet.", -"error.dedicate.pod.failed": "Failed to dedicate pod.", -"error.dedicate.zone.failed": "Failed to dedicate zone.", +"error.dedicate.pod.failed": "Failed to dedicate Pod.", +"error.dedicate.zone.failed": "Failed to dedicate Zone.", "error.empty.counter.operator.threshold": "Either Counter, Operator or Threshold is empty", "error.execute.api.failed": "Failed to execute API.", "error.fetching.async.job.result": "Error encountered while fetching async job result.", "error.form.message": "There are errors in the form. Please fix them.", "error.password.not.match": "The password fields do not match", "error.release.dedicate.bgp.peer": "Failed to release dedicated BGP peer.", -"error.release.dedicate.cluster": "Failed to release dedicated cluster.", +"error.release.dedicate.cluster": "Failed to release dedicated Cluster.", "error.release.dedicate.host": "Failed to release dedicated host.", "error.release.dedicate.ipv4.subnet": "Failed to release dedicated IPv4 subnet.", -"error.release.dedicate.pod": "Failed to release dedicated pod.", -"error.release.dedicate.zone": "Failed to release dedicated zone.", +"error.release.dedicate.pod": "Failed to release dedicated Pod.", +"error.release.dedicate.zone": "Failed to release dedicated Zone.", "error.unable.to.add.setting.extraconfig": "It is not allowed to add setting for extraconfig. Please update VirtualMachine with extraconfig parameter.", +"error.unable.to.add.setting": "Unable to add or edit setting", "error.unable.to.proceed": "Unable to proceed. Please contact your administrator.", "firewall.close": "Firewall", "icmp.code.desc": "Please specify -1 if you want to allow all ICMP codes (except NSX zones).", @@ -29,9 +31,9 @@ "label.accept.project.invitation": "Accept project invitation", "label.access": "Access", "label.access.kubernetes.nodes": "Access Kubernetes nodes", -"label.accesskey": "Access key", -"label.access.key": "Access key", -"label.secret.key": "Secret key", +"label.accesskey": "Access Key", +"label.access.key": "Access Key", +"label.secret.key": "Secret Key", "label.apikeyaccess": "Api Key Access", "label.account": "Account", "label.account.and.security.group": "Account - security group", @@ -41,18 +43,23 @@ "label.accounts": "Accounts", "label.accountstate": "Account state", "label.accounttype": "Account type", -"label.acl.export": "Export ACLs", +"label.import": "Import", +"label.acl.import": "Import rules", +"label.acl.export": "Export rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL list rules", +"label.acl.rules": "ACL rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", "label.aclname": "ACL name", +"label.acl.rule.name": "ACL rule name", "label.acquire.new.ip": "Acquire new IP", "label.acquire.new.secondary.ip": "Acquire new secondary IP", "label.acquiring.ip": "Acquiring IP", "label.associated.resource": "Associated resource", "label.action": "Action", -"label.action.attach.disk": "Attach disk", +"label.action.add.nodes.to.kubernetes.cluster": "Add nodes to Kubernetes cluster", +"label.action.remove.nodes.from.kubernetes.cluster": "Remove nodes from Kubernetes cluster", +"label.action.attach.disk": "Attach Disk", "label.action.attach.iso": "Attach ISO", "label.action.attach.to.instance": "Attach to Instance", "label.action.bulk.delete.egress.firewall.rules": "Bulk delete egress firewall rules", @@ -62,92 +69,100 @@ "label.action.bulk.delete.load.balancer.rules": "Bulk delete load balancer rules", "label.action.bulk.delete.portforward.rules": "Bulk delete port forward rules", "label.action.bulk.delete.routing.firewall.rules": "Bulk remove IPv4 Routing firewall rules", -"label.action.bulk.delete.snapshots": "Bulk delete snapshots", +"label.action.bulk.delete.snapshots": "Bulk delete Snapshots", "label.action.bulk.delete.templates": "Bulk delete Templates", "label.action.bulk.release.public.ip.address": "Bulk release public IP addresses", "label.action.cancel.maintenance.mode": "Cancel maintenance mode", "label.action.change.password": "Change password", "label.action.clear.webhook.deliveries": "Clear deliveries", -"label.action.delete.webhook.deliveries": "Delete deliveries", -"label.action.change.primary.storage.scope": "Change primary storage scope", +"label.action.clear.webhook.filters": "Clear filters", +"label.action.change.primary.storage.scope": "Change Primary Storage scope", "label.action.configure.stickiness": "Stickiness", +"label.action.configure.storage.access.group": "Update storage access group", "label.action.copy.iso": "Copy ISO", "label.action.copy.snapshot": "Copy Snapshot", "label.action.copy.template": "Copy Template", +"label.action.create.backup.schedule": "Create Backup Schedule", +"label.action.create.recurring.snapshot": "Create Recurring Snapshot", "label.action.create.snapshot.from.vmsnapshot": "Create Snapshot from Instance Snapshot", "label.action.create.template.from.volume": "Create Template from volume", -"label.action.create.volume": "Create volume", +"label.action.create.volume": "Create Volume", "label.action.create.volume.add": "Create and Add Volume", "label.action.delete.account": "Delete Account", "label.action.delete.backup.offering": "Delete backup offering", -"label.action.delete.cluster": "Delete cluster", -"label.action.delete.domain": "Delete domain", -"label.action.delete.egress.firewall": "Delete egress firewall rule", -"label.action.delete.firewall": "Delete firewall rule", +"label.action.delete.cluster": "Delete Cluster", +"label.action.delete.domain": "Delete Domain", +"label.action.delete.egress.firewall": "Delete Egress Firewall Rule", +"label.action.delete.firewall": "Delete Firewall Rule", "label.action.delete.interface.static.route": "Remove Tungsten Fabric interface static route", -"label.action.delete.guest.os": "Delete guest os", -"label.action.delete.guest.os.hypervisor.mapping": "Delete guest os hypervisor mapping", +"label.action.delete.gpu.card": "Delete GPU card", +"label.action.delete.guest.os": "Delete guest OS", +"label.action.delete.guest.os.category": "Delete guest OS category", +"label.action.delete.guest.os.hypervisor.mapping": "Delete guest OS hypervisor mapping", "label.action.delete.ip.range": "Delete IP range", "label.action.delete.iso": "Delete ISO", -"label.action.delete.load.balancer": "Delete load balancer rule", +"label.action.delete.load.balancer": "Delete Load Balancer Rule", "label.action.delete.network": "Delete Network", "label.action.delete.network.static.route": "Remove Tungsten Fabric Network static route", "label.action.delete.network.permission": "Delete Network permission", -"label.action.delete.node": "Delete node", +"label.action.delete.node": "Delete Node", "label.action.delete.oauth.provider": "Delete OAuth provider", "label.action.delete.physical.network": "Delete physical Network", "label.action.delete.pod": "Delete Pod", -"label.action.delete.primary.storage": "Delete primary storage", +"label.action.delete.primary.storage": "Delete Primary Storage", "label.action.delete.routing.firewall.rule": "Delete IPv4 Routing firewall rule", -"label.action.delete.secondary.storage": "Delete secondary storage", -"label.action.delete.security.group": "Delete security group", +"label.action.delete.secondary.storage": "Delete Secondary Storage", +"label.action.delete.security.group": "Delete Security Group", "label.action.delete.snapshot": "Delete Snapshot", "label.action.delete.template": "Delete Template", "label.action.delete.tungsten.router.table": "Remove Tungsten Fabric route table from Network", "label.action.delete.user": "Delete User", -"label.action.delete.volume": "Delete volume", -"label.action.delete.zone": "Delete zone", +"label.action.delete.vgpu.profile": "Delete vGPU profile", +"label.action.delete.volume": "Delete Volume", +"label.action.delete.webhook.deliveries": "Delete Deliveries", +"label.action.delete.webhook.filters": "Delete Filters", +"label.action.delete.zone": "Delete Zone", "label.action.destroy.instance": "Destroy Instance", -"label.action.destroy.systemvm": "Destroy system VM", -"label.action.destroy.volume": "Destroy volume", -"label.action.detach.disk": "Detach disk", +"label.action.destroy.systemvm": "Destroy System VM", +"label.action.destroy.volume": "Destroy Volume", +"label.action.detach.disk": "Detach Disk", "label.action.detach.iso": "Detach ISO", "label.action.disable.account": "Disable Account", -"label.action.disable.cluster": "Disable cluster", -"label.action.disable.disk.offering": "Disable disk offering", +"label.action.disable.cluster": "Disable Cluster", +"label.action.disable.disk.offering": "Disable Disk Offering", "label.action.disable.physical.network": "Disable physical Network", -"label.action.disable.pod": "Disable pod", +"label.action.disable.pod": "Disable Pod", "label.action.disable.role": "Disable Role", "label.action.disable.static.nat": "Disable static NAT", -"label.action.disable.service.offering": "Disable service offering", -"label.action.disable.system.service.offering": "Disable system service offering", +"label.action.disable.service.offering": "Disable Service Offering", +"label.action.disable.system.service.offering": "Disable System Service Offering", "label.action.disable.user": "Disable User", -"label.action.disable.zone": "Disable zone", +"label.action.disable.zone": "Disable Zone", "label.action.download.iso": "Download ISO", "label.action.download.snapshot": "Download Snapshot", "label.action.download.template": "Download Template", -"label.action.download.volume": "Download volume", +"label.action.download.volume": "Download Volume", "label.action.edit.account": "Edit Account", -"label.action.edit.domain": "Edit domain", +"label.action.edit.domain": "Edit Domain", "label.action.edit.instance": "Edit Instance", "label.action.edit.iso": "Edit ISO", "label.action.edit.nfs.options": "Edit NFS mount options", "label.action.edit.template": "Edit Template", -"label.action.edit.zone": "Edit zone", +"label.action.edit.zone": "Edit Zone", "label.action.enable.two.factor.authentication": "Enabled Two factor authentication", "label.action.verify.two.factor.authentication": "Verified Two factor authentication", "label.action.enable.account": "Enable Account", -"label.action.enable.cluster": "Enable cluster", +"label.action.enable.cluster": "Enable Cluster", "label.action.enable.disk.offering": "Enable disk offering", "label.action.enable.maintenance.mode": "Enable maintenance mode", "label.action.enable.physical.network": "Enable physical Network", -"label.action.enable.pod": "Enable pod", +"label.action.enable.pod": "Enable Pod", "label.action.enable.role": "Enable Role", -"label.action.enable.service.offering": "Enable service offering", -"label.action.enable.system.service.offering": "Enable system service offering", +"label.action.enable.service.offering": "Enable Service Offering", +"label.action.enable.system.service.offering": "Enable System Service Offering", "label.action.enable.static.nat": "Enable static NAT", "label.action.enable.user": "Enable User", -"label.action.enable.zone": "Enable zone", +"label.action.enable.zone": "Enable Zone", "label.action.expunge.instance": "Expunge Instance", "label.action.force.reconnect": "Force reconnect", "label.action.generate.keys": "Generate keys", @@ -163,22 +178,22 @@ "label.action.iso.share": "Update ISO sharing", "label.action.lock.account": "Lock Account", "label.action.lock.user": "Lock User", -"label.action.manage.cluster": "Manage cluster", -"label.action.migrate.router": "Migrate router", +"label.action.manage.cluster": "Manage Cluster", +"label.action.migrate.router": "Migrate Router", "label.action.migrate.systemvm": "Migrate System VM", -"label.action.migrate.systemvm.to.ps": "Migrate System VM to another primary storage", -"label.action.patch.systemvm": "Patch system VM", +"label.action.migrate.systemvm.to.ps": "Migrate System VM to another Primary Storage", +"label.action.patch.systemvm": "Patch System VM", "label.action.patch.systemvm.vpc": "Patch System VM - VPC Router", "label.action.patch.systemvm.processing": "Patching System VM....", -"label.action.project.add.account": "Add Account to project", -"label.action.project.add.user": "Add User to project", +"label.action.project.add.account": "Add Account to Project", +"label.action.project.add.user": "Add User to Project", "label.action.quota.tariff.create": "Create Quota Tariff", "label.action.quota.tariff.edit": "Edit Quota Tariff", "label.action.quota.tariff.remove": "Remove Quota Tariff", "label.action.reboot.instance": "Reboot Instance", -"label.action.reboot.router": "Reboot router", +"label.action.reboot.router": "Reboot Router", "label.action.reboot.systemvm": "Reboot System VM", -"label.action.recover.volume": "Recover volume", +"label.action.recover.volume": "Recover Volume", "label.action.resize.sharedfs": "Resize Shared FileSystem", "label.action.restart.sharedfs": "Restart Shared FileSystem", "label.action.recurring.snapshot": "Recurring Snapshots", @@ -188,7 +203,7 @@ "label.action.release.asnumber": "Release AS Number", "label.action.release.ip": "Release IP", "label.action.release.reserved.ip": "Release reserved IP", -"label.action.remove.host": "Remove host", +"label.action.remove.host": "Remove Host", "label.action.remove.logical.router": "Remove Logical Router", "label.action.remove.network.policy": "Remove Network Policy", "label.action.remove.router.table.from.interface": "Remove Tungsten Fabric route table from interface", @@ -197,36 +212,41 @@ "label.action.reserve.ip": "Reserve Public IP", "label.action.reset.network.permissions": "Reset Network permissions", "label.action.reset.password": "Reset password", -"label.action.resize.volume": "Resize volume", +"label.action.resize.volume": "Resize Volume", "label.action.revert.snapshot": "Revert to Snapshot", "label.action.router.health.checks": "Get health checks result", -"label.action.run.diagnostics": "Run diagnostics", +"label.action.run.diagnostics": "Run Diagnostics", "label.action.secure.host": "Provision host security keys", "label.action.set.as.source.nat.ip": "make source NAT", "label.action.setup.2FA.user.auth": "Setup User Two Factor Authentication", "label.action.start.sharedfs": "Start Shared FileSystem", "label.action.start.instance": "Start Instance", -"label.action.start.router": "Start router", -"label.action.start.systemvm": "Start system VM", +"label.action.start.router": "Start Router", +"label.action.start.systemvm": "Start System VM", "label.action.stop.sharedfs": "Stop Shared FileSystem", "label.action.stop.instance": "Stop Instance", -"label.action.stop.router": "Stop router", -"label.action.stop.systemvm": "Stop system VM", +"label.action.stop.router": "Stop Router", +"label.action.stop.systemvm": "Stop System VM", "label.action.take.snapshot": "Take Snapshot", "label.action.template.permission": "Update Template permissions", "label.action.template.share": "Update Template sharing", -"label.action.unmanage.cluster": "Unmanage cluster", +"label.action.unmanage.cluster": "Unmanage Cluster", "label.action.unmanage.instance": "Unmanage Instance", "label.action.unmanage.instances": "Unmanage Instances", "label.action.unmanage.virtualmachine": "Unmanage Instance", +"label.action.update.cluster": "Update cluster", +"label.action.update.pod": "Update pod", +"label.action.update.zone": "Update zone", +"label.action.update.storage.pool": "Update storage pool", "label.action.unmanage.volume": "Unmanage Volume", "label.action.unmanage.volumes": "Unmanage Volumes", -"label.action.update.host": "Update host", +"label.action.unregister.extension.resource": "Unregister extension resource", +"label.action.update.host": "Update Host", "label.action.update.security.groups": "Update security groups", "label.action.update.offering.access": "Update offering access", "label.action.update.resource.count": "Update resource count", +"label.action.user.data.reset": "Reset User Data", "label.action.value": "Action/Value", -"label.action.userdata.reset": "Reset Userdata", "label.action.vmsnapshot.create": "Take Instance Snapshot", "label.action.vmsnapshot.delete": "Delete Instance Snapshot", "label.action.vmsnapshot.revert": "Revert to Instance Snapshot", @@ -236,74 +256,83 @@ "label.activate.project": "Activate project", "label.activeviewersessions": "Active sessions", "label.add": "Add", +"label.addservices": "Add Services", "label.add.account": "Add Account", +"label.add.acl.rule": "Add rule", "label.add.acl": "Add ACL", -"label.add.acl.list": "Add ACL list", -"label.add.affinity.group": "Add new affinity group", +"label.add.affinity.group": "Add new Affinity Group", +"label.add.backup.schedule": "Add Backup Schedule", "label.add.baremetal.dhcp.device": "Add bare metal DHCP device", -"label.add.bgp.peer": "Add BGP peer", -"label.add.bigswitchbcf.device": "Add BigSwitch BCF controller", +"label.add.bgp.peer": "Add BGP Peer", +"label.add.bigswitchbcf.device": "Add BigSwitch BCF Controller", "label.add.brocadevcs.device": "Add Brocade Vcs Switch", "label.add.by": "Add by", "label.add.certificate": "Add certificate", "label.add.ciscoasa1000v": "Add CiscoASA1000v resource", -"label.add.cluster": "Add cluster", -"label.add.compute.offering": "Add compute offering", +"label.add.cluster": "Add Cluster", +"label.add.compute.offering": "Add Compute Offering", "label.add.condition": "Add condition", -"label.add.disk.offering": "Add disk offering", -"label.add.domain": "Add domain", -"label.add.egress.rule": "Add egress rule", +"label.add.custom.action": "Add Custom Action", +"label.add.disk.offering": "Add Disk Offering", +"label.add.domain": "Add Domain", +"label.add.egress.rule": "Add Egress Rule", +"label.add.external.details": "Add external details", "label.add.f5.device": "Add F5 device", -"label.add.firewall": "Add firewall rule", +"label.add.firewall": "Add Firewall Rule", "label.add.firewallrule": "Add Firewall Rule", -"label.add.guest.network": "Add guest Network", -"label.add.guest.os": "Add guest os", +"label.add.gpu.card": "Add GPU card", +"label.add.gpu.device": "Add GPU device", +"label.add.guest.os.category": "Add guest OS category", +"label.add.guest.network": "Add Guest Network", +"label.add.guest.os": "Add Guest OS", "label.add.guest.os.hypervisor.mapping": "Add guest os hypervisor mapping", -"label.add.host": "Add host", -"label.add.ingress.rule": "Add ingress rule", +"label.add.host": "Add Host", +"label.add.ingress.rule": "Add Ingress Rule", "label.add.intermediate.certificate": "Add intermediate certificate", "label.add.internal.lb": "Add internal LB", -"label.add.ip.range": "Add IP range", -"label.add.ipv4.subnet": "Add IPv4 subnet for Routed networks", +"label.add.ip.range": "Add IP Range", +"label.add.ipv4.subnet": "Add IPv4 Subnet for Routed Networks", "label.add.ip.v6.prefix": "Add IPv6 prefix", -"label.add.isolated.network": "Add isolated Network", -"label.add.kubernetes.cluster": "Add Kubernetes cluster", +"label.add.isolated.network": "Add Isolated Network", +"label.add.kubernetes.cluster": "Add Kubernetes Cluster", +"label.add.acl.name": "ACL name", +"label.add.latest.kubernetes.iso": "Add latest Kubernetes ISO", "label.add.ldap.account": "Add LDAP Account", -"label.add.list.name": "ACL List name", "label.add.logical.router": "Add Logical Router to this Network", +"label.add.minimum.required.compute.offering": "Add minimum required Compute Offering", "label.add.more": "Add more", -"label.add.netscaler.device": "Add Netscaler device", +"label.add.nodes": "Add Nodes to Kubernetes Cluster", +"label.add.netscaler.device": "Add Netscaler Device", "label.add.network": "Add Network", "label.add.network.acl": "Add Network ACL", -"label.add.network.acl.list": "Add Network ACL list", -"label.add.network.offering": "Add Network offering", +"label.add.network.offering": "Add Network Offering", "label.add.network.permission": "Add Network permission", -"label.add.new.gateway": "Add new gateway", +"label.add.new.gateway": "Add new Gateway", "label.add.new.tier": "Add new Network Tier", "label.add.niciranvp.device": "Add Nvp controller", "label.add.note": "Add comment", "label.add.opendaylight.device": "Add OpenDaylight controller", "label.add.pa.device": "Add Palo Alto device", "label.add.param": "Add param", -"label.add.physical.network": "Add physical Network", -"label.add.pod": "Add pod", +"label.add.physical.network": "Add Physical Network", +"label.add.pod": "Add Pod", "label.add.prefix": "Add prefix", "label.add.policy": "Add policy", -"label.add.primary.storage": "Add primary storage", -"label.add.private.gateway": "Add private gateway", -"label.add.resources": "Add resources", -"label.add.role": "Add role", -"label.add.route": "Add route", -"label.add.router.table.to.instance": "Add router table to this Instance", -"label.add.routing.policy": "Add routing policy", -"label.add.rule": "Add rule", -"label.add.secondary.ip": "Add secondary IP", -"label.add.secondary.storage": "Add secondary storage", -"label.add.security.group": "Add security group", +"label.add.primary.storage": "Add Primary Storage", +"label.add.private.gateway": "Add Private Gateway", +"label.add.resources": "Add Resources", +"label.add.role": "Add Role", +"label.add.route": "Add Route", +"label.add.router.table.to.instance": "Add Router Table to this Instance", +"label.add.routing.policy": "Add Routing Policy", +"label.add.rule": "Add Rule", +"label.add.secondary.ip": "Add Secondary IP", +"label.add.secondary.storage": "Add Secondary Storage", +"label.add.security.group": "Add Security Group", "label.add.setting": "Add setting", -"label.add.srx.device": "Add SRX device", -"label.add.static.route": "Add static route", -"label.add.system.service.offering": "Add system service offering", +"label.add.srx.device": "Add SRX Device", +"label.add.static.route": "Add Static Route", +"label.add.system.service.offering": "Add System Service Offering", "label.add.term.then": "Add term", "label.add.traffic": "Add traffic", "label.add.traffic.type": "Add traffic type", @@ -325,26 +354,28 @@ "label.add.user": "Add User", "label.add.upstream.ipv4.routes": "Add upstream IPv4 routes", "label.add.upstream.ipv6.routes": "Add upstream IPv6 routes", +"label.add.vgpu.profile": "Add profile", "label.add.vm": "Add Instance", "label.add.vms": "Add Instances", -"label.add.vmware.datacenter": "Add VMware datacenter", -"label.add.vnmc.device": "Add VNMC device", +"label.add.vmware.datacenter": "Add VMware Datacenter", +"label.add.vnmc.device": "Add VNMC Device", "label.add.vpc": "Add VPC", -"label.add.vpc.offering": "Add VPC offering", -"label.add.vpn.customer.gateway": "Add VPN customer gateway", -"label.add.vpn.gateway": "Add VPN gateway", +"label.add.vpc.offering": "Add VPC Offering", +"label.add.vpn.customer.gateway": "Add VPN Customer Gateway", +"label.add.vpn.gateway": "Add VPN Gateway", "label.add.vpn.user": "Add VPN User", -"label.add.zone": "Add zone", +"label.add.webhook.filter": "Add Webhook Filter", +"label.add.zone": "Add Zone", "label.adding": "Adding", "label.adding.user": "Adding User...", "label.address": "Address", "label.address.group": "Address group", -"label.admin": "Domain admin", +"label.admin": "Domain Admin", "label.advanced": "Advanced", "label.advanced.mode": "Advanced mode", "label.affinity": "Affinity", -"label.affinity.groups": "Affinity groups", -"label.affinitygroup": "Affinity group", +"label.affinity.groups": "Affinity Groups", +"label.affinitygroup": "Affinity Group", "label.agentcount": "Number Of connected agents", "label.agent.password": "Agent password", "label.agent.username": "Agent username", @@ -359,11 +390,12 @@ "label.all": "All", "label.all.available.data": "All available data", "label.all.ipv6": "All IPv6", -"label.all.zone": "All zones", +"label.all.zone": "All Zones", "label.allocated": "Allocated", "label.allocatedonly": "Allocated", "label.allocationstate": "Allocation state", "label.allow": "Allow", +"label.allowedroletypes": "Allowed Role Types", "label.allow.duplicate.macaddresses": "Allow duplicate MAC addresses", "label.allowuserdrivenbackups": "Allow User driven backups", "label.annotation": "Comment", @@ -381,6 +413,7 @@ "label.app.name": "CloudStack", "label.application.policy.set": "Application Policy Set", "label.apply": "Apply", +"label.apply.to.all": "Apply to all", "label.apply.tungsten.firewall.policy": "Apply Firewall Policy", "label.apply.tungsten.network.policy": "Apply Network Policy", "label.apply.tungsten.tag": "Apply tag", @@ -413,6 +446,8 @@ "label.auto.assign": "Automatically assign", "label.auto.assign.diskoffering.disk.size": "Automatically assign offering matching the disk size", "label.auto.assign.random.ip": "Automatically assign a random IP address", +"label.auto.refresh.statistics": "Period between auto refreshes", +"label.auto.refresh.statistics.none": "None", "label.automigrate.volume": "Auto migrate volume to another storage pool if required", "label.autoscale.vm.groups": "AutoScaling Groups", "label.autoscale.vm.profile": "AutoScale Instance Profile", @@ -423,21 +458,26 @@ "label.availablevirtualmachinecount": "Available Instances", "label.back": "Back", "label.back.login": "Back to login", -"label.backup": "Backups", +"label.backup": "Backup", +"label.backups": "Backups", "label.backup.attach.restore": "Restore and attach backup volume", "label.backup.configure.schedule": "Configure Backup Schedule", "label.backup.offering.assign": "Assign Instance to backup offering", "label.backup.offering.remove": "Remove Instance from backup offering", -"label.backup.offerings": "Backup offerings", +"label.backup.offerings": "Backup Offerings", +"label.backup.offering.assign.failed": "Failed to assign Backup Offering", "label.backup.repository": "Backup Repository", "label.backup.restore": "Restore Instance backup", -"label.backupofferingid": "Backup offering", -"label.backupofferingname": "Backup offering", -"label.backup.repository.add": "Add backup repository", -"label.backup.repository.remove": "Remove backup repository", +"label.backup.schedule.create.failed": "Failed to create Backup Schedule", "label.backuplimit": "Backup Limits", +"label.backup.schedules": "Backup Schedules", "label.backup.storage": "Backup Storage", "label.backupstoragelimit": "Backup Storage Limits (GiB)", +"label.backupofferingid": "Backup Offering ID", +"label.backupofferingname": "Backup Offering Name", +"label.backup.repository.add": "Add Backup Repository", +"label.backup.repository.edit": "Edit Backup Repository", +"label.backup.repository.remove": "Remove Backup Repository", "label.balance": "Balance", "label.bandwidth": "Bandwidth", "label.baremetal.dhcp.devices": "Bare metal DHCP devices", @@ -468,12 +508,12 @@ "label.bucket": "Bucket", "label.bucketlimit": "Bucket Limits", "label.by.account": "By Account", -"label.by.domain": "By domain", +"label.by.domain": "By Domain", "label.by.level": "By level", -"label.by.pod": "By pod", +"label.by.pod": "By Pod", "label.by.state": "By state", "label.by.type": "By type", -"label.by.zone": "By zone", +"label.by.zone": "By Zone", "label.bypassvlanoverlapcheck": "Bypass VLAN id/range overlap", "label.cachemode": "Write-cache type", "label.cancel": "Cancel", @@ -486,10 +526,13 @@ "label.category": "Category", "label.certchain": "Chain", "label.certificate": "Certificate", +"label.certificate.chain": "Certificate chain", "label.certificate.upload": "Certificate uploaded.", "label.certificate.upload.failed": "Certificate upload failed", "label.certificate.upload.failed.description": "Failed to update SSL Certificate. Failed to pass certificate validation check.", "label.certificateid": "Certificate ID", +"label.certificates": "Certificates", +"label.chainsize": "Chain size", "label.change": "Change", "label.change.affinity": "Change affinity", "label.change.bgp.peers": "Change BGP peers", @@ -497,11 +540,14 @@ "label.change.ipaddress": "Change IP address for NIC", "label.change.disk.offering": "Change disk offering", "label.change.offering.for.volume": "Change disk offering for the volume", +"label.change.password.onlogin": "User must change password at next login", +"label.change.password.reset": "Force password reset", "label.change.service.offering": "Change service offering", "label.character": "Character", "label.checksum": "Checksum", "label.choose.resource.icon": "Choose icon", "label.choose.saml.identity": "Choose SAML identity provider", +"label.choose.isolation.method.public.ip.range": "Choose the proper isolation method for the public IP range in accordance with the zone. Valid options currently 'vlan' or 'vxlan', defaults to 'vlan'.", "label.cidr": "CIDR", "label.cidrsize": "CIDR size", "label.cidr.destination.network": "Destination Network CIDR", @@ -510,14 +556,32 @@ "label.cisco.nexus1000v.password": "Nexus 1000v password", "label.cisco.nexus1000v.username": "Nexus 1000v username", "label.cks.cluster.autoscalingenabled": "Enable auto scaling on this cluster", +"label.cks.cluster.control.nodes.offeringid": "Service Offering for Control Nodes", +"label.cks.cluster.control.nodes.templateid": "Template for Control Nodes", +"label.cks.cluster.etcd.nodes": "Etcd Nodes", +"label.cks.cluster.etcd.nodes.offeringid": "Service Offering for etcd Nodes", +"label.cks.cluster.etcd.nodes.templateid": "Template for etcd Nodes", "label.cks.cluster.maxsize": "Maximum cluster size (Worker nodes)", "label.cks.cluster.minsize": "Minimum cluster size (Worker nodes)", +"label.cks.cluster.node.manual.upgrade": "Mark nodes for manual upgrade", "label.cks.cluster.size": "Cluster size (Worker nodes)", +"label.cks.cluster.worker.nodes.offeringid": "Service Offering for Worker Nodes", +"label.cks.cluster.worker.nodes.templateid": "Template for Worker Nodes", +"label.cks.cluster.control.nodes.affinitygroupid": "Affinity Groups for Control Nodes", +"label.cks.cluster.worker.nodes.affinitygroupid": "Affinity Groups for Worker Nodes", +"label.cks.cluster.etcd.nodes.affinitygroupid": "Affinity Groups for ETCD Nodes", "label.cleanup": "Clean up", "label.clear": "Clear", +"label.clear.all": "Clear all", "label.clear.list": "Clear list", "label.clear.notification": "Clear notification", "label.clientid": "Provider Client ID", +"label.clone.backup.offering": "Clone Backup Offering", +"label.clone.compute.offering": "Clone Compute Offering", +"label.clone.disk.offering": "Clone Disk Offering", +"label.clone.network.offering": "Clone Network Offering", +"label.clone.system.service.offering": "Clone System Service Offering", +"label.clone.vpc.offering": "Clone VPC Offering", "label.close": "Close", "label.cloud.managed": "CloudManaged", "label.cloudian.admin.password": "Admin Service Password", @@ -544,14 +608,17 @@ "label.communities": "Communities", "label.community": "Community", "label.complete": "Complete", +"label.completed": "Completed", "label.compute": "Compute", -"label.compute.offerings": "Compute offerings", -"label.compute.offering.for.sharedfs.instance": "Compute offering for Instance", +"label.compute.offerings": "Compute Offerings", +"label.compute.offering.for.sharedfs.instance": "Compute Offering for Instance", "label.computeonly.offering": "Compute only disk offering", "label.computeonly.offering.tooltip": "Option to specify root disk related information in the compute offering or to directly link a disk offering to the compute offering", "label.conditions": "Conditions", "label.configuration": "Configuration", +"label.configuration.details": "Configuration Details", "label.configure": "Configure", + "label.configure.instance": "Configure Instance", "label.configure.health.monitor": "Configure Health Monitor", "label.configure.app": "Configure the App", "label.configure.ldap": "Configure LDAP", @@ -564,7 +631,7 @@ "label.confirm.delete.loadbalancer.rules": "Please confirm you wish to delete the selected load balancing rules.", "label.confirm.delete.portforward.rules": "Please confirm you wish to delete the selected port-forward rules.", "label.confirm.delete.routing.firewall.rules": "Please confirm you wish to delete the selected IPv4 Routing firewall rules", -"label.confirm.delete.snapshot.zones": "Please confirm you wish to delete the Snapshot in the selected zones.", +"label.confirm.delete.snapshot.zones": "Please confirm you wish to delete the Snapshot in the selected Zones.", "label.confirm.delete.templates": "Please confirm you wish to delete the selected Templates.", "label.confirm.delete.tungsten.address.group": "Please confirm that you would like to delete this Address Group", "label.confirm.delete.tungsten.firewall.policy": "Please confirm that you would like to delete this Firewall Policy", @@ -590,21 +657,26 @@ "label.consoleproxy": "Console proxy", "label.console.proxy": "Console proxy", "label.console.proxy.vm": "Console proxy VM", +"label.contains": "Contains", "label.continue": "Continue", "label.continue.install": "Continue with installation", "label.controlnodes": "Control nodes", +"label.conversionhost": "Conversion Host", "label.copied.clipboard": "Copied to clipboard", "label.copy": "Copy", "label.copy.clipboard": "Copy to clipboard", "label.copy.consoleurl": "Copy console URL to clipboard", "label.copyid": "Copy ID", "label.copy.password": "Copy password", +"label.copy.templates.from.other.secondary.storages": "Copy Templates from other storages instead of fetching from URLs", +"label.copy.templates.from.other.secondary.storages.add.zone": "Copy Templates from other storages", "label.core": "Core", -"label.core.zone.type": "Core zone type", +"label.core.zone.type": "Core Zone type", +"label.count": "Count", "label.counter": "Counter", "label.counter.name": "Name of the counter for which the policy will be evaluated", "label.cpu": "CPU", -"label.cpu.sockets": "CPU sockets", +"label.cpu.sockets": "CPU Sockets", "label.cpu.usage.info": "CPU usage information", "label.cpuallocated": "CPU allocated for Instances", "label.cpuallocatedghz": "CPU allocated", @@ -619,29 +691,32 @@ "label.cpuused": "CPU utilized", "label.cpuusedghz": "CPU used", "label.create": "Create", -"label.create.instance": "Create cloud server", +"label.create.instance": "Create Cloud Server", "label.create.account": "Create Account", "label.create.asnrange": "Create AS Range", -"label.create.backup": "Start backup", +"label.create.backup": "Start Backup", +"label.create.extension": "Create Extension", "label.create.sharedfs": "Create Shared FileSystem", "label.create.network": "Create new Network", "label.create.nfs.secondary.staging.storage": "Create NFS secondary staging storage", -"label.create.project": "Create project", -"label.create.project.role": "Create project role", +"label.create.on.storage": "Create on Storage", +"label.create.project": "Create Project", +"label.create.project.role": "Create Project Role", "label.create.routing.policy": "Create Routing Policy", "label.create.site.vpn.connection": "Create site-to-site VPN connection", "label.create.site.vpn.gateway": "Create site-to-site VPN gateway", -"label.create.snapshot.for.volume": "Created Snapshot for volume", +"label.create.snapshot.for.volume": "Created Snapshot for Volume", "label.create.ssh.key.pair": "Create a SSH Key Pair", "label.create.template": "Create Template", "label.create.tier.aclid.description": "The ACL associated with the Network Tier.", "label.create.tier.externalid.description": "ID of the Network in an external system.", -"label.create.tier.gateway.description": "The Network Tier's gateway in the super CIDR range, not overlapping with the CIDR of other Network Tiers in this VPC.", +"label.create.tier.gateway.description": "Gateway IP must be within VPC CIDR ({value})", "label.create.tier.name.description": "A unique name for the Network Tier.", -"label.create.tier.netmask.description": "The Network Tier's netmask. For example 255.255.255.0", +"label.create.tier.netmask.description": "Network Tier's netmask must be more restrictive than {value}", "label.create.tier.networkofferingid.description": "The Network offering for the Network Tier.", "label.create.tungsten.routing.policy": "Create Tungsten-Fabric routing policy", "label.create.user": "Create User", +"label.create.volume.on.primary.storage": "Create Volume on the specified Primary Storage", "label.create.vm": "Create Instance", "label.create.vm.and.stay": "Create Instance & stay on this page", "label.create.vpn.connection": "Create VPN connection", @@ -652,20 +727,29 @@ "label.credit": "Credit", "label.cron": "Cron expression", "label.cron.mode": "Cron mode", -"label.crosszones": "Cross zones", +"label.crosszones": "Cross Zones", +"label.csienabled": "CSI Enabled", +"label.csv.preview": "Data preview", "label.currency": "Currency", "label.current": "Current", +"label.currentstep": "Current step", +"label.currentstep.duration": "Current step duration", "label.current.storage": "Current storage", "label.currentpassword": "Current password", "label.custom": "Custom", +"label.customactionid": "Custom Action", +"label.customactions": "Custom Actions", +"label.custom.actions": "Custom Actions", "label.customconstrained": "Custom constrained", "label.customdisksize": "Custom disk size", "label.customunconstrained": "Custom unconstrained", "label.daily": "Daily", "label.dark.mode": "Dark mode", "label.dashboard": "Dashboard", -"label.data.disk": "Data disk", -"label.data.disk.offering": "Data disk offering", +"label.data.disk": "Data Disk", +"label.data.disk.offering": "Data Disk Offering", +"label.data.pool": "Data pool", +"label.data.pool.description": "Data pool is required when using a Ceph pool with erasure code", "label.date": "Date", "label.datetime.filter.period": "From {startDate} to {endDate}", "label.datetime.filter.starting": "Starting {startDate}.", @@ -674,19 +758,19 @@ "label.days": "Days", "label.day.of.month": "Day of month", "label.day.of.week": "Day of week", -"label.db.usage.metrics": "DB/Usage server", +"label.db.usage.metrics": "DB/Usage Server", "label.dbislocal": "The db runs locally", "label.dc.name": "DC name", "label.declare.host.as.degraded": "Declare host as degraded", "label.decline.invitation": "Decline invitation", "label.dedicate": "Dedicate", "label.dedicate.bgp.peer": "Dedicate BGP peer", -"label.dedicate.cluster": "Dedicate cluster", -"label.dedicate.host": "Dedicate host", +"label.dedicate.cluster": "Dedicate Cluster", +"label.dedicate.host": "Dedicate Host", "label.dedicate.ipv4.subnet": "Dedicate IPv4 subnet", -"label.dedicate.pod": "Dedicate pod", +"label.dedicate.pod": "Dedicate Pod", "label.dedicate.vlan.vni.range": "Dedicate VLAN/VNI range", -"label.dedicate.zone": "Dedicate zone", +"label.dedicate.zone": "Dedicate Zone", "label.dedicated": "Dedicated", "label.dedicated.vlan.vni.ranges": "Dedicated VLAN/VNI ranges", "label.dedicatedresources": "Dedicated resources", @@ -697,12 +781,13 @@ "label.default.network.guestcidraddress.isolated.network": "Default guest CIDR for Isolated Networks", "label.defaultnetwork": "Default Network", "label.delete": "Delete", -"label.delete.acl.list": "Delete ACL list", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "Delete affinity group", "label.delete.alerts": "Delete alerts", "label.delete.asnrange": "Delete AS Range", "label.delete.autoscale.vmgroup": "Delete AutoScaling Group", "label.delete.backup": "Delete backup", +"label.delete.backup.schedule": "Delete backup schedule", "label.delete.bgp.peer": "Delete BGP peer", "label.delete.bigswitchbcf": "Remove BigSwitch BCF controller", "label.delete.brocadevcs": "Remove Brocade Vcs switch", @@ -710,11 +795,13 @@ "label.delete.ciscoasa1000v": "Delete CiscoASA1000v", "label.delete.ciscovnmc.resource": "Delete CiscoVNMC resource", "label.delete.condition": "Delete condition", +"label.delete.confirmation": "Enter the exact resource name to proceed with deletion", +"label.delete.custom.action": "Delete Custom Action", "label.delete.dedicated.vlan.range": "Deleted dedicated VLAN/VNI range.", "label.delete.domain": "Delete domain", "label.delete.events": "Delete events", +"label.delete.extension": "Delete Extension", "label.delete.f5": "Delete F5", -"label.destroy.sharedfs": "Destroy Shared FileSystem", "label.delete.gateway": "Delete gateway", "label.delete.icon": "Delete icon", "label.delete.instance.group": "Delete Instance group", @@ -728,13 +815,13 @@ "label.delete.portforward.rules": "Delete port forward rules", "label.delete.project": "Delete project", "label.delete.project.role": "Delete project role", -"label.delete.role": "Delete role", -"label.delete.rule": "Delete rule", -"label.delete.setting": "Delete setting", +"label.delete.role": "Delete Role", +"label.delete.rule": "Delete Rule", +"label.delete.setting": "Delete Setting", "label.delete.snapshot.policy": "Delete Snapshot policy", "label.delete.srx": "Delete SRX", "label.delete.sslcertificate": "Delete SSL certificate", -"label.delete.tag": "Remove tag", +"label.delete.tag": "Remove Tag", "label.delete.term": "Delete term", "label.delete.traffic.type": "Delete traffic type", "label.delete.tungsten.address.group": "Delete Address Group", @@ -746,11 +833,12 @@ "label.delete.tungsten.service.group": "Delete Service Group", "label.delete.volumes": "Data volumes to be deleted", "label.delete.vpn.connection": "Delete VPN connection", -"label.delete.vpn.customer.gateway": "Delete VPN customer gateway", +"label.delete.vpn.customer.gateway": "Delete VPN Customer Gateway", "label.delete.vpn.gateway": "Delete VPN gateway", "label.delete.vpn.user": "Delete VPN User", "label.delete.webhook": "Delete Webhook", "label.delete.webhook.delivery": "Delete Webhook Delivery", +"label.delete.webhook.filter": "Delete Webhook Filter", "label.deleteconfirm": "Please confirm that you would like to delete this", "label.deleting": "Deleting", "label.deleting.failed": "Deleting failed", @@ -764,13 +852,13 @@ "label.deployasis": "Read Instance settings from OVA", "label.deploymentplanner": "Deployment planner", "label.desc.db.stats": "Database Statistics", -"label.desc.importexportinstancewizard": "Import and export Instances to/from an existing VMware or KVM cluster.", +"label.desc.importexportinstancewizard": "Import and export Instances to/from an existing VMware or KVM Cluster.", "label.desc.import.ext.kvm.wizard": "Import Instance from remote KVM host", "label.desc.import.local.kvm.wizard": "Import QCOW2 image from Local Storage", "label.desc.import.shared.kvm.wizard": "Import QCOW2 image from Shared Storage", "label.desc.import.unmanage.volume": "Import and unmanage volume on Storage Pools", "label.desc.ingesttinstancewizard": "Ingest instances from an external KVM host", -"label.desc.importmigratefromvmwarewizard": "Import instances from VMware into a KVM cluster", +"label.desc.importmigratefromvmwarewizard": "Import instances from VMware into a KVM Cluster", "label.desc.usage.stats": "Usage Server Statistics", "label.description": "Description", "label.destaddressgroupuuid": "Destination Address Group", @@ -793,10 +881,12 @@ "label.destroying": "Destroying", "label.destroyed": "Destroyed", "label.destroy.router": "Destroy router", +"label.destroy.sharedfs": "Destroy Shared FileSystem", "label.deststartport": "Destination Start Port", "label.desttaguuid": "Destination Tag", "label.details": "Details", "label.deviceid": "Device ID", +"label.devicename": "Device Name", "label.devices": "Devices", "label.dhcp": "DHCP", "label.direct.attached.public.ip": "Direct attached public IP", @@ -804,17 +894,20 @@ "label.directdownload": "Direct download", "label.direction": "Direction", "label.disable.autoscale.vmgroup": "Disable AutoScaling Group", +"label.disable.custom.action": "Disable Custom Action", +"label.disable.extension": "Disable Extension", "label.disable.host": "Disable host", -"label.disable.network.offering": "Disable Network offering", +"label.disable.network.offering": "Disable Network Offering", "label.disable.provider": "Disable provider", "label.disable.storage": "Disable storage pool", -"label.disable.vpc.offering": "Disable VPC offering", +"label.disable.vpc.offering": "Disable VPC Offering", "label.disable.vpn": "Disable remote access VPN", "label.disable.webhook": "Disable Webhook", "label.disabled": "Disabled", "label.disconnected": "Last disconnected", +"label.discover.gpu.devices": "Discover GPU devices", "label.disk": "Disk", -"label.disk.offerings": "Disk offerings", +"label.disk.offerings": "Disk Offerings", "label.disk.path": "Disk Path", "label.disk.tooltip": "Disk Image filename in the selected Storage Pool", "label.disk.selection": "Disk selection", @@ -835,9 +928,9 @@ "label.diskkbswrite": "Disk write (KiB)", "label.diskread": "Disk read", "label.diskwrite": "Disk write", -"label.diskoffering": "Disk offering", -"label.diskofferingdisplaytext": "Disk offering", -"label.diskofferingid": "Disk offering", +"label.diskoffering": "Disk Offering", +"label.diskofferingdisplaytext": "Disk Offering", +"label.diskofferingid": "Disk Offering", "label.disksize": "Disk size (in GB)", "label.disksizeallocated": "Disk allocated", "label.disksizeallocatedgb": "Allocated", @@ -858,7 +951,7 @@ "label.domain": "Domain", "label.domain.id": "Domain ID", "label.domain.name": "Domain name", -"label.domain.router": "Domain router", +"label.domain.router": "Domain Router", "label.domain.suffix": "DNS domain suffix (i.e., xyz.com)", "label.domainid": "Domain", "label.domainname": "Domain", @@ -867,6 +960,7 @@ "label.domains": "Domains", "label.done": "Done", "label.down": "Down", +"label.dropservices": "Drop Services", "label.download": "Download", "label.download.csv": "Download CSV", "label.download.kubeconfig.cluster": "Download kubeconfig for the cluster

    The kubectl command-line tool uses kubeconfig files to find the information it needs to choose a cluster and communicate with the API server of a cluster.", @@ -876,6 +970,7 @@ "label.download.setting": "Download setting", "label.download.state": "Download state", "label.dpd": "Dead peer detection", +"label.crosszoneinstancecreation": "Cross-Zone Instance Creation", "label.driver": "Driver", "label.drs": "DRS", "label.drsimbalance": "DRS imbalance", @@ -898,15 +993,16 @@ "label.edge.zone": "Edge Zone", "label.edit": "Edit", "label.edit.account": "Edit Account", -"label.edit.acl.list": "Edit ACL list", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.autoscale.vmprofile": "Edit AutoScale Instance Profile", +"label.edit.nic": "Edit NIC", "label.edit.project.details": "Edit project details", "label.edit.project.role": "Edit project role", -"label.edit.role": "Edit role", -"label.edit.rule": "Edit rule", +"label.edit.role": "Edit Role", +"label.edit.rule": "Edit Rule", "label.edit.secondary.ips": "Edit secondary IPs", -"label.edit.tags": "Edit tags", +"label.edit.tags": "Edit Tags", "label.edit.traffic.type": "Edit traffic type", "label.edit.user": "Edit User", "label.egress": "Egress", @@ -916,15 +1012,19 @@ "label.elastic": "Elastic", "label.email": "Email", "label.enable.autoscale.vmgroup": "Enable AutoScaling Group", +"label.enable.csi": "Enable CloudStack CSI Driver", +"label.enable.custom.action": "Enable Custom Action", +"label.enable.extension": "Enable Extension", "label.enable.host": "Enable Host", -"label.enable.network.offering": "Enable Network offering", +"label.enable.network.offering": "Enable Network Offering", "label.enable.oauth": "Enable OAuth Login", "label.enable.provider": "Enable provider", -"label.enable.storage": "Enable storage pool", -"label.enable.vpc.offering": "Enable VPC offering", +"label.enable.storage": "Enable Storage Pool", +"label.enable.vpc.offering": "Enable VPC Offering", "label.enable.vpn": "Enable remote access VPN", "label.enable.webhook": "Enable Webhook", "label.enabled": "Enabled", +"label.enabled.revocation.check": "Enables revocation checking for certificates", "label.encrypt": "Encrypt", "label.encryptroot": "Encrypt Root Disk", "label.end": "End", @@ -940,12 +1040,15 @@ "label.endipv6": "IPv6 end IP", "label.endpoint": "Endpoint", "label.endport": "End port", +"label.enter.account.name": "Enter the account name", +"label.enter.domain.name": "Enter the domain name", "label.enter.code": "Enter 2FA code to verify", "label.enter.static.pin": "Enter static PIN to verify", "label.enter.token": "Enter token", "label.entityid": "Entity", "label.entitytype": "Entity Type", "label.error": "Error", +"label.errormessage": "Error message", "label.error.caught": "Error caught", "label.error.code": "Error code", "label.error.file.read": "Cannot read file.", @@ -968,27 +1071,40 @@ "label.event.timeline": "Event timeline", "label.events": "Events", "label.every": "Every", +"label.exact": "Exact", "label.example": "Example", "label.example.plugin": "ExamplePlugin", +"label.exclude": "Exclude", "label.existing": "Existing", "label.execute": "Execute", "label.expunge": "Expunge", - "label.expunge.sharedfs": "Expunge Shared FileSystem", +"label.expunge.sharedfs": "Expunge Shared FileSystem", "label.expungevmgraceperiod": "Expunge Instance grace period (in sec)", "label.expunged": "Expunged", "label.expunging": "Expunging", "label.export.rules": "Export Rules", "label.ext.hostname.tooltip": "External Host Name or IP Address", -"label.external.managed": "ExternalManaged", +"label.extension": "Extension", +"label.extensions": "Extensions", +"label.extensionid": "Extension", +"label.extensionname": "Extension", "label.external": "External", +"label.external.managed": "ExternalManaged", +"label.external.details": "External provisioning details", +"label.externaldetails": "External details", +"label.external.details.tooltip": "Details that will be passed to the external provisioner while deploying an instance", +"label.externalprovisioner": "External provisioner", "label.external.link": "External link", "label.externalid": "External Id", "label.externalloadbalanceripaddress": "External load balancer IP address.", "label.extra": "Extra arguments", +"label.extraconfig": "Additional Configuration", +"label.extraconfig.tooltip": "Additional configuration parameters (extraconfig) to pass to the instance in plain text", "label.f5": "F5", "label.f5.ip.loadbalancer": "F5 BIG-IP load balancer.", "label.failed": "Failed", "label.featured": "Featured", +"label.fetch.from.backup": "Fetch from Backup", "label.fetch.instances": "Fetch Instances", "label.fetch.latest": "Fetch latest", "label.filename": "File Name", @@ -997,24 +1113,30 @@ "label.shared.filesystems": "Shared FileSystems", "label.filesystem": "Filesystem", "label.filter": "Filter", +"label.filters": "Filters", "label.filter.annotations.all": "All comments", "label.filter.annotations.self": "Created by me", "label.filterby": "Filter by", "label.fingerprint": "FingerPrint", +"label.skip": "Skip", "label.finish": "Finish", "label.firewall": "Firewall", "label.firewall.policy": "Firewall Policy", "label.firewallpolicy": "Firewall Policy", -"label.firewallrule": "Firewall rule", +"label.firewallrule": "Firewall Rule", "label.firewallruleuuid": "Firewall Rule", "label.firstname": "First name", "label.firstname.lower": "firstname", "label.fix.errors": "Fix errors", -"label.fixed": "Fixed offering", +"label.fix.global.setting": "Fix Global Setting", +"label.fixed": "Fixed Offering", "label.for": "for", +"label.forcks": "For CKS", "label.forbidden": "Forbidden", "label.forced": "Force", -"label.force.ms.to.import.vm.files": "Force MS to export OVF from VMware to temporary storage", +"label.force.convert.to.pool": "Force converting to storage pool directly (not using temporary storage for conversion)", +"label.force.ms.to.import.vm.files": "Enable to force OVF Download via Management Server. Disable to use KVM Host ovftool (if installed)", +"label.force.update.os.type": "Force update OS type", "label.force.stop": "Force stop", "label.force.reboot": "Force reboot", "label.forceencap": "Force UDP encapsulation of ESP packets", @@ -1040,7 +1162,30 @@ "label.globo.dns.configuration": "GloboDNS configuration", "label.glustervolume": "Volume", "label.go.back": "Go back", +"label.go.to.compute.offerings": "Go to Compute Offerings", +"label.go.to.global.settings": "Go to Global Settings", +"label.go.to.kubernetes.isos": "Go to Kubernetes ISOs", "label.gpu": "GPU", +"label.gpucardid": "GPU Card", +"label.gpucardname": "GPU Card", +"label.gpu.card": "GPU Card", +"label.gpu.card.types": "GPU Card Types", +"label.gpu.count": "GPU Count", +"label.gpucount": "GPU Count", +"label.gpu.device": "GPU Device", +"label.gpu.devices": "GPU Devices", +"label.gpu.enabled": "GPU Enabled", +"label.gpuenabled": "GPU Enabled", +"label.gpudevicetype": "Device Type", +"label.gpu.devices.add": "Add GPU Device", +"label.gpu.devices.delete": "Delete GPU Device", +"label.gpu.devices.manage": "Manage GPU Device", +"label.gpu.devices.unmanage": "Unmanage GPU Device", +"label.gpu.display": "GPU Display", +"label.gpulimit": "GPU limits", +"label.gpu.summary": "Summary", +"label.gputotal": "GPU Total", +"label.gpuused": "GPU Used", "label.chart.info": "Information about the charts", "label.group": "Group", "label.group.optional": "Group (Optional)", @@ -1060,6 +1205,8 @@ "label.guest.netmask": "Guest netmask", "label.guest.networks": "Guest Networks", "label.guest.os": "Guest OS", +"label.guest.os.category": "Guest OS Category", +"label.guest.os.categories": "Guest OS Categories", "label.guest.os.hypervisor.mappings": "Guest OS mappings", "label.guest.start.ip": "Guest start IP", "label.guest.traffic": "Guest traffic", @@ -1098,7 +1245,11 @@ "label.host": "IP address", "label.host.alerts": "Hosts in alert state", "label.host.name": "Host name", +"label.host.ovftool.version": "OVFTool Version", +"label.host.vddk.support": "VDDK Support", +"label.host.vddk.version": "VDDK Version", "label.host.tag": "Host tag", +"label.host.virtv2v.version": "Virt-v2v Version", "label.hostcontrolstate": "Compute Resource Status", "label.hostid": "Host", "label.hostname": "Host", @@ -1114,7 +1265,8 @@ "label.hosttags.implicit.description": "The host tags defined by CloudStack Agent", "label.hourly": "Hourly", "label.hypervisor": "Hypervisor", -"label.hypervisor.capabilities": "Hypervisor capabilities", +"label.hypervisor.capabilities": "Hypervisor Capabilities", +"label.hypervisor.default": "Hypervisor default", "label.hypervisor.type": "Hypervisor type", "label.hypervisors": "Hypervisors", "label.hypervisorsnapshotreserve": "Hypervisor Snapshot reserve", @@ -1134,14 +1286,19 @@ "label.ikelifetime": "IKE lifetime (second)", "label.ikepolicy": "IKE policy", "label.ikeversion": "IKE version", +"label.image": "Image", +"label.image.type": "Image type", "label.images": "Images", "label.imagestoreid": "Secondary Storage", -"label.import.backup.offering": "Import backup offering", +"label.import.backup.offering": "Import Backup Offering", "label.import.instance": "Import Instance", -"label.import.offering": "Import offering", -"label.import.role": "Import role", +"label.import.offering": "Import Offering", +"label.import.role": "Import Role", +"label.import.vm.tasks": "Import VM Tasks", "label.import.volume": "Import Volume", "label.inactive": "Inactive", +"label.inbuilt": "Inbuilt", +"label.include": "Include", "label.in.progress": "in progress", "label.in.progress.for": "in progress for", "label.info": "Info", @@ -1150,19 +1307,21 @@ "label.ingest.instance": "Ingest Instance", "label.ingress": "Ingress", "label.ingress.rule": "Ingress Rule", -"label.initial": "Inital", -"label.initialized": "Initalized", +"label.initial": "Initial", +"label.initialized": "Initialized", "label.insideportprofile": "Inside port profile", -"label.installwizard.addzoneintro.title": "Let's add a zone", +"label.installwizard.addzoneintro.title": "Let's add a Zone", "label.installwizard.subtitle": "This guide will aid you in setting up your CloudStack™ installation", "label.installwizard.title": "Hello and welcome to CloudStack™", "label.instance": "Instance", "label.instance.conversion.support": "Instance Conversion Supported", -"label.instance.groups": "Instance groups", +"label.instance.groups": "Instance Groups", +"label.instance.metadata": "Instance metadata", "label.instance.name": "Instance name", "label.instancename": "Internal name", "label.instanceport": "Instance port", "label.instances": "Instances", +"label.leasedinstances": "Leased Instances", "label.interface.route.table": "Interface Route Table", "label.interface.router.table": "Interface Router Table", "label.intermediate.certificate": "Intermediate certificate", @@ -1258,6 +1417,7 @@ "label.isoname": "Attached ISO", "label.isos": "ISOs", "label.isostate": "ISO state", +"label.isourl": "ISO URL", "label.ispersistent": "Persistent ", "label.ispublic": "Public", "label.isready": "Ready", @@ -1274,22 +1434,25 @@ "label.javadistribution": "Java Runtime Distribution", "label.javaversion": "Java Runtime Version", "label.keep": "Keep", +"label.keep.mac.address.on.public.nic": "Use same MAC address for public NIC of VRs", "label.kernelversion": "Kernel Version", "label.key": "Key", "label.keyboard": "Keyboard language", "label.keyboardtype": "Keyboard type", "label.keypair": "SSH key pair", "label.keypairs": "SSH key pair(s)", -"label.kubeconfig.cluster": "Kubernetes cluster config", +"label.kubeconfig.cluster": "Kubernetes Cluster config", "label.kubernetes": "Kubernetes", -"label.kubernetes.access.details": "The kubernetes nodes can be accessed via ssh using:
    ssh -i [ssh_key] -p [port_number] cloud@[public_ip_address]

    where,
    ssh_key: points to the ssh private key file corresponding to the key that was associated while creating the Kubernetes cluster. If no ssh key was provided during Kubernetes cluster creation, use the ssh private key of the management server.
    port_number: can be obtained from the Port Forwarding Tab (Public Port column)", -"label.kubernetes.cluster": "Kubernetes cluster", -"label.kubernetes.cluster.create": "Create Kubernetes cluster", -"label.kubernetes.cluster.delete": "Delete Kubernetes cluster", -"label.kubernetes.cluster.scale": "Scale Kubernetes cluster", -"label.kubernetes.cluster.start": "Start Kubernetes cluster", -"label.kubernetes.cluster.stop": "Stop Kubernetes cluster", -"label.kubernetes.cluster.upgrade": "Upgrade Kubernetes cluster", +"label.kubernetes.access.details": "The kubernetes nodes can be accessed via ssh using:
    ssh -i [ssh_key] -p [port_number] cloud@[public_ip_address]

    where,
    ssh_key: points to the ssh private key file corresponding to the key that was associated while creating the Kubernetes Cluster. If no ssh key was provided during Kubernetes cluster creation, use the ssh private key of the management server.
    port_number: can be obtained from the Port Forwarding Tab (Public Port column)", +"label.kubernetes.cluster.add.nodes.to.cluster": "Add nodes to Kubernetes cluster", +"label.kubernetes.cluster.remove.nodes.from.cluster": "Remove nodes from Kubernetes cluster", +"label.kubernetes.cluster": "Kubernetes Cluster", +"label.kubernetes.cluster.create": "Create Kubernetes Cluster", +"label.kubernetes.cluster.delete": "Delete Kubernetes Cluster", +"label.kubernetes.cluster.scale": "Scale Kubernetes Cluster", +"label.kubernetes.cluster.start": "Start Kubernetes Cluster", +"label.kubernetes.cluster.stop": "Stop Kubernetes Cluster", +"label.kubernetes.cluster.upgrade": "Upgrade Kubernetes Cluster", "label.kubernetes.dashboard": "Kubernetes dashboard UI", "label.kubernetes.dashboard.create.token": "Create token for Kubernetes dashboard", "label.kubernetes.dashboard.create.token.desc": "Since Kubernetes v1.24.0, there is no auto-generation of secret-based service Account token due to security reason. You need to create a service Account and an optional long-lived Bearer Token for the service Account.", @@ -1298,6 +1461,7 @@ "label.kubernetes.version.add": "Add Kubernetes version", "label.kubernetes.version.delete": "Delete Kubernetes version", "label.kubernetes.version.update": "Manage Kubernetes version", +"label.kubernetes.version.from.local": "Add Kubernetes version from local", "label.kubernetesversionid": "Kubernetes version", "label.kubernetesversionname": "Kubernetes version", "label.kvm": "KVM", @@ -1319,9 +1483,9 @@ "label.launch": "Launch", "label.launch.vm": "Launch Instance", "label.launch.vm.and.stay": "Launch Instance & stay on this page", -"label.launch.vnf.appliance": "Launch VNF appliance", -"label.launch.vnf.appliance.and.stay": "Launch VNF appliance & stay on this page", -"label.launch.zone": "Launch zone", +"label.launch.vnf.appliance": "Launch VNF Appliance", +"label.launch.vnf.appliance.and.stay": "Launch VNF Appliance & stay on this page", +"label.launch.zone": "Launch Zone", "label.lb.algorithm.leastconn": "Least connections", "label.lb.algorithm.roundrobin": "Round-robin", "label.lb.algorithm.source": "Source", @@ -1335,8 +1499,9 @@ "label.lbruleid": "Load balancer ID", "label.lbtype": "Load balancer type", "label.ldap": "LDAP", -"label.ldap.configuration": "LDAP configuration", -"label.ldap.group.name": "LDAP group", +"label.ldapdomain": "LDAP Domain", +"label.ldap.configuration": "LDAP Configuration", +"label.ldap.group.name": "LDAP Group", "label.level": "Level", "label.license.agreements": "License agreements", "label.limit": "Limit", @@ -1350,11 +1515,11 @@ "label.list.ciscoasa1000v": "ASA 1000v", "label.list.ciscovnmc": "Cisco VNMC", "label.list.nodes": "List nodes", -"label.list.pods": "List pods", +"label.list.pods": "List Pods", "label.list.services": "List services", "label.list.vmware.vcenter.vms": "List VMware Instances", "label.livepatch": "Live patch Network's router(s)", -"label.load.balancer": "Load balancer", +"label.load.balancer": "Load Balancer", "label.loadbalancerinstance": "Assigned Instances", "label.loadbalancerrule": "Load balancing rule", "label.loadbalancing": "Load balancing", @@ -1388,6 +1553,7 @@ "label.make.user.project.owner": "Make User project owner", "label.makeredundant": "Make redundant", "label.manage": "Manage", +"label.manage.ssl.cert": "Manage SSL certificate", "label.manage.vpn.user": "Manage VPN Users", "label.managed.instances": "Managed Instances", "label.managed.volumes": "Managed Volumes", @@ -1396,17 +1562,17 @@ "label.managementserverid": "Management server", "label.managementservername": "Management server", "label.management.ips": "Management IP addresses", -"label.management.server": "Management server", -"label.management.servers": "Management servers", +"label.management.server": "Management Server", +"label.management.servers": "Management Servers", "label.management.server.peers": "Peers", -"label.managementservername": "Management Server", "label.managementservers": "Number of management servers", "label.matchall": "Match all", +"label.matchtype": "Match Type", "label.max": "Max.", "label.max.primary.storage": "Max. primary (GiB)", "label.max.secondary.storage": "Max. secondary (GiB)", "label.max.migrations": "Max. migrations", -"label.maxbackup": "Max. Backups", +"label.maxbackups": "Max. Backups", "label.maxbackupstorage": "Max. Backup Storage (GiB)", "label.maxbackups.to.retain": "Max. Backups to retain", "label.maxbucket": "Max. Buckets", @@ -1414,8 +1580,10 @@ "label.maxcpunumber": "Max CPU cores", "label.maxdatavolumeslimit": "Max data volumes limit", "label.maxerrorretry": "Max error retry", +"label.maxgpu": "Max. GPUs", "label.maxguestslimit": "Max guest limit", -"label.maxhostspercluster": "Max hosts per cluster", +"label.maxheads": "Max. heads", +"label.maxhostspercluster": "Max hosts per Cluster", "label.maximum": "Maximum", "label.maxinstance": "Max Instances", "label.maxiops": "Max IOPS", @@ -1424,14 +1592,18 @@ "label.maxnetwork": "Max. Networks", "label.maxobjectstorage": "Max. Object Storage (GiB)", "label.maxprimarystorage": "Max. primary storage (GiB)", -"label.maxproject": "Max. projects", +"label.maxproject": "Max. Projects", "label.maxpublicip": "Max. public IPs", +"label.maxresolutionx": "Max. resolution X", +"label.maxresolutiony": "Max. resolution Y", "label.maxsecondarystorage": "Max. secondary storage (GiB)", "label.maxsize": "Maximum size", +"label.maxsnaps": "Max. Snapshots", "label.maxsnapshot": "Max. Snapshots", "label.maxtemplate": "Max. Templates", "label.maxuservm": "Max. User Instances", -"label.maxvolume": "Max. volumes", +"label.maxvgpuperphysicalgpu": "Max. vGPUs per physical GPU", +"label.maxvolume": "Max. Volumes", "label.maxvpc": "Max. VPCs", "label.may.continue": "You may now continue.", "label.mb.memory": "MB memory", @@ -1451,8 +1623,8 @@ "label.memoryused": "Used memory", "label.memoryusedgb": "Memory used", "label.memused": "Memory usage", -"label.menu.security.groups": "Security groups", -"label.menu.service.offerings": "Service offerings", +"label.menu.security.groups": "Security Groups", +"label.menu.service.offerings": "Service Offerings", "label.metadata": "Metadata", "label.metadata.description": "Metadata of the Object", "label.metadata.upload.description": "Set metadata for the object", @@ -1464,8 +1636,8 @@ "label.migrate.instance.to.ps": "Migrate Instance to another primary storage", "label.migrate.instance.single.storage": "Migrate all volume(s) of the Instance to a single primary storage", "label.migrate.instance.specific.storages": "Migrate volume(s) of the Instance to specific primary storages", -"label.migrate.systemvm.to": "Migrate system VM to", -"label.migrate.volume": "Migrate volume", +"label.migrate.systemvm.to": "Migrate System VM to", +"label.migrate.volume": "Migrate Volume", "message.memory.usage.info.hypervisor.additionals": "The data shown may not reflect the actual memory usage if the Instance does not have the additional hypervisor tools installed", "message.memory.usage.info.negative.value": "If the Instance's memory usage cannot be obtained from the hypervisor, the lines for free memory in the raw data graph and memory usage in the percentage graph will be disabled", "message.migrate.volume.tooltip": "Volume can be migrated to any suitable storage pool. Admin has to choose the appropriate disk offering to replace, that supports the new storage pool", @@ -1497,7 +1669,9 @@ "label.monitor.url": "URL Path", "label.monthly": "Monthly", "label.more.access.dashboard.ui": "More about accessing dashboard UI", +"label.mount.cks.iso.on.vr": "Use CKS packages from Virtual Router", "label.mount.sharedfs": "Mount Shared FileSystem via NFS", +"label.mountopts": "Mount options", "label.move.down.row": "Move down one row", "label.move.to.bottom": "Move to bottom", "label.move.to.top": "Move to top", @@ -1511,20 +1685,31 @@ "label.native": "Native", "label.ncc": "NCC", "label.netmask": "Netmask", +"label.netris": "Netris", +"label.netristag": "Netris tag", +"label.netrisurl": "Netris URL", +"label.netris.provider": "Netris Provider", +"label.netris.provider.name": "Netris provider name", +"label.netris.provider.username": "Netris provider username", +"label.netris.provider.password": "Netris provider password", +"label.netris.provider.site": "Netris provider Site name", +"label.netris.provider.tenant.name": "Netris provider Admin Tenant name", +"label.netris.provider.tag": "Netris Tag", +"label.netris.provider.url": "Netris provider URL", "label.netscaler": "NetScaler", "label.netscaler.mpx": "NetScaler MPX LoadBalancer", "label.netscaler.sdx": "NetScaler SDX LoadBalancer", "label.netscaler.vpx": "NetScaler VPX LoadBalancer", "label.network": "Network", "label.network.acl": "Network ACL", -"label.network.acl.lists": "Network ACL lists", +"label.network.acls": "Network ACLs", "label.network.addvm": "Add Network to Instance", "label.network.desc": "Network desc", -"label.network.domain": "Network domain", +"label.network.domain": "Network Domain", "label.network.label.display.for.blank.value": "Use default gateway", "label.network.name": "Network name", -"label.network.offering": "Network offering", -"label.network.offerings": "Network offerings", +"label.network.offering": "Network Offerings", +"label.network.offerings": "Network Offerings", "label.network.policy": "Network Policy", "label.network.restart.required": "Network restart required", "label.network.route.table": "Network route table", @@ -1541,9 +1726,9 @@ "label.networklimit": "Network limits", "label.networkmode": "Network Mode", "label.networkname": "Network name", -"label.networkofferingdisplaytext": "Network offering", -"label.networkofferingid": "Network offering", -"label.networkofferingname": "Network offering", +"label.networkofferingdisplaytext": "Network Offering", +"label.networkofferingid": "Network Offering", +"label.networkofferingname": "Network Offering", "label.networkrate": "Network rate (Mb/s)", "label.networkread": "Network read", "label.networks": "Networks", @@ -1553,9 +1738,9 @@ "label.never": "Never", "label.new": "New", "label.new.autoscale.vmgroup": "New AutoScaling Group", -"label.new.instance.group": "New Instance group", +"label.new.instance.group": "New Instance Group", "label.new.password": "New password", -"label.new.project": "New project", +"label.new.project": "New Project", "label.new.secondaryip.description": "Enter new secondary IP address", "label.new.tag": "New tag", "label.new.vm": "New Instance", @@ -1564,6 +1749,7 @@ "label.newinstance": "New Instance", "label.newname": "New name", "label.next": "Next", +"label.nexthop": "Next hop", "label.nfs": "NFS", "label.nfsmountopts": "NFS mount options", "label.nfsserver": "NFS server", @@ -1578,8 +1764,10 @@ "label.no.data": "No data to show", "label.no.errors": "No recent errors", "label.no.items": "No available Items", +"label.no.matching.guest.os.vmware.import": "No matching guest OS mapping found, using the default import template guest OS", "label.no.matching.offering": "No matching offering found", "label.no.matching.network": "No matching Networks found", +"label.node.version": "Node version", "label.no.usage.records": "No usage records found", "label.noderootdisksize": "Node root disk size (in GB)", "label.nodiskcache": "No disk cache", @@ -1596,16 +1784,17 @@ "label.nsx.provider.port": "NSX provider port", "label.nsx.provider.username": "NSX provider username", "label.nsx.provider.password": "NSX provider password", -"label.nsx.provider.edgecluster": "NSX provider edge cluster", +"label.nsx.provider.edgecluster": "NSX provider edge Cluster", "label.nsx.provider.tier0gateway": "NSX provider tier-0 gateway", -"label.nsx.provider.transportzone": "NSX provider transport zone", +"label.nsx.provider.transportzone": "NSX provider transport Zone", "label.nsx.supports.internal.lb": "Enable NSX internal LB service", "label.nsx.supports.lb": "Enable NSX LB service", "label.num.cpu.cores": "# of CPU cores", +"label.numanode": "NUMA node", "label.number": "#Rule", "label.numretries": "Number of retries", "label.nvpdeviceid": "ID", -"label.oauth.configuration": "OAuth configuration", +"label.oauth.configuration": "OAuth Configuration", "label.oauth.verification": "OAuth verification", "label.ocfs2": "OCFS2", "label.object.storage" : "Object Storage", @@ -1623,7 +1812,7 @@ "label.of.month": "of month", "label.offerha": "Offer HA", "label.offeringid": "Offering ID", -"label.offeringtype": "Compute offering type", +"label.offeringtype": "Compute Offering type", "label.ok": "OK", "label.only.end.date.and.time": "Only end date and time", "label.only.start.date.and.time": "Only start date and time", @@ -1640,7 +1829,11 @@ "label.operator.less.or.equal": "Less than or equals to", "label.operator.equal": "Equals to", "label.optional": "Optional", +"label.options": "Options", +"label.orchestrator": "Orchestrator", +"label.orchestratorrequirespreparevm": "Requires Prepare Instance", "label.order": "Order", +"label.os": "Operating System", "label.oscategoryid": "OS category", "label.oscategoryname": "OS category name", "label.osname": "OS name", @@ -1680,9 +1873,11 @@ "label.palo.alto.firewall": "Palo Alto firewall", "label.palp": "Palo Alto log profile", "label.params": "Parameters", +"label.parameters": "Parameters", "label.param.name": "Parameter name", "label.param.value": "Parameter value", "label.parentdomainname": "Parent domain", +"label.parentgpudeviceid": "Parent GPU device", "label.parentname": "Parent", "label.parentsubnet": "Parent Subnet", "label.passive": "Passive", @@ -1692,8 +1887,10 @@ "label.password.tooltip": "The password for the Host", "label.passwordenabled": "Password enabled", "label.path": "Path", +"label.pathready": "Path Ready", +"label.pathstate": "Path State", "label.patp": "Palo Alto threat profile", -"label.pavr": "Virtual router", +"label.pavr": "Virtual Router", "label.payload": "Payload", "label.payloadurl": "Payload URL", "label.pcidevice": "GPU", @@ -1707,7 +1904,7 @@ "label.pending.jobs": "Pending Jobs", "label.pendingjobscount": "Number Of pending jobs", "label.per.account": "Per Account", -"label.per.zone": "Per zone", +"label.per.zone": "Per Zone", "label.percentage": "Percentage", "label.perfectforwardsecrecy": "Perfect forward secrecy", "label.perform.fresh.checks": "Perform fresh checks", @@ -1739,7 +1936,7 @@ "label.powerflex.gateway": "Gateway", "label.powerflex.gateway.password": "Gateway password", "label.powerflex.gateway.username": "Gateway username", -"label.powerflex.storage.pool": "Storage pool", +"label.powerflex.storage.pool": "Storage Pool", "label.powerstate": "Power state", "label.preferred": "Preferred", "label.prefix": "Prefix", @@ -1756,13 +1953,13 @@ "label.flashArray.username.tooltip": "The username with edit privileges", "label.flashArray.url.tooltip": "URL designating the Flash Array endpoint, formatted as: http[s]://HOSTNAME:PORT?pod=NAME&hostgroup=NAME[&skipTlsValidation=true][&postCopyWaitMs=#][&keyttl=#][&connectTimeoutMs=#][&apiLoginVersion=#][&apiVersion=#] where values in [] are optional.", "label.primary": "Primary", -"label.primary.storage": "Primary storage", -"label.primary.storage.allocated": "Primary storage allocated", -"label.primary.storage.used": "Primary storage used", -"label.primarystoragelimit": "Primary storage limits (GiB)", -"label.primarystoragetotal": "Primary storage", +"label.primary.storage": "Primary Storage", +"label.primary.storage.allocated": "Primary Storage allocated", +"label.primary.storage.used": "Primary Storage used", +"label.primarystoragelimit": "Primary Storage limits (GiB)", +"label.primarystoragetotal": "Primary Storage", "label.privatemtu": "Private Interface MTU", -"label.private.gateway": "Private gateway", +"label.private.gateway": "Private Gateway", "label.private.interface": "Private interface", "label.private.registry": "Private registry", "label.privateinterface": "Private interface", @@ -1772,7 +1969,7 @@ "label.privateport": "Private port", "label.profilename": "Profile", "label.project": "Project", -"label.project.invitation": "Project invitations", +"label.project.invitation": "Project Invitations", "label.project.name": "Project name", "label.project.owner": "Project owner(s)", "label.project.role": "Project role", @@ -1796,13 +1993,15 @@ "label.provisioningtype.fat": "Fat provisioning", "label.provisioningtype.sparse": "Sparse provisioning", "label.provisioningtype.thin": "Thin provisioning", +"label.public": "Public", "label.publicmtu": "Public Interface MTU", "label.public.interface": "Public interface", "label.public.ip": "Public IP address", -"label.public.ip.addresses": "Public IP addresses", +"label.public.ip.addresses": "Public IP Addresses", "label.public.ips": "Public IP addresses", "label.public.lb": "Public LB", "label.public.traffic": "Public traffic", +"label.public.traffic.netris": "Netris Public IP Pool", "label.public.traffic.nsx": "NSX Public traffic", "label.publicinterface": "Public interface", "label.publicip": "IP address", @@ -1811,7 +2010,7 @@ "label.publicnetwork": "Public Network", "label.publicport": "Public port", "label.purgeresources": "Purge Resources", -"label.purge.usage.records.success": "Successfuly purged usage records", +"label.purge.usage.records.success": "Successfully purged usage records", "label.purge.usage.records.error": "Failed while purging usage records", "label.purpose": "Purpose", "label.qostype": "QoS type", @@ -1866,6 +2065,7 @@ "label.read.io": "Read (IO)", "label.readonly": "Read-Only", "label.reason": "Reason", +"label.rebalance": "Rebalance", "label.reboot": "Reboot", "label.recent.deliveries": "Recent deliveries", "label.receivedbytes": "Bytes received", @@ -1880,9 +2080,12 @@ "label.redundantvpcrouter": "Redundant VPC", "label.refresh": "Refresh", "label.region": "Region", +"label.register.extension": "Register Extension", "label.register.oauth": "Register OAuth", "label.register.template": "Register Template", -"label.register.user.data": "Register a userdata", +"label.register.user.data": "Register User Data", +"label.register.cni.config": "Register CNI Configuration", +"label.register.user.data.details": "Enter the User Data in plain text or in Base64 encoding. Up to 32KB of Base64 encoded User Data can be sent by default. The setting vm.userdata.max.length can be used to increase the limit to upto 1MB.", "label.reinstall.vm": "Reinstall Instance", "label.reject": "Reject", "label.related": "Related", @@ -1890,16 +2093,18 @@ "label.release": "Release", "label.release.account": "Release from Account", "label.release.dedicated.bgp.peer": "Release dedicated BGP peer", -"label.release.dedicated.cluster": "Release dedicated cluster", +"label.release.dedicated.cluster": "Release dedicated Cluster", "label.release.dedicated.host": "Release dedicated host", "label.release.dedicated.ipv4.subnet": "Release dedicated IPv4 subnet", -"label.release.dedicated.pod": "Release dedicated pod", -"label.release.dedicated.zone": "Release dedicated zone", +"label.release.dedicated.pod": "Release dedicated Pod", +"label.release.dedicated.zone": "Release dedicated Zone", "label.releasing.ip": "Releasing IP", +"label.remote.access.vpn.specify.iprange": "Specify IP Range of remote VPN", "label.remote.instances": "Remote Instances", "label.remove": "Remove", "label.remove.annotation": "Remove comment", "label.remove.bgp.peer": "Remove BGP peer", +"label.remove.cni.configuration": "Remove CNI configuration", "label.remove.egress.rule": "Remove egress rule", "label.remove.interface.route.table": "Remove Tungsten interface route table", "label.remove.ip.range": "Remove IP range", @@ -1907,8 +2112,9 @@ "label.remove.ldap": "Remove LDAP", "label.remove.logical.network": "Remove Network from logical router", "label.remove.logical.router": "Remove logical router", -"label.remove.network.offering": "Remove Network offering", +"label.remove.network.offering": "Remove Network Offering", "label.remove.network.route.table": "Remove Tungsten Fabric Network routing table", +"label.remove.nodes": "Remove nodes from Kubernetes cluster", "label.remove.pf": "Remove port forwarding rule", "label.remove.policy": "Remove policy", "label.remove.project.account": "Remove Account from project", @@ -1918,21 +2124,22 @@ "label.remove.rule": "Remove rule", "label.remove.ssh.key.pair": "Remove SSH Key pair", "label.remove.tungsten.tag": "Remove Tag", -"label.remove.user.data": "Remove Userdata", +"label.remove.user.data": "Remove User Data", "label.remove.vm.from.lb": "Remove Instance from load balancer rule", "label.remove.vmware.datacenter": "Remove VMware Datacenter", "label.remove.vpc": "Remove VPC", -"label.remove.vpc.offering": "Remove VPC offering", +"label.remove.vpc.offering": "Remove VPC Offering", "label.removed": "Removed", "label.removing": "Removing", +"label.replace": "Replace", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL list", "label.report.bug": "Ask a question or Report an issue", "label.request": "Request", "label.required": "Required", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires upgrade", "label.reserved": "Reserved", +"label.reservedresourcedetails": "Reserved resource details", "label.reserved.system.gateway": "Reserved system gateway", "label.reserved.system.ip": "Reserved system IP", "label.reserved.system.netmask": "Reserved system netmask", @@ -1945,9 +2152,10 @@ "label.reset.config.value": "Reset to default value", "label.reset.ssh.key.pair": "Reset SSH key pair", "label.reset.to.default": "Reset to default", -"label.reset.userdata.on.autoscale.vm.group": "Reset Userdata on AutoScale VM Group", -"label.reset.userdata.on.vm": "Reset Userdata on Instance", +"label.reset.user.data.on.autoscale.vm.group": "Reset User Data on AutoScale VM Group", +"label.reset.user.data.on.vm": "Reset User Data on Instance", "label.reset.vpn.connection": "Reset VPN connection", +"label.resolution": "Resolution", "label.resource": "Resource", "label.resource.limit.exceeded": "Resource limit exceeded", "label.resource.name": "Resource name", @@ -1962,12 +2170,15 @@ "label.restartrequired": "Restart required", "label.restore": "Restore", "label.restore.volume.attach": "Restore volume and attach", +"label.use.backup.ip.address": "Use IP Addresses from Backup", +"label.use.backup.ip.address.tooltip": "Use the same IP/MAC addresses as stored in the backup metadata. The command will error out if the IP/MAC addresses are not available", "label.review": "Review", "label.role": "Role", "label.roleid": "Role", "label.rolename": "Role", "label.roles": "Roles", "label.roletype": "Role Type", +"label.rolepermissiontab.searchbar": "Search Rule", "label.root.certificate": "Root certificate", "label.root.disk.size": "Root disk size (GB)", "label.rootdisk": "ROOT disk", @@ -1997,6 +2208,7 @@ "label.rules.file.import.description": "Click or drag rule definitions CSV file to import.", "label.rules.file.to.import": "Rule definitions CSV file to import", "label.run.proxy.locally": "Run proxy locally", +"label.run.custom.action": "Run Action", "label.running": "Running", "label.running.vms": "Running Instances", "label.s2scustomergatewayid": "Site to site customer gateway ID", @@ -2027,6 +2239,7 @@ "label.scaleup.policy": "ScaleUp policy", "label.scaling": "Scaling", "label.schedule": "Schedule", +"label.scheduled": "Scheduled", "label.schedule.add": "Add schedule", "label.scheduled.backups": "Scheduled backups", "label.schedules": "Schedules", @@ -2035,17 +2248,17 @@ "label.search": "Search", "label.secondary.isolated.vlan.type.isolated": "Isolated", "label.secondary.isolated.vlan.type.promiscuous": "Promiscuous", -"label.secondary.storage": "Secondary storage", -"label.secondary.storage.vm": "Secondary storage VM", +"label.secondary.storage": "Secondary Storage", +"label.secondary.storage.vm": "Secondary Storage VM", "label.secondaryips": "Secondary IPs", -"label.secondarystoragelimit": "Secondary storage limits (GiB)", +"label.secondarystoragelimit": "Secondary Storage limits (GiB)", "label.secretkey": "Secret key", "label.secured": "Secured", -"label.security.groups": "Security groups", -"label.securitygroup": "Security group", -"label.securitygroupenabled": "Security groups enabled", +"label.security.groups": "Security Groups", +"label.securitygroup": "Security Group", +"label.securitygroupenabled": "Security Groups enabled", "label.securitygroups": "Security groups", -"label.securitygroupsenabled": "Security groups enabled", +"label.securitygroupsenabled": "Security Groups enabled", "label.select": "Select", "label.see.more.info.cpu.usage": "See more info about CPU usage", "label.see.more.info.memory.usage": "See more info about memory usage", @@ -2053,18 +2266,24 @@ "label.see.more.info.disk.usage": "See more info about disk usage", "label.see.more.info.shown.charts": "See more info about the shown charts", "label.select-view": "Select view", -"label.select.a.zone": "Select a zone", +"label.select.all": "Select all", +"label.select.columns": "Select columns", +"label.select.a.zone": "Select a Zone", +"label.select.backup.offering": "Select Backup Offering", "label.select.deployment.infrastructure": "Select deployment infrastructure", "label.select.guest.os.type": "Please select the guest OS type", "label.select.network": "Select Network", "label.select.period": "Select period", -"label.select.project": "Select project", -"label.select.projects": "Select projects", -"label.select.ps": "Select primary storage", +"label.select.project": "Select Project", +"label.select.projects": "Select Projects", +"label.select.ps": "Select Primary Storage", "label.select.root.disk": "Select the ROOT disk", "label.select.source.vcenter.datacenter": "Select the source VMware vCenter Datacenter", "label.select.tier": "Select Network Tier", +"label.select.vm": "Select Instance", +"label.select.volume": "Select Volume", "label.select.zones": "Select zones", +"label.select.storagepools": "Select storage pools", "label.select.2fa.provider": "Select the provider", "label.selected.storage": "Selected storage", "label.self": "Mine", @@ -2075,23 +2294,26 @@ "label.sequence": "Sequence", "label.server": "Server", "label.server.certificate": "Server certificate", -"label.serviceip": "Service IP", +"label.serviceip": "Management Service IP", "label.service.connectivity.distributedroutercapabilitycheckbox": "Distributed router", "label.service.connectivity.regionlevelvpccapabilitycheckbox": "Region level VPC", -"label.service.group": "Service group", -"label.serviceip": "Management IP", +"label.service.group": "Service Group", +"label.management.ip": "Management IP", "label.service.lb.elasticlbcheckbox": "Elastic LB", "label.service.lb.inlinemodedropdown": "Mode", "label.service.lb.lbisolationdropdown": "LB isolation", "label.service.lb.netscaler.servicepackages": "Netscaler service packages", "label.service.lb.netscaler.servicepackages.description": "Service package description", -"label.service.offering": "Service offering", +"label.service.offering.controlnodes": "Compute offering for Control Nodes", +"label.service.offering.etcdnodes": "Compute offering for etcd Nodes", +"label.service.offering.workernodes": "Compute offering for Worker Nodes", +"label.service.offering": "Service Offering", "label.service.staticnat.associatepublicip": "Associate public IP", "label.service.staticnat.elasticipcheckbox": "Elastic IP", "label.servicegroupuuid": "Service Group", "label.servicelist": "Services", -"label.serviceofferingid": "Compute offering", -"label.serviceofferingname": "Compute offering", +"label.serviceofferingid": "Compute Offering", +"label.serviceofferingname": "Compute Offering", "label.sessions": "Active client sessions", "label.set.default.nic": "Set default NIC", "label.set.reservation": "Set reservation", @@ -2108,13 +2330,16 @@ "label.sharedrouteripv6": "IPv6 address for the VR in this shared Network.", "label.sharewith": "Share with", "label.showing": "Showing", +"label.show.only.gpu.enabled.offerings": "Show only GPU enabled offerings", "label.show.usage.records": "Show usage records", +"label.showing.results.for": "Showing results for \"%x\"", "label.shrinkok": "Shrink OK", "label.shutdown": "Shutdown", "label.shutdown.provider": "Shutdown provider", "label.simplified.chinese.keyboard": "Simplified Chinese keyboard", +"label.site": "Netris Site", "label.site.to.site.vpn": "Site-to-site VPN", -"label.site.to.site.vpn.connections": "Site-to-site VPN Connections", +"label.site.to.site.vpn.connections": "VPN Connections", "label.size": "Size", "label.sizegb": "Size", "label.smb.domain": "SMB domain", @@ -2127,6 +2352,8 @@ "label.snapshot.name": "Snapshot name", "label.snapshotlimit": "Snapshot limits", "label.snapshotmemory": "Snapshot memory", +"label.snapshotpolicy": "Snapshot policy", +"label.snapshotpolicies": "Snapshot policies", "label.snapshots": "Volume Snapshots", "label.snapshottype": "Snapshot Type", "label.sockettimeout": "Socket timeout", @@ -2144,6 +2371,7 @@ "label.sourcenattype": "Supported source NAT type", "label.sourceport": "Source port", "label.sourcetype": "Source type", +"label.sourcevmname": "Source VM Name", "label.specifyasnumber": "Specify AS Number", "label.specifyipranges": "Specify IP ranges", "label.specifyvlan": "Specify VLAN", @@ -2159,28 +2387,42 @@ "label.srctaguuid": "Source Tag", "label.srx": "SRX", "label.srx.firewall": "Juniper SRX firewall", -"label.ssh.key.pairs": "SSH key pairs", +"label.storageaccessgroups": "Storage Access Groups", +"label.storageallocated": "Allocated size", +"label.storagetotal": "Total size", +"label.storageused": "Used size", +"label.clusterstorageaccessgroups": "Cluster Storage Access Groups", +"label.podstorageaccessgroups": "Pod Storage Access Groups", +"label.zonestorageaccessgroups": "Zone Storage Access Groups", +"label.ssh.key.pairs": "SSH Key Pairs", "label.uefi.supported": "UEFI supported", +"label.unregister.extension": "Unregister Extension", "label.usediops": "IOPS used", -"label.userdataid": "Userdata ID", -"label.userdataname": "Userdata name", -"label.userdatadetails": "Userdata details", -"label.userdataparams": "Userdata parameters", -"label.userdatapolicy": "Userdata link policy", -"label.userdata.text": "Manual Userdata entry", -"label.userdata.registered": "Stored Userdata", -"label.userdata.do.override": "Userdata override", -"label.userdata.do.append": "Userdata append", -"label.userdatapolicy.tooltip": "Userdata linked to the Template can be overridden by Userdata provided during Instance deploy. Select the override policy as required.", +"label.userdata": "User Data", +"label.user.data.id": "User Data ID", +"label.user.data.name": "User Data name", +"label.user.data.details": "User Data details", +"label.user.data.params": "User Data parameters", +"label.user.data.policy": "User Data link policy", +"label.user.data.text": "Manual User Data entry", +"label.user.data.registered": "Stored User Data", +"label.user.data.do.override": "User Data override", +"label.user.data.do.append": "User Data append", +"label.user.data.policy.tooltip": "User Data linked to the Template can be overridden by User Data provided during Instance deploy. Select the override policy as required.", "label.user.data": "User Data", +"label.user.data.library": "User Data Library", +"label.use.vddk": "Use VDDK", "label.ssh.port": "SSH port", "label.sshkeypair": "New SSH key pair", "label.sshkeypairs": "SSH key pairs", +"label.ssl": "SSL", +"label.sslcertificate": "SSL certificate", "label.sslcertificates": "SSL certificates", "label.sslverification": "SSL verification", "label.standard.us.keyboard": "Standard (US) keyboard", "label.start": "Start", "label.startasn": "Start AS Number", +"label.started": "Started", "label.start.date": "Start date", "label.start.date.and.time": "Start date and time", "label.start.ip": "Start IP", @@ -2199,7 +2441,7 @@ "label.state.reported": "Reported State", "label.staticnat": "Static NAT", "label.static": "Static", -"label.static.routes": "Static routes", +"label.static.routes": "Static Routes", "label.status": "Status", "label.step.1": "Step 1", "label.step.2": "Step 2", @@ -2225,24 +2467,28 @@ "label.stopping": "Stopping", "label.storage": "Storage", "label.storage.migration.required": "Storage migration required", -"label.storage.tags": "Storage tags", +"label.storage.tags": "Storage Tags", "label.storage.traffic": "Storage traffic", -"label.storageid": "Primary storage", +"label.storageid": "Primary Storage", "label.storagemotionenabled": "Storage motion enabled", "label.storagepolicy": "Storage policy", "label.storagepool": "Storage pool", +"label.storagepools": "Storage pools", "label.storagepool.tooltip": "Destination Storage Pool. Volume should be located in this Storage Pool", "label.storagetags": "Storage tags", "label.storagetype": "Storage type", +"label.storageip": "Storage IP address", "label.strict": "Strict", "label.subdomainaccess": "Subdomain access", "label.submit": "Submit", "label.subnet": "Subnet", "label.succeeded": "Succeeded", "label.success": "Success", +"label.successmessage": "Success message", "label.success.migrations": "Successful migrations", "label.success.set": "Successfully set", "label.success.updated": "Successfully updated", +"label.suffix": "Suffix", "label.suitability": "Suitability", "label.suitable": "Suitable", "label.summary": "Summary", @@ -2254,12 +2500,12 @@ "label.supportspublicaccess": "Supports public access", "label.supportsstrechedl2subnet": "Supports stretched L2 subnet", "label.supportsvmautoscaling": "Supports auto scaling", -"label.suspend.project": "Suspend project", +"label.suspend.project": "Suspend Project", "label.switch.type": "Switch type", -"label.sync.storage": "Sync storage pool", +"label.sync.storage": "Sync Storage Pool", "label.system.ip.pool": "System Pool", -"label.system.offering": "System offering", -"label.system.offerings": "System offerings", +"label.system.offering": "System Offering", +"label.system.offerings": "System Offerings", "label.system.service.offering": "System service offering", "label.system.vm": "System VM", "label.system.vms": "System VMs", @@ -2273,6 +2519,7 @@ "label.systemvm": "System VM", "label.systemvmtype": "System VM type", "label.tag": "Tag", +"label.tag.netris": "netris", "label.tag.nsx": "nsx", "label.tag.key": "Tag key", "label.tag.systemvm": "systemvm", @@ -2289,7 +2536,8 @@ "label.tariffvalue": "Tariff value", "label.tcp": "TCP", "label.tcp.proxy": "TCP proxy", -"label.template": "Select a template", +"label.template": "Template", +"label.template.select": "Select a template", "label.templatetag": "Tag", "label.template.select.existing": "Select an existing template", "label.template.temporary.import": "Use a temporary template for import", @@ -2303,6 +2551,7 @@ "label.templatesubject": "Subject", "label.templatetype": "Template type", "label.templateversion": "Template version", +"label.tenantname": "Netris Tenant", "label.term.type": "Term type", "label.test": "Test", "label.test.webhook.delivery": "Test Webhook Delivery", @@ -2325,6 +2574,7 @@ "label.threshold": "Threshold", "label.threshold.description": "Value for which the Counter will be evaluated with the Operator selected", "label.thursday": "Thursday", +"label.tier0gateway": "Tier-0 Gateway", "label.time": "Time", "label.timeout": "Timeout", "label.timeout.in.second ": " Timeout (seconds)", @@ -2338,11 +2588,12 @@ "label.total": "Total", "label.total.network": "Total Networks", "label.total.vms": "Total Instances", -"label.total.volume": "Total volumes", +"label.total.volume": "Total Volumes", "label.totalcpu": "Total CPU", "label.traffic.label": "Traffic label", "label.traffic.types": "Traffic types", "label.traffictype": "Traffic type", +"label.transportzone": "Transport Zone", "label.transportzoneuuid": "Transport zone UUID", "label.trigger.shutdown": "Trigger Safe Shutdown", "label.true": "True", @@ -2390,6 +2641,7 @@ "label.undefined": "Undefined", "label.unit": "Usage unit", "label.unknown": "Unknown", +"label.unlink.domain.from.ldap": "Unlink the Domain from LDAP", "label.unlimited": "Unlimited", "label.unmanaged": "Unmanaged", "label.unmanage.instance": "Unmanage Instance", @@ -2403,6 +2655,10 @@ "label.update.autoscale.vmgroup": "Update AutoScaling Group", "label.update.bgp.peer": "Update BGP peer", "label.update.condition": "Update condition", +"label.update.gpu.device": "Update GPU device", +"label.update.vgpu.profile": "Update vGPU profile", +"label.update.custom.action": "Update Custom Action", +"label.update.extension": "Update Extension", "label.update.sharedfs": "Update Shared FileSystem", "label.update.instance.group": "Update Instance group", "label.update.ip.range": "Update IP range", @@ -2414,6 +2670,7 @@ "label.update.to": "updated to", "label.update.traffic.label": "Update traffic labels", "label.update.vmware.datacenter": "Update VMWare datacenter", +"label.update.vpn.customer.gateway": "Update VPN Customer Gateway", "label.update.webhook": "Update Webhook", "label.updating": "Updating", "label.upgrade.router.newer.template": "Upgrade router to use newer Template", @@ -2424,10 +2681,11 @@ "label.upload.icon": "Upload icon", "label.upload.iso.from.local": "Upload ISO from local", "label.upload.resource.icon": "Upload icon", +"label.upload.ssl.certificate": "Upload SSL certificate", "label.upload.template.from.local": "Upload Template from local", "label.upload.volume": "Upload volume", -"label.upload.volume.from.local": "Upload volume from local", -"label.upload.volume.from.url": "Upload volume from URL", +"label.upload.volume.from.local": "Upload Volume from local", +"label.upload.volume.from.url": "Upload Volume from URL", "label.url": "URL", "label.usage.explanation": "Note: Only the usage server that owns the active usage job is shown here.", "label.usage": "Usage", @@ -2451,13 +2709,12 @@ "label.usagetypedescription": "Usage description", "label.use.kubectl.access.cluster": "kubectl and kubeconfig file to access cluster", "label.use.local.timezone": "Use local timezone", +"label.use.router.ip.resolver": "Use Virtual Router IP as resolver", "label.used": "Used", "label.usehttps": "Use HTTPS", -"label.usenewdiskoffering": "Replace disk offering?", +"label.usenewdiskoffering": "Replace Disk Offering?", "label.user": "User", "label.user.conflict": "Conflict", -"label.userdata": "Userdata", -"label.userdatal2": "User data", "label.username": "Username", "label.username.tooltip": "The Username for the Host", "label.users": "Users", @@ -2466,6 +2723,8 @@ "label.utilization": "Utilization", "label.uuid": "ID", "label.value": "Value", +"label.validationformat": "Validation Format", +"label.valueoptions": "Values Options", "label.vcenter": "VMware datacenter vCenter", "label.vcenter.datacenter": "vCenter datacenter", "label.vcenter.datastore": "vCenter datastore", @@ -2477,22 +2736,29 @@ "label.vcenterpassword": "vCenter password", "label.vcenterusername": "vCenter username", "label.vcsdeviceid": "ID", +"label.vendorid": "Vendor ID", +"label.vendorname": "Vendor Name", "label.verify": "Verify", "label.version": "Version", "label.versions": "Versions", -"label.vgpu": "VGPU", +"label.vgpu": "Profile", +"label.vgpuprofileid": "Profile", +"label.vgpuprofileids": "Profile", +"label.vgpuprofilename": "Profile", +"label.vgpu.profile": "GPU Profile", "label.vgputype": "vGPU type", +"label.videoram": "Video RAM", "label.view": "View", "label.view.all": "View all", "label.view.console": "View console", "label.viewing": "Viewing", "label.virtualmachine": "Instance", "label.virtualmachinecount": "Instances Count", -"label.virtual.machine": "Virtual machine", -"label.virtual.machines": "Virtual machines", +"label.virtual.machine": "Virtual Machine", +"label.virtual.machines": "Virtual Machines", "label.virtual.network": "Virtual Network", "label.virtual.networking": "Virtual Networking", -"label.virtual.routers": "Virtual routers", +"label.virtual.routers": "Virtual Routers", "label.virtualmachineid": "Instance ID", "label.virtualmachinename": "Instance name", "label.virtualsize": "Virtual Size", @@ -2524,24 +2790,24 @@ "label.vmwaredcvcenter": "VMware datacenter vCenter", "label.vmwarenetworklabel": "VMware traffic label", "label.vnf.appliance": "VNF Appliance", -"label.vnf.appliances": "VNF appliances", +"label.vnf.appliances": "VNF Appliances", "label.vnf.appliance.add": "Add VNF Appliance", -"label.vnf.appliance.access.methods": "Management access information for this VNF appliance", -"label.vnf.app.action.destroy": "Destroy VNF appliance", -"label.vnf.app.action.edit": "Edit VNF appliance", -"label.vnf.app.action.expunge": "Expunge VNF appliance", -"label.vnf.app.action.migrate.to.host": "Migrate VNF appliance to another host", -"label.vnf.app.action.migrate.to.ps": "Migrate VNF appliance to another primary storage", -"label.vnf.app.action.recover": "Recover VNF appliance", -"label.vnf.app.action.scale": "Scale VNF appliance", -"label.vnf.app.action.start": "Start VNF appliance", -"label.vnf.app.action.stop": "Stop VNF appliance", -"label.vnf.app.action.reboot": "Reboot VNF appliance", -"label.vnf.app.action.reinstall": "Reinstall VNF appliance", -"label.vnf.cidr.list": "CIDR from which access to the VNF appliance’s Management interface should be allowed from", +"label.vnf.appliance.access.methods": "Management access information for this VNF Appliance", +"label.vnf.app.action.destroy": "Destroy VNF Appliance", +"label.vnf.app.action.edit": "Edit VNF Appliance", +"label.vnf.app.action.expunge": "Expunge VNF Appliance", +"label.vnf.app.action.migrate.to.host": "Migrate VNF Appliance to another host", +"label.vnf.app.action.migrate.to.ps": "Migrate VNF Appliance to another primary storage", +"label.vnf.app.action.recover": "Recover VNF Appliance", +"label.vnf.app.action.scale": "Scale VNF Appliance", +"label.vnf.app.action.start": "Start VNF Appliance", +"label.vnf.app.action.stop": "Stop VNF Appliance", +"label.vnf.app.action.reboot": "Reboot VNF Appliance", +"label.vnf.app.action.reinstall": "Reinstall VNF Appliance", +"label.vnf.cidr.list": "CIDR from which access to the VNF appliance's Management interface should be allowed from", "label.vnf.cidr.list.tooltip": "the CIDR list to forward traffic from to the VNF management interface. Multiple entries must be separated by a single comma character (,). The default value is 0.0.0.0/0.", -"label.vnf.configure.management": "Configure Firewall and Port Forwarding rules for VNF's management interfaces", -"label.vnf.configure.management.tooltip": "True by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. False otherwise. Learn what rules are configured at http://docs.cloudstack.apache.org/en/latest/adminguide/networking/vnf_templates_appliances.html#deploying-vnf-appliances", +"label.vnf.configure.management": "Configure network rules for VNF's management interfaces", +"label.vnf.configure.management.tooltip": "False by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. True otherwise. Learn what rules are configured at http://docs.cloudstack.apache.org/en/latest/adminguide/networking/vnf_templates_appliances.html#deploying-vnf-appliances", "label.vnf.detail.add": "Add VNF detail", "label.vnf.detail.remove": "Remove VNF detail", "label.vnf.details": "VNF Details", @@ -2561,8 +2827,10 @@ "label.vnf.templates": "VNF templates", "label.vnf.template.register": "Register VNF template", "label.vnmc": "VNMC", -"label.volgroup": "Volume group", +"label.volgroup": "Volume Group", "label.volume": "Volume", +"label.vms.empty": "No VMs available to be added to the Kubernetes cluster", +"label.vms.remove.empty": "No external VMs present in the Kubernetes cluster to be removed", "label.volume.empty": "No data volumes attached to this Instance", "label.volume.encryption.support": "Volume Encryption Supported", "label.volume.metrics": "Volume Metrics", @@ -2570,7 +2838,7 @@ "label.volumechecksum": "MD5 checksum", "label.volumechecksum.description": "Use the hash that you created at the start of the volume upload procedure.", "label.volumefileupload": "Local file", -"label.volumegroup": "Volume group", +"label.volumegroup": "Volume Group", "label.volumeid": "Volume", "label.volumeids": "Volumes to be deleted", "label.volumelimit": "Volume limits", @@ -2580,21 +2848,23 @@ "label.volumetype": "Volume Type", "label.vpc": "VPC", "label.vpcs": "VPCs", +"label.vpc.gateway.ip": "VPC Gateway IP", "label.vpc.id": "VPC ID", -"label.vpc.offerings": "VPC offerings", -"label.vpc.virtual.router": "VPC virtual router", +"label.vpc.offerings": "VPC Offerings", +"label.vpc.virtual.router": "VPC Virtual Router", "label.vpc.restart.required": "VPC restart required", "label.vpcid": "VPC", "label.vpclimit": "VPC limits", "label.vpcname": "VPC", -"label.vpcoffering": "VPC offering", -"label.vpcofferingid": "VPC offering", +"label.vpcoffering": "VPC Offering", +"label.vpcofferingid": "VPC Offering", "label.vpn": "VPN", "label.vpn.connection": "VPN connection", "label.vpn.gateway": "VPN gateway", "label.vpn.users": "VPN Users", "label.vpncustomergateway": "IP address of the remote gateway", -"label.vpncustomergatewayid": "VPN customer gateway", +"label.vramsize": "VRAM Size", +"label.vpncustomergatewayid": "VPN Customer Gateway", "label.vsmipaddress": "Nexus 1000v IP address", "label.vsmpassword": "Nexus 1000v password", "label.vsmusername": "Nexus 1000v username", @@ -2620,7 +2890,7 @@ "label.windows": "Windows", "label.with.snapshotid": "with Snapshot ID", "label.write": "Write", -"label.writeback": "Write-back disk caching", +"label.writeback": "Write-back", "label.writecachetype": "Write-cache Type", "label.writeio": "Write (IO)", "label.writethrough": "Write-through", @@ -2629,7 +2899,7 @@ "label.xenservertoolsversion61plus": "Original XS Version is 6.1+", "label.yes": "Yes", "label.yourinstance": "Your Instance", -"label.your.autoscale.vmgroup": "Your autoscaling group", +"label.your.autoscale.vmgroup": "Your Autoscaling Group", "label.zone": "Zone", "label.zone.dedicated": "Zone dedicated", "label.zone.details": "Zone details", @@ -2642,6 +2912,7 @@ "label.zones": "Zones", "label.zonewizard.traffictype.storage": "Storage: Traffic between primary and secondary storage servers, such as Instance Templates and Snapshots.", "label.buckets": "Buckets", +"label.busaddress": "Address", "label.objectstorageid": "Object Storage Pool", "label.oobm.address": "Out-of-band management address", "label.oobm.driver": "Out-of-band management driver", @@ -2651,28 +2922,60 @@ "label.bucket.update": "Update Bucket", "label.bucket.delete": "Delete Bucket", "label.quotagib": "Quota in GiB", +"label.quotagb": "Quota in GB", +"label.edgecluster": "Edge Cluster", "label.encryption": "Encryption", +"label.etcdnodes": "Number of etcd nodes", +"label.controlaffinitygroupnames": "Control Affinity Groups", +"label.workeraffinitygroupnames": "Worker Affinity Groups", +"label.etcdaffinitygroupnames": "ETCD Affinity Groups", "label.versioning": "Versioning", "label.objectlocking": "Object Lock", "label.bucket.policy": "Bucket Policy", "label.usersecretkey": "Secret Key", "label.create.bucket": "Create Bucket", +"label.cniconfiguration": "CNI Configuration", +"label.cniconfigname": "Associated CNI Configuration", +"label.cniconfigparams": "CNI Configuration parameters", +"label.create.instance.from.backup": "Create new instance from backup", +"label.lease.enable": "Enable Lease", +"label.lease.enable.tooltip": "The Instance Lease feature allows to set a lease duration (in days) for instances, after which they automatically expire. Upon expiry, the instance can either be stopped (powered off) or destroyed, based on the configured policy", +"label.instance.lease": "Instance lease", +"label.instance.lease.placeholder": "Lease duration in days ( > 0)", +"label.leaseduration": "Lease duration (in days)", +"label.leaseexpiry.date.and.time": "Lease expiry date", +"label.leaseexpiryaction": "Lease expiry action", +"label.remainingdays": "Lease", +"label.leased": "Leased", +"label.totalduration": "Total duration", +"label.usestoragereplication": "Use primary storage replication", "message.acquire.ip.failed": "Failed to acquire IP.", "message.action.acquire.ip": "Please confirm that you want to acquire new IP.", "message.action.cancel.maintenance": "Your host has been successfully canceled for maintenance. This process can take up to several minutes.", "message.action.cancel.maintenance.mode": "Please confirm that you want to cancel this maintenance.", "message.action.create.snapshot.from.vmsnapshot": "Please confirm that you want to create Snapshot from Instance Snapshot", +"message.action.create.instance.from.backup": "Please confirm that you want to create a new Instance from the given Backup.
    Click on configure to edit the parameters for the new Instance before creation.", +"message.create.instance.from.backup.different.zone": "Creating Instance from Backup on a different Zone. Please ensure that the backup repository is accessible in the selected Zone.", +"message.csv.empty": "Empty CSV File", +"message.csv.missing.headers": "Columns are missing from headers in CSV", +"message.template.ostype.different.from.backup": "Selected Template has a different OS type than the Backup. Please proceed with caution.", +"message.iso.ostype.different.from.backup": "Selected ISO has a different OS type than the Backup. Please proceed with caution.", "message.action.delete.asnrange": "Please confirm the AS range that you want to delete", "message.action.delete.autoscale.vmgroup": "Please confirm that you want to delete this autoscaling group.", "message.action.delete.backup.offering": "Please confirm that you want to delete this backup offering?", "message.action.delete.backup.repository": "Please confirm that you want to delete this backup repository?", -"message.action.delete.cluster": "Please confirm that you want to delete this cluster.", +"message.action.delete.backup.schedule": "Please confirm that you want to delete this backup schedule?", +"message.action.delete.cluster": "Please confirm that you want to delete this Cluster.", +"message.action.delete.custom.action": "Please confirm that you want to delete this custom action.", "message.action.delete.domain": "Please confirm that you want to delete this domain.", +"message.action.delete.extension": "Please confirm that you want to delete the extension", "message.action.delete.external.firewall": "Please confirm that you would like to remove this external firewall. Warning: If you are planning to add back the same external firewall, you must reset usage data on the device.", "message.action.delete.external.load.balancer": "Please confirm that you would like to remove this external load balancer. Warning: If you are planning to add back the same external load balancer, you must reset usage data on the device.", "message.action.delete.ingress.rule": "Please confirm that you want to delete this ingress rule.", "message.action.delete.ipv4.subnet": "Please confirm that you want to delete this IPv4 subnet.", +"message.action.delete.gpu.card": "Please confirm that you want to delete this GPU card.", "message.action.delete.guest.os": "Please confirm that you want to delete this guest os. System defined entry cannot be deleted.", +"message.action.delete.guest.os.category": "Please confirm that you want to delete this guest os category.", "message.action.delete.guest.os.hypervisor.mapping": "Please confirm that you want to delete this guest os hypervisor mapping. System defined entry cannot be deleted.", "message.action.delete.instance.group": "Please confirm that you want to delete the Instance group.", "message.action.delete.interface.static.route": "Please confirm that you want to remove this interface Static Route?", @@ -2683,15 +2986,17 @@ "message.action.delete.node": "Please confirm that you want to delete this node.", "message.action.delete.oauth.provider": "Please confirm that you want to delete the OAuth provider.", "message.action.delete.physical.network": "Please confirm that you want to delete this physical Network.", -"message.action.delete.pod": "Please confirm that you want to delete this pod.", +"message.action.delete.pod": "Please confirm that you want to delete this Pod.", "message.action.delete.secondary.storage": "Please confirm that you want to delete this secondary storage.", "message.action.delete.security.group": "Please confirm that you want to delete this security group.", "message.action.delete.snapshot": "Please confirm that you want to delete this Snapshot.", +"message.action.delete.snapshot.policy": "Please confirm that you want to delete the selected Snapshot Policy.", "message.action.delete.template": "Please confirm that you want to delete this Template.", "message.action.delete.tungsten.router.table": "Please confirm that you want to remove Route Table from this Network?", +"message.action.delete.vgpu.profile": "Please confirm that you want to delete this vGPU profile.", "message.action.delete.volume": "Please confirm that you want to delete this volume. Note: this will not delete any Snapshots of this volume.", "message.action.delete.vpn.user": "Please confirm that you want to delete the VPN user.", -"message.action.delete.zone": "Please confirm that you want to delete this zone.", +"message.action.delete.zone": "Please confirm that you want to delete this Zone.", "message.action.destroy.sharedfs": "Please confirm that you want to destroy this Shared FileSystem.
    Caution: This will delete all the data of the Shared FileSystem as well.", "message.action.destroy.instance": "Please confirm that you want to destroy the Instance.", "message.action.destroy.instance.with.backups": "Please confirm that you want to destroy the Instance. There may be backups associated with the Instance which will not be deleted.", @@ -2699,35 +3004,37 @@ "message.action.destroy.volume": "Please confirm that you want to destroy the volume.", "message.action.disable.2FA.user.auth": "Please confirm that you want to disable User two factor authentication.", "message.action.about.mandate.and.disable.2FA.user.auth": "Two factor authentication is mandated for the User, if this is disabled now User will need to setup two factor authentication again during next login.

    Please confirm that you want to disable.", -"message.action.disable.cluster": "Please confirm that you want to disable this cluster.", +"message.action.disable.cluster": "Please confirm that you want to disable this Cluster.", "message.action.disable.disk.offering": "Please confirm that you want to disable this disk offering.", "message.action.disable.service.offering": "Please confirm that you want to disable this service offering.", "message.action.disable.system.service.offering": "Please confirm that you want to disable this system service offering.", "message.action.disable.physical.network": "Please confirm that you want to disable this physical Network.", -"message.action.disable.pod": "Please confirm that you want to disable this pod.", +"message.action.disable.pod": "Please confirm that you want to disable this Pod.", "message.action.disable.static.nat": "Please confirm that you want to disable static NAT.", -"message.action.disable.zone": "Please confirm that you want to disable this zone.", +"message.action.disable.zone": "Please confirm that you want to disable this Zone.", +"message.action.discover.gpu.devices": "Please confirm that you want to discover GPU devices.", "message.action.download.iso": "Please confirm that you want to download this ISO.", "message.action.download.snapshot": "Please confirm that you want to download this Snapshot.", "message.action.download.template": "Please confirm that you want to download this Template.", +"message.action.edit.backup.repository": "Please confirm that you want to update the backup repository.", "message.action.edit.nfs.mount.options": "Changes to NFS mount options will only take affect on cancelling maintenance mode which will cause the storage pool to be remounted on all KVM hosts with the new mount options.", -"message.action.enable.cluster": "Please confirm that you want to enable this cluster.", +"message.action.enable.cluster": "Please confirm that you want to enable this Cluster.", "message.action.enable.disk.offering": "Please confirm that you want to enable this disk offering.", "message.action.enable.service.offering": "Please confirm that you want to enable this service offering.", "message.action.enable.system.service.offering": "Please confirm that you want to enable this system service offering.", "message.action.enable.physical.network": "Please confirm that you want to enable this physical Network.", -"message.action.enable.pod": "Please confirm that you want to enable this pod.", -"message.action.enable.zone": "Please confirm that you want to enable this zone.", +"message.action.enable.pod": "Please confirm that you want to enable this Pod.", +"message.action.enable.zone": "Please confirm that you want to enable this Zone.", "message.action.expunge.sharedfs": "Please confirm that you want to expunge this Shared FileSystem.", "message.action.expunge.instance": "Please confirm that you want to expunge this Instance.", "message.action.expunge.instance.with.backups": "Please confirm that you want to expunge this Instance. There may be backups associated with the Instance which will not be deleted.", "message.action.host.enable.maintenance.mode": "Enabling maintenance mode will cause a live migration of all running Instances on this host to any available host.", "message.action.instance.reset.password": "Please confirm that you want to change the ROOT password for this Instance.", -"message.action.manage.cluster": "Please confirm that you want to manage the cluster.", +"message.action.manage.cluster": "Please confirm that you want to manage the Cluster.", "message.action.patch.router": "Please confirm that you want to live patch the router.
    This operation is equivalent updating the router packages and restarting the Network without cleanup.", "message.action.patch.systemvm": "Please confirm that you want to patch the System VM.", -"message.action.primary.storage.scope.cluster": "Please confirm that you want to change the scope from zone to the specified cluster.
    This operation will update the database and disconnect the storage pool from all hosts that were previously connected to the primary storage and are not part of the specified cluster.", -"message.action.primary.storage.scope.zone": "Please confirm that you want to change the scope from cluster to zone.
    This operation will update the database and connect the storage pool to all hosts of the zone running the same hypervisor as set on the storage pool.", +"message.action.primary.storage.scope.cluster": "Please confirm that you want to change the scope from Zone to the specified Cluster.
    This operation will update the database and disconnect the storage pool from all hosts that were previously connected to the primary storage and are not part of the specified cluster.", +"message.action.primary.storage.scope.zone": "Please confirm that you want to change the scope from Cluster to Zone.
    This operation will update the database and connect the storage pool to all hosts of the zone running the same hypervisor as set on the storage pool.", "message.action.primarystorage.enable.maintenance.mode": "Warning: placing the primary storage into maintenance mode will cause all Instances using volumes from it to be stopped. Do you want to continue?", "message.action.quota.tariff.create.error.namerequired": "Please, inform a name for the quota tariff.", "message.action.quota.tariff.create.error.usagetyperequired": "Please, select the usage type of the quota tariff.", @@ -2738,6 +3045,7 @@ "message.action.reboot.systemvm": "Please confirm that you want to reboot this system VM.", "message.action.recover.sharedfs": "Please confirm that you would like to recover this Shared FileSystem.", "message.action.recover.volume": "Please confirm that you would like to recover this volume.", +"message.action.register.extension": "Register the extension to a resource", "message.action.release.asnumber": "Please confirm that you want to release this AS Number.", "message.action.release.ip": "Please confirm that you want to release this IP.", "message.action.remove.host": "Please confirm that you want to remove this host.", @@ -2749,7 +3057,7 @@ "message.action.revert.snapshot": "Please confirm that you want to revert the owning volume to this Snapshot.", "message.action.router.health.checks": "Health checks result will be fetched from router.", "message.action.router.health.checks.disabled.warning": "Please enable router health checks.", -"message.action.scale.kubernetes.cluster.warning": "Please do not manually scale the cluster if cluster auto scaling is enabled.", +"message.action.scale.kubernetes.cluster.warning": "Please do not manually scale the Cluster if cluster auto scaling is enabled.", "message.action.secondary.storage.read.only": "Please confirm that you want to make this secondary storage read only.", "message.action.secondary.storage.read.write": "Please confirm that you want to make this secondary storage read write.", "message.action.secure.host": "This will restart the host agent and libvirtd process after applying new X509 certificates, please confirm?", @@ -2762,22 +3070,28 @@ "message.action.stop.instance": "Please confirm that you want to stop this Instance.", "message.action.stop.router": "All services provided by this virtual router will be interrupted. Please confirm that you want to stop this router.", "message.action.stop.systemvm": "Please confirm that you want to stop this system VM.", -"message.action.unmanage.cluster": "Please confirm that you want to unmanage the cluster.", +"message.action.unmanage.cluster": "Please confirm that you want to unmanage the Cluster.", "message.action.unmanage.instance": "Please confirm that you want to unmanage the Instance.", "message.action.unmanage.instances": "Please confirm that you want to unmanage the Instances.", "message.action.unmanage.virtualmachine": "Please confirm that you want to unmanage the Instance.", "message.action.unmanage.volume": "Please confirm that you want to unmanage the Volume.", "message.action.unmanage.volumes": "Please confirm that you want to unmanage the Volumes.", "message.action.vmsnapshot.delete": "Please confirm that you want to delete this Instance Snapshot.
    Please notice that the Instance will be paused before the Snapshot deletion, and resumed after deletion, if it runs on KVM.", +"message.action.vmsnapshot.disk-only.delete": "Please confirm that you want to delete this Instance Snapshot.", "message.activate.project": "Are you sure you want to activate this project?", +"message.add.custom.action.parameters": "Parameters to be made available while running the custom action.", "message.add.egress.rule.failed": "Adding new egress rule failed.", "message.add.egress.rule.processing": "Adding new egress rule...", "message.add.failed": "Adding failed.", -"message.add.firewall": "Add a firewall to zone", +"message.add.firewall": "Add a firewall to Zone", "message.add.firewall.rule.failed": "Adding new Firewall rule failed", "message.add.firewall.rule.processing": "Adding new Firewall rule...", "message.add.firewallrule.failed": "Adding Firewall Rule failed", "message.add.host": "Please specify the following parameters to add a new host.", +"message.add.extension.custom.action.details": "Details to be sent to the extension during execution of this action.", +"message.add.extension.details": "Details to be sent to the extension on any operation.", +"message.add.extension.resource.details": "Details to be sent to the extension during any operation for this resource.", +"message.add.orchestrator.resource.details": "Details to be sent to the hypervisor.", "message.add.host.sshkey": "WARNING: In order to add a host with SSH key, you must ensure your hypervisor host has been configured correctly.", "message.add.iprange.processing": "Adding IP Range...", "message.add.ipv4.subnet.for.guest.network.failed": "Failed to add IPv4 subnet for guest network", @@ -2786,27 +3100,35 @@ "message.add.ip.v6.firewall.rule.failed": "Failed to add IPv6 firewall rule", "message.add.ip.v6.firewall.rule.processing": "Adding IPv6 firewall rule...", "message.add.ip.v6.firewall.rule.success": "Added IPv6 firewall rule", +"message.advisory.cks.endpoint.url.not.configured": "Endpoint URL which will be used by Kubernetes clusters is not configured correctly", +"message.advisory.cks.min.offering": "No suitable Compute Offering found for Kubernetes cluster nodes with minimum required resources (2 vCPU, 2 GB RAM)", +"message.advisory.cks.version.check": "No Kubernetes version found that can be used to deploy a Kubernetes cluster", "message.redeliver.webhook.delivery": "Redeliver this Webhook delivery", "message.remove.ip.v6.firewall.rule.failed": "Failed to remove IPv6 firewall rule", "message.remove.ip.v6.firewall.rule.processing": "Removing IPv6 firewall rule...", "message.remove.ip.v6.firewall.rule.success": "Removed IPv6 firewall rule", +"message.remove.sslcert.failed": "Failed to remove SSL certificate from load balancer", +"message.remove.sslcert.processing": "Removing SSL certificate from load balancer...", +"message.add.latest.kubernetes.iso.failed": "Failed to add latest Kubernetes ISO", +"message.add.minimum.required.compute.offering.kubernetes.cluster.failed": "Failed to add minimum required Compute Offering for Kubernetes cluster nodes", +"message.add.netris.controller": "Add Netris Provider", "message.add.nsx.controller": "Add NSX Provider", -"message.add.network": "Add a new network for zone: ", -"message.add.network.acl.failed": "Adding network ACL list failed.", -"message.add.network.acl.processing": "Adding network ACL list...", +"message.add.network": "Add a new network for Zone: ", +"message.add.network.acl.failed": "Adding network ACL failed.", +"message.add.network.acl.processing": "Adding network ACL...", "message.add.network.failed": "Adding network failed.", "message.add.network.processing": "Adding network...", "message.add.new.gateway.to.vpc": "Please specify the information to add a new gateway to this VPC.", "message.add.physical.network.failed": "Adding physical network failed", "message.add.physical.network.processing": "Adding a new physical network...", -"message.add.pod": "Add a new pod for zone ", -"message.add.pod.during.zone.creation": "Each zone must contain one or more pods. We will add the first pod now. A pod contains hosts and primary storage servers, which you will add in a later step. First, configure a range of reserved IP addresses for CloudStack's internal management traffic. The reserved IP range must be unique for each zone in the cloud.", +"message.add.pod": "Add a new Pod for Zone ", +"message.add.pod.during.zone.creation": "Each Zone must contain one or more Pods. We will add the first pod now. A pod contains hosts and primary storage servers, which you will add in a later step. First, configure a range of reserved IP addresses for CloudStack's internal management traffic. The reserved IP range must be unique for each zone in the cloud.", "message.add.port.forward.failed": "Adding new port forwarding rule failed.", "message.add.port.forward.processing": "Adding new port forwarding rule...", "message.add.private.gateway.failed": "Adding private gateway failed.", "message.add.private.gateway.processing": "Adding private gateway...", "message.add.resource.description": "Add infrastructure resources", -"message.add.resource.hint": "Add infrastructure resources - pods, clusters, primary/secondary storages.", +"message.add.resource.hint": "Add infrastructure resources - Pods, Clusters, primary/secondary storages.", "message.add.routing.firewall.rule.failed": "Failed to add IPv4 Routing firewall rule", "message.add.routing.firewall.rule.processing": "Adding IPv4 Routing firewall rule...", "message.add.routing.firewall.rule.success": "Added IPv4 Routing firewall rule", @@ -2824,20 +3146,28 @@ "message.add.volume": "Please fill in the following data to add a new volume.", "message.add.vpn.connection.failed": "Adding VPN connection failed", "message.add.vpn.connection.processing": "Adding VPN Connection...", -"message.add.vpn.customer.gateway": "Adding VPN customer gateway", -"message.add.vpn.customer.gateway.processing": "Creation of VPN customer gateway is in progress", +"message.add.vpn.customer.gateway": "Adding VPN Customer Gateway", +"message.add.vpn.customer.gateway.processing": "Creation of VPN Customer Gateway is in progress", "message.add.vpn.gateway": "Please confirm that you want to add a VPN Gateway.", "message.add.vpn.gateway.failed": "Adding VPN gateway failed", "message.add.vpn.gateway.processing": "Adding VPN gateway...", +"message.added.latest.kubernetes.iso": "Latest Kubernetes ISO added successfully", +"message.added.minimum.required.compute.offering.kubernetes.cluster": "Minimum required Compute Offering for Kubernetes cluster nodes added successfully", "message.added.vpc.offering": "Added VPC offering", "message.adding.firewall.policy": "Adding Firewall Policy", "message.adding.host": "Adding host", +"message.adding.latest.kubernetes.iso": "Adding latest Kubernetes ISO", +"message.adding.minimum.required.compute.offering.kubernetes.cluster": "Adding minimum required Compute Offering for Kubernetes cluster nodes", "message.adding.netscaler.device": "Adding Netscaler device", "message.adding.netscaler.provider": "Adding Netscaler provider", +"message.adding.nodes.to.cluster": "Adding nodes to Kubernetes cluster", +"message.removing.nodes.from.cluster": "Removing nodes from Kubernetes cluster", "message.advanced.security.group": "Choose this if you wish to use security groups to provide guest Instance isolation.", "message.allowed": "Allowed", "message.alert.show.all.stats.data": "This may return a lot of data depending on VM statistics and retention settings", "message.apply.success": "Apply Successfully", +"message.assign.sslcert.failed": "Failed to assign SSL certificate", +"message.assign.sslcert.processing": "Assigning SSL certificate...", "message.assign.instance.another": "Please specify the Account type, domain, Account name and Network (optional) of the new Account.
    If the default NIC of the Instance is on a shared Network, CloudStack will check if the Network can be used by the new Account if you do not specify one Network.
    If the default NIC of the Instance is on a isolated Network, and the new Account has more one isolated Networks, you should specify one.", "message.assign.vm.failed": "Failed to assign Instance", "message.assign.vm.processing": "Assigning Instance...", @@ -2846,14 +3176,16 @@ "message.attach.volume.progress": "Attaching volume", "message.attach.volume.success": "Successfully attached the volume to the instance", "message.authorization.failed": "Session expired, authorization verification failed.", -"message.autoscale.loadbalancer.update": "The load balancer rule can be updated only when autoscaling group is DISABLED.", +"message.autoscale.loadbalancer.update": "The load balancer rule can be updated. However, instance can be removed only when autoscaling group is DISABLED.", "message.autoscale.policies.update": "The scale up/down policies can be updated only when autoscaling group is DISABLED.", "message.autoscale.vm.networks": "Please choose at least one Network for Instances in the autoscaling group. The default Network must be an Isolated Network or VPC Network Tier which supports Instance AutoScaling and has load balancing rules.", "message.autoscale.vmprofile.update": "The autoscale Instance profile can be updated only when autoscaling group is DISABLED.", "message.backup.attach.restore": "Please confirm that you want to restore and attach the volume from the backup?", -"message.backup.create": "Are you sure you want create an Instance backup?", +"message.backup.create": "Are you sure you want to create an Instance backup?", "message.backup.offering.remove": "Are you sure you want to remove Instance from backup offering and delete the backup chain?", +"message.backup.provision.instance": "Select a backup offering to assign to the Instance. You can also add one or more backup schedules for different interval types to automate backups for this Instance. Assigning a backup offering and schedules helps protect your data by enabling automated and scheduled backups.", "message.backup.restore": "Please confirm that you want to restore the Instance backup?", +"message.backup.update.existing.schedule": "Updating existing backup schedule for the same interval type", "message.cancel.shutdown": "Please confirm that you would like to cancel the shutdown on this Management Server. It will resume accepting any new Async Jobs.", "message.cancel.maintenance": "Please confirm that you would like to cancel the maintenance on this Management Server. It will resume accepting any new Async Jobs.", "message.certificate.upload.processing": "Certificate upload in progress", @@ -2862,8 +3194,10 @@ "message.change.offering.confirm": "Please confirm that you wish to change the service offering of this virtual Instance.", "message.change.offering.for.volume": "Successfully changed offering for the volume", "message.change.offering.for.volume.failed": "Change offering for the volume failed", -"message.change.offering.processing": "Changing offering for the volume...", +"message.change.offering.for.volume.processing": "Changing offering for the volume...", "message.change.password": "Please change your password.", +"message.change.password.required": "You are required to change your password.", +"message.change.password.reset": "Force password reset on next login.", "message.change.scope.failed": "Scope change failed", "message.change.scope.processing": "Scope change in progress", "message.change.service.offering.sharedfs.failed": "Failed to change service offering for the Shared FileSystem.", @@ -2878,6 +3212,8 @@ "message.configuring.guest.traffic": "Configuring guest traffic", "message.configuring.physical.networks": "Configuring physical Networks", "message.configuring.public.traffic": "Configuring public traffic", +"message.configuring.netris.public.traffic": "Configuring Netris public traffic", +"message.configuring.storage.access.failed": "Configuring storage access failed", "message.configuring.nsx.public.traffic": "Configuring NSX public traffic", "message.configuring.storage.traffic": "Configuring storage traffic", "message.confirm.action.force.reconnect": "Please confirm that you want to force reconnect this host.", @@ -2890,11 +3226,13 @@ "message.confirm.change.offering.for.volume": "Please confirm that you want to change disk offering for the volume", "message.confirm.change.service.offering.for.sharedfs": "Please confirm that you want to change the service offering for the Shared FileSystem.", "message.confirm.configure.ovs": "Are you sure you want to configure Ovs?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller.", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch.", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v.", "message.confirm.delete.ciscovnmc.resource": "Please confirm you want to delete CiscoVNMC resource.", +"message.confirm.delete.gpu.devices": "Please confirm that you would like to delete this GPU device?", +"message.confirm.delete.vgpu.profile": "Please confirm that you want to delete this vGPU profile?", "message.confirm.delete.f5": "Please confirm that you would like to delete F5.", "message.confirm.delete.internal.lb": "Please confirm you want to delete internal LB.", "message.confirm.delete.netscaler": "Please confirm that you would like to delete NetScaler.", @@ -2905,19 +3243,25 @@ "message.confirm.delete.traffic.type": "Please confirm that you would like to delete traffic type.", "message.confirm.destroy.router": "All services provided by this virtual router will be interrupted. Please confirm that you want to stop this router. Please confirm that you would like to destroy this router.", "message.confirm.disable.autoscale.vmgroup": "Please confirm that you want to disable this autoscaling group.", +"message.confirm.disable.custom.action": "Please confirm that you want to disable this custom action.", +"message.confirm.disable.extension": "Please confirm that you want to disable this extension.", "message.confirm.disable.host": "Please confirm that you want to disable the host.", "message.confirm.disable.network.offering": "Are you sure you want to disable this Network offering?", "message.confirm.disable.provider": "Please confirm that you would like to disable this provider.", "message.confirm.disable.storage": "Please confirm that you want to disable the storage pool.", "message.confirm.disable.vpc.offering": "Are you sure you want to disable this VPC offering?", "message.confirm.disable.webhook": "Please confirm that you want to disable this webhook.", +"message.confirm.discover.gpu.devices": "Please confirm that you want to discover GPU devices?", "message.confirm.enable.autoscale.vmgroup": "Please confirm that you want to enable this autoscaling group.", +"message.confirm.enable.custom.action": "Please confirm that you want to enable this custom action.", +"message.confirm.enable.extension": "Please confirm that you want to enable this extension.", "message.confirm.enable.host": "Please confirm that you want to enable the host.", "message.confirm.enable.network.offering": "Are you sure you want to enable this Network offering?", "message.confirm.enable.provider": "Please confirm that you would like to enable this provider.", "message.confirm.enable.storage": "Please confirm that you want to enable the storage pool.", "message.confirm.enable.vpc.offering": "Are you sure you want to enable this VPC offering?", "message.confirm.enable.webhook": "Please confirm that you want to enable this webhook.", +"message.confirm.manage.gpu.devices": "Please confirm that you want to manage the selected GPU devices?", "message.confirm.remove.firewall.rule": "Please confirm that you want to delete this Firewall Rule?", "message.confirm.remove.ip.range": "Please confirm that you would like to remove this IP range.", "message.confirm.remove.network.offering": "Are you sure you want to remove this Network offering?", @@ -2928,20 +3272,28 @@ "message.confirm.remove.vmware.datacenter": "Please confirm you want to remove VMware datacenter.", "message.confirm.remove.vpc.offering": "Are you sure you want to remove this VPC offering?", "message.confirm.replace.acl.new.one": "Do you want to replace the ACL with a new one?", +"message.confirm.reset.configuration.value": "Are you sure you want reset configuration - %x?", "message.confirm.reset.network.permissions": "Are you sure you want to reset this Network permissions?", "message.confirm.scale.up.router.vm": "Do you really want to scale up the router Instance?", "message.confirm.scale.up.system.vm": "Do you really want to scale up the system VM?", "message.confirm.start.lb.vm": "Please confirm you want to start LB Instance.", "message.confirm.sync.storage": "Please confirm you want to sync the storage pool", "message.confirm.type": "To confirm, please type", +"message.confirm.unmanage.gpu.devices": "Please confirm that you want to unmanage the selected GPU devices?", "message.confirm.upgrade.router.newer.template": "Please confirm that you want to upgrade router to use newer Template.", "message.cpu.usage.info": "The CPU usage percentage can exceed 100% if the Instance has more than 1 vCPU or when CPU Cap is not enabled. This behavior happens according to the hypervisor being used (e.g: in KVM), due to how they account the stats", +"message.create.backup.failed": "Failed to create backup.", "message.create.bucket.failed": "Failed to create bucket.", "message.create.bucket.processing": "Bucket creation in progress", -"message.create.compute.offering": "Compute offering created", +"message.create.compute.offering": "Compute Offering created", +"message.clone.compute.offering": "Compute Offering cloned", +"message.clone.service.offering": "Service Offering cloned", +"message.clone.offering.from": "Cloning from", +"message.clone.offering.edit.hint": "All values are pre-filled from the source offering. Edit any field to customize the new offering.", "message.create.sharedfs.failed": "Failed to create Shared FileSystem.", "message.create.sharedfs.processing": "Shared FileSystem creation in progress.", "message.create.tungsten.public.network": "Create Tungsten-Fabric public Network", +"message.create.instance.from.backup.prefill": "Data is prefilled using the configurations stored in the backup. Edit to change individual fields.", "message.create.internallb": "Creating internal LB", "message.create.internallb.failed": "Failed to create internal LB.", "message.create.internallb.processing": "Creation of internal LB is in progress", @@ -2950,34 +3302,41 @@ "message.create.snapshot.from.vmsnapshot.progress": "Snapshot creation in progress", "message.create.template.failed": "Failed to create template.", "message.create.template.processing": "Template creation in progress", -"message.create.volume.failed": "Failed to create volume.", +"message.create.volume.failed": "Failed to create Volume.", "message.create.volume.processing": "Volume creation in progress", "message.create.vpc.offering": "VPC offering created.", -"message.create.vpn.customer.gateway.failed": "VPN customer gateway creation failed.", +"message.create.vpn.customer.gateway.failed": "VPN Customer Gateway creation failed.", "message.creating.autoscale.vmgroup": "Creating AutoScaling Group", "message.creating.autoscale.vmprofile": "Creating AutoScale Instance profile", "message.creating.autoscale.scaledown.conditions": "Creating ScaleDown conditions", "message.creating.autoscale.scaledown.policy": "Creating ScaleDown policy", "message.creating.autoscale.scaleup.conditions": "Creating ScaleUp conditions", "message.creating.autoscale.scaleup.policy": "Creating ScaleUp policy", -"message.creating.cluster": "Creating cluster", +"message.creating.cluster": "Creating Cluster", "message.creating.guest.network": "Creating guest Network", "message.creating.physical.networks": "Creating physical Networks", -"message.creating.pod": "Creating pod", +"message.creating.pod": "Creating Pod", "message.creating.primary.storage": "Creating primary storage", "message.creating.secondary.storage": "Creating secondary storage", -"message.creating.zone": "Creating zone", +"message.creating.zone": "Creating Zone", "message.data.migration": "Data migration", "message.data.migration.progress": "Data migration between image stores", "message.datacenter.description": "Name of the datacenter on vCenter.", "message.datastore.description": "Name of the datastore on vCenter.", -"message.dedicate.zone": "Dedicating zone", +"message.dedicate.zone": "Dedicating Zone", "message.dedicated.zone.released": "Zone dedication released.", -"message.dedicating.cluster": "Dedicating cluster...", +"message.dedicating.cluster": "Dedicating Cluster...", "message.dedicating.host": "Dedicating host...", -"message.dedicating.pod": "Dedicating pod...", -"message.dedicating.zone": "Dedicating zone...", -"message.delete.account": "Please confirm that you want to delete this Account.", +"message.dedicating.pod": "Dedicating Pod...", +"message.dedicating.zone": "Dedicating Zone...", +"message.delete.account.confirm": "Please confirm that you want to delete this account by entering the name of the account below.", +"message.delete.account.failed": "Delete account failed", +"message.delete.account.processing": "Deleting account", +"message.delete.account.success": "Successfully deleted account", +"message.delete.account.warning": "Deleting this account will delete all of the instances, volumes and snapshots associated with the account.", +"message.delete.domain.confirm": "Please confirm that you want to delete this domain by entering the name of the domain below.", +"message.delete.domain.warning": "All associated accounts, users, VMs, and sub-domains will be permanently deleted. This action cannot be undone.", +"message.delete.domain.failed": "Delete domain failed", "message.delete.acl.processing": "Removing ACL rule...", "message.delete.acl.rule": "Remove ACL rule", "message.delete.acl.rule.failed": "Failed to remove ACL rule.", @@ -3000,10 +3359,12 @@ "message.delete.tungsten.tag": "Are you sure you want to remove this Tag from this Policy?", "message.delete.user": "Please confirm that you would like to delete this User.", "message.delete.vpn.connection": "Please confirm that you want to delete VPN connection.", -"message.delete.vpn.customer.gateway": "Please confirm that you want to delete this VPN customer gateway.", +"message.delete.vpn.customer.gateway": "Please confirm that you want to delete this VPN Customer Gateway.", "message.delete.vpn.gateway": "Please confirm that you want to delete this VPN Gateway.", +"message.delete.vpn.gateway.failed": "Failed to delete VPN Gateway.", "message.delete.webhook": "Please confirm that you want to delete this Webhook.", "message.delete.webhook.delivery": "Please confirm that you want to delete this Webhook delivery.", +"message.delete.webhook.filter": "Please confirm that you want to delete this Webhook filter.", "message.deleting.firewall.policy": "Deleting Firewall Policy", "message.deleting.node": "Deleting Node", "message.deleting.vm": "Deleting Instance", @@ -3011,27 +3372,31 @@ "message.deployasis": "Selected Template is Deploy As-Is i.e., the Instance is deployed by importing an OVA with vApps directly into vCenter. Root disk(s) resize is allowed only on stopped Instances for such Templates.", "message.desc.advanced.zone": "This is recommended and allows more sophisticated Network topologies. This Network model provides the most flexibility in defining guest Networks and providing custom Network offerings such as firewall, VPN, or load balancer support.", "message.desc.basic.zone": "Provide a single Network where each Instance is assigned an IP directly from the Network. Guest isolation can be provided through layer-3 means such as security groups (IP address source filtering).", -"message.desc.core.zone": "Core Zones are intended for Datacenter based deployments and allow the full range of Networking and other functionality in Apache CloudStack. Core zones have a number of prerequisites and rely on the presence of shared storage and helper Instances.", -"message.desc.edge.zone": "Edge Zones are lightweight zones, designed for deploying in edge computing scenarios. They are limited in functionality but have far fewer prerequisites than core zones.

    Please refer to the Apache CloudStack documentation for more information on Zone Types
    http://docs.cloudstack.apache.org/en/latest/installguide/configuration.html#adding-a-zone", -"message.desc.cluster": "Each pod must contain one or more clusters. We will add the first cluster now. A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Each cluster consists of one or more hosts and one or more primary storage servers.", +"message.desc.core.zone": "Core Zones are intended for Datacenter based deployments and allow the full range of Networking and other functionality in Apache CloudStack. Core Zones have a number of prerequisites and rely on the presence of shared storage and helper Instances.", +"message.desc.edge.zone": "Edge Zones are lightweight Zones, designed for deploying in edge computing scenarios. They are limited in functionality but have far fewer prerequisites than core zones.

    Please refer to the Apache CloudStack documentation for more information on Zone Types
    http://docs.cloudstack.apache.org/en/latest/installguide/configuration.html#adding-a-zone", +"message.desc.cluster": "Each Pod must contain one or more Clusters. We will add the first cluster now. A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Each cluster consists of one or more hosts and one or more primary storage servers.", "message.desc.create.ssh.key.pair": "Please fill in the following data to create or register a ssh key pair.

    (1) If public key is set, CloudStack will register the public key. You can use it through your private key.

    (2) If public key is not set, CloudStack will create a new SSH key pair. In this case, please copy and save the private key. CloudStack will not keep it.
    ", "message.desc.created.ssh.key.pair": "Created a SSH key pair.", -"message.desc.host": "Each cluster must contain at least one host (computer) for guest Instances to run on. We will add the first host now. For a host to function in CloudStack, you must install hypervisor software on the host, assign an IP address to the host, and ensure the host is connected to the CloudStack management server.

    Give the host's DNS or IP address, the user name (usually root) and password, and any labels you use to categorize hosts.", -"message.desc.importingestinstancewizard": "This feature only applies to libvirt based KVM instances. Only Stopped instances can be ingested", +"message.desc.host": "Each Cluster must contain at least one host (computer) for guest Instances to run on. We will add the first host now. For a host to function in CloudStack, you must install hypervisor software on the host, assign an IP address to the host, and ensure the host is connected to the CloudStack management server.

    Give the host's DNS or IP address, the user name (usually root) and password, and any labels you use to categorize hosts.", "message.desc.import.ext.kvm.wizard": "Import libvirt domain from External KVM Host not managed by CloudStack", "message.desc.import.local.kvm.wizard": "Import QCOW2 image from Local Storage of selected KVM Host", "message.desc.import.shared.kvm.wizard": "Import QCOW2 image from selected Primary Storage Pool", "message.desc.import.unmanage.volume": "Please choose a storage pool that you want to import or unmanage volumes. The storage pool should be in Up status.
    This feature only supports KVM.", "message.desc.importexportinstancewizard": "By choosing to manage an Instance, CloudStack takes over the orchestration of that Instance. Unmanaging an Instance removes CloudStack ability to manage it. In both cases, the Instance is left running and no changes are done to the VM on the hypervisor.

    For KVM, managing a VM is an experimental feature.", -"message.desc.importmigratefromvmwarewizard": "By selecting an existing or external VMware Datacenter and an instance to import, CloudStack migrates the selected instance from VMware to KVM on a conversion host using virt-v2v and imports it into a KVM cluster", -"message.desc.primary.storage": "Each cluster must contain one or more primary storage servers. We will add the first one now. Primary storage contains the disk volumes for all the Instances running on hosts in the cluster. Use any standards-compliant protocol that is supported by the underlying hypervisor.", -"message.desc.reset.ssh.key.pair": "Please specify a ssh key pair that you would like to add to this Instance.", -"message.desc.secondary.storage": "Each zone must have at least one NFS or secondary storage server. We will add the first one now. Secondary storage stores Instance Templates, ISO images, and Instance disk volume Snapshots. This server must be available to all hosts in the zone.

    Provide the IP address and exported path.", -"message.desc.register.user.data": "Please fill in the following data to register a User data.", +"message.desc.importingestinstancewizard": "This feature only applies to libvirt based KVM instances. Only Stopped instances can be ingested", +"message.desc.importmigratefromvmwarewizard": "By selecting an existing or external VMware Datacenter and an instance to import, CloudStack migrates the selected instance from VMware to KVM on a conversion host using virt-v2v and imports it into a KVM Cluster", +"message.desc.primary.storage": "Each Cluster must contain one or more primary storage servers. We will add the first one now. Primary storage contains the disk volumes for all the Instances running on hosts in the cluster. Use any standards-compliant protocol that is supported by the underlying hypervisor.", +"message.desc.register.template": "Hosted on download.cloudstack.org, these templates can be easily registered directly within CloudStack. Simply click Register Template for the templates you wish to use.", +"message.desc.register.cni.config": "Please fill in the following data to register CNI Configuration as user data.", +"message.desc.register.user.data": "Please fill in the following to register new User Data.", "message.desc.registered.user.data": "Registered a User Data.", -"message.desc.zone": "A zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.", -"message.desc.zone.edge": "A zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. An edge zone consists of one or more hosts (each of which provides local storage as primary storage servers). Only shared and L2 Networks can be deployed in such zones and functionalities that require secondary storages are not supported.", -"message.drs.plan.description": "The maximum number of live migrations allowed for DRS. Configure DRS under the settings tab before generating a plan or to enable automatic DRS for the cluster.", +"message.desc.reset.ssh.key.pair": "Please specify a ssh key pair that you would like to add to this Instance.", +"message.desc.secondary.storage": "Each Zone must have at least one NFS or secondary storage server. We will add the first one now. Secondary storage stores Instance Templates, ISO images, and Instance disk volume Snapshots. This server must be available to all hosts in the zone.

    Provide the IP address and exported path.

    \"Copy templates from other secondary storages\" switch can be used to automatically copy existing templates from secondary storages in other zones instead of fetching from their URLs.", +"message.desc.validationformat": "Specifies the format used to validate the parameter value, such as EMAIL, URL, UUID, DECIMAL, etc.", +"message.desc.valueoptions": "Provide a comma-separated list of values that will appear as selectable options for this parameter", +"message.desc.zone": "A Zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more Pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.", +"message.desc.zone.edge": "A Zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. An edge zone consists of one or more hosts (each of which provides local storage as primary storage servers). Only shared and L2 Networks can be deployed in such zones and functionalities that require secondary storages are not supported.", +"message.drs.plan.description": "The maximum number of live migrations allowed for DRS. Configure DRS under the settings tab before generating a plan or to enable automatic DRS for the Cluster.", "message.drs.plan.executed": "DRS plan executed successfully.", "message.zone.edge.local.storage": "Local storage will be used by default for User Instances and virtual routers", "message.detach.disk": "Are you sure you want to detach this disk?", @@ -3045,6 +3410,9 @@ "message.disable.webhook.ssl.verification": "Disabling SSL verification is not recommended", "message.discovering.feature": "Discovering features, please wait...", "message.disk.offering.created": "Disk offering created:", +"message.success.clone.backup.offering": "Successfully cloned backup offering", +"message.success.clone.disk.offering": "Successfully cloned disk offering:", +"message.success.clone.network.offering": "Successfully cloned network offering:", "message.disk.usage.info.data.points": "Each data point represents the difference in read/write data since the last data point.", "message.disk.usage.info.sum.of.disks": "The disk usage shown is made up of the sum of read/write data from all the disks in the Instance.", "message.download.volume": "Please click the link to download the volume:

    00000", @@ -3065,11 +3433,13 @@ "message.enable.vpn": "Please confirm that you want remote access VPN enabled for this IP address.", "message.enable.vpn.failed": "Failed to enable VPN.", "message.enable.vpn.processing": "Enabling VPN...", -"message.enabled.vpn": "Your remote access VPN is currently enabled and can be accessed via the IP.", +"message.enabled.vpn": "Your remote access VPN is currently enabled and can be accessed via the IP", "message.enabled.vpn.ip.sec": "Your IPSec pre-shared key is", +"message.enabled.vpn.ip.range": "Your VPN IP Range is", "message.enabling.security.group.provider": "Enabling security group provider", "message.enter.valid.nic.ip": "Please enter a valid IP address for NIC", "message.error.access.key": "Please enter access key.", +"message.error.account.delete.name.mismatch": "Name entered doesn't match the account name.", "message.error.add.guest.network": "Either IPv4 fields or IPv6 fields need to be filled when adding a guest Network.", "message.error.add.interface.static.route": "Adding interface Static Route failed", "message.error.add.logical.router": "Adding Logical Router failed", @@ -3085,11 +3455,12 @@ "message.error.apply.tungsten.tag": "Applying Tag failed", "message.error.binaries.iso.url": "Please enter binaries ISO URL.", "message.error.bucket": "Please enter bucket", +"message.error.change.password": "Failed to change password.", "message.error.cidr": "CIDR is required", "message.error.cidr.or.cidrsize": "CIDR or cidr size is required", "message.error.cloudian.console": "Single-Sign-On failed for Cloudian management console. Please ask your administrator to fix integration issues.", -"message.error.cluster.description": "Please enter Kubernetes cluster description.", -"message.error.cluster.name": "Please enter cluster name.", +"message.error.cluster.description": "Please enter Kubernetes Cluster description.", +"message.error.cluster.name": "Please enter Cluster name.", "message.error.confirm.password": "Please confirm new password.", "message.error.confirm.text": "Please enter the confirmation text", "message.error.current.password": "Please enter current password.", @@ -3103,6 +3474,7 @@ "message.error.delete.tungsten.tag": "Removing Tag failed", "message.error.description": "Please enter description.", "message.error.discovering.feature": "Exception caught while discovering features.", +"message.error.setting.deployasistemplate": "Settings are read directly from the template", "message.error.setup.2fa": "2FA setup failed while verifying the code, please retry.", "message.error.verifying.2fa": "Unable to verify 2FA, please retry.", "message.error.display.text": "Please enter display text.", @@ -3118,6 +3490,9 @@ "message.error.host.username": "Please enter host username.", "message.error.hypervisor.type": "Please select hypervisor type.", "message.error.input.value": "Please enter value.", +"message.error.input.invalidemail": "Please enter a valid email.", +"message.error.input.invalidurl": "Please enter a valid URL.", +"message.error.input.invaliduuid": "Please enter a valid UUID.", "message.error.internal.dns1": "Please enter internal DNS 1", "message.error.internallb.instance.port": "Please specify a Instance port.", "message.error.internallb.name": "Please specify a name for the internal LB.", @@ -3130,7 +3505,7 @@ "message.error.ipv6.address": "Please enter a valid IP v6 address.", "message.error.ipv6.gateway": "Please enter IpV6 Gateway", "message.error.ipv6.gateway.format": "Please enter a valid IPv6 Gateway.", -"message.error.kubecluster.name": "Please enter Kubernetes cluster name.", +"message.error.kubecluster.name": "Please enter Kubernetes Cluster name.", "message.error.kuberversion": "Please enter Kubernetes semantic version.", "message.error.limit.value": "The value must not be less than", "message.error.loading.setting": "There was an error loading these settings.", @@ -3144,6 +3519,7 @@ "message.error.netmask": "Please enter Netmask.", "message.error.network.offering": "Please select Network offering.", "message.error.new.password": "Please enter new password.", +"message.error.newpassword.sameascurrent": "New password cannot be the same as the current password.", "message.error.nexus1000v.ipaddress": "Please enter Nexus 1000v IP address.", "message.error.nexus1000v.password": "Please enter Nexus 1000v password.", "message.error.nexus1000v.username": "Please enter Nexus 1000v username.", @@ -3164,7 +3540,7 @@ "message.error.remove.vm.schedule": "Removing Instance Schedule failed", "message.error.required.input": "Please enter input", "message.error.reset.config": "Unable to reset config to default value", -"message.error.retrieve.kubeconfig": "Unable to retrieve Kubernetes cluster config", +"message.error.retrieve.kubeconfig": "Unable to retrieve Kubernetes Cluster config", "message.error.routing.policy.term": "Community need to have the following format number:number", "message.error.s3nfs.path": "Please enter S3 NFS Path", "message.error.s3nfs.server": "Please enter S3 NFS Server", @@ -3181,12 +3557,13 @@ "message.error.sbdomain.username": "Please enter SMB domain username.", "message.error.secret.key": "Please enter secret key.", "message.error.select": "Please select option.", +"message.error.select.account.to.dedicate": "Please select an account to dedicate to.", "message.error.select.domain.to.dedicate": "Please select domain to dedicate to.", -"message.error.select.zone.type": "Please select zone type below.", +"message.error.select.zone.type": "Please select Zone type below.", "message.error.server": "Please enter server.", -"message.error.serviceoffering.for.cluster": "Please select service offering for Kubernetes cluster.", +"message.error.serviceoffering.for.cluster": "Please select service offering for Kubernetes Cluster.", "message.error.size": "Please enter size in GB.", -"message.error.size.for.cluster": "Please enter size for Kubernetes cluster.", +"message.error.size.for.cluster": "Please enter size for Kubernetes Cluster.", "message.error.smb.password": "Please enter SMB password.", "message.error.smb.username": "Please enter SMB username.", "message.error.specify.stickiness.method": "Please specify a stickiness method", @@ -3204,7 +3581,7 @@ "message.error.upload.template": "Template upload failed.", "message.error.upload.template.description": "Only one Template can be uploaded at a time.", "message.error.url": "Please enter URL.", -"message.error.userdata": "Please enter Userdata", +"message.error.user.data": "Please enter the User Data", "message.error.username": "Enter your username.", "message.error.valid.iops.range": "Please enter a valid IOPS range.", "message.error.vcenter.datacenter": "Please enter vCenter datacenter.", @@ -3212,18 +3589,17 @@ "message.error.vcenter.host": "Please enter vCenter host.", "message.error.vcenter.password": "Please enter vCenter password.", "message.error.vcenter.username": "Please enter vCenter username.", -"message.error.version.for.cluster": "Please select Kubernetes version for Kubernetes cluster.", +"message.error.version.for.cluster": "Please select Kubernetes version for Kubernetes Cluster.", "message.error.vlan.range": "Please enter a valid VLAN/VNI range.", "message.error.volume.name": "Please enter volume name.", "message.error.volume": "Please enter volume.", "message.error.volume.group": "Please enter volume group.", -"message.error.zone": "Please select a zone.", -"message.error.zone.combined": "All zones cannot be combined with any other zone.", -"message.error.zone.for.cluster": "Please select zone for Kubernetes cluster.", -"message.error.zone.name": "Please enter zone name.", -"message.error.zone.type": "Please select zone type.", +"message.error.zone": "Please select a Zone.", +"message.error.zone.combined": "All Zones cannot be combined with any other zone.", +"message.error.zone.for.cluster": "Please select Zone for Kubernetes Cluster.", +"message.error.zone.name": "Please enter Zone name.", +"message.error.zone.type": "Please select Zone type.", "message.error.linstor.resourcegroup": "Please enter the Linstor Resource-Group.", -"message.error.fixed.offering.kvm": "It's not possible to scale up Instances that utilize KVM hypervisor with a fixed compute offering.", "message.error.create.webhook.local.account": "Account must be provided for creating a Webhook with Local scope.", "message.error.create.webhook.name": "Name must be provided for creating a Webhook.", "message.error.create.webhook.payloadurl": "Payload URL must be provided for creating a Webhook.", @@ -3233,6 +3609,8 @@ "message.failed.to.remove": "Failed to remove", "message.forgot.password.success": "An email has been sent to your email address with instructions on how to reset your password.", "message.generate.keys": "Please confirm that you would like to generate new API/Secret keys for this User.", +"message.global.setting.updated": "Global Setting updated successfully.", +"message.global.setting.update.failed": "Failed to update Global Setting.", "message.chart.statistic.info": "The shown charts are self-adjustable, that means, if the value gets close to the limit or overpass it, it will grow to adjust the shown value", "message.chart.statistic.info.hypervisor.additionals": "The metrics data depend on the hypervisor plugin used for each hypervisor. The behavior can vary across different hypervisors. For instance, with KVM, metrics are real-time statistics provided by libvirt. In contrast, with VMware, the metrics are averaged data for a given time interval controlled by configuration.", "message.guest.traffic.in.advanced.zone": "Guest Network traffic is communication between end-user Instances. Specify a range of VLAN IDs or VXLAN Network identifiers (VNIs) to carry guest traffic for each physical Network.", @@ -3241,12 +3619,15 @@ "message.host.controlstate.retry": "Some actions on this Instance will fail, if so please wait a while and retry.", "message.host.dedicated": "Host Dedicated", "message.host.dedication.released": "Host dedication released.", +"message.host.external.datadisk": "Usage of data disks for the selected template is not applicable", "message.import.running.instance.warning": "The selected VM is powered-on on the VMware Datacenter. The recommended state to convert a VMware VM into KVM is powered-off after a graceful shutdown of the guest OS.", +"message.import.vm.tasks": "Import from VMware to KVM tasks", "message.import.volume": "Please specify the domain, account or project name.
    If not set, the volume will be imported for the caller.", "message.info.cloudian.console": "Cloudian Management Console should open in another window.", "message.installwizard.cloudstack.helptext.website": " * Project website:\t ", -"message.infra.setup.nsx.description": "This zone must contain an NSX provider because the isolation method is NSX", -"message.infra.setup.tungsten.description": "This zone must contain a Tungsten-Fabric provider because the isolation method is TF", +"message.infra.setup.netris.description": "This zone must contain a Netris provider because the isolation method is Netris", +"message.infra.setup.nsx.description": "This Zone must contain an NSX provider because the isolation method is NSX", +"message.infra.setup.tungsten.description": "This Zone must contain a Tungsten-Fabric provider because the isolation method is TF", "message.installwizard.cloudstack.helptext.document": " * Documentation:\t ", "message.installwizard.cloudstack.helptext.header": "\nYou can find more information about Apache CloudStack™ on the pages listed below.\n", "message.installwizard.cloudstack.helptext.issues": " * Report issues:\t ", @@ -3254,26 +3635,34 @@ "message.installwizard.cloudstack.helptext.releasenotes": " * Release notes:\t ", "message.installwizard.cloudstack.helptext.survey": " * Take the survey:\t ", "message.installwizard.copy.whatiscloudstack": "CloudStack™ is a software platform that pools computing resources to build public, private, and hybrid Infrastructure as a Service (IaaS) clouds. CloudStack™ manages the Network, storage, and compute nodes that make up a cloud infrastructure. Use CloudStack™ to deploy, manage, and configure cloud computing environments.\n\nExtending beyond individual Instance images running on commodity hardware, CloudStack™ provides a turnkey cloud infrastructure software stack for delivering virtual datacenters as a service - delivering all of the essential components to build, deploy, and manage multi-tier and multi-tenant cloud applications.", -"message.installwizard.tooltip.addpod.name": "A name for the pod.", +"message.installwizard.tooltip.addpod.name": "A name for the Pod.", "message.installwizard.tooltip.addpod.reservedsystemendip": "This is the IP range in the private Network that the CloudStack uses to manage Secondary Storage VMs and Console Proxy VMs. These IP addresses are taken from the same subnet as computing servers.", -"message.installwizard.tooltip.addpod.reservedsystemgateway": "The gateway for the hosts in that pod.", +"message.installwizard.tooltip.addpod.reservedsystemgateway": "The gateway for the hosts in that Pod.", "message.installwizard.tooltip.addpod.reservedsystemstartip": "This is the IP range in the private Network that the CloudStack uses to manage Secondary Storage VMs and Console Proxy VMs. These IP addresses are taken from the same subnet as computing servers.", -"message.installwizard.tooltip.configureguesttraffic.guestendip": "The range of IP addresses that will be available for allocation to guests in this zone. If one NIC is used, these IPs should be in the same CIDR as the pod CIDR.", +"message.installwizard.tooltip.configureguesttraffic.guestendip": "The range of IP addresses that will be available for allocation to guests in this Zone. If one NIC is used, these IPs should be in the same CIDR as the Pod CIDR.", "message.installwizard.tooltip.configureguesttraffic.guestgateway": "The gateway that the guests should use.", "message.installwizard.tooltip.configureguesttraffic.guestnetmask": "The netmask in use on the subnet that the guests should use.", -"message.installwizard.tooltip.configureguesttraffic.gueststartip": "The range of IP addresses that will be available for allocation to guests in this zone. If one NIC is used, these IPs should be in the same CIDR as the pod CIDR.", +"message.installwizard.tooltip.configureguesttraffic.gueststartip": "The range of IP addresses that will be available for allocation to guests in this Zone. If one NIC is used, these IPs should be in the same CIDR as the Pod CIDR.", +"message.installwizard.tooltip.netris.provider.name": "Netris Provider name is required", +"message.installwizard.tooltip.netris.provider.url": "Netris Provider URL not provided", +"message.installwizard.tooltip.netris.provider.username": "Netris Provider username not provided", +"message.installwizard.tooltip.netris.provider.password": "Netris Provider password not provided", +"message.installwizard.tooltip.netris.provider.site": "Netris Provider Site name not provided", +"message.installwizard.tooltip.netris.provider.tag": "Netris Tag to be assigned to vNets", +"message.installwizard.tooltip.netris.provider.tenant.name": "Netris Provider Admin Tenant name not provided", "message.installwizard.tooltip.nsx.provider.hostname": "NSX Provider hostname / IP address not provided", "message.installwizard.tooltip.nsx.provider.username": "NSX Provider username not provided", "message.installwizard.tooltip.nsx.provider.password": "NSX Provider password not provided", -"message.installwizard.tooltip.nsx.provider.edgecluster": "NSX Provider edge cluster information not provided", +"message.installwizard.tooltip.nsx.provider.edgecluster": "NSX Provider edge Cluster information not provided", "message.installwizard.tooltip.nsx.provider.tier0gateway": "NSX Provider tier-0 gateway information not provided", -"message.installwizard.tooltip.nsx.provider.transportZone": "NSX Provider transport zone information not provided", +"message.installwizard.tooltip.nsx.provider.transportZone": "NSX Provider transport Zone information not provided", "message.installwizard.tooltip.tungsten.provider.gateway": "Tungsten provider gateway is required", "message.installwizard.tooltip.tungsten.provider.hostname": "Tungsten provider hostname is required", "message.installwizard.tooltip.tungsten.provider.introspectport": "Tungsten provider introspect port is required", "message.installwizard.tooltip.tungsten.provider.name": "Tungsten provider name is required", "message.installwizard.tooltip.tungsten.provider.port": "Tungsten provider port is required", "message.installwizard.tooltip.tungsten.provider.vrouterport": "Tungsten provider vrouter port is required", +"message.instance.architecture": "Please select Instance architecture", "message.instances.managed": "Instances controlled by CloudStack.", "message.instances.unmanaged": "Instances not controlled by CloudStack.", "message.instances.migrate.vmware": "Instances that can be migrated from VMware.", @@ -3283,14 +3672,16 @@ "message.ip.v6.prefix.delete": "IPv6 prefix deleted", "message.iso.arch": "Please select an ISO architecture", "message.iso.desc": "Disc image containing data or bootable media for OS.", -"message.kubeconfig.cluster.not.available": "Kubernetes cluster kubeconfig not available currently.", -"message.kubernetes.cluster.delete": "Please confirm that you want to destroy the cluster.", -"message.kubernetes.cluster.scale": "Please select desired cluster configuration.", -"message.kubernetes.cluster.start": "Please confirm that you want to start the cluster.", -"message.kubernetes.cluster.stop": "Please confirm that you want to stop the cluster.", +"message.kubernetes.cluster.add.nodes": "Please confirm that you want to add the following nodes to the cluster", +"message.kubernetes.cluster.delete": "Please confirm that you want to destroy the Cluster.", +"message.kubeconfig.cluster.not.available": "Kubernetes Cluster kubeconfig not available currently.", +"message.kubernetes.cluster.remove.nodes": "Please confirm that you want to remove the following nodes from the cluster", +"message.kubernetes.cluster.scale": "Please select desired Cluster configuration.", +"message.kubernetes.cluster.start": "Please confirm that you want to start the Cluster.", +"message.kubernetes.cluster.stop": "Please confirm that you want to stop the Cluster.", "message.kubernetes.cluster.upgrade": "Please select new Kubernetes version.", "message.kubernetes.version.delete": "Please confirm that you want to delete this Kubernetes version.", -"message.l2.network.unsupported.for.nsx": "L2 networks aren't supported for NSX enabled zones", +"message.l2.network.unsupported.for.nsx": "L2 networks aren't supported for NSX enabled Zones", "message.launch.zone": "Zone is ready to launch; please proceed to the next step.", "message.launch.zone.description": "Zone is ready to launch; please proceed to the next step.", "message.launch.zone.hint": "Configure Network components and traffic including IP addresses.", @@ -3315,8 +3706,9 @@ "message.lock.user": "Please confirm that you want to lock the User \"{user}\". By locking this User, they will no longer be able to manage their cloud resources. Existing resources can still be accessed.", "message.lock.user.success": "Successfully locked User \"{user}\"", "message.login.failed": "Login Failed", -"message.migrate.instance.host.auto.assign": "Host for the Instance will be automatically chosen based on the suitability within the same cluster", -"message.migrate.instance.to.host": "Please confirm that you want to migrate this Instance to another host. When migration is between hosts of different clusters volume(s) of the Instance may get migrated to suitable storage pools.", +"message.maintenance.initiated": "Maintenance has been initiated. This Management Server will not accept new jobs", +"message.migrate.instance.host.auto.assign": "Host for the Instance will be automatically chosen based on the suitability within the same Cluster", +"message.migrate.instance.to.host": "Please confirm that you want to migrate this Instance to another host. When migration is between hosts of different Clusters volume(s) of the Instance may get migrated to suitable storage pools.", "message.migrate.instance.to.ps": "Please confirm that you want to migrate this Instance to another primary storage.", "message.migrate.resource.to.ss": "Please confirm that you want to migrate this resource to another secondary storage.", "message.migrate.router.confirm": "Please confirm the host you wish to migrate the router to:", @@ -3334,6 +3726,7 @@ "message.move.acl.order.processing": "Moving ACL rule...", "message.network.acl.default.allow": "Warning: With this policy all traffic will be allowed through the firewall to this VPC Network Tier. You should consider securing your Network.", "message.network.acl.default.deny": "Warning: With this policy all traffic will be denied through the firewall to this VPC Network Tier. In order to allow traffic through you will need to change policies.", +"message.network.acl.import.note": "Note: Only valid rules from the CSV will be imported. Invalid entries will be discarded.", "message.network.addvm.desc": "Please specify the Network that you would like to add this Instance to. A new NIC will be added for this Network.", "message.network.description": "Setup Network and traffic.", "message.network.error": "Network Error", @@ -3351,6 +3744,7 @@ "message.network.selection": "Choose one or more Networks to attach the Instance to.", "message.network.selection.new.network": "A new Network can also be created here.", "message.network.updateip": "Please confirm that you would like to change the IP address for this NIC on the Instance.", +"message.network.update.nic": "Please confirm that you would like to update this NIC.", "message.network.usage.info.data.points": "Each data point represents the difference in data traffic since the last data point.", "message.network.usage.info.sum.of.vnics": "The Network usage shown is made up of the sum of data traffic from all the vNICs in the Instance.", "message.nfs.mount.options.description": "Comma separated list of NFS mount options for KVM hosts. Supported options : vers=[3,4.0,4.1,4.2], nconnect=[1...16]", @@ -3365,12 +3759,14 @@ "message.password.reset.success": "Password has been reset successfully. Please login using your new credentials.", "message.path": "Path : ", "message.path.description": "NFS: exported path from the server. VMFS: /datacenter name/datastore name. SharedMountPoint: path where primary storage is mounted, such as /mnt/primary.", +"message.please.confirm.remove.cni.configuration": "Please confirm that you want to remove this CNI Configuration", "message.please.confirm.remove.ssh.key.pair": "Please confirm that you want to remove this SSH key pair.", -"message.please.confirm.remove.user.data": "Please confirm that you want to remove this Userdata", +"message.please.confirm.remove.user.data": "Please confirm that you want to remove this User Data", "message.please.enter.valid.value": "Please enter a valid value.", "message.please.enter.value": "Please enter values.", +"message.please.login.new.password": "Please log in again with your new password", "message.please.wait.while.autoscale.vmgroup.is.being.created": "Please wait while your AutoScaling Group is being created; this may take a while...", -"message.please.wait.while.zone.is.being.created": "Please wait while your zone is being created; this may take a while...", +"message.please.wait.while.zone.is.being.created": "Please wait while your Zone is being created; this may take a while...", "message.pod.dedicated": "Pod dedicated.", "message.pod.dedication.released": "Pod dedication released.", "message.prepare.for.shutdown": "Please confirm that you would like to prepare this Management Server for shutdown. It will not accept any new Async Jobs but will NOT terminate after there are no pending jobs.", @@ -3387,10 +3783,11 @@ "message.recover.vm": "Please confirm that you would like to recover this Instance.", "message.reinstall.vm": "NOTE: Proceed with caution. This will cause the Instance to be reinstalled from the Template; data on the root disk will be lost. Extra data volumes, if any, will not be touched.", "message.release.ip.failed": "Failed to release IP", -"message.releasing.dedicated.cluster": "Releasing dedicated cluster...", +"message.releasing.dedicated.cluster": "Releasing dedicated Cluster...", "message.releasing.dedicated.host": "Releasing dedicated host...", -"message.releasing.dedicated.pod": "Releasing dedicated pod...", -"message.releasing.dedicated.zone": "Releasing dedicated zone...", +"message.releasing.dedicated.pod": "Releasing dedicated Pod...", +"message.releasing.dedicated.zone": "Releasing dedicated Zone...", +"message.remote.access.vpn.iprange.description": "The range of IP addresses to allocate to VPN clients. The first IP in the range will be taken by the VPN server. (Optional)", "message.remove.annotation": "Are you sure you want to delete the comment?", "message.remove.egress.rule.failed": "Removing egress rule failed", "message.remove.egress.rule.processing": "Deleting egress rule...", @@ -3424,9 +3821,11 @@ "message.resource.not.found": "Resource not found.", "message.restart.mgmt.server": "Please restart your management server(s) for your new settings to take effect.", "message.restart.network": "All services provided by this Network will be interrupted. Please confirm that you want to restart this Network.", +"message.restart.usage.server": "Please restart your usage server(s) for your new settings to take effect.", "message.restart.vm.to.update.settings": "Update in fields other than name and display name will require the Instance to be restarted.", "message.restart.vpc": "Please confirm that you want to restart the VPC.", "message.restart.vpc.remark": "Please confirm that you want to restart the VPC

    Remark: making a non-redundant VPC redundant will force a clean up. The Networks will not be available for a couple of minutes.

    ", +"message.running.custom.action": "Running action", "message.scale.processing": "Scale in progress", "message.scaledown.policies": "Please add at least a ScaleDown policy. The AutoScale Group will be scaled down when all conditions in a ScaleDown policy are matched. ScaleDown policies will be checked after ScaleUp policies.", "message.scaledown.policy.continue": "Please add at least condition to ScaleDown policy to continue", @@ -3436,37 +3835,41 @@ "message.scaleup.policy.continue": "Please add at least a condition to ScaleUp policy to continue", "message.scaleup.policy.duration.continue": "Please input a valid duration to ScaleUp policy to continue", "message.scaleup.policy.name.continue": "Please input a name to ScaleUp policy to continue", -"message.select.a.zone": "A zone typically corresponds to a single datacenter. Multiple zones help make the cloud more reliable by providing physical isolation and redundancy.", +"message.select.a.zone": "A Zone typically corresponds to a single datacenter. Multiple zones help make the cloud more reliable by providing physical isolation and redundancy.", "message.select.affinity.groups": "Please select any affinity groups you want this Instance to belong to:", "message.select.bgp.peers": "Please select / deselect the BGP peers associated to the network or VPC:", "message.select.deselect.desired.options": "Please select / deselect the desired options", "message.select.deselect.to.sort": "Please select / deselect to sort the values", "message.select.destination.image.stores": "Please select Image Store(s) to which data is to be migrated to", +"message.select.destination.storage.instance.conversion": "(Optional) Select a Primary Storage destination for the converted disks", "message.select.disk.offering": "Please select a disk offering for disk", "message.select.end.date.and.time": "Select an end date & time.", -"message.select.kvm.host.instance.conversion": "(Optional) Select a KVM host in the zone to perform the instance conversion through virt-v2v", -"message.select.kvm.host.instance.import": "(Optional) Select a KVM host in the cluster to perform the importing of the converted instance", +"message.select.extra.parameters.for.instance.conversion": "(Optional) Pass extra parameters to the virt-v2v command on the conversion host", +"message.select.kvm.host.instance.conversion": "(Optional) Select a KVM host in the Zone to perform the instance conversion through virt-v2v", +"message.select.kvm.host.instance.import": "(Optional) Select a KVM host in the Cluster to perform the importing of the converted instance", "message.select.load.balancer.rule": "Please select a load balancer rule for your AutoScale Instance group.", "message.select.migration.policy": "Please select a migration policy.", "message.select.nic.network": "Please select a Network for NIC", "message.select.security.groups": "Please select security group(s) for your new Instance.", "message.select.start.date.and.time": "Select a start date & time.", -"message.select.temporary.storage.instance.conversion": "(Optional) Select a Storage temporary destination for the converted disks through virt-v2v", -"message.select.zone.description": "Select type of zone basic/advanced.", -"message.select.zone.hint": "This is the type of zone deployment that you want to use. Basic zone: provides a single Network where each Instance is assigned an IP directly from the Network. Guest isolation can be provided through layer-3 means such as security groups (IP address source filtering). Advanced zone: For more sophisticated Network topologies. This Network model provides the most flexibility in defining guest Networks and providing custom Network offerings such as firewall, VPN, or load balancer support.", +"message.select.temporary.storage.instance.conversion": "(Optional) Select a staging storage for the converted disks", +"message.select.volume.to.continue": "Please select a volume to continue.", +"message.select.vm.to.continue": "Please select an Instance to continue.", +"message.select.zone.description": "Select type of Zone basic/advanced.", +"message.select.zone.hint": "This is the type of Zone deployment that you want to use. Basic zone: provides a single Network where each Instance is assigned an IP directly from the Network. Guest isolation can be provided through layer-3 means such as security groups (IP address source filtering). Advanced zone: For more sophisticated Network topologies. This Network model provides the most flexibility in defining guest Networks and providing custom Network offerings such as firewall, VPN, or load balancer support.", "message.server": "Server : ", "message.server.description": "NFS, iSCSI, or PreSetup: IP address or DNS name of the storage device. VMWare PreSetup: IP address or DNS name of the vCenter server. Linstor: http(s) url of the linstor-controller.", "message.set.default.nic": "Please confirm that you would like to make this NIC the default for this Instance.", "message.set.default.nic.manual": "Please manually update the default NIC on the Instance now.", "message.setting.updated": "Setting Updated:", "message.setting.update.delay": "The new value will take effect within 30 seconds.", -"message.setup.physical.network.during.zone.creation": "When adding a zone, you need to set up one or more physical networks. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical network.", -"message.setup.physical.network.during.zone.creation.basic": "When adding a basic zone, you can set up one physical Network, which corresponds to a NIC on the hypervisor. The Network carries several types of traffic.

    You may also add other traffic types onto the physical Network.", +"message.setup.physical.network.during.zone.creation": "When adding a Zone, you need to set up one or more physical networks. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical network.", +"message.setup.physical.network.during.zone.creation.basic": "When adding a basic Zone, you can set up one physical Network, which corresponds to a NIC on the hypervisor. The Network carries several types of traffic.

    You may also add other traffic types onto the physical Network.", "message.shared.network.offering.warning": "Domain admins and regular Users can only create shared Networks from Network offering with the setting specifyvlan=false. Please contact an administrator to create a Network offering if this list is empty.", -"message.shared.network.unsupported.for.nsx": "Shared networks aren't supported for NSX enabled zones", -"message.shutdown.triggered": "Shutdown has been triggered. This Management Server will not accept new jobs", -"message.maintenance.initiated": "Maintenance has been initiated. This Management Server will not accept new jobs", -"message.snapshot.additional.zones": "Snapshots will always be created in its native zone - %x, here you can select additional zone(s) where it will be copied to at creation time", +"message.shared.network.unsupported.for.nsx": "Shared networks aren't supported for NSX enabled Zones", +"message.shutdown.triggered": "A shutdown has been triggered. CloudStack will not accept new jobs", +"message.snapshot.additional.zones": "Snapshots will always be created in its native Zone - %x, here you can select additional zone(s) where it will be copied to at creation time", +"message.snapshot.desc": "Snapshot to create a ROOT disk from", "message.sourcenatip.change.warning": "WARNING: Changing the sourcenat IP address of the network will cause connectivity downtime for the Instances with NICs in the Network.", "message.sourcenatip.change.inhibited": "Changing the sourcenat to this IP of the Network to this address is inhibited as firewall rules are defined for it. This can include port forwarding or load balancing rules.\n - If this is an Isolated Network, please use updateNetwork/click the edit button.\n - If this is a VPC, first clear all other rules for this address.", "message.specify.tag.key": "Please specify a tag key.", @@ -3480,6 +3883,7 @@ "message.success.add.egress.rule": "Successfully added new egress rule", "message.success.add.firewall.rule": "Successfully added new firewall rule", "message.success.add.guest.network": "Successfully created guest Network", +"message.success.add.gpu.device": "Successfully added GPU device", "message.success.add.interface.static.route": "Successfully added interface Static Route", "message.success.add.iprange": "Successfully added IP range", "message.success.add.ipv4.subnet": "Successfully added IPv4 subnet", @@ -3488,9 +3892,11 @@ "message.success.add.kuberversion": "Successfully added Kubernetes version", "message.success.add.logical.router": "Successfully added Logical Router", "message.success.add.network": "Successfully added Network", -"message.success.add.network.acl": "Successfully added Network ACL list", +"message.success.add.network.acl": "Successfully added Network ACL", "message.success.add.network.static.route": "Successfully added Network Static Route", "message.success.add.network.permissions": "Successfully added Network permissions", +"message.success.add.nodes.to.cluster": "Successfully added nodes to Kubernetes cluster", +"message.success.remove.nodes.from.cluster": "Successfully removed nodes from Kubernetes cluster", "message.success.add.physical.network": "Successfully added Physical Network", "message.success.add.object.storage": "Successfully added Object Storage", "message.success.add.policy.rule": "Successfully added Policy rule", @@ -3505,12 +3911,13 @@ "message.success.add.tungsten.routing.policy": "Successfully added Tungsten-Fabric routing policy", "message.success.add.vpc": "Successfully added a Virtual Private Cloud", "message.success.add.vpc.network": "Successfully added a VPC network", -"message.success.add.vpn.customer.gateway": "Successfully added VPN customer gateway", +"message.success.add.vpn.customer.gateway": "Successfully added VPN Customer Gateway", "message.success.add.vpn.gateway": "Successfully added VPN gateway", +"message.success.add.webhook.filter": "Successfully added Webhook Filter", +"message.success.assign.sslcert": "Successfully assigned SSL certificate", "message.success.assign.vm": "Successfully assigned Instance", "message.success.apply.network.policy": "Successfully applied Network Policy", "message.success.apply.tungsten.tag": "Successfully applied Tag", -"message.success.asign.vm": "Successfully assigned Instance", "message.success.assigned.vms": "Successfully assigned Instances", "message.success.certificate.upload": "Certificate successfully uploaded", "message.success.change.affinity.group": "Successfully changed affinity groups", @@ -3519,6 +3926,7 @@ "message.success.change.password": "Successfully changed password for User", "message.success.change.host.password": "Successfully changed password for host \"{name}\"", "message.success.clear.webhook.deliveries": "Successfully cleared webhook deliveries", +"message.success.clear.webhook.filters": "Successfully cleared webhook filters", "message.success.change.scope": "Successfully changed scope for storage pool", "message.success.config.backup.schedule": "Successfully configured Instance backup schedule", "message.success.config.health.monitor": "Successfully Configure Health Monitor", @@ -3528,11 +3936,12 @@ "message.success.create.account": "Successfully created Account", "message.success.create.asnrange": "Successfully created AS Range", "message.success.create.bucket": "Successfully created bucket", +"message.success.create.extension": "Successfully created Extension", "message.success.create.sharedfs": "Successfully created Shared FileSystem", "message.success.create.internallb": "Successfully created Internal Load Balancer", "message.success.create.isolated.network": "Successfully created isolated Network", "message.success.create.keypair": "Successfully created SSH key pair", -"message.success.create.kubernetes.cluter": "Successfully created Kubernetes cluster", +"message.success.create.kubernetes.cluster": "Successfully created Kubernetes Cluster", "message.success.create.l2.network": "Successfully created L2 Network", "message.success.create.snapshot.from.vmsnapshot": "Successfully created Snapshot from Instance Snapshot", "message.success.create.template": "Successfully created Template", @@ -3546,6 +3955,8 @@ "message.success.delete.acl.rule": "Successfully removed ACL rule", "message.success.delete.backup.schedule": "Successfully deleted configure Instance backup schedule", "message.success.delete.bgp.peer": "Successfully deleted BGP peer", +"message.success.delete.custom.action": "Successfully deleted Custom Action", +"message.success.delete.gpu.devices": "Successfully deleted GPU device(s)", "message.success.delete.icon": "Successfully deleted icon of", "message.success.delete.interface.static.route": "Successfully removed interface Static Route", "message.success.delete.ipv4.subnet": "Successfully removed IPv4 subnet", @@ -3558,26 +3969,31 @@ "message.success.delete.tungsten.router.table": "Successfully removed Router Table", "message.success.delete.tungsten.tag": "Successfully removed Tag", "message.success.delete.vm": "Successfully deleted Instance", +"message.success.delete.vpn.gateway": "Successfully deleted VPN gateway", "message.success.disable.saml.auth": "Successfully disabled SAML authorization", "message.success.disable.vpn": "Successfully disabled VPN", +"message.success.discover.gpu.devices": "Successfully discovered GPU devices", "message.success.edit.acl": "Successfully edited ACL rule", "message.success.edit.primary.storage": "Successfully edited Primary Storage", "message.success.edit.rule": "Successfully edited rule", "message.success.enable.saml.auth": "Successfully enabled SAML Authorization", "message.success.import.instance": "Successfully imported Instance", "message.success.import.volume": "Successfully imported Volume", +"message.success.manage.gpu.devices": "Successfully managed GPU device(s)", "message.success.migrate.volume": "Successfully migrated volume", "message.success.migrating": "Migration completed successfully for", "message.success.migration": "Migration completed successfully", "message.success.move.acl.order": "Successfully moved ACL rule", "message.success.recurring.snapshot": "Successfully recurring Snapshots", +"message.success.register.extension": "Successfully registered Extension", "message.success.register.iso": "Successfully registered ISO", "message.success.register.keypair": "Successfully registered SSH key pair", "message.success.register.template": "Successfully registered Template", -"message.success.register.user.data": "Successfully registered Userdata", +"message.success.register.user.data": "Successfully registered User Data", "message.success.release.ip": "Successfully released IP", "message.success.release.dedicated.bgp.peer": "Successfully released dedicated BGP peer", "message.success.release.dedicated.ipv4.subnet": "Successfully released dedicated IPv4 subnet", +"message.success.remove.sslcert": "Successfully removed SSL certificate from load balancer", "message.success.remove.egress.rule": "Successfully removed egress rule", "message.success.remove.objectstore.objects": "Successfully removed selected object(s)", "message.success.remove.objectstore.directory": "Successfully removed selected directory", @@ -3597,26 +4013,38 @@ "message.success.remove.tungsten.routing.policy": "Successfully removed Tungsten-Fabric Routing Policy from Network", "message.success.reset.network.permissions": "Successfully reset Network Permissions", "message.success.resize.volume": "Successfully resized volume", -"message.success.scale.kubernetes": "Successfully scaled Kubernetes cluster", +"message.success.scale.kubernetes": "Successfully scaled Kubernetes Cluster", +"message.success.unmanage.gpu.devices": "Successfully unmanaged GPU device(s)", "message.success.unmanage.instance": "Successfully unmanaged Instance", "message.success.unmanage.volume": "Successfully unmanaged Volume", +"message.success.unregister.extension": "Successfully unregistered Extension", "message.success.update.account": "Successfully updated Account", "message.success.update.bgp.peer": "Successfully updated BGP peer", "message.success.update.bucket": "Successfully updated bucket", "message.success.update.condition": "Successfully updated condition", -"message.success.update.sharedfs": "Successfully updated Shared FileSystem", +"message.success.update.gpu.device": "Successfully updated GPU device", +"message.success.create.vgpu.profile": "Successfully created vGPU profile", +"message.success.update.vgpu.profile": "Successfully updated vGPU profile", +"message.success.delete.vgpu.profile": "Successfully deleted vGPU profile", +"message.success.update.custom.action": "Successfully updated Custom Action", +"message.success.update.extension": "Successfully updated Extension", "message.success.update.ipaddress": "Successfully updated IP address", "message.success.update.iprange": "Successfully updated IP range", "message.success.update.ipv4.subnet": "Successfully updated IPv4 subnet", +"message.success.update.iso": "Successfully updated ISO", "message.success.update.kubeversion": "Successfully updated Kubernetes supported version", "message.success.update.network": "Successfully updated Network", +"message.success.update.nic": "Successfully updated NIC", +"message.success.update.sharedfs": "Successfully updated Shared FileSystem", "message.success.update.template": "Successfully updated Template", "message.success.update.user": "Successfully updated User", -"message.success.upgrade.kubernetes": "Successfully upgraded Kubernetes cluster", +"message.success.update.vpn.customer.gateway": "Successfully updated VPN Customer Gateway", +"message.success.upgrade.kubernetes": "Successfully upgraded Kubernetes Cluster", "message.success.upload": "Successfully uploaded", "message.success.upload.description": "This ISO file has been uploaded. Please check its status in the Templates menu.", "message.success.upload.icon": "Successfully uploaded icon for ", "message.success.upload.iso.description": "This ISO file has been uploaded. Please check its status in the images > ISOs menu.", +"message.success.upload.ssl.cert": "Successfully uploaded SSL certificate", "message.success.upload.template.description": "This Template file has been uploaded. Please check its status in the Templates menu.", "message.success.upload.volume.description": "This volume has been uploaded. Please check its status in the volumes menu.", "message.suspend.project": "Are you sure you want to suspend this project?", @@ -3625,12 +4053,12 @@ "message.template.arch": "Please select a Template architecture.", "message.template.desc": "OS image that can be used to boot Instances.", "message.template.import.vm.temporary": "If a temporary Template is used, the reset Instance operation will not work after importing it.", -"message.template.iso": "Please select a Template or ISO to continue.", +"message.template.iso": "Please select a Template, ISO, volume or a snapshot to continue.", "message.template.type.change.warning": "WARNING: Changing the Template type to SYSTEM will disable further changes to the Template.", -"message.tooltip.reserved.system.netmask": "The Network prefix that defines the pod subnet. Uses CIDR notation.", +"message.tooltip.reserved.system.netmask": "The Network prefix that defines the Pod subnet. Uses CIDR notation.", "message.traffic.type.deleted": "Successfully deleted traffic type", -"message.traffic.type.to.basic.zone": "traffic type to basic zone", -"message.trigger.shutdown": "Please confirm that you would like to trigger a shutdown on this Management Server. It will not accept any new Async Jobs and will terminate after there are no pending jobs.", +"message.traffic.type.to.basic.zone": "traffic type to basic Zone", +"message.trigger.shutdown": "Please confirm that you would like to trigger a shutdown on this Management server. It will not accept any new Async Jobs and will terminate after there are no pending jobs.", "message.type.values.to.add": "Please add additional values by typing them in", "message.update.autoscale.policy.failed": "Failed to update autoscale policy", "message.update.autoscale.vmgroup.failed": "Failed to update autoscale group", @@ -3638,6 +4066,9 @@ "message.update.condition.failed": "Failed to update condition", "message.update.condition.processing": "Updating condition...", "message.update.failed": "Update failed", +"message.update.vpn.customer.gateway": "Update VPN Customer Gateway", +"message.update.vpn.customer.gateway.failed": "Updating the VPN Customer Gateway failed", +"message.update.vpn.customer.gateway.processing": "Updating VPN Customer Gateway...", "message.test.webhook.delivery": "Test delivery to the Webhook with an optional payload", "message.two.factor.authorization.failed": "Unable to verify 2FA with provided code, please retry.", "message.two.fa.auth": "Open the two-factor authentication app on your mobile device to view your authentication code.", @@ -3654,6 +4085,7 @@ "message.two.fa.setup.page": "Two factor authentication (2FA) is an extra layer of security to your account.
    Once setup is done, on every login you will be prompted to enter the 2FA code.
    ", "message.two.fa.view.setup.key": "Click here to view the setup key", "message.two.fa.view.static.pin": "Click here to view the static PIN", +"message.update.nic.processing": "Updating NIC...", "message.update.ipaddress.processing": "Updating IP Address...", "message.update.resource.count": "Please confirm that you want to update resource counts for this Account.", "message.update.resource.count.domain": "Please confirm that you want to update resource counts for this domain.", @@ -3700,6 +4132,8 @@ "message.vnf.nic.move.down.fail": "Failed to move down this NIC", "message.vnf.no.credentials": "No credentials found for the VNF appliance.", "message.vnf.select.networks": "Please select the relevant network for each VNF NIC.", +"message.volume.desc": "Volume to use as a ROOT disk", +"message.volume.pool.apply.to.all": "Selected storage pool will be applied to all existing volumes of the instance.", "message.volume.state.allocated": "The volume is allocated but has not been created yet.", "message.volume.state.attaching": "The volume is attaching to a volume from Ready state.", "message.volume.state.copying": "The volume is being copied from the image store to primary storage, in case it's an uploaded volume.", @@ -3723,17 +4157,26 @@ "message.volumes.managed": "Volumes controlled by CloudStack.", "message.volumes.unmanaged": "Volumes not controlled by CloudStack.", "message.vpc.restart.required": "Restart is required for VPC(s). Click here to view VPC(s) which require restart.", +"message.vpn.customer.gateway.contains.excluded.obsolete.parameters": "This VPN Customer Gateway contains cryptographic parameters that are marked as excluded or obsolete by the Administrator. Consider changing them using the Update VPN Customer Gateway form.", +"message.vpn.customer.gateway.excluded.parameter": " is marked as excluded. Please choose another value.", +"message.vpn.customer.gateway.obsolete.parameter": " is marked as obsolete/insecure. Please choose another value.", +"message.vpn.customer.gateway.obsolete.parameter.tooltip": "This parameter value is marked as obsolete/insecure.", +"message.vr.alert.upon.network.offering.creation.l2": "As virtual routers are not created for L2 Networks, the compute offering will not be used.", "message.vr.alert.upon.network.offering.creation.others": "As none of the obligatory services for creating a virtual router (VPN, DHCP, DNS, Firewall, LB, UserData, SourceNat, StaticNat, PortForwarding) are enabled, the virtual router will not be created and the compute offering will not be used.", "message.warn.change.primary.storage.scope": "This feature is tested and supported for the following configurations:
    KVM - NFS/Ceph - DefaultPrimary
    VMware - NFS - DefaultPrimary
    *There might be extra steps involved to make it work for other configurations.", "message.warn.filetype": "jpg, jpeg, png, bmp and svg are the only supported image formats.", -"message.warn.importing.instance.without.nic": "WARNING: This Instance is being imported without NICs and many Network resources will not be available. Consider creating a NIC via vCenter before importing or as soon as the Instance is imported.", -"message.warn.zone.mtu.update": "Please note that this limit won't affect pre-existing Network’s MTU settings", +"message.warn.importing.instance.without.nic": "WARNING: This Instance is being imported without NICs and many Network resources will not be available. Consider creating a NIC via vCenter before importing or as soon as the Instance is imported. For KVM host, allocate a NIC to Instance after import.", +"message.warn.select.template": "Please select a Template for Registration.", +"message.warn.zone.mtu.update": "Please note that this limit won't affect pre-existing Network's MTU settings", +"message.warn.vpc.offerings": "VPC offerings will only be shown if the selected account has at least one VPC.", "message.webhook.deliveries.time.filter": "Webhook deliveries list can be filtered based on date-time. Select 'Custom' for specifying start and end date range.", +"message.webhook.filter.add": "Webhook deliveries can be controlled using filters (currently by Event type). Please select the parameters to add to the applied filters list.", "message.zone.creation.complete": "Zone creation complete.", -"message.zone.detail.description": "Populate zone details.", -"message.zone.detail.hint": "A zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.", +"message.zone.detail.description": "Populate Zone details.", +"message.zone.detail.hint": "A Zone is the largest organizational unit in CloudStack, and it typically corresponds to a single datacenter. Zones provide physical isolation and redundancy. A zone consists of one or more Pods (each of which contains hosts and primary storage servers) and a secondary storage server which is shared by all pods in the zone.", "message.validate.min": "Please enter a value greater than or equal to {0}.", "message.action.delete.object.storage": "Please confirm that you want to delete this Object Store", +"message.action.unregister.extension.resource": "Please confirm that you want to unregister extension with this resource", "message.bgp.peers.null": "Please note, if no BGP peers are selected, the VR will connect to
    (1) dedicated BGP peers the owner can access, if the owner has dedicated BGP peers and account setting use.system.bgp.peers is set to false;
    (2) all BGP peers the owner can access, otherwise.
    ", "message.bucket.delete": "Please confirm that you want to delete this Bucket", "migrate.from": "Migrate from", @@ -3767,6 +4210,7 @@ "state.stopped": "Stopped", "state.stopping": "Stopping", "state.suspended": "Suspended", +"state.partiallyallocated": "Partially Allocated", "user.login": "Login", "user.logout": "Logout", "ALLOCATED_VM": "Allocated VM", diff --git a/ui/public/locales/es.json b/ui/public/locales/es.json index ae4fa19f0334..b7a409adad1e 100644 --- a/ui/public/locales/es.json +++ b/ui/public/locales/es.json @@ -14,12 +14,12 @@ "label.account.specific": "espec\u00edficas de la cuenta", "label.accounts": "Cuentas", "label.accounttype": "Tipo de Cuenta", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ID de ACL", -"label.acl.list.rules": "Lista de Reglas ACL", +"label.acl.rules": "Lista de Reglas ACL", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "Nombre de ACL", +"label.acl.rule.name": "Nombre de ACL", "label.acquire.new.ip": "Adquirir nueva IP", "label.acquire.new.secondary.ip": "Adquirir nueva IP secundaria", "label.action": "Acci\u00f3n", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Sesiones activas", "label.add": "Agregar", "label.add.account": "A\u00f1adir Cuenta", -"label.add.acl": "Agregar ACL", -"label.add.acl.list": "Agregar Lista ACL", +"label.add.acl.rule": "Agregar ACL", +"label.add.acl": "Agregar Lista ACL", "label.add.affinity.group": "Agregar un nuevo grupo de afinidad", "label.add.baremetal.dhcp.device": "Agregar dispositivo DHCP Baremetal", "label.add.bigswitchbcf.device": "Agregar Controlador BigSwitch BCF", @@ -142,12 +142,12 @@ "label.add.ip.range": "A\u00f1adir Rango IP", "label.add.isolated.network": "Agregar Red Aislada", "label.add.ldap.account": "Agregar cuenta LDAP", -"label.add.list.name": "Nombre de la Lista ACL", +"label.add.acl.name": "Nombre de la Lista ACL", "label.add.more": "A\u00f1adir m\u00e1s", "label.add.netscaler.device": "Agregar dispositivo Netscaler", "label.add.network": "Agregar Red", "label.add.network.acl": "Agregar ACL de Red", -"label.add.network.acl.list": "Agregar Lista ACL de Red", +"label.add.network.acl": "Agregar Lista ACL de Red", "label.add.network.offering": "Agregar Oferta de Red", "label.add.new.gateway": "Agregar nuevo gateway", "label.add.new.tier": "Agregar un nuevo tier", @@ -222,6 +222,7 @@ "label.available": "Disponible", "label.back": "Volver", "label.backup": "Respaldos", +"label.backups": "Respaldos", "label.backup.attach.restore": "Restaurar y conectar un Volumen de Respaldo", "label.backup.offering.assign": "Asignar instancia a una oferta de respaldo", "label.backup.offering.remove": "remover instancia de una oferta de respaldo", @@ -344,7 +345,7 @@ "label.default.use": "Uso por defecto", "label.default.view": "Vista Por Defecto", "label.delete": "Eliminar", -"label.delete.acl.list": "Borrar Lista ACL", +"label.delete.acl": "Borrar Lista ACL", "label.delete.affinity.group": "Borrar Grupo de Afinidad", "label.delete.alerts": "Eliminar alertas", "label.delete.bigswitchbcf": "Remover Controlador BigSwitch BCF", @@ -431,7 +432,7 @@ "label.driver": "Controlador", "label.dynamicscalingenabled": "Escalado din\u00e1mico habilitado", "label.edit": "Editar", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Editar regla ACL", "label.edit.project.details": "Editar detalles de proyecto", "label.edit.role": "Editar Rol", @@ -947,7 +948,6 @@ "label.remove.vpc.offering": "Quitar Oferta VPC", "label.removing": "Quitando..", "label.replace.acl": "Reemplazar ACL", -"label.replace.acl.list": "Reemplazar Lista ACL", "label.report.bug": "Reportar un Error", "label.required": "Requerido", "label.requireshvm": "HVM", @@ -1180,8 +1180,7 @@ "label.usehttps": "Use HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Usuario", -"label.userdata": "DatosUsuario", -"label.userdatal2": "Datos de Usuario", +"label.user.data": "DatosUsuario", "label.username": "Nombre de usuario", "label.users": "Usuarios", "label.utilization": "Utilisation", @@ -1361,7 +1360,7 @@ "message.confirm.archive.selected.alerts": "Por favor confirme que desea archivar las alertas seleccionadas", "message.confirm.archive.selected.events": "Por favor confirme que desea archivar los eventos seleccionados", "message.confirm.attach.disk": "\u00bf Est\u00e1 seguro que desea conectar el disco?", -"message.confirm.delete.acl.list": "\u00bfEsta seguro que desea borrar esta lista de ACL?", +"message.confirm.delete.acl": "\u00bfEsta seguro que desea borrar esta lista de ACL?", "message.confirm.delete.bigswitchbcf": "Por favor confirme que desa borrar este Controlador BigSwitch BCF", "message.confirm.delete.brocadevcs": "Por favor confirme que desa borrar este Switch Brocade Vcs", "message.confirm.delete.ciscoasa1000v": "Por favor confirme que desea borrar CiscoASA1000v", diff --git a/ui/public/locales/fr_FR.json b/ui/public/locales/fr_FR.json index 48a0560f1761..424f4749aa35 100644 --- a/ui/public/locales/fr_FR.json +++ b/ui/public/locales/fr_FR.json @@ -14,12 +14,12 @@ "label.account.specific": "Sp\u00e9cifique au compte", "label.accounts": "Comptes", "label.accounttype": "Type Compte", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ID ACL", -"label.acl.list.rules": "Liste r\u00e8gles ACL", +"label.acl.rules": "Liste r\u00e8gles ACL", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "Nom ACL", +"label.acl.rule.name": "Nom ACL", "label.acquire.new.ip": "Acqu\u00e9rir nouvelle adr. IP", "label.acquire.new.secondary.ip": "Acqu\u00e9rir nouvelle IP secondaire", "label.action": "Action", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Sessions actives", "label.add": "Ajouter", "label.add.account": "Ajouter un compte", -"label.add.acl": "Ajouter r\u00e8gle ACL", -"label.add.acl.list": "Ajouter Liste ACL", +"label.add.acl.rule": "Ajouter r\u00e8gle ACL", +"label.add.acl": "Ajouter Liste ACL", "label.add.affinity.group": "Ajouter nouveau groupe d'affinit\u00e9", "label.add.baremetal.dhcp.device": "Ajouter un DHCP Baremetal", "label.add.bigswitchbcf.device": "Ajouter un contr\u00f4leur BigSwitch BCF", @@ -142,12 +142,12 @@ "label.add.ip.range": "Ajouter une plage IP", "label.add.isolated.network": "Ajouter un r\u00e9seau isol\u00e9", "label.add.ldap.account": "Ajouter un compte LDAP", -"label.add.list.name": "Nom Liste ACL", +"label.add.acl.name": "Nom Liste ACL", "label.add.more": "Ajouter plus", "label.add.netscaler.device": "Ajouter un Netscaler", "label.add.network": "Ajouter un r\u00e9seau", "label.add.network.acl": "Ajouter une r\u00e8gle d'acc\u00e8s r\u00e9seau ACL", -"label.add.network.acl.list": "Ajouter Liste ACL r\u00e9seau", +"label.add.network.acl": "Ajouter Liste ACL r\u00e9seau", "label.add.network.offering": "Ajouter Offre R\u00e9seau", "label.add.new.gateway": "Ajouter une nouvelle passerelle", "label.add.new.tier": "Ajouter un nouveau tiers", @@ -334,7 +334,7 @@ "label.default.use": "Utilisation par d\u00e9faut", "label.default.view": "Vue par d\u00e9faut", "label.delete": "Supprimer", -"label.delete.acl.list": "Supprimer Liste ACL", +"label.delete.acl": "Supprimer Liste ACL", "label.delete.affinity.group": "Supprimer le groupe d'affinit\u00e9", "label.delete.alerts": "Supprimer alertes", "label.delete.bigswitchbcf": "Supprimer contr\u00f4leur BigSwitch BCF", @@ -419,7 +419,7 @@ "label.dpd": "D\u00e9tection de pair mort", "label.driver": "Pilote", "label.edit": "Modifier", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Modifier r\u00e8gle ACL", "label.edit.project.details": "Modifier les d\u00e9tails du projet", "label.edit.role": "\u00c9diter R\u00f4le", @@ -926,7 +926,6 @@ "label.remove.vpc.offering": "Supprimer offre VPC", "label.removing": "Suppression", "label.replace.acl": "Remplacer ACL", -"label.replace.acl.list": "Remplacer Liste ACL", "label.required": "Requis", "label.requireshvm": "HVM", "label.requiresupgrade": "Mise \u00e0 jour n\u00e9cessaire", @@ -1152,8 +1151,7 @@ "label.usehttps": "Utiliser HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Utilisateur", -"label.userdata": "Donn\u00e9es Utilisateur", -"label.userdatal2": "Donn\u00e9es utilisateur", +"label.user.data": "Donn\u00e9es Utilisateur", "label.username": "Identifiant", "label.users": "Utilisateurs", "label.utilization": "Utilisation", @@ -1331,7 +1329,7 @@ "message.confirm.archive.selected.alerts": "Confirmer l'archivage des alertes s\u00e9lectionn\u00e9es", "message.confirm.archive.selected.events": "Confirmez l'archivage des \u00e9v\u00e9nements s\u00e9lectionn\u00e9s", "message.confirm.attach.disk": "Confirmer le rattachement de ce disque ?", -"message.confirm.delete.acl.list": "Confirmer la suppression de cette liste ACL ?", +"message.confirm.delete.acl": "Confirmer la suppression de cette liste ACL ?", "message.confirm.delete.bigswitchbcf": "Confirmer que vous voulez supprimer ce contr\u00f4leur BigSwitch BCF", "message.confirm.delete.brocadevcs": "Confirmer la suppression du switch Brocade Vcs", "message.confirm.delete.ciscoasa1000v": "Confirmez la suppression du CiscoASA1000v", diff --git a/ui/public/locales/hi.json b/ui/public/locales/hi.json index 055909360b52..9d7440b92626 100644 --- a/ui/public/locales/hi.json +++ b/ui/public/locales/hi.json @@ -6,7 +6,7 @@ "label.accounts": "लेखा", "label.accounttype": "खाता प्रकार", "label.aclid": "ACL", -"label.aclname": "ACL नाम", +"label.acl.rule.name": "ACL नाम", "label.actions": "क्रियाएँ", "label.add": "जोड़ें", "label.adding": "जोड़ना", @@ -410,7 +410,7 @@ "label.usageunit": "Unit", "label.usehttps": "HTTPS का उपयोग करें", "label.user": "उपयोगकर्ता", -"label.userdata": "Userdata", +"label.user.data": "User Data", "label.username": "उपयोगकर्ता नाम", "label.users": "उपयोगकर्ता", "label.uuid": "ID", diff --git a/ui/public/locales/hu.json b/ui/public/locales/hu.json index 48275ce81fc1..ae58379d343c 100644 --- a/ui/public/locales/hu.json +++ b/ui/public/locales/hu.json @@ -14,12 +14,12 @@ "label.account.specific": "Sz\u00e1mla-specifikus", "label.accounts": "Sz\u00e1ml\u00e1k", "label.accounttype": "Sz\u00e1mla t\u00edpus", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL n\u00e9v", +"label.acl.rule.name": "ACL n\u00e9v", "label.acquire.new.ip": "\u00daj IP c\u00edm beszerz\u00e9se", "label.acquire.new.secondary.ip": "\u00daj m\u00e1sodlagos IP c\u00edm beszerz\u00e9se", "label.action": "M\u0171velet", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Akt\u00edv munkamenetek", "label.add": "Felv\u00e9tel", "label.add.account": "Sz\u00e1mla felv\u00e9tele", -"label.add.acl": "ACL felv\u00e9tele", -"label.add.acl.list": "ACL lista felv\u00e9tele", +"label.add.acl.rule": "ACL felv\u00e9tele", +"label.add.acl": "ACL Lista felv\u00e9tele", "label.add.affinity.group": "\u00daj affin\u00edt\u00e1si csoport felv\u00e9tele", "label.add.baremetal.dhcp.device": "Baremetal DHCP eszk\u00f6z felv\u00e9tele", "label.add.bigswitchbcf.device": "BigSwitch BCF vez\u00e9rl\u0151 felv\u00e9tele", @@ -142,12 +142,12 @@ "label.add.ip.range": "IP c\u00edmtartom\u00e1ny felv\u00e9tele", "label.add.isolated.network": "Izol\u00e1lt h\u00e1l\u00f3zat felv\u00e9tele", "label.add.ldap.account": "LDAP hozz\u00e1f\u00e9r\u00e9s felv\u00e9tele", -"label.add.list.name": "ACL lista n\u00e9v", +"label.add.acl.name": "ACL Lista n\u00e9v", "label.add.more": "Tov\u00e1bbi felv\u00e9tele", "label.add.netscaler.device": "Netscaler eszk\u00f6z felv\u00e9tele", "label.add.network": "H\u00e1l\u00f3zat felv\u00e9tele", "label.add.network.acl": "H\u00e1l\u00f3zati ACL felv\u00e9tele", -"label.add.network.acl.list": "H\u00e1l\u00f3zati ACL lista felv\u00e9tele", +"label.add.network.acl": "H\u00e1l\u00f3zati ACL Lista felv\u00e9tele", "label.add.network.offering": "H\u00e1l\u00f3zati aj\u00e1nlat felv\u00e9tele", "label.add.new.gateway": "\u00daj \u00e1tj\u00e1r\u00f3 felv\u00e9tele", "label.add.new.tier": "\u00daj r\u00e9teg felv\u00e9tele", @@ -334,7 +334,7 @@ "label.default.use": "Alap\u00e9rtelmezett haszn\u00e1lat", "label.default.view": "Alap\u00e9rtelmezett n\u00e9zet", "label.delete": "T\u00f6rl\u00e9s", -"label.delete.acl.list": "ACL lista t\u00f6rl\u00e9se", +"label.delete.acl": "ACL Lista t\u00f6rl\u00e9se", "label.delete.affinity.group": "Affin\u00edt\u00e1si csoport t\u00f6rl\u00e9se", "label.delete.alerts": "T\u00f6rl\u00e9s riaszt\u00e1sok", "label.delete.bigswitchbcf": "BigSwitch BCF vez\u00e9rl\u0151 elt\u00e1vol\u00edt\u00e1sa", @@ -419,7 +419,7 @@ "label.driver": "Driver", "label.dynamicscalingenabled": "dinamikus m\u00e9retez\u00e9s enged\u00e9lyezve", "label.edit": "Szerkeszt\u00e9s", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "ACL szab\u00e1ly szerkeszt\u00e9se", "label.edit.project.details": "Projekt r\u00e9szletek szerkeszt\u00e9se", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "VPC aj\u00e1nlat t\u00f6rl\u00e9se", "label.removing": "T\u00f6rl\u00e9s", "label.replace.acl": "ACL csere", -"label.replace.acl.list": "ACL lista cser\u00e9je", "label.required": "Sz\u00fcks\u00e9ges", "label.requireshvm": "HVM", "label.requiresupgrade": "Friss\u00edt\u00e9st ig\u00e9nyel", @@ -1150,8 +1149,7 @@ "label.usehttps": "HTTPS haszn\u00e1lata", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Felhaszn\u00e1l\u00f3", -"label.userdata": "Felhaszn\u00e1l\u00f3 adat", -"label.userdatal2": "Felhaszn\u00e1l\u00f3i adat", +"label.user.data": "Felhaszn\u00e1l\u00f3 adat", "label.username": "Felhaszn\u00e1l\u00f3n\u00e9v", "label.users": "Felhaszn\u00e1l\u00f3k", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Er\u0151s\u00edtsd meg, hogy le akarod archiv\u00e1lni a kiv\u00e1lasztott riaszt\u00e1sokat!", "message.confirm.archive.selected.events": "Er\u0151s\u00edtsd meg, hogy archiv\u00e1lni szeretn\u00e9d a kiv\u00e1lasztott esem\u00e9nyeket!", "message.confirm.attach.disk": "Biztosan csatolni szeretn\u00e9d a merevlemezt?", -"message.confirm.delete.acl.list": "Biztosan t\u00f6r\u00f6lni akarod ezt a ACL list\u00e1t?", +"message.confirm.delete.acl": "Biztosan t\u00f6r\u00f6lni akarod ezt a ACL List\u00e1t?", "message.confirm.delete.bigswitchbcf": "Er\u0151s\u00edtsd meg, hogy t\u00f6r\u00f6lni szeretn\u00e9d ezt a BigSwitch BCF vez\u00e9rl\u0151t!", "message.confirm.delete.brocadevcs": "Er\u0151s\u00edtsd meg, hogy t\u00f6r\u00f6lni szeretn\u00e9d a Brocade Vcs Switch-et", "message.confirm.delete.ciscoasa1000v": "Er\u0151s\u00edtsd meg, hogy t\u00f6r\u00f6lni akarod a CiscoASA1000v-t", @@ -1354,7 +1352,7 @@ "message.confirm.remove.selected.events": "Er\u0151s\u00edtsd meg, hogy t\u00f6r\u00f6lni szeretn\u00e9d a kiv\u00e1lasztott esem\u00e9nyeket", "message.confirm.remove.vmware.datacenter": "Er\u0151s\u00edtsd meg, hogy el akarod t\u00e1vol\u00edtani a VMware adatk\u00f6zpontot!", "message.confirm.remove.vpc.offering": "Biztos vagy abban, hogy t\u00f6r\u00f6lni akarod ezt a VPC aj\u00e1nlatot?", -"message.confirm.replace.acl.new.one": "Le akarod cser\u00e9lni ez ACL list\u00e1t egy \u00fajjal?", +"message.confirm.replace.acl.new.one": "Le akarod cser\u00e9lni ez ACL List\u00e1t egy \u00fajjal?", "message.confirm.scale.up.router.vm": "Biztosan fel akarod m\u00e9retezni a router VM-et?", "message.confirm.scale.up.system.vm": "Biztosan fel akarod m\u00e9retezni a rendszer VM-et?", "message.confirm.start.lb.vm": "Er\u0151s\u00edtsd meg, hogy el akarod ind\u00edtani az LB VM-et!", diff --git a/ui/public/locales/it_IT.json b/ui/public/locales/it_IT.json index 844763eba3a9..a2907b71f235 100644 --- a/ui/public/locales/it_IT.json +++ b/ui/public/locales/it_IT.json @@ -14,12 +14,12 @@ "label.account.specific": "Specifico dell'Account", "label.accounts": "Utenti", "label.accounttype": "Account Type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Name", +"label.acl.rule.name": "ACL Name", "label.acquire.new.ip": "Acquisizione nuovo indirizzo IP", "label.acquire.new.secondary.ip": "Acquisizione nuovo IP secondario", "label.action": "Action", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Sessioni Attive", "label.add": "Add", "label.add.account": "Aggiungi un Account", -"label.add.acl": "Aggiungere ACL", -"label.add.acl.list": "Add ACL List", +"label.add.acl.rule": "Aggiungere ACL", +"label.add.acl": "Add ACL", "label.add.affinity.group": "Aggiungere un nuovo gruppo di affinit\u00e0", "label.add.baremetal.dhcp.device": "Add Baremetal DHCP Device", "label.add.bigswitchbcf.device": "Aggiungere Controller BigSwitch BCF", @@ -142,12 +142,12 @@ "label.add.ip.range": "Aggiungere un IP Range", "label.add.isolated.network": "Add Isolated Network", "label.add.ldap.account": "Aggiungi un account LDAP", -"label.add.list.name": "ACL List Name", +"label.add.acl.name": "ACL Name", "label.add.more": "Add More", "label.add.netscaler.device": "Aggiungere device Netscaler", "label.add.network": "Aggiungere una Rete", "label.add.network.acl": "Aggiungere le ACL di rete", -"label.add.network.acl.list": "Add Network ACL List", +"label.add.network.acl": "Add Network ACL", "label.add.network.offering": "Aggiungere offerta di rete", "label.add.new.gateway": "Aggiungere un nuovo gateway", "label.add.new.tier": "Aggiungere un nuovo livello", @@ -334,7 +334,7 @@ "label.default.use": "Default Use", "label.default.view": "Vista di default", "label.delete": "Cancellare", -"label.delete.acl.list": "Delete ACL List", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "Cancellare Gruppo di Affinit\u00e0", "label.delete.alerts": "Cancella allarmi", "label.delete.bigswitchbcf": "Rimuovere Controller BigSwitch BCF", @@ -419,7 +419,7 @@ "label.dpd": "Dead Peer Detection", "label.driver": "Driver", "label.edit": "Modifica", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.project.details": "Modificare i dettagli del progetto", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "Remove VPC offering", "label.removing": "Rimozione", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL List", "label.required": "Required", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires Upgrade", @@ -1150,8 +1149,7 @@ "label.usehttps": "Utilizzare HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "User", -"label.userdata": "Userdata", -"label.userdatal2": "User Data", +"label.user.data": "User Data", "label.username": "Username", "label.users": "Users", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Please confirm you would like to archive the selected alerts", "message.confirm.archive.selected.events": "Please confirm you would like to archive the selected events", "message.confirm.attach.disk": "Are you sure you want to attach disk?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v", diff --git a/ui/public/locales/ja_JP.json b/ui/public/locales/ja_JP.json index 8357b9d49a28..b7f32d7a2e12 100644 --- a/ui/public/locales/ja_JP.json +++ b/ui/public/locales/ja_JP.json @@ -58,11 +58,11 @@ "label.access.kubernetes.nodes": "Kubernetesノードに接続", "label.acl.export": "エクスポートACLs", "label.acl.id": "ACL ID", - "label.acl.list.rules": "ACLルールのリスト", + "label.acl.rules": "ACLルールのリスト", "label.acl.reason.description": "ACLルールの理由を入力してください。", "label.acl.replaced": "ACLが置き換えられました", "label.aclid": "ACL", - "label.aclname": "ACL名", + "label.acl.rule.name": "ACL名", "label.acltotal": "ネットワークACL合計", "label.acquire.new.ip": "新しいIPアドレスの取得", "label.acquire.new.secondary.ip": "セカンダリIPアドレスの取得", @@ -298,8 +298,8 @@ "label.add.account": "アカウント追加", "label.add.accounts": "アカウント追加", "label.add.accounts.to": "アカウントの追加先:", - "label.add.acl": "ACL追加", - "label.add.acl.list": "ACL一覧追加", + "label.add.acl.rule": "ACL追加", + "label.add.acl": "ACL一覧追加", "label.add.affinity.group": "新しいアフィニティグループ追加", "label.add.baremetal.dhcp.device": "ベアメタルDHCPデバイス追加", "label.add.baremetal.rack.configuration": "ベアメタルラック設定追加", @@ -333,14 +333,14 @@ "label.add.l2.guest.network": "L2ゲストネットワーク追加", "label.add.ldap.account": "LDAPアカウント追加", "label.add.ldap.list.users": "LDAPユーザー一覧", - "label.add.list.name": "ACL一覧名", + "label.add.acl.name": "ACL一覧名", "label.add.load.balancer": "ロードバランサー追加", "label.add.management.ip.range": "マネージメントIP範囲追加", "label.add.more": "その他の項目追加", "label.add.netscaler.device": "NetScalerデバイス追加", "label.add.network": "ネットワーク追加", "label.add.network.acl": "ネットワークACL追加", - "label.add.network.acl.list": "ネットワークACL一覧追加", + "label.add.network.acl": "ネットワークACL一覧追加", "label.add.network.device": "ネットワークデバイス追加", "label.add.network.offering": "ネットワークオファリング追加", "label.add.new.f5": "新しいF5追加", @@ -485,6 +485,7 @@ "label.available.public.ips": "使用できるパブリックIPアドレス", "label.back": "戻る", "label.backup": "バックアップ", + "label.backups": "バックアップ", "label.backup.attach.restore": "復元とバックアップボリュームをアタッチ", "label.backup.offering.assign": "VMをバックアップオファリングに割り当て", "label.backup.offering.remove": "VMバックアップオファリングから削除", @@ -718,7 +719,7 @@ "label.default.view": "デフォルトビュー", "label.defaultnetwork": "デフォルトネットワーク", "label.delete": "削除", - "label.delete.acl.list": "ACL一覧削除", + "label.delete.acl": "ACL一覧削除", "label.delete.affinity.group": "アフィニティグループ削除", "label.delete.alerts": "アラート削除", "label.delete.backup": "バックアップ削除", @@ -872,7 +873,7 @@ "label.dynamicscalingenabled": "ダイナミックスケーリング有効", "label.dynamicscalingenabled.tooltip": "テンプレート、サービスオファリング、およびグローバル設定で動的スケーリングが有効になっている場合にのみ、VMは動的にスケーリングできます。", "label.edit": "編集", - "label.edit.acl.list": "ACL一覧編集", + "label.edit.acl": "ACL一覧編集", "label.edit.acl.rule": "ACLルール編集", "label.edit.affinity.group": "アフィニティグループ編集", "label.edit.lb.rule": "LBルール編集", @@ -1498,7 +1499,7 @@ "label.netscaler.vpx": "NetScaler VPXロードバランサー", "label.network": "ネットワーク", "label.network.acl": "ネットワークACL", - "label.network.acl.lists": "ネットワークACL一覧", + "label.network.acls": "ネットワークACL一覧", "label.network.acls": "ネットワークACL", "label.network.addvm": "VMへのネットワーク追加", "label.network.desc": "ネットワークの説明", @@ -1871,7 +1872,6 @@ "label.removing": "削除しています", "label.removing.user": "ユーザーを削除しています", "label.replace.acl": "ACLの置き換え", - "label.replace.acl.list": "ACL一覧の置き換え", "label.report.bug": "問題レポート", "label.required": "必須です", "label.requireshvm": "HVM", @@ -2321,8 +2321,7 @@ "label.user.details": "ユーザーの詳細", "label.user.source": "ソース", "label.user.vm": "ユーザーVM", - "label.userdata": "ユーザーデータ", - "label.userdatal2": "ユーザーデータ", + "label.user.data": "ユーザーデータ", "label.username": "ユーザー名", "label.users": "ユーザー", "label.usersource": "ユーザータイプ", @@ -2727,7 +2726,7 @@ "message.confirm.dedicate.host.domain.account": "このホストをドメイン/アカウント専用に設定してもよろしいですか?", "message.confirm.dedicate.pod.domain.account": "このポッドをドメイン/アカウント専用に設定してもよろしいですか?", "message.confirm.dedicate.zone": "このゾーンをドメイン/アカウント専用に設定してもよろしいですか?", - "message.confirm.delete.acl.list": "このACL一覧を削除してもよろしいですか?", + "message.confirm.delete.acl": "このACL一覧を削除してもよろしいですか?", "message.confirm.delete.alert": "このアラートを削除してもよろしいですか?", "message.confirm.delete.baremetal.rack.configuration": "ベアメタルラック設定を削除してもよろしいですか?", "message.confirm.delete.bigswitchbcf": "このBigSwitchBCFコントローラーを削除してもよろしいですか?", @@ -2933,7 +2932,6 @@ "message.error.domain": "ドメインを入力し、ROOTドメインは空のままにします", "message.error.enable.saml": "SAML SSOを有効にするユーザーIDが見つかりません。手動で有効にしてください。", "message.error.endip": "終了IPを入力してください", - "message.error.fixed.offering.kvm": "固定コンピューティングオファリングでKVMハイパーバイザーを利用するVMをスケールアップすることはできません。", "message.error.gateway": "ゲートウェイに入ってください", "message.error.host.name": "ホスト名を入力してください", "message.error.host.password": "ホストパスワードを入力してください", @@ -3329,7 +3327,7 @@ "message.success.create.internallb": "正常に作成された内部LB", "message.success.create.isolated.network": "正常に作成された隔離ネットワーク", "message.success.create.keypair": "SSHキーペアが正常に作成されました", - "message.success.create.kubernetes.cluter": "正常に作成されたKubernetesクラスター", + "message.success.create.kubernetes.cluster": "正常に作成されたKubernetesクラスター", "message.success.create.l2.network": "正常に作成されたL2ネットワーク", "message.success.create.snapshot.from.vmsnapshot": "VMスナップショットからスナップショットを正常に作成しました", "message.success.create.user": "正常に作成されたユーザー", diff --git a/ui/public/locales/ko_KR.json b/ui/public/locales/ko_KR.json index f1fab4b584cf..a951b859b48e 100644 --- a/ui/public/locales/ko_KR.json +++ b/ui/public/locales/ko_KR.json @@ -32,10 +32,10 @@ "label.accounttype": "\uacc4\uc815 \uc720\ud615", "label.acl.export": "ACL \ub0b4\ubcf4\ub0b4\uae30", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL \ubaa9\ub85d \uaddc\uce59", +"label.acl.rules": "ACL \ubaa9\ub85d \uaddc\uce59", "label.acl.reason.description": "ACL \uaddc\uce59 \ub4a4\uc5d0 \uc124\uba85\uc744 \uc785\ub825\ud558\uc2ed\uc2dc\uc624.", "label.aclid": "ACL", -"label.aclname": "ACL \uc774\ub984", +"label.acl.rule.name": "ACL \uc774\ub984", "label.acquire.new.ip": "\uc0c8 IP \uc8fc\uc18c \uac00\uc838\uc624\uae30", "label.acquire.new.secondary.ip": "\uc0c8 \ubcf4\uc870 IP \uc8fc\uc18c \uac00\uc838\uc624\uae30", "label.acquiring.ip": "IP \uac00\uc838\uc624\uae30", @@ -153,8 +153,8 @@ "label.activeviewersessions": "\ud65c\uc131 \uc138\uc158", "label.add": "\ucd94\uac00", "label.add.account": "\uacc4\uc815 \ucd94\uac00", -"label.add.acl": "\uad8c\ud55c \uad00\ub9ac(ACL) \ucd94\uac00", -"label.add.acl.list": "ACL \ubaa9\ub85d \ucd94\uac00", +"label.add.acl.rule": "\uad8c\ud55c \uad00\ub9ac(ACL) \ucd94\uac00", +"label.add.acl": "ACL \ubaa9\ub85d \ucd94\uac00", "label.add.affinity.group": "\uc0c8 Affinity \uadf8\ub8f9 \ucd94\uac00", "label.add.baremetal.dhcp.device": "Baremetal DHCP \uc7a5\uce58 \ucd94\uac00", "label.add.bigswitchbcf.device": "BigSwitch BCF \ucee8\ud2b8\ub864\ub7ec \ucd94\uac00", @@ -178,12 +178,12 @@ "label.add.isolated.network": "isolated \ub124\ud2b8\uc6cc\ud06c \ucd94\uac00", "label.add.kubernetes.cluster": "\ucfe0\ubc84\ub124\ud14c\uc2a4 \ud074\ub7ec\uc2a4\ud130 \ucd94\uac00", "label.add.ldap.account": "LDAP \uacc4\uc815 \ucd94\uac00", -"label.add.list.name": "ACL \ubaa9\ub85d \uc774\ub984", +"label.add.acl.name": "ACL \ubaa9\ub85d \uc774\ub984", "label.add.more": "\ub2e4\ub978 \ud56d\ubaa9 \ucd94\uac00", "label.add.netscaler.device": "Netscaler \uc7a5\uce58 \ucd94\uac00", "label.add.network": "\ub124\ud2b8\uc6cc\ud06c \ucd94\uac00", "label.add.network.acl": "\ub124\ud2b8\uc6cc\ud06c \uad8c\ud55c \uad00\ub9ac(ACL) \ucd94\uac00", -"label.add.network.acl.list": "\ub124\ud2b8\uc6cc\ud06c ACL \ubaa9\ub85d \ucd94\uac00", +"label.add.network.acl": "\ub124\ud2b8\uc6cc\ud06c ACL \ubaa9\ub85d \ucd94\uac00", "label.add.network.offering": "\ub124\ud2b8\uc6cc\ud06c \uc624\ud37c\ub9c1 \ucd94\uac00", "label.add.new.gateway": "\uc0c8 \uac8c\uc774\ud2b8\uc6e8\uc774 \ucd94\uac00\ud558\uae30", "label.add.new.tier": "\uc0c8 \uc11c\ube0c\ub137 \ucd94\uac00", @@ -269,6 +269,7 @@ "label.available": "\uc0ac\uc6a9 \uac00\ub2a5", "label.back": "\ub4a4\ub85c", "label.backup": "\ubc31\uc5c5", +"label.backups": "\ubc31\uc5c5", "label.backup.attach.restore": "\ubc31\uc5c5 \ubcfc\ub968 \ubcf5\uc6d0 \ubc0f \uc5f0\uacb0", "label.backup.offering.assign": "\uac00\uc0c1\uba38\uc2e0\uc5d0 \ubc31\uc5c5 \uc624\ud37c\ub9c1 \ud560\ub2f9", "label.backup.offering.remove": "\uac00\uc0c1\uba38\uc2e0\uc5d0 \ubc31\uc5c5 \uc624\ud37c\ub9c1 \uc81c\uac70", @@ -436,7 +437,7 @@ "label.default.view": "\uae30\ubcf8 \ubcf4\uae30", "label.defaultnetwork": "\uae30\ubcf8 \ub124\ud2b8\uc6cc\ud06c", "label.delete": "\uc0ad\uc81c", -"label.delete.acl.list": "ACL \ubaa9\ub85d \uc0ad\uc81c", +"label.delete.acl": "ACL \ubaa9\ub85d \uc0ad\uc81c", "label.delete.affinity.group": "Affinity \uadf8\ub8f9 \uc0ad\uc81c", "label.delete.alerts": "\uc54c\ub9bc \uc0ad\uc81c", "label.delete.backup": "\ubc31\uc5c5 \uc0ad\uc81c", @@ -549,7 +550,7 @@ "label.dpd": "Dead \ud53c\uc5b4 \uac10\uc9c0", "label.driver": "\ub4dc\ub77c\uc774\ubc84", "label.edit": "\ud3b8\uc9d1", -"label.edit.acl.list": "ACL \ubaa9\ub85d \ud3b8\uc9d1", +"label.edit.acl": "ACL \ubaa9\ub85d \ud3b8\uc9d1", "label.edit.acl.rule": "ACL \uaddc\uce59 \ud3b8\uc9d1", "label.edit.project.details": "\ud504\ub85c\uc81d\ud2b8 \uc0c1\uc138 \ud3b8\uc9d1", "label.edit.project.role": "\ud504\ub85c\uc81d\ud2b8 \uc5ed\ud560 \ud3b8\uc9d1", @@ -985,7 +986,7 @@ "label.netscaler.vpx": "NetScaler VPX \ub85c\ub4dc\ubc38\ub7f0\uc11c", "label.network": "\ub124\ud2b8\uc6cc\ud06c", "label.network.acl": "\ub124\ud2b8\uc6cc\ud06c \uad8c\ud55c \uad00\ub9ac(ACL)", -"label.network.acl.lists": "Network ACL \ubaa9\ub85d", +"label.network.acls": "Network ACL \ubaa9\ub85d", "label.network.addvm": "VM\uc5d0 \ub124\ud2b8\uc6cc\ud06c \ucd94\uac00", "label.network.desc": "\ub124\ud2b8\uc6cc\ud06c \uc124\uba85", "label.network.domain": "\ub124\ud2b8\uc6cc\ud06c \ub3c4\uba54\uc778", @@ -1251,7 +1252,6 @@ "label.remove.vpc.offering": "VPC \uc624\ud37c\ub9c1 \uc0ad\uc81c", "label.removing": "\uc0ad\uc81c\ud558\ub294 \uc911...", "label.replace.acl": "ACL \uad50\uccb4", -"label.replace.acl.list": "ACL \ubaa9\ub85d \uad50\uccb4", "label.report.bug": "\uc774\uc288 \ub9ac\ud3ec\ud2b8", "label.required": "\ud544\uc218 \uc0ac\ud56d", "label.requireshvm": "HVM", @@ -1560,8 +1560,7 @@ "label.usenewdiskoffering": "\ub514\uc2a4\ud06c \uc624\ud37c\ub9c1\uc744 \ubcc0\uacbd\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", "label.user": "\uc0ac\uc6a9\uc790", "label.user.conflict": "\ucda9\ub3cc", -"label.userdata": "\uc0ac\uc6a9\uc790 \ub370\uc774\ud130", -"label.userdatal2": "\uc0ac\uc6a9\uc790 \ub370\uc774\ud130", +"label.user.data": "\uc0ac\uc6a9\uc790 \ub370\uc774\ud130", "label.username": "\uc0ac\uc6a9\uc790 \uc774\ub984", "label.users": "\uc0ac\uc6a9\uc790", "label.usersource": "\uc0ac\uc6a9\uc790 \uc720\ud615", @@ -1818,7 +1817,7 @@ "message.confirm.archive.selected.events": "\uc120\ud0dd\ud55c \uc774\ubca4\ud2b8\ub97c \ubcf4\uad00\ud560 \uac83\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.", "message.confirm.attach.disk": "\ub514\uc2a4\ud06c\ub97c \uc5f0\uacb0 \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", "message.confirm.configure.ovs": "Ovs\ub97c \uad6c\uc131\ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", -"message.confirm.delete.acl.list": "\uc774 ACL \ubaa9\ub85d\uc744 \uc0ad\uc81c \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", +"message.confirm.delete.acl": "\uc774 ACL \ubaa9\ub85d\uc744 \uc0ad\uc81c \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?", "message.confirm.delete.bigswitchbcf": "\uc774 BigSwitch BCF \ucee8\ud2b8\ub864\ub7ec\ub97c \uc0ad\uc81c\ud560 \uac83\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.", "message.confirm.delete.brocadevcs": "Brocade Vcs \uc2a4\uc704\uce58\ub97c \uc0ad\uc81c\ud560 \uac83\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.", "message.confirm.delete.ciscoasa1000v": "CiscoASA1000\uc744 \uc0ad\uc81c\ud560 \uac83\uc778\uc9c0 \ud655\uc778\ud558\uc2ed\uc2dc\uc624.", @@ -2197,7 +2196,7 @@ "message.success.create.internallb": "\ub0b4\ubd80 LB\ub97c \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", "message.success.create.isolated.network": "isolated \ub124\ud2b8\uc6cc\ud06c\ub97c \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", "message.success.create.keypair": "SSH \ud0a4 \uc30d\uc744 \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", -"message.success.create.kubernetes.cluter": "\ucfe0\ubc84\ub124\ud14c\uc2a4 \ud074\ub7ec\uc2a4\ud130\ub97c \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", +"message.success.create.kubernetes.cluster": "\ucfe0\ubc84\ub124\ud14c\uc2a4 \ud074\ub7ec\uc2a4\ud130\ub97c \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", "message.success.create.l2.network": "L2 \ub124\ud2b8\uc6cc\ud06c\ub97c \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", "message.success.create.snapshot.from.vmsnapshot": "VM \uc2a4\ub0c5\uc0f7\uc5d0\uc11c \uc2a4\ub0c5\uc0f7\uc744 \uc0dd\uc131\ud588\uc2b5\ub2c8\ub2e4.", "message.success.create.user": "\uc0ac\uc6a9\uc790\uac00 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4.", diff --git a/ui/public/locales/nb_NO.json b/ui/public/locales/nb_NO.json index ec51f7415d3a..586d1fc5b259 100644 --- a/ui/public/locales/nb_NO.json +++ b/ui/public/locales/nb_NO.json @@ -14,12 +14,12 @@ "label.account.specific": "Kontospesifikk", "label.accounts": "Kontoer", "label.accounttype": "Kontotype", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL Liste Regler", +"label.acl.rules": "ACL Liste Regler", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Navn", +"label.acl.rule.name": "ACL Navn", "label.acquire.new.ip": "Tilegne ny IP", "label.acquire.new.secondary.ip": "Tilegne ny sekund\u00e6r IP", "label.action": "Handling", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Aktive sesjoner", "label.add": "Legg til", "label.add.account": "Legg til konto", -"label.add.acl": "Legg til ACL", -"label.add.acl.list": "Legg til ACL liste", +"label.add.acl.rule": "Legg til ACL", +"label.add.acl": "Legg til ACL liste", "label.add.affinity.group": "Legg til affinitetsgruppe", "label.add.baremetal.dhcp.device": "Legg Til Barmetall DHCP Enhet", "label.add.bigswitchbcf.device": "Legg til BigSwitch BCF kontroller", @@ -142,12 +142,12 @@ "label.add.ip.range": "Legg til IP-rekke", "label.add.isolated.network": "Legg Til Isolert Nettverk", "label.add.ldap.account": "Legg til LDAP-konto", -"label.add.list.name": "ACL listenavn", +"label.add.acl.name": "ACL listenavn", "label.add.more": "Legg til mer", "label.add.netscaler.device": "Legg til Netscaler enhet", "label.add.network": "Legg til nettverk", "label.add.network.acl": "Legg til nettverk ACL", -"label.add.network.acl.list": "Legg til nettverk ACL liste", +"label.add.network.acl": "Legg til nettverk ACL liste", "label.add.network.offering": "Legg til nettverkstilbud", "label.add.new.gateway": "Legg til ny gateway", "label.add.new.tier": "Legg til ny gren", @@ -334,7 +334,7 @@ "label.default.use": "Standard bruk", "label.default.view": "Standardvisning", "label.delete": "Slett", -"label.delete.acl.list": "Slett ACL liste", +"label.delete.acl": "Slett ACL liste", "label.delete.affinity.group": "Slett affinitetsgruppe", "label.delete.alerts": "Slette varsler", "label.delete.bigswitchbcf": "Fjern BigSwitch BCF-kontroller", @@ -419,7 +419,7 @@ "label.dpd": "D\u00f8d endepunkt-deteksjon", "label.driver": "Driver", "label.edit": "Editer", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Endre ACL regel", "label.edit.project.details": "Editer prosjektdetaljer", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "Fjern VPC tilbud", "label.removing": "Fjerner", "label.replace.acl": "Erstatt ACL", -"label.replace.acl.list": "Erstatt ACL Liste", "label.required": "P\u00e5krevd", "label.requireshvm": "HVM", "label.requiresupgrade": "Krever oppgradering", @@ -1150,8 +1149,7 @@ "label.usehttps": "Bruk HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Bruker", -"label.userdata": "Brukerdata", -"label.userdatal2": "Brukerdata", +"label.user.data": "Brukerdata", "label.username": "Brukernavn", "label.users": "Brukere", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Vennligst bekreft at du \u00f8nsker \u00e5 arkivere valgte varsler", "message.confirm.archive.selected.events": "Vennligst bekreft at du vil arkivere valgte hendelser", "message.confirm.attach.disk": "Er du sikker p\u00e5 at du vil tildele disk?", -"message.confirm.delete.acl.list": "Er du sikker p\u00e5 at du \u00f8nsker \u00e5 slette denne ACL listen?", +"message.confirm.delete.acl": "Er du sikker p\u00e5 at du \u00f8nsker \u00e5 slette denne ACL listen?", "message.confirm.delete.bigswitchbcf": "Vennligst bekreft at du \u00f8nsker \u00e5 slette denne BigSwitch BCF Controlleren?", "message.confirm.delete.brocadevcs": "Vennligst bekreft at du vil slette denne Brocade Vcs svitsjen", "message.confirm.delete.ciscoasa1000v": "Vennligst bekreft at du vil slette CiscoASA1000v", diff --git a/ui/public/locales/nl_NL.json b/ui/public/locales/nl_NL.json index 6bd1bf671594..15b1bbb13941 100644 --- a/ui/public/locales/nl_NL.json +++ b/ui/public/locales/nl_NL.json @@ -14,12 +14,12 @@ "label.account.specific": "Account-specifiek", "label.accounts": "Accounts", "label.accounttype": "Account type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL lijst regels", +"label.acl.rules": "ACL lijst regels", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL naam", +"label.acl.rule.name": "ACL naam", "label.acquire.new.ip": "Bemachtig nieuw IP", "label.acquire.new.secondary.ip": "Verkrijg nieuw secundair IP", "label.action": "Actie", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Actieve Sessies", "label.add": "Voeg toe", "label.add.account": "Voeg Account toe", -"label.add.acl": "Voeg ACL toe", -"label.add.acl.list": "voeg een ACL lijst toe", +"label.add.acl.rule": "Voeg ACL toe", +"label.add.acl": "voeg een ACL lijst toe", "label.add.affinity.group": "Nieuwe affinity groep toevoegen", "label.add.baremetal.dhcp.device": "Voeg Baremetal DHCP Apparaat toe", "label.add.bigswitchbcf.device": "Voeg eenBigSwitch BCF controller toe", @@ -142,12 +142,12 @@ "label.add.ip.range": "Voeg IP range toe", "label.add.isolated.network": "Geisoleerd Netwerk Toevoegen", "label.add.ldap.account": "Voeg LDAP account toe", -"label.add.list.name": "ACL lijst naam", +"label.add.acl.name": "ACL lijst naam", "label.add.more": "Voeg meer toe", "label.add.netscaler.device": "Voeg Netscaler apparaat toe", "label.add.network": "Voeg Netwerk toe", "label.add.network.acl": "Voeg netwerk ACL toe", -"label.add.network.acl.list": "voeg netwerk ACL lijst toe", +"label.add.network.acl": "voeg netwerk ACL lijst toe", "label.add.network.offering": "Voeg netwerk aanbieding toe", "label.add.new.gateway": "Voeg nieuwe gateway toe", "label.add.new.tier": "Voeg nieuwe Tier toe", @@ -334,7 +334,7 @@ "label.default.use": "Standaard Gebruik", "label.default.view": "Standaard Weergave", "label.delete": "Verwijder", -"label.delete.acl.list": "verwijder ACL lijst", +"label.delete.acl": "verwijder ACL lijst", "label.delete.affinity.group": "Verwijder Affinity Groep", "label.delete.alerts": "Verwijder waarschuwingen", "label.delete.bigswitchbcf": "Verwijder BigSwitch BCF Controller", @@ -420,7 +420,7 @@ "label.driver": "Driver", "label.dynamicscalingenabled": "Dynamisch schalen ingeschakeld\n", "label.edit": "Wijzig", -"label.edit.acl.list": "Verander een ACL lijst", +"label.edit.acl": "Verander een ACL lijst", "label.edit.acl.rule": "wijzig ACL regel", "label.edit.project.details": "Wijzig project details", "label.edit.role": "Edit Role", @@ -925,7 +925,6 @@ "label.remove.vpc.offering": "VPC aanbieding verwijderen", "label.removing": "Verwijderen", "label.replace.acl": "vervang ACL", -"label.replace.acl.list": "vervang ACL lijst", "label.required": "Vereist", "label.requireshvm": "HVM", "label.requiresupgrade": "Upgrade Benodigd", @@ -1151,8 +1150,7 @@ "label.usehttps": "Gebruik HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "Gebruiker", -"label.userdata": "Gebruikers gegevens", -"label.userdatal2": "Gebruiker Data", +"label.user.data": "Gebruiker Data", "label.username": "Gebruikersnaam", "label.users": "Gebruikers", "label.utilization": "Utilisation", @@ -1330,7 +1328,7 @@ "message.confirm.archive.selected.alerts": "bevestig dat u de geselecteerde meldingen wilt archiveren, alstublieft", "message.confirm.archive.selected.events": "bevestig dat u de geselecteerde gebeurtenissen wilt archiveren, alstublieft", "message.confirm.attach.disk": "Weet U zeker dat U een disk wilt koppelen?", -"message.confirm.delete.acl.list": "Weet U zeker dat U dit ACL wilt verwijderen?", +"message.confirm.delete.acl": "Weet U zeker dat U dit ACL wilt verwijderen?", "message.confirm.delete.bigswitchbcf": "bevestig dat u deze BigSwitch BCF Controller wilt verwijderen, alstublieft", "message.confirm.delete.brocadevcs": "bevestigd dat Brocade Vcs Switch wilt verwijderen, altublieft", "message.confirm.delete.ciscoasa1000v": "bevestig dat u CiscoASA100v wilt verwijderen, alstublieft", diff --git a/ui/public/locales/pl.json b/ui/public/locales/pl.json index 6077da5928e0..fbbbf612bc1d 100644 --- a/ui/public/locales/pl.json +++ b/ui/public/locales/pl.json @@ -14,12 +14,12 @@ "label.account.specific": "Account-Specific", "label.accounts": "Konta", "label.accounttype": "Account Type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Name", +"label.acl.rule.name": "ACL Name", "label.acquire.new.ip": "Acquire New IP", "label.acquire.new.secondary.ip": "Acquire new secondary IP", "label.action": "Action", @@ -119,8 +119,8 @@ "label.activeviewersessions": "Active Sessions", "label.add": "Dodaj", "label.add.account": "Dodaj konto", -"label.add.acl": "Dodaj ACL", -"label.add.acl.list": "Add ACL List", +"label.add.acl.rule": "Dodaj ACL", +"label.add.acl": "Add ACL rule List", "label.add.affinity.group": "Add new affinity group", "label.add.baremetal.dhcp.device": "Add Baremetal DHCP Device", "label.add.bigswitchbcf.device": "Add BigSwitch BCF Controller", @@ -142,12 +142,12 @@ "label.add.ip.range": "Add IP Range", "label.add.isolated.network": "Add Isolated Network", "label.add.ldap.account": "Add LDAP account", -"label.add.list.name": "ACL List Name", +"label.add.acl.name": "ACL Name", "label.add.more": "Dodaj wi\u0119cej", "label.add.netscaler.device": "Add Netscaler device", "label.add.network": "Dodaj sie\u0107", "label.add.network.acl": "Add network ACL", -"label.add.network.acl.list": "Add Network ACL List", +"label.add.network.acl": "Add Network ACL", "label.add.network.offering": "Add network offering", "label.add.new.gateway": "Add new gateway", "label.add.new.tier": "Add new tier", @@ -334,7 +334,7 @@ "label.default.use": "Default Use", "label.default.view": "Widok domy\u015blny", "label.delete": "Usu\u0144", -"label.delete.acl.list": "Delete ACL List", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "Delete Affinity Group", "label.delete.alerts": "Delete alerts", "label.delete.bigswitchbcf": "Remove BigSwitch BCF Controller", @@ -419,7 +419,7 @@ "label.dpd": "Dead Peer Detection", "label.driver": "Driver", "label.edit": "Edytuj", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.project.details": "Zmie\u0144 szczeg\u00f3\u0142y projektu", "label.edit.role": "Edit Role", @@ -924,7 +924,6 @@ "label.remove.vpc.offering": "Remove VPC offering", "label.removing": "Usuwanie", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL List", "label.required": "Wymagane", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires Upgrade", @@ -1150,8 +1149,7 @@ "label.usehttps": "Use HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "U\u017cytkowni", -"label.userdata": "Userdata", -"label.userdatal2": "User Data", +"label.user.data": "User Data", "label.username": "Nazwa u\u017cytkownika", "label.users": "U\u017cytkownicy", "label.utilization": "Utilisation", @@ -1329,7 +1327,7 @@ "message.confirm.archive.selected.alerts": "Please confirm you would like to archive the selected alerts", "message.confirm.archive.selected.events": "Please confirm you would like to archive the selected events", "message.confirm.attach.disk": "Are you sure you want to attach disk?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v", diff --git a/ui/public/locales/pt_BR.json b/ui/public/locales/pt_BR.json index dc72ec023bba..91f0fd895e58 100644 --- a/ui/public/locales/pt_BR.json +++ b/ui/public/locales/pt_BR.json @@ -1,27 +1,35 @@ { "alert.service.domainrouter": "Roteador do dom\u00ednio", +"error.dedicate.bgp.peer.failed": "Falha ao dedicar o par BGP", +"error.dedicate.ipv4.subnet.failed": "Falha ao dedicar a sub-rede IPv4", "error.dedicate.cluster.failed": "Falha ao dedicar cluster", "error.dedicate.host.failed": "Falha ao dedicar host", "error.dedicate.pod.failed": "Falha ao dedicar pod", "error.dedicate.zone.failed": "Falha ao dedicar zona", +"error.empty.counter.operator.threshold": "Contador, Operador ou Limite est\u00e1 vazio", "error.execute.api.failed": "Falha ao executar API", "error.fetching.async.job.result": "Foi encontrado um erro ao buscar o resultado do job ass\u00edncrono", -"error.form.message": "H\u00e1 problemas no formul\u00e1rio. Por favor, corrija-os.", +"error.form.message": "H\u00e1 problemas no formul\u00e1rio. Por favor, corrija-os", "error.password.not.match": "Os campos de senha n\u00e3o coincidem", +"error.release.dedicate.bgp.peer": "Falha ao liberar o par BGP dedicado", "error.release.dedicate.cluster": "Falha ao liberar cluster dedicado.", "error.release.dedicate.host": "Falha ao liberar host dedicado.", +"error.release.dedicate.ipv4.subnet": "Falha ao liberar a sub-rede IPv4 dedicada", "error.release.dedicate.pod": "Falha ao liberar pod dedicado.", "error.release.dedicate.zone": "Falha ao liberar zona dedicada.", +"error.unable.to.add.setting.extraconfig": "N\u00e3o \u00e9 permitido adicionar configura\u00e7\u00e3o para extraconfig. Por favor, habilite o par\u00e2metro extraconfig para a m\u00e1quina virtual", "error.unable.to.proceed": "N\u00e3o foi poss\u00edvel proceder. Por favor, contate um administrador.", "firewall.close": "Firewall", -"icmp.code.desc": "Informe -1 para permitir todos os c\u00f3digos ICMP.", -"icmp.type.desc": "Informe -1 para permitir todos os tipos ICMP.", +"icmp.code.desc": "Informe -1 para permitir todos os c\u00f3digos ICMP", +"icmp.type.desc": "Informe -1 para permitir todos os tipos ICMP", "inline": "Inline", "label.about": "Sobre", "label.about.app": "Sobre o CloudStack", "label.accept": "Aceitar", -"label.accept.project.invitation": "Aceitar convite de projeto.", +"label.accept.project.invitation": "Aceitar convite de projeto", "label.access": "Acesso", +"label.access.key": "Chave de acesso", +"label.access.kubernetes.nodes": "Acessar n\u00f3s Kubernetes", "label.accesskey": "Chave de acesso", "label.account": "Conta", "label.account.and.security.group": "Contas e grupos de seguran\u00e7a", @@ -33,10 +41,10 @@ "label.accounttype": "Tipo de conta", "label.acl.export": "Exportar ACLs", "label.acl.id": "ACL ID", -"label.acl.list.rules": "Lista de regras de ACL", +"label.acl.rules": "Lista de regras de ACL", "label.acl.reason.description": "Motivo para se utilizar a regra.", "label.aclid": "ACL", -"label.aclname": "Nome da ACL", +"label.acl.rule.name": "Nome da ACL", "label.acquire.new.ip": "Adquirir novo IP", "label.acquire.new.secondary.ip": "Adquira um novo IP secund\u00e1rio", "label.acquiring.ip": "Obtendo IP", @@ -45,19 +53,27 @@ "label.action.attach.iso": "Anexar ISO", "label.action.bulk.delete.egress.firewall.rules": "Apagar em massa as regras de sa\u00edda do firewall.", "label.action.bulk.delete.firewall.rules": "Apagar em massa as regras do firewall.", +"label.action.bulk.delete.ip.v6.firewall.rules": "Apagar em massa as regras de firewall IPv6.", "label.action.bulk.delete.isos": "Apagar em massa as ISOs.", "label.action.bulk.delete.load.balancer.rules": "Apagar em massa as regras de balanceamento de carga.", "label.action.bulk.delete.portforward.rules": "Apagar em massa as regras de encaminhamento de porta.", +"label.action.bulk.delete.routing.firewall.rules": "Remover em massa regras de firewall de Roteamento IPv4", +"label.action.bulk.delete.snapshots": "Excluir snapshots em massa", "label.action.bulk.delete.templates": "Apagar em massa as regras de template.", "label.action.bulk.release.public.ip.address": "Liberar em massa os enderec\u0327os de IPs P\u00fablicos.", "label.action.cancel.maintenance.mode": "Cancelar modo de manuten\u00e7\u00e3o", "label.action.change.password": "Trocar de senha", +"label.action.change.primary.storage.scope": "Alterar escopo do armazenamento prim\u00e1rio", +"label.action.clear.webhook.deliveries": "Limpar entregas do webhook", +"label.action.delete.webhook.deliveries": "Excluir entregas do webhook", "label.action.configure.stickiness": "Ader\u00eancia", "label.action.copy.iso": "Copiar ISO", +"label.action.copy.snapshot": "Copiar Snapshot", "label.action.copy.template": "Copiar template", "label.action.create.snapshot.from.vmsnapshot": "Criar snapshot a partir de uma snapshot de VM", "label.action.create.template.from.volume": "Criar template a partir do disco", "label.action.create.volume": "Criar disco", +"label.action.create.volume.add": "Criar e Adicionar Volume", "label.action.delete.account": "Remover conta", "label.action.delete.backup.offering": "Remover oferta de backup", "label.action.delete.cluster": "Remover cluster", @@ -65,20 +81,29 @@ "label.action.delete.domain": "Remover dom\u00ednio", "label.action.delete.egress.firewall": "Remover regra de sa\u00edda do firewall", "label.action.delete.firewall": "Remover regra de firewall", +"label.action.delete.guest.os": "Excluir Guest OS", +"label.action.delete.guest.os.hypervisor.mapping": "Excluir mapeamento de virtualizador do Guest OS", +"label.action.delete.interface.static.route": "Remover rota est\u00e1tica da interface Tungsten Fabric", "label.action.delete.ip.range": "Remover intervalo de IPs", "label.action.delete.iso": "Remover ISO", "label.action.delete.load.balancer": "Remover regra do balanceador de carga", "label.action.delete.network": "Remover rede", +"label.action.delete.network.permission": "Excluir permiss\u00e3o de Rede", +"label.action.delete.network.static.route": "Remover rota est\u00e1tica de Rede Tungsten Fabric", "label.action.delete.node": "Remover nodo", +"label.action.delete.oauth.provider": "Excluir provedor OAuth", +"message.action.delete.object.storage": "Por favor, confirme que voc\u00ea deseja excluir este Object Storage", "label.action.delete.physical.network": "Remover rede f\u00edsica", "label.action.delete.pod": "Remover pod", "label.action.delete.primary.storage": "Remover armazenamento prim\u00e1rio", +"label.action.delete.routing.firewall.rule": "Excluir regra de firewall de Roteamento IPv4", "label.action.delete.secondary.storage": "Remover armazenamento secund\u00e1rio", "label.action.delete.security.group": "Remover grupo de seguran\u00e7a", "label.action.delete.service.offering": "Remover plano", "label.action.delete.snapshot": "Remover snapshot", "label.action.delete.system.service.offering": "Remover oferta de servi\u00e7o de sistema", "label.action.delete.template": "Remover template", +"label.action.delete.tungsten.router.table": "Remover tabela de rotas Tungsten Fabric da Rede", "label.action.delete.user": "Remover usu\u00e1rio", "label.action.delete.volume": "Remover disco", "label.action.delete.zone": "Remover zona", @@ -87,11 +112,16 @@ "label.action.destroy.volume": "Destruindo volume", "label.action.detach.disk": "Desanexar disco", "label.action.detach.iso": "Desanexar ISO", +"label.action.disable.2FA.user.auth": "Desativar Autentica\u00e7\u00e3o de dois fatores do usu\u00e1rio", "label.action.disable.account": "Desativar conta", "label.action.disable.cluster": "Desativar cluster", +"label.action.disable.disk.offering": "Desativar oferta de disco", "label.action.disable.physical.network": "Desabilitar rede f\u00edsica", "label.action.disable.pod": "Desativar pod", +"label.action.disable.role": "Desativar Fun\u00e7\u00e3o", "label.action.disable.static.nat": "Desativar NAT est\u00e1tico", +"label.action.disable.service.offering": "Desativar oferta de servi\u00e7o", +"label.action.disable.system.service.offering": "Desativar oferta de servi\u00e7o do sistema", "label.action.disable.user": "Desativar usu\u00e1rio", "label.action.disable.zone": "Desativar zona", "label.action.download.iso": "Baixar ISO", @@ -102,22 +132,33 @@ "label.action.edit.domain": "Editar dom\u00ednio", "label.action.edit.instance": "Editar inst\u00e2ncia", "label.action.edit.iso": "Editar ISO", +"label.action.edit.nfs.options": "Editar op\u00e7\u00f5es de montagem NFS", +"label.action.edit.template": "Editar Template", "label.action.edit.zone": "Editar zona", "label.action.enable.account": "Ativar conta", "label.action.enable.cluster": "Ativar cluster", +"label.action.enable.disk.offering": "Ativar oferta de disco", "label.action.enable.maintenance.mode": "Ativar modo de manuten\u00e7\u00e3o", "label.action.enable.physical.network": "Habilitar rede f\u00edsica", "label.action.enable.pod": "Ativar pod", +"label.action.enable.role": "Ativar role", "label.action.enable.static.nat": "Ativar NAT est\u00e1tico", +"label.action.enable.service.offering": "Ativar oferta de servi\u00e7o", +"label.action.enable.system.service.offering": "Ativar oferta de servi\u00e7o do sistema", +"label.action.enable.two.factor.authentication": "Autentica\u00e7\u00e3o de dois fatores ativada", "label.action.enable.user": "Habilitar usu\u00e1rio", "label.action.enable.zone": "Ativar zona", "label.action.expunge.instance": "Eliminar inst\u00e2ncia", "label.action.force.reconnect": "Forc\u0327ar reconex\u00e3o", "label.action.generate.keys": "Gerar chaves", +"label.action.generate.api.secret.keys": "Gerar novos pares de chave de API", "label.action.get.diagnostics": "Obter diagn\u00f3stico", +"label.action.health.monitor": "Monitor de sa\u00fade", "label.action.image.store.read.only": "Colocar armazenamento secund\u00e1rio em modo somente leitura", "label.action.image.store.read.write": "Colocar armazenamento secund\u00e1rio em modo leitura-escrita", "label.action.import.export.instances": "Importar-exportar inst\u00e2ncias", +"label.action.import.unmanage.volumes": "Importar volumes de dados", +"label.action.ingest.instances": "Ingerir inst\u00e2ncias", "label.action.iso.permission": "Atualizar permiss\u00f5es da ISO", "label.action.iso.share": "Atualizar compartilhamento da ISO", "label.action.lock.account": "Bloquear conta", @@ -126,6 +167,9 @@ "label.action.migrate.router": "Migrar roteador", "label.action.migrate.systemvm": "Migrar VM de sistema", "label.action.migrate.systemvm.to.ps": "Migrar VM de sistema para outro armazenamento prim\u00e1rio", +"label.action.patch.systemvm": "Aplicar patch na VM de sistema", +"label.action.patch.systemvm.vpc": "Aplicar patch na VM de Sistema - Roteador Virtual de VPCs", +"label.action.patch.systemvm.processing": "Aplicando patch na VM de sistema....", "label.action.project.add.account": "Adicionar conta ao projeto", "label.action.project.add.user": "Adicionar usu\u00e1rio a um projeto", "label.action.quota.tariff.create": "Criar tarifa", @@ -136,21 +180,36 @@ "label.action.reboot.systemvm": "Reiniciar VM de sistema", "label.action.recover.volume": "Recuperar volume", "label.action.recurring.snapshot": "Snapshots recorrentes", +"label.action.resize.sharedfs": "Redimensionar Sistema de Arquivos Compartilhado", +"label.action.restart.sharedfs": "Reiniciar Sistema de Arquivos Compartilhado", "label.action.register.iso": "Registrar ISO", "label.action.register.template": "Registrar template a partir da URL", +"label.action.release.asnumber": "Liberar N\u00famero AS", "label.action.release.ip": "Liberar IP", +"label.action.release.reserved.ip": "Liberar IP reservado", "label.action.remove.host": "Remover host", +"label.action.remove.logical.router": "Remover Roteador L\u00f3gico", +"label.action.remove.network.policy": "Remover Pol\u00edtica de Rede", +"label.action.remove.nic": "Remover NIC", +"label.action.remove.router.table.from.interface": "Remover tabela de rotas Tungsten Fabric da interface", +"label.action.remove.tungsten.routing.policy": "Remover pol\u00edtica de roteamento Tungsten Fabric da Rede", +"label.action.reserve.ip": "Reservar IP P\u00fablico", +"label.action.reset.network.permissions": "Redefinir permiss\u00f5es de Rede", "label.action.reset.password": "Recuperar senha", "label.action.resize.volume": "Redimensionar volume", "label.action.revert.snapshot": "Reverter para snapshot", "label.action.router.health.checks": "Obter resultado das checagens de sa\u00fade", "label.action.run.diagnostics": "Executar diagn\u00f3sticos", "label.action.secure.host": "Propagar certificado de seguran\u00e7a para o host", +"label.action.set.as.source.nat.ip": "Tornar source NAT", +"label.action.setup.2FA.user.auth": "Configurar Autentica\u00e7\u00e3o de Dois Fatores do Usu\u00e1rio", "label.action.start.instance": "Iniciar inst\u00e2ncia", "label.action.start.router": "Iniciar roteador", "label.action.start.systemvm": "Iniciar VM de sistema", +"label.action.start.sharedfs": "Iniciar Sistema de Arquivos Compartilhado", "label.action.stop.instance": "Parar inst\u00e2ncia", "label.action.stop.router": "Parar roteador", +"label.action.stop.sharedfs": "Parar Sistema de Arquivos Compartilhado", "label.action.stop.systemvm": "Parar VM de sistema", "label.action.take.snapshot": "Criar snapshot", "label.action.template.permission": "Atualizar permiss\u00f5es do template", @@ -159,8 +218,15 @@ "label.action.unmanage.instance": "Parar de gerenciar inst\u00e2ncia", "label.action.unmanage.instances": "Parar de gerenciar inst\u00e2ncias", "label.action.unmanage.virtualmachine": "Parar de gerenciar VM", +"label.action.unmanage.volume": "Parar de gerenciar Volume", +"label.action.unmanage.volumes": "Parar de gerenciar Volumes", +"label.action.update.host": "Atualizar host", "label.action.update.offering.access": "Atualizar acesso \u00e0 oferta", +"label.action.update.security.groups": "Atualizar grupos de seguran\u00e7a", "label.action.update.resource.count": "Atualizar contagem de recursos", +"label.action.userdata.reset": "Redefinir Userdata", +"label.action.value": "A\u00e7\u00e3o/Valor", +"label.action.verify.two.factor.authentication": "Autentica\u00e7\u00e3o de dois fatores verificada", "label.action.vmsnapshot.create": "Criar snapshot de VM", "label.action.vmsnapshot.delete": "Remover snapshot de VM", "label.action.vmsnapshot.revert": "Reverter snapshot de VM", @@ -171,10 +237,11 @@ "label.activeviewersessions": "Sess\u00f5es ativas", "label.add": "Adicionar", "label.add.account": "Adicionar conta", -"label.add.acl": "Adicionar ACL", -"label.add.acl.list": "Adiciona lista ACL", +"label.add.acl.rule": "Adicionar ACL", +"label.add.acl": "Adiciona lista ACL", "label.add.affinity.group": "Adicionar um grupo de afinidade", "label.add.baremetal.dhcp.device": "Adicionar dispositivo DHCP baremetal", +"label.add.bgp.peer": "Adicionar par BGP", "label.add.bigswitchbcf.device": "Adicionar controlador BigSwitch BCF", "label.add.brocadevcs.device": "Adicionar switch Brocade Vcs", "label.add.by": "Adicionado por", @@ -182,40 +249,56 @@ "label.add.ciscoasa1000v": "Adicionar recurso CiscoASA1000v", "label.add.cluster": "Adicionar cluster", "label.add.compute.offering": "Adicionar oferta de computa\u00e7\u00e3o", +"label.add.condition": "Adicionar condi\u00e7\u00e3o", "label.add.disk.offering": "Adicionar oferta de disco", "label.add.domain": "Adicionar dom\u00ednio", "label.add.egress.rule": "Adicionar regra de sa\u00edda", "label.add.f5.device": "Adicionar dispositivo F5", "label.add.firewall": "Adicionar regra de firewall", +"label.add.firewallrule": "Adicionar Regra de Firewall", "label.add.guest.network": "Adicionar rede guest", +"label.add.guest.os": "Adicionar SO convidado", +"label.add.guest.os.hypervisor.mapping": "Adicionar mapeamento de hypervisor do Guest OS", +"label.add.gui.theme": "Adicionar tema da GUI", "label.add.host": "Adicionar host", "label.add.ingress.rule": "Adicionar regra de entrada", "label.add.intermediate.certificate": "Adicionar certificado intermedi\u00e1rio", "label.add.internal.lb": "Adicionar LB interno", "label.add.ip.range": "Adicionar intervalo de IPs", +"label.add.ip.v6.prefix": "Adicionar prefixo IPv6", +"label.add.ipv4.subnet": "Adicionar sub-rede IPv4 para redes Roteadas", "label.add.isolated.network": "Adiciona rede isolada", +"label.add.key.value": "Adicionar par de chaves valor", "label.add.kubernetes.cluster": "Adicionar cluster Kubernetes", "label.add.ldap.account": "Adicionar conta LDAP", -"label.add.list.name": "Nome da lista ACL", +"label.add.acl.name": "Nome da lista ACL", + "label.add.logical.router": "Adicionar Roteador L\u00f3gico a esta Rede", "label.add.more": "Adicionar mais", "label.add.netscaler.device": "Adicionar dispositivo Netscaler", "label.add.network": "Adicionar rede", "label.add.network.acl": "Adicione ACL de rede", -"label.add.network.acl.list": "Adicionar lista de ACL de rede", +"label.add.network.acl": "Adicionar lista de ACL de rede", "label.add.network.offering": "Adicionar oferta de rede", +"label.add.network.permission": "Adicionar permiss\u00e3o de Rede", "label.add.new.gateway": "Adicionar novo gateway", "label.add.new.tier": "Adicionar nova camada", "label.add.niciranvp.device": "Adicionar controlador Nvp", "label.add.note": "Adicionar coment\u00e1rio", +"label.add.object.storage" : "Adicionar Object Storage", "label.add.opendaylight.device": "Adiciona controlador OpenDaylight", "label.add.pa.device": "Adicionar dispositivo Palo Alto", +"label.add.param": "Adicionar par\u00c2metro", "label.add.physical.network": "Adicionar rede f\u00edsica", "label.add.pod": "Adicionar pod", +"label.add.policy": "Adicionar pol\u00edtica", +"label.add.prefix": "Adicionar prefixo", "label.add.primary.storage": "Adicionar armazenamento prim\u00e1rio", "label.add.private.gateway": "Adicionar gateway privado", "label.add.resources": "Adicionar recursos", "label.add.role": "Adicionar fun\u00e7\u00e3o", "label.add.route": "Adicionar rota", +"label.add.router.table.to.instance": "Adicionar tabela de roteamento a esta Inst\u00e2ncia", +"label.add.routing.policy": "Adicionar pol\u00edtica de roteamento", "label.add.rule": "Adicionar regra", "label.add.secondary.ip": "Adicionar IP secund\u00e1rio", "label.add.secondary.storage": "Adicionar armazenamento secund\u00e1rio", @@ -224,8 +307,26 @@ "label.add.srx.device": "Adicionar dispositivo SRX", "label.add.static.route": "Adicionar rota est\u00e1tica", "label.add.system.service.offering": "Adicionar oferta de servi\u00e7o para VMs de sistema", +"label.add.term.then": "Adicionar termo", "label.add.traffic": "Adicionar tr\u00e1fego", "label.add.traffic.type": "Adicionar tipo de tr\u00e1fego", +"label.add.tungsten.address.group": "Adicionar Grupo de Endere\u00e7os", +"label.add.tungsten.fabric.route": "Adicionar tabela de roteamento de Rede Tungsten Fabric", +"label.add.tungsten.firewall.policy": "Adicionar Pol\u00edtica de Firewall", +"label.add.tungsten.firewall.rule": "Adicionar Regra de Firewall", +"label.add.tungsten.interface.route": "Adicionar tabela de roteamento de interface Tungsten Fabric", +"label.add.tungsten.interface.static.route": "Adicionar rota est\u00e1tica de interface Tungsten Fabric", +"label.add.tungsten.logical.route": "Adicionar Roteador L\u00f3gico", +"label.add.tungsten.network.static.route": "Adicionar rota est\u00e1tica de Rede Tungsten Fabric", +"label.add.tungsten.policy": "Adicionar Pol\u00edtica", +"label.add.tungsten.policy.set": "Adicionar Conjunto de Pol\u00edticas de Aplica\u00e7\u00e3o", +"label.add.tungsten.router.table": "Adicionar tabela de roteamento a esta Rede", +"label.add.tungsten.routing.policy": "Adicionar pol\u00edtica de roteamento a esta Rede", +"label.add.tungsten.service.group": "Adicionar Grupo de Servi\u00e7os", +"label.add.tungsten.tag": "Adicionar Tag", +"label.add.tungsten.tag.type": "Adicionar Tipo de Tag", +"label.add.upstream.ipv4.routes": "Adicionar roteamento upstream IPv4", +"label.add.upstream.ipv6.routes": "Adicionar roteamento upstream IPv6", "label.add.user": "Adicionar usu\u00e1rio", "label.add.vm": "Adicionar VM", "label.add.vms": "Adicionar VMs", @@ -240,7 +341,9 @@ "label.adding": "Adicionando", "label.adding.user": "Adicionando usu\u00e1rio", "label.address": "Endere\u00e7o", +"label.address.group": "Grupo de endere\u00e7os", "label.admin": "Administrador", +"label.adminsonly": "Vis\u00edvel apenas para administradores", "label.advanced": "Avan\u00e7ado", "label.advanced.mode": "Modo avan\u00e7ado", "label.affinity": "Afinidade", @@ -248,6 +351,7 @@ "label.affinitygroup": "Grupo de afinidade", "label.agent.password": "Senha do agente", "label.agent.username": "Usu\u00e1rio do agente", +"label.agentcount": "N\u00famero de agentes conectados", "label.agentport": "Porta do agente", "label.agentstate": "Estado do agente", "label.agree": "Concordo", @@ -257,46 +361,85 @@ "label.algorithm": "Algoritmo", "label.all": "Todos", "label.all.available.data": "Todos os dados dispon\u00edveis", +"label.all.ipv6": "Todos IPv6", "label.all.zone": "Todas as zonas", "label.allocated": "Alocado", +"label.allocatedonly": "Alocado", "label.allocationstate": "Estado da aloca\u00e7\u00e3o", "label.allow": "Permitir", +"label.allow.duplicate.macaddresses": "Permitir endere\u00e7os MAC duplicados", "label.allowuserdrivenbackups": "Permitir backups manuais pelos usu\u00e1rios", "label.annotation": "Coment\u00e1rio", "label.annotations": "Coment\u00e1rios", "label.annotation.everyone": "Vis\u00edvel a todos", "label.anti.affinity": "Anti-afinidade", "label.anti.affinity.group": "Grupo de anti-afinidade", +"label.api.docs": "Documenta\u00e7\u00c3o da API", +"label.api.docs.description": "Para informa\u00e7\u00f5es sobre como as APIs funcionam e dicas de como us\u00e1-las, clique aqui para ver o Guia do Desenvolvedor", +"label.api.docs.count": "APIs dispon\u00edveis para sua conta", "label.api.version": "Vers\u00e3o da API", "label.apikey": "Chave da API", "label.app.cookie": "AppCookie", "label.app.name": "CloudStack", +"label.application.policy.set": "Conjunto de Pol\u00edticas de Aplica\u00e7\u00e3o", "label.apply": "Aplicar", +"label.apply.tungsten.firewall.policy": "Aplicar Pol\u00edtica de Firewall", +"label.apply.tungsten.network.policy": "Aplicar Pol\u00edtica de Rede", +"label.apply.tungsten.tag": "Aplicar tag", +"label.arch": "Arquitetura", +"label.archived": "Arquivado", "label.archive": "Arquivo", "label.archive.alerts": "Arquivar alertas", "label.archive.events": "Arquivar eventos", "label.as.default": "como padr\u00e3o", +"label.asnumber": "N\u00famero AS", +"label.asnumbers": "N\u00fameros AS", +"label.asnrange": "Faixa AS", "label.assign": "Atribuir", "label.assign.instance.another": "Atribuir inst\u00e2ncia para outra conta", "label.assign.vms": "Atribuir VMs", "label.assigning.vms": "Atribuindo VMs", +"label.associated.resource": "Recurso associado", "label.associatednetwork": "Rede associada", "label.associatednetworkid": "ID de rede associado", "label.associatednetworkname": "Nome da rede", "label.asyncbackup": "Backup ass\u00edncrono", +"label.attaching": "Anexando", +"label.authentication.method": "M\u00e9todo de Autentica\u00e7\u00e3o", +"label.authentication.sshkey": "Chave SSH do Sistema", +"label.autoscale": "AutoScale", +"label.autoscalevmgroupname": "Grupo de AutoScale", "label.author.email": "E-mail do autor", "label.author.name": "Nome do autor", +"label.auto.assign": "Atribuir automaticamente", "label.auto.assign.diskoffering.disk.size": "Atribuir automaticamente a oferta correspondente ao tamanho do disco", "label.auto.assign.random.ip": "Atribuir automaticamente um enderec\u0327o de IP aleat\u00f3rio", +"label.auto.refresh.statistics": "Tempo entre atualiza\u00e7\u00f5es autom\u00e1ticas", +"label.auto.refresh.statistics.none": "Nenhum", +"label.automigrate.volume": "Migrar volume automaticamente para outro pool de armazenamento, se neces\u00e1rio", +"label.autoscale.vm.groups": "Grupos de AutoScale", +"label.autoscale.vm.profile": "Perfil de Inst\u00e2ncia de AutoScale", "label.autoscalingenabled": "Escalonamento autom\u00e1tico", "label.availability": "Disponibilidade", "label.available": "Dispon\u00edvel", +"label.availableprocessors": "N\u00facleos de processador dispon\u00edveis", +"label.availablevirtualmachinecount": "Inst\u00e2ncias Dispon\u00edveis", "label.back": "Voltar", +"label.backup": "Backup", +"label.backups": "Backups", +"label.back.login": "Voltar à página de login", "label.backup": "Backups", "label.backup.attach.restore": "Restaurar e anexar volume de backup", +"label.backuplimit": "Limite de backups", +"label.backup.storage": "Armazenamento de backup", +"label.backupstoragelimit": "Limite de armazenamento de backup (GiB)", +"label.backup.configure.schedule": "Configurar Agendamento de Backup", "label.backup.offering.assign": "Atribuir VM a oferta de backup", "label.backup.offering.remove": "Remover VM de oferta de backup", "label.backup.offerings": "Ofertas de backup", +"label.backup.repository": "Reposit\u00f3rio de Backup", +"label.backup.repository.add": "Adicionar reposit\u00f3rio de backup", +"label.backup.repository.remove": "Remover reposit\u00f3rio de backup", "label.backup.restore": "Restaurar backup da VM", "label.backupofferingid": "Oferta de backup", "label.backupofferingname": "Oferta de backup", @@ -313,6 +456,8 @@ "label.based.on.role.id.or.type": "Criar uma fun\u00e7\u00e3o baseado no ID da fun\u00e7\u00e3o ou no seu tipo", "label.basic": "B\u00e1sico", "label.bcfdeviceid": "ID", +"label.bgp.peers": "Pares BGP", +"label.bgp.peer.set.reservation.desc": "Voc\u00ea pode tornar o par BGP p\u00fablico, ou pode dedic\u00e1-lo/reserv\u00e1-lo para um Dom\u00ednio ou uma Conta", "label.bigswitch.controller.address": "Endere\u00e7o do controlador BigSwitch BCF", "label.bladeid": "ID da l\u00e2mina", "label.blades": "L\u00e2minas", @@ -324,7 +469,13 @@ "label.broadcastdomaintype": "Tipo de dom\u00ednio broadcast", "label.broadcasturi": "URI de broadcast", "label.brocade.vcs.address": "Endere\u00e7o do switch Vcs", +"label.browser": "Navegador", "label.bucket": "Bucket", +"label.bucket.delete": "Excluir Bucket", +"label.bucket.policy": "Pol\u00edtica do Bucket", +"label.bucket.update": "Atualizar Bucket", +"label.bucketlimit": "Limite de Bucket", +"label.buckets": "Buckets", "label.by.account": "por conta", "label.by.domain": "por dom\u00ednio", "label.by.level": "por n\u00edvel", @@ -335,6 +486,9 @@ "label.bypassvlanoverlapcheck": "Ignorar a sobreposi\u00e7\u00e3o de ID/intervalo de VLAN", "label.cachemode": "Tipo do cache de escrita", "label.cancel": "Cancelar", +"label.cancel.host.as.degraded": "Cancelar host como degradado", +"label.cancel.shutdown": "Cancelar Desligamento", +"label.cancelmaintenance": "Cancelar manuten\u00e7\u00e3o", "label.capacity": "Capacidade", "label.capacitybytes": "Capacidade de bytes", "label.capacityiops": "IOPS total", @@ -345,9 +499,13 @@ "label.certificate.upload.failed": "Falha ao carregar certificado", "label.certificate.upload.failed.description": "Falha ao atualizar certificado SSL. Falha na verifica\u00e7\u00e3o do certificado.", "label.certificateid": "ID do certificado", +"label.change": "Alterar", "label.change.affinity": "Mudar afinidade", +"label.change.bgp.peers": "Alterar pares BGP", +"label.change.disk.offering": "Alterar oferta de disco", "label.change.ip.address": "Trocar endere\u00e7o IP", "label.change.ipaddress": "Mudan\u00e7a de endere\u00e7o IP para NIC", +"label.change.offering.for.volume": "Alterar oferta de disco para o volume", "label.change.service.offering": "Alterar oferta de servi\u00e7o", "label.character": "Caracter", "label.checksum": "Checksum", @@ -356,6 +514,7 @@ "label.cidr": "CIDR", "label.cidr.destination.network": "CIDR da rede de destino", "label.cidrlist": "Lista de CIDRs", +"label.cidrsize": "Tamanho do CIDR", "label.cisco.nexus1000v.ip.address": "Endere\u00e7o IP do Nexus 1000v", "label.cisco.nexus1000v.password": "Senha do Nexus 1000v", "label.cisco.nexus1000v.username": "Usu\u00e1rio do Nexus 1000v", @@ -366,42 +525,75 @@ "label.cleanup": "Limpar", "label.clear": "Limpar", "label.clear.list": "Limpar lista", +"label.clear.notification": "Limpar notifica\u00e7\u00e3o", +"label.clientid": "ID do Cliente Provedor", "label.close": "Fechar", +"label.cloud.managed": "Gerenciado pela Nuvem", "label.cloudian.storage": "Armazenamento Cloudian", "label.cluster": "Cluster", "label.cluster.name": "Nome do cluster", "label.cluster.size": "Tamanho do cluster", "label.clusterid": "Cluster", "label.clustername": "Nome do cluster", +"label.clusternamelabel": "Nome do cluster", "label.clusters": "Clusters", "label.clustertype": "Tipo de cluster", "label.clvm": "CLVM", "label.code": "C\u00f3digo", +"label.collectiontime": "Tempo de coleta", +"label.columns": "Colunas", "label.comma.separated.list.description": "Insira uma lista de comandos separados por v\u00edrgulas", +"label.command": "Comando", "label.comments": "Coment\u00e1rios", +"label.commonnames": "Nomes Comuns (CN)", +"label.communities": "Comunidades", "label.community": "Comunidade", "label.complete": "Complete", +"label.compressionstatus": "Estado de compress\u00e3o", "label.compute": "Computa\u00e7\u00e3o", "label.compute.offerings": "Oferta de computa\u00e7\u00e3o", +"label.compute.offering.for.sharedfs.instance": "Oferta de computa\u00e7\u00e3o para Inst\u00e2ncia", +"label.computeonly.offering": "Oferta de disco apenas para computa\u00e7\u00e3o", +"label.computeonly.offering.tooltip": "Op\u00e7\u00e3o para especificar informa\u00e7\u00f5es relacionadas ao disco ROOT na oferta de computa\u00e7\u00e3o ou para vincular diretamente uma oferta de disco \u00e0 oferta de computa\u00e7\u00e3o", +"label.conditions": "Condi\u00e7\u00f5es", "label.configuration": "Configura\u00e7\u00e3o", "label.configure": "Configurar", +"label.configure.app": "Configurar o App", +"label.configure.instance": "Configurar inst\u00e2ncia", +"label.configure.health.monitor": "Configurar Monitor de Sa\u00fade", "label.configure.ldap": "Configurar LDAP", "label.configure.ovs": "Configure Ovs", "label.configure.sticky.policy": "Configurar sticky policy", "label.confirm.delete.egress.firewall.rules": "Por favor, confirme se deseja apagar as regras de firewall de sa\u00edda selecionadas", "label.confirm.delete.firewall.rules": "Por favor, confirme se deseja apagar as regras de firewall selecionadas", +"label.confirm.delete.ip.v6.firewall.rules": "Por favor, confirme que deseja excluir as regras de firewall IPv6 selecionadas", "label.confirm.delete.isos": "Por favor, confirme se deseja apagar as ISOs selecionadas", "label.confirm.delete.loadbalancer.rules": "Por favor, confirme se deseja apagar as regras de balanceamento de carga selecionadas", "label.confirm.delete.portforward.rules": "Por favor, confirme se deseja apagar as regras de encaminhamento de porta selecionadas", +"label.confirm.delete.routing.firewall.rules": "Por favor, confirme que deseja excluir as regras de firewall de Roteamento IPv4 selecionadas", +"label.confirm.delete.snapshot.zones": "Por favor, confirme que deseja excluir o Snapshot nas zonas selecionadas", "label.confirm.delete.templates": "Por favor, confirme se deseja apagar os templates selecionados", +"label.confirm.delete.tungsten.address.group": "Por favor, confirme que deseja excluir este Grupo de Endere\u00e7os", +"label.confirm.delete.tungsten.firewall.policy": "Por favor, confirme que deseja excluir esta Pol\u00edtica de Firewall", +"label.confirm.delete.tungsten.policy": "Por favor, confirme que deseja excluir esta Pol\u00edtica", +"label.confirm.delete.tungsten.policy.set": "Por favor, confirme que deseja excluir este Conjunto de Pol\u00edticas de Aplica\u00e7\u00e3o", +"label.confirm.delete.tungsten.service.group": "Por favor, confirme que deseja excluir este Grupo de Servi\u00e7os", +"label.confirm.delete.tungsten.tag": "Por favor, confirme que deseja excluir esta Tag", +"label.confirm.delete.tungsten.tag.type": "Por favor, confirme que deseja excluir este Tipo de Tag", +"label.confirm.remove.logical.router": "Por favor, confirme que deseja excluir este Roteador L\u00f3gico", "label.confirm.release.public.ip.addresses": "Por favor, confirme se deseja liberar os endere\u00e7os IPs selecionados", +"label.confirm.remove.network.route.table": "Por favor, confirme que deseja excluir esta Tabela de Rotas de Rede", +"label.confirm.remove.route.table": "Por favor, confirme que deseja excluir esta Tabela de Rotas de Interface", "label.confirmacceptinvitation": "Por favor, confirme se deseja participar deste projeto", "label.confirmation": "Confirma\u00e7\u00e3o", "label.confirmdeclineinvitation": "Voc\u00ea tem certeza que quer rejeitar este convite de projeto?", "label.confirmpassword": "Confirme a senha", "label.confirmpassword.description": "Por favor, digite a mesma senha novamente", +"label.connect": "Conectar", "label.connectiontimeout": "Tempo limite de conex\u00e3o", "label.conservemode": "Modo conservativo", +"label.considerlasthost": "Considerar \u00faltimo Host", +"label.consoleproxy": "Console proxy", "label.console.proxy": "Console proxy", "label.console.proxy.vm": "VM da console proxy", "label.continue": "Continuar", @@ -410,13 +602,19 @@ "label.copied.clipboard": "Copiado para a \u00c1rea de transfer\u00eancia", "label.copy": "Copiar", "label.copy.clipboard": "Copiar para \u00c1rea de transfer\u00eancia", +"label.copy.password": "Copiar senha", "label.copyid": "Copiar ID", +"label.core": "Core", +"label.core.zone.type": "Tipo de zona Core", +"label.counter": "Contador", +"label.counter.name": "Nome do contador para o qual a pol\u00edtica ser\u00e1 avaliada", "label.cpu": "CPU", "label.cpu.sockets": "Sockets da CPU", "label.cpu.usage.info": "Informa\u00e7\u00f5es sobre o uso de CPU", "label.cpuallocated": "CPU alocada por VMs", "label.cpuallocatedghz": "Alocado", "label.cpulimit": "Limite de CPU", +"label.cpuload": "% de CPU em uso", "label.cpumaxdeviation": "Desvio", "label.cpunumber": "N\u00facleos da CPU", "label.cpusockets": "O n\u00famero de sockets de CPU", @@ -426,13 +624,17 @@ "label.cpuused": "CPU utilizada", "label.cpuusedghz": "CPU utilizada", "label.create": "Criar", -"label.create.instance": "Criar nova instância", "label.create.account": "Criar conta", +"label.create.asnrange": "Criar faixa de número AS", "label.create.backup": "Iniciar backup", +"label.create.bucket": "Criar Bucket", +"label.create.instance": "Criar inst\u00e2ncia na nuvem", +"label.create.instance.from.backup": "Criar nova inst\u00e2ncia a partir de backup", "label.create.network": "Criar nova rede", "label.create.nfs.secondary.staging.storage": "Criar armazenamento secund\u00e1rio tempor\u00e1rio", "label.create.project": "Criar um projeto", "label.create.project.role": "Criar fun\u00e7\u00e3o para o projeto", +"label.create.routing.policy": "Criar Pol\u00edtica de Roteamento", "label.create.site.vpn.connection": "Criar conex\u00e3o VPN site-to-site", "label.create.site.vpn.gateway": "Criar gateway de VPN site-to-site", "label.create.snapshot.for.volume": "Criar snapshot para volume", @@ -444,11 +646,19 @@ "label.create.tier.name.description": "Um nome \u00fanico para a camada", "label.create.tier.netmask.description": "M\u00e1scara de rede da camada. Por exemplo: 255.255.255.0", "label.create.tier.networkofferingid.description": "A oferta de rede da camada", +"label.create.tungsten.routing.policy": "Criar pol\u00edtica de roteamento Tungsten-Fabric", +"label.create.sharedfs": "Criar Sistema de Arquivos Compartilhado", "label.create.user": "Criar usu\u00e1rio", +"label.create.vm": "Criar Inst\u00e2ncia", +"label.create.vm.and.stay": "Criar Inst\u00e2ncia e permanecer nesta p\u00e1gina", "label.create.vpn.connection": "Criar uma conex\u00e3o VPN", +"label.create.webhook": "Criar Webhook", "label.created": "Criado", +"label.creating": "Criando", "label.creating.iprange": "Criando intervalos de IP", "label.credit": "Cr\u00e9dito", +"label.cron": "Express\u00e3o Cron", +"label.cron.mode": "Modo Cron", "label.crosszones": "Inter zonas", "label.currency": "Moeda", "label.current": "Atual", @@ -463,15 +673,25 @@ "label.dashboard": "Dashboard", "label.data.disk": "Disco de dados", "label.data.disk.offering": "Oferta de disco adicional", +"label.data.pool": "Data pool", +"label.data.pool.description": "\u00c9 necess\u00e1rio informar um data pool ao utilizar um Ceph pool com erasure code", "label.date": "Data", +"label.datetime.filter.period": "De {startDate} at\u00e9 {endDate}", +"label.datetime.filter.starting": "Iniciando {startDate}", +"label.datetime.filter.up.to": "At\u00e9 {endDate}", "label.day": "Dia", "label.day.of.month": "Dia do m\u00eas", "label.day.of.week": "Dia da semana", +"label.db.usage.metrics": "Servidor de BD/Uso", +"label.dbislocal": "O banco de dados roda localmente", "label.dc.name": "Nome do DC", +"label.declare.host.as.degraded": "Declarar host como degradado", "label.decline.invitation": "Rejeitar convite", "label.dedicate": "Dedicado", +"label.dedicate.bgp.peer": "Dedicar par BGP", "label.dedicate.cluster": "Cluster dedicado", "label.dedicate.host": "Dedicar host", +"label.dedicate.ipv4.subnet": "Dedicar sub-rede IPv4", "label.dedicate.pod": "Pod dedicado", "label.dedicate.vlan.vni.range": "Intervalo de VLAN/VNI dedicado", "label.dedicate.zone": "Zona dedicada", @@ -479,19 +699,27 @@ "label.dedicated.vlan.vni.ranges": "Intervalo(s) de VLAN/VNI dedicados", "label.dedicatedresources": "Recursos dedicados", "label.default": "Padr\u00e3o", +"label.default.network.domain.isolated.network": "Dom\u00ednio de rede padr\u00e3o para redes Isoladas", +"label.default.network.guestcidraddress.isolated.network": "CIDR guest padr\u00e3o para Redes Isoladas", +"label.default.project": "Projeto padr\u00e3o", "label.default.use": "Uso padr\u00e3o", "label.default.view": "Visualiza\u00e7\u00e3o padr\u00e3o", "label.defaultnetwork": "Rede padr\u00e3o", "label.delete": "Remover", -"label.delete.acl.list": "Apagar lista ACL", +"label.delete.acl": "Apagar lista ACL", "label.delete.affinity.group": "Apagar grupo de afinidade", "label.delete.alerts": "Remover alertas", +"label.delete.asnrange": "Excluir Faixa AS", +"label.delete.autoscale.vmgroup": "Excluir grupo de auto escalonamento horizontal", "label.delete.backup": "Apagar backup", +"label.delete.backup.schedule": "Remover agendamento de backup", +"label.delete.bgp.peer": "Excluir par BGP", "label.delete.bigswitchbcf": "Remover controlador BigSwitch BCF", "label.delete.brocadevcs": "Remover switch Brocade Vcs", "label.delete.certificate": "Apagar certificado", "label.delete.ciscoasa1000v": "Apagar CiscoASA1000v", "label.delete.ciscovnmc.resource": "Apagar recurso CiscoVNMC", +"label.delete.condition": "Excluir condi\u00e7\u00e3o", "label.delete.dedicated.vlan.range": "Apagar intervalo de VLAN/VNI dedicado", "label.delete.domain": "Apagar dom\u00ednio", "label.delete.events": "Remover eventos", @@ -500,6 +728,8 @@ "label.delete.icon": "Remover \u00edcone", "label.delete.instance.group": "Apagar grupo de inst\u00e2ncias", "label.delete.internal.lb": "Apagar LB interno", +"label.delete.ipv4.subnet": "Excluir sub-rede IPv4", +"label.delete.ip.v6.prefix": "Excluir prefixo IPv6", "label.delete.netscaler": "Remover NetScaler", "label.delete.niciranvp": "Remover controlador Nvp", "label.delete.opendaylight.device": "Apagar controladora OpenDaylight", @@ -513,28 +743,68 @@ "label.delete.snapshot.policy": "Apagar pol\u00edtica de snapshot", "label.delete.srx": "Remover SRX", "label.delete.sslcertificate": "Apagar certificado SSL", +"label.delete.tag": "Remover tag", +"label.delete.term": "Excluir termo", +"label.delete.traffic.type": "Excluir tipo de tr\u00e1fego", +"label.delete.tungsten.address.group": "Excluir Grupo de Endere\u00e7os", +"label.delete.tungsten.fabric.tag": "Excluir Tag", +"label.delete.tungsten.fabric.tag.type": "Excluir Tipo de Tag", +"label.delete.tungsten.firewall.policy": "Excluir Pol\u00edtica de Firewall", +"label.delete.tungsten.policy": "Excluir Pol\u00edtica", +"label.delete.tungsten.policy.set": "Excluir Conjunto de Pol\u00edticas", +"label.delete.tungsten.service.group": "Excluir Grupo de Servi\u00e7os", "label.delete.volumes": "Volumes a serem apagados", "label.delete.vpn.connection": "Remover conex\u00e3o VPN", "label.delete.vpn.customer.gateway": "Remover gateway de VPN de usu\u00e1rio", "label.delete.vpn.gateway": "Remover gateway de VPN", "label.delete.vpn.user": "Apagar usu\u00e1rio VPN", +"label.delete.webhook": "Excluir Webhook", +"label.delete.webhook.delivery": "Excluir Entrega de Webhook", "label.deleteconfirm": "Por favor, confirme que voc\u00ea deseja apagar isto", "label.deleting": "Removendo", "label.deleting.failed": "Falha ao remover", "label.deleting.iso": "Removendo ISO", "label.deleting.template": "Remover template", +"label.deleting.snapshot": "Excluindo Snapshot", +"label.deleteprotection": "Prote\u00e7\u00e3o contra exclus\u00e3o", "label.demote.project.owner": "Rebaixar conta para fun\u00e7\u00e3o regular", "label.demote.project.owner.user": "Rebaixar usu\u00e1rio para fun\u00e7\u00e3o regular", "label.deny": "Negar", "label.deployasis": "Ler configura\u00e7\u00f5es da VM do OVA", "label.deploymentplanner": "Planejador de implanta\u00e7\u00e3o", +"label.desc.db.stats": "Estat\u00edsticas do Banco de Dados", +"label.desc.import.ext.kvm.wizard": "Importar Inst\u00e2ncia de host KVM remoto", +"label.desc.import.local.kvm.wizard": "Importar imagem QCOW2 do Armazenamento Local", +"label.desc.import.shared.kvm.wizard": "Importar imagem QCOW2 do Armazenamento Compartilhado", +"label.desc.import.unmanage.volume": "Importar e parar de gerenciar volume em Pools de Armazenamento", "label.desc.importexportinstancewizard": "Importar e exportar inst\u00e2ncias para/de um cluster VMWare existente", +"label.desc.importmigratefromvmwarewizard": "Importar inst\u00e2ncias do VMware para um cluster KVM", +"label.desc.ingesttinstancewizard": "Ingerir inst\u00e2ncias de um host KVM externo", +"label.desc.usage.stats": "Estat\u00edsticas do Usage Server", "label.description": "Descri\u00e7\u00e3o", +"label.destaddressgroupuuid": "Grupo de Endere\u00e7os de Destino", "label.destcidr": "CIDR de destino", +"label.destendport": "Porta Final de Destino", +"label.desthost": "Host de destino", "label.destination": "Destino", +"label.destination.cluster": "Cluster de Destino", +"label.destination.hypervisor": "Hypervisor de Destino", +"label.destination.pod": "Pod de Destino", +"label.destination.zone": "Zona de Destino", "label.destinationphysicalnetworkid": "ID de destino da rede f\u00edsica", +"label.destinationtype": "Tipo de Destino", +"label.destipprefix": "Endere\u00e7o de Rede de Destino", +"label.destipprefixlen": "Comprimento do Prefixo de Destino", +"label.destnetwork": "Rede de Destino", +"label.destnetworkuuid": "Rede", +"label.destport": "Portas de Destino", "label.destroy": "Apagar", "label.destroy.router": "Destruir roteador", +"label.destroy.sharedfs": "Destruir Sistema de Arquivos Compartilhado", +"label.destroying": "Destruindo", +"label.destroyed": "Destru\u00eddo", +"label.deststartport": "Porta Inicial de Destino", +"label.desttaguuid": "Tag de Destino", "label.details": "Detalhes", "label.deviceid": "ID do dispositivo", "label.devices": "Dispositivos", @@ -542,16 +812,21 @@ "label.direct.attached.public.ip": "IP p\u00fablico conectado diretamente", "label.direct.ips": "IPs diretos", "label.directdownload": "Download direto", +"label.direction": "Dire\u00e7\u00e3o", +"label.disable.autoscale.vmgroup": "Desativar grupo de auto escalonamento horizontal", "label.disable.host": "Desabilitar host", "label.disable.network.offering": "Desabilitar oferta de rede", "label.disable.provider": "Desabilitar provedor", "label.disable.storage": "Desabilitar pool de armazenamento", "label.disable.vpc.offering": "Desabilitar oferta VPC", "label.disable.vpn": "Desabilitar VPN", +"label.disable.webhook": "Desativar Webhook", "label.disabled": "Desativado", "label.disconnected": "\u00daltima desconex\u00e3o", "label.disk": "Disco", "label.disk.offerings": "Ofertas de disco", +"label.disk.path": "Caminho do Disco", +"label.disk.tooltip": "Nome do arquivo de Imagem de Disco no Pool de Armazenamento selecionado", "label.disk.selection": "Sele\u00e7\u00e3o de disco", "label.disk.size": "Tamanho do disco", "label.disk.usage.info": "Informa\u00e7\u00f5es sobre o uso de disco", @@ -576,6 +851,7 @@ "label.disksize": "Tamanho (em GB)", "label.disksizeallocated": "Disco alocado", "label.disksizeallocatedgb": "Alocado", +"label.disksizefree": "Disco livre", "label.disksizetotal": "Disco total", "label.disksizetotalgb": "Total", "label.disksizeunallocatedgb": "N\u00e3o alocado", @@ -597,21 +873,47 @@ "label.domainid": "ID do dom\u00ednio", "label.domainname": "Dom\u00ednio", "label.domainpath": "Dom\u00ednio", +"label.domainrouter": "Roteador Virtual", "label.domains": "Dom\u00ednios", "label.done": "Pronto", +"label.down": "Baixo", "label.download": "Download", +"label.download.csv": "Baixar CSV", "label.download.kubeconfig.cluster": "Baixar kubeconfig para o cluster

    A ferramenta de linha de comando kubectl usa os arquivos kubeconfig para encontrar informa\u00e7\u00f5es necess\u00e1rias para escolher o cluster e se comunicar com o servidor da API do cluster.", "label.download.kubectl": "Baixar a ferramenta kubectl para a vers\u00e3o Kubernetes do cluster", "label.download.kubernetes.cluster.config": "Baixar a configura\u00e7\u00e3o do cluster Kubernetes", "label.download.percent": "Porcentagem do download", +"label.download.setting": "Baixar configura\u00e7\u00e3o", "label.download.state": "Estado do download", "label.dpd": "Detec\u00e7\u00e3o de correspondente morto", "label.driver": "Driver", +"label.drs": "DRS", +"label.drsimbalance": "Desequil\u00edbrio DRS", +"label.drs.generate.plan": "Gerar plano DRS", +"label.drs.no.plan.generated": "Nenhum plano DRS foi gerado pois o cluster n\u00e3o est\u00e1 desequilibrado", +"label.drs.plan": "Plano DRS", +"label.duration": "Dura\u00e7\u00e3o (em segundos)", +"label.duration.custom": "Personalizado", +"label.duration.1hour": "1 hora", +"label.duration.6hours": "6 horas", +"label.duration.12hours": "12 horas", +"label.duration.24hours": "24 horas", +"label.duration.7days": "7 dias", +"label.dynamic": "Din\u00e2mico", "label.dynamicscalingenabled": "Escalonamento din\u00e2mico habilitado", "label.dynamicscalingenabled.tooltip": "VM s\u00f3 pode ser dinamicamente escalonada quando o escalonamento din\u00e2mico estiver habilitado no template, oferta de computa\u00e7\u00e3o e nas configura\u00e7\u00e3oes globais", +"label.diskofferingstrictness": "Rigor da oferta de disco", +"label.disksizestrictness": "Rigor do tamanho do disco", +"label.edge": "Borda", +"label.edge.zone": "Zona de Borda", +"label.enable.autoscale.vmgroup": "Ativar Grupo de AutoScaleAutoScaleAutoScale", "label.edit": "Editar", +"label.edit.acl": "Editar lista ACL", +"label.edit.account": "Editar conta", "label.edit.acl.list": "Editar lista ACL", "label.edit.acl.rule": "Editar regra ACL", +"label.edit.autoscale.vmprofile": "Editar Perfil de Inst\u00e2ncia de AutoScale", +"label.edit.nic": "Editar NIC", "label.edit.project.details": "Editar detalhes do projeto", "label.edit.project.role": "Editar fun\u00e7\u00e3o do projeto", "label.edit.role": "Editar fun\u00e7\u00e3o", @@ -628,11 +930,18 @@ "label.email": "Email", "label.enable.host": "Habilita host", "label.enable.network.offering": "Habilita oferta de rede", +"label.enable.oauth": "Ativar Login OAuth", "label.enable.provider": "Habilitar provedor", "label.enable.storage": "Habilitar pool de armazenamento", "label.enable.vpc.offering": "Habilitar oferta VPC", "label.enable.vpn": "Habilitar VPN", +"label.enable.webhook": "Ativar Webhook", +"label.enabled": "Ativado", +"label.encrypt": "Criptografar", +"label.encryption": "Criptografia", +"label.encryptroot": "Criptografar Disco ROOT", "label.end": "Fim", +"label.endasn": "Fim Como N\u00famero", "label.end.date": "Data de término", "label.end.date.and.time": "Data e hor\u00e1rio final", "label.end.ip": "IP final", @@ -644,7 +953,11 @@ "label.endipv6": "IP final IPv6", "label.endpoint": "Ponto de acesso", "label.endport": "Porta final", +"label.enter.code": "Insira o c\u00f3digo 2FA para verificar", +"label.enter.static.pin": "Insira o PIN est\u00e1tico para verificar", "label.enter.token": "Digite o token", +"label.entityid": "Entidade", +"label.entitytype": "Tipo de Entidade", "label.error": "Erro", "label.error.caught": "Erro detectado", "label.error.code": "C\u00f3digo de erro", @@ -654,10 +967,14 @@ "label.error.setting": "Erro de configura\u00e7\u00e3o", "label.error.something.went.wrong.please.correct.the.following": "Alguma coisa est\u00e1 errada; por favor corrija abaixo", "label.error.upper": "ERRO", +"label.errorinmaintenance": "Erro na manuten\u00e7\u00e3o", "label.espencryption": "Encripta\u00e7\u00e3o ESP", "label.esphash": "Hash ESP", "label.esplifetime": "Tempo de vida do ESP (segundos)", "label.esppolicy": "Pol\u00edtica ESP", +"label.estimatedcost": "Custo estimado", +"label.eventid": "Evento", +"label.eventtype": "Tipo de evento", "label.esx.host": "ESX/ESXi host", "label.event": "Eventos", "label.event.archived": "Evento arquivado", @@ -667,10 +984,21 @@ "label.every": "Cada", "label.example": "Exemplo", "label.example.plugin": "PluginDeExemplo", +"label.execute": "Executar", +"label.existing": "Existente", "label.expunge": "Eliminar", +"label.export.data.csv": "Exportar dados como CSV", +"label.export.details.csv": "Exportar detalhes como CSV", +"label.export.resources.csv": "Exportar recursos como CSV", +"label.export.rules": "Exportar Regras", +"label.expunge.sharedfs": "Expurgar Sistema de Arquivos Compartilhado", +"label.expungevmgraceperiod": "Per\u00edodo de car\u00eancia para expurgar Inst\u00e2ncia (em seg)", "label.expunged": "Eliminado", "label.expunging": "Eliminando", +"label.ext.hostname.tooltip": "Nome do Host Externo ou Endere\u00e7o IP", "label.external.link": "Link externo", +"label.external": "Externo", +"label.external.managed": "Gerenciado Externamente", "label.externalid": "ID externo", "label.externalloadbalanceripaddress": "Endere\u00e7o externo do balanceador de carga", "label.extra": "Argumentos extras", @@ -678,25 +1006,43 @@ "label.f5.ip.loadbalancer": "Balanceador de carga F5 Big Ip", "label.failed": "Falhou", "label.featured": "Em destaque", +"label.fetch.from.backup": "Buscar do backup", +"label.fetch.instances": "Buscar Inst\u00e2ncias", "label.fetch.latest": "Atualizar", +"label.fetched": "Buscado", +"label.filename": "Nome do Arquivo", "label.files": "Alterar arquivos a serem recuperados", +"label.filesystem": "Sistema de Arquivos", "label.filter": "Filtro", "label.filter.annotations.self": "Criado por mim", "label.filter.annotations.all": "Todos os coment\u00e1rios", "label.filterby": "Filtrar por", "label.fingerprint": "Impress\u00e3o digital", +"label.finish": "Finalizar", "label.firewall": "Firewall", +"label.firewall.policy": "Pol\u00edtica de Firewall", +"label.firewallpolicy": "Pol\u00edtica de Firewall", "label.firewallrule": "Regra de firewall", +"label.firewallruleuuid": "Regra de Firewall", "label.firstname": "Primeiro nome", +"label.firstname.lower": "primeiro nome", "label.fix.errors": "Corrija os erros", "label.fixed": "Fixa", "label.for": "para", "label.forbidden": "Proibido", +"label.force.ms.to.import.vm.files": "For\u00e7ar MS a importar arquivo(s) da VM para armazenamento tempor\u00e1rio", +"label.force.reboot": "For\u00e7ar reinicializa\u00e7\u00e3o", +"label.force.stop": "For\u00e7ar parada", "label.forced": "For\u00e7ar", "label.forceencap": "For\u00e7ar encapsulamento UDP de pacotes ESP", "label.forgedtransmits": "Transmiss\u00f5es forjadas", +"label.forgot.password": "Esqueceu a senha?", +"label.fornsx": "NSX", +"label.forvpc": "VPC", +"label.fsprovidername": "Provedor de Sistema de Arquivos Compartilhado", "label.format": "Formato", "label.free": "Livre", +"label.french.azerty.keyboard": "Teclado franc\u00eas AZERTY", "label.friday": "Sexta-feira", "label.from": "de", "label.from.lb": "de LB", @@ -705,6 +1051,7 @@ "label.fwdeviceid": "ID", "label.fwdevicestate": "Estado", "label.gateway": "Gateway", +"label.global": "Global", "label.global.settings": "Configura\u00e7\u00f5es globais", "label.globo.dns": "GloboDNS", "label.globo.dns.configuration": "Configurar GloboDNS", @@ -729,8 +1076,11 @@ "label.guest.ip.range": "Intervalo da rede guest", "label.guest.netmask": "M\u00e1scara da rede guest", "label.guest.networks": "Redes guest", +"label.guest.os": "SO Convidado", +"label.guest.os.hypervisor.mappings": "Mapeamentos de SO convidado", "label.guest.start.ip": "IP de in\u00edcio do guest", "label.guest.traffic": "Tr\u00e1fego da redes guest", +"label.guest.vlan": "VLAN Guest", "label.guestcidraddress": "CIDR da rede guest", "label.guestendip": "IP do fim do guest", "label.guestgateway": "Gateway da rede guest", @@ -750,11 +1100,15 @@ "label.haenable": "HA ativado", "label.haprovider": "Provedor HA", "label.hardware": "Hardware", +"label.hasrules":"Regras de FW definidas", "label.hastate": "Estado do HA", "label.header.backup.schedule": "Voc\u00ea pode definir cronogramas de backup recorrentes selecionando dentre as op\u00e7\u00f5es dispon\u00edveis abaixo e aplicando suas pol\u00edticas preferenciais", "label.header.volume.snapshot": "Voc\u00ea pode configurar snapshots recorrentes selecionando as op\u00e7\u00f5es dispon\u00edveis abaixo e aplicando suas pol\u00edticas preferenciais", "label.header.volume.take.snapshot": "Por favor confirme que voc\u00ea deseja criar uma snapshot para este volume.", +"label.headers": "Cabe\u00e7alhos", "label.health.check": "Checagem de sa\u00fade", +"label.heapmemoryused": "Mem\u00f3ria heap usada", +"label.heapmemorytotal": "Mem\u00f3ria heap dispon\u00edvel", "label.help": "Ajuda", "label.hideipaddressusage": "Ocultar uso do endere\u00e7o IP", "label.home": "In\u00edcio", @@ -762,14 +1116,23 @@ "label.host.alerts": "Hosts em estado de alerta", "label.host.name": "Nome do host", "label.host.tag": "Tag de host", +"label.hostcontrolstate": "Status do Recurso de Computa\u00e7\u00e3o", "label.hostid": "Host", "label.hostname": "Host", +"label.hostname.tooltip": "Host de Destino. O volume deve estar localizado no armazenamento local deste Host", "label.hostnamelabel": "Nome do host", "label.hosts": "Hosts", "label.hosttags": "Tags de host", +"label.hosttags.explicit": "Tags de Host definidas pela API", +"label.hosttags.explicit.abbr": "definido pela api", +"label.hosttags.explicit.description": "As tags de host definidas pelas APIs do CloudStack", +"label.hosttags.implicit": "Tags de Host definidas pelo Agente", +"label.hosttags.implicit.abbr": "definido pelo agente", +"label.hosttags.implicit.description": "As tags de host definidas pelo Agente CloudStack", "label.hourly": "A cada hora", "label.hypervisor": "Virtualizador", "label.hypervisor.capabilities": "Recursos do virtualizador", +"label.hypervisor.default": "Padr\u00e3o do virtualizador", "label.hypervisor.type": "Tipo do virtualizador", "label.hypervisors": "Virtualizadores", "label.hypervisorsnapshotreserve": "Reserva de snapshot do virtualizador", @@ -790,22 +1153,31 @@ "label.ikepolicy": "Pol\u00edtica IKE", "label.ikeversion": "Vers\u00e3o do IKE", "label.images": "Imagens", +"label.imagestoreid": "Armazenamento Secun\u00e1rio", "label.import.backup.offering": "Importar oferta de backup", "label.import.instance": "Importar inst\u00e2ncia", "label.import.offering": "Importar oferta", "label.import.role": "Importar fun\u00e7\u00e3o", +"label.import.volume": "Importar Volume", +"label.inactive": "Inativo", "label.in.progress": "em progresso", "label.in.progress.for": "em progresso para", "label.info": "Info", "label.info.upper": "INFO", "label.infrastructure": "Infraestrutura", +"label.ingest.instance": "Ingerir Inst\u00e2ncia", "label.ingress": "Entrada", "label.ingress.rule": "Regra de entrada", +"label.initial": "Inicial", +"label.initialized": "Inicializado", +"label.interface.route.table": "Tabela de Rotas de Interface", +"label.interface.router.table": "Tabela de Rotas de Interface", "label.insideportprofile": "Perfil de porta interna", "label.installwizard.addzoneintro.title": "Vamos adicionar uma zona", "label.installwizard.subtitle": "Este tour vai auxiliar voc\u00ea na configura\u00e7\u00e3o da sua instala\u00e7\u00e3o do CloudStack™", "label.installwizard.title": "Ol\u00e1, seja bem vindo ao CloudStack™", "label.instance": "Inst\u00e2ncia", +"label.instance.conversion.support": "Convers\u00e3o de Inst\u00e2ncia Suportada", "label.instance.groups": "Grupos de inst\u00e2ncia", "label.instance.name": "Nome da inst\u00e2ncia", "label.instancename": "Nome interno", @@ -821,35 +1193,61 @@ "label.internallb.name.description": "Nome \u00fanico para o LB interno", "label.internallb.sourceip.description": "Descri\u00e7\u00e3o do LB interno", "label.internallbvm": "LbVm interno", +"label.internetprotocol": "Protocolo de internet", +"label.invalid.number": "N\u00famero inv\u00e1lido", +"label.iodriverpolicy" : "Pol\u00edtica de driver de IO", +"label.iodriverpolicy.tooltip" : "A pol\u00edtica de driver de IO pode ser nativa, io_uring ou threads. Escolher a pol\u00edtica de IO para uma Inst\u00e2ncia substituir\u00e1 a op\u00e7\u00e3o do pool de armazenamento 'kvm.storage.pool.io.policy' se definida (apenas se iothreads estiver ativado)", +"label.iops": "IOPS", +"label.iothreadsenabled" : "IOThreads", +"label.iothreadsenabled.tooltip" : "Ativar aloca\u00e7\u00e3o de iothreads para hypervisor KVM", "label.interval": "Intervalo de verifica\u00e7\u00e3o (em seg)", "label.intervaltype": "Tipo de intervalo", "label.introduction.to.cloudstack": "Introdu\u00e7\u00e3o ao CloudStack™", "label.invitations": "Convites", "label.invite": "Convidar", "label.ip": "IP", +"label.ip.addresses": "Endere\u00e7os IP", +"label.ip.range.type": "Tipo de intervalo de IP", "label.ip.range": "Intervalo de IP", "label.ip.ranges": "Intervalos de IP", +"label.ip.v4": "IPv4", +"label.ip.v4.v6": "IPv4 + IPv6 (Pilha Dupla)", +"label.ip.v6": "IPv6", +"label.ip.v6.firewall": "Firewall IPv6", "label.ip4gateway": "Gateway IPV4", "label.ip4netmask": "M\u00e1scara de rede IPv4", +"label.ip4routes": "Rotas IPv6", +"label.ip4routing": "Roteamento IPv4", "label.ip6address": "Endere\u00e7o IPv6", "label.ip6cidr": "CIDR IPv6", "label.ip6dns1": "IPv6 DNS1", "label.ip6dns2": "IPv6 DNS2", "label.ip6gateway": "Gateway IPv6", +"label.ip6firewall": "Firewall IPv6", +"label.ip6routes": "Rotas IPv6", +"label.ip6routing": "Roteamento IPv6", +"label.ipv6.subnets": "Sub-redes IPv6", "label.ipaddress": "Endere\u00e7o IP", "label.iplimit": "Limites de IP p\u00fablico", +"label.ipprefix": "Prefixo IP", +"label.ipprefixlen": "Comprimento do Prefixo IP", "label.ips": "IPs", "label.ipsecpsk": "Chave IPSec pr\u00e9 compartilhada", "label.iptotal": "Total de endere\u00e7os IPs", "label.ipv4.cidr": "CIDR IPv4", "label.ipv4.dns1": "IPv4 DNS1", "label.ipv4.dns2": "IPv4 DNS2", +"label.ipv4.subnet.set.reservation.desc": "(opcional) Por favor, especifique um dom\u00ednio ou uma Conta para ser associada a esta sub-rede IPv4", +"label.ipv4.subnets": "Sub-redes IPv4", "label.ipv6.dns1": "IPv6 DNS1", "label.ipv6.dns2": "IPv6 DNS2", "label.iqn": "Alvo IQN", +"label.is.base64.encoded": "Codificado em Base64", "label.is.in.progress": "est\u00e1 em progresso", "label.is.shared": "\u00c9 compartilhado", +"label.is2faenabled": "2FA est\u00e1 ativado", "label.isadvanced": "Mostra ajustes avan\u00e7ados", +"label.isallocated": "Alocado", "label.iscsi": "iSCSI", "label.iscustomized": "Tamanho customizado", "label.iscustomizeddiskiops": "IOPS personalizado", @@ -857,6 +1255,8 @@ "label.isdedicated": "Dedicado", "label.isdefault": "\u00c9\u0089 padr\u00e3o", "label.isdynamicallyscalable": "Dinamicamente escal\u00e1vel", +"label.isencrypted": "Criptografado", +"label.isuserdefined": "Definido pelo us\u00e1rio", "label.istagarule": "Tag como regra JS", "label.isextractable": "Extra\u00edvel", "label.isfeatured": "Em destaque", @@ -877,6 +1277,7 @@ "label.isoname": "Imagem ISO plugada", "label.isos": "ISOs", "label.isostate": "Estado da ISO", +"label.isourl": "URL da ISO", "label.ispersistent": "Persistente", "label.ispublic": "P\u00fablico", "label.isready": "Pronto", @@ -889,13 +1290,20 @@ "label.items": "itens", "label.items.selected": "item(ns) selecionados", "label.japanese.keyboard": "Teclado japon\u00eas", +"label.javadistribution": "Distribui\u00e7\u00e3o Java Runtime", +"label.javaversion": "Vers\u00e3o Java Runtime", +"label.jsonconfiguration": "Configura\u00e7\u00e3o JSON", "label.keep": "Manter", +"label.kernelversion": "Vers\u00e3o do Kernel", +"label.keep.mac.address.on.public.nic": "Utilizar o mesmo endere\u00e7o MAC para a NIC p\u00fablica dos VRs", "label.key": "Chave", "label.keyboard": "Linguagem do teclado", "label.keyboardtype": "Tipo de teclado", "label.keypair": "Par de chaves SSH", +"label.keypairs": "Par(es) de chaves SSH", "label.kubeconfig.cluster": "Configura\u00e7\u00e3o do cluster Kubernetes", "label.kubernetes": "Kubernetes", +"label.kubernetes.access.details": "Os n\u00f3s Kubernetes podem ser acessados via SSH usando:
    ssh -i [ssh_key] -p [port_number] cloud@[public_ip_address]

    onde,
    ssh_key: aponta para o arquivo de chave privada SSH correspondente \u00e0 chave que foi associada durante a cria\u00e7\u00e3o do cluster Kubernetes. Se nenhuma chave SSH foi fornecida durante a cria\u00e7\u00e3o do cluster, use a chave privada SSH do Management Server.
    port_number: pode ser obtido na Aba de Encaminhamento de Porta (coluna Porta P\u00fablica)", "label.kubernetes.cluster": "Cluster Kubernetes", "label.kubernetes.cluster.create": "Criar cluster Kubernetes", "label.kubernetes.cluster.delete": "Remover cluster Kubernetes", @@ -904,6 +1312,8 @@ "label.kubernetes.cluster.stop": "Parar cluster Kubernetes", "label.kubernetes.cluster.upgrade": "Atualizar cluster Kubernetes", "label.kubernetes.dashboard": "Dashboard da UI do Kubernetes", +"label.kubernetes.dashboard.create.token": "Criar token para dashboard Kubernetes", +"label.kubernetes.dashboard.create.token.desc": "Desde o Kubernetes v1.24.0, n\u00e3o h\u00e1 gera\u00e7\u00e3o autom\u00e1tica de token de conta de servi\u00e7o baseado em segredo por motivo de seguran\u00e7a. Voc\u00ea precisa criar uma conta de servi\u00e7o e um Token Bearer opcional de longa dura\u00e7\u00e3o para a conta de servi\u00e7o", "label.kubernetes.isos": "ISOs Kubernetes", "label.kubernetes.service": "Servi\u00e7o Kubernetes", "label.kubernetes.version.add": "Adicionar vers\u00e3o do Kubernetes", @@ -911,6 +1321,7 @@ "label.kubernetes.version.update": "Gerenciar vers\u00e3o do Kubernetes", "label.kubernetesversionid": "Vers\u00e3o do Kubernetes", "label.kubernetesversionname": "Vers\u00e3o do Kubernetes", +"label.kvm": "KVM", "label.kvmnetworklabel": "Etiqueta de tr\u00e1fego KVM", "label.l2": "L2", "label.l2gatewayserviceuuid": "UUID do servi\u00e7o de gateway L2", @@ -918,11 +1329,18 @@ "label.label": "Etiqueta", "label.last.updated": "\u00daltima atualiza\u00e7\u00e3o", "label.lastannotated": "Data da \u00faltima anota\u00e7\u00e3o", +"label.lastboottime": "Hora de inicializa\u00e7\u00e3o da m\u00e1quina do Management Server", +"label.lastheartbeat": "\u00daltimo heartbeat", "label.lastname": "Sobrenome", "label.lastname.lower": "sobrenome", +"label.lastserverstart": "\u00daltima vez que o Management Server foi inicializado", +"label.lastserverstop": "Hora da \u00faltima parada para este Management Server", +"label.lastsuccessfuljob": "\u00daltimo job bem-sucedido", "label.launch": "Executar", "label.launch.vm": "Executar VM", "label.launch.vm.and.stay": "Iniciar VM e permanecer na p\u00e1gina", +"label.launch.vnf.appliance": "Lan\u00e7ar appliance VNF", +"label.launch.vnf.appliance.and.stay": "Lan\u00e7ar appliance VNF & permanecer nesta p\u00e1gina", "label.launch.zone": "Executar zona.", "label.lb.algorithm.leastconn": "Conex\u00f5es m\u00ednimas", "label.lb.algorithm.roundrobin": "Round-robin", @@ -933,6 +1351,8 @@ "label.lbdevicededicated": "Dedicado", "label.lbdeviceid": "ID", "label.lbdevicestate": "Estado", +"label.lbprovider": "Provedor de balanceador de carga", +"label.lbruleid": "ID do Balanceador de carga", "label.lbtype": "Tipo de balanceamento de carga", "label.ldap.configuration": "Configura\u00e7\u00e3o do LDAP", "label.ldap.group.name": "Grupo LDAP", @@ -941,6 +1361,8 @@ "label.limit": "Limitar", "label.limitcpuuse": "Limite da CPU", "label.limits": "Configurar limites", +"label.limits.configure": "Configurar limites", +"label.link": "Link", "label.link.domain.to.ldap": "Link dom\u00ednio para LDAP", "label.linklocalip": "Endere\u00e7o IP do Control", "label.linux": "Linux", @@ -949,6 +1371,8 @@ "label.list.nodes": "Listar nodos", "label.list.pods": "Listar pods", "label.list.services": "Listar servi\u00e7os", +"label.list.vmware.vcenter.vms": "Listar Inst\u00e2ncias VMware", +"label.livepatch": "Aplicar patch ao vivo no(s) roteador(es) da Rede", "label.load.balancer": "Balanceador de carga", "label.loadbalancerinstance": "VMs designadas", "label.loadbalancerrule": "Regra de balanceamento de carga", @@ -960,18 +1384,23 @@ "label.local.storage.enabled.system.vms": "Habilitar armazenamento local para VMs de sistema", "label.localstorageenabled": "Habilitar armazenamento local para VMs de usu\u00e1rios", "label.localstorageenabledforsystemvm": "Habilitar armazenamento local para VMs de sistema", +"label.locked": "Bloqueado", "label.login": "Entrar", +"label.loginfo": "Informa\u00e7\u00e3o do arquivo de log", "label.login.portal": "Entrar no portal", "label.login.single.signon": "Single Sign-On", "label.logout": "Sair", "label.lun": "LUN", "label.lun.number": "LUN #", +"label.lxc": "LXC", "label.lxcnetworklabel": "R\u00f3tulo de tr\u00e1fego LXC", "label.macaddress": "Endere\u00e7o MAC", "label.macaddress.example": "O endere\u00e7o MAC. Exemplo: 01:23:45:67:89:ab", "label.macaddresschanges": "Mudan\u00e7as no endere\u00e7o MAC", "label.maclearning": "MAC learning", "label.macos": "MacOS", +"label.maintenance": "Manuten\u00e7\u00e3o", +"label.majorsequence": "Sequ\u00eancia Maior", "label.make": "Tornar", "label.make.project.owner": "Criar propriet\u00e1rio de conta de projeto", "label.make.user.project.owner": "Tornar usu\u00e1rio dono do projeto", @@ -979,16 +1408,28 @@ "label.manage": "Gerenciar", "label.manage.vpn.user": "Gerenciar usu\u00e1rios da VPN", "label.managed.instances": "Inst\u00e2ncias gerenciadas", +"label.managed.volumes": "Volumes Gerenciados", +"label.managementserverid": "Management Server", +"label.managementservername": "Management Server", "label.managedstate": "Estados gerenciados", "label.management": "Gerenciamento", "label.management.ips": "Gerenciamento de endere\u00e7os IP", -"label.management.server": "Servidor de gerenciamento", +"label.management.server": "Management Server", "label.management.servers": "Servidores de ger\u00eancia", "label.managementservers": "N\u00famero de servidores de ger\u00eancia", +"label.matchall": "Corresponder a todos", +"label.max": "M\u00e1x.", +"label.max.migrations": "M\u00e1x. de migra\u00e7\u00f5es", +"label.maxbackup": "M\u00e1x. de Backups", +"label.maxbackupstorage": "M\u00e1x. de Armazenamento de Backup (GiB)", +"label.maxbackups.to.retain": "M\u00e1x. de Backups para manter", +"label.maxbucket": "M\u00e1x. de Buckets", +"label.maxmembers": "M\u00e1x de membros", +"label.maxbackups": "Backups M\u00e1x.", "label.max.primary.storage": "M\u00e1x. de armazenamento prim\u00e1rio (GiB)", "label.max.secondary.storage": "M\u00e1x. de armazenamento secund\u00e1rio (GiB)", -"label.maxcpu": "N\u00famerom\u00e1ximo de cores de CPU", -"label.maxcpunumber": "N\u00famerom\u00e1ximo de cores de CPU", +"label.maxcpu": "N\u00famero m\u00e1ximo de cores de CPU", +"label.maxcpunumber": "N\u00famero m\u00e1ximo de n\u00facleos de CPU", "label.maxdatavolumeslimit": "Limite m\u00e1ximo de volume de dados", "label.maxerrorretry": "Limite de tentativas de recupera\u00e7\u00e3o de erro", "label.maxguestslimit": "Limite m\u00e1x. de guest", @@ -996,8 +1437,9 @@ "label.maximum": "M\u00e1ximo", "label.maxinstance": "Inst\u00e2ncias m\u00e1x", "label.maxiops": "M\u00e1x IOPS", -"label.maxmemory": "M\u00e1x. de mem\u00f3ria (MiB)", +"label.maxmemory": "M\u00e1ximo de mem\u00f3ria (MiB)", "label.maxnetwork": "M\u00e1x. de redes", +"label.maxobjectstorage": "M\u00e1x. de Object Storage (GiB)", "label.maxprimarystorage": "M\u00e1x. armazenamento prim\u00e1rio (GiB)", "label.maxproject": "Projetos m\u00e1x.", "label.maxpublicip": "M\u00e1x. IPs P\u00fablicos", @@ -1012,6 +1454,7 @@ "label.mb.memory": "MB de mem\u00f3ria", "label.memory": "Mem\u00f3ria (em MB)", "label.memory.free": "Mem\u00f3ria livre", +"label.memory.maximum.mb": "Mem\u00f3ria m\u00e1x (em MB)", "label.memory.total": "Mem\u00f3ria total", "label.memory.usage.info": "Informa\u00e7\u00f5es sobre o uso de mem\u00f3ria", "label.memory.used": "Mem\u00f3ria usada", @@ -1027,6 +1470,16 @@ "label.memused": "Uso de mem\u00f3ria", "label.menu.security.groups": "Grupos de seguran\u00e7a", "label.menu.service.offerings": "Oferta de servi\u00e7os", +"label.metadata": "Metadados", +"label.metadata.description": "Metadados do Objeto", +"label.metadata.upload.description": "Definir metadados para o objeto", +"label.migrate.instance.single.storage": "Migrar todo(s) o(s) volume(s) da Inst\u00e2ncia para um \u00fanico armazenamento prim\u00e1rio", +"label.migrate.instance.specific.storages": "Migrar volume(s) da Inst\u00e2ncia para armazenamentos prim\u00e1rios espec\u00edficos", +"label.migrate.with.storage": "Migrar com armazenamento", +"label.min_balance": "Saldo m\u00edn", +"label.minimumsemanticversion": "Vers\u00e3o sem\u00e2ntica m\u00ednima", +"label.minmembers": "M\u00edn membros", +"label.minorsequence": "Sequ\u00eancia Menor", "label.metrics": "M\u00e9tricas", "label.migrate.allowed": "Migra\u00e7\u00e3o permitida", "label.migrate.data.from.image.store": "Migrar dados para o armazenamento de imagens", @@ -1039,21 +1492,31 @@ "label.migrating.data": "Migrando dados", "label.min.balance": "Saldo m\u00ednimo", "label.min.past.hour": "minutos passados da \u00faltima hora", -"label.mincpunumber": "N\u00famero m\u00edn de n\u00facleos de CPU", +"label.mincpunumber": "N\u00famero m\u00ednimo de n\u00facleos de CPU", "label.minimum": "M\u00ed\u00adnimo", "label.miniops": "M\u00edn IOPS", "label.minmaxiops": "M\u00edn IOPS /m\u00e1x IOPS", -"label.minmemory": "M\u00edn mem\u00f3ria (em MB)", +"label.minmemory": "M\u00ednimo de mem\u00f3ria (em MB)", "label.minsize": "Tamanho m\u00ednimo", "label.minute.past.hour": "minuto(s) passado(s) da \u00faltima hora", +"label.mode": "Modo", "label.monday": "Segunda", "label.monitor": "Monitor", +"label.monitor.expected.code": "C\u00f3digo de Status HTTP Esperado", +"label.monitor.http.method": "M\u00e9todo HTTP", +"label.monitor.interval": "Intervalo de verifica\u00e7\u00e3o de sa\u00fade (seg)", +"label.monitor.retry": "Contagem de tentativas antes de marcar como inativo", +"label.monitor.timeout": "Timeout (seg)", +"label.monitor.type": "Tipo de Monitor", +"label.monitor.url": "Caminho da URL", "label.monthly": "Mensal", "label.more.access.dashboard.ui": "Mais sobre como acessar a UI da Dashboard", +"label.mount.sharedfs": "Montar Sistema de Arquivos Compartilhado via NFS", "label.move.down.row": "Mover uma c\u00e9lula para baixo", "label.move.to.bottom": "Mover para baixo", "label.move.to.top": "Mover para o topo", "label.move.up.row": "Mover uma c\u00e9lula para cima", +"label.my.isos": "Minhas ISOs", "label.my.templates": "Meus templates", "label.na": "N/D", "label.name": "Nome", @@ -1067,7 +1530,7 @@ "label.netscaler.vpx": "NetScaler VPX LoadBalancer", "label.network": "Rede", "label.network.acl": "ACL de rede", -"label.network.acl.lists": "Lista de redes ACL", +"label.network.acls": "Lista de redes ACL", "label.network.addvm": "Adicionar rede para VM", "label.network.desc": "Descri\u00e7\u00e3o de rede", "label.network.domain": "Dom\u00ednio de rede", @@ -1075,6 +1538,11 @@ "label.network.name": "Nome da rede", "label.network.offering": "Oferta de rede", "label.network.offerings": "Oferta de rede", +"label.network.permissions": "Permiss\u00f5es de rede", +"label.network.policy": "Pol\u00edtica de Rede", +"label.network.restart.required": "Reinicializa\u00e7\u00e3o de rede necess\u00e1ria", +"label.network.route.table": "Tabela de roteamento de rede", +"label.network.routing.policy": "Pol\u00edtica de roteamento de rede", "label.network.selection": "Sele\u00e7\u00e3o da rede", "label.network.service.providers": "Provedores de servi\u00e7os de rede", "label.network.usage.info": "Informa\u00e7\u00f5es sobre o uso de rede", @@ -1084,6 +1552,7 @@ "label.networkkbsread": "Leitura da rede", "label.networkkbswrite": "Escrita da rede", "label.networklimit": "Limites de rede", +"label.networkmode": "Modo de Rede", "label.networkname": "Nome da rede", "label.networkofferingdisplaytext": "Oferta de rede", "label.networkofferingid": "Oferta de rede", @@ -1095,26 +1564,35 @@ "label.networktype": "Tipo de rede", "label.networkwrite": "Escrita da rede", "label.new": "Novo", +"label.new.autoscale.vmgroup": "Novo Grupo de AutoScale", "label.new.instance.group": "Novo grupo de inst\u00e2ncia", "label.new.password": "Nova senha", "label.new.project": "Novo projeto", "label.new.secondaryip.description": "Insira um novo endere\u00e7o IP secund\u00e1rio", "label.new.tag": "Nova etiqueta", +"label.new.version.available": "Nova vers\u00e3o dispon\u00edvel", "label.new.vm": "Nova VM", "label.newdiskoffering": "Nova oferta", "label.newinstance": "Nova inst\u00e2ncia", "label.newname": "Novo nome", "label.next": "Pr\u00f3ximo", "label.nfs": "NFS", +"label.nfsmountopts": "Op\u00e7\u00f5es de montagem NFS", "label.nfsserver": "Servidor NFS", "label.nic": "NIC", "label.nicadaptertype": "Tipo de adaptador de rede", +"label.nicmultiqueuenumber" : "N\u00famero de multiqueues da NIC", +"label.nicmultiqueuenumber.tooltip" : "N\u00famero de multiqueues da NIC. Apenas suportado para KVM. O valor \"-1\" indica que o n\u00famero de multiqueues da NIC ser\u00e1 definido como o n\u00famero de vCPUs da Inst\u00e2ncia.", +"label.nicpackedvirtqueuesenabled" : "Virtqueues empacotadas da NIC ativadas", +"label.nicpackedvirtqueuesenabled.tooltip" : "Ativar ou n\u00e3o virtqueues empacotadas da NIC. Apenas suportado para KVM com QEMU >= 4.2.0 e Libvirt >=6.3.0.", "label.nics": "Adaptadores de rede", "label.no": "N\u00e3o", "label.no.data": "Sem dados para mostrar", "label.no.errors": "Sem erros recentes", "label.no.items": "Sem itens dispon\u00edveis", "label.no.matching.offering": "Nenhuma oferta correspondente encontrada", +"label.no.matching.network": "Nenhuma Rede correspondente encontrada", +"label.no.usage.records": "Nenhum registro de uso encontrado", "label.noderootdisksize": "Tamanho do disco ra\u00edz do nodo (em GB)", "label.nodiskcache": "Sem cache de disco", "label.none": "Nenhum", @@ -1122,14 +1600,38 @@ "label.not.found": "N\u00e3o encontrado", "label.not.suitable": "N\u00e3o apropriado", "label.notifications": "Notifica\u00e7\u00f5es", +"label.nsx": "NSX", +"label.nsx.provider": "Provedor NSX", +"label.nsx.provider.edgecluster": "Cluster de borda do provedor NSX", +"label.nsx.provider.hostname": "Hostname do provedor NSX", +"label.nsx.provider.name": "Nome do provedor NSX", +"label.nsx.provider.password": "Senha do provedor NSX", +"label.nsx.provider.port": "Porta do provedor NSX", +"label.nsx.provider.tier0gateway": "Gateway tier-0 do provedor NSX", +"label.nsx.provider.transportzone": "Zona de transporte do provedor NSX", +"label.nsx.provider.username": "Nome de usu\u00e1rio do provedor NSX", +"label.nsx.supports.internal.lb": "Ativar servi\u00e7o de LB interno NSX", +"label.nsx.supports.lb": "Ativar servi\u00e7o de LB NSX", "label.num.cpu.cores": "# de n\u00facleos da CPU", "label.number": "#Regra", "label.numretries": "N\u00famero de tentativas", "label.nvpdeviceid": "ID", +"label.oauth.configuration": "Configura\u00e7\u00e3o OAuth", +"label.oauth.verification": "Verifica\u00e7\u00e3o OAuth", +"label.object.storage" : "Armazenamento de Objetos (Object Storage)", +"label.object.presigned.url": "URL pr\u00e9-assinada", +"label.object.presigned.url.description" : "URL pr\u00e9-assinada do objeto para acess\u00e1-lo sem autentica\u00e7\u00e3o.", +"label.object.url.description" : "URL do objeto", +"label.objectlocking": "Bloqueio de Objeto", +"label.objectstoragelimit": "Limite de Armazenamento de Objetos (GiB)", +"label.objectstore" : "Armazenamento de Objetos", +"label.objectstore.search" : "Busca baseada em prefixo no diret\u00f3rio atual", +"label.objectstorageid": "Pool de Armazenamento de Objetos", "label.ocfs2": "OCFS2", "label.of": "de(a)", "label.of.month": "do m\u00eas", "label.offerha": "Oferta HA", +"label.offeringid": "ID da Oferta", "label.offeringtype": "Tipo da oferta de computa\u00e7\u00e3o", "label.ok": "OK", "label.only.end.date.and.time": "Apenas data e hor\u00e1rio final", @@ -1141,9 +1643,20 @@ "label.opendaylight.controllers": "Controladores OpenDaylight", "label.operation": "Opera\u00e7\u00e3o", "label.operation.status": "Estado da opera\u00e7\u00e3o", +"label.operator.greater": "Maior que", +"label.operator.greater.or.equal": "Maior ou igual a", +"label.operator.less": "Menor que", +"label.operator.less.or.equal": "Menor ou igual a", +"label.operator.equal": "Igual a", "label.optional": "Opcional", "label.order": "Ordenar", "label.oscategoryid": "Prefer\u00eancia de SO", +"label.oscategoryname": "Nome da categoria do SO", +"label.osdisplayname": "Nome do SO", +"label.osdistribution": "Distribui\u00e7\u00e3o do SO", +"label.osmappingcheckenabled": "Verificar nome do SO com hypervisor", +"label.osname": "Nome do SO", +"label.osnameforhypervisor": "Nome de mapeamento do hypervisor", "label.ostypeid": "Tipo de SO", "label.ostypename": "Tipo de SO", "label.other": "Outro", @@ -1157,9 +1670,11 @@ "label.override.guest.traffic": "Sobrescrever tr\u00e1fego guest", "label.override.public.traffic": "Sobrescrever tr\u00e1fego p\u00fablico", "label.override.rootdisk.size": "Sobrescrever tamanho do disco ra\u00edz", +"label.override.root.diskoffering": "Substituir oferta de disco root", "label.overrideguesttraffic": "Sobrescrever tr\u00e1fego guest", "label.overridepublictraffic": "Sobrescrever tr\u00e1fego p\u00fablico", "label.ovf.properties": "Propriedades vApp", +"label.ovm3": "OVM3", "label.ovm3cluster": "Clustering nativo", "label.ovm3networklabel": "Label de trafego OVM3", "label.ovm3pool": "Pooling nativo", @@ -1173,27 +1688,36 @@ "label.page": "p\u00e1gina", "label.palo.alto.firewall": "Firewall Palo Alto", "label.palp": "Perfil de log Palo Alto", +"label.param.name": "Nome do par\u00e2metro", +"label.param.value": "Valor do par\u00e2metro", "label.params": "Par\u00e2metros", "label.parentdomainname": "Dom\u00ednio pai", "label.parentname": "Pai", +"label.parentsubnet": "Sub-rede Pai", "label.passive": "Passivo", "label.password": "Senha", +"label.password.default": "Senha Padr\u00e3o", "label.password.reset.confirm": "A senha foi recuperada para", +"label.password.tooltip": "A senha para o Host", "label.passwordenabled": "Habilitar troca de senha", "label.path": "Caminho (Path)", "label.patp": "Perfil de amea\u00e7a Palo Alto", "label.pavr": "Roteador virtual", "label.payload": "Payload", +"label.payloadurl": "URL de Payload", "label.pcidevice": "GPU", +"label.pending.jobs": "Jobs pendentes", "label.per.account": "Por conta", "label.per.zone": "Por zona", "label.percentage": "Porcentagem", +"label.performfreshchecks": "Executar novas verifica\u00e7\u00f5es", "label.perfectforwardsecrecy": "Perfect Forward secrecy", "label.perform.fresh.checks": "Realizar novas verifica\u00e7\u00f5es", "label.permission": "Permiss\u00e3o", "label.permissions": "permiss\u00e3o", "label.physical.network": "Rede f\u00edsica", "label.physicalnetworkid": "Rede f\u00edsica", +"label.physicalnetworkname": "Nome da Rede F\u00edsica", "label.physicalsize": "Tamanho f\u00edsico", "label.ping.path": "Caminho do ping", "label.pkcs.private.certificate": "Certificado privado PKCS#8", @@ -1207,6 +1731,8 @@ "label.podid": "Pod", "label.podname": "Nome do pod", "label.pods": "Pods", +"label.policy": "Pol\u00edtica", +"label.policyuuid": "Pol\u00edtica de Rede", "label.port": "Porta", "label.port.range": "Intervalo de porta", "label.portforwarding": "Encaminhamento de porta", @@ -1217,20 +1743,30 @@ "label.powerflex.storage.pool": "Pool de armazenamento", "label.powerstate": "Estado de energia", "label.preferred": "Preferido", +"label.prefix": "Prefixo", +"label.prefix.type": "Tipo de Prefixo", +"label.prepare.for.shutdown": "Preparar para Desligamento", +"label.prepareformaintenance": "Preparar para Manuten\u00e7\u00e3o", "label.presetup": "PreSetup", "label.prev": "Anterior", "label.previous": "Anterior", +"label.primera.url.tooltip": "URL designando o endpoint do array de armazenamento Primera, formatado como: http[s]://HOSTNAME:PORT?cpg=NAME&hostset=NAME[&skipTlsValidation=true][&snapCPG=NAME][&taskWaitTimeoutMs=#][&keyttl=#][&connectTimeoutMs=#] onde valores em [] s\u00e3o opcionais.", +"label.primera.username.tooltip": "O nome de usu\u00e1rio com privil\u00e9gios de edi\u00e7\u00e3o", +"label.flashArray.username.tooltip": "O nome de us\u00e1rio com privil\u00e9gios de edi\u00e7\u00e3o", +"label.flashArray.url.tooltip": "URL designando o endpoint Flash Array, formatado como: http[s]://HOSTNAME:PORT?pod=NAME&hostgroup=NAME[&skipTlsValidation=true][&postCopyWaitMs=#][&keyttl=#][&connectTimeoutMs=#][&apiLoginVersion=#][&apiVersion=#] onde valores em [] s\u00e3o opcionais.", "label.primary": "Prim\u00e1rio", "label.primary.storage": "Armazenamento prim\u00e1rio", "label.primary.storage.allocated": "Armazenamento prim\u00e1rio alocado", "label.primary.storage.used": "Uso do armazenamento prim\u00e1rio", "label.primarystoragelimit": "Limites do armazenamento prim\u00e1rio (GiB)", +"label.primarystoragetotal": "Armazenamento prim\u00e1rio", "label.private.gateway": "Gateway privado", "label.private.interface": "Interface privada", "label.private.registry": "Registro privado", "label.privateinterface": "Interface privada", "label.privateip": "Endere\u00e7o IP privado", "label.privatekey": "Chave privada PKCS#8", +"label.privatemtu": "MTU da Interface Privada", "label.privatenetwork": "Rede privada", "label.privateport": "Porta privada", "label.profilename": "Perfil", @@ -1265,15 +1801,22 @@ "label.public.ips": "IPs P\u00fablicos", "label.public.lb": "LB p\u00fablico", "label.public.traffic": "Tr\u00e1fego p\u00fablico", +"label.public.traffic.nsx": "Tr\u00e1fego P\u00fablico NSX", +"label.publicipid": "ID do endere\u00e7o IP", +"label.publicmtu": "MTU da Interface P\u00fablica", "label.publicinterface": "Interface p\u00fablica", "label.publicip": "Endere\u00e7o IP", "label.publickey": "Chave p\u00fablica", "label.publicnetwork": "Rede p\u00fablica", "label.publicport": "Porta p\u00fablica", +"label.purge.usage.records.error": "Falha ao eliminar registros de uso", +"label.purge.usage.records.success": "Registros de uso eliminados com sucesso", +"label.purgeresources": "Limpar Recursos", "label.purpose": "Prop\u00f3sito", "label.qostype": "Tipo de QoS", "label.quickview": "Visualiza\u00e7\u00e3o r\u00e1pida", "label.quiescevm": "Quiesce VM", +"label.quiettime": "Tempo em espera (em seg)", "label.quota": "Cota", "label.quota.add.credits": "Adicionar cr\u00e9ditos", "label.quota.configuration": "Configura\u00e7\u00e3o da cota", @@ -1286,6 +1829,7 @@ "label.quota.statement.tariff": "Tarifa", "label.quota.summary": "Relat\u00f3rios", "label.quotastate": "Estado da cota", +"label.quota_enforce": "Impor Cota", "label.summary": "Sum\u00e1rio", "label.quota.tariff": "Tarifa", "label.quota.tariff.activationrule": "Regra de ativa\u00e7\u00e3o", @@ -1295,15 +1839,24 @@ "label.quota.total": "Total", "label.quota.type.name": "Tipo de uso", "label.quota.type.unit": "Unidade do uso", +"label.action.update.object.storage" : "Atualizar Object Storage", "label.quota.usage": "Consumo da cota", "label.quota.validate.activation.rule": "Validar regra de ativa\u00e7\u00e3o", "label.quota.value": "Valor", "label.rados.monitor": "Monitor RADOS", +"label.rados.monitor.description": "O(s) monitor(es) RADOS. Se houver v\u00e1rios monitores, eles s\u00e3o separados por v\u00edrgula. Por exemplo, \"192.168.0.1,192.168.0.2,192.168.0.3\", \"mon1, mon2, mon3\". Endere\u00e7os IPv6 devem incluir colchetes, por exemplo, \"[fc00:1234::1],[fc00:1234::2],[fc00:1234::3]\".", "label.rados.pool": "Pool do RADOS", "label.rados.secret": "Segredo RADOS", "label.rados.user": "Usu\u00e1rio RADOS", "label.ram": "RAM", +"label.range.last.1month": "\u00daltimo 1 m\u00eas", +"label.range.last.1week": "\u00daltima 1 semana", +"label.range.last.2week": "\u00daltimas 2 semanas", +"label.range.last.3month": "\u00daltimos 3 meses", +"label.range.today": "Hoje", +"label.range.yesterday": "Ontem", "label.raw.data": "Dados Brutos", +"label.rawusage": "Uso bruto (em horas)", "label.rbd": "RDB", "label.rbdid": "Usu\u00e1rio Ceph", "label.rbdmonitor": "Monitor Ceph", @@ -1315,8 +1868,14 @@ "label.readonly": "Apenas leitura", "label.reason": "Motivo", "label.reboot": "Reiniciar", +"label.recent.deliveries": "Entregas recentes", +"label.recover.sharedfs": "Recuperar Sistema de Arquivos Compartilhado", +"label.recovering": "Recuperando", "label.receivedbytes": "Bytes recebidos", "label.recover.vm": "Recuperar VM", +"label.recursivedomains": "Dom\u00ednios recursivos", +"label.redeliver": "Reentregar", +"label.redirecturi": "URI de Redirecionamento", "label.redirect": "Clique para acessar:", "label.redundantrouter": "Roteador Redundante", "label.redundantrouterstate": "Estado redundante", @@ -1324,41 +1883,61 @@ "label.redundantvpcrouter": "VPC redundante", "label.refresh": "Atualizar", "label.region": "Regi\u00e3o", +"label.register.api.key": "Registrar chave de API", +"label.register.oauth": "Registrar OAuth", +"label.register.user.data": "Registrar dados de usu\u00e1rio", "label.register.template": "Registrar template", "label.reinstall.vm": "Reinstalar VM", "label.reject": "Rejeitar", "label.related": "Relacionado", +"label.relationaloperator": "Operador", "label.release": "Liberar", "label.release.account": "Liberar conta", +"label.release.dedicated.bgp.peer": "Liberar par BGP dedicado", "label.release.dedicated.cluster": "Liberar cluster dedicado", "label.release.dedicated.host": "Liberar host dedicado", +"label.release.dedicated.ipv4.subnet": "Liberar sub-rede IPv4 dedicada", "label.release.dedicated.pod": "LIberar pod dedicado", "label.release.dedicated.zone": "Liberar zona dedicada", "label.releasing.ip": "Liberando IP", +"label.remote.instances": "Inst\u00e2ncias Remotas", "label.remove": "Remover", "label.remove.annotation": "Remover coment\u00e1rio", +"label.remove.bgp.peer": "Remover par BGP", "label.remove.egress.rule": "Remover regra de sa\u00edda", +"label.remove.gui.theme": "Remover tema da GUI", +"label.remove.interface.route.table": "Remover tabela de rotas de interface Tungsten", "label.remove.ip.range": "Remover intervalo de IPs", +"label.remove.ipv4.subnet": "Remover sub-rede IPv4", "label.remove.ldap": "Remover LDAP", +"label.remove.logical.network": "Remover Rede do roteador l\u00f3gico", +"label.remove.logical.router": "Remover roteador l\u00f3gico", "label.remove.network.offering": "Remover oferta de rede", +"label.remove.network.route.table": "Remover tabela de roteamento de Rede Tungsten Fabric", "label.remove.pf": "Remover regra de redirecionamento de porta", +"label.remove.policy": "Remover pol\u00edtica", "label.remove.project.account": "Remover conta de projeto", "label.remove.project.role": "Remover fun\u00e7\u00e3o do projeo", "label.remove.project.user": "Remover usu\u00e1rio do projeto", +"label.remove.routing.policy": "Remover pol\u00edtica de roteamento Tungsten-Fabric", +"label.remove.tungsten.tag": "Remover Tag", +"label.remove.user.data": "Remover Userdata", +"label.removed": "Removido", +"label.removedaccounts": "Contas removidas", "label.remove.rule": "Remover regra", "label.remove.ssh.key.pair": "Remover par de chaves SSH", "label.remove.vm.from.lb": "Remover VM da regra de balanceamento de carga", "label.remove.vmware.datacenter": "Remover datacenter VMware", "label.remove.vpc": "Remover VPC", "label.remove.vpc.offering": "Remover oferta VPC", -"label.removed": "Removido", "label.removing": "Removendo", "label.replace.acl": "Substituir ACL", -"label.replace.acl.list": "Substituir lista ACL", "label.report.bug": "Reportar um problema", +"label.request": "Solicita\u00e7\u00e3o", "label.required": "Obrigat\u00f3rio", "label.requireshvm": "HVM", "label.requiresupgrade": "Requer atualiza\u00e7\u00e3o", +"label.reserved": "Reservado", "label.reserved.system.gateway": "Gateway de sistema reservado", "label.reserved.system.ip": "IP de sistema reservado", "label.reserved.system.netmask": "M\u00e1scara de rede reservada do sistema", @@ -1368,8 +1947,11 @@ "label.reservedsystemnetmask": "M\u00e1scara de rede reservada do sistema", "label.reservedsystemstartip": "In\u00edcio dos IPs reservados para o sistema", "label.reset": "Reiniciar", +"label.reset.config.value": "Redefinir para valor padr\u00e3o", "label.reset.ssh.key.pair": "Recriar par de chaves SSH", "label.reset.to.default": "Reinicializar para o padr\u00e3o", +"label.reset.userdata.on.autoscale.vm.group": "Redefinir Userdata no Grupo de VMs de AutoScale", +"label.reset.userdata.on.vm": "Redefinir Userdata na Inst\u00e2ncia", "label.reset.vpn.connection": "Reiniciar a conex\u00e3o VPN", "label.resource": "Recurso", "label.resource.limit.exceeded": "Limite de recurso excedido", @@ -1378,6 +1960,8 @@ "label.resourcename": "Nome do recurso", "label.resources": "Recursos", "label.resourcestate": "Estado do recurso", +"label.resourcetype": "Tipo de recurso", +"label.response": "Resposta", "label.restart.network": "Reiniciar rede", "label.restart.vpc": "Reiniciar a VPC", "label.restartrequired": "Reiniciar obrigat\u00f3rio", @@ -1385,11 +1969,18 @@ "label.restore.volume.attach": "Restaurar volume e anex\u00e1-lo", "label.review": "Revisar", "label.role": "Fun\u00e7\u00e3o", +"label.roleid": "Fun\u00e7\u00e3o", "label.rolename": "Fun\u00e7\u00e3o", "label.roles": "Fun\u00e7\u00f5es", "label.roletype": "Tipo de fun\u00e7\u00e3o", +"label.rolepermissiontab.searchbar": "Pesquisa de regras", "label.root.certificate": "Certificado ra\u00edz", "label.root.disk.size": "Tamanho do disco ra\u00edz (GB)", +"label.rootdiskcontrollertypekvm": "Controladora do disco ROOT", +"label.rootdisksize": "Tamanho do disco ROOT (GB)", +"label.routenexthop": "Pr\u00f3ximo salto da rota", +"label.routenexthoptype": "Tipo do pr\u00f3ximo salto da rota", +"label.routeprefix": "Prefixo da rota", "label.rootdisk": "Disco ra\u00edz", "label.rootdiskcontrollertype": "Controlador do disco ra\u00edz", "label.router.health.check.last.updated": "\u00daltima atualiza\u00e7\u00e3o", @@ -1399,6 +1990,12 @@ "label.routercount": "Total de roteadores virtuais", "label.routerip": "Endere\u00e7os IPv4 para o roteador dentro da rede compartilhada", "label.routeripv6": "Endere\u00e7os IPv6 para o roteador dentro da rede compartilhada", +"label.router.source.nat.ip": "IP source NAT do roteador", +"label.routing.firewall": "Firewall de Roteamento IPv4", +"label.routing.policy": "Pol\u00edtica de roteamento", +"label.routing.policy.terms": "Termos da pol\u00edtica de roteamento", +"label.routing.policy.terms.then": "Termos da pol\u00edtica de roteamento ent\u00e3o", +"label.routingmode": "Modo de roteamento", "label.resourcegroup": "Grupo de recurso", "label.rule": "Regra", "label.rule.number": "Regra n\u00famero", @@ -1408,6 +2005,7 @@ "label.rules.file.to.import": "Arquivo CSV com as defini\u00e7\u00f5es de regras para importar", "label.run.proxy.locally": "Rodar o proxy localmente", "label.running": "VMs rodando", +"label.running.vms": "Inst\u00e2ncias em Execu\u00e7\u00e3o", "label.s2scustomergatewayid": "ID do gateway do cliente site a site", "label.s2svpngatewayid": "ID do gateway da VPN site a site", "label.s3.access.key": "Chave de acesso", @@ -1428,9 +2026,17 @@ "label.save": "Salvar", "label.save.new.rule": "Salvar nova regra", "label.scale.vm": "Escalar VM", +"label.scaledown.policies": "Pol\u00edticas de ScaleDown", +"label.scaledown.policy": "Pol\u00edtica de ScaleDown", +"label.scaleup.policies": "Pol\u00edticas de ScaleUp", +"label.scaleup.policy": "Pol\u00edtica de ScaleUp", +"label.scaling": "Escalonamento", +"label.schedule.add": "Adicionar agendamento", +"label.schedules": "Agendamentos", "label.schedule": "Programar", "label.scheduled.backups": "Backups programados", "label.scope": "Escopo", +"label.scope.tooltip": "Escopo do Pool de Armazenamento Prim\u00e1rio", "label.search": "Pesquisar", "label.secondary.isolated.vlan.type.isolated": "Isolada", "label.secondary.isolated.vlan.type.promiscuous": "Prom\u00edscuos", @@ -1439,11 +2045,13 @@ "label.secondaryips": "IPs secund\u00e1rios", "label.secondarystoragelimit": "Limites do armazenamento secund\u00e1rio (GiB)", "label.secretkey": "Chave secreta", +"label.secret.key": "Chave secreta", "label.secured": "Protegido", "label.security.groups": "Grupos de seguran\u00e7a", "label.securitygroup": "Grupo de seguran\u00e7a", "label.securitygroupenabled": "Grupo de seguran\u00e7a ativado", "label.securitygroups": "Grupos de seguran\u00e7a", +"label.securitygroupsenabled": "Grupos de seguran\u00e7a ativados", "label.see.more.info.cpu.usage": "Ver mais informa\u00e7\u00f5es sobre o uso de CPU", "label.see.more.info.memory.usage": "Ver mais informa\u00e7\u00f5es sobre o uso de mem\u00f3ria", "label.see.more.info.network.usage": "Ver mais informa\u00e7\u00f5es sobre o uso de rede", @@ -1451,11 +2059,17 @@ "label.see.more.info.shown.charts": "Ver mais informa\u00E7\u00F5es sobre os gr\u00E1ficos mostrados", "label.select": "Selecionar", "label.select-view": "Selecionar visualiza\u00e7\u00e3o", +"label.select.2fa.provider": "Selecione o provedor", "label.select.a.zone": "Selecione uma zona", "label.select.deployment.infrastructure": "Selecione uma infraestrutura de implanta\u00e7\u00e3o", +"label.select.guest.os.type": "Por favor, selecione o tipo de SO convidado", +"label.select.network": "Selecionar Rede", "label.select.period": "Selecionar per\u00edodo", "label.select.project": "Selecionar projeto", "label.select.projects": "Selecionar projetos", +"label.select.ps": "Selecionar armazenamento prim\u00e1rio", +"label.select.root.disk": "Selecione o disco ROOT", +"label.select.source.vcenter.datacenter": "Selecione o Datacenter VMware vCenter de origem", "label.select.tier": "Selecionar camada", "label.select.zones": "Selecionar zonas", "label.selected.storage": "Armazenamento selecionado", @@ -1464,10 +2078,12 @@ "label.semanticversion": "Vers\u00e3o sem\u00e2ntica", "label.sent": "Enviado", "label.sentbytes": "Bytes enviados", +"label.sequence": "Sequ\u00eancia", "label.server": "Servidor", "label.server.certificate": "Certificados do servidor", "label.service.connectivity.distributedroutercapabilitycheckbox": "Roteador distribu\u00eddo", "label.service.connectivity.regionlevelvpccapabilitycheckbox": "VPC a n\u00edvel de regi\u00e3o", +"label.service.group": "Grupo de servi\u00e7os", "label.service.lb.elasticlbcheckbox": "LB el\u00e1stico", "label.service.lb.inlinemodedropdown": "Modo", "label.service.lb.lbisolationdropdown": "Isolamento de LB", @@ -1476,23 +2092,31 @@ "label.service.offering": "Plano", "label.service.staticnat.associatepublicip": "Associa IP p\u00fablico", "label.service.staticnat.elasticipcheckbox": "IP el\u00e1stico", +"label.servicegroupuuid": "Grupo de Servi\u00e7os", +"label.serviceip": "IP de Servi\u00e7o", "label.servicelist": "Servi\u00e7os", "label.serviceofferingid": "Oferta de computa\u00e7\u00e3o", "label.serviceofferingname": "Oferta de computa\u00e7\u00e3o", +"label.sessions": "Sess\u00f5es de cliente ativas", "label.set.default.nic": "Configurar para NIC padr\u00e3o", "label.set.reservation": "Fazer reserva", +"label.set.reservation.account.desc": "Por favor, especifique uma Conta para ser associada a este intervalo de IP", "label.set.reservation.desc": "(opcional) especificar uma conta a ser associada a esta faixa de IP.

    VMs de sistema: habilitar a dedica\u00e7\u00e3o da faixa IP p\u00fablica para SSVM e CPVM, campo de conta desativado. Rigor das reservas definido em 'system.vm.public.ip.reservation.mode.strictness'", +"label.set.reservation.systemvm.desc": "Ativar dedica\u00e7\u00e3o de intervalo de IP p\u00fablico para SSVM e CPVM. Rigor da reserva definido em 'system.vm.public.ip.reservation.mode.strictness'.", "label.setting": "Configura\u00e7\u00e3o", "label.settings": "Configura\u00e7\u00f5es", "label.setup": "Configura\u00e7\u00e3o", -"label.shared": "Compartilhado", -"label.sharedexecutable": "Compartilhado", +"label.shared": "Compartilhado(a)", +"label.shared.filesystems": "Sistemas de Arquivos Compartilhados", +"label.sharedexecutable": "Execut\u00e1veis compartilhados ", "label.sharedmountpoint": "SharedMountPoint", "label.sharedrouterip": "Endere\u00e7os IPv4 para o roteador dentro da rede compartilhada", "label.sharedrouteripv6": "Endere\u00e7os IPv6 para o roteador dentro da rede compartilhada", "label.sharewith": "Compartilhar com", +"label.show.usage.records": "Mostrar registros de uso", "label.showing": "Exibindo", "label.shrinkok": "Encolhimento OK", +"label.shutdown": "Desligar", "label.shutdown.provider": "Desabilitar provider", "label.simplified.chinese.keyboard": "Teclado chin\u00eas simplificado", "label.site.to.site.vpn": "VPN site a site", @@ -1510,19 +2134,35 @@ "label.snapshotlimit": "Limite de snapshots", "label.snapshotmemory": "Snapshot da mem\u00f3ria", "label.snapshots": "Snapshots", +"label.snapshottype": "Tipo de Snapshot", +"label.softwareversion": "Vers\u00e3o do software", "label.sockettimeout": "Tempo limite no socket", +"label.source": "Selecionar Hypervisor de Origem de Importa\u00e7\u00e3o-Exporta\u00e7\u00e3o", "label.source.based": "SourceBased", "label.sourcecidr": "CIDR de origem", "label.sourcecidrlist": "Lista de CIDRs de origem", +"label.sourcehost": "Host de origem", "label.sourceipaddress": "Endere\u00e7o IP de origem", +"label.sourceipaddressnetworkid": "ID da Rede do endere\u00e7o IP de origem", "label.sourcenat": "Source NAT", +"label.sourcenatipaddress": "Endere\u00e7o IP de NAT de origem", "label.sourcenatsupported": "Suporte \u00e0 source NAT", "label.sourcenattype": "Tipo de source NAT suportado", "label.sourceport": "Porta de origem", +"label.sourcetype": "Tipo de origem", +"label.specifyasnumber": "Especificar N\u00famero AS", "label.specifyipranges": "Especifique range de IP", "label.specifyvlan": "Especificar VLAN", "label.splitconnections": "Separar conex\u00f5es", "label.sr.name": "Nome da etiqueta SR", +"label.srcaddressgroupuuid": "Grupo de Endere\u00e7os de Origem", +"label.srcendport": "Porta Final de Origem", +"label.srcipprefix": "Endere\u00e7o de Rede de Origem", +"label.srcipprefixlen": "Comprimento do Prefixo de Origem", +"label.srcnetwork": "Rede de Origem", +"label.srcnetworkuuid": "Rede", +"label.srcstartport": "Porta Inicial de Origem", +"label.srctaguuid": "Tag de Origem", "label.srx": "SRX", "label.srx.firewall": "Juniper SRX firewall", "label.ssh.key.pairs": "Par de chaves SSH", @@ -1531,6 +2171,7 @@ "label.sshkeypairs": "Par de chaves SSH", "label.standard.us.keyboard": "Teclado padr\u00e3o (EUA)", "label.sslcertificates": "Certificados SSL", +"label.sslverification": "Verifica\u00e7\u00e3o SSL", "label.start": "Iniciar", "label.start.date": "Data de in\u00edcio", "label.start.date.and.time": "Data e hor\u00e1rio inicial", @@ -1539,14 +2180,18 @@ "label.start.reserved.system.ip": "In\u00edcio dos IPs reservados para o sistema", "label.start.rolling.maintenance": "Iniciar a manunten\u00e7\u00e3o", "label.start.vm": "Iniciar VM", +"label.startasn": "Iniciar N\u00famero AS", "label.startdate": "Por data (in\u00edcio)", +"label.starting": "Iniciando", "label.startip": "IP do in\u00edcio", "label.startipv4": "IP inicial IPv4", "label.startipv6": "IP inicial IPv6", "label.startport": "Porta de in\u00edcio", "label.startquota": "Valor", "label.state": "Estado", +"label.static": "Est\u00e1tico", "label.static.routes": "Rotas est\u00e1ticas", +"label.staticnat": "NAT Est\u00e1tico", "label.statistics": "Estat\u00edsticas", "label.status": "Estado", "label.step.1": "Passo 1", @@ -1569,6 +2214,8 @@ "label.sticky.tablesize": "Tamanho da tabela", "label.stop": "Parar", "label.stopped": "VMs paradas", +"label.stopped.vms": "Inst\u00e2ncias Paradas", +"label.stopping": "Parando", "label.storage": "Armazenamento", "label.storage.migration.required": "Migra\u00e7\u00e3o de armazenamento necess\u00e1ria", "label.storage.tags": "Tags de armazenamento", @@ -1577,33 +2224,56 @@ "label.storagemotionenabled": "Motion do armazenamento habilitado", "label.storagepolicy": "Pol\u00edtica de armazenamento", "label.storagepool": "Pool de armazenamento", +"label.storagepool.tooltip": "Pool de Armazenamento de Destino. O volume deve estar localizado neste Pool de Armazenamento", "label.storagetags": "Tags de armazenamento", "label.storagetype": "Tipo de armazenamento", +"label.storageip": "Endere\u00e7o IP na rede de armazenamento", "label.strict": "Rigoroso", "label.subdomainaccess": "acesso ao subdom\u00ednio", "label.submit": "Enviar", +"label.subnet": "Sub-rede", "label.succeeded": "Sucedido", "label.success": "Sucesso", +"label.success.migrations": "Migra\u00e7\u00f5es bem-sucedidas", "label.success.set": "Definido com sucesso", "label.success.updated": "Atualizado com sucesso", "label.suitability": "Adequabilidade", "label.suitable": "Adequado", "label.sunday": "Domingo", +"label.supported": "Suportado", "label.supportedservices": "Servi\u00e7os suportados", "label.supportsautoscaling": "Suporte \u00e0 auto-escala", "label.supportsha": "Suporte \u00e0 HA", "label.supportspublicaccess": "Suporte \u00e0 acesso p\u00fablico", "label.supportsstrechedl2subnet": "Suporte \u00e0 Streched L2 Subnet", +"label.supportsvmautoscaling": "Suporta escalonamento autom\u00e1tico", "label.suspend.project": "Suspender projeto", "label.switch.type": "Tipo de switch", "label.sync.storage": "Sincronizar pool do armazenamento", +"label.system.ip.pool": "Pool do Sistema", "label.system.offering": "Ofertas de sistema", "label.system.offerings": "Ofertas de sistema", "label.system.service.offering": "Ofertas de servi\u00e7o de sistema", "label.system.vm": "VM de sistema", "label.system.vms": "VMs de sistema", +"label.systemcycleusage": "Ciclos de usu\u00e1rio, sistema e ociosidade", +"label.systemloadaverages": "M\u00e9dias de carga de 1, 5 e 15 minutos", +"label.systemmemoryfree": "Mem\u00f3ria livre do sistema", +"label.systemmemorytotal": "Mem\u00f3ria total do sistema", +"label.systemmemoryused": "Mem\u00f3ria do sistema usada", +"label.systemmemoryvirtualsize": "Tamanho virtual total do processo", +"label.systemtotalcpucycles": "Capacidade total da CPU para todos os n\u00facleos em MHz", +"label.systemvm": "VM de Sistema", "label.systemvmtype": "Tipo de VM de sistema", +"label.tag": "Tag", "label.tag.key": "Chave", +"label.tag.nsx": "nsx", +"label.tag.systemvm": "systemvm", +"label.tag.type": "Tipo de Tag", +"label.tagged.limits": "Limites marcados", +"label.tagtypeuuid": "Tipo de Tag", +"label.taguuid": "Tag", +"label.taken": "Ocupado", "label.tag.value": "Valor", "label.tagged": "Etiquetado", "label.tags": "Etiquetas", @@ -1623,7 +2293,13 @@ "label.templatename": "Template", "label.templates": "Templates", "label.templatesubject": "Assunto", +"label.templatetag": "Tag", "label.templatetype": "Tipo de template", +"label.templateremoved": "Este template foi removido", +"label.templateversion": "Vers\u00e3o do template", +"label.term.type": "Tipo de termo", +"label.test": "Teste", +"label.test.webhook.delivery": "Testar Entrega de Webhook", "label.tftpdir": "Diret\u00f3rio raiz do TFTP", "label.theme.alert": "O painel de configura\u00e7\u00e3o \u00e9 apenas vis\u00edvel no ambiente de desenvolvimento, por favor, salve as configura\u00e7\u00f5es para que as mudan\u00e7as tenham efeito.", "label.theme.color": "Cor do tema", @@ -1633,12 +2309,23 @@ "label.theme.page.style.setting": "Defini\u00e7\u00e3o do estilo da p\u00e1gina", "label.theme.project": "Estilo do projeto", "label.theme.project.navigation.setting": "Configura\u00e7\u00e3o de navega\u00e7\u00e3o do projeto", +"label.threadsblockedcount": "Threads Bloqueadas", +"label.threadsdeamoncount": "Threads Daemon", +"label.threadsnewcount": "Novas Threads", +"label.threadsrunnablecount": "Threads Execut\u00e1veis", +"label.threadsterminatedcount": "Threads Terminadas", +"label.threadstotalcount": "Contagem total de Threads", +"label.threadswaitingcount": "Threads Aguardando", +"label.threshold.description": "Valor pelo qual o Contador ser\u00e1 avaliado com o Operador selecionado", +"label.themes": "Temas", "label.threshold": "Limiar", "label.thursday": "Quinta", "label.time": "Tempo", "label.timeout": "Timeout", "label.timeout.in.second ": " Timeout (segundos)", "label.timezone": "Fuso hor\u00e1rio", +"label.tmppath": "Caminho Temp", +"label.tmppath.tooltip": "Caminho tempor\u00e1rio para armazenar imagens de disco no Host Externo antes de copiar para o pool de armazenamento de destino. O padr\u00e3o \u00e9 /tmp", "label.to": "para", "label.token": "Token", "label.token.for.dashboard.login": "Token para o login na Dashboard pode ser obtido atrav\u00e9s do seguinte comando", @@ -1652,34 +2339,82 @@ "label.traffic.types": "Tipos de tr\u00e1fego", "label.traffictype": "Tipo de tr\u00e1fego", "label.transportzoneuuid": "UUID da zona de transporte", +"label.trigger.shutdown": "Acionar Desligamento Seguro", "label.try.again": "Tente novamente", "label.tuesday": "Ter\u00e7a", +"label.2FA": "2FA", +"label.two.factor.authentication": "Autentica\u00e7\u00e3o de Dois Fatores", +"label.two.factor.authentication.secret.key": "Sua chave secreta de autentica\u00e7\u00e3o de dois fatores", +"label.two.factor.authentication.static.pin": "Seu PIN est\u00e1tico de autentica\u00e7\u00e3o de dois fatores", +"label.tungsten.fabric": "Tungsten Fabric", +"label.tungsten.fabric.provider": "Provedor Tungsten Fabric", +"label.tungsten.fabric.routing": "Roteamento Tungsten Fabric", +"label.tungsten.interface.router.table": "Tabela de rotas da interface", +"label.tungsten.logical.router": "Roteador L\u00f3gico", +"label.tungsten.network.router.table": "Tabela de rotas da rede", +"label.tungsten.provider": "Provedor Tungsten", +"label.tungsten.provider.gateway": "Gateway do provedor Tungsten", +"label.tungsten.provider.hostname": "Hostname do provedor Tungsten", +"label.tungsten.provider.introspectport": "Porta de introspec\u00e7\u00e3o do provedor Tungsten", +"label.tungsten.provider.name": "Nome do provedor Tungsten", +"label.tungsten.provider.port": "Porta do provedor Tungsten", +"label.tungsten.provider.vrouterport": "Porta do vrouter do provedor Tungsten", +"label.tungsten.router.table": "Tabela de Roteador", +"label.tungsten.routing.polices": "Pol\u00edticas de roteamento", +"label.tungsten.static.routes": "Rotas Est\u00e1ticas", +"label.tungstengateway": "Gateway", +"label.tungsteninterfaceroutetablename": "Nome", +"label.tungstennetworkroutetablename": "Nome", +"label.tungstenproviderhostname": "Hostname do provedor", +"label.tungstenproviderintrospectport": "Porta de introspec\u00e7\u00e3o do provedor", +"label.tungstenproviderport": "Porta do provedor", +"label.tungstenprovideruuid": "UUID do Provedor", +"label.tungstenprovidervrouterport": "Porta do vrouter do provedor", +"label.tungstenroutingpolicyterm": "Rede", +"label.tungstenvms": "Inst\u00e2ncias", "label.type": "Tipo", "label.type.id": "Tipo do ID", "label.ucs": "UCS", "label.udp": "UDP", +"label.udp6": "UDPv6", +"label.uefi.supported": "UEFI suportado", "label.uk.keyboard": "Teclado do Reino Unido", "label.unauthorized": "N\u00e3o autorizado", "label.unavailable": "Indispon\u00edvel", +"label.undefined": "Indefinido", "label.unit": "Unidade", "label.unknown": "Desconhecido", "label.unlimited": "Ilimitado", +"label.unmanaged": "N\u00e3o gerenciado", "label.unmanage.instance": "N\u00e3o gerenciar inst\u00e2ncia", +"label.unmanage.volume": "Parar de gerenciar Volume", "label.unmanaged.instance": "Inst\u00e2ncia n\u00e3o gerenciada", "label.unmanaged.instances": "Inst\u00e2ncias n\u00e3o gerenciadas", +"label.unmanaged.volumes": "Volumes n\u00e3o gerenciados", "label.untagged": "N\u00e3omarcado", +"label.up": "Cima", +"label.update.autoscale.vmgroup": "Atualizar Grupo de AutoScale", +"label.update.bgp.peer": "Atualizar par BGP", +"label.update.condition": "Atualizar condi\u00e7\u00e3o", +"label.update.ipv4.subnet": "Atualizar sub-rede IPv4", "label.update.instance.group": "Grupo de inst\u00e2ncias de atualiza\u00e7\u00e3o", "label.update.ip.range": "Atualizar intervalo IP", "label.update.network": "Atualizar rede", "label.update.physical.network": "Atualizar rede f\u00edsica", "label.update.project.role": "Atualizar fun\u00e7\u00e3o do projeto", +"label.update.sharedfs": "Atualizar Sistema de Arquivos Compartilhado", "label.update.ssl": " atualizar certificado SSL", "label.update.to": "atualizado para", "label.update.traffic.label": "Atualizar etiquetas de tr\u00e1fego", "label.update.vmware.datacenter": "Atualizar VMware datacenter", +"label.update.webhook": "Atualizar Webhook", +"label.updateinsequence": "Atualizar em sequ\u00eancia", "label.updating": "Atualizando", "label.upgrade.router.newer.template": "Atualize roteador para usar template mais novo", +"label.upgrading": "Atualizando", "label.upload": "Enviar", +"label.upload.description": "Caminho de onde objetos serão enviados", +"label.upload.path": "Caminho de envio", "label.upload.icon": "Carregar \u00cdcone", "label.upload.iso.from.local": "Carregar ISO local", "label.upload.resource.icon": "Carregar \u00cdcone", @@ -1688,18 +2423,46 @@ "label.upload.volume.from.local": "Carregar volume local", "label.upload.volume.from.url": "Carregar volume por URL", "label.url": "URL", +"label.usage": "Uso", +"label.usage.explanation": "Nota: Apenas o Usage Server que possui o job de uso ativo \u00e9 mostrado aqui.", +"label.usage.records.downloading": "Baixando registros de uso", +"label.usage.records.fetch.child.domains": "Buscar registros de uso para dom\u00ednios filhos", +"label.usage.records.generate": "Gerar registros de uso", +"label.usage.records.generate.after": "Os registros de uso ser\u00e3o criados para o per\u00edodo ap\u00f3s ", +"label.usage.records.generate.description": "Se o job de uso agendado n\u00e3o foi executado ou falhou, isso gerar\u00e1 registros (apenas se houver registros a serem gerados)", +"label.usage.records.generated": "Um job foi criado para gerar registros de uso.", +"label.usage.records.purge": "Expurgar registros de uso", +"label.usage.records.purge.alert": "Expurgar registros de uso excluir\u00e1 permanentemente os registros do banco de dados. Dependendo dos dados sendo exclu\u00eddos, isso pode aumentar a carga no banco de dados e pode demorar um pouco. Tem certeza de que deseja continuar?", +"label.usage.records.purge.days": "Expurgar registros com mais de", +"label.usage.records.purge.days.description": "Expurgar registros com mais de o n\u00famero especificado de dias.", +"label.usage.records.usagetype.required": "O tipo de uso \u00e9 obrigat\u00f3rio com o ID do recurso", +"label.usageid": "ID do Recurso", +"label.usageislocal": "Um Usage Server est\u00e1 instalado localmente", +"label.usagename": "Tipo de uso", +"label.usagetypedescription": "Descri\u00e7\u00e3o do uso", "label.usageinterface": "Interface de uso", "label.usagetype": "Tipo", "label.usageunit": "Unidade", "label.use.kubectl.access.cluster": "os arquivos kubectl e kubeconfig para acessar o cluster", "label.use.local.timezone": "Use o fuso hor\u00e1rio local", +"label.userdata.do.append": "Anexar dados do usu\u00e1rio", +"label.userdata.do.override": "Substituir dados do usu\u00e1rio", +"label.userdata.registered": "Dados do usu\u00e1rio armazenados", +"label.userdata.text": "Entrada manual de dados do usu\u00e1rio", +"label.userdatadetails": "Detalhes dos dados do usu\u00e1rio", +"label.userdataid": "ID dos dados do usu\u00e1rio", +"label.userdataname": "Nome dos dados do usu\u00e1rio", +"label.userdataparams": "Par\u00e2metros dos dados do usu\u00e1rio", +"label.userdatapolicy": "Pol\u00edtica de link de dados do usu\u00e1rio", +"label.userdatapolicy.tooltip": "Os dados do usu\u00e1rio vinculados ao Template podem ser substitu\u00eddos pelos dados do usu\u00e1rio fornecidos durante a implanta\u00e7\u00e3o da Inst\u00e2ncia. Selecione a pol\u00edtica de substitui\u00e7\u00e3o conforme necess\u00e1rio.", +"label.username.tooltip": "O Nome de Usu\u00e1rio para o Host", +"label.keep.mac.address.on.public.nic": "Utilizar o mesmo endere\u00e7o MAC para a NIC p\u00fablica dos VRs", "label.used": "Utilizado", "label.usehttps": "Utilize HTTPS", "label.usenewdiskoffering": "Substituir a oferta de disco?", "label.user": "Usu\u00e1rio", "label.user.conflict": "Conflito", -"label.userdata": "Dados de usu\u00e1rio", -"label.userdatal2": "Dados de usu\u00e1rio", +"label.user.data": "Dados de usu\u00e1rio", "label.username": "Nome de usu\u00e1rio", "label.users": "Usu\u00e1rios", "label.usersource": "Tipo de usu\u00e1rio", @@ -1718,7 +2481,9 @@ "label.vcenterpassword": "Senha vCenter", "label.vcenterusername": "Usu\u00e1rio vCenter", "label.vcsdeviceid": "ID", +"label.verify": "Verificar", "label.version": "Vers\u00e3o", +"label.versioning": "Versionamento", "label.versions": "Vers\u00f5es", "label.vgpu": "VGPU", "label.vgputype": "Tipo de vGPU", @@ -1726,11 +2491,14 @@ "label.view.all": "Visualizar tudo", "label.view.console": "Visualizar console", "label.viewing": "Visualizar", +"label.virtualmachine": "Inst\u00e2ncia", +"label.virtualmachinecount": "Contagem de Inst\u00e2ncias", "label.virtual.machine": "M\u00e1quina virtual", "label.virtual.machines": "M\u00e1quinas virtuais", "label.virtual.network": "Rede virtual", "label.virtual.networking": "Rede virtual", "label.virtual.routers": "Roteadores virtuais", +"label.virtual.routers.system.offering": "Oferta de sistema do roteador virtual", "label.virtualmachineid": "ID da VM", "label.virtualmachinename": "Nome da VM", "label.virtualsize": "Tamanho virtual", @@ -1752,18 +2520,59 @@ "label.vmlimit": "Limites de inst\u00e2ncias", "label.vmname": "Nome da VM", "label.vms": "VMs", +"label.vmscheduleactions": "A\u00e7\u00f5es", +"label.vmsnapshotlimit": "Limite de snapshots de VM", "label.vmstate": "Estado da VM", "label.vmtotal": "VMs totais", +"label.vmware": "VMware", "label.vmware.storage.policy": "Pol\u00edtica de armazenamento do VMWare", "label.vmwaredcid": "ID do datacenter VMware", "label.vmwaredcname": "Nome do datacenter VMware", "label.vmwaredcvcenter": "Vcednter do datacenter VMware", "label.vmwarenetworklabel": "Etiqueta de tr\u00e1fego VMware", -"label.vnf.appliance.add": "Adicionar VNF Appliance", "label.vnmc": "VNMC", +"label.vnf.app.action.destroy": "Destruir appliance VNF", +"label.vnf.app.action.edit": "Editar appliance VNF", +"label.vnf.app.action.expunge": "Expurgar appliance VNF", +"label.vnf.app.action.migrate.to.host": "Migrar appliance VNF para outro host", +"label.vnf.app.action.migrate.to.ps": "Migrar appliance VNF para outro armazenamento prim\u00e1rio", +"label.vnf.app.action.reboot": "Reiniciar appliance VNF", +"label.vnf.app.action.recover": "Recuperar appliance VNF", +"label.vnf.app.action.reinstall": "Reinstalar appliance VNF", +"label.vnf.app.action.scale": "Escalonar appliance VNF", +"label.vnf.app.action.start": "Iniciar appliance VNF", +"label.vnf.app.action.stop": "Parar appliance VNF", +"label.vnf.appliance": "Appliance VNF", +"label.vnf.appliance.add": "Adicionar Appliance VNF", +"label.vnf.appliance.access.methods": "Informa\u00e7\u00f5es de acesso de gerenciamento para este appliance VNF", +"label.vnf.appliances": "Appliances VNF", +"label.vnf.cidr.list": "CIDR a partir do qual o acesso \u00e0 interface de Gerenciamento do appliance VNF deve ser permitido", +"label.vnf.cidr.list.tooltip": "a lista CIDR para encaminhar tr\u00e1fego para a interface de gerenciamento VNF. M\u00faltiplas entradas devem ser separadas por um \u00fanico caractere de v\u00edrgula (,). O valor padr\u00e3o \u00e9 0.0.0.0/0.", +"label.vnf.configure.management": "Configurar regras de Firewall e Encaminhamento de Porta para as interfaces de gerenciamento da VNF", +"label.vnf.configure.management.tooltip": "Verdadeiro por padr\u00e3o, regras de grupo de seguran\u00e7a ou de rede (source nat e regras de firewall) ser\u00e3o configuradas para interfaces de gerenciamento VNF. Falso caso contr\u00e1rio. Saiba quais regras s\u00e3o configuradas em http://docs.cloudstack.apache.org/en/latest/adminguide/networking/vnf_templates_appliances.html#deploying-vnf-appliances", +"label.vnf.detail.add": "Adicionar detalhe VNF", +"label.vnf.detail.remove": "Remover detalhe VNF", +"label.vnf.details": "Detalhes VNF", +"label.vnf.nics": "NICs VNF", +"label.vnf.nic.add": "Adicionar NIC VNF", +"label.vnf.nic.delete": "Excluir NIC VNF", +"label.vnf.nic.description": "Descri\u00e7\u00e3o da NIC VNF", +"label.vnf.nic.deviceid": "ID do Dispositivo da NIC VNF. Come\u00e7a com 0. A NIC com deviceid como 0 para o appliance VNF ser\u00e1 a NIC padr\u00e3o.", +"label.vnf.nic.edit": "Editar NIC VNF", +"label.vnf.nic.management": "NIC de Gerenciamento", +"label.vnf.nic.management.description": "Verdadeiro se a NIC VNF for uma interface de gerenciamento. Falso caso contr\u00e1rio", +"label.vnf.nic.mappings": "Mapeamentos de NIC VNF", +"label.vnf.nic.name": "Nome da NIC VNF", +"label.vnf.nic.remove": "Remover NIC VNF", +"label.vnf.nic.required": "Verdadeiro se a NIC VNF for obrigat\u00f3ria. Caso contr\u00e1rio, opcional", +"label.vnf.settings": "Configura\u00e7\u00f5es VNF", +"label.vnf.template.register": "Registrar template VNF", +"label.vnf.templates": "Templates VNF", "label.volgroup": "Grupo de volume", "label.volume": "Disco", "label.volume.empty": "Nenhum volume de dados anexado a esta VM", +"label.volume.encryption.support": "Criptografia de Volume Suportada", +"label.volume.metrics": "M\u00e9tricas de Volume", "label.volume.volumefileupload.description": "Clique ou arraste o arquivo para esta \u00e1rea para carreg\u00e1-lo", "label.volumechecksum": "MD5 checksum", "label.volumechecksum.description": "Utilize o hash que voc\u00ea criou no inicio do procedimento de carregamento de volume", @@ -1775,15 +2584,18 @@ "label.volumename": "Nome do disco", "label.volumes": "Discos", "label.volumetotal": "Disco", +"label.volumetype": "Tipo de Volume", "label.vpc": "VPC", "label.vpc.id": "ID da VPC", "label.vpc.offerings": "Ofertas VPC", "label.vpc.virtual.router": "Roteador virtual VPC", +"label.vpc.restart.required": "Reinicializa\u00e7\u00e3o de VPC necess\u00e1ria", "label.vpcid": "VPC", "label.vpclimit": "Limites VPC", "label.vpcname": "VPC", "label.vpcoffering": "Oferta VPC", "label.vpcofferingid": "Oferta VPC", +"label.vpcs": "VPCs", "label.vpn": "VPN", "label.vpn.connection": "Conex\u00e3o VPN", "label.vpn.gateway": "Gateway de VPN", @@ -1804,20 +2616,26 @@ "label.warn": "Avisar", "label.warn.upper": "AVISO", "label.warning": "Aten\u00e7\u00e3o", +"label.webhook": "Webhook", +"label.webhook.deliveries": "Entregas de Webhook", +"label.webhookname": "Webhook", +"label.webhooks": "Webhooks", "label.wednesday": "Quarta-Feira", "label.weekly": "Semanal", "label.welcome": "Bem-Vindo", "label.what.is.cloudstack": "O que \u00e9 o CloudStack™?", "label.windows": "Windows", "label.with.snapshotid": "com o ID da snapshot", -"label.write": "Escreva", -"label.writeback": "Cache de disco write-back", +"label.write": "Escrita", +"label.writeback": "Write-back", "label.writecachetype": "Tipo do cache de escrita", "label.writeio": "Escrita (IO)", "label.writethrough": "Write-through", "label.xennetworklabel": "Etiqueta de tr\u00e1fego XenServer", +"label.xenserver": "XenServer", "label.xenservertoolsversion61plus": "Vers\u00e3o original do XS \u00e9 6.1+", "label.yes": "Sim", +"label.your.autoscale.vmgroup": "Seu grupo de escalonamento autom\u00e1tico", "label.yourinstance": "Sua inst\u00e2ncia", "label.zone": "Zona", "label.zone.dedicated": "Zona dedicada", @@ -1830,18 +2648,37 @@ "label.zonenamelabel": "Nome da zona", "label.zones": "Zonas", "label.zonewizard.traffictype.storage": "Armazenamento: tr\u00e1fego entre servidores de armazenamento prim\u00e1ria e secund\u00e1ria, tais como templates de m\u00e1quinas virtuais e snapshots", +"label.quotagb": "Cota em GB", +"label.quotagib": "Cota em GiB", "message.acquire.ip.failed": "Falha ao adquirir IP", +"message.action.about.mandate.and.disable.2FA.user.auth": "A autentica\u00e7\u00e3o de dois fatores \u00e9 obrigat\u00f3ria para o usu\u00e1rio. Se for desativada agora, o usu\u00e1rio precisar\u00e1 configurar a autentica\u00e7\u00e3o de dois fatores novamente no pr\u00f3ximo login.

    Por favor, confirme que voc\u00ea deseja desativ\u00e1-la.", "message.action.acquire.ip": "Por favor, confirme que voc\u00ea quer adquirir um novo IP", "message.action.cancel.maintenance": "A manuten\u00e7\u00e3o do seu host foi cancelada com sucesso", "message.action.cancel.maintenance.mode": "Confirme que voc\u00ea deseja cancelar esta manuten\u00e7\u00e3o", "message.action.create.snapshot.from.vmsnapshot": "Por favor, confirme que voc\u00ea quer criar uma snapshot a partir de uma snapshot de VM", +"message.action.delete.asnrange": "Por favor, confirme a faixa AS que voc\u00ea deseja excluir", +"message.action.delete.autoscale.vmgroup": "Por favor, confirme que voc\u00ea deseja excluir este grupo de autoescalonamento.", "message.action.delete.backup.offering": "Por favor, confirme que voc\u00ea quer remover esta oferta de backup", +"message.action.delete.backup.repository": "Por favor, confirme que voc\u00ea deseja excluir este reposit\u00f3rio de backup?", +"message.action.delete.backup.schedule": "Confirme que voc\u00ea deseja remover esse agendamento de backup.", "message.action.delete.cluster": "Confirme que voc\u00ea deseja excluir este host", +"message.action.delete.domain": "Por favor, confirme que voc\u00ea deseja excluir este dom\u00ednio.", "message.action.delete.disk.offering": "Confirme que voc\u00ea deseja excluir esta oferta de disco", +"message.action.delete.external.firewall": "Por favor, confirme que voc\u00ea gostaria de remover este firewall externo. Aviso: Se voc\u00ea planeja adicionar de volta o mesmo firewall externo, deve redefinir os dados de uso no dispositivo.", +"message.action.delete.external.load.balancer": "Por favor, confirme que voc\u00ea gostaria de remover este balanceador de carga externo. Aviso: Se voc\u00ea planeja adicionar de volta o mesmo balanceador de carga externo, deve redefinir os dados de uso no dispositivo.", +"message.action.delete.gui.theme": "Por favor, confirme que voc\u00ea deseja excluir este tema da GUI", +"message.action.delete.guest.os": "Por favor, confirme que voc\u00ea deseja excluir este SO convidado. Entradas definidas pelo sistema n\u00e3o podem ser exclu\u00eddas.", +"message.action.delete.guest.os.hypervisor.mapping": "Por favor, confirme que voc\u00ea deseja excluir este mapeamento de hypervisor do SO convidado. Entradas definidas pelo sistema n\u00e3o podem ser exclu\u00eddas.", +"message.action.delete.ingress.rule": "Por favor, confirme que voc\u00ea deseja excluir esta regra de ingresso.", "message.action.delete.instance.group": "Por favor, confirme que voc\u00ea quer remover o grupo de inst\u00e2ncia", +"message.action.delete.interface.static.route": "Por favor, confirme que voc\u00ea deseja remover esta Rota Est\u00e1tica de interface?", "message.action.delete.iso": "Confirme que voc\u00ea deseja excluir esta ISO", +"message.action.delete.ipv4.subnet": "Por favor, confirme que voc\u00ea deseja excluir esta sub-rede IPv4.", +"message.action.delete.network.static.route": "Por favor, confirme que voc\u00ea deseja remover esta Rota Est\u00e1tica de Rede", "message.action.delete.network": "Confirme que voc\u00ea deseja remover esta rede.", +"message.action.delete.nexusvswitch": "Por favor, confirme que voc\u00ea deseja excluir este nexus 1000v", "message.action.delete.node": "Por favor, confirme que voc\u00ea quer remover este nodo.", +"message.action.delete.oauth.provider": "Por favor, confirme que voc\u00ea deseja excluir o provedor OAuth.", "message.action.delete.physical.network": "Por favor confirme que voc\u00ea deseja deletar esta rede f\u00edsica", "message.action.delete.pod": "Confirme que voc\u00ea deseja remover este pod.", "message.action.delete.secondary.storage": "Confirme que voc\u00ea deseja remover este armazenamento secund\u00e1rio.", @@ -1850,30 +2687,46 @@ "message.action.delete.snapshot": "Confirme que voc\u00ea deseja remover esta snapshot.", "message.action.delete.system.service.offering": "Por favor confirme que voc\u00ea deseja deletar esta oferta de servi\u00e7o de sistema.", "message.action.delete.template": "Confirme que voc\u00ea deseja remover este template.", +"message.action.delete.theme": "Por favor, confirme que voc\u00ea deseja excluir este tema.", +"message.action.delete.tungsten.router.table": "Por favor, confirme que voc\u00ea deseja remover a Tabela de Rotas desta Rede?", "message.action.delete.volume": "Confirme que voc\u00ea deseja remover este disco.", "message.action.delete.vpn.user": "Por favor, confirme que voc\u00ea quer remover o usu\u00e1rio da VPN.", "message.action.delete.zone": "Confirme que voc\u00ea deseja remover esta zona.", "message.action.destroy.instance": "Por favor, confirme que voc\u00ea deseja excluir esta inst\u00e2ncia.", "message.action.destroy.instance.with.backups": "Por favor, confirme que voc\u00ea quer destruir a inst\u00e2ncia. \u00c9 poss\u00edvel que haja backups associados a inst\u00e2ncia no qual n\u00e3o ser\u00e3o removidos.", +"message.action.destroy.sharedfs": "Por favor, confirme que voc\u00ea deseja destruir este Sistema de Arquivos Compartilhado.
    Cuidado: Isso excluir\u00e1 todos os dados do Sistema de Arquivos Compartilhado tamb\u00e9m.", "message.action.destroy.systemvm": "Confirme que voc\u00ea deseja excluir esta VM de sistema.", "message.action.destroy.volume": "Por favor, confirme que voc\u00ea quer destruir este volume.", +"message.action.disable.2FA.user.auth": "Por favor, confirme que voc\u00ea deseja desativar a autentica\u00e7\u00e3o de dois fatores do usu\u00e1rio.", "message.action.disable.cluster": "Confirma a desativa\u00e7\u00e3o do cluster.", +"message.action.disable.disk.offering": "Por favor, confirme que voc\u00ea deseja desativar esta oferta de disco.", "message.action.disable.physical.network": "Por favor confirme que voc\u00ea deseja desabilitar esta rede f\u00edsica.", "message.action.disable.pod": "Confirma a desativa\u00e7\u00e3o do pod.", "message.action.disable.static.nat": "Confirme que voc\u00ea deseja desativar o NAT est\u00e1tico.", +"message.action.disable.service.offering": "Por favor, confirme que voc\u00ea deseja desativar esta oferta de servi\u00e7o.", +"message.action.disable.system.service.offering": "Por favor, confirme que voc\u00ea deseja desativar esta oferta de servi\u00e7o do sistema.", "message.action.disable.zone": "Confirma a desativa\u00e7\u00e3o da zona.", "message.action.download.iso": "Por favor confirme que voc\u00ea deseja baixar esta ISO.", "message.action.download.snapshot": "Por favor confirme que voc\u00ea deseja baixar esta snapshot.", "message.action.download.template": "Por favor confirme que voc\u00ea deseja baixar este template.", +"message.action.edit.nfs.mount.options": "Altera\u00e7\u00f5es nas op\u00e7\u00f5es de montagem NFS s\u00f3 ter\u00e3o efeito ao cancelar o modo de manuten\u00e7\u00e3o, o que far\u00e1 com que o pool de armazenamento seja remontado em todos os hosts KVM com as novas op\u00e7\u00f5es de montagem.", "message.action.enable.cluster": "Confirma a ativa\u00e7\u00e3o do cluster.", +"message.action.enable.disk.offering": "Por favor, confirme que voc\u00ea deseja ativar esta oferta de disco.", +"message.action.enable.service.offering": "Por favor, confirme que voc\u00ea deseja ativar esta oferta de servi\u00e7o.", +"message.action.enable.system.service.offering": "Por favor, confirme que voc\u00ea deseja ativar esta oferta de servi\u00e7o do sistema.", "message.action.enable.physical.network": "Por favor confirme que voc\u00ea deseja habilitar esta rede f\u00edsica.", "message.action.enable.pod": "Confirma a ativa\u00e7\u00e3o do pod.", "message.action.enable.zone": "Confirma a ativa\u00e7\u00e3o da zona.", "message.action.expunge.instance": "Por favor, confirme que voc\u00ea deseja eliminar esta inst\u00e2ncia.", "message.action.expunge.instance.with.backups": "Por favor, confirme que voc\u00ea quer eliminar esta inst\u00e2ncia. \u00c9 poss\u00edvel que haja backups associados a inst\u00e2ncia no qual n\u00e3o ser\u00e3o removidos.", +"message.action.expunge.sharedfs": "Por favor, confirme que voc\u00ea deseja expurgar este Sistema de Arquivos Compartilhado.", "message.action.host.enable.maintenance.mode": "Ativar o modo de manuten\u00e7\u00e3o ir\u00e1 causar o live migration de todas as inst\u00e2ncias hospedadas neste host para o pr\u00f3ximo dispon\u00edvel.", "message.action.instance.reset.password": "Por favor confirme que voc\u00ea deseja alterar a senha de root para est\u00e1 m\u00e1quina virtual.", "message.action.manage.cluster": "Confirma a vincula\u00e7\u00e3o do cluster.", +"message.action.patch.router": "Por favor, confirme que voc\u00ea deseja aplicar um patch ao vivo no roteador.
    Esta opera\u00e7\u00e3o \u00e9 equivalente a atualizar os pacotes do roteador e reiniciar a Rede sem limpeza.", +"message.action.patch.systemvm": "Por favor, confirme que voc\u00ea deseja aplicar um patch na VM de Sistema.", +"message.action.primary.storage.scope.cluster": "Por favor, confirme que voc\u00ea deseja alterar o escopo de zona para o cluster especificado.
    Esta opera\u00e7\u00e3o atualizar\u00e1 o banco de dados e desconectar\u00e1 o pool de armazenamento de todos os hosts que estavam conectados anteriormente ao armazenamento prim\u00e1rio e n\u00e3o fazem parte do cluster especificado.", +"message.action.primary.storage.scope.zone": "Por favor, confirme que voc\u00ea deseja alterar o escopo de cluster para zona.
    Esta opera\u00e7\u00e3o atualizar\u00e1 o banco de dados e conectar\u00e1 o pool de armazenamento a todos os hosts da zona executando o mesmo hypervisor definido no pool de armazenamento.", "message.action.primarystorage.enable.maintenance.mode": "Aviso: colocar o armazenamento prim\u00e1rio em modo de manuten\u00e7\u00e3o ir\u00e1 causar a parada de todas as VMs hospedadas nesta unidade. Deseja continuar?", "message.action.quota.tariff.create.error.namerequired": "Por favor, informe o nome da tarifa.", "message.action.quota.tariff.create.error.usagetyperequired": "Por favor, selecione o tipo da tarifa.", @@ -1882,8 +2735,16 @@ "message.action.reboot.instance": "Por favor, confirme que voc\u00ea deseja reiniciar esta inst\u00e2ncia.", "message.action.reboot.router": "Confirme que voc\ufffd deseja reiniciar este roteador.", "message.action.reboot.systemvm": "Confirme que voc\u00ea deseja reiniciar esta VM de sistema.", +"message.action.recover.sharedfs": "Por favor, confirme que voc\u00ea gostaria de recuperar este Sistema de Arquivos Compartilhado.", "message.action.recover.volume": "Por favor, confirme que voc\u00ea quer recuperar este volume.", +"message.action.release.asnumber": "Por favor, confirme que voc\u00ea deseja liberar este N\u00famero AS.", "message.action.release.ip": "Confirme que voc\u00ea deseja liberar este IP.", +"message.action.release.reserved.ip": "Por favor, confirme que voc\u00ea deseja liberar este IP reservado.", +"message.action.remove.host": "Por favor, confirme que voc\u00ea deseja remover este host.", +"message.action.remove.logical.router": "Por favor, confirme que voc\u00ea deseja remover o Roteador L\u00f3gico?", +"message.action.remove.routing.policy": "Por favor, confirme que voc\u00ea deseja remover a Pol\u00edtica de Roteamento desta Rede", +"message.action.reserve.ip": "Por favor, confirme que voc\u00ea deseja reservar este IP.", +"message.action.restart.sharedfs": "Por favor, confirme que voc\u00ea deseja reiniciar este Sistema de Arquivos Compartilhado. Isso causar\u00e1 um tempo de inatividade para o usu\u00e1rio.
    Reiniciar com limpeza reinicializar\u00e1 a Inst\u00e2ncia do Sistema de Arquivos Compartilhado sem afetar o sistema de arquivos instalado.", "message.action.revert.snapshot": "Por favor, confirme que voc\u00ea deseja reverter o seu volume desta snapshot.", "message.action.router.health.checks": "Resultados das checagens de sa\u00fade ser\u00e3o obtidos do roteador.", "message.action.router.health.checks.disabled.warning": "Por favor, habilite as checagens de sa\u00fade do roteador.", @@ -1894,15 +2755,20 @@ "message.action.settings.warning.vm.running": "Por favor, pare a VM para acessar as configura\u00e7\u00f5es", "message.action.start.instance": "Por favor, confirme que voc\u00ea deseja iniciar esta inst\u00e2ncia.", "message.action.start.router": "Confirme que voc\u00ea deseja inciar este roteador.", +"message.action.start.sharedfs": "Por favor, confirme que voc\u00ea deseja iniciar este Sistema de Arquivos Compartilhado.", "message.action.start.systemvm": "Confirme que voc\u00ea deseja iniciar esta VM de sistema.", "message.action.stop.instance": "Por favor, confirme que voc\u00ea deseja parar esta inst\u00e2ncia.", "message.action.stop.router": "Confirme que voc\ufffd deseja parar este roteador.", +"message.action.stop.sharedfs": "Por favor, confirme que voc\u00ea deseja parar este Sistema de Arquivos Compartilhado.", "message.action.stop.systemvm": "Confirme que voc\u00ea deseja parar esta VM de sistema.", "message.action.unmanage.cluster": "Confirma a desvincula\u00e7\u00e3o do cluster.", "message.action.unmanage.instance": "Por favor, confirme que voc\u00ea deseja parar de gerenciar a inst\u00e2ncia.", "message.action.unmanage.instances": "Por favor, confirme que voc\u00ea deseja parar de gerenciar as inst\u00e2ncias.", "message.action.unmanage.virtualmachine": "Por favor, confirme que voc\u00ea deseja parar de gerenciar a VM.", -"message.action.vmsnapshot.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM.", +"message.action.unmanage.volume": "Por favor, confirme que voc\u00ea deseja parar de gerenciar o Volume.", +"message.action.unmanage.volumes": "Por favor, confirme que voc\u00ea deseja parar de gerenciar os Volumes.", +"message.action.vmsnapshot.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM.
    Saiba que caso a instância execute em um hypervisor KVM, ela será pausada antes da deleç\u00e3o, e continuada após a deleç\u00e3o.", +"message.action.vmsnapshot.disk-only.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM.", "message.activate.project": "Voc\u00ea tem certeza que deseja ativar este projeto?", "message.add.egress.rule.failed": "Falha ao adicionar uma nova regra de sa\u00edda", "message.add.egress.rule.processing": "Adicionando uma nova regra de sa\u00edda...", @@ -1910,14 +2776,29 @@ "message.add.firewall": "Adicionar firewall \u00e0\u00a0 zona.", "message.add.firewall.rule.failed": "Falha ao adicionar uma nova regra de firewall", "message.add.firewall.rule.processing": "Adicionando uma nova regra de firewall...", +"message.add.firewallrule.failed": "Falha ao adicionar Regra de Firewall", "message.add.host": "Especifique os seguintes par\u00e2metros para adicionar um novo host.", +"message.add.host.sshkey": "AVISO: Para adicionar um host com chave SSH, voc\u00ea deve garantir que o host do seu hypervisor foi configurado corretamente.", "message.add.iprange.processing": "Adicionando intervalo IP...", +"message.add.ipv4.subnet.for.guest.network.failed": "Falha ao adicionar sub-rede IPv4 para rede guest", +"message.add.ipv4.subnet.for.guest.network.processing": "Adicionando sub-rede IPv4 para rede guest...", +"message.add.ip.v6.prefix.processing": "Adicionando Prefixo IPv6...", +"message.add.ip.v6.firewall.rule.failed": "Falha ao adicionar regra de firewall IPv6", +"message.add.ip.v6.firewall.rule.processing": "Adicionando regra de firewall IPv6...", +"message.add.ip.v6.firewall.rule.success": "Regra de firewall IPv6 adicionada", +"message.redeliver.webhook.delivery": "Reentregar esta entrega de Webhook", +"message.remove.ip.v6.firewall.rule.failed": "Falha ao remover regra de firewall IPv6", +"message.remove.ip.v6.firewall.rule.processing": "Removendo regra de firewall IPv6...", +"message.remove.ip.v6.firewall.rule.success": "Regra de firewall IPv6 removida", +"message.add.nsx.controller": "Adicionar Provedor NSX", "message.add.network": "Adicionar uma nova rede para a zona: ", "message.add.network.acl.failed": "Falha ao adicionar lista de rede ACL", "message.add.network.acl.processing": "Adicionando lista de rede ACL...", "message.add.network.failed": "Falha ao adicionar rede", "message.add.network.processing": "Adicionando rede...", "message.add.new.gateway.to.vpc": "Favor especificar a informa\u00e7\u00e3o para adicionar um novo gateway a esta VPC.", +"message.add.physical.network.failed": "Falha ao adicionar rede f\u00edsica", +"message.add.physical.network.processing": "Adicionando uma nova rede f\u00edsica...", "message.add.pod": "Adicionar um novo pod para a zona ", "message.add.pod.during.zone.creation": "Cada zona deve conter um ou mais pods e iremos adicionar o primeiro pod agora. Um pod cont\u00e9m hosts e servidores de armazenamento prim\u00e1rio que ser\u00e3o adicionados em uma etapa posterior. Inicialmente, configure um intervalo de endere\u00e7os IP reservados para o tr\u00e1fego de gerenciamento interno do CloudStack. A faixa de IP reservados devem ser \u00fanicos para cada zona na nuvem.", "message.add.port.forward.failed": "Falha ao adicionar nova regra de encaminhamento de porta", @@ -1926,6 +2807,9 @@ "message.add.private.gateway.processing": "Adicionando gateway privado...", "message.add.resource.description": "Adicionar recursos de infraestrutura", "message.add.resource.hint": "Adicionar recursos de infraestrutura - pods, clusters, armazenamentos prim\u00e1rios/secund\u00e1rios.", +"message.add.routing.firewall.rule.failed": "Falha ao adicionar regra de firewall de Roteamento IPv4", +"message.add.routing.firewall.rule.processing": "Adicionando regra de firewall de Roteamento IPv4...", +"message.add.routing.firewall.rule.success": "Regra de firewall de Roteamento IPv4 adicionada", "message.add.rule.failed": "Falha ao adicionar nova regra", "message.add.rule.processing": "Adicionando nova regra do security-group...", "message.add.secondary.ipaddress.processing": "Adicionando endere\u00e7o IP secund\u00e1rio...", @@ -1934,7 +2818,10 @@ "message.add.tag.failed": "Falha ao adicionar nova etiqueta", "message.add.tag.for.networkacl": "Adicionar etiqueta para rede ACL", "message.add.tag.processing": "Adicionando nova etiqueta...", +"message.add.template": "Por favor, insira os seguintes dados para criar o seu novo Template", +"message.add.tungsten.routing.policy.available": "A pol\u00edtica de roteamento Tungsten-Fabric est\u00e1 pronta para iniciar. Por favor, prossiga para a pr\u00f3xima etapa.", "message.add.user.to.project": "Este formul\u00e1rio permitir\u00e1 adicionar usu\u00e1rios espec\u00edficos de uma conta a um projeto.
    Al\u00e9m disso, uma fun\u00e7\u00e3o de projeto pode ser adicionada ao usu\u00e1rio/conta para permitir/n\u00e3o permitir o acesso API em n\u00edvel de projeto.
    Tamb\u00e9m podemos especificar a fun\u00e7\u00e3o com a qual o usu\u00e1rio deve ser adicionado a um projeto - admin/Regular; se n\u00e3o for especificado, o padr\u00e3o \u00e9 'Regular'.", +"message.add.volume": "Por favor, preencha os seguintes dados para adicionar um novo volume.", "message.add.vpn.connection.failed": "Falha ao adicionar conex\u00e3o VPN", "message.add.vpn.connection.processing": "Adicionando conex\u00e3o VPN...", "message.add.vpn.customer.gateway": "Adicionando o gateway da VPN do cliente", @@ -1942,11 +2829,14 @@ "message.add.vpn.gateway": "Favor confirmar que voc\u00ea deseja adicionar um gateway de VPN", "message.add.vpn.gateway.failed": "Falha ao adicionar gateway da VPN", "message.add.vpn.gateway.processing": "Adicionando gateway da VPN...", +"message.added.vpc.offering": "Oferta de VPC adicionada", +"message.adding.firewall.policy": "Adicionando Pol\u00edtica de Firewall", "message.adding.host": "Adicionando host", "message.adding.netscaler.device": "Adicionando dispositivo Nescaler", "message.adding.netscaler.provider": "Adicionando Netscaler provider", "message.advanced.security.group": "Escolha esta op\u00e7\u00e3o se desejar utilizar grupos de seguran\u00e7a para isolamento das VMs guest.", "message.alert.show.all.stats.data": "Isso pode retornar muitos dados dependendo das configura\u00e7\u00f5es de coleta e reten\u00e7\u00e3o de estat\u00edsticas.", +"message.allowed": "Permitido", "message.apply.success": "Aplicado com sucesso", "message.assign.instance.another": "Favor especificar o tipo de conta, dom\u00ednio, nome da conta e rede (opcional) da nova conta.
    Se o NIC padr\u00e3o da VM estiver em uma rede compartilhada, o CloudStack verificar\u00e1 se a rede pode ser usada pela nova conta se voc\u00ea n\u00e3o especificar uma rede.
    Se o NIC padr\u00e3o da VM estiver em uma rede isolada, e a nova conta tiver mais uma rede isolada, voc\u00ea deve especificar uma.", "message.assign.vm.failed": "Falha na designa\u00e7\u00e3o de VM", @@ -1954,28 +2844,54 @@ "message.attach.volume": "Preencha os seguintes dados para conectar o novo disco. Se voc\u00ea est\u00e1 conectando um disco a uma m\u00e1quina virtual Windows, ser\u00e1 necess\u00e1rio reiniciar a inst\u00e2ncia para visualizar o novo disco.", "message.attach.volume.failed": "Falha ao anexar volume", "message.attach.volume.progress": "Anexando volume", +"message.attach.volume.success": "Volume anexado com sucesso \u00e0 inst\u00e2ncia", "message.authorization.failed": "Sess\u00e3o expirada, a verifica\u00e7\u00e3o de autoriza\u00e7\u00e3o falhou", +"message.autoscale.loadbalancer.update": "A regra do balanceador de carga s\u00f3 pode ser atualizada quando o grupo de autoescalonamento estiver DESATIVADO.", +"message.autoscale.policies.update": "As pol\u00edticas de aumento/diminui\u00e7\u00e3o s\u00f3 podem ser atualizadas quando o grupo de autoescalonamento estiver DESATIVADO.", +"message.autoscale.vm.networks": "Por favor, escolha pelo menos uma Rede para as Inst\u00e2ncias no grupo de autoescalonamento. A Rede padr\u00e3o deve ser uma Rede Isolada ou Camada de Rede VPC que suporte AutoScale de Inst\u00e2ncia e tenha regras de balanceamento de carga.", +"message.autoscale.vmprofile.update": "O perfil de Inst\u00e2ncia de AutoScale s\u00f3 pode ser atualizado quando o grupo de autoescalonamento estiver DESATIVADO.", "message.backup.attach.restore": "Favor confirmar que voc\u00ea deseja restaurar e anexar o volume do backup?", "message.backup.create": "Voc\u00ea tem certeza de que quer criar um backup da VM?", "message.backup.offering.remove": "Voc\u00ea tem certeza que quer remover a VM da oferta de backup e excluir a cadeia de backup?", "message.backup.restore": "Por favor, confirme que voc\u00ea deseja restaurar o backup da VM?", +"message.bgp.peers.null": "Por favor note, se nenhum par BGP for selecionado, o VR conectar\u00e1 a
    (1) pares BGP dedicados que o propriet\u00e1rio pode acessar, se o propriet\u00e1rio tiver pares BGP dedicados e a configura\u00e7\u00e3o da conta use.system.bgp.peers estiver definida como false;
    (2) todos os pares BGP que o propriet\u00e1rio pode acessar, caso contr\u00e1rio.
    ", +"message.bucket.delete": "Por favor, confirme que voc\u00ea deseja excluir este Bucket", +"message.cancel.shutdown": "Por favor, confirme que voc\u00ea gostaria de cancelar o desligamento neste Management Server. Ele voltar\u00e1 a aceitar quaisquer novos job Ass\u00edncronos.", "message.certificate.upload.processing": "Carregamento de certificados em andamento", +"message.change.disk.offering.sharedfs.failed": "Falha ao alterar oferta de disco para o Sistema de Arquivos Compartilhado.", +"message.change.disk.offering.sharedfs.processing": "Alterando oferta de disco para o Sistema de Arquivos Compartilhado.", "message.change.offering.confirm": "Por favor, confirme que voc\u00ea deseja mudar a oferta de servi\u00e7o desta inst\u00e2ncia virtual.", +"message.change.offering.for.volume": "Por favor, confirme que voc\u00ea deseja alterar a oferta de disco para o volume", +"message.change.offering.for.volume.failed": "Falha ao alterar oferta para o volume", +"message.change.offering.processing": "Alterando oferta para o volume...", "message.change.password": "Por favor, troque sua senha.", +"message.change.scope.failed": "Falha na altera\u00e7\u00e3o de escopo", +"message.change.scope.processing": "Altera\u00e7\u00e3o de escopo em andamento", +"message.change.service.offering.sharedfs.failed": "Falha ao alterar oferta de servi\u00e7o para o Sistema de Arquivos Compartilhado.", +"message.change.service.offering.sharedfs.processing": "Alterando oferta de servi\u00e7o para o Sistema de Arquivos Compartilhado.", "message.cluster.dedicated": "Cluster dedicado", "message.cluster.dedication.released": "Cluster dedicado liberado", +"message.config.health.monitor.failed": "Configura\u00e7\u00e3o do Monitor de Sa\u00fade falhou", "message.config.sticky.policy.failed": "Falha na configura\u00e7\u00e3o da pol\u00edtica sticky", "message.config.sticky.policy.processing": "Atualizando pol\u00edtica sticky...", +"message.configure.network.ip.and.mac": "Por favor, configure o endere\u00e7o IP e o endere\u00e7o mac das redes, se necess\u00e1rio.", +"message.configure.network.select.default.network": "Por favor, configure o endere\u00e7o IP e o endere\u00e7o mac das redes, se necess\u00e1rio. Por favor, selecione uma rede como a rede padr\u00e3o.", "message.configuring.guest.traffic": "Configurando tr\u00e1fego do guest", +"message.configuring.nsx.public.traffic": "Configurando tr\u00e1fego p\u00fablico NSX", "message.configuring.physical.networks": "Configurando redes f\u00edsicas", "message.configuring.public.traffic": "Configurando tr\u00e1fego p\u00fablico", "message.configuring.storage.traffic": "Configurando tr\u00e1fego de storage", "message.confirm.action.force.reconnect": "Por favor confirme que voc\u00ea deseja for\u00e7ar a reconex\u00e3o com este host.", +"message.confirm.add.router.table.to.instance": "Por favor, confirme que voc\u00ea deseja adicionar a Tabela de Rotas a esta NIC", +"message.confirm.add.routing.policy": "Por favor, confirme que voc\u00ea deseja adicionar a Pol\u00edtica de Roteamento a esta Rede", "message.confirm.archive.selected.alerts": "Por favor confirme que voc\u00ea deseja arquivar os alertas selecionados", "message.confirm.archive.selected.events": "Por favor confirme que voc\u00ea deseja arquivar os eventos selecionados", "message.confirm.attach.disk": "Voc\u00ea tem certeza que deseja conectar este disco?", +"message.confirm.change.disk.offering.for.sharedfs": "Por favor, confirme que voc\u00ea deseja alterar a oferta de disco para o Sistema de Arquivos Compartilhado. Isso pode migrar o volume subjacente para um pool de armazenamento diferente, se necess\u00e1rio.", +"message.confirm.change.offering.for.volume": "Por favor, confirme que voc\u00ea deseja alterar a oferta de disco para o volume", +"message.confirm.change.service.offering.for.sharedfs": "Por favor, confirme que voc\u00ea deseja alterar a oferta de servi\u00e7o para o Sistema de Arquivos Compartilhado.", "message.confirm.configure.ovs": "Voc\u00ea tem certeza de que quer configurar os Ovs?", -"message.confirm.delete.acl.list": "Voc\u00ea tem certeza que deseja apagar esta lista ACL?", +"message.confirm.delete.acl": "Voc\u00ea tem certeza que deseja apagar esta lista ACL?", "message.confirm.delete.bigswitchbcf": "Por favor, confirme que voc\u00ea deseja deletar este controlador BigSwitch BCF", "message.confirm.delete.brocadevcs": "Por favor confirme que voc\u00ea deseja remover o switch Brocade Vcs", "message.confirm.delete.ciscoasa1000v": "Favor confirmar que voc\u00ea deseja apagar este CiscoASA1000v", @@ -1986,42 +2902,66 @@ "message.confirm.delete.niciranvp": "Por favor, confirme que voc\u00ea deseja excluir o controlador Nicira Nvp", "message.confirm.delete.pa": "Por favor, confirme que voc\u00ea deseja remover Palo Alto", "message.confirm.delete.provider": "Por favor, confirme que voc\u00ea deseja excluir este provedor?", +"message.confirm.delete.traffic.type": "Por favor, confirme que voc\u00ea gostaria de excluir o tipo de tr\u00e1fego.", "message.confirm.delete.srx": "Por favor confirme que voc\u00ea deseja remover o SRX", "message.confirm.destroy.router": "Por favor confirme que voc\u00ea gostaria de destruir este roteador", +"message.confirm.disable.autoscale.vmgroup": "Por favor, confirme que voc\u00ea deseja desativar este grupo de autoescalonamento.", "message.confirm.disable.host": "Favor confirmar que voc\u00ea deseja desabilitar este host.", "message.confirm.disable.network.offering": "Voc\u00ea tem certeza que deseja deshabilitar esta oferta de rede?", "message.confirm.disable.provider": "Por favor confirme que voc\u00ea gostaria de desabilitar este provider", "message.confirm.disable.storage": "Por favor, confirme que voc\u00ea deseja desabilitar o pool de armazenamento", "message.confirm.disable.vpc.offering": "Voc\u00ea tem certeza que deseja desabilitar esta oferta de VPC?", +"message.confirm.disable.webhook": "Por favor, confirme que voc\u00ea deseja desativar este webhook.", +"message.confirm.enable.autoscale.vmgroup": "Por favor, confirme que voc\u00ea deseja ativar este grupo de autoescalonamento.", "message.confirm.enable.host": "Por favor confirme que voc\u00ea deseja habilitar este host.", "message.confirm.enable.network.offering": "Voc\u00ea tem certeza que deseja habilitar esta oferta de rede?", "message.confirm.enable.provider": "Por favor confirme que voc\u00ea gostaria de habilitar este provider", "message.confirm.enable.storage": "Por favor, confirme que voc\u00ea deseja hablitar o pool de armazenamento", "message.confirm.enable.vpc.offering": "Voc\u00ea tem certeza que deseja habilitar esta oferta de VPC?", +"message.confirm.enable.webhook": "Por favor, confirme que voc\u00ea deseja ativar este webhook.", +"message.confirm.remove.firewall.rule": "Por favor, confirme que voc\u00ea deseja excluir esta Regra de Firewall?", "message.confirm.remove.ip.range": "Por favor confirme que voc\u00ea deseja remover este range de IP.", "message.confirm.remove.network.offering": "Voc\u00ea tem certeza que deseja remover esta oferta de rede?", +"message.confirm.remove.network.policy": "Por favor, confirme que voc\u00ea deseja remover esta Pol\u00edtica de Rede?", +"message.confirm.remove.routing.policy": "Por favor, confirme que voc\u00ea deseja excluir esta Pol\u00edtica de Roteamento?", "message.confirm.remove.selected.alerts": "Por favor confirme que voc\u00ea deseja remover os alertas selecionados", "message.confirm.remove.selected.events": "Por favor confirme que voc\u00ea deseja remover os eventos selecionados", "message.confirm.remove.vmware.datacenter": "Por favor, confirme que voc\u00ea quer remover este VMware datacenter", "message.confirm.remove.vpc.offering": "Voc\u00ea tem certeza que deseja remover esta oferta de VPC?", "message.confirm.replace.acl.new.one": "Voc\u00ea deseja substituir a ACL com uma nova?", +"message.confirm.reset.network.permissions": "Tem certeza de que deseja redefinir as permiss\u00f5es desta Rede?", "message.confirm.scale.up.router.vm": "Voc\u00ea realmente quer escalonar a VM do roteador?", "message.confirm.scale.up.system.vm": "Voc\u00ea realmente quer escalonar a VM do sistema?", "message.confirm.start.lb.vm": "Confirme que voc\u00ea deseja iniciar esta LB VM", "message.confirm.sync.storage": "Por favor, confirme que voc\u00ea gostaria de sincronizar o pool de armazenamento", +"message.confirm.type": "Para confirmar, digite", "message.confirm.upgrade.router.newer.template": "Por favor confirme que voc\u00ea deseja atualizar o roteador para usar o template mais recente.", "message.cpu.usage.info": "A porcentagem de uso da CPU pode exceder 100% se a VM tiver mais de 1 vCPU ou quando o CPU Cap n\u00E3o estiver habilitado. Este comportamento acontece de acordo com o hypervisor que est\u00E1 sendo utilizado (ex: no KVM), devido \u00E0 forma como contabilizam as estat\u00EDsticas", +"message.create.backup.failed": "Falha ao criar backup.", +"message.create.bucket.failed": "Falha ao criar bucket.", +"message.create.bucket.processing": "Cria\u00e7\u00e3o de bucket em andamento", "message.create.compute.offering": "Oferta de computa\u00e7\u00e3o criada", "message.create.internallb": "Criando LB interno", "message.create.internallb.failed": "Falha ao criar LB interno", "message.create.internallb.processing": "Cria\u00e7\u00e3o do LB interno em progresso", "message.create.service.offering": "Oferta de servi\u00e7o criada", +"message.create.sharedfs.failed": "Falha ao criar Sistema de Arquivos Compartilhado.", +"message.create.sharedfs.processing": "Cria\u00e7\u00e3o de Sistema de Arquivos Compartilhado em andamento.", "message.create.snapshot.from.vmsnapshot.failed": "Falha ao criar snapshot a partir de uma snapshot de VM", "message.create.snapshot.from.vmsnapshot.progress": "Cria\u00e7\u00e3o de snapshot em progresso", +"message.create.template.failed": "Falha ao criar template.", +"message.create.template.processing": "Cria\u00e7\u00e3o de template em andamento", +"message.create.tungsten.public.network": "Criar Rede p\u00fablica Tungsten-Fabric", "message.create.volume.failed": "Falha ao criar volume", "message.create.volume.processing": "Cria\u00e7\u00e3o de volume em progresso", "message.create.vpc.offering": "Oferta VPC criada", "message.create.vpn.customer.gateway.failed": "A cria\u00e7\u00e3o do gateway da VPN do cliente falhou", +"message.creating.autoscale.scaledown.conditions": "Criando condi\u00e7\u00f5es de ScaleDown", +"message.creating.autoscale.scaledown.policy": "Criando pol\u00edtica de ScaleDown", +"message.creating.autoscale.scaleup.conditions": "Criando condi\u00e7\u00f5es de ScaleUp", +"message.creating.autoscale.scaleup.policy": "Criando pol\u00edtica de ScaleUp", +"message.creating.autoscale.vmgroup": "Criando Grupo de AutoScale", +"message.creating.autoscale.vmprofile": "Criando perfil de Inst\u00e2ncia de AutoScale", "message.creating.cluster": "Criando cluster", "message.creating.guest.network": "Criando rede guest", "message.creating.physical.networks": "Criando redes fisicas", @@ -2044,9 +2984,13 @@ "message.delete.acl.rule": "Remover regra ACL", "message.delete.acl.rule.failed": "Falha ao remover regra ACL", "message.delete.affinity.group": "Por favor, confirme que voc\u00ea deseja remover este grupo de afinidade", +"message.delete.asn.range": "ASN Range exclu\u00eddo com sucesso", "message.delete.backup": "Voc\u00ea tem certeza de que quer apagar o backup?", "message.delete.failed": "Falha ao remover", "message.delete.gateway": "Favor confirmar que voc\u00ea deseja deleta o gateway", +"message.delete.ip.v6.prefix.processing": "Excluindo prefixo IPv6...", +"message.delete.keypair": "Favor confirmar que voc\u00ea deseja deletar a chave de API.", +"message.delete.keypair.failed": "Falha ao deletar par de chave de API", "message.delete.port.forward.processing": "Removendo regra de encaminhamento de porta...", "message.delete.project": "Voc\u00ea tem certeza que deseja remover este projeto?", "message.delete.rule.processing": "Removendo regra...", @@ -2055,44 +2999,70 @@ "message.delete.tag.failed": "Falha ao remover etiqueta", "message.delete.tag.for.networkacl": "Remover etiqueta para rede ACL", "message.delete.tag.processing": "Removendo etiqueta...", +"message.delete.traffic.type.processing": "Excluindo tipo de tr\u00e1fego...", +"message.delete.tungsten.policy.rule": "Por favor, confirme que voc\u00ea deseja excluir a Regra de Pol\u00edtica?", +"message.delete.tungsten.tag": "Tem certeza de que deseja remover esta Tag desta Pol\u00edtica?", "message.delete.user": "Por favor confirme que voc\u00ea deseja deletar este usu\u00e1rio.", "message.delete.vpn.connection": "Favor confirmar que voc\u00ea deseja deletar esta conex\u00e3o VPN", "message.delete.vpn.customer.gateway": "Favor confirmar que voc\u00ea deseja deletar este gateway de VPN de usu\u00e1rio", "message.delete.vpn.gateway": "Favor confirmar que voc\u00ea deseja deletar este gateway de VPN", +"message.delete.webhook": "Por favor, confirme que voc\u00ea deseja excluir este Webhook.", +"message.delete.webhook.delivery": "Por favor, confirme que voc\u00ea deseja excluir esta entrega de Webhook.", +"message.deleting.firewall.policy": "Excluindo Pol\u00edtica de Firewall", "message.deleting.node": "Removendo nodo", "message.deleting.vm": "Removendo VM", +"message.denied": "Negado", "message.deployasis": "O modelo selecionado \u00e9 Deploy As-Is, ou seja, a VM \u00e9 implantada atrav\u00e9s da importa\u00e7\u00e3o de um OVA com vApps diretamente no vCenter. O redimensionamento do(s) disco(s) raiz(s) \u00e9 permitido somente em VMs paradas para tais modelos.", "message.desc.advanced.zone": "Para topologias de rede mais sofisticadas. este modelo fornece maior flexibilidade na defini\u00e7\u00e3o de redes de clientes e fornece ofertas de rede personalizadas, tais como firewall, VPN ou de balanceamento de carga.", "message.desc.basic.zone": "Fornece uma \u00fanica rede onde em cada inst\u00e2ncia de VM \u00e9 atribu\u00eddo um IP diretamente na rede. O isolamento guest podem ser fornecidos atrav\u00e9s de camada-3 da rede com grupos de seguran\u00e7a (filtragem da fonte de endere\u00e7os IP).", +"message.desc.core.zone": "Zonas Core destinam-se a implanta\u00e7\u00f5es baseadas em Datacenter e permitem toda a gama de funcionalidades de Rede e outras no Apache CloudStack. Zonas Core t\u00eam uma s\u00e9rie de pr\u00e9-requisitos e dependem da presen\u00e7a de armazenamento compartilhado e inst\u00e2ncias auxiliares.", "message.desc.cluster": "Cada pod deve conter um ou mais clusters, e iremos adicionar o primeiro cluster agora. Um cluster fornece uma maneira de agrupamento de hosts. Os hosts de um cluster t\u00eam hardware id\u00eantico, executam o mesmo virtualizador, est\u00e3o na mesma sub-rede e acessam o mesmo armazenamento compartilhado. Cada cluster \u00e9 constitu\u00eddo por um ou mais hosts e um ou mais servidores de armazenamento prim\u00e1rio.", "message.desc.create.ssh.key.pair": "Por favor, preencha os seguintes dados para criar ou registar um par de chaves SSH.

    (1) Se a chave p\u00fablica est\u00e1 definida, CloudStack ir\u00e1 registrar a chave p\u00fablica. Voc\u00ea pode us\u00e1-la atrav\u00e9s de sua chave privada.

    (2) Se a chave p\u00fablica n\u00e3o est\u00e1 definida, CloudStack ir\u00e1 criar um novo par de chaves SSH. Neste caso, copie e salve a chave privada. CloudStack n\u00e3o ir\u00e1 mant\u00ea-la.
    ", "message.desc.created.ssh.key.pair": "Par de chaves SSH criado", -"message.desc.host": "Cada cluster deve conter pelo menos um host (computador) para as VMs guest serem executadas e iremos adicionar o primeira host agora. Para um host funcionar no CloudStack, voc\u00ea deve instalar um virtualizador no host, atribuir um endere\u00e7o IP e garantir que o host est\u00e1 conectado ao servidor de gerenciamento do CloudStack.

    Forne\u00e7a o hostname ou o endere\u00e7o IP do host, o nome de usu\u00e1rio (geralmente root) e a senha e qualquer label que voc\u00ea utiliza para categorizar os hosts.", +"message.desc.edge.zone": "Zonas Edge s\u00e3o zonas leves, projetadas para implanta\u00e7\u00e3o em cen\u00e1rios de computa\u00e7\u00e3o de borda. Elas s\u00e3o limitadas em funcionalidade, mas t\u00eam muito menos pr\u00e9-requisitos do que zonas core.

    Por favor, consulte a documenta\u00e7\u00e3o do Apache CloudStack para mais informa\u00e7\u00f5es sobre Tipos de Zona
    http://docs.cloudstack.apache.org/en/latest/installguide/configuration.html#adding-a-zone", +"message.desc.host": "Cada cluster deve conter pelo menos um host (computador) para as VMs guest serem executadas e iremos adicionar o primeira host agora. Para um host funcionar no CloudStack, voc\u00ea deve instalar um virtualizador no host, atribuir um endere\u00e7o IP e garantir que o host est\u00e1 conectado ao Management Server do CloudStack.

    Forne\u00e7a o hostname ou o endere\u00e7o IP do host, o nome de usu\u00e1rio (geralmente root) e a senha e qualquer label que voc\u00ea utiliza para categorizar os hosts.", +"message.desc.import.ext.kvm.wizard": "Importar dom\u00ednio libvirt de Host KVM Externo n\u00e3o gerenciado pelo CloudStack", +"message.desc.import.local.kvm.wizard": "Importar imagem QCOW2 do Armazenamento Local do Host KVM selecionado", +"message.desc.import.shared.kvm.wizard": "Importar imagem QCOW2 do Pool de Armazenamento Prim\u00e1rio selecionado", +"message.desc.import.unmanage.volume": "Por favor, escolha um pool de armazenamento do qual voc\u00ea deseja importar ou parar de gerenciar volumes. O pool de armazenamento deve estar no status Up.
    Este recurso suporta apenas KVM.", "message.desc.importexportinstancewizard": "Testa caracter\u00edstica s\u00f3 se aplica aos clusters Cloudstack VMware. Ao optar por gerenciar uma inst\u00e2ncia, o CloudStack assume a orquestra\u00e7\u00e3o dessa inst\u00e2ncia. A inst\u00e2ncia \u00e9 deixada em funcionamento e n\u00e3o movida fisicamente. Desagrupar inst\u00e2ncias, remove a capacidade do CloudStack de gerenci\u00e1-las (mas elas s\u00e3o deixadas em funcionamento e n\u00e3o s\u00e3o destru\u00eddas).", +"message.desc.importingestinstancewizard": "Este recurso aplica-se apenas a inst\u00e2ncias KVM baseadas em libvirt. Apenas inst\u00e2ncias Paradas podem ser ingeridas", +"message.desc.importmigratefromvmwarewizard": "Ao selecionar um Datacenter VMware existente ou externo e uma inst\u00e2ncia para importar, o CloudStack migra a inst\u00e2ncia selecionada do VMware para KVM em um host de convers\u00e3o usando virt-v2v e a importa para um cluster KVM", "message.desc.primary.storage": "Cada cluster deve conter um ou mais servidores de armazenamento prim\u00e1rio e iremos adicionar o primeiro agora. Um armazenamento prim\u00e1rio, cont\u00e9m os volumes de disco para todas as VMs em execu\u00e7\u00e3o nos hosts do cluster. utiliza qualquer protocolo compat\u00edvel com os padr\u00f5es que \u00e9 suportado pelo virtualizador utilizado.", +"message.desc.register.user.data": "Por favor, preencha os seguintes dados para registrar um dado de usu\u00e1rio.", +"message.desc.registered.user.data": "Dados do Usu\u00e1rio Registrados.", "message.desc.reset.ssh.key.pair": "Por favor, especifique um par de chaves SSH que voc\u00ea deseja adicionar a esta VM.", "message.desc.secondary.storage": "Cada zona deve ter pelo menos um NFS ou servidor de armazenamento secund\u00e1rio e iremos adicionar o primeiro agora. Um armazenamento secund\u00e1rios armazena templates de VM, imagens ISO e snapshots do volume de disco da VM. Esse servidor deve estar dispon\u00edvel para todos os hosts na zona.

    Fornecer o endere\u00e7o IP e o caminho exportados.", +"message.desc.zone.edge": "Uma zona \u00e9 a maior unidade organizacional no CloudStack e, normalmente, corresponde a um \u00fanico datacenter. Zonas fornecem isolamento f\u00edsico e redund\u00e2ncia. Uma zona de borda consiste em um ou mais hosts (cada um dos quais fornece armazenamento local como servidores de armazenamento prim\u00e1rio). Apenas redes compartilhadas e L2 podem ser implantadas nessas zonas e funcionalidades que requerem armazenamentos secund\u00e1rios n\u00e3o s\u00e3o suportadas.", "message.desc.zone": "Uma zona \u00e9 a maior unidade organizacional no CloudStack e normalmente corresponde \u00e0 um \u00fanico datacenter. As zonas disponibilizam isolamento f\u00edsico e redund\u00e2ncia. Uma zona \u00e9 composta por um ou mais pods (cada um dos quais cont\u00e9m os hosts e servidores de armazenamento prim\u00e1rio) e um servidor de armazenamento secund\u00e1rio que \u00e9 compartilhado por todos os pods na zona.", "message.detach.disk": "Voc\u00ea tem certeza que deseja desconectar este disco?", "message.detach.iso.confirm": "Confirme se voc\u00ea deseja desconectar o ISO da inst\u00e2ncia virtual.", "message.disable.account": "Por favor confirme que voc\u00ea deseja desabilitar esta conta. Ap\u00f3s desabilitar uma conta, todos os usu\u00e1rios desta conta n\u00e3o ir\u00e3o possuir mais acesso aos seus recursos da cloud. Todas as m\u00e1quinas virtuais ser\u00e3o automaticamente desligadas.", +"message.disable.role": "Por favor, confirme que voc\u00ea gostaria de desativar esta Fun\u00e7\u00e3o", "message.disable.user": "Por favor confirme que voc\u00ea deseja desabilitar este usu\u00e1rio.", "message.disable.vpn": "Voc\u00ea tem certeza que deseja desabilitar a VPN?", "message.disable.vpn.failed": "Falha ao desabilitar VPN", "message.disable.vpn.processing": "Desabilitando VPN...", +"message.disable.webhook.ssl.verification": "Desativar a verifica\u00e7\u00e3o SSL n\u00e3o \u00e9 recomendado", "message.discovering.feature": "Descobrindo funcionalidades, por favor aguarde...", "message.disk.offering.created": "Oferta de disco criada:", "message.disk.usage.info.data.points": "Cada ponto no gr\u00e1fico representa a diferen\u00e7a de dados lidos/escritos desde a \u00faltima coleta de estat\u00edstica realizada (o ponto anterior)", "message.disk.usage.info.sum.of.disks": "O uso de disco apresentado \u00e9 composto pela soma de dados lidos/escritos por todos os discos da VM", "message.download.volume": "Clique 00000 para baixar o disco", "message.download.volume.confirm": "Por favor confirme que voc\u00ea quer baixar este volume", +"message.drs.plan.description": "O n\u00famero m\u00e1ximo de migra\u00e7\u00f5es ao vivo permitidas para DRS. Configure DRS na aba de configura\u00e7\u00f5es antes de gerar um plano ou para ativar o DRS autom\u00e1tico para o cluster.", +"message.drs.plan.executed": "Plano DRS executado com sucesso.", "message.edit.acl.failed": "Falha ao editar regra ACL", "message.edit.acl.processing": "Editando regra ACL...", "message.edit.rule.failed": "Falha ao editar regra", "message.edit.rule.processing": "Atualizando regra...", "message.edit.traffic.type": "Favor especificar a etiqueta de tr\u00e1fego que voc\u00ea deseja associar com este tipo de tr\u00e1fego.", +"message.egress.rules.allow": "Permitir (o tr\u00e1fego correspondente \u00e0s regras de sa\u00edda adicionadas ser\u00e1 negado)", +"message.egress.rules.deny": "Negar (o tr\u00e1fego correspondente \u00e0s regras de sa\u00edda adicionadas ser\u00e1 permitido)", +"message.egress.rules.info.for.network": "A pol\u00edtica de sa\u00edda padr\u00e3o desta Rede \u00e9 %x.
    O tr\u00e1fego de sa\u00edda correspondente \u00e0s seguintes regras de sa\u00edda ser\u00e1 %y", "message.enable.account": "Confirme se voc\u00ea deseja ativar a conta.", "message.enable.netsacler.provider.failed": "Falha ao habilitar provedor Netscaler", +"message.enable.role": "Por favor, confirme que voc\u00ea deseja ativar esta Fun\u00e7\u00e3o", "message.enable.securitygroup.provider.failed": "Falha ao habilitar provedor do grupo de seguran\u00e7a", "message.enable.user": "Por favor confirme que voc\u00ea deseja habilitar este usu\u00e1rio.", "message.enable.vpn": "Por favor confirme que voc\u00ea deseja acesso VPN habilitado para este endere\u00e7o IP.", @@ -2104,23 +3074,46 @@ "message.enter.valid.nic.ip": "Por favor insira um endere\u00e7o IP valido para o NIC", "message.error.access.key": "Por favor insira a chave de acesso", "message.error.add.guest.network": "Os campos IPv4 ou IPv6 precisam ser preenchidos ao adicionar uma rede guest", +"message.error.delete.asnrange": "Excluindo Faixa AS", +"message.error.add.interface.static.route": "Adicionar Rota Est\u00e1tica de interface falhou", +"message.error.add.logical.router": "Adicionar Roteador L\u00f3gico falhou", +"message.error.add.network.static.route": "Adicionar Rota Est\u00e1tica de Rede falhou", +"message.error.add.policy.rule": "Adicionar regra de Pol\u00edtica falhou", "message.error.add.secondary.ipaddress": "Houve um erro ao adicionar o endere\u00e7o IP secund\u00e1rio", +"message.error.add.tungsten.router.table": "Adicionar Tabela de Roteador falhou", +"message.error.add.tungsten.routing.policy": "Adicionar Pol\u00edtica de Roteamento Tungsten-Fabric falhou", "message.error.agent.password": "Por favor, insira a senha do agente", -"message.error.agent.username": "Por favor, insira o usu\u00e1rio do agent", +"message.error.agent.username": "Por favor, insira o usu\u00e1rio do agente", +"message.error.apply.network.policy": "Aplica\u00e7\u00e3o da Pol\u00edtica de Rede falhou", +"message.error.apply.tungsten.tag": "Aplica\u00e7\u00e3o de Tag falhou", +"message.error.authentication.code": "Por favor, insira o c\u00f3digo de autentica\u00e7\u00e3o.", "message.error.binaries.iso.url": "Por favor, digite a URL ISO dos bin\u00e1rios", "message.error.bucket": "Por favor, insira o bucket", +"message.error.cidr": "CIDR \u00e9 obrigat\u00f3rio", +"message.error.cidr.or.cidrsize": "CIDR ou tamanho do cidr \u00e9 obrigat\u00f3rio", "message.error.cloudian.console": "Single-Sign-On falhou para o Cloudian management console. Solicite a seu administrador que conserte problemas de integra\u00e7\u00e3o.", "message.error.cluster.description": "Por favor, digite a descri\u00e7\u00e3o do Kubernetes cluster", "message.error.cluster.name": "Por favor, insira o nome do cluster", "message.error.confirm.password": "Por favor, confirme a nova senha", +"message.error.confirm.text": "Por favor, insira o texto de confirma\u00e7\u00e3o", +"message.error.create.webhook.local.account": "Conta deve ser fornecida para criar um Webhook com escopo Local.", +"message.error.create.webhook.name": "Nome deve ser fornecido para criar um Webhook.", +"message.error.create.webhook.payloadurl": "URL de Payload deve ser fornecida para criar um Webhook.", "message.error.current.password": "Por favor, insira a senha atual", "message.error.custom.disk.size": "Por favor, insira o tamanho do disco personalizado", "message.error.date": "Por favor, insira uma data", +"message.error.delete.interface.static.route": "Remo\u00e7\u00e3o de Rota Est\u00e1tica de interface falhou", +"message.error.delete.network.static.route": "Remo\u00e7\u00e3o de Rota Est\u00e1tica de Rede falhou", +"message.error.delete.tungsten.policy.rule": "Exclus\u00e3o da regra de Pol\u00edtica falhou", +"message.error.delete.tungsten.router.table": "Remo\u00e7\u00e3o da Tabela de Roteador falhou", +"message.error.delete.tungsten.tag": "Remo\u00e7\u00e3o da Tag falhou", "message.error.description": "Por favor, insira uma descri\u00e7\u00e3o", "message.error.discovering.feature": "Exce\u00e7\u00e3o lan\u00e7ada durante a descoberta de funcionalidades", "message.error.display.text": "Por favor, insira o texto de exibi\u00e7\u00e3o", +"message.error.duration.less.than.interval": "A dura\u00e7\u00e3o na pol\u00edtica de AutoScale n\u00e3o pode ser menor que o intervalo", "message.error.enable.saml": "Incapaz de encontrar IDs de usu\u00e1rios para ativar o SAML Single Sign On, por favor, ative-o manualmente.", "message.error.end.date.and.time": "Por favor, selecione a data e hor\u00e1rio final.", +"message.error.endasn": "Por favor, insira a Faixa AS final", "message.error.endip": "Por favor, insira o IP final", "message.error.gateway": "Por favor, insira o gateway", "message.error.host.name": "Por favor, insira o nome do host", @@ -2133,9 +3126,11 @@ "message.error.internallb.instance.port": "Por favor, especifique a porta da inst\u00e2ncia", "message.error.internallb.name": "Por favor, especifique um nome para o LB interno", "message.error.internallb.source.port": "Por favor, insira uma porta de origem", +"message.error.invalid.autoscale.vmgroup.name": "Nome do Grupo de AutoScale inv\u00e1lido. Ele pode conter as letras ASCII 'a' a 'z', 'A' a 'Z', os d\u00edgitos '0' a '9' e o h\u00edfen ('-'), deve ter entre 1 e 255 caracteres.", "message.error.ip.range": "Por favor, insira um intervalo v\u00e1lido", "message.error.ipv4.address": "Por favor, insira um endere\u00e7o IPv4 v\u00e1lido", "message.error.ipv4.dns1": "Por favor, insira o DNS 1 IPv4", +"message.error.ipv4.dns2": "Por favor, insira o DNS 2 IPv4", "message.error.ipv6.address": "Por favor, insira um endere\u00e7o IPv6 v\u00e1lido.", "message.error.ipv6.gateway": "Por favor, insira o gateway IpV6", "message.error.ipv6.gateway.format": "Por favor, insira um gateway IpV6 v\u00e1lido.", @@ -2145,6 +3140,10 @@ "message.error.loading.setting": "Houve um erro ao carregar estas configura\u00e7\u00f5es.", "message.error.lun": "Por favor, insira o # LUN", "message.error.macaddress": "Por favor, digite um endere\u00e7o MAC v\u00e1lido.", +"message.error.max.members.less.than.min.members": "O valor de M\u00e1x membros deve ser maior que o valor de M\u00edn membros", +"message.error.mtu.below.min": "MTU est\u00e1 abaixo do valor m\u00ednimo suportado de %x", +"message.error.mtu.private.max.exceed": "O valor inserido excede o MTU privado m\u00e1ximo permitido para esta Zona, seu valor ser\u00e1 automaticamente reduzido para corresponder a ele.", +"message.error.mtu.public.max.exceed": "O valor inserido excede o MTU p\u00fablico m\u00e1ximo permitido para esta Zona, seu valor ser\u00e1 automaticamente reduzido para corresponder a ele.", "message.error.name": "Por favor, insira um nome", "message.error.netmask": "Por favor, insira am\u00e1scara de rede", "message.error.network.offering": "Por favor, selecione a oferta de rede", @@ -2153,6 +3152,7 @@ "message.error.nexus1000v.password": "Por favor, insira a senha do Nexus 1000v", "message.error.nexus1000v.username": "Por favor, insira o usu\u00e1rio do Nexus 1000v", "message.error.number": "Por favor, insira um n\u00famero v\u00e1lido", +"message.error.parent.subnet": "Por favor, escolha uma sub-rede pai", "message.error.password": "Insira a sua senha", "message.error.path": "Por favor, insira o path", "message.error.provide.setting": "Deve fornecer uma chave v\u00e1lida e um valor para a configura\u00e7\u00e3o", @@ -2160,10 +3160,16 @@ "message.error.rados.pool": "Por favor, digite o RADOS pool", "message.error.rados.secret": "Por favor, digite o RADOS secret", "message.error.rados.user": "Por favor, digite o usu\u00e1rio RADOS", +"message.error.remove.logical.router": "Remo\u00e7\u00e3o do Roteador L\u00f3gico falhou", +"message.error.remove.network.policy": "Remo\u00e7\u00e3o da Pol\u00edtica de Rede falhou", "message.error.remove.nic": "Houve um erro", "message.error.remove.secondary.ipaddress": "Houve um erro ao remover o endere\u00e7o IP secund\u00e1rio", +"message.error.remove.tungsten.routing.policy": "Remo\u00e7\u00e3o da Pol\u00edtica de Roteamento Tungsten-Fabric da Rede falhou", +"message.error.remove.vm.schedule": "Remo\u00e7\u00e3o do Agendamento de Inst\u00e2ncia falhou", "message.error.required.input": "Por favor, digite os dados", +"message.error.reset.config": "Incapaz de redefinir configura\u00e7\u00e3o para o valor padr\u00e3o", "message.error.retrieve.kubeconfig": "N\u00e3o foi poss\u00edvel recuperar a configura\u00e7\u00e3o do cluster Kubernetes", +"message.error.routing.policy.term": "Comunidade precisa ter o seguinte formato n\u00famero:n\u00famero", "message.error.s3nfs.path": "Por favor, insira o S3 NFS path", "message.error.s3nfs.server": "Por favor, insira o servidor S3 NFS", "message.error.save.setting": "Houve um erro ao salvar esta configura\u00e7\u00e3o.", @@ -2173,18 +3179,28 @@ "message.error.secret.key": "Por favor, insira a chave secreta", "message.error.select": "Por favor, escolha uma op\u00e7\u00e3o", "message.error.select.domain.to.dedicate": "Por favor, escolha o dom\u00ednio a ser dedicado", +"message.error.select.load.balancer": "Por favor, selecione um balanceador de carga", +"message.error.select.network": "Por favor, selecione uma Rede", +"message.error.select.network.supports.vm.autoscaling": "A Rede padr\u00e3o que voc\u00ea selecionou n\u00e3o suporta AutoScale de Inst\u00e2ncia, por favor selecione uma Rede padr\u00e3o que suporte AutoScale de Inst\u00e2ncia.", +"message.error.select.user": "Por favor, selecione um Usu\u00e1rio", "message.error.select.zone.type": "Por favor, escolha o tipo de zona abaixo.", "message.error.server": "Por favor, insira o servidor", "message.error.serviceoffering.for.cluster": "Por favor, escolha a oferta de servi\u00e7o para o cluster Kubernetes", +"message.error.setup.2fa": "Falha na configura\u00e7\u00e3o 2FA ao verificar o c\u00f3digo, por favor tente novamente.", "message.error.size": "Por favor, insira o tamanho em GB", "message.error.size.for.cluster": "Por favor, insira o tamanho do cluster Kubernetes", "message.error.smb.password": "Por favor, insira a senha do SMB ", "message.error.smb.username": "Por favor, insira o usu\u00e1rio do SMB", +"message.error.specify.stickiness.method": "Por favor, especifique um m\u00e9todo de stickiness", "message.error.specify.sticky.name": "Por favor, especifique o nome sticky", "message.error.sr.namelabel": "Por favor, insira o nome-R\u00f3tulo SR", "message.error.start.date.and.time": "Por favor, selecione a data e hor\u00e1rio inicial.", +"message.error.startasn": "Por favor, insira a Faixa AS inicial", "message.error.startip": "Por favor, insira o IP de \u00cdnicio", "message.error.storage.tags": "Por favor, insira as tags de armazenamento", +"message.error.swift.account": "Por favor, insira a Conta", +"message.error.swift.key": "Por favor, insira a chave", +"message.error.swift.username": "Por favor, insira o nome de usu\u00e1rio", "message.error.target.iqn": "Por favor, insira o Target IQN", "message.error.time": "Por favor, selecione a hora", "message.error.traffic.label": "Por favor, insira o r\u00f3tulo de tr\u00e1fego", @@ -2193,6 +3209,7 @@ "message.error.upload.template": "Falha no carregamento de template", "message.error.upload.template.description": "Apenas um template pode ser carregado de cada vez", "message.error.url": "Por favor, insira a URL", +"message.error.userdata": "Por favor, insira o Userdata", "message.error.username": "Insira o seu usu\u00e1rio", "message.error.valid.iops.range": "Por favor, insira uma faixa IOPS v\u00e1lida", "message.error.vcenter.datacenter": "Por favor, insira o vCenter datacenter", @@ -2200,6 +3217,7 @@ "message.error.vcenter.host": "Por favor, insira o vCenter host", "message.error.vcenter.password": "Por favor, insira a senha vCenter", "message.error.vcenter.username": "Por favor, insira o usu\u00e1rio vCenter", +"message.error.verifying.2fa": "Incapaz de verificar 2FA, por favor tente novamente.", "message.error.version.for.cluster": "Por favor, selecionar a vers\u00e3o Kubernetes para o cluster Kubernetes", "message.error.vlan.range": "Por favor, insira um intervalo VLAN/VNI v\u00e1lido", "message.error.volume.name": "Por favor, insira o nome do volume", @@ -2211,19 +3229,45 @@ "message.error.zone.name": "Por favor, insira o nome da zona", "message.error.zone.type": "Por favor, selecione o tipo de zona", "message.error.linstor.resourcegroup": "Por favor, insira o Linstor Resource-Group", -"message.error.fixed.offering.kvm": "N\u00e3o \u00e9 poss\u00edvel escalar VMs que utilizam o virtualizador KVM com uma oferta de computa\u00e7\u00e3o fixa.", "message.fail.to.delete": "Falha ao deletar.", "message.failed.to.add": "Falha ao adicionar", "message.failed.to.assign.vms": "Falha ao atribuir VMs", "message.failed.to.remove": "Falha ao remover", +"message.forgot.password.success": "Um e-mail foi enviado para o seu endere\u00e7o de e-mail com instru\u00e7\u00f5es sobre como redefinir sua senha.", "message.generate.keys": "Por favor confirme que voc\u00ea deseja gerar novas chaves para este usu\u00e1rio.", "message.chart.statistic.info": "Os gr\u00E1ficos mostrados s\u00E3o autoajust\u00E1veis, ou seja, se o valor se aproximar ou passar do limite, ele crescer\u00E1 para ajustar o valor mostrado", +"message.chart.statistic.info.hypervisor.additionals": "Os dados de m\u00e9tricas dependem do plugin de hypervisor usado para cada hypervisor. O comportamento pode variar entre diferentes hypervisors. Por exemplo, com KVM, as m\u00e9tricas s\u00e3o estat\u00edsticas em tempo real fornecidas pelo libvirt. Em contraste, com VMware, as m\u00e9tricas s\u00e3o dados m\u00e9dios para um determinado intervalo de tempo controlado pela configura\u00e7\u00e3o.", "message.guest.traffic.in.advanced.zone": "O tr\u00e1fego de rede guest \u00e9 para comunica\u00e7\u00e3o entre m\u00e1quinas virtuais do usu\u00e1rio final. Especifique um intervalo de IDs de VLAN para transportar o tr\u00e1fego do guest para cada rede f\u00edsica.", "message.guest.traffic.in.basic.zone": "O tr\u00e1fego de rede guest \u00e9 para comunica\u00e7\u00e3o entre m\u00e1quinas virtuais do usu\u00e1rio final. Especifique um intervalo de endere\u00e7os IP para que CloudStack possa atribuir \u00e0s VMs. Certifique-se que este intervalo n\u00e3o se sobreponha o range de IPs reservados do sistema.", +"message.host.controlstate": "O Status do Recurso de Computa\u00e7\u00e3o para esta Inst\u00e2ncia \u00e9 ", +"message.host.controlstate.retry": "Algumas a\u00e7\u00f5es nesta Inst\u00e2ncia falhar\u00e3o, se for o caso, por favor aguarde um pouco e tente novamente.", "message.host.dedicated": "Host dedicado", "message.host.dedication.released": "Host dedicado liberado", "message.info.cloudian.console": "O Cloudian management console deve abrir em outra janela", -"message.installwizard.copy.whatiscloudstack": "O CloudStack™ \u00e9 uma plataforma de software que agrega recursos computacionais para construir uma Cloud de infraestrutura como servi\u00e7o (IaaS) p\u00fablica, privada ou h\u00edbrida. O CloudStack™ ger\u00eancia a rede, o armazenamento e os recursos computacionais que comp\u00f5em a infraestrutura de cloud. utilize o CloudStack™ para instalar, gerenciar e configurar os ambientes de cloud computing.

    Indo al\u00e9m de imagens de m\u00e1quinas virtuais individuais rodando em hardware commodity, CloudStack™ prov\u00ea uma solu\u00e7\u00e3o completa de software de infraestrutura de cloud para entregar datacenters virtuais como um servi\u00e7o - possuindo todos os componentes essenciais para contruir, instalar e gerenciar aplica\u00e7\u00f5es na cloud multi-camadas e multi-tenant.", +"message.infra.setup.nsx.description": "Esta zona deve conter um provedor NSX porque o m\u00e9todo de isolamento \u00e9 NSX", +"message.infra.setup.tungsten.description": "Esta zona deve conter um provedor Tungsten-Fabric porque o m\u00e9todo de isolamento \u00e9 TF", +"message.import.running.instance.warning": "A VM selecionada est\u00e1 ligada no Datacenter VMware. O estado recomendado para converter uma VM VMware em KVM \u00e9 desligada ap\u00f3s um desligamento gracioso do SO convidado.", +"message.import.volume": "Por favor, especifique o dom\u00ednio, conta ou nome do projeto.
    Se n\u00e3o definido, o volume ser\u00e1 importado para o solicitante.", +"message.installwizard.cloudstack.helptext.document": " * Documenta\u00e7\u00e3o:\t ", +"message.installwizard.cloudstack.helptext.header": "\nVoc\u00ea pode encontrar mais informa\u00e7\u00f5es sobre o Apache CloudStack™ nas p\u00e1ginas listadas abaixo.\n", +"message.installwizard.cloudstack.helptext.issues": " * Relatar problemas:\t ", +"message.installwizard.cloudstack.helptext.mailinglists": " * Juntar-se a listas de discuss\u00e3o:\t ", +"message.installwizard.cloudstack.helptext.releasenotes": " * Notas de lan\u00e7amento:\t ", +"message.installwizard.cloudstack.helptext.survey": " * Participe da pesquisa:\t ", +"message.installwizard.cloudstack.helptext.website": " * Site do projeto:\t ", +"message.installwizard.tooltip.nsx.provider.edgecluster": "Informa\u00e7\u00f5es do cluster de borda do Provedor NSX n\u00e3o fornecidas", +"message.installwizard.tooltip.nsx.provider.hostname": "Hostname / endere\u00e7o IP do Provedor NSX n\u00e3o fornecido", +"message.installwizard.tooltip.nsx.provider.password": "Senha do Provedor NSX n\u00e3o fornecida", +"message.installwizard.tooltip.nsx.provider.tier0gateway": "Informa\u00e7\u00f5es do gateway tier-0 do Provedor NSX n\u00e3o fornecidas", +"message.installwizard.tooltip.nsx.provider.transportZone": "Informa\u00e7\u00f5es da zona de transporte do Provedor NSX n\u00e3o fornecidas", +"message.installwizard.tooltip.nsx.provider.username": "Nome de usu\u00e1rio do Provedor NSX n\u00e3o fornecido", +"message.installwizard.tooltip.tungsten.provider.gateway": "Gateway do provedor Tungsten \u00e9 obrigat\u00f3rio", +"message.installwizard.tooltip.tungsten.provider.hostname": "Hostname do provedor Tungsten \u00e9 obrigat\u00f3rio", +"message.installwizard.tooltip.tungsten.provider.introspectport": "Porta de introspec\u00e7\u00e3o do provedor Tungsten \u00e9 obrigat\u00f3ria", +"message.installwizard.tooltip.tungsten.provider.name": "Nome do provedor Tungsten \u00e9 obrigat\u00f3rio", +"message.installwizard.tooltip.tungsten.provider.port": "Porta do provedor Tungsten \u00e9 obrigat\u00f3ria", +"message.installwizard.tooltip.tungsten.provider.vrouterport": "Porta do vrouter do provedor Tungsten \u00e9 obrigat\u00f3ria", +"message.installwizard.copy.whatiscloudstack": "O CloudStack™ \u00e9 uma plataforma de software que agrega recursos computacionais para construir uma Cloud de infraestrutura como servi\u00e7o (IaaS) p\u00fablica, privada ou h\u00edbrida. O CloudStack™ ger\u00eancia a rede, o armazenamento e os recursos computacionais que comp\u00f5em a infraestrutura de cloud. utilize o CloudStack™ para instalar, gerenciar e configurar os ambientes de cloud computing.

    Indo al\u00e9m de imagens de m\u00e1quinas virtuais individuais rodando em hardware commodity, CloudStack™ prov\u00ea uma solu\u00e7\u00e3o completa de software de infraestrutura de cloud para entregar datacenters virtuais como um servi\u00e7o - possuindo todos os componentes essenciais para contruir, instalar e gerenciar aplica\u00e7\u00f5es na cloud multi-camadas e multi-tenant. Ambas as vers\u00f5es open-source e premium est\u00e3o dispon\u00edveis, com a vers\u00e3o opensource oferecendo praticamente os mesmos recursos.", "message.installwizard.tooltip.addpod.name": "O nome para o pod", "message.installwizard.tooltip.addpod.reservedsystemendip": "Este \u00e9 o range de IP na rede privada que o CloudStack utiliza para gerenciar o armazenamento secund\u00e1rio das VMs e proxy console das VMs. estes endere\u00e7os IP s\u00e3o obtidos da mesma subrede dos servidores hosts.", "message.installwizard.tooltip.addpod.reservedsystemgateway": "O gateway para os hosts neste pod.", @@ -2234,8 +3278,12 @@ "message.installwizard.tooltip.configureguesttraffic.gueststartip": "O range de endere\u00e7os IP que estar\u00e1 dispon\u00edvel para aloca\u00e7\u00e3o para os guests nesta zona. Caso uma interface de rede seja utilizada, estes IPs devem estar no mesmo CIDR que o CIDR do pod.", "message.instances.managed": "Inst\u00e2ncias ou VMs controladas pelo CloudStack", "message.instances.unmanaged": "Inst\u00e2ncias ou VMs que n\u00e3o s\u00e3o controladas pelo CloudStack", +"message.instances.migrate.vmware": "Inst\u00e2ncias que podem ser migradas do VMware.", "message.interloadbalance.not.return.elementid": "erro: A API listInternalLoadBalancerElements API n\u00e3o retorna o ID interno do elemento LB", +"message.ip.address": "Endere\u00e7o IP : ", "message.ip.address.changes.effect.after.vm.restart": "As mudan\u00e7as de endere\u00e7o IP entram em vigor somente ap\u00f3s o rein\u00edcio da VM.", +"message.ip.v6.prefix.delete": "Prefixo IPv6 exclu\u00eddo", +"message.iso.arch": "Por favor, selecione uma arquitetura ISO", "message.iso.desc": "Imagem de disco contendo dados ou m\u00eddia de sistema operacional boot\u00e1vel", "message.kubeconfig.cluster.not.available": "kubeconfig do cluster Kubernetes n\u00e3o est\u00e1 dispon\u00edvel no momento", "message.kubernetes.cluster.delete": "Por favor, confirme que voc\u00ea quer destruir o cluster", @@ -2244,25 +3292,43 @@ "message.kubernetes.cluster.stop": "Por favor, confirme que voc\u00ea deseja parar o cluster", "message.kubernetes.cluster.upgrade": "Por favor, selecione a nova vers\u00e3o do Kubernetes", "message.kubernetes.version.delete": "Por favor, confirme que voc\u00ea deseja excluir esta vers\u00e3o do Kubernetes", +"message.l2.network.unsupported.for.nsx": "Redes L2 n\u00e3o s\u00e3o suportadas para zonas habilitadas para NSX", "message.launch.zone": "A zona est\u00e1 pronta para ser executada; por favor, v\u00e1 para o pr\u00f3ximo passo.", "message.launch.zone.description": "A zona est\u00e1 pronta para iniciar; por favor, prossiga para o pr\u00f3ximo passo.", "message.launch.zone.hint": "Configurar componentes e tr\u00e1fego de rede, incluindo endere\u00e7os IP.", "message.license.agreements.not.accepted": "Contratos de licen\u00e7a n\u00e3o foram aceitos", "message.listnsp.not.return.providerid": "erro: A API listNetworkServiceProviders n\u00e3o retorna o ID do provedor virtualRouter", "message.load.host.failed": "Falha ao carregar os hosts", +"message.loadbalancer.stickypolicy.configuration": "Personalize a pol\u00edtica de stickiness do balanceador de carga:", +"message.loading.add.interface.static.route": "Adicionando Rota Est\u00e1tica de interface...", +"message.loading.add.network.static.route": "Adicionando Rota Est\u00e1tica de Rede...", +"message.loading.add.policy.rule": "Adicionando regra de Pol\u00edtica...", +"message.loading.add.tungsten.router.table": "Adicionando Tabela de Roteador...", +"message.loading.apply.tungsten.tag": "Aplicando Tag...", +"message.loading.delete.interface.static.route": "Removendo Rota Est\u00e1tica de interface...", +"message.loading.delete.network.static.route": "Removendo Rota Est\u00e1tica de Rede...", +"message.loading.delete.tungsten.policy.rule": "Excluindo regra de Pol\u00edtica...", +"message.loading.delete.tungsten.router.table": "Removendo Tabela de Roteador...", +"message.loading.delete.tungsten.tag": "Removendo Tag...", "message.lock.account": "Confirme se voc\u00ea deseja bloquear esta conta. Bloqueando a conta, todos os usu\u00e1rios desta conta n\u00e3o estar\u00e3o mais habilitados a gerenciar os recursos na nuvem. Os recursos existentes (cloud server) ainda poder\u00e3o ser acessados.", "message.lock.user": "Confirme se voc\u00ea deseja bloquear o usu\u00e1rio \"{user}\". Bloqueando este usu\u00e1rio, o mesmo n\u00e3o estar\u00e1 mais habilitado a gerenciar os recursos na nuvem. Os recursos existentes (cloud server) ainda poder\u00e3o ser acessados.", "message.lock.user.success": "Usu\u00e1rio \"{user}\" bloqueado com sucesso", "message.login.failed": "Falha no login", +"message.list.zone.vmware.datacenter.empty": "Nenhum Datacenter VMware existe na Zona selecionada", "message.memory.usage.info.hypervisor.additionals": "Os dados apresentados podem n\u00e3o refletir o real uso de mem\u00f3ria se a VM n\u00e3o possuir as ferramentas adicionais do virtualizador instaladas", "message.memory.usage.info.negative.value": "Se n\u00e3o for poss\u00edvel obter do hypervisor o uso de mem\u00f3ria da VM, ser\u00e3o desabilitadas as linhas de mem\u00f3ria livre do gr\u00e1fico de dados brutos e de uso de mem\u00f3ria no gr\u00e1fico de percentual", +"message.migrate.instance.host.auto.assign": "O Host para a Inst\u00e2ncia ser\u00e1 escolhido automaticamente com base na adequa\u00e7\u00e3o dentro do mesmo cluster", "message.migrate.instance.to.host": "Por favor confirme que voc\u00ea deseja migrar a inst\u00e2ncia para outro host.", "message.migrate.instance.to.ps": "Por favor confirme que voc\u00ea deseja migrar a inst\u00e2ncia para outro armazenamento prim\u00e1rio.", +"message.migrate.resource.to.ss": "Por favor, confirme que voc\u00ea deseja migrar este recurso para outro armazenamento secund\u00e1rio.", "message.migrate.router.confirm": "Por favor confirme o host que voc\u00ea deseja migrar o roteador para:", "message.migrate.systemvm.confirm": "Por favor confirme o host para o qual voc\u00ea deseja migrar a VM de sistema:", "message.migrate.volume": "Por favor confirme que voc\u00ea deseja migrar o volume \"{volume}\" do armazenamento prim\u00e1rio \"{storage}\" para outro.", "message.migrate.volume.failed": "Falha ao migrar volume", +"message.migrate.volume.pool.auto.assign": "O armazenamento prim\u00e1rio para o volume ser\u00e1 escolhido automaticamente com base na adequa\u00e7\u00e3o e no destino da Inst\u00e2ncia", "message.migrate.volume.processing": "Migrando volume...", +"message.migrate.volume.tooltip": "O volume pode ser migrado para qualquer pool de armazenamento adequado. O administrador deve escolher a oferta de disco apropriada para substituir, que suporte o novo pool de armazenamento", +"message.migrate.with.storage": "Especifique o pool de armazenamento para volumes da Inst\u00e2ncia.", "message.migrating.failed": "Falha na migra\u00e7\u00e3o", "message.migrating.processing": "Migra\u00e7\u00e3o em andamento para", "message.migrating.vm.to.storage.failed": "Falha na migra\u00e7\u00e3o da VM para o armazenamento", @@ -2274,7 +3340,7 @@ "message.network.addvm.desc": "Por favor especifique a rede onde voc\u00ea gostaria de adicionar esta VM. Uma nova NIC ser\u00e1 adicionada a esta rede.", "message.network.description": "Configura\u00e7\u00e3o da rede e do tr\u00e1fego", "message.network.error": "Erro de rede", -"message.network.error.description": "N\u00e3o \u00e9 poss\u00edvel acessar o servidor de gerenciamento ou uma extens\u00e3o do navegador pode estar bloqueando a solicita\u00e7\u00e3o de rede.", +"message.network.error.description": "N\u00e3o \u00e9 poss\u00edvel acessar o Management Server ou uma extens\u00e3o do navegador pode estar bloqueando a solicita\u00e7\u00e3o de rede.", "message.network.hint": "Configure componentes de rede e tr\u00e1fego p\u00fablico/guest/gerenciamento, incluindo endere\u00e7os IP.", "message.network.offering.change.warning": "AVISO: Alterar a oferta causar\u00e1 tempo de inatividade de conectividade para as VMs com NICs na rede.", "message.network.offering.forged.transmits": "O switch deixa qualquer frame de sa\u00edda de um adaptador de m\u00e1quina virtual com um endere\u00e7o MAC de origem diferente daquele do arquivo de configura\u00e7\u00e3o .vmx.\nRejeitar - O switch deixa qualquer frame de sa\u00edda de um adaptador de m\u00e1quina virtual com um endere\u00e7o MAC de origem diferente daquele do arquivo de configura\u00e7\u00e3o .vmx.\nAceitar - O switch n\u00e3o realiza filtragem e permite todos os frames de sa\u00edda.\nNenhum - padr\u00e3o de valor a partir da configura\u00e7\u00e3o global.", @@ -2283,20 +3349,35 @@ "message.network.offering.mac.learning.warning": "AVISO: para usar o MAC Learning voc\u00ea deve assegurar-se de que os virtualizadores dos hosts est\u00e3o rodando ESXi 6.7+ e a rede usa o vSwitch 6.6.0+ distribu\u00eddo.", "message.network.offering.promiscuous.mode": "Se aplica apenas para redes guest no virtualizador VMware.\nRejeitar - O switch deixa qualquer frame de sa\u00edda de um adaptador de m\u00e1quina virtual com um endere\u00e7o MAC de origem diferente daquele do arquivo de configura\u00e7\u00e3o .vmx.\nAceitar - O switch n\u00e3o realiza filtragem e permite todos os frames de sa\u00edda.\nNenhum - padr\u00e3o de valor a partir da configura\u00e7\u00e3o global.", "message.network.removenic": "Por favor, confirme que deseja remover esta interface de rede, esta a\u00e7\u00e3o tamb\u00e9m ir\u00e1 remover a rede associada \u00e0 VM.", +"message.network.restart.required": "Reinicializa\u00e7\u00e3o \u00e9 necess\u00e1ria para rede(s). Clique aqui para ver rede(s) que requerem reinicializa\u00e7\u00e3o.", +"message.network.selection": "Escolha uma ou mais Redes para anexar a Inst\u00e2ncia.", +"message.network.selection.new.network": "Uma nova Rede tamb\u00e9m pode ser criada aqui.", "message.network.secondaryip": "Por favor, confirme que voc\u00ea gostaria de adquirir um novo IP secund\u00e1rio para este NIC. \n NOTA: Voc\u00ea precisa configurar manualmente o IP secund\u00e1rio rec\u00e9m-adquirido dentro da m\u00e1quina virtual.", "message.network.updateip": "Por favor, confirme que voc\u00ea gostaria de mudar o endere\u00e7o IP da NIC em VM.", +"message.network.update.nic": "Por favor, confirme que voc\u00ea gostaria de atualizar esta NIC.", "message.network.usage.info.data.points": "Cada ponto no gr\u00e1fico representa a diferen\u00e7a de dados trafegados desde a \u00faltima coleta de estat\u00edstica realizada (o ponto anterior)", "message.network.usage.info.sum.of.vnics": "O uso de rede apresentado \u00e9 composto pela soma de dados trafegados por todas as vNICs da VM", +"message.new.version.available": "Uma nova vers\u00e3o do CloudStack est\u00e1 dispon\u00edvel. Clique aqui para verificar os detalhes", +"message.nfs.mount.options.description": "Lista separada por v\u00edrgulas de op\u00e7\u00f5es de montagem NFS para hosts KVM. Op\u00e7\u00f5es suportadas : vers=[3,4.0,4.1,4.2], nconnect=[1...16]", "message.no.data.to.show.for.period": "Nenhum dado para mostrar no per\u00edodo selecionado.", "message.no.description": "Nenhuma descri\u00e7\u00e3o inserida.", +"message.offering.internet.protocol.warning": "AVISO: Redes suportadas por IPv6 usam roteamento est\u00e1tico e exigir\u00e3o que rotas upstream sejam configuradas manualmente.", +"message.offering.ipv6.warning": "Por favor, consulte a documenta\u00e7\u00e3o para criar oferta de Rede/VPC habilitada para IPv6 Suporte IPv6 no CloudStack - Redes Isoladas e Camadas de VPC", "message.ovf.configurations": "H\u00e1 propriedades OVF dispon\u00edveis para a personaliza\u00e7\u00e3o do aparelho selecionado. Por favor, edite os valores de forma apropriada.As ofertas incompat\u00edveis de computa\u00e7\u00e3o ser\u00e3o desativadas.", +"message.password.reset.failed": "Falha ao redefinir senha.", +"message.password.reset.success": "A senha foi redefinida com sucesso. Por favor, fa\u00e7a login usando suas novas credenciais.", +"message.path": "Caminho : ", "message.path.description": "NFS: caminho exportado do servidor. VMFS: /datacenter name/datastore name. SharedMountPoint: caminho onde o armazenamento prim\u00e1rio \u00e9 montado, tal como /mnt/primary", "message.please.confirm.remove.ssh.key.pair": "Por favor, confirme que voc\u00ea deseja remover este par de chaves SSH", +"message.please.confirm.remove.user.data": "Por favor, confirme que voc\u00ea deseja remover este Userdata", "message.please.enter.valid.value": "Por favor, insira um valor v\u00e1lido", "message.please.enter.value": "Por favor, insira valores", +"message.please.wait.while.autoscale.vmgroup.is.being.created": "Por favor, aguarde enquanto seu Grupo de AutoScale est\u00e1 sendo criado; isso pode levar um tempo...", "message.please.wait.while.zone.is.being.created": "Por favor, espere enquanto sua zona est\u00e1 sendo criada; isto pode demorar um pouco...", "message.pod.dedicated": "Pod dedicado", "message.pod.dedication.released": "Pod dedicado liberado", +"message.prepare.for.shutdown": "Por favor, confirme que voc\u00ea gostaria de preparar este Management Server para desligamento. Ele n\u00e3o aceitar\u00e1 nenhum novo job Ass\u00edncrono, mas N\u00c3O terminar\u00e1 ap\u00f3s n\u00e3o haver jobs pendentes.", +"message.primary.storage.invalid.state": "Armazenamento prim\u00e1rio n\u00e3o est\u00e1 no estado Up", "message.processing.complete": "Processamento conclu\u00eddo!", "message.protocol.description": "Para XenServer, escolha NFS, iSCSI, ou PreSetup. para KVM, escolha NFS, SharedMountPoint, RDB, CLVM ou Gluster. para vSphere, escolha NFS, PreSetup (VMFS, iSCSI, fiberChannel, vSAN ou vVols) ou datastoreCluster. para Hyper-V, escolha SMB/CIFS. para LXC, escolha NFS ou SharedMountPoint. para OVM, escolha NFS ou ocfs2.", "message.public.traffic.in.advanced.zone": "O tr\u00e1fego p\u00fablico \u00e9 gerado quando as VMs na nuvem acessam a internet. Os IPs acess\u00edveis ao p\u00fablico devem ser alocados para essa finalidade. Os usu\u00e1rios finais podem usar a interface do usu\u00e1rio CloudStack para adquirir esses IPs afim de implementar NAT entre a sua rede de guests e sua rede p\u00fablica.

    Forne\u00e7a pelo menos um intervalo de endere\u00e7os IP para o tr\u00e1fego de internet.", @@ -2324,6 +3405,11 @@ "message.remove.ldap": "Voc\u00ea tem certeza que deseja deletar a configura\u00e7\u00e3o LDAP?", "message.remove.nic.processing": "Removendo NIC...", "message.remove.port.forward.failed": "Falha ao remover regra de encaminhamento de porta", +"message.remove.router.table.from.interface": "Por favor, confirme que voc\u00ea deseja remover a Tabela de Roteamento desta NIC", +"message.remove.router.table.from.interface.failed": "Remo\u00e7\u00e3o da Tabela de Roteamento da interface falhou", +"message.remove.routing.firewall.rule.failed": "Falha ao remover regra de firewall de Roteamento IPv4", +"message.remove.routing.firewall.rule.processing": "Removendo regra de firewall de Roteamento IPv4...", +"message.remove.routing.firewall.rule.success": "Regra de firewall de Roteamento IPv4 removida", "message.remove.rule.failed": "Falha ao remover regra", "message.remove.secondary.ipaddress.processing": "Removendo endere\u00e7o IP secund\u00e1rio...", "message.remove.securitygroup.rule.processing": "Removendo regra do grupo de seguran\u00e7a...", @@ -2332,10 +3418,12 @@ "message.remove.vpc": "Favor confirmar que voc\u00ea deseja remover a VPC", "message.request.failed": "Falha na solicita\u00e7\u00e3o", "message.required.add.least.ip": "Por favor, adicionar pelo menos UM intervalo IP", +"message.required.tagged.physical.network": "S\u00f3 pode haver uma rede f\u00edsica n\u00e3o marcada com tipo de tr\u00e1fego convidado.", "message.required.traffic.type": "Erro na configura\u00e7\u00e3o! Todos os tipos de tr\u00e1fego necess\u00e1rios devem ser adicionados e com m\u00faltiplas redes f\u00edsicas cada rede deve ter uma etiqueta.", "message.reset.vpn.connection": "Favor confirmar que voc\u00ea deseja reinicializar a conex\u00e3o VPN", "message.linstor.resourcegroup.description": "Grupo de recursos Linstor a ser usado para armazenamento prim\u00e1rio", "message.resize.volume.failed": "Falha ao redimensionar volume", +"message.resize.volume.processing": "Redimensionamento de volume est\u00e1 em andamento", "message.resource.not.found": "Recurso n\u00e3o encontrado", "message.restart.mgmt.server": "Reinicie o(s) servidor(es) de gerenciamento para que a nova configura\u00c3\u00a7\u00c3\u00a3o tenha efeito.", "message.restart.network": "Por favor confirme que voc\ufffd deseja reiniciar a rede", @@ -2343,24 +3431,47 @@ "message.restart.vpc": "Favor confirmar que voc\u00ea deseja reiniciar a VPC", "message.restart.vpc.remark": "Por favor, confirme a reinicializa\u00e7\u00e3o do VPC

    Observa\u00e7\u00e3o: fazendo um VPC redundante n\u00e3o redundante ir\u00e1 for\u00e7ar uma limpeza. As redes n\u00e3o estar\u00e3o dispon\u00edveis por alguns minutos.

    ", "message.scale.processing": "Escalonamento em progresso", +"message.scaledown.policies": "Por favor, adicione pelo menos uma pol\u00edtica de ScaleDown. O Grupo de AutoScale ser\u00e1 reduzido quando todas as condi\u00e7\u00f5es em uma pol\u00edtica de ScaleDown forem atendidas. As pol\u00edticas de ScaleDown ser\u00e3o verificadas ap\u00f3s as pol\u00edticas de ScaleUp.", +"message.scaledown.policy.continue": "Por favor, adicione pelo menos uma condi\u00e7\u00e3o \u00e0 pol\u00edtica de ScaleDown para continuar", +"message.scaledown.policy.duration.continue": "Por favor, insira uma dura\u00e7\u00e3o v\u00e1lida para a pol\u00edtica de ScaleDown para continuar", +"message.scaledown.policy.name.continue": "Por favor, insira um nome para a pol\u00edtica de ScaleDown para continuar", +"message.scaleup.policies": "Por favor, adicione pelo menos uma pol\u00edtica de ScaleUp. O Grupo de AutoScale ser\u00e1 aumentado quando todas as condi\u00e7\u00f5es em uma pol\u00edtica de ScaleUp forem atendidas. As pol\u00edticas de ScaleUp ser\u00e3o verificadas antes das pol\u00edticas de ScaleDown.", +"message.scaleup.policy.continue": "Por favor, adicione pelo menos uma condi\u00e7\u00e3o \u00e0 pol\u00edtica de ScaleUp para continuar", +"message.scaleup.policy.duration.continue": "Por favor, insira uma dura\u00e7\u00e3o v\u00e1lida para a pol\u00edtica de ScaleUp para continuar", +"message.scaleup.policy.name.continue": "Por favor, insira um nome para a pol\u00edtica de ScaleUp para continuar", "message.select.a.zone": "A zona tipicamente corresponde a um \u00fanico datacenter. M\u00faltiplas zonas auxiliam a nuvem a ser mais confi\u00e1vel provendo isolamento f\u00edsico e redund\u00e2ncia.", "message.select.affinity.groups": "Por favor, selecione quaisquer grupos de afinidade que voc\u00ea deseja que esta VM perten\u00e7a:", +"message.select.bgp.peers": "Por favor, selecione / desmarque os pares BGP associados \u00e0 rede ou VPC:", "message.select.deselect.desired.options": "Por favor, selecione / desselecione as op\u00e7\u00f5es desejadas", +"message.select.deselect.to.sort": "Por favor, selecione / desmarque para ordenar os valores", "message.select.destination.image.stores": "Por favor, selecione o(s) armazenamento(s) de imagem(ns) para os quais os dados devem ser migrados", "message.select.disk.offering": "Por favor, selecione uma oferta de disco para o disco", "message.select.end.date.and.time": "Selecione uma data e hor\u00e1rio final.", +"message.select.kvm.host.instance.conversion": "(Opcional) Selecione um host KVM no cluster para realizar a convers\u00e3o da inst\u00e2ncia atrav\u00e9s do virt-v2v", +"message.select.load.balancer.rule": "Por favor, selecione uma regra de balanceamento de carga para o seu Grupo de escalonamento automatico.", "message.select.migration.policy": "Por favor, selecione uma pol\u00edtica de migra\u00e7\u00e3o", "message.select.nic.network": "Por favor, selecione uma rede para o NIC", "message.select.security.groups": "Por favor selecione o(s) grupo(s) de seguran\u00e7a para sua nova VM", "message.select.start.date.and.time": "Selecione uma data e hor\u00e1rio inicial.", +"message.select.temporary.storage.instance.conversion": "(Opcional) Selecione um destino tempor\u00e1rio de Armazenamento para os discos convertidos atrav\u00e9s do virt-v2v", +"message.select.volume.to.continue": "Por favor, selecione um volume para continuar.", "message.select.zone.description": "Selecione o tipo de zona b\u00e1sica/avan\u00e7ada", "message.select.zone.hint": "Este \u00e9 o tipo de implanta\u00e7\u00e3o de zona que voc\u00ea deseja utilizar. Zona b\u00e1sica: fornece uma \u00fanica rede na qual para cada inst\u00e2ncia de VM \u00e9 atribu\u00eddo um IP diretamente da rede. O isolamento do guest pode ser fornecido atrav\u00e9s de meios da camada 3, tais como grupos de seguran\u00e7a (filtragem de source IP). Zona avan\u00e7ada: para topologias de rede mais sofisticadas. este modelo de rede oferece maior flexibilidade na defini\u00e7\u00e3o de redes guest e oferece ofertas de rede personalizadas, como firewall, VPN, ou suporte de balanceamento de carga.", +"message.select.vm.to.continue": "Por favor, selecione uma inst\u00e2ncia para continuar", +"message.server": "Servidor : ", "message.server.description": "NFS, iSCSI, ou PreSetup: endere\u00e7o IP ou nome DNS do dispositivo de armazenamento. VMWare PreSetup: endere\u00e7o IP ou nome DNS do servidor vCenter. Linstor: URL HTTP(S) do linstor-controller.", "message.set.default.nic": "Por favor confirme que voc\u00ea quer tornar este NIC o padr\u00e3o para esta VM,", "message.set.default.nic.manual": "Por favor atualize manualmente o NIC padr\u00e3o desta VM agora.", "message.setting.updated": "Configura\u00e7\u00e3o atualizada:", +"message.setting.update.delay": "O novo valor entrar\u00e1 em vigor em 30 segundos.", "message.setup.physical.network.during.zone.creation": "Ao adicionar uma zona avan\u00e7ada, \u00e9 preciso configurar uma ou mais redes f\u00edsicas. Cada rede corresponde \u00e0 uma interface de rede no virtualizador. Cada rede f\u00edsica pode ser utilizada para transportar um ou mais tipos de tr\u00e1fego, com certas restri\u00e7\u00f5es sobre como eles podem ser combinados.
    Arraste e solte um ou mais tipos de tr\u00e1fego em cada rede f\u00edsica.", "message.setup.physical.network.during.zone.creation.basic": "Ao adicionar uma zona b\u00e1sica, \u00e9 poss\u00edvel configurar uma rede f\u00edsica, que corresponde a uma interface de rede no virtualizador. A rede carrega diversos tipos de tr\u00e1fego.

    \u00c9 poss\u00edvel adicionar e remover outros tipos de tr\u00e1fego na mesma interface de rede f\u00edsica.", +"message.shared.network.offering.warning": "Administradores de dom\u00ednio e usu\u00e1rios regulares s\u00f3 podem criar Redes compartilhadas a partir de ofertas de Rede com a configura\u00e7\u00e3o specifyvlan=false. Por favor, contate um administrador para criar uma oferta de Rede se esta lista estiver vazia.", +"message.shared.network.unsupported.for.nsx": "Redes compartilhadas n\u00e3o s\u00e3o suportadas para zonas habilitadas para NSX", +"message.shutdown.triggered": "Um desligamento foi acionado. CloudStack n\u00e3o aceitar\u00e1 novos jobs", +"message.snapshot.additional.zones": "Snapshots sempre ser\u00e3o criados em sua zona nativa - %x, aqui voc\u00ea pode selecionar zona(s) adicional(is) para onde ela ser\u00e1 copiada no momento da cria\u00e7\u00e3o", +"message.sourcenatip.change.inhibited": "Alterar o sourcenat para este IP da Rede para este endere\u00e7o est\u00e1 inibido, pois regras de firewall est\u00e3o definidas para ele. Isso pode incluir regras de encaminhamento de porta ou balanceamento de carga.\n - Se esta for uma Rede Isolada, por favor use updateNetwork/clique no bot\u00e3o editar.\n - Se esta for uma VPC, primeiro limpe todas as outras regras para este endere\u00e7o.", +"message.sourcenatip.change.warning": "AVISO: Alterar o endere\u00e7o IP sourcenat da rede causar\u00e1 tempo de inatividade de conectividade para as Inst\u00e2ncias com NICs na Rede.", "message.specify.tag.key": "Por favor, especifique uma chave de etiqueta", "message.specify.tag.value": "Por favor, especifique um valor para a etiqueta", "message.step.2.continue": "Selecione o plano", @@ -2368,55 +3479,101 @@ "message.step.4.continue": "Selecione pelo menos uma rede para continuar", "message.step.license.agreements.continue": "Por favor, aceite todos os termos de licen\u00e7a para continuar", "message.success.acquire.ip": "IP adquirido com sucesso", +"message.success.add.bgp.peer": "Novo par BGP adicionado com sucesso", "message.success.add.egress.rule": "Nova regra de sa\u00edda adicionada com sucesso", "message.success.add.firewall.rule": "Nova regra do firewall adicionada com sucesso", "message.success.add.guest.network": "Rede guest criada com sucesso", +"message.success.add.interface.static.route": "Rota Est\u00e1tica de interface adicionada com sucesso", +"message.success.add.ip.v6.prefix": "Prefixo IPv6 adicionado com sucesso", "message.success.add.iprange": "Intervalo IP adicionado com sucesso", +"message.success.add.ipv4.subnet": "Sub-rede IPv4 adicionada com sucesso", +"message.success.add.ipv4.subnet.for.guest.network": "Sub-rede IPv4 para rede guest adicionada com sucesso", "message.success.add.kuberversion": "Vers\u00e3o do Kubernetes adicionado com sucesso", +"message.success.add.logical.router": "Roteador L\u00f3gico adicionado com sucesso", "message.success.add.network": "Rede adicionada com sucesso", "message.success.add.network.acl": "Lista ACL da rede adicionada com sucesso", +"message.success.add.network.permissions": "Permiss\u00f5es de Rede adicionadas com sucesso", +"message.success.add.network.static.route": "Rota Est\u00e1tica de Rede adicionada com sucesso", +"message.success.add.object.storage": "Object Storage adicionado com sucesso", +"message.success.add.physical.network": "Rede F\u00edsica adicionada com sucesso", +"message.success.add.policy.rule": "Regra de Pol\u00edtica adicionada com sucesso", +"message.success.add.router.table.to.instance": "Tabela de Roteador adicionada \u00e0 Inst\u00e2ncia com sucesso", "message.success.add.port.forward": "Nova regra de encaminhamento de porta adicionada com sucesso", "message.success.add.private.gateway": "Gateway privado adicionado com sucesso", "message.success.add.rule": "Nova regra adicionada com sucesso", "message.success.add.secondary.ipaddress": "IP secund\u00e1rio adicionado com sucesso", "message.success.add.static.route": "Rota est\u00e1tica adicionada com sucesso", "message.success.add.tag": "Etiqueta adicionada com sucesso", +"message.success.add.tungsten.router.table": "Tabela de Roteador adicionada com sucesso", +"message.success.add.tungsten.routing.policy": "Pol\u00edtica de roteamento Tungsten-Fabric adicionada com sucesso", +"message.success.add.vpc": "Uma Nuvem Privada Virtual adicionada com sucesso", "message.success.add.vpc.network": "Rede VPC adicionada com sucesso", "message.success.add.vpn.customer.gateway": "Gateway da VPN do cliente adicionado com sucesso", "message.success.add.vpn.gateway": "Gateway da VPN adicionado com sucesso", "message.success.assign.vm": "VM atribu\u00edda com sucesso", +"message.success.assign.volume": "Volume atribu\u00eddo com sucesso", +"message.success.apply.network.policy": "Pol\u00edtica de Rede aplicada com sucesso", +"message.success.apply.tungsten.tag": "Tag aplicada com sucesso", +"message.success.asign.vm": "Inst\u00e2ncia atribu\u00edda com sucesso", "message.success.assigned.vms": "VMs atribu\u00eddas com sucesso", "message.success.certificate.upload": "Certificado carregado com sucesso", "message.success.change.affinity.group": "Grupos de afinidade alterados com sucesso", +"message.success.change.bgp.peers": "Pares BGP alterados com sucesso", "message.success.change.offering": "Oferta alterada com sucesso", "message.success.change.password": "Senha alterada com sucesso", "message.success.change.host.password": "Senha do host \"{name}\" foi alterada com sucesso", +"message.success.change.scope": "Escopo alterado com sucesso para o pool de armazenamento", +"message.success.clear.webhook.deliveries": "Entregas de webhook limpas com sucesso", +"message.success.config.health.monitor": "Monitor de Sa\u00fade Configurado com Sucesso", +"message.success.config.vm.schedule": "Agendamento de Inst\u00e2ncia configurado com sucesso", "message.success.config.backup.schedule": "Agendamento de backup de VM configurado com sucesso", "message.success.config.sticky.policy": "Sticky policy configurada com sucesso", "message.success.copy.clipboard": "Copiado com sucesso para a \u00e1rea de transfer\u00eancia", "message.success.create.account": "Conta criada com sucesso", +"message.success.create.asnrange": "Faixa AS criada com sucesso", +"message.success.create.bucket": "Bucket criado com sucesso", +"message.success.create.gui.theme": "Tema da GUI \"{guiTheme}\" criado com sucesso", "message.success.create.internallb": "LB interno criado com sucesso", "message.success.create.isolated.network": "Rede isolada criada com sucesso", "message.success.create.keypair": "Par de chaves SSH criado com sucesso", -"message.success.create.kubernetes.cluter": "Cluster Kubernetes criado com sucesso", +"message.success.create.kubernetes.cluster": "Cluster Kubernetes criado com sucesso", "message.success.create.l2.network": "Rede L2 criada com sucesso", +"message.success.create.password": "Par de chave de acesso \u00e0 API criada com sucesso", +"message.success.create.sharedfs": "Sistema de Arquivos Compartilhado criado com sucesso", "message.success.create.snapshot.from.vmsnapshot": "Snapshot de volume a partir da snapshot de VM criada com sucesso", +"message.success.create.template": "Template criado com sucesso", "message.success.create.user": "Usu\u00e1rio criado com sucesso", "message.success.create.volume": "Volume criado com sucesso", +"message.success.create.webhook": "Webhook criado com sucesso", +"message.success.dedicate.bgp.peer": "Par BGP dedicado com sucesso", +"message.success.dedicate.ipv4.subnet": "Sub-rede IPv4 dedicada com sucesso", "message.success.delete": "Exclu\u00eddo com sucesso", "message.success.delete.acl.rule": "Regra ACL removida com sucesso", +"message.success.delete.asnrange": "Faixa AS exclu\u00edda com sucesso", +"message.success.delete.backup.schedule": "Agendamento de Backup de Inst\u00e2ncia exclu\u00eddo com sucesso", +"message.success.delete.bgp.peer": "Par BGP exclu\u00eddo com sucesso", "message.success.delete.icon": "\u00cdcone deletado com sucesso", +"message.success.delete.interface.static.route": "Rota Est\u00e1tica de interface removida com sucesso", +"message.success.delete.ipv4.subnet": "Sub-rede IPv4 removida com sucesso", +"message.success.delete.keypair": "Par de chave de API deletada com sucesso", +"message.success.delete.network.static.route": "Rota Est\u00e1tica de Rede removida com sucesso", "message.success.delete.node": "Nodo exclu\u00eddo com sucesso", "message.success.delete.snapshot.policy": "Pol\u00edtica de snapshot exclu\u00edda com sucesso", "message.success.delete.static.route": "Rota est\u00e1tica exclu\u00edda com sucesso", "message.success.delete.tag": "Tag exclu\u00edda com sucesso", +"message.success.delete.tungsten.policy.rule": "Regra de Pol\u00edtica exclu\u00edda com sucesso", +"message.success.delete.tungsten.router.table": "Tabela de Roteador removida com sucesso", +"message.success.delete.tungsten.tag": "Tag removida com sucesso", "message.success.delete.vm": "VM remov\u00edda com sucesso", "message.success.disable.saml.auth": "Autoriza\u00e7\u00e3o SAML desativada com sucesso", "message.success.disable.vpn": "VPN desativada com sucesso", "message.success.edit.acl": "Regra ACL editada com sucesso", +"message.success.edit.primary.storage": "Armazenamento Prim\u00e1rio editado com sucesso", "message.success.edit.rule": "Regra editada com sucesso", "message.success.enable.saml.auth": "Autoriza\u00e7\u00e3o SAML ativada com sucesso", "message.success.import.instance": "Inst\u00e2ncia importada com sucesso", +"message.success.import.volume": "Volume importado com sucesso", +"message.success.migration": "Migra\u00e7\u00e3o conclu\u00edda com sucesso", "message.success.migrate.volume": "Volume migrado com sucesso", "message.success.migrating": "Migra\u00e7\u00e3o conclu\u00edda com sucesso para", "message.success.move.acl.order": "Regra de ACL movida com sucesso", @@ -2424,25 +3581,47 @@ "message.success.register.iso": "ISO registrado com sucesso", "message.success.register.keypair": "Par de chaves SSH registrado com sucesso", "message.success.register.template": "Template cadastrado com sucesso", +"message.success.register.user.data": "Userdata registrado com sucesso", +"message.success.register.user.keypair": "Novo par de chave de API criado com sucesso", +"message.success.release.dedicated.bgp.peer": "Par BGP dedicado liberado com sucesso", +"message.success.release.dedicated.ipv4.subnet": "Sub-rede IPv4 dedicada liberada com sucesso", "message.success.release.ip": "IP liberado com sucesso", "message.success.remove.egress.rule": "Regra de sa\u00edda removida com sucesso", "message.success.remove.firewall.rule": "Regra de firewall removida com sucesso", "message.success.remove.instance.rule": "Inst\u00e2ncia removida da regra", "message.success.remove.ip": "IP removido com sucesso", "message.success.remove.iprange": "Intervalo de IP removido com sucesso", +"message.success.remove.logical.router": "Roteador L\u00f3gico removido com sucesso", +"message.success.remove.network.permissions": "Permiss\u00f5es de Rede removidas com sucesso", +"message.success.remove.network.policy": "Pol\u00edtica de Rede removida com sucesso", "message.success.remove.nic": "NIC removida com sucesso", +"message.success.remove.objectstore.directory": "Diret\u00f3rio selecionado removido com sucesso", +"message.success.remove.objectstore.objects": "Objeto(s) selecionado(s) removido(s) com sucesso", "message.success.remove.port.forward": "Regra de encaminhamento de porta removida com sucesso", +"message.success.remove.router.table.from.interface": "Tabela de Roteador removida da interface com sucesso", "message.success.remove.rule": "Regra exclu\u00edda com sucesso", "message.success.remove.secondary.ipaddress": "Endere\u00e7o de IP secund\u00e1rio removido com sucesso", "message.success.remove.sticky.policy": "Sticky policy removida com sucesso", +"message.success.remove.tungsten.routing.policy": "Pol\u00edtica de Roteamento Tungsten-Fabric removida da Rede com sucesso", +"message.success.reset.network.permissions": "Permiss\u00f5es de Rede redefinidas com sucesso", "message.success.resize.volume": "Volume redimensionado com sucesso", "message.success.scale.kubernetes": "Cluster Kubernetes escalonado com sucesso", "message.success.unmanage.instance": "Inst\u00e2ncia n\u00e3o gerenciada com sucesso", +"message.success.unmanage.volume": "Volume n\u00e3o gerenciado com sucesso", +"message.success.update.account": "Conta atualizada com sucesso", +"message.success.update.bgp.peer": "Par BGP atualizado com sucesso", +"message.success.update.bucket": "Bucket atualizado com sucesso", +"message.success.update.condition": "Condi\u00e7\u00e3o atualizada com sucesso", +"message.success.update.gui.theme": "Tema da GUI \"{guiTheme}\" atualizado com sucesso", "message.success.update.ipaddress": "Endere\u00e7o IP atualizado com sucesso", "message.success.update.iprange": "Intervalo de IP atualizado com sucesso", +"message.success.update.ipv4.subnet": "Sub-rede IPv4 atualizada com sucesso", "message.success.update.kubeversion": "Vers\u00e3o compat\u00edvel com Kubernetes atualizada com sucesso", "message.success.update.network": "Rede atualizada com sucesso", +"message.success.update.nic": "NIC atualizada com sucesso", "message.success.update.user": "Usu\u00e1rio atualizado com sucesso", +"message.success.update.sharedfs": "Sistema de Arquivos Compartilhado atualizado com sucesso", +"message.success.update.template": "Template atualizado com sucesso", "message.success.upgrade.kubernetes": "Cluster do Kubernetes atualizado com sucesso", "message.success.upload": "Carregado com sucesso", "message.success.upload.description": "Este arquivo de ISO foi carregado. Verifique seu status no menu Imagens > ISOs. Verifique seu status no menu templates", @@ -2453,14 +3632,43 @@ "message.suspend.project": "Voc\u00ea tem certeza que deseja suspender este projeto?", "message.sussess.discovering.feature": "Descoberto todos os recursos dispon\u00edveis!", "message.switch.to": "Transferido para", +"message.template.arch": "Por favor, selecione uma arquitetura de Template.", "message.template.desc": "Imagem de SO que pode ser utilizada para bootar VMs", "message.template.import.vm.temporary": "Se um template tempor\u00e1rio for usado, a opera\u00e7\u00e3o de redefini\u00e7\u00e3o da VM n\u00e3o funcionar\u00e1 ap\u00f3s a importa\u00e7\u00e3o.", "message.template.iso": "Selecione o template ou ISO para continuar", +"message.template.type.change.warning": "AVISO: Alterar o tipo de Template para SYSTEM desativar\u00e1 futuras altera\u00e7\u00f5es no Template.", +"message.test.webhook.delivery": "Testar entrega para o Webhook com um payload opcional", "message.tooltip.reserved.system.netmask": "O prefixo de rede que define a subrede deste pod. utilize a nota\u00e7\u00e3o CIDR.", +"message.traffic.type.deleted": "Tipo de tr\u00e1fego exclu\u00eddo com sucesso", +"message.trigger.shutdown": "Por favor, confirme que voc\u00ea gostaria de acionar um desligamento neste Management Server. Ele n\u00e3o aceitar\u00e1 nenhum novo job Ass\u00edncrono e terminar\u00e1 ap\u00f3s n\u00e3o haver jobs pendentes.", +"message.two.fa.auth": "Abra o aplicativo de autentica\u00e7\u00e3o de dois fatores no seu dispositivo m\u00f3vel para visualizar seu c\u00f3digo de autentica\u00e7\u00e3o.", +"message.two.fa.auth.register.account": "Abra o aplicativo de autentica\u00e7\u00e3o de dois fatores e escaneie o c\u00f3digo QR para adicionar a Conta de Usu\u00e1rio.", +"message.two.fa.auth.staticpin": "
    Voc\u00ea configurou 2FA para verifica\u00e7\u00e3o de seguran\u00e7a.
    Insira o PIN est\u00e1tico gerado durante a configura\u00e7\u00e3o do 2FA para verificar.", +"message.two.fa.auth.totp": "
    Voc\u00ea configurou 2FA para verifica\u00e7\u00e3o de seguran\u00e7a.
    Abra o aplicativo autenticador TOTP no seu dispositivo e insira o c\u00f3digo de autentica\u00e7\u00e3o.", +"message.two.fa.login.page": "A autentica\u00e7\u00e3o de dois fatores (2FA) est\u00e1 ativada na sua Conta, voc\u00ea precisa selecionar um provedor 2FA e configurar. 2FA \u00e9 uma camada extra de seguran\u00e7a para sua conta. Uma vez que a configura\u00e7\u00e3o seja feita, em cada login voc\u00ea ser\u00e1 solicitado a inserir o c\u00f3digo 2FA.
    ", +"message.two.fa.register.account": "1. Abra o aplicativo autenticador TOTP no seu dispositivo.
    2. Escaneie o c\u00f3digo QR abaixo para adicionar o Usu\u00e1rio.
    3. Se voc\u00ea n\u00e3o conseguir escanear o c\u00f3digo QR, insira a chave de configura\u00e7\u00e3o manualmente.
    4. A verifica\u00e7\u00e3o do c\u00f3digo 2FA \u00e9 obrigat\u00f3ria para completar a configura\u00e7\u00e3o 2FA.", +"message.two.fa.register.account.login.page": "1. Abra o aplicativo autenticador TOTP no seu dispositivo.
    2. Escaneie o c\u00f3digo QR abaixo para adicionar o Usu\u00e1rio.
    3. Se voc\u00ea n\u00e3o conseguir escanear o c\u00f3digo QR, insira a chave de configura\u00e7\u00e3o manualmente.
    4. Verifique o c\u00f3digo 2FA para continuar para o login.", +"message.two.fa.setup.page": "A autentica\u00e7\u00e3o de dois fatores (2FA) \u00e9 uma camada extra de seguran\u00e7a para sua conta.
    Uma vez que a configura\u00e7\u00e3o seja feita, em cada login voc\u00ea ser\u00e1 solicitado a inserir o c\u00f3digo 2FA.
    ", +"message.two.fa.static.pin.part1": "Se voc\u00ea n\u00e3o conseguir escanear o c\u00f3digo QR, ", +"message.two.fa.static.pin.part2": "Clique aqui para visualizar o c\u00f3digo secreto", +"message.two.fa.staticpin": "1. Use o PIN est\u00e1tico gerado como c\u00f3digo 2FA para autentica\u00e7\u00e3o de dois fatores.
    2. Salve este PIN est\u00e1tico / c\u00f3digo 2FA e n\u00e3o o compartilhe. Este c\u00f3digo ser\u00e1 usado para logins subsequentes.
    3. A verifica\u00e7\u00e3o do c\u00f3digo 2FA \u00e9 obrigat\u00f3ria para completar a configura\u00e7\u00e3o 2FA.", +"message.two.fa.staticpin.login.page": "1. Use o PIN est\u00e1tico gerado como c\u00f3digo 2FA para autentica\u00e7\u00e3o de dois fatores.
    2. Salve este PIN est\u00e1tico / c\u00f3digo 2FA e n\u00e3o o compartilhe. Este c\u00f3digo ser\u00e1 usado para logins subsequentes.
    3. Verifique o c\u00f3digo 2FA para continuar para o login.", +"message.two.fa.view.setup.key": "Clique aqui para visualizar a chave de configura\u00e7\u00e3o", +"message.two.fa.view.static.pin": "Clique aqui para visualizar o PIN est\u00e1tico", +"message.two.factor.authorization.failed": "Incapaz de verificar 2FA com o c\u00f3digo fornecido, por favor tente novamente.", +"message.type.values.to.add": "Por favor, adicione valores adicionais digitando-os", "message.traffic.type.to.basic.zone": "Tipo de tr\u00e1fego para a zona b\u00e1sica", +"message.update.autoscale.policy.failed": "Falha ao atualizar pol\u00edtica de AutoScale", +"message.update.autoscale.vm.profile.failed": "Falha ao atualizar perfil de Inst\u00e2ncia de AutoScale", +"message.update.autoscale.vmgroup.failed": "Falha ao atualizar grupo de AutoScale", +"message.update.condition.failed": "Falha ao atualizar condi\u00e7\u00e3o", +"message.update.condition.processing": "Atualizando condi\u00e7\u00e3o...", +"message.update.failed": "Atualiza\u00e7\u00e3o falhou", +"message.update.nic.processing": "Atualizando NIC...", "message.update.ipaddress.processing": "Atualizando endere\u00e7o IP...", "message.update.resource.count": "Por favor confirme que voc\u00ea quer atualizar a contagem de recursos para esta conta.", "message.update.resource.count.domain": "Por favor, confirme que voc\u00ea deseja atualizar as contagens de recursos para este dom\u00ednio.", +"message.update.resource.limit.max.untagged.error": "Limite n\u00e3o marcado %x \u00e9 %y. Por favor, especifique limite para tag '%z' menor ou igual a esse", "message.update.ssl": "Envie o novo certificado SSL X.509 para ser atualizado em cada console proxy:", "message.upload.failed": "Falha ao fazer o carregamento", "message.upload.file.limit": "Apenas um arquivo pode ser carregado de cada vez", @@ -2475,6 +3683,7 @@ "message.validate.maxlength": "Por favor entre com mais de [0] caracteres.", "message.validate.minlength": "Por favor entre com pelo menos [0] caracteres.", "message.validate.number": "Por favor entre um n\u00famero v\u00e1lido.", +"message.validate.positive.number": "Por favor, insira um n\u00famero positivo v\u00e1lido.", "message.validate.range": "Por favor entre com um valor com valor entre [0] e [1].", "message.validate.range.length": "Por favor entre com um valor com tamanho entre [0] e [1] caracteres.", "message.virtual.router.not.return.elementid": "erro: A API listVirtualRouterElements n\u00e3o retorna o ID do elemento do roteador virtual", @@ -2489,6 +3698,20 @@ "message.vm.state.stopped": "A VM est\u00e1 parada", "message.vm.state.stopping": "A VM est\u00e1 sendo parada", "message.vm.state.unknown": "O estado da VM \u00e9 desconhecido.", +"message.vnf.appliance.networks": "Por favor, selecione as redes para o novo appliance VNF.", +"message.vnf.credentials.change": "Por favor, altere a(s) senha(s) do appliance VNF imediatamente.", +"message.vnf.credentials.default": "A(s) credencial(is) padr\u00e3o do appliance VNF", +"message.vnf.credentials.in.template.vnf.details": "Por favor, encontre as credenciais padr\u00e3o para este VNF nos detalhes do template VNF.", +"message.vnf.error.deviceid.should.be.consecutive": "O deviceid das NICs VNF selecionadas deve ser consecutivo.", +"message.vnf.error.network.is.already.used": "A Rede foi usada por v\u00e1rias NICs do novo appliance VNF.", +"message.vnf.error.network.should.be.used": "Todas as redes selecionadas devem ser usadas como Nics VNF", +"message.vnf.error.no.networks": "Por favor, selecione as redes para o novo appliance VNF.", +"message.vnf.error.no.network.for.required.deviceid": "Por favor, selecione uma Rede para a NIC obrigat\u00f3ria do novo appliance VNF.", +"message.vnf.nic.move.down.fail": "Falha ao mover esta NIC para baixo", +"message.vnf.nic.move.up.fail": "Falha ao mover esta NIC para cima", +"message.vnf.no.credentials": "Nenhuma credencial encontrada para o appliance VNF.", +"message.vnf.select.networks": "Por favor, selecione a rede relevante para cada NIC VNF.", +"message.volume.state.primary.storage.suitability": "A adequa\u00e7\u00e3o de um armazenamento prim\u00e1rio para um volume depende da oferta de disco do volume e da aloca\u00e7\u00e3o da m\u00e1quina virtual (se o volume estiver anexado a uma m\u00e1quina virtual).", "message.volume.state.allocated": "O volume foi alocado, mas ainda n\u00e3o foi criado", "message.volume.state.attaching": "O volume est\u00e1 anexado a um volume do estado pronto.", "message.volume.state.copying": "O volume est\u00e1 sendo copiado do armazenamento de imagens para o armazenamento prim\u00e1rio, no caso de ser um volume carregado", @@ -2508,12 +3731,20 @@ "message.volume.state.uploaderror": "O carregamento do volume encontrou um erro", "message.volume.state.uploadinprogress": "Carregamento do volume em progresso", "message.volume.state.uploadop": "A opera\u00e7\u00e3o de carregamento de volume est\u00e1 em andamento", +"message.volumes.managed": "Volumes controlados pelo CloudStack.", +"message.volumes.unmanaged": "Volumes n\u00e3o controlados pelo CloudStack.", +"message.vpc.restart.required": "Reinicializa\u00e7\u00e3o \u00e9 necess\u00e1ria para VPC(s). Clique aqui para ver VPC(s) que requerem reinicializa\u00e7\u00e3o.", "message.vr.alert.upon.network.offering.creation.others": "Como nenhum dos servi\u00e7os obrigat\u00f3rios para cria\u00e7\u00e3o do VR (VPN, DHCP, DNS, Firewall, LB, UserData, SourceNat, StaticNat, PortForwarding) foram habilitados, o VR n\u00e3o ser\u00e1 criado e a oferta de computa\u00e7\u00e3o n\u00e3o ser\u00e1 usada.", +"message.warn.change.primary.storage.scope": "Este recurso \u00e9 testado e suportado para as seguintes configura\u00e7\u00f5es:
    KVM - NFS/Ceph - DefaultPrimary
    VMware - NFS - DefaultPrimary
    *Pode haver etapas extras envolvidas para faz\u00ea-lo funcionar para outras configura\u00e7\u00f5es.", "message.warn.filetype": "jpg, jpeg, png, bmp e svg s\u00e3o os \u00fanicos formatos de imagem suportados", "message.warn.importing.instance.without.nic": "AVISO: essa inst\u00e2ncia est\u00e1 sendo importada sem NICs e muitos recursos de rede n\u00e3o estar\u00e3o dispon\u00edveis. Considere criar uma NIC antes de importar via VCenter ou assim que a inst\u00e2ncia for importada.", +"message.warn.vpc.offerings": "Ofertas de VPC s\u00c3o exibidas somente caso a conta selecionada possua ao menos uma VPC.", +"message.warn.zone.mtu.update": "Por favor, note que este limite n\u00e3o afetar\u00e1 as configura\u00e7\u00f5es de MTU da Rede pr\u00e9-existentes", +"message.webhook.deliveries.time.filter": "A lista de entregas de webhook pode ser filtrada com base em data e hora. Selecione 'Customizado' para especificar o intervalo de data de in\u00edcio e fim.", "message.zone.creation.complete": "Cria\u00e7\u00e3o de zona completa", "message.zone.detail.description": "Preencha os detalhes da zona", "message.zone.detail.hint": "Uma zona \u00e9 a maior unidade organizacional no CloudStack, e normalmente corresponde a um \u00fanico datacenter. As zonas proporcionam isolamento f\u00edsico e redund\u00e2ncia. Uma zona consiste em um ou mais pods (cada um contendo hosts e servidores de armazenamento prim\u00e1rio) e um servidor de armazenamento secund\u00e1rio que \u00e9 compartilhado por todos os pods da zona.", +"message.zone.edge.local.storage": "Armazenamento local ser\u00e1 usado por padr\u00e3o para Inst\u00e2ncias de Usu\u00e1rio e roteadores virtuais", "message.validate.min": "Por favor entre com um valor maior que ou igual a {0}.", "migrate.from": "Migrar de", "migrate.to": "Migrar para", diff --git a/ui/public/locales/ru_RU.json b/ui/public/locales/ru_RU.json index 46d70081f1b3..4fb3788bc511 100644 --- a/ui/public/locales/ru_RU.json +++ b/ui/public/locales/ru_RU.json @@ -14,12 +14,12 @@ "label.account.specific": "\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u043d\u0442\u0430", "label.accounts": "\u0423\u0447\u0451\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438", "label.accounttype": "Account Type", -"label.acl.export": "Export ACLs", +"label.acl.export": "Export ACL rules", "label.acl.id": "ACL ID", -"label.acl.list.rules": "ACL List Rules", +"label.acl.rules": "ACL Rules", "label.acl.reason.description": "Enter the reason behind an ACL rule.", "label.aclid": "ACL", -"label.aclname": "ACL Name", +"label.acl.rule.name": "ACL Name", "label.acquire.new.ip": "\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 IP", "label.acquire.new.secondary.ip": "\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441", "label.action": "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f", @@ -119,8 +119,8 @@ "label.activeviewersessions": "\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438", "label.add": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c", "label.add.account": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c", -"label.add.acl": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c ACL", -"label.add.acl.list": "Add ACL List", +"label.add.acl.rule": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c ACL", +"label.add.acl": "Add ACL", "label.add.affinity.group": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e affinity group", "label.add.baremetal.dhcp.device": "Add Baremetal DHCP Device", "label.add.bigswitchbcf.device": "Add BigSwitch BCF Controller", @@ -142,12 +142,12 @@ "label.add.ip.range": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0430\u0434\u0440\u0435\u0441\u043e\u0432", "label.add.isolated.network": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c", "label.add.ldap.account": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c LDAP \u0430\u043a\u043a\u0430\u0443\u043d\u0442", -"label.add.list.name": "ACL List Name", +"label.add.acl.name": "ACL Name", "label.add.more": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435", "label.add.netscaler.device": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c Netscaler \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e", "label.add.network": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u044c", "label.add.network.acl": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u0443\u044e ACL", -"label.add.network.acl.list": "Add Network ACL List", +"label.add.network.acl": "Add Network ACL", "label.add.network.offering": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b", "label.add.new.gateway": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0448\u043b\u044e\u0437", "label.add.new.tier": "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 Tier", @@ -334,7 +334,7 @@ "label.default.use": "\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e", "label.default.view": "\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u0438\u0434", "label.delete": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c", -"label.delete.acl.list": "Delete ACL List", +"label.delete.acl": "Delete ACL", "label.delete.affinity.group": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c affinity group", "label.delete.alerts": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0432\u043e\u0433\u0438", "label.delete.bigswitchbcf": "Remove BigSwitch BCF Controller", @@ -418,7 +418,7 @@ "label.dpd": "Dead Peer Detection", "label.driver": "Driver", "label.edit": "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c", -"label.edit.acl.list": "Edit ACL List", +"label.edit.acl": "Edit ACL", "label.edit.acl.rule": "Edit ACL rule", "label.edit.project.details": "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430", "label.edit.role": "Edit Role", @@ -923,7 +923,6 @@ "label.remove.vpc.offering": "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0441\u043b\u0443\u0433\u0443 VPC", "label.removing": "\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435", "label.replace.acl": "Replace ACL", -"label.replace.acl.list": "Replace ACL List", "label.required": "\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f", "label.requireshvm": "HVM", "label.requiresupgrade": "Requires Upgrade", @@ -1149,8 +1148,7 @@ "label.usehttps": "\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 HTTPS", "label.usenewdiskoffering": "Replace disk offering?", "label.user": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c", -"label.userdata": "Userdata", -"label.userdatal2": "User Data", +"label.user.data": "User Data", "label.username": "\u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f", "label.users": "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438", "label.utilization": "Utilisation", @@ -1328,7 +1326,7 @@ "message.confirm.archive.selected.alerts": "Please confirm you would like to archive the selected alerts", "message.confirm.archive.selected.events": "Please confirm you would like to archive the selected events", "message.confirm.attach.disk": "Are you sure you want to attach disk?", -"message.confirm.delete.acl.list": "Are you sure you want to delete this ACL list?", +"message.confirm.delete.acl": "Are you sure you want to delete this ACL?", "message.confirm.delete.bigswitchbcf": "Please confirm that you would like to delete this BigSwitch BCF Controller", "message.confirm.delete.brocadevcs": "Please confirm that you would like to delete Brocade Vcs Switch", "message.confirm.delete.ciscoasa1000v": "Please confirm you want to delete CiscoASA1000v", diff --git a/ui/public/locales/te.json b/ui/public/locales/te.json index 957aed4ee885..f3b4c70ca2ed 100644 --- a/ui/public/locales/te.json +++ b/ui/public/locales/te.json @@ -419,6 +419,7 @@ "label.back": "వెనుకకు", "label.back.login": "తిరిగి లాగిన్‌కి", "label.backup": "బ్యాకప్‌లు", + "label.backups": "బ్యాకప్‌లు", "label.backup.attach.restore": "బ్యాకప్ వాల్యూమ్‌ను పునరుద్ధరించండి మరియు అటాచ్ చేయండి", "label.backup.configure.schedule": "బ్యాకప్ షెడ్యూల్‌ను కాన్ఫిగర్ చేయండి", "label.backup.offering.assign": "బ్యాకప్ సమర్పణకు ఉదాహరణను కేటాయించండి", @@ -3168,7 +3169,6 @@ "message.error.zone.name": "దయచేసి జోన్ పేరును నమోదు చేయండి.", "message.error.zone.type": "దయచేసి జోన్ రకాన్ని ఎంచుకోండి.", "message.error.linstor.resourcegroup": "దయచేసి Linstor Resource-Groupని నమోదు చేయండి.", - "message.error.fixed.offering.kvm": "ఫిక్స్‌డ్ కంప్యూట్ ఆఫర్‌తో KVM హైపర్‌వైజర్‌ను ఉపయోగించుకునే సందర్భాలను స్కేల్ చేయడం సాధ్యం కాదు.", "message.error.create.webhook.local.account": "స్థానిక స్కోప్‌తో వెబ్‌హుక్‌ని సృష్టించడానికి తప్పనిసరిగా ఖాతా అందించబడాలి.", "message.error.create.webhook.name": "వెబ్‌హుక్‌ని సృష్టించడానికి తప్పనిసరిగా పేరు అందించాలి.", "message.error.create.webhook.payloadurl": "Webhookని సృష్టించడానికి పేలోడ్ URL తప్పనిసరిగా అందించబడాలి.", @@ -3450,7 +3450,6 @@ "message.success.assign.vm": "విజయవంతంగా కేటాయించబడిన ఉదాహరణ", "message.success.apply.network.policy": "నెట్‌వర్క్ పాలసీ విజయవంతంగా వర్తింపజేయబడింది", "message.success.apply.tungsten.tag": "ట్యాగ్ విజయవంతంగా వర్తింపజేయబడింది", - "message.success.asign.vm": "విజయవంతంగా కేటాయించబడిన ఉదాహరణ", "message.success.assigned.vms": "సందర్భాలు విజయవంతంగా కేటాయించబడ్డాయి", "message.success.certificate.upload": "సర్టిఫికెట్ విజయవంతంగా అప్‌లోడ్ చేయబడింది", "message.success.change.affinity.group": "అనుబంధ సమూహాలు విజయవంతంగా మార్చబడ్డాయి", @@ -3471,7 +3470,7 @@ "message.success.create.internallb": "ఇంటర్నల్ లోడ్ బ్యాలెన్సర్ విజయవంతంగా సృష్టించబడింది", "message.success.create.isolated.network": "ఐసోలేటెడ్ నెట్‌వర్క్ విజయవంతంగా సృష్టించబడింది", "message.success.create.keypair": "SSH కీ జత విజయవంతంగా సృష్టించబడింది", - "message.success.create.kubernetes.cluter": "Kubernetes క్లస్టర్ విజయవంతంగా సృష్టించబడింది", + "message.success.create.kubernetes.cluster": "Kubernetes క్లస్టర్ విజయవంతంగా సృష్టించబడింది", "message.success.create.l2.network": "L2 నెట్‌వర్క్ విజయవంతంగా సృష్టించబడింది", "message.success.create.snapshot.from.vmsnapshot": "ఇన్‌స్టాన్స్ స్నాప్‌షాట్ నుండి స్నాప్‌షాట్ విజయవంతంగా సృష్టించబడింది", "message.success.create.template": "టెంప్లేట్ విజయవంతంగా సృష్టించబడింది", diff --git a/ui/public/locales/zh_CN.json b/ui/public/locales/zh_CN.json index fc3a456a8fb4..9536bab7ee43 100644 --- a/ui/public/locales/zh_CN.json +++ b/ui/public/locales/zh_CN.json @@ -66,12 +66,12 @@ "label.acl.export": "\u5BFC\u51FA ACL \u89C4\u5219", "label.acl.id": "ACL \u6807\u8BC6\u7801", - "label.acl.list.rules": "ACL\u5217\u8868\u7B56\u7565", + "label.acl.rules": "ACL\u5217\u8868\u7B56\u7565", "label.acl.reason.description": "\u8F93\u5165\u5B9A\u4E49 ACL \u7B56\u7565\u7684\u539F\u56E0\u3002", "label.acl.replaced": "ACL \u5DF2\u66FF\u6362", "label.aclid": "\u8BBF\u95EE\u63A7\u5236\uFF08ACL\uFF09", - "label.aclname": "ACL \u540D\u79F0", + "label.acl.rule.name": "ACL \u540D\u79F0", "label.acltotal": "\u7F51\u7EDC ACL \u603B\u6570", "label.acquire.new.ip": "\u83B7\u53D6\u65B0 IP \u5730\u5740", "label.acquire.new.secondary.ip": "\u83B7\u53D6\u65B0\u4E8C\u7EA7 IP \u5730\u5740", @@ -336,8 +336,8 @@ "label.add.account": "\u6DFB\u52A0\u5E10\u6237", "label.add.accounts": "\u6DFB\u52A0\u5E10\u6237", "label.add.accounts.to": "\u6DFB\u52A0\u5E10\u6237\u81F3", - "label.add.acl": "\u6DFB\u52A0 ACL", - "label.add.acl.list": "\u6DFB\u52A0 ACL \u5217\u8868", + "label.add.acl.rule": "\u6DFB\u52A0 ACL", + "label.add.acl": "\u6DFB\u52A0 ACL \u5217\u8868", "label.add.affinity.group": "\u6DFB\u52A0\u65B0\u5173\u8054\u6027\u7EC4", "label.add.baremetal.dhcp.device": "\u6DFB\u52A0\u88F8\u673A DHCP \u8BBE\u5907", @@ -381,7 +381,7 @@ "label.add.l2.guest.network": "\u6DFB\u52A0 L2 \u6765\u5BBE\u7F51\u7EDC", "label.add.ldap.account": "\u6DFB\u52A0 LDAP \u8D26\u6237", "label.add.ldap.list.users": "\u5217\u51FA LDAP \u7528\u6237", - "label.add.list.name": "ACL \u5217\u8868\u540D\u79F0", + "label.add.acl.name": "ACL \u5217\u8868\u540D\u79F0", "label.add.load.balancer": "\u6DFB\u52A0\u8D1F\u8F7D\u5747\u8861\u5668", "label.add.management.ip.range": "\u6DFB\u52A0\u7BA1\u7406 IP \u5730\u5740\u8303\u56F4", @@ -389,7 +389,7 @@ "label.add.netscaler.device": "\u6DFB\u52A0 Netscaler \u8BBE\u5907", "label.add.network": "\u6DFB\u52A0\u7F51\u7EDC", "label.add.network.acl": "\u6DFB\u52A0\u7F51\u7EDC ACL", - "label.add.network.acl.list": "\u6DFB\u52A0\u7F51\u7EDC ACL \u5217\u8868", + "label.add.network.acl": "\u6DFB\u52A0\u7F51\u7EDC ACL \u5217\u8868", "label.add.network.device": "\u6DFB\u52A0\u7F51\u7EDC\u8BBE\u5907", "label.add.network.offering": "\u6DFB\u52A0\u7F51\u7EDC\u65B9\u6848", @@ -561,6 +561,7 @@ "label.back": "\u540E\u9000", "label.backup": "\u5907\u4EFD", + "label.backups": "\u5907\u4EFD", "label.backup.attach.restore": "\u6062\u590D\u5E76\u8FDE\u63A5\u5907\u4EFD\u5377", "label.backup.offering.assign": "\u5C06\u865A\u62DF\u673A\u5206\u914D\u7ED9\u5907\u4EFD\u4EA7\u54C1", "label.backup.offering.remove": "\u4ECE\u5907\u4EFD\u4EA7\u54C1\u4E2D\u5220\u9664\u865A\u62DF\u673A", @@ -829,7 +830,7 @@ "label.defaultnetwork": "\u9ED8\u8BA4\u7F51\u7EDC", "label.delete": "\u5220\u9664", - "label.delete.acl.list": "\u5220\u9664 ACL \u5217\u8868", + "label.delete.acl": "\u5220\u9664 ACL \u5217\u8868", "label.delete.affinity.group": "\u5220\u9664\u5173\u8054\u6027\u7EC4", "label.delete.alerts": "\u5220\u9664\u8B66\u62A5", "label.delete.backup": "\u5220\u9664\u5907\u4EFD", @@ -1007,7 +1008,7 @@ "label.computeonly.offering.tooltip": "\u5728\u8BA1\u7B97\u65B9\u6848\u4E2D\u6307\u5B9A\u4E0E\u6839\u78C1\u76D8\u76F8\u5173\u7684\u4FE1\u606F\u6216\u5C06\u78C1\u76D8\u65B9\u6848\u76F4\u63A5\u94FE\u63A5\u5230\u8BA1\u7B97\u65B9\u6848\u7684\u9009\u9879", "label.edit": "\u7F16\u8F91", - "label.edit.acl.list": "\u7F16\u8F91 ACL \u5217\u8868", + "label.edit.acl": "\u7F16\u8F91 ACL \u5217\u8868", "label.edit.acl.rule": "\u7F16\u8F91 ACL \u89C4\u5219", "label.edit.affinity.group": "\u7F16\u8F91\u5173\u8054\u6027\u7EC4", "label.edit.lb.rule": "\u7F16\u8F91\u8D1F\u8F7D\u5747\u8861\u5668\u89C4\u5219", @@ -1717,7 +1718,7 @@ "label.netscaler.vpx": "NetScaler VPX \u8D1F\u8F7D\u5747\u8861\u5668", "label.network": "\u7F51\u7EDC", "label.network.acl": "\u7F51\u7EDC ACL", - "label.network.acl.lists": "\u7F51\u7EDC ACL \u5217\u8868", + "label.network.acls": "\u7F51\u7EDC ACL \u5217\u8868", "label.network.acls": "\u7F51\u7EDC ACL", "label.network.addvm": "\u5C06\u7F51\u7EDC\u6DFB\u52A0\u5230\u865A\u62DF\u673A", "label.network.desc": "\u7F51\u7EDC\u63CF\u8FF0", @@ -2136,7 +2137,6 @@ "label.removing.user": "\u6B63\u5728\u5220\u9664\u7528\u6237", "label.replace.acl": "\u66FF\u6362 ACL", - "label.replace.acl.list": "\u66FF\u6362 ACL \u5217\u8868", "label.report.bug": "\u62A5\u544A\u95EE\u9898", "label.required": "\u5FC5\u586B\u9879", @@ -2666,8 +2666,7 @@ "label.user.details": "\u7528\u6237\u8BE6\u60C5", "label.user.source": "\u6765\u6E90", "label.user.vm": "\u7528\u6237\u865A\u62DF\u673A", - "label.userdata": "\u7528\u6237\u6570\u636E", - "label.userdatal2": "\u7528\u6237\u6570\u636E", + "label.user.data": "\u7528\u6237\u6570\u636E", "label.username": "\u7528\u6237\u540D", "label.users": "\u7528\u6237", "label.usersource": "\u7528\u6237\u7C7B\u578B", @@ -3129,7 +3128,7 @@ "message.confirm.dedicate.pod.domain.account": "\u662F\u5426\u786E\u5B9E\u8981\u5C06\u6B64\u63D0\u4F9B\u70B9\u4E13\u7528\u4E8E\u57DF/\u5E10\u6237\uFF1F", "message.confirm.dedicate.zone": "\u662F\u5426\u8981\u5C06\u6B64\u8D44\u6E90\u57DF\u4E13\u7528\u4E8E\u57DF/\u5E10\u6237\uFF1F", - "message.confirm.delete.acl.list": "\u662F\u5426\u786E\u5B9E\u8981\u5220\u9664\u6B64 ACL \u5217\u8868\uFF1F", + "message.confirm.delete.acl": "\u662F\u5426\u786E\u5B9E\u8981\u5220\u9664\u6B64 ACL \u5217\u8868\uFF1F", "message.confirm.delete.alert": "\u662F\u5426\u786E\u5B9E\u8981\u5220\u9664\u6B64\u8B66\u62A5\uFF1F", "message.confirm.delete.baremetal.rack.configuration": "\u8BF7\u786E\u8BA4\u60A8\u786E\u5B9E\u8981\u5220\u9664 Baremetal Rack \u914D\u7F6E", "message.confirm.delete.bigswitchbcf": "\u8BF7\u786E\u8BA4\u60A8\u786E\u5B9E\u8981\u5220\u9664\u6B64 BigSwitch BCF \u63A7\u5236\u5668", @@ -3463,7 +3462,6 @@ "message.error.zone.name": "\u8BF7\u8F93\u5165\u533A\u57DF\u540D\u79F0", "message.error.zone.type": "\u8BF7\u9009\u62E9\u533A\u57DF\u7C7B\u578B", "message.error.linstor.resourcegroup": "\u8BF7\u8F93\u5165 Linstor \u8D44\u6E90\u7EC4", - "message.error.fixed.offering.kvm": "\u4E0D\u53EF\u80FD\u901A\u8FC7\u56FA\u5B9A\u7684\u8BA1\u7B97\u65B9\u6848\u6765\u6269\u5C55KVM\u865A\u62DF\u673A\u3002", "message.fail.to.delete": "\u5220\u9664\u5931\u8D25\u3002", "message.failed.to.add": "\u6DFB\u52A0\u5931\u8D25", "message.failed.to.assign.vms": "\u672A\u80FD\u5206\u914D\u865A\u62DF\u673A", @@ -3793,7 +3791,7 @@ "message.success.create.internallb": "\u5DF2\u6210\u529F\u521B\u5EFA\u5185\u90E8LB", "message.success.create.isolated.network": "\u5DF2\u6210\u529F\u521B\u5EFA\u9694\u79BB\u7F51\u7EDC", "message.success.create.keypair": "\u5DF2\u6210\u529F\u521B\u5EFA SSH \u5BC6\u94A5\u5BF9", - "message.success.create.kubernetes.cluter": "\u5DF2\u6210\u529F\u521B\u5EFA Kubernetes \u96C6\u7FA4", + "message.success.create.kubernetes.cluster": "\u5DF2\u6210\u529F\u521B\u5EFA Kubernetes \u96C6\u7FA4", "message.success.create.l2.network": "\u5DF2\u6210\u529F\u521B\u5EFA L2 \u7F51\u7EDC", "message.success.create.snapshot.from.vmsnapshot": "\u5DF2\u6210\u529F\u4ECE\u865A\u62DF\u673A\u5FEB\u7167\u521B\u5EFA\u5FEB\u7167", "message.success.create.user": "\u5DF2\u6210\u529F\u521B\u5EFA\u7528\u6237", diff --git a/ui/src/api/index.js b/ui/src/api/index.js index 7ab87780a9d4..5ec73a0b20e1 100644 --- a/ui/src/api/index.js +++ b/ui/src/api/index.js @@ -23,18 +23,23 @@ import { ACCESS_TOKEN } from '@/store/mutation-types' -export function api (command, args = {}, method = 'GET', data = {}) { - let params = {} +const getAPICommandsRegex = /^(get|list|query|find)\w+$/i +const additionalGetAPICommandsList = [ + 'isaccountallowedtocreateofferingswithtags', + 'readyforshutdown', + 'cloudianisenabled', + 'quotabalance', + 'quotasummary', + 'quotatarifflist', + 'quotaisenabled', + 'quotastatement', + 'verifyoauthcodeandgetuser' +] + +export function getAPI (command, args = {}) { args.command = command args.response = 'json' - if (data) { - params = new URLSearchParams() - Object.entries(data).forEach(([key, value]) => { - params.append(key, value) - }) - } - const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey') if (sessionkey) { args.sessionkey = sessionkey @@ -45,18 +50,46 @@ export function api (command, args = {}, method = 'GET', data = {}) { ...args }, url: '/', - method, - data: params || {} + method: 'GET' }) } +export function postAPI (command, data = {}) { + const params = new URLSearchParams() + params.append('command', command) + params.append('response', 'json') + if (data) { + Object.entries(data).forEach(([key, value]) => { + if (value !== undefined && value !== null) { + params.append(key, value) + } + }) + } + + const sessionkey = vueProps.$localStorage.get(ACCESS_TOKEN) || Cookies.get('sessionkey') + if (sessionkey) { + params.append('sessionkey', sessionkey) + } + return axios({ + url: '/', + method: 'POST', + data: params + }) +} + +export function callAPI (command, args = {}) { + const isGetAPICommand = getAPICommandsRegex.test(command) || additionalGetAPICommandsList.includes(command.toLowerCase()) + const call = isGetAPICommand ? getAPI : postAPI + return call(command, args) +} + export function login (arg) { if (!sourceToken.checkExistSource()) { sourceToken.init() } // Logout before login is called to purge any duplicate sessionkey cookies - api('logout') + postAPI('logout') const params = new URLSearchParams() params.append('command', 'login') @@ -66,7 +99,7 @@ export function login (arg) { params.append('response', 'json') return axios({ url: '/', - method: 'post', + method: 'POST', data: params, headers: { 'content-type': 'application/x-www-form-urlencoded' @@ -74,10 +107,13 @@ export function login (arg) { }) } -export function logout () { - message.destroy() - notification.destroy() - return api('logout') +export async function logout () { + const result = await postAPI('logout').finally(() => { + sourceToken.cancel() + message.destroy() + notification.destroy() + }) + return result } export function oauthlogin (arg) { @@ -86,7 +122,7 @@ export function oauthlogin (arg) { } // Logout before login is called to purge any duplicate sessionkey cookies - api('logout') + postAPI('logout') const params = new URLSearchParams() params.append('command', 'oauthlogin') @@ -104,3 +140,7 @@ export function oauthlogin (arg) { } }) } + +export function getBaseUrl () { + return vueProps.axios.defaults.baseURL +} diff --git a/ui/src/assets/icons/dark.svg b/ui/src/assets/icons/dark.svg index b1dd4b38e0ac..524521a3208e 100644 --- a/ui/src/assets/icons/dark.svg +++ b/ui/src/assets/icons/dark.svg @@ -1,6 +1,6 @@ - diff --git a/ui/src/assets/icons/kubernetes.svg b/ui/src/assets/icons/kubernetes.svg new file mode 100644 index 000000000000..51d8f490353d --- /dev/null +++ b/ui/src/assets/icons/kubernetes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/src/components/CheckBoxSelectPair.vue b/ui/src/components/CheckBoxSelectPair.vue index 4fba1da25565..a874144458ae 100644 --- a/ui/src/components/CheckBoxSelectPair.vue +++ b/ui/src/components/CheckBoxSelectPair.vue @@ -21,7 +21,7 @@ {{ checkBoxLabel }} @@ -32,7 +32,7 @@ :label="selectLabel"> + + + @@ -115,7 +115,7 @@ > @@ -128,7 +128,7 @@ + + diff --git a/ui/src/components/view/EventsTab.vue b/ui/src/components/view/EventsTab.vue index bd01b3f57c26..59080a4988a5 100644 --- a/ui/src/components/view/EventsTab.vue +++ b/ui/src/components/view/EventsTab.vue @@ -48,10 +48,12 @@ + + diff --git a/ui/src/components/view/GPUSummaryTab.vue b/ui/src/components/view/GPUSummaryTab.vue new file mode 100644 index 000000000000..a602335033a3 --- /dev/null +++ b/ui/src/components/view/GPUSummaryTab.vue @@ -0,0 +1,293 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + + + diff --git a/ui/src/components/view/GPUTab.vue b/ui/src/components/view/GPUTab.vue new file mode 100644 index 000000000000..03096ea2e7cd --- /dev/null +++ b/ui/src/components/view/GPUTab.vue @@ -0,0 +1,440 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + + + diff --git a/ui/src/components/view/ImageDeployInstanceButton.vue b/ui/src/components/view/ImageDeployInstanceButton.vue new file mode 100644 index 000000000000..2cdd5a0af460 --- /dev/null +++ b/ui/src/components/view/ImageDeployInstanceButton.vue @@ -0,0 +1,155 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + diff --git a/ui/src/components/view/ImageStoreSelectView.vue b/ui/src/components/view/ImageStoreSelectView.vue index 13c5a68e5b12..7871703cd8e4 100644 --- a/ui/src/components/view/ImageStoreSelectView.vue +++ b/ui/src/components/view/ImageStoreSelectView.vue @@ -75,7 +75,7 @@ diff --git a/ui/src/components/view/ObjectStoreBrowser.vue b/ui/src/components/view/ObjectStoreBrowser.vue index 9f94cc619c7b..5507540d1f41 100644 --- a/ui/src/components/view/ObjectStoreBrowser.vue +++ b/ui/src/components/view/ObjectStoreBrowser.vue @@ -489,7 +489,12 @@ export default { asyncUploadFile (file, objectName) { return new Promise((resolve, reject) => { file.arrayBuffer().then((buffer) => { - this.client.putObject(this.resource.name, objectName, Buffer.from(buffer), file.size, this.uploadMetaData, err => { + const metadata = { + ...this.uploadMetaData, + 'Content-Type': file.type || 'binary/octet-stream' + } + + this.client.putObject(this.resource.name, objectName, Buffer.from(buffer), file.size, metadata, err => { if (err) { return reject(this.$notification.error({ message: this.$t('message.upload.failed'), diff --git a/ui/src/components/view/ResourceCountUsage.vue b/ui/src/components/view/ResourceCountUsage.vue index 265c6e789559..c74391f3a9bc 100644 --- a/ui/src/components/view/ResourceCountUsage.vue +++ b/ui/src/components/view/ResourceCountUsage.vue @@ -40,7 +40,7 @@ v-if="taggedUsage[item]" class="list-item__collapse" @change="handleCollapseChange(item)"> - + - + diff --git a/ui/src/components/view/SearchView.vue b/ui/src/components/view/SearchView.vue index 76ccde802f71..bd952f049476 100644 --- a/ui/src/components/view/SearchView.vue +++ b/ui/src/components/view/SearchView.vue @@ -72,7 +72,7 @@ v-for="(opt, idx) in field.opts" :key="idx" :value="['account'].includes(field.name) ? opt.name : opt.id" - :label="$t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path)"> + :label="field.name === 'vgpuprofileid' ? `${opt.gpucardname} - ${opt.name}` : $t((field.name.startsWith('domain') && opt.path) ? opt.path : opt.name)">
    @@ -89,7 +89,12 @@ - {{ $t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path) }} + + {{ opt.gpucardname }} - {{ opt.name }} + + + {{ $t((field.name.startsWith('domain') && opt.path) ? opt.path : opt.name) }} +
    @@ -161,7 +166,7 @@ diff --git a/ui/src/components/view/VmwareData.vue b/ui/src/components/view/VmwareData.vue index efb921df5f30..e978fbb29da7 100644 --- a/ui/src/components/view/VmwareData.vue +++ b/ui/src/components/view/VmwareData.vue @@ -35,7 +35,7 @@ + + diff --git a/ui/src/components/view/stats/ResourceStatsInfo.vue b/ui/src/components/view/stats/ResourceStatsInfo.vue index 6898141bdfc5..104283436626 100644 --- a/ui/src/components/view/stats/ResourceStatsInfo.vue +++ b/ui/src/components/view/stats/ResourceStatsInfo.vue @@ -1,17 +1,17 @@ // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// regarding copyright ownership. The ASF licenses this file // to you 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. diff --git a/ui/src/components/view/stats/ResourceStatsLineChart.vue b/ui/src/components/view/stats/ResourceStatsLineChart.vue index fa15ea398a5e..399e77bebd46 100644 --- a/ui/src/components/view/stats/ResourceStatsLineChart.vue +++ b/ui/src/components/view/stats/ResourceStatsLineChart.vue @@ -1,17 +1,17 @@ // Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file +// or more contributor license agreements. See the NOTICE file // distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file +// regarding copyright ownership. The ASF licenses this file // to you 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 +// with the License. You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. diff --git a/ui/src/components/widgets/BlockRadioGroupSelect.vue b/ui/src/components/widgets/BlockRadioGroupSelect.vue new file mode 100644 index 000000000000..a2364597a63d --- /dev/null +++ b/ui/src/components/widgets/BlockRadioGroupSelect.vue @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + + + diff --git a/ui/src/components/widgets/Breadcrumb.vue b/ui/src/components/widgets/Breadcrumb.vue index 147e779502bf..4723417f5398 100644 --- a/ui/src/components/widgets/Breadcrumb.vue +++ b/ui/src/components/widgets/Breadcrumb.vue @@ -100,7 +100,7 @@ export default { this.breadList = [] this.$route.matched.forEach((item, idx) => { const parent = this.$route.matched[idx - 1] - if (item && parent && parent.name !== 'index' && !item.path.endsWith(':id')) { + if (item && parent && parent.name !== 'index' && !item.path.endsWith(':id') && !item.path.endsWith(':id(.*)')) { this.breadList.pop() } this.breadList.push(item) diff --git a/ui/src/components/widgets/Console.vue b/ui/src/components/widgets/Console.vue index 6c16c7546a7c..edee7498991a 100644 --- a/ui/src/components/widgets/Console.vue +++ b/ui/src/components/widgets/Console.vue @@ -17,9 +17,17 @@ @@ -29,7 +29,10 @@ - - diff --git a/ui/src/components/widgets/Status.vue b/ui/src/components/widgets/Status.vue index 22a8236d6cdf..6b9f71b5de84 100644 --- a/ui/src/components/widgets/Status.vue +++ b/ui/src/components/widgets/Status.vue @@ -88,6 +88,9 @@ export default { case 'ReadWrite': state = this.$t('state.readwrite') break + case 'partiallyallocated': + state = this.$t('state.partiallyallocated') + break case 'InProgress': state = this.$t('state.inprogress') break @@ -97,6 +100,12 @@ export default { case 'Up': state = this.$t('state.up') break + case 'Yes': + state = this.$t('label.yes') + break + case 'no': + state = this.$t('label.no') + break } return state.charAt(0).toUpperCase() + state.slice(1) } @@ -124,6 +133,8 @@ export default { case 'success': case 'poweron': case 'primary': + case 'managed': + case 'yes': status = 'success' break case 'alert': @@ -138,6 +149,8 @@ export default { case 'poweroff': case 'stopped': case 'failed': + case 'unmanaged': + case 'no': status = 'error' break case 'migrating': @@ -161,6 +174,7 @@ export default { case 'unsecure': case 'warning': case 'backup': + case 'partiallyallocated': status = 'warning' break } diff --git a/ui/src/composables/useServiceCapabilityParams.js b/ui/src/composables/useServiceCapabilityParams.js new file mode 100644 index 000000000000..734f30ec3f4a --- /dev/null +++ b/ui/src/composables/useServiceCapabilityParams.js @@ -0,0 +1,153 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +export function buildServiceCapabilityParams (params, values, selectedServiceProviderMap, registeredServicePackages) { + const supportedServices = Object.keys(selectedServiceProviderMap) + params.supportedservices = supportedServices.join(',') + for (const k in supportedServices) { + params[`serviceProviderList[${k}].service`] = supportedServices[k] + params[`serviceProviderList[${k}].provider`] = selectedServiceProviderMap[supportedServices[k]] + } + let serviceCapabilityIndex = 0 + if (supportedServices.includes('Connectivity')) { + if (values.supportsstrechedl2subnet === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Connectivity' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RegionLevelVpc' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + if (values.supportspublicaccess === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Connectivity' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'DistributedRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + delete params.supportsstrechedl2subnet + delete params.supportspublicaccess + } + // SourceNat capabilities + if (supportedServices.includes('SourceNat')) { + if (values.redundantroutercapability === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'SourceNat' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RedundantRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'SourceNat' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'SupportedSourceNatTypes' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = values.sourcenattype + serviceCapabilityIndex++ + delete params.redundantroutercapability + delete params.sourcenattype + } else if (values.redundantroutercapability === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Gateway' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RedundantRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + // StaticNat capabilities + if (supportedServices.includes('SourceNat')) { + if (values.elasticip === true) { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'StaticNat' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'ElasticIp' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + if (values.elasticip === true || values.associatepublicip === true) { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'StaticNat' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'associatePublicIP' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = values.associatepublicip + serviceCapabilityIndex++ + } + delete params.elasticip + delete params.associatepublicip + } + // Lb capabilities + if (supportedServices.includes('Lb')) { + if ('vmautoscalingcapability' in values) { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'lb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'VmAutoScaling' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = values.vmautoscalingcapability + serviceCapabilityIndex++ + } + if (values.elasticlb === true) { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'lb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'ElasticLb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + if (values.inlinemode === true && ((selectedServiceProviderMap.Lb === 'F5BigIp') || (selectedServiceProviderMap.Lb === 'Netscaler'))) { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'lb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'InlineMode' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = values.inlinemode + serviceCapabilityIndex++ + } + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'lb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'SupportedLbIsolation' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = values.isolation || 'dedicated' + serviceCapabilityIndex++ + if (selectedServiceProviderMap.Lb === 'InternalLbVm') { + params[`servicecapabilitylist[${serviceCapabilityIndex}].service`] = 'lb' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilitytype`] = 'lbSchemes' + params[`servicecapabilitylist[${serviceCapabilityIndex}].capabilityvalue`] = 'internal' + serviceCapabilityIndex++ + } + if ('netscalerservicepackages' in values && + registeredServicePackages.length > values.netscalerservicepackages && + 'netscalerservicepackagesdescription' in values) { + params['details[0].servicepackageuuid'] = registeredServicePackages[values.netscalerservicepackages].id + params['details[1].servicepackagedescription'] = values.netscalerservicepackagesdescription + } + } +} + +/** + * Build the VPC service capability params for Add/Clone VPC Offering forms. + * Handles: RegionLevelVpc, DistributedRouter, RedundantRouter (SourceNat/Gateway) + */ +export function buildVpcServiceCapabilityParams (params, values, selectedServiceProviderMap, isVpcVirtualRouterForAtLeastOneService) { + const supportedServices = Object.keys(selectedServiceProviderMap) + let serviceCapabilityIndex = 0 + if (supportedServices.includes('Connectivity')) { + if (values.regionlevelvpc === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Connectivity' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RegionLevelVpc' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + if (values.distributedrouter === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Connectivity' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'DistributedRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + } + if (supportedServices.includes('SourceNat') && values.redundantrouter === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'SourceNat' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RedundantRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } else if (values.redundantrouter === true) { + params[`serviceCapabilityList[${serviceCapabilityIndex}].service`] = 'Gateway' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilitytype`] = 'RedundantRouter' + params[`serviceCapabilityList[${serviceCapabilityIndex}].capabilityvalue`] = true + serviceCapabilityIndex++ + } + if (values.serviceofferingid && isVpcVirtualRouterForAtLeastOneService) { + params.serviceofferingid = values.serviceofferingid + } +} diff --git a/ui/src/config/router.js b/ui/src/config/router.js index 16599a0c3673..43e8efd7b5d3 100644 --- a/ui/src/config/router.js +++ b/ui/src/config/router.js @@ -38,6 +38,8 @@ import infra from '@/config/section/infra' import zone from '@/config/section/zone' import offering from '@/config/section/offering' import config from '@/config/section/config' +import extension from '@/config/section/extension' +import customaction from '@/config/section/extension/customaction' import tools from '@/config/section/tools' import quota from '@/config/section/plugin/quota' import cloudian from '@/config/section/plugin/cloudian' @@ -75,11 +77,11 @@ function generateRouterMap (section) { icon: child.icon, docHelp: vueProps.$applyDocHelpMappings(child.docHelp), permission: child.permission, - getApiToCall: child.getApiToCall, resourceType: child.resourceType, filters: child.filters, params: child.params ? child.params : {}, columns: child.columns, + advisories: !vueProps.$config.advisoriesDisabled ? child.advisories : undefined, details: child.details, searchFilters: child.searchFilters, related: child.related, @@ -91,7 +93,7 @@ function generateRouterMap (section) { hideChildrenInMenu: true, children: [ { - path: '/' + child.name + '/:id', + path: '/' + child.name + '/:id(.*)', hidden: child.hidden, meta: { title: child.title, @@ -146,7 +148,7 @@ function generateRouterMap (section) { map.meta.tabs = section.tabs map.children = [{ - path: '/' + section.name + '/:id', + path: '/' + section.name + '/:id(.*)', actions: section.actions ? section.actions : [], meta: { title: section.title, @@ -179,6 +181,10 @@ function generateRouterMap (section) { map.meta.columns = section.columns } + if (!vueProps.$config.advisoriesDisabled && section.advisories) { + map.meta.advisories = section.advisories + } + if (section.actions) { map.meta.actions = section.actions } @@ -222,6 +228,8 @@ export function asyncRouterMap () { generateRouterMap(zone), generateRouterMap(offering), generateRouterMap(config), + generateRouterMap(extension), + generateRouterMap(customaction), generateRouterMap(tools), generateRouterMap(quota), generateRouterMap(cloudian), @@ -310,6 +318,11 @@ export const constantRouterMap = [ path: 'resetPassword', name: 'resetPassword', component: () => import(/* webpackChunkName: "auth" */ '@/views/auth/ResetPassword') + }, + { + path: 'forceChangePassword', + name: 'forceChangePassword', + component: () => import(/* webpackChunkName: "auth" */ '@/views/iam/ForceChangePassword') } ] }, diff --git a/ui/src/config/section/account.js b/ui/src/config/section/account.js index b5e962752f82..5766fd8a0f92 100644 --- a/ui/src/config/section/account.js +++ b/ui/src/config/section/account.js @@ -55,7 +55,7 @@ export default { param: 'account' }, { name: 'userdata', - title: 'label.userdata', + title: 'label.user.data', param: 'account' }, { name: 'template', @@ -85,7 +85,7 @@ export default { component: shallowRef(defineAsyncComponent(() => import('@/components/view/ResourceLimitTab.vue'))) }, { - name: 'certificate', + name: 'certificates', component: shallowRef(defineAsyncComponent(() => import('@/views/iam/SSLCertificateTab.vue'))) }, { @@ -228,11 +228,10 @@ export default { message: 'message.delete.account', dataView: true, disabled: (record, store) => { - return record.id !== 'undefined' && store.userInfo.accountid === record.id + return store.userInfo.accountid === record?.id }, - groupAction: true, popup: true, - groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + component: shallowRef(defineAsyncComponent(() => import('@/views/iam/DeleteAccountWrapper.vue'))) } ] } diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index 803f8eb0c705..6b7a5428b1f9 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -18,6 +18,9 @@ import { shallowRef, defineAsyncComponent } from 'vue' import store from '@/store' import { isZoneCreated } from '@/utils/zone' +import { getAPI, postAPI, getBaseUrl } from '@/api' +import { getLatestKubernetesIsoParams } from '@/utils/acsrepo' +import kubernetesIcon from '@/assets/icons/kubernetes.svg?inline' export default { name: 'compute', @@ -29,8 +32,7 @@ export default { title: 'label.instances', icon: 'cloud-server-outlined', docHelp: 'adminguide/virtual_machines.html', - permission: ['listVirtualMachines', 'listVirtualMachinesMetrics'], - getApiToCall: () => store.getters.metrics ? 'listVirtualMachinesMetrics' : 'listVirtualMachines', + permission: ['listVirtualMachinesMetrics'], resourceType: 'UserVm', params: () => { var params = { details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff' } @@ -45,6 +47,9 @@ export default { if (!(store.getters.project && store.getters.project.id)) { filters.unshift('self') } + if (store.getters.features.instanceleaseenabled) { + filters.push('leased') + } return filters }, columns: () => { @@ -52,8 +57,8 @@ export default { const metricsFields = ['cpunumber', 'cputotal', 'cpuused', 'memorytotal', { memoryused: (record) => { - if (record.memoryintfreekbs <= 0 || record.memorykbs <= 0) { - return '-' + if (!record.memoryintfreekbs || record.memoryintfreekbs <= 0 || record.memorykbs <= 0) { + return '' } return parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' } @@ -63,6 +68,7 @@ export default { if (store.getters.metrics) { fields.push(...metricsFields) } + fields.push('arch') if (store.getters.userInfo.roletype === 'Admin') { fields.splice(2, 0, 'instancename') fields.push('hostname') @@ -78,12 +84,12 @@ export default { fields.push('zonename') return fields }, - searchFilters: ['name', 'zoneid', 'domainid', 'account', 'groupid', 'tags'], + searchFilters: ['name', 'gpuenabled', 'zoneid', 'domainid', 'account', 'groupid', 'arch', 'extensionid', 'tags'], details: () => { var fields = ['name', 'displayname', 'id', 'state', 'ipaddress', 'ip6address', 'templatename', 'ostypename', - 'serviceofferingname', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'boottype', 'bootmode', 'account', + 'serviceofferingname', 'gpucount', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'arch', 'boottype', 'bootmode', 'account', 'domain', 'zonename', 'userdataid', 'userdataname', 'userdataparams', 'userdatadetails', 'userdatapolicy', - 'hostcontrolstate', 'deleteprotection'] + 'hostcontrolstate', 'deleteprotection', 'leaseexpirydate', 'leaseexpiryaction'] const listZoneHaveSGEnabled = store.getters.zones.filter(zone => zone.securitygroupsenabled === true) if (!listZoneHaveSGEnabled || listZoneHaveSGEnabled.length === 0) { return fields @@ -123,7 +129,7 @@ export default { dataView: true, groupAction: true, popup: true, - groupMap: (selection, values) => { return selection.map(x => { return { id: x, considerlasthost: values.considerlasthost } }) }, + groupMap: (selection, values) => { return selection.map(x => { return { id: x, considerlasthost: values.considerlasthost === true } }) }, args: (record, store) => { if (['Admin'].includes(store.userInfo.roletype)) { return ['considerlasthost'] @@ -179,7 +185,7 @@ export default { message: 'message.reinstall.vm', dataView: true, popup: true, - show: (record) => { return ['Running', 'Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Running', 'Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, disabled: (record) => { return record.hostcontrolstate === 'Offline' }, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ReinstallVm.vue'))) }, @@ -189,11 +195,17 @@ export default { label: 'label.action.vmsnapshot.create', docHelp: 'adminguide/virtual_machines.html#virtual-machine-snapshots', dataView: true, - args: ['virtualmachineid', 'name', 'description', 'snapshotmemory', 'quiescevm'], + args: (record, store) => { + var args = ['virtualmachineid', 'name', 'description', 'snapshotmemory'] + if (['KVM', 'VMware'].includes(record.hypervisor)) { + args.push('quiescevm') + } + return args + }, show: (record) => { - return (((['Running'].includes(record.state) && record.hypervisor !== 'LXC') || - (['Stopped'].includes(record.state) && ((record.hypervisor !== 'KVM' && record.hypervisor !== 'LXC') || - (record.hypervisor === 'KVM' && record.pooltype === 'PowerFlex')))) && record.vmtype !== 'sharedfsvm') + return record.hypervisor !== 'External' && (((['Running'].includes(record.state) && record.hypervisor !== 'LXC') || + (['Stopped'].includes(record.state) && (!['KVM', 'LXC'].includes(record.hypervisor) || + (record.hypervisor === 'KVM' && ['PowerFlex', 'Filesystem', 'NetworkFilesystem', 'SharedMountPoint'].includes(record.pooltype))))) && record.vmtype !== 'sharedfsvm') }, disabled: (record) => { return record.hostcontrolstate === 'Offline' && record.hypervisor === 'KVM' }, mapping: { @@ -210,9 +222,9 @@ export default { dataView: true, popup: true, show: (record, store) => { - return (record.hypervisor !== 'KVM') || + return record.hypervisor !== 'External' && ((record.hypervisor !== 'KVM') || ['Stopped', 'Destroyed'].includes(record.state) || - store.features.kvmsnapshotenabled + store.features.kvmsnapshotenabled) }, disabled: (record) => { return record.hostcontrolstate === 'Offline' && record.hypervisor === 'KVM' }, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/CreateSnapshotWizard.vue'))) @@ -225,7 +237,7 @@ export default { docHelp: 'adminguide/virtual_machines.html#backup-offerings', dataView: true, args: ['virtualmachineid', 'backupofferingid'], - show: (record) => { return !record.backupofferingid }, + show: (record) => { return ['Running', 'Stopped', 'Shutdown'].includes(record.state) && record.hypervisor !== 'External' && !record.backupofferingid }, mapping: { backupofferingid: { api: 'listBackupOfferings', @@ -243,13 +255,9 @@ export default { message: 'message.backup.create', docHelp: 'adminguide/virtual_machines.html#creating-vm-backups', dataView: true, - args: ['virtualmachineid'], show: (record) => { return record.backupofferingid }, - mapping: { - virtualmachineid: { - value: (record, params) => { return record.id } - } - } + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/StartBackup.vue'))) }, { api: 'createBackupSchedule', @@ -291,7 +299,7 @@ export default { docHelp: 'adminguide/templates.html#attaching-an-iso-to-a-vm', dataView: true, popup: true, - show: (record) => { return ['Running', 'Stopped'].includes(record.state) && !record.isoid && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Running', 'Stopped'].includes(record.state) && !record.isoid && record.vmtype !== 'sharedfsvm' }, disabled: (record) => { return record.hostcontrolstate === 'Offline' || record.hostcontrolstate === 'Maintenance' }, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/AttachIso.vue'))) }, @@ -308,7 +316,7 @@ export default { } return args }, - show: (record) => { return ['Running', 'Stopped'].includes(record.state) && 'isoid' in record && record.isoid && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Running', 'Stopped'].includes(record.state) && 'isoid' in record && record.isoid && record.vmtype !== 'sharedfsvm' }, disabled: (record) => { return record.hostcontrolstate === 'Offline' || record.hostcontrolstate === 'Maintenance' }, mapping: { virtualmachineid: { @@ -323,7 +331,7 @@ export default { docHelp: 'adminguide/virtual_machines.html#change-affinity-group-for-an-existing-vm', dataView: true, args: ['affinitygroupids'], - show: (record) => { return ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' && record.vmtype !== 'cksnode' }, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ChangeAffinity'))), popup: true }, @@ -333,7 +341,7 @@ export default { label: 'label.scale.vm', docHelp: 'adminguide/virtual_machines.html#how-to-dynamically-scale-cpu-and-ram', dataView: true, - show: (record) => { return (['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'LXC')) && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && (['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'LXC')) && record.vmtype !== 'sharedfsvm' }, disabled: (record) => { return record.state === 'Running' && !record.isdynamicallyscalable }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ScaleVM.vue'))) @@ -344,7 +352,7 @@ export default { label: 'label.migrate.instance.to.host', docHelp: 'adminguide/virtual_machines.html#moving-vms-between-hosts-manual-live-migration', dataView: true, - show: (record, store) => { return ['Running'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, + show: (record, store) => { return record.hypervisor !== 'External' && ['Running'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, disabled: (record) => { return record.hostcontrolstate === 'Offline' }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/MigrateWizard.vue'))) @@ -356,7 +364,7 @@ export default { message: 'message.migrate.instance.to.ps', docHelp: 'adminguide/virtual_machines.html#moving-vms-between-hosts-manual-live-migration', dataView: true, - show: (record, store) => { return ['Stopped'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, + show: (record, store) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, disabled: (record) => { return record.hostcontrolstate === 'Offline' }, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/MigrateVMStorage'))), popup: true @@ -368,7 +376,7 @@ export default { message: 'message.action.instance.reset.password', dataView: true, args: ['password'], - show: (record) => { return ['Stopped'].includes(record.state) && record.passwordenabled }, + show: (record) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && record.passwordenabled }, response: (result) => { return { message: result.virtualmachine && result.virtualmachine.password ? `The password of VM ${result.virtualmachine.displayname} is ${result.virtualmachine.password}` : null, @@ -384,18 +392,18 @@ export default { message: 'message.desc.reset.ssh.key.pair', docHelp: 'adminguide/virtual_machines.html#resetting-ssh-keys', dataView: true, - show: (record) => { return ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ResetSshKeyPair'))) }, { api: 'resetUserDataForVirtualMachine', icon: 'solution-outlined', - label: 'label.reset.userdata.on.vm', + label: 'label.reset.user.data.on.vm', message: 'message.desc.reset.userdata', docHelp: 'adminguide/virtual_machines.html#resetting-userdata', dataView: true, - show: (record) => { return ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, + show: (record) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ResetUserData'))) }, @@ -406,7 +414,7 @@ export default { dataView: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/AssignInstance'))), popup: true, - show: (record) => { return ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' } + show: (record) => { return record.hypervisor !== 'External' && ['Stopped'].includes(record.state) && record.vmtype !== 'sharedfsvm' } }, { api: 'recoverVirtualMachine', @@ -414,7 +422,16 @@ export default { label: 'label.recover.vm', message: 'message.recover.vm', dataView: true, - show: (record, store) => { return ['Destroyed'].includes(record.state) && store.features.allowuserexpungerecovervm && record.vmtype !== 'sharedfsvm' } + show: (record, store) => { return record.hypervisor !== 'External' && ['Destroyed'].includes(record.state) && store.features.allowuserexpungerecovervm && record.vmtype !== 'sharedfsvm' } + }, + { + api: 'runCustomAction', + icon: 'play-square-outlined', + label: 'label.run.custom.action', + dataView: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/RunCustomAction'))), + popup: true, + show: (record) => { return ['External'].includes(record.hypervisor) } }, { api: 'unmanageVirtualMachine', @@ -422,7 +439,7 @@ export default { label: 'label.action.unmanage.virtualmachine', message: 'message.action.unmanage.virtualmachine', dataView: true, - show: (record) => { return ['Running', 'Stopped'].includes(record.state) && ['VMware', 'KVM'].includes(record.hypervisor) && record.vmtype !== 'sharedfsvm' } + show: (record) => { return record.hypervisor !== 'External' && ['Running', 'Stopped'].includes(record.state) && ['VMware', 'KVM'].includes(record.hypervisor) && record.vmtype !== 'sharedfsvm' } }, { api: 'expungeVirtualMachine', @@ -519,7 +536,12 @@ export default { api: 'deleteVMSnapshot', icon: 'delete-outlined', label: 'label.action.vmsnapshot.delete', - message: 'message.action.vmsnapshot.delete', + message: (record) => { + if (record.hypervisor !== 'KVM' || record.type === 'Disk') { + return 'message.action.vmsnapshot.disk-only.delete' + } + return 'message.action.vmsnapshot.delete' + }, dataView: true, show: (record) => { return ['Ready', 'Expunging', 'Error'].includes(record.state) }, args: ['vmsnapshotid'], @@ -537,7 +559,7 @@ export default { { name: 'kubernetes', title: 'label.kubernetes', - icon: ['fa-solid', 'fa-dharmachakra'], + icon: kubernetesIcon, docHelp: 'plugins/cloudstack-kubernetes-service.html', searchFilters: ['name', 'domainid', 'account', 'state'], permission: ['listKubernetesClusters'], @@ -559,7 +581,7 @@ export default { const filters = ['cloud.managed', 'external.managed'] return filters }, - details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename', 'clustertype', 'created'], + details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'csienabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'controlaffinitygroupnames', 'etcdnodes', 'etcdaffinitygroupnames', 'workeraffinitygroupnames', 'cpunumber', 'memory', 'keypair', 'cniconfigname', 'associatednetworkname', 'account', 'domain', 'zonename', 'clustertype', 'created'], tabs: [ { name: 'k8s', @@ -567,6 +589,182 @@ export default { } ], resourceType: 'KubernetesCluster', + advisories: [ + { + id: 'cks-min-offering', + severity: 'warning', + message: 'message.advisory.cks.min.offering', + docsHelp: 'plugins/cloudstack-kubernetes-service.html', + dismissOnConditionFail: true, + condition: async (store) => { + if (!('listServiceOfferings' in store.getters.apis)) { + return false + } + const params = { + cpunumber: 2, + memory: 2048, + issystem: false + } + try { + const json = await getAPI('listServiceOfferings', params) + const offerings = json?.listserviceofferingsresponse?.serviceoffering || [] + return !offerings.some(o => !o.iscustomized) + } catch (error) {} + return false + }, + actions: [ + { + primary: true, + label: 'label.add.minimum.required.compute.offering', + loadingLabel: 'message.adding.minimum.required.compute.offering.kubernetes.cluster', + show: (store) => { return ('createServiceOffering' in store.getters.apis) }, + run: async () => { + const params = { + name: 'CKS Instance', + cpunumber: 2, + cpuspeed: 1000, + memory: 2048, + iscustomized: false, + issystem: false + } + try { + const json = await postAPI('createServiceOffering', params) + if (json?.createserviceofferingresponse?.serviceoffering) { + return true + } + } catch (error) {} + return false + }, + successMessage: 'message.added.minimum.required.compute.offering.kubernetes.cluster', + errorMessage: 'message.add.minimum.required.compute.offering.kubernetes.cluster.failed' + }, + { + label: 'label.go.to.compute.offerings', + show: (store) => { return ('listServiceOfferings' in store.getters.apis) }, + run: (store, router) => { + router.push({ name: 'computeoffering' }) + return false + } + } + ] + }, + { + id: 'cks-version-check', + severity: 'warning', + message: 'message.advisory.cks.version.check', + docsHelp: 'plugins/cloudstack-kubernetes-service.html', + dismissOnConditionFail: true, + condition: async (store) => { + const api = 'listKubernetesSupportedVersions' + if (!(api in store.getters.apis)) { + return false + } + try { + const json = await getAPI(api, {}) + const versions = json?.listkubernetessupportedversionsresponse?.kubernetessupportedversion || [] + return versions.length === 0 + } catch (error) {} + return false + }, + actions: [ + { + primary: true, + label: 'label.add.latest.kubernetes.iso', + loadingLabel: 'message.adding.latest.kubernetes.iso', + show: (store) => { return ('addKubernetesSupportedVersion' in store.getters.apis) }, + run: async () => { + let arch = 'x86_64' + if ('listClusters' in store.getters.apis) { + try { + const json = await getAPI('listClusters', { allocationstate: 'Enabled', page: 1, pagesize: 1 }) + const cluster = json?.listclustersresponse?.cluster?.[0] || {} + arch = cluster.architecture || 'x86_64' + } catch (error) {} + } + const params = await getLatestKubernetesIsoParams(arch) + try { + const json = await postAPI('addKubernetesSupportedVersion', params) + if (json?.addkubernetessupportedversionresponse?.kubernetessupportedversion) { + return true + } + } catch (error) {} + return false + }, + successMessage: 'message.added.latest.kubernetes.iso', + errorMessage: 'message.add.latest.kubernetes.iso.failed' + }, + { + label: 'label.go.to.kubernetes.isos', + show: true, + run: (store, router) => { + router.push({ name: 'kubernetesiso' }) + return false + } + } + ] + }, + { + id: 'cks-endpoint-url', + severity: 'warning', + message: 'message.advisory.cks.endpoint.url.not.configured', + docsHelp: 'plugins/cloudstack-kubernetes-service.html', + dismissOnConditionFail: true, + condition: async (store) => { + if (!['Admin'].includes(store.getters.userInfo.roletype)) { + return false + } + let url = '' + const baseUrl = getBaseUrl() + if (baseUrl.startsWith('/')) { + url = window.location.origin + baseUrl + } + if (!url || url.startsWith('http://localhost')) { + return false + } + const params = { + name: 'endpoint.url' + } + const json = await getAPI('listConfigurations', params) + const configuration = json?.listconfigurationsresponse?.configuration?.[0] || {} + return !configuration.value || configuration.value.startsWith('http://localhost') + }, + actions: [ + { + primary: true, + label: 'label.fix.global.setting', + show: (store) => { return ('updateConfiguration' in store.getters.apis) }, + run: async () => { + let url = '' + const baseUrl = getBaseUrl() + if (baseUrl.startsWith('/')) { + url = window.location.origin + baseUrl + } + const params = { + name: 'endpoint.url', + value: url + } + try { + const json = await postAPI('updateConfiguration', params) + if (json?.updateconfigurationresponse?.configuration) { + return true + } + } catch (error) {} + return false + }, + successMessage: 'message.global.setting.updated', + errorMessage: 'message.global.setting.update.failed' + }, + { + label: 'label.go.to.global.settings', + show: (store) => { return ('listConfigurations' in store.getters.apis) }, + run: (store, router) => { + router.push({ name: 'globalsetting' }) + return false + } + } + ] + } + ], actions: [ { api: 'createKubernetesCluster', @@ -604,7 +802,7 @@ export default { }, { api: 'scaleKubernetesCluster', - icon: 'swap-outlined', + icon: 'arrows-alt-outlined', label: 'label.kubernetes.cluster.scale', message: 'message.kubernetes.cluster.scale', docHelp: 'plugins/cloudstack-kubernetes-service.html#scaling-kubernetes-cluster', @@ -613,6 +811,15 @@ export default { popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ScaleKubernetesCluster.vue'))) }, + { + api: 'updateKubernetesClusterAffinityGroups', + icon: 'swap-outlined', + label: 'label.change.affinity', + dataView: true, + show: (record) => { return ['Stopped'].includes(record.state) && record.clustertype === 'CloudManaged' }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/ChangeKubernetesClusterAffinity.vue'))) + }, { api: 'upgradeKubernetesCluster', icon: 'plus-circle-outlined', @@ -624,6 +831,26 @@ export default { popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/UpgradeKubernetesCluster.vue'))) }, + { + api: 'addNodesToKubernetesCluster', + icon: 'plus-outlined', + label: 'label.kubernetes.cluster.add.nodes.to.cluster', + message: 'message.kubernetes.cluster.add.nodes', + dataView: true, + show: (record) => { return ['Running', 'Alert'].includes(record.state) && record.clustertype === 'CloudManaged' }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/KubernetesAddNodes.vue'))) + }, + { + api: 'removeNodesFromKubernetesCluster', + icon: 'minus-outlined', + label: 'label.kubernetes.cluster.remove.nodes.from.cluster', + message: 'message.kubernetes.cluster.remove.nodes', + dataView: true, + show: (record) => { return ['Running', 'Alert'].includes(record.state) && record.clustertype === 'CloudManaged' && (record.virtualmachines.filter(vm => vm.isexternalnode) || []).length > 0 }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/KubernetesRemoveNodes.vue'))) + }, { api: 'deleteKubernetesCluster', icon: 'delete-outlined', @@ -903,7 +1130,7 @@ export default { }, { name: 'userdata', - title: 'label.user.data', + title: 'label.user.data.library', icon: 'solution-outlined', docHelp: 'adminguide/virtual_machines.html#user-data-and-meta-data', permission: ['listUserData'], @@ -942,7 +1169,7 @@ export default { api: 'registerUserData', icon: 'plus-outlined', label: 'label.register.user.data', - docHelp: 'adminguide/virtual_machines.html#creating-the-ssh-keypair', + docHelp: 'adminguide/virtual_machines.html#user-data-and-meta-data', listView: true, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/compute/RegisterUserData.vue'))) @@ -953,11 +1180,14 @@ export default { label: 'label.remove.user.data', message: 'message.please.confirm.remove.user.data', dataView: true, - args: ['id', 'account', 'domainid'], + args: ['id', 'account', 'domainid', 'projectid'], mapping: { id: { value: (record, params) => { return record.id } }, + projectid: { + value: (record, params) => { return record.projectid } + }, account: { value: (record, params) => { return record.account } }, @@ -971,7 +1201,93 @@ export default { return selection.map(x => { const data = record.filter(y => { return y.id === x }) return { - id: x, account: data[0].account, domainid: data[0].domainid + id: x, + account: data[0].account, + domainid: data[0].domainid, + projectid: data[0].projectid + } + }) + } + } + ] + }, + { + name: 'cniconfiguration', + title: 'label.cniconfiguration', + icon: 'solution-outlined', + docHelp: 'adminguide/virtual_machines.html#user-data-and-meta-data', + permission: ['listCniConfiguration'], + columns: () => { + var fields = ['name', 'id'] + if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { + fields.push('account') + if (store.getters.listAllProjects) { + fields.push('project') + } + fields.push('domain') + } else if (store.getters.listAllProjects) { + fields.push('project') + } + return fields + }, + resourceType: 'UserData', + details: ['id', 'name', 'userdata', 'account', 'domain', 'params'], + related: [{ + name: 'vm', + title: 'label.instances', + param: 'userdata' + }], + tabs: [ + { + name: 'details', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, + { + name: 'comments', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))) + } + ], + actions: [ + { + api: 'registerCniConfiguration', + icon: 'plus-outlined', + label: 'label.register.cni.config', + docHelp: 'adminguide/virtual_machines.html#creating-the-ssh-keypair', + listView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/RegisterUserData.vue'))) + }, + { + api: 'deleteCniConfiguration', + icon: 'delete-outlined', + label: 'label.remove.cni.configuration', + message: 'message.please.confirm.remove.cni.configuration', + dataView: true, + args: ['id', 'account', 'domainid', 'projectid'], + mapping: { + id: { + value: (record, params) => { return record.id } + }, + projectid: { + value: (record, params) => { return record.projectid } + }, + account: { + value: (record, params) => { return record.account } + }, + domainid: { + value: (record, params) => { return record.domainid } + } + }, + groupAction: true, + popup: true, + groupMap: (selection, values, record) => { + return selection.map(x => { + const data = record.filter(y => { return y.id === x }) + return { + id: x, + account: data[0].account, + domainid: data[0].domainid, + projectid: data[0].projectid } }) } @@ -1023,12 +1339,8 @@ export default { label: 'label.add.affinity.group', docHelp: 'adminguide/virtual_machines.html#creating-a-new-affinity-group', listView: true, - args: ['name', 'description', 'type'], - mapping: { - type: { - options: ['host anti-affinity (Strict)', 'host affinity (Strict)', 'host anti-affinity (Non-Strict)', 'host affinity (Non-Strict)'] - } - } + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/CreateAffinityGroup.vue'))) }, { api: 'deleteAffinityGroup', diff --git a/ui/src/config/section/config.js b/ui/src/config/section/config.js index 2a4dbb84a6ec..e190515855e6 100644 --- a/ui/src/config/section/config.js +++ b/ui/src/config/section/config.js @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +import { shallowRef, defineAsyncComponent } from 'vue' + export default { name: 'config', title: 'label.configuration', @@ -39,7 +41,7 @@ export default { permission: ['listLdapConfigurations'], searchFilters: ['domainid', 'hostname', 'port'], columns: ['hostname', 'port', 'domainid'], - details: ['hostname', 'port', 'domainid'], + details: ['id', 'hostname', 'port', 'domainid'], actions: [ { api: 'addLdapConfiguration', @@ -131,43 +133,6 @@ export default { } ] }, - { - name: 'backuprepository', - title: 'label.backup.repository', - icon: 'inbox-outlined', - docHelp: 'adminguide/backup_and_recovery.html', - permission: ['listBackupRepositories'], - searchFilters: ['zoneid'], - columns: ['name', 'provider', 'type', 'address', 'zonename'], - details: ['name', 'type', 'address', 'provider', 'zonename'], - actions: [ - { - api: 'addBackupRepository', - icon: 'plus-outlined', - label: 'label.backup.repository.add', - listView: true, - args: [ - 'name', 'provider', 'address', 'type', 'mountopts', 'zoneid' - ], - mapping: { - type: { - options: ['nfs', 'cifs'] - }, - provider: { - value: (record) => { return 'nas' } - } - } - }, - { - api: 'deleteBackupRepository', - icon: 'delete-outlined', - label: 'label.backup.repository.remove', - message: 'message.action.delete.backup.repository', - dataView: true, - popup: true - } - ] - }, { name: 'hypervisorcapability', title: 'label.hypervisor.capabilities', @@ -187,6 +152,56 @@ export default { } ] }, + { + name: 'guestoscategory', + title: 'label.guest.os.categories', + docHelp: 'adminguide/guest_os.html#guest-os-categories', + icon: 'group-outlined', + permission: ['listOsCategories', 'addOsCategory'], + columns: ['name', 'isfeatured', 'created', 'order'], + details: ['name', 'isfeatured', 'created'], + related: [{ + name: 'guestos', + title: 'label.guest.os', + param: 'oscategoryid' + }, + { + name: 'template', + title: 'label.templates', + param: 'oscategoryid' + }, + { + name: 'iso', + title: 'label.isos', + param: 'oscategoryid' + }], + actions: [ + { + api: 'addOsCategory', + icon: 'plus-outlined', + label: 'label.add.guest.os.category', + listView: true, + dataView: false, + args: ['name', 'isfeatured'] + }, + { + api: 'updateOsCategory', + icon: 'edit-outlined', + label: 'label.edit', + dataView: true, + popup: true, + args: ['name', 'isfeatured'] + }, + { + api: 'deleteOsCategory', + icon: 'delete-outlined', + label: 'label.action.delete.guest.os.category', + message: 'message.action.delete.guest.os.category', + dataView: true, + popup: true + } + ] + }, { name: 'guestos', title: 'label.guest.os', @@ -195,6 +210,7 @@ export default { permission: ['listOsTypes', 'listOsCategories'], columns: ['name', 'oscategoryname', 'isuserdefined'], details: ['name', 'oscategoryname', 'isuserdefined'], + searchFilters: ['oscategoryid'], related: [{ name: 'guestoshypervisormapping', title: 'label.guest.os.hypervisor.mappings', @@ -221,7 +237,14 @@ export default { label: 'label.edit', dataView: true, popup: true, - args: ['osdisplayname'] + groupAction: true, + groupMap: (selection, values) => { return selection.map(x => { return { id: x, oscategoryid: values.oscategoryid } }) }, + args: (record, store, isGroupAction) => { + if (isGroupAction) { + return ['oscategoryid'] + } + return ['osdisplayname', 'oscategoryid'] + } }, { api: 'addGuestOsMapping', @@ -282,6 +305,95 @@ export default { popup: true } ] + }, + { + name: 'gpucard', + title: 'label.gpu.card.types', + icon: 'laptop-outlined', + permission: ['listGpuCards'], + columns: ['name', 'deviceid', 'devicename', 'vendorid', 'vendorname'], + details: ['name', 'deviceid', 'devicename', 'vendorid', 'vendorname'], + related: [{ + name: 'gpudevices', + title: 'label.gpu.device', + param: 'gpucardid' + }, { + name: 'vgpuprofile', + title: 'label.vgpu.profile', + param: 'gpucardid' + }], + tabs: [{ + name: 'details', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, { + name: 'vgpu', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/VgpuProfilesTab.vue'))) + }], + actions: [ + { + api: 'createGpuCard', + icon: 'plus-outlined', + label: 'label.add.gpu.card', + listView: true, + dataView: false, + args: ['name', 'deviceid', 'devicename', 'vendorid', 'vendorname', 'videoram'] + }, + { + api: 'updateGpuCard', + icon: 'edit-outlined', + label: 'label.edit', + dataView: true, + popup: true, + args: ['name', 'devicename', 'vendorname'] + }, + { + api: 'deleteGpuCard', + icon: 'delete-outlined', + label: 'label.action.delete.gpu.card', + message: 'message.action.delete.gpu.card', + dataView: true, + popup: true, + groupAction: true, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + } + ] + }, + { + name: 'vgpuprofile', + title: 'label.vgpu.profile', + icon: 'laptop-outlined', + permission: ['listVgpuProfiles'], + hidden: true, + columns: ['name', 'gpucardname', 'description', 'videoram', 'maxheads', 'resolution', 'maxvgpuperphysicalgpu'], + details: ['gpucardname', 'name', 'description', 'videoram', 'maxheads', 'maxresolutionx', 'maxresolutiony', 'maxvgpuperphysicalgpu'], + actions: [ + { + api: 'createVgpuProfile', + icon: 'plus-outlined', + label: 'label.add.vgpu.profile', + listView: true, + dataView: false, + args: ['name', 'description', 'gpucardid', 'videoram', 'maxheads', 'maxresolutionx', 'maxresolutiony', 'maxvgpuperphysicalgpu'] + }, + { + api: 'updateVgpuProfile', + icon: 'edit-outlined', + label: 'label.edit', + dataView: true, + popup: true, + args: ['name', 'description', 'videoram', 'maxheads', 'maxresolutionx', 'maxresolutiony', 'maxvgpuperphysicalgpu'] + }, + { + api: 'deleteVgpuProfile', + icon: 'delete-outlined', + label: 'label.action.delete.vgpu.profile', + message: 'message.action.delete.vgpu.profile', + dataView: true, + popup: true, + groupAction: true, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + } + ] } ] } diff --git a/ui/src/config/section/domain.js b/ui/src/config/section/domain.js index e6807f06278f..706cbf805cfa 100644 --- a/ui/src/config/section/domain.js +++ b/ui/src/config/section/domain.js @@ -48,6 +48,11 @@ export default { name: 'template', title: 'label.templates', param: 'domainid' + }, + { + name: 'iso', + title: 'label.isos', + param: 'domainid' }], tabs: [ { @@ -139,7 +144,7 @@ export default { docHelp: 'adminguide/accounts.html#using-an-ldap-server-for-user-authentication', listView: true, dataView: true, - args: ['type', 'domainid', 'name', 'accounttype', 'admin'], + args: ['type', 'domainid', 'ldapdomain', 'accounttype', 'admin'], mapping: { type: { options: ['GROUP', 'OU'] @@ -152,6 +157,20 @@ export default { } } }, + { + api: 'unlinkDomainFromLdap', + icon: 'ArrowsAltOutlined', + label: 'label.unlink.domain.from.ldap', + docHelp: 'adminguide/accounts.html#using-an-ldap-server-for-user-authentication', + listView: true, + dataView: true, + args: ['domainid'], + mapping: { + domainid: { + value: (record) => { return record.id } + } + } + }, { api: 'deleteDomain', icon: 'delete-outlined', diff --git a/ui/src/config/section/event.js b/ui/src/config/section/event.js index 5ab87e86964c..b07f3ba37c4e 100644 --- a/ui/src/config/section/event.js +++ b/ui/src/config/section/event.js @@ -32,7 +32,7 @@ export default { return fields }, details: ['username', 'id', 'description', 'resourcetype', 'resourceid', 'state', 'level', 'type', 'account', 'domain', 'created'], - searchFilters: ['level', 'domainid', 'account', 'keyword', 'resourcetype'], + searchFilters: ['level', 'domainid', 'account', 'keyword', 'resourcetype', 'state'], related: [{ name: 'event', title: 'label.event.timeline', diff --git a/ui/src/config/section/extension.js b/ui/src/config/section/extension.js new file mode 100644 index 000000000000..5904abae30b6 --- /dev/null +++ b/ui/src/config/section/extension.js @@ -0,0 +1,147 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +import { shallowRef, defineAsyncComponent } from 'vue' +import store from '@/store' + +export default { + name: 'extension', + title: 'label.extensions', + icon: 'appstore-add-outlined', + docHelp: 'adminguide/extensions.html', + permission: ['listExtensions'], + params: (dataView) => { + const params = {} + if (!dataView) { + params.details = 'min' + } + return params + }, + resourceType: 'Extension', + columns: () => { + var fields = ['name', 'state', 'type', 'path', + { + availability: (record) => { + if (record.pathready) { + return 'Ready' + } + return 'Not Ready' + } + }, 'created'] + return fields + }, + details: ['name', 'description', 'id', 'type', 'details', 'path', 'pathready', 'isuserdefined', 'orchestratorrequirespreparevm', 'reservedresourcedetails', 'created'], + filters: ['orchestrator'], + tabs: [{ + name: 'details', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, + { + name: 'resources', + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/ExtensionResourcesTab.vue'))) + }, + { + name: 'customactions', + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/ExtensionCustomActionsTab.vue'))) + }, + { + name: 'events', + resourceType: 'Extension', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))), + show: () => { return 'listEvents' in store.getters.apis } + }], + related: [ + { + name: 'vm', + title: 'label.instances', + param: 'extensionid' + }, + { + name: 'template', + title: 'label.templates', + param: 'extensionid' + } + ], + actions: [ + { + api: 'createExtension', + icon: 'plus-outlined', + label: 'label.create.extension', + docHelp: 'adminguide/extensions.html', + listView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/CreateExtension.vue'))) + }, + { + api: 'updateExtension', + icon: 'edit-outlined', + label: 'label.update.extension', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/UpdateExtension.vue'))) + }, + { + api: 'registerExtension', + icon: 'api-outlined', + label: 'label.register.extension', + message: 'message.action.register.extension', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/RegisterExtension.vue'))) + }, + { + api: 'updateExtension', + icon: 'play-circle-outlined', + label: 'label.enable.extension', + message: 'message.confirm.enable.extension', + dataView: true, + groupAction: true, + popup: true, + defaultArgs: { state: 'Enabled' }, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) }, + show: (record) => { return ['Disabled'].includes(record.state) } + }, + { + api: 'updateExtension', + icon: 'pause-circle-outlined', + label: 'label.disable.extension', + message: 'message.confirm.disable.extension', + dataView: true, + groupAction: true, + popup: true, + defaultArgs: { state: 'Disabled' }, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) }, + show: (record) => { return ['Enabled'].includes(record.state) } + }, + { + api: 'deleteExtension', + icon: 'delete-outlined', + label: 'label.delete.extension', + message: 'message.action.delete.extension', + dataView: true, + popup: true, + args: ['id', 'cleanup'], + mapping: { + id: { + value: (record, params) => { return record.id } + }, + cleanup: false + }, + show: (record) => { return record.isuserdefined } + } + ] +} diff --git a/ui/src/config/section/extension/customaction.js b/ui/src/config/section/extension/customaction.js new file mode 100644 index 000000000000..e01f9bc944b4 --- /dev/null +++ b/ui/src/config/section/extension/customaction.js @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +import { shallowRef, defineAsyncComponent } from 'vue' +import store from '@/store' + +export default { + name: 'customaction', + title: 'label.custom.actions', + icon: 'play-square-outlined', + docHelp: 'adminguide/extensions.html#custom-actions', + permission: ['listCustomActions'], + resourceType: 'ExtensionCustomAction', + hidden: true, + columns: ['name', 'extensionname', 'enabled', 'created'], + details: ['name', 'id', 'description', 'extensionname', 'allowedroletypes', 'resourcetype', 'parameters', 'timeout', 'successmessage', 'errormessage', 'details', 'created'], + tabs: [{ + name: 'details', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, + { + name: 'events', + resourceType: 'ExtensionCustomAction', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/EventsTab.vue'))), + show: () => { return 'listEvents' in store.getters.apis } + }], + actions: [ + { + api: 'addCustomAction', + icon: 'plus-outlined', + label: 'label.add.custom.action', + docHelp: 'adminguide/extensions.html#custom-actions', + listView: true, + popup: true, + show: (record) => { return false }, // Hidden for now + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/AddCustomAction.vue'))) + }, + { + api: 'updateCustomAction', + icon: 'edit-outlined', + label: 'label.update.custom.action', + message: 'message.action.update.extension', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/extension/UpdateCustomAction.vue'))) + }, + { + api: 'updateCustomAction', + icon: 'play-circle-outlined', + label: 'label.enable.custom.action', + message: 'message.confirm.enable.custom.action', + dataView: true, + groupAction: true, + popup: true, + defaultArgs: { enabled: true }, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) }, + show: (record) => { return !record.enabled } + }, + { + api: 'updateCustomAction', + icon: 'pause-circle-outlined', + label: 'label.disable.custom.action', + message: 'message.confirm.disable.custom.action', + dataView: true, + groupAction: true, + popup: true, + defaultArgs: { enabled: false }, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) }, + show: (record) => { return record.enabled } + }, + { + api: 'deleteCustomAction', + icon: 'delete-outlined', + label: 'label.delete.custom.action', + message: 'message.action.delete.custom.action', + dataView: true, + popup: true + } + ] +} diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index 6001480513bb..bae4a40c9a8d 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -18,6 +18,7 @@ import { shallowRef, defineAsyncComponent } from 'vue' import store from '@/store' import { isZoneCreated } from '@/utils/zone' +import kubernetesIcon from '@/assets/icons/kubernetes.svg?inline' export default { name: 'image', @@ -43,7 +44,7 @@ export default { } return 'Not Ready' } - }, 'ostypename', 'hypervisor'] + }, 'ostypename', 'arch', 'hypervisor'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { fields.push('size') fields.push('account') @@ -58,16 +59,16 @@ export default { return fields }, details: () => { - var fields = ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'arch', 'format', 'ostypename', 'size', 'physicalsize', 'isready', 'passwordenabled', + var fields = ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'arch', 'format', 'externalprovisioner', 'ostypename', 'size', 'physicalsize', 'isready', 'passwordenabled', 'crossZones', 'templatetype', 'directdownload', 'deployasis', 'ispublic', 'isfeatured', 'isextractable', 'isdynamicallyscalable', 'crosszones', 'type', - 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy'] + 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy', 'url', 'forcks'] if (['Admin'].includes(store.getters.userInfo.roletype)) { - fields.push('templatetag', 'templatetype', 'url') + fields.push('templatetag', 'templatetype') } return fields }, searchFilters: () => { - var filters = ['name', 'zoneid', 'tags'] + var filters = ['name', 'zoneid', 'tags', 'arch', 'oscategoryid', 'templatetype', 'extensionid'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { filters.push('storageid') filters.push('imagestoreid') @@ -220,7 +221,7 @@ export default { } return 'Not Ready' } - }, 'ostypename'] + }, 'ostypename', 'arch'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { fields.push('size') fields.push('account') @@ -235,7 +236,7 @@ export default { }, details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'arch', 'bootable', 'isready', 'passwordenabled', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'isdynamicallyscalable', 'crosszones', 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy', 'url'], searchFilters: () => { - var filters = ['name', 'zoneid', 'tags'] + var filters = ['name', 'zoneid', 'tags', 'arch', 'oscategoryid'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { filters.push('storageid') filters.push('imagestoreid') @@ -367,12 +368,12 @@ export default { { name: 'kubernetesiso', title: 'label.kubernetes.isos', - icon: ['fa-solid', 'fa-dharmachakra'], + icon: kubernetesIcon, docHelp: 'plugins/cloudstack-kubernetes-service.html#kubernetes-supported-versions', permission: ['listKubernetesSupportedVersions'], - searchFilters: ['zoneid', 'minimumsemanticversion'], - columns: ['name', 'state', 'semanticversion', 'isostate', 'mincpunumber', 'minmemory', 'zonename'], - details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'mincpunumber', 'minmemory', 'supportsha', 'state', 'created'], + searchFilters: ['zoneid', 'minimumsemanticversion', 'arch'], + columns: ['name', 'state', 'semanticversion', 'isostate', 'mincpunumber', 'minmemory', 'arch', 'zonename'], + details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'arch', 'mincpunumber', 'minmemory', 'supportsha', 'state', 'created', 'isourl'], tabs: [ { name: 'details', @@ -395,6 +396,15 @@ export default { show: isZoneCreated, component: shallowRef(defineAsyncComponent(() => import('@/views/image/AddKubernetesSupportedVersion.vue'))) }, + { + api: 'getUploadParamsForKubernetesSupportedVersion', + icon: 'cloud-upload-outlined', + label: 'label.kubernetes.version.from.local', + listView: true, + popup: true, + show: isZoneCreated, + component: shallowRef(defineAsyncComponent(() => import('@/views/image/AddKubernetesSupportedVersion.vue'))) + }, { api: 'updateKubernetesSupportedVersion', icon: 'edit-outlined', diff --git a/ui/src/config/section/infra.js b/ui/src/config/section/infra.js index cb91d4d7b04f..dc365b74c930 100644 --- a/ui/src/config/section/infra.js +++ b/ui/src/config/section/infra.js @@ -23,6 +23,7 @@ import clusters from '@/config/section/infra/clusters' import hosts from '@/config/section/infra/hosts' import primaryStorages from '@/config/section/infra/primaryStorages' import secondaryStorages from '@/config/section/infra/secondaryStorages' +import backupRepositories from '@/config/section/infra/backupRepositories' import objectStorages from '@/config/section/infra/objectStorages' import systemVms from '@/config/section/infra/systemVms' import routers from '@/config/section/infra/routers' @@ -50,6 +51,7 @@ export default { hosts, primaryStorages, secondaryStorages, + backupRepositories, objectStorages, systemVms, routers, @@ -63,6 +65,27 @@ export default { permission: ['listHosts'], component: () => import('@/views/infra/CpuSockets.vue') }, + { + name: 'gpudevices', + title: 'label.gpu.devices', + icon: 'BoxPlotOutlined', + hidden: true, + permission: ['listGpuDevices'], + columns: ['busaddress', 'gpucardname', 'vgpuprofilename', 'hostname', 'virtualmachinename'], + details: ['id', 'busaddress', 'gpucardname', 'vgpuprofilename', 'hostname', 'virtualmachinename'], + searchFilters: ['gpucardid', 'vgpuprofileid'], + actions: [ + { + api: 'deleteGpuDevice', + icon: 'delete-outlined', + label: 'label.delete.gpu.device', + dataView: true, + popup: true, + groupAction: true, + groupMap: (selection) => { return selection.map(x => { return { id: x.id } }) } + } + ] + }, { name: 'metric', title: 'label.db.usage.metrics', diff --git a/ui/src/config/section/infra/backupRepositories.js b/ui/src/config/section/infra/backupRepositories.js new file mode 100644 index 000000000000..aa1aa5eab4fe --- /dev/null +++ b/ui/src/config/section/infra/backupRepositories.js @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +export default { + name: 'backuprepository', + title: 'label.backup.repository', + icon: 'inbox-outlined', + docHelp: 'adminguide/nas_plugin.html', + permission: ['listBackupRepositories'], + searchFilters: ['zoneid'], + columns: ['name', 'provider', 'type', 'address', 'zonename'], + details: ['name', 'type', 'address', 'provider', 'zonename', 'crosszoneinstancecreation'], + actions: [ + { + api: 'addBackupRepository', + icon: 'plus-outlined', + label: 'label.backup.repository.add', + listView: true, + args: [ + 'name', 'provider', 'address', 'type', 'mountopts', 'zoneid', 'crosszoneinstancecreation' + ], + mapping: { + type: { + options: ['nfs', 'cifs', 'ceph'] + }, + provider: { + value: (record) => { return 'nas' } + } + } + }, + { + api: 'updateBackupRepository', + icon: 'edit-outlined', + label: 'label.backup.repository.edit', + message: 'message.action.edit.backup.repository', + args: ['name', 'address', 'mountopts', 'crosszoneinstancecreation'], + dataView: true, + popup: true + }, + { + api: 'deleteBackupRepository', + icon: 'delete-outlined', + label: 'label.backup.repository.remove', + message: 'message.action.delete.backup.repository', + dataView: true, + popup: true + } + ] +} diff --git a/ui/src/config/section/infra/clusters.js b/ui/src/config/section/infra/clusters.js index c304a8a7e6c2..ad6c59dda421 100644 --- a/ui/src/config/section/infra/clusters.js +++ b/ui/src/config/section/infra/clusters.js @@ -24,10 +24,10 @@ export default { icon: 'cluster-outlined', docHelp: 'conceptsandterminology/concepts.html#about-clusters', permission: ['listClustersMetrics'], - searchFilters: ['name', 'zoneid', 'podid', 'hypervisor'], + searchFilters: ['name', 'zoneid', 'podid', 'arch', 'hypervisor'], columns: () => { - const fields = ['name', 'state', 'allocationstate', 'clustertype', 'hypervisortype', 'hosts'] - const metricsFields = ['cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance'] + const fields = ['name', 'allocationstate', 'clustertype', 'arch', 'hypervisortype'] + const metricsFields = ['state', 'hosts', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance'] if (store.getters.metrics) { fields.push(...metricsFields) } @@ -35,7 +35,7 @@ export default { fields.push('zonename') return fields }, - details: ['name', 'id', 'allocationstate', 'clustertype', 'managedstate', 'arch', 'hypervisortype', 'podname', 'zonename', 'drsimbalance'], + details: ['name', 'id', 'allocationstate', 'clustertype', 'managedstate', 'arch', 'hypervisortype', 'externalprovisioner', 'podname', 'zonename', 'drsimbalance', 'storageaccessgroups', 'podstorageaccessgroups', 'zonestorageaccessgroups', 'externaldetails'], related: [{ name: 'host', title: 'label.hosts', @@ -57,7 +57,8 @@ export default { component: shallowRef(defineAsyncComponent(() => import('@/components/view/SettingsTab.vue'))) }, { name: 'drs', - component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ClusterDRSTab.vue'))) + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ClusterDRSTab.vue'))), + show: (resource) => { return resource.hypervisortype !== 'External' } }, { name: 'comments', component: shallowRef(defineAsyncComponent(() => import('@/components/view/AnnotationsTab.vue'))) @@ -83,12 +84,8 @@ export default { icon: 'edit-outlined', label: 'label.edit', dataView: true, - args: ['clustername', 'arch'], - mapping: { - arch: { - options: ['x86_64', 'aarch64'] - } - } + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ClusterUpdate.vue'))) }, { api: 'updateCluster', @@ -136,7 +133,7 @@ export default { dataView: true, defaultArgs: { iterations: null }, args: ['iterations'], - show: (record) => { return record.managedstate === 'Managed' } + show: (record) => { return record.hypervisortype !== 'External' && record.managedstate === 'Managed' } }, { api: 'enableOutOfBandManagementForCluster', @@ -145,7 +142,7 @@ export default { message: 'label.outofbandmanagement.enable', dataView: true, show: (record) => { - return record?.resourcedetails?.outOfBandManagementEnabled === 'false' + return record.hypervisortype !== 'External' && record?.resourcedetails?.outOfBandManagementEnabled === 'false' }, args: ['clusterid'], mapping: { @@ -161,7 +158,7 @@ export default { message: 'label.outofbandmanagement.disable', dataView: true, show: (record) => { - return !(record?.resourcedetails?.outOfBandManagementEnabled === 'false') + return record.hypervisortype !== 'External' && !(record?.resourcedetails?.outOfBandManagementEnabled === 'false') }, args: ['clusterid'], mapping: { @@ -177,7 +174,7 @@ export default { message: 'label.ha.enable', dataView: true, show: (record) => { - return record?.resourcedetails?.resourceHAEnabled === 'false' + return record.hypervisortype !== 'External' && record?.resourcedetails?.resourceHAEnabled === 'false' }, args: ['clusterid'], mapping: { @@ -193,7 +190,7 @@ export default { message: 'label.ha.disable', dataView: true, show: (record) => { - return !(record?.resourcedetails?.resourceHAEnabled === 'false') + return record.hypervisortype !== 'External' && !(record?.resourcedetails?.resourceHAEnabled === 'false') }, args: ['clusterid'], mapping: { @@ -213,6 +210,9 @@ export default { clusterids: { value: (record) => { return record.id } } + }, + show: (record) => { + return record.hypervisortype !== 'External' } }, { diff --git a/ui/src/config/section/infra/hosts.js b/ui/src/config/section/infra/hosts.js index a372b2288e99..48e850a22fbe 100644 --- a/ui/src/config/section/infra/hosts.js +++ b/ui/src/config/section/infra/hosts.js @@ -24,7 +24,7 @@ export default { icon: 'database-outlined', docHelp: 'conceptsandterminology/concepts.html#about-hosts', permission: ['listHostsMetrics'], - searchFilters: ['name', 'zoneid', 'podid', 'clusterid', 'hypervisor'], + searchFilters: ['name', 'zoneid', 'podid', 'clusterid', 'arch', 'hypervisor'], resourceType: 'Host', filters: () => { const filters = ['enabled', 'disabled', 'maintenance', 'up', 'down', 'disconnected', 'alert'] @@ -32,8 +32,11 @@ export default { }, params: { type: 'routing' }, columns: () => { - const fields = ['name', 'state', 'resourcestate', 'ipaddress', 'hypervisor', 'instances', 'powerstate', 'version'] - const metricsFields = ['cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite'] + const fields = [ + 'name', 'state', 'resourcestate', 'ipaddress', 'arch', 'hypervisor', + { field: 'systeminstances', customTitle: 'system.vms' }, 'version' + ] + const metricsFields = ['instances', 'powerstate', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'gputotal', 'gpuused', 'networkread', 'networkwrite'] if (store.getters.metrics) { fields.push(...metricsFields) } @@ -42,10 +45,14 @@ export default { fields.push('managementservername') return fields }, - details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'arch', 'type', 'clustername', 'podname', 'zonename', 'managementservername', 'disconnected', 'created'], + details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'externalprovisioner', 'arch', 'type', 'clustername', 'podname', 'zonename', 'storageaccessgroups', 'clusterstorageaccessgroups', 'podstorageaccessgroups', 'zonestorageaccessgroups', 'managementservername', 'disconnected', 'created', 'externaldetails'], tabs: [{ name: 'details', component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, { + name: 'gpu', + resourceType: 'Host', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/GPUTab.vue'))) }, { name: 'events', resourceType: 'Host', @@ -84,6 +91,7 @@ export default { label: 'label.action.change.password', dataView: true, popup: true, + show: (record) => { return record.hypervisor !== 'External' }, component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ChangeHostPassword.vue'))) }, { @@ -95,7 +103,7 @@ export default { show: (record) => { return record.hypervisor === 'KVM' || record.hypervisor === store.getters.customHypervisorName }, - args: ['hostid'], + args: ['hostid', 'forced'], mapping: { hostid: { value: (record) => { return record.id } @@ -116,9 +124,14 @@ export default { label: 'label.disable.host', message: 'message.confirm.disable.host', dataView: true, - show: (record) => { return record.resourcestate === 'Enabled' }, + show: (record) => record.resourcestate === 'Enabled', popup: true, - component: shallowRef(defineAsyncComponent(() => import('@/views/infra/HostEnableDisable'))) + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/HostEnableDisable'))), + events: { + 'refresh-data': () => { + store.dispatch('refreshCurrentPage') + } + } }, { api: 'updateHost', @@ -126,9 +139,14 @@ export default { label: 'label.enable.host', message: 'message.confirm.enable.host', dataView: true, - show: (record) => { return record.resourcestate === 'Disabled' }, + show: (record) => record.resourcestate === 'Disabled', popup: true, - component: shallowRef(defineAsyncComponent(() => import('@/views/infra/HostEnableDisable'))) + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/HostEnableDisable'))), + events: { + 'refresh-data': () => { + store.dispatch('refreshCurrentPage') + } + } }, { api: 'prepareHostForMaintenance', @@ -156,6 +174,7 @@ export default { docHelp: 'adminguide/hosts.html#out-of-band-management', dataView: true, popup: true, + show: (record) => { return record.hypervisor !== 'External' }, component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ConfigureHostOOBM'))) }, { @@ -166,7 +185,7 @@ export default { docHelp: 'adminguide/hosts.html#out-of-band-management', dataView: true, show: (record) => { - return !(record?.outofbandmanagement?.enabled === true) + return record.hypervisor !== 'External' && !(record?.outofbandmanagement?.enabled === true) }, args: ['hostid'], mapping: { @@ -183,7 +202,7 @@ export default { docHelp: 'adminguide/hosts.html#out-of-band-management', dataView: true, show: (record) => { - return record?.outofbandmanagement?.enabled === true + return record.hypervisor !== 'External' && record?.outofbandmanagement?.enabled === true }, args: ['hostid'], mapping: { @@ -200,7 +219,7 @@ export default { docHelp: 'adminguide/hosts.html#out-of-band-management', dataView: true, show: (record) => { - return record?.outofbandmanagement?.enabled === true + return record.hypervisor !== 'External' && record?.outofbandmanagement?.enabled === true }, args: ['hostid', 'action'], mapping: { @@ -220,7 +239,7 @@ export default { docHelp: 'adminguide/hosts.html#out-of-band-management', dataView: true, show: (record) => { - return record?.outofbandmanagement?.enabled === true + return record.hypervisor !== 'External' && record?.outofbandmanagement?.enabled === true }, args: ['hostid', 'password'], mapping: { @@ -255,7 +274,7 @@ export default { docHelp: 'adminguide/reliability.html#ha-for-hosts', dataView: true, show: (record) => { - return !(record?.hostha?.haenable === true) + return record.hypervisor !== 'External' && !(record?.hostha?.haenable === true) }, args: ['hostid'], mapping: { diff --git a/ui/src/config/section/infra/managementServers.js b/ui/src/config/section/infra/managementServers.js index bd17a4b8d5aa..4bf54943fd85 100644 --- a/ui/src/config/section/infra/managementServers.js +++ b/ui/src/config/section/infra/managementServers.js @@ -39,6 +39,10 @@ export default { name: 'details', component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) }, + { + name: 'settings', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/SettingsTab.vue'))) + }, { name: 'management.server.peers', component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ManagementServerPeerTab.vue'))) @@ -75,6 +79,7 @@ export default { message: 'message.cancel.maintenance', dataView: true, popup: true, + args: ['rebalance'], show: (record, store) => { return ['PreparingForMaintenance', 'Maintenance'].includes(record.state) }, mapping: { managementserverid: { @@ -109,7 +114,6 @@ export default { icon: 'close-circle-outlined', label: 'label.cancel.shutdown', message: 'message.cancel.shutdown', - docHelp: 'installguide/configuration.html#adding-a-zone', dataView: true, popup: true, show: (record, store) => { return ['PreparingForShutDown', 'ReadyToShutDown', 'ShuttingDown'].includes(record.state) }, diff --git a/ui/src/config/section/infra/objectStorages.js b/ui/src/config/section/infra/objectStorages.js index 821c1b2d9484..f3469718efcc 100644 --- a/ui/src/config/section/infra/objectStorages.js +++ b/ui/src/config/section/infra/objectStorages.js @@ -29,7 +29,7 @@ export default { return fields }, details: () => { - var fields = ['name', 'id', 'url', 'providername'] + var fields = ['name', 'id', 'url', 'providername', 'storagetotal', 'storageallocated', 'storageused'] return fields }, resourceType: 'ObjectStorage', @@ -59,7 +59,7 @@ export default { api: 'updateObjectStoragePool', icon: 'edit-outlined', label: 'label.action.update.object.storage', - args: ['name', 'url'], + args: ['name', 'url', 'size'], dataView: true }, { diff --git a/ui/src/config/section/infra/phynetworks.js b/ui/src/config/section/infra/phynetworks.js index 578a12516fac..0863eff6ec0b 100644 --- a/ui/src/config/section/infra/phynetworks.js +++ b/ui/src/config/section/infra/phynetworks.js @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -import { shallowRef, defineAsyncComponent } from 'vue' +import { shallowRef, defineAsyncComponent, reactive } from 'vue' export default { name: 'physicalnetwork', title: 'label.physical.network', @@ -57,7 +57,7 @@ export default { args: ['name', 'zoneid', 'isolationmethods', 'vlan', 'tags', 'networkspeed', 'broadcastdomainrange'], mapping: { isolationmethods: { - options: ['VLAN', 'VXLAN', 'GRE', 'STT', 'BCF_SEGMENT', 'SSP', 'ODL', 'L3VPN', 'VCS'] + options: ['VLAN', 'VXLAN', 'GRE', 'STT', 'BCF_SEGMENT', 'SSP', 'ODL', 'L3VPN', 'VCS', 'NSX', 'NETRIS'] } } }, @@ -131,3 +131,6 @@ export default { } ] } +export const trafficTypeTab = reactive({ + index: 0 +}) diff --git a/ui/src/config/section/infra/pods.js b/ui/src/config/section/infra/pods.js index 595b35f4fb99..66d38c088964 100644 --- a/ui/src/config/section/infra/pods.js +++ b/ui/src/config/section/infra/pods.js @@ -26,7 +26,7 @@ export default { permission: ['listPods'], searchFilters: ['name', 'zoneid'], columns: ['name', 'allocationstate', 'gateway', 'netmask', 'zonename'], - details: ['name', 'id', 'allocationstate', 'netmask', 'gateway', 'zonename'], + details: ['name', 'id', 'allocationstate', 'netmask', 'gateway', 'zonename', 'storageaccessgroups', 'zonestorageaccessgroups'], related: [{ name: 'cluster', title: 'label.clusters', @@ -71,7 +71,8 @@ export default { icon: 'edit-outlined', label: 'label.edit', dataView: true, - args: ['name', 'netmask', 'gateway'] + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/PodUpdate.vue'))) }, { api: 'updatePod', diff --git a/ui/src/config/section/infra/primaryStorages.js b/ui/src/config/section/infra/primaryStorages.js index 826ffc7422b5..f127a0853b9e 100644 --- a/ui/src/config/section/infra/primaryStorages.js +++ b/ui/src/config/section/infra/primaryStorages.js @@ -35,7 +35,7 @@ export default { fields.push('zonename') return fields }, - details: ['name', 'id', 'ipaddress', 'type', 'nfsmountopts', 'scope', 'tags', 'path', 'provider', 'hypervisor', 'overprovisionfactor', 'disksizetotal', 'disksizeallocated', 'disksizeused', 'capacityiops', 'usediops', 'clustername', 'podname', 'zonename', 'created'], + details: ['name', 'id', 'ipaddress', 'type', 'details', 'nfsmountopts', 'scope', 'tags', 'storageaccessgroups', 'path', 'provider', 'hypervisor', 'overprovisionfactor', 'disksizetotal', 'disksizeallocated', 'disksizeused', 'capacityiops', 'usediops', 'clustername', 'podname', 'zonename', 'created'], related: [{ name: 'volume', title: 'label.volumes', diff --git a/ui/src/config/section/infra/routers.js b/ui/src/config/section/infra/routers.js index 76b1f4eba454..e52bcd7a829f 100644 --- a/ui/src/config/section/infra/routers.js +++ b/ui/src/config/section/infra/routers.js @@ -26,12 +26,12 @@ export default { permission: ['listRouters'], params: { projectid: '-1' }, columns: () => { - var columns = ['name', 'state', 'publicip', { field: 'guestnetworkname', customTitle: 'network' }, 'redundantstate', 'softwareversion', 'hostname', 'account', 'zonename', 'requiresupgrade'] + var columns = ['name', 'state', 'publicip', { field: 'guestnetworkname', customTitle: 'network' }, 'redundantstate', 'softwareversion', 'hostname', 'arch', 'account', 'zonename', 'requiresupgrade'] columns.splice(6, 0, { field: 'version', customTitle: 'templateversion' }) return columns }, - searchFilters: ['name', 'zoneid', 'podid', 'clusterid'], - details: ['name', 'id', 'version', 'softwareversion', 'requiresupgrade', 'guestnetworkname', 'vpcname', 'publicip', 'guestipaddress', 'linklocalip', 'serviceofferingname', 'networkdomain', 'isredundantrouter', 'redundantstate', 'hostname', 'account', 'zonename', 'created', 'hostcontrolstate'], + searchFilters: ['name', 'zoneid', 'podid', 'clusterid', 'arch'], + details: ['name', 'id', 'version', 'softwareversion', 'requiresupgrade', 'guestnetworkname', 'vpcname', 'publicip', 'guestipaddress', 'linklocalip', 'serviceofferingname', 'networkdomain', 'isredundantrouter', 'redundantstate', 'hostname', 'arch', 'account', 'zonename', 'created', 'hostcontrolstate'], resourceType: 'VirtualRouter', filters: () => { const filters = ['starting', 'running', 'stopping', 'stopped', 'destroyed', 'expunging', 'migrating', 'error', 'unknown', 'shutdown'] diff --git a/ui/src/config/section/infra/systemVms.js b/ui/src/config/section/infra/systemVms.js index 3ecd17f95caf..4a5879b17626 100644 --- a/ui/src/config/section/infra/systemVms.js +++ b/ui/src/config/section/infra/systemVms.js @@ -24,9 +24,9 @@ export default { icon: 'thunderbolt-outlined', docHelp: 'adminguide/systemvm.html', permission: ['listSystemVms'], - searchFilters: ['name', 'zoneid', 'podid', 'hostid', 'systemvmtype', 'storageid'], - columns: ['name', 'state', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'version', 'hostname', 'zonename'], - details: ['name', 'id', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'gateway', 'hostname', 'version', 'zonename', 'created', 'activeviewersessions', 'isdynamicallyscalable', 'hostcontrolstate'], + searchFilters: ['name', 'zoneid', 'podid', 'hostid', 'systemvmtype', 'storageid', 'arch'], + columns: ['name', 'state', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'version', 'hostname', 'arch', 'zonename'], + details: ['name', 'id', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'gateway', 'hostname', 'arch', 'version', 'zonename', 'created', 'activeviewersessions', 'isdynamicallyscalable', 'hostcontrolstate', 'storageip'], resourceType: 'SystemVm', filters: () => { const filters = ['starting', 'running', 'stopping', 'stopped', 'destroyed', 'expunging', 'migrating', 'error', 'unknown', 'shutdown'] diff --git a/ui/src/config/section/infra/zones.js b/ui/src/config/section/infra/zones.js index b4a34372e101..61aef1706c0b 100644 --- a/ui/src/config/section/infra/zones.js +++ b/ui/src/config/section/infra/zones.js @@ -26,15 +26,15 @@ export default { permission: ['listZonesMetrics'], searchFilters: ['name', 'domainid', 'tags'], columns: () => { - const fields = ['name', 'allocationstate', 'type', 'networktype', 'clusters'] - const metricsFields = ['cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal'] + const fields = ['name', 'allocationstate', 'type', 'networktype'] + const metricsFields = ['clusters', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'gputotal', 'gpuused'] if (store.getters.metrics) { fields.push(...metricsFields) } fields.push('order') return fields }, - details: ['name', 'id', 'allocationstate', 'type', 'networktype', 'guestcidraddress', 'localstorageenabled', 'securitygroupsenabled', 'dns1', 'dns2', 'internaldns1', 'internaldns2', 'asnrange'], + details: ['name', 'id', 'allocationstate', 'type', 'networktype', 'guestcidraddress', 'localstorageenabled', 'securitygroupsenabled', 'dns1', 'dns2', 'internaldns1', 'internaldns2', 'asnrange', 'storageaccessgroups'], related: [{ name: 'pod', title: 'label.pods', @@ -118,8 +118,9 @@ export default { icon: 'edit-outlined', label: 'label.action.edit.zone', dataView: true, - args: ['name', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'internaldns1', 'internaldns2', 'guestcidraddress', 'domain', 'localstorageenabled'], - show: (record) => { return record.networktype === 'Advanced' } + popup: true, + show: (record) => { return record.networktype === 'Advanced' }, + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/ZoneUpdate.vue'))) }, { api: 'updateZone', diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js index fc0a1f7dee6b..50c2ff4250b0 100644 --- a/ui/src/config/section/network.js +++ b/ui/src/config/section/network.js @@ -20,6 +20,7 @@ import store from '@/store' import tungsten from '@/assets/icons/tungsten.svg?inline' import { isAdmin } from '@/role' import { isZoneCreated } from '@/utils/zone' +import { vueProps } from '@/vue-app' export default { name: 'network', @@ -48,9 +49,14 @@ export default { return fields }, details: () => { - var fields = ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'egressdefaultpolicy', 'zonename', 'account', 'domainpath', 'associatednetwork', 'associatednetworkid', 'ip6firewall', 'ip6routing', 'ip6routes', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu', 'privatemtu'] - if (!isAdmin()) { - fields = fields.filter(function (e) { return e !== 'broadcasturi' }) + const fields = ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'asnumber', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'egressdefaultpolicy', 'zonename', 'account', 'domainpath', 'associatednetwork', 'associatednetworkid', 'ip4routing', 'ip6firewall', 'ip6routing', 'ip6routes', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu', 'privatemtu'] + if (isAdmin()) { + const vlanIndex = fields.findIndex(detail => detail === 'vlan') + fields.splice(vlanIndex + 1, 0, 'broadcasturi') + fields.push({ + field: 'keepmacaddressonpublicnic', + customTitle: 'keep.mac.address.on.public.nic' + }) } return fields }, @@ -68,6 +74,14 @@ export default { name: 'egress.rules', component: shallowRef(defineAsyncComponent(() => import('@/views/network/EgressRulesTab.vue'))), show: (record, route, user) => { return record.type === 'Isolated' && !('vpcname' in record) && 'listEgressFirewallRules' in store.getters.apis && (['Admin', 'DomainAdmin'].includes(user.roletype) || record.account === user.account || record.projectid) } + }, { + name: 'bgp.peers', + component: shallowRef(defineAsyncComponent(() => import('@/views/infra/zone/BgpPeersTab.vue'))), + show: (record, route, user) => { return !record.vpcid && ['Admin'].includes(user.roletype) && record.ip4routing === 'Dynamic' } + }, { + name: 'routing.firewall', + component: shallowRef(defineAsyncComponent(() => import('@/views/network/RoutingFirewallRulesTab.vue'))), + show: (record, route, user) => { return record.type === 'Isolated' && record.ip4routing && !('vpcname' in record) && 'listRoutingFirewallRules' in store.getters.apis && (['Admin', 'DomainAdmin'].includes(user.roletype) || record.account === user.account || record.projectid) } }, { name: 'ip.v6.firewall', component: shallowRef(defineAsyncComponent(() => import('@/views/network/Ipv6FirewallRulesTab.vue'))), @@ -75,7 +89,7 @@ export default { }, { name: (record) => { return record.type === 'Shared' ? 'ip.addresses' : 'public.ip.addresses' }, component: shallowRef(defineAsyncComponent(() => import('@/views/network/IpAddressesTab.vue'))), - show: (record, route, user) => { return 'listPublicIpAddresses' in store.getters.apis && (record.type === 'Shared' || (record.type === 'Isolated' && !('vpcname' in record) && (['Admin', 'DomainAdmin'].includes(user.roletype) || record.account === user.account || record.projectid))) } + show: (record, route, user) => { return 'listPublicIpAddresses' in store.getters.apis && (record.type === 'Shared' || (record.type === 'Isolated' && !record.ip4routing && !('vpcname' in record) && (['Admin', 'DomainAdmin'].includes(user.roletype) || record.account === user.account || record.projectid))) } }, { name: 'virtual.routers', component: shallowRef(defineAsyncComponent(() => import('@/views/network/RoutersTab.vue'))), @@ -163,18 +177,21 @@ export default { if (isGroupAction || record.vpcid == null) { fields.push('cleanup') } + if (!record.redundantrouter && vueProps.$config.allowMakingRouterRedundant) { + fields.push('makeredundant') + } fields.push('livepatch') return fields }, show: (record) => record.type !== 'L2', groupAction: true, popup: true, - groupMap: (selection, values) => { return selection.map(x => { return { id: x, cleanup: values.cleanup } }) } + groupMap: (selection, values) => { return selection.map(x => { return { id: x, cleanup: values.cleanup, makeredundant: values.makeredundant } }) } }, { api: 'replaceNetworkACLList', icon: 'swap-outlined', - label: 'label.replace.acl.list', + label: 'label.replace.acl', message: 'message.confirm.replace.acl.new.one', docHelp: 'adminguide/networking_and_traffic.html#configuring-network-access-control-list', dataView: true, @@ -221,8 +238,17 @@ export default { fields.push(...['domain', 'zonename']) return fields }, - details: ['name', 'id', 'displaytext', 'cidr', 'networkdomain', 'ip6routes', 'ispersistent', 'redundantvpcrouter', 'restartrequired', 'zonename', 'account', 'domain', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu'], - searchFilters: ['name', 'zoneid', 'domainid', 'account', 'tags'], + details: () => { + const fields = ['name', 'id', 'displaytext', 'cidr', 'networkdomain', 'ip4routing', 'ip4routes', 'ip6routes', 'ispersistent', 'redundantvpcrouter', 'restartrequired', 'zonename', 'account', 'domain', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'publicmtu'] + if (isAdmin()) { + fields.push({ + field: 'keepmacaddressonpublicnic', + customTitle: 'keep.mac.address.on.public.nic' + }) + } + return fields + }, + searchFilters: ['name', 'zoneid', 'domainid', 'account', 'restartrequired', 'tags'], related: [{ name: 'vm', title: 'label.instances', @@ -256,7 +282,13 @@ export default { icon: 'edit-outlined', label: 'label.edit', dataView: true, - args: ['name', 'displaytext', 'publicmtu', 'sourcenatipaddress'] + args: () => { + const fields = ['name', 'displaytext', 'publicmtu', 'sourcenatipaddress'] + if (isAdmin()) { + fields.push('keepmacaddressonpublicnic') + } + return fields + } }, { api: 'restartVPC', @@ -312,10 +344,7 @@ export default { return false } const listZoneHaveSGEnabled = store.getters.zones.filter(zone => zone.securitygroupsenabled === true) - if (!listZoneHaveSGEnabled || listZoneHaveSGEnabled.length === 0) { - return false - } - return true + return (listZoneHaveSGEnabled && listZoneHaveSGEnabled.length > 0) || store.getters.showSecurityGroups }, actions: [ { @@ -351,7 +380,10 @@ export default { permission: ['listVnfAppliances'], resourceType: 'UserVm', params: () => { - return { details: 'servoff,tmpl,nics', isvnf: true } + return { + details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff,vnfnics', + isvnf: true + } }, columns: () => { const fields = ['name', 'state', 'ipaddress'] @@ -693,7 +725,7 @@ export default { { api: 'resetUserDataForVirtualMachine', icon: 'solution-outlined', - label: 'label.reset.userdata.on.vm', + label: 'label.reset.user.data.on.vm', message: 'message.desc.reset.userdata', docHelp: 'adminguide/virtual_machines.html#resetting-userdata', dataView: true, @@ -795,7 +827,7 @@ export default { }, { name: 'vpn', component: shallowRef(defineAsyncComponent(() => import('@/views/network/VpnDetails.vue'))), - show: (record) => { return record.issourcenat } + show: (record) => { return record.issourcenat || record.virtualmachinetype === 'DomainRouter' || !record.hasrules } }, { name: 'events', @@ -873,6 +905,54 @@ export default { } ] }, + { + name: 'asnumbers', + title: 'label.asnumbers', + icon: 'partition-outlined', + permission: ['listASNumbers'], + show: () => { + if (!store.getters.zones || store.getters.zones.length === 0) { + return false + } + const AdvancedZonesWithRoutedmode = store.getters.zones.filter(zone => zone.routedmodeenabled) + if (isAdmin() && (AdvancedZonesWithRoutedmode && AdvancedZonesWithRoutedmode.length > 0)) { + return true + } + return false + }, + filters: ['all', 'allocatedonly', 'free'], + columns: ['asnumber', 'allocationstate', 'asnrange', 'associatednetworkname', 'vpcname', 'allocated', 'account', 'domain', 'zonename'], + searchFilters: ['zoneid', 'associatednetworkid', 'account', 'domainid'], + resourceType: 'ASNumber', + actions: [ + { + api: 'releaseASNumber', + icon: 'delete-outlined', + label: 'label.action.release.asnumber', + message: 'message.action.release.asnumber', + show: (record) => { return record.allocationstate === 'Allocated' }, + args: ['zoneid', 'asnumber'], + mapping: { + zoneid: { + value: (record) => { return record.zoneid } + }, + asnumber: { + value: (record) => { return record.asnumber } + } + }, + dataView: true, + groupAction: true, + popup: true, + groupShow: (selectedItems, storegetters) => { + return selectedItems.length === 1 && selectedItems[0].allocationstate === 'Allocated' + }, + groupMap: (selectedId, values, records) => { + const record = records.filter(x => { return x.id === selectedId[0] }) + return record + } + } + ] + }, { name: 'privategw', title: 'label.private.gateway', @@ -912,7 +992,7 @@ export default { { api: 'replaceNetworkACLList', icon: 'swap-outlined', - label: 'label.replace.acl.list', + label: 'label.replace.acl', message: 'message.confirm.replace.acl.new.one', docHelp: 'adminguide/networking_and_traffic.html#acl-on-private-gateway', dataView: true, @@ -968,7 +1048,6 @@ export default { title: 'label.site.to.site.vpn.connections', docHelp: 'adminguide/networking_and_traffic.html#setting-up-a-site-to-site-vpn-connection', icon: 'sync-outlined', - hidden: true, permission: ['listVpnConnections'], columns: ['publicip', 'state', 'gateway', 'ipsecpsk', 'ikepolicy', 'esppolicy'], details: ['publicip', 'gateway', 'passive', 'cidrlist', 'ipsecpsk', 'ikepolicy', 'esppolicy', 'ikelifetime', 'ikeversion', 'esplifetime', 'dpd', 'splitconnections', 'forceencap', 'created'], @@ -1009,10 +1088,9 @@ export default { }, { name: 'acllist', - title: 'label.network.acl.lists', + title: 'label.network.acls', icon: 'bars-outlined', docHelp: 'adminguide/networking_and_traffic.html#configuring-network-access-control-list', - hidden: true, permission: ['listNetworkACLLists'], columns: ['name', 'description', 'id'], details: ['name', 'description', 'id'], @@ -1020,15 +1098,15 @@ export default { name: 'details', component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) }, { - name: 'acl.list.rules', - component: shallowRef(defineAsyncComponent(() => import('@/views/network/AclListRulesTab.vue'))), + name: 'acl.rules', + component: shallowRef(defineAsyncComponent(() => import('@/views/network/AclRulesTab.vue'))), show: () => true }], actions: [ { api: 'createNetworkACLList', icon: 'plus-outlined', - label: 'label.add.acl.list', + label: 'label.add.acl', docHelp: 'adminguide/networking_and_traffic.html#creating-acl-lists', listView: true, args: ['name', 'description', 'vpcid'] @@ -1036,15 +1114,15 @@ export default { { api: 'updateNetworkACLList', icon: 'edit-outlined', - label: 'label.edit.acl.list', + label: 'label.edit.acl', dataView: true, args: ['name', 'description'] }, { api: 'deleteNetworkACLList', icon: 'delete-outlined', - label: 'label.delete.acl.list', - message: 'message.confirm.delete.acl.list', + label: 'label.delete.acl', + message: 'message.confirm.delete.acl', dataView: true } ] @@ -1212,15 +1290,11 @@ export default { { api: 'updateVpnCustomerGateway', icon: 'edit-outlined', - label: 'label.edit', + label: 'label.update.vpn.customer.gateway', docHelp: 'adminguide/networking_and_traffic.html#updating-and-removing-a-vpn-customer-gateway', dataView: true, - args: ['name', 'gateway', 'cidrlist', 'ipsecpsk', 'ikepolicy', 'ikelifetime', 'ikeversion', 'esppolicy', 'esplifetime', 'dpd', 'splitconnections', 'forceencap'], - mapping: { - ikeversion: { - options: ['ike', 'ikev1', 'ikev2'] - } - } + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/network/UpdateVpnCustomerGateway.vue'))) }, { api: 'deleteVpnCustomerGateway', @@ -1397,6 +1471,46 @@ export default { show: (record) => { return (record.allocationstate === 'Allocated') } }], show: isZoneCreated + }, + { + name: 'ipv4subnets', + title: 'label.ipv4.subnets', + icon: 'pic-center-outlined', + permission: ['listIpv4SubnetsForGuestNetwork'], + columns: ['subnet', 'zonename', 'parentsubnet', 'networkname', 'vpcname', 'created', 'allocated'], + details: ['subnet', 'zonename', 'zoneid', 'parentsubnet', 'networkname', 'networkid', 'vpcname', 'vpcid', 'created', 'allocated', 'state'], + searchFilters: ['zoneid'], + show: () => { + if (!store.getters.zones || store.getters.zones.length === 0) { + return false + } + const AdvancedZonesWithRoutedmode = store.getters.zones.filter(zone => zone.routedmodeenabled) + if (isAdmin() && (AdvancedZonesWithRoutedmode && AdvancedZonesWithRoutedmode.length > 0)) { + return true + } + return false + }, + actions: [ + { + api: 'createIpv4SubnetForGuestNetwork', + icon: 'plus-outlined', + label: 'label.add.ipv4.subnet', + listView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/network/CreateIpv4SubnetForNetwork.vue'))) + }, + { + api: 'deleteIpv4SubnetForGuestNetwork', + icon: 'delete-outlined', + label: 'label.delete.ipv4.subnet', + message: 'message.action.delete.ipv4.subnet', + dataView: true, + show: (record) => { return !record.networkid }, + groupAction: true, + popup: true, + groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + } + ] } ] } diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js index f83daaea7638..9d7b743a70aa 100644 --- a/ui/src/config/section/offering.js +++ b/ui/src/config/section/offering.js @@ -16,6 +16,7 @@ // under the License. import { shallowRef, defineAsyncComponent } from 'vue' import store from '@/store' +import { getFilteredExternalDetails } from '@/utils/extension' export default { name: 'offering', @@ -29,7 +30,7 @@ export default { docHelp: 'adminguide/service_offerings.html#compute-and-disk-service-offerings', icon: 'cloud-outlined', permission: ['listServiceOfferings'], - searchFilters: ['name', 'zoneid', 'domainid', 'cpunumber', 'cpuspeed', 'memory'], + searchFilters: ['name', 'gpuenabled', 'zoneid', 'domainid', 'cpunumber', 'cpuspeed', 'memory'], params: () => { var params = {} if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { @@ -38,9 +39,9 @@ export default { return params }, filters: ['active', 'inactive'], - columns: ['name', 'displaytext', 'state', 'cpunumber', 'cpuspeed', 'memory', 'domain', 'zone', 'order'], + columns: ['name', 'displaytext', 'state', 'cpunumber', 'cpuspeed', 'memory', 'gpu', 'domain', 'zone', 'order'], details: () => { - var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'iscustomizediops', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'storagetags', 'domain', 'zone', 'created', 'dynamicscalingenabled', 'diskofferingstrictness', 'encryptroot', 'purgeresources'] + var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'iscustomizediops', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'storageaccessgroups', 'storagetags', 'domain', 'zone', 'created', 'dynamicscalingenabled', 'diskofferingstrictness', 'encryptroot', 'purgeresources', 'leaseduration', 'gpucardid', 'gpucardname', 'vgpuprofileid', 'vgpuprofilename', 'gpucount', 'gpudisplay', 'leaseexpiryaction', 'externaldetails'] if (store.getters.apis.createServiceOffering && store.getters.apis.createServiceOffering.params.filter(x => x.name === 'storagepolicy').length > 0) { fields.splice(6, 0, 'vspherestoragepolicy') @@ -95,7 +96,12 @@ export default { label: 'label.edit', docHelp: 'adminguide/service_offerings.html#modifying-or-deleting-a-service-offering', dataView: true, - args: ['name', 'displaytext', 'storagetags', 'hosttags'] + args: ['name', 'displaytext', 'storagetags', 'hosttags', 'externaldetails'], + mapping: { + externaldetails: { + transformedvalue: (record) => { return getFilteredExternalDetails(record.serviceofferingdetails) } + } + } }, { api: 'updateServiceOffering', icon: 'lock-outlined', @@ -122,7 +128,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteServiceOffering', + api: 'updateServiceOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.service.offering', message: 'message.action.disable.service.offering', @@ -130,8 +136,21 @@ export default { dataView: true, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, - groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Inactive' } }) } + }, { + api: 'cloneServiceOffering', + icon: 'copy-outlined', + label: 'label.clone.compute.offering', + docHelp: 'adminguide/service_offerings.html#creating-a-new-compute-offering', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneComputeOffering.vue'))) }] }, { @@ -198,7 +217,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteServiceOffering', + api: 'updateServiceOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.system.service.offering', message: 'message.action.disable.system.service.offering', @@ -207,8 +226,22 @@ export default { params: { issystem: 'true' }, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, - groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Inactive' } }) } + }, { + api: 'cloneServiceOffering', + icon: 'copy-outlined', + label: 'label.clone.system.service.offering', + docHelp: 'adminguide/service_offerings.html#creating-a-new-system-service-offering', + dataView: true, + params: { issystem: 'true' }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneComputeOffering.vue'))) }] }, { @@ -301,7 +334,7 @@ export default { show: (record) => { return record.state !== 'Active' }, groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Active' } }) } }, { - api: 'deleteDiskOffering', + api: 'updateDiskOffering', icon: 'pause-circle-outlined', label: 'label.action.disable.disk.offering', message: 'message.action.disable.disk.offering', @@ -309,8 +342,21 @@ export default { dataView: true, groupAction: true, popup: true, + mapping: { + state: { + value: (record) => { return 'Inactive' } + } + }, show: (record) => { return record.state === 'Active' }, - groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + groupMap: (selection) => { return selection.map(x => { return { id: x, state: 'Inactive' } }) } + }, { + api: 'cloneDiskOffering', + icon: 'copy-outlined', + label: 'label.clone.disk.offering', + docHelp: 'adminguide/service_offerings.html#creating-a-new-disk-offering', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneDiskOffering.vue'))) }] }, { @@ -319,9 +365,9 @@ export default { icon: 'cloud-upload-outlined', docHelp: 'adminguide/virtual_machines.html#backup-offerings', permission: ['listBackupOfferings'], - searchFilters: ['zoneid'], - columns: ['name', 'description', 'zonename'], - details: ['name', 'id', 'description', 'externalid', 'zone', 'allowuserdrivenbackups', 'created'], + searchFilters: ['zoneid', 'domainid'], + columns: ['name', 'description', 'domain', 'zonename'], + details: ['name', 'id', 'description', 'externalid', 'domain', 'zone', 'allowuserdrivenbackups', 'created'], related: [{ name: 'vm', title: 'label.instances', @@ -355,6 +401,14 @@ export default { popup: true, groupMap: (selection) => { return selection.map(x => { return { id: x } }) }, args: ['name', 'description', 'allowuserdrivenbackups'] + }, { + api: 'cloneBackupOffering', + icon: 'copy-outlined', + label: 'label.clone.backup.offering', + docHelp: 'adminguide/virtual_machines.html#importing-backup-offerings', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneBackupOffering.vue'))) }, { api: 'deleteBackupOffering', icon: 'delete-outlined', @@ -466,6 +520,14 @@ export default { dataView: true, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/offering/UpdateOfferingAccess.vue'))) + }, { + api: 'cloneNetworkOffering', + icon: 'copy-outlined', + label: 'label.clone.network.offering', + docHelp: 'adminguide/networking.html#creating-a-new-network-offering', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneNetworkOffering.vue'))) }, { api: 'deleteNetworkOffering', icon: 'delete-outlined', @@ -487,7 +549,7 @@ export default { searchFilters: ['name', 'zoneid', 'domainid'], resourceType: 'VpcOffering', columns: ['name', 'state', 'displaytext', 'domain', 'zone', 'order'], - details: ['name', 'id', 'displaytext', 'internetprotocol', 'distributedvpcrouter', 'tags', 'routingmode', 'specifyasnumber', 'service', 'fornsx', 'networkmode', 'domain', 'zone', 'created'], + details: ['name', 'id', 'displaytext', 'internetprotocol', 'distributedvpcrouter', 'tags', 'routingmode', 'specifyasnumber', 'service', 'fornsx', 'networkmode', 'conservemode', 'domain', 'zone', 'created'], related: [{ name: 'vpc', title: 'label.vpc', @@ -558,6 +620,14 @@ export default { dataView: true, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/offering/UpdateOfferingAccess.vue'))) + }, { + api: 'cloneVPCOffering', + icon: 'copy-outlined', + docHelp: 'plugins/nuage-plugin.html?#optional-create-and-enable-vpc-offering', + label: 'label.clone.vpc.offering', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/offering/CloneVpcOffering.vue'))) }, { api: 'deleteVPCOffering', icon: 'delete-outlined', diff --git a/ui/src/config/section/project.js b/ui/src/config/section/project.js index 18354c3c7ec9..c08cb8dce4dc 100644 --- a/ui/src/config/section/project.js +++ b/ui/src/config/section/project.js @@ -46,6 +46,10 @@ export default { 'listProjectRoles' in store.getters.apis } }, + { + name: 'certificates', + component: shallowRef(defineAsyncComponent(() => import('@/views/iam/SSLCertificateTab.vue'))) + }, { name: 'limits', component: shallowRef(defineAsyncComponent(() => import('@/components/view/ResourceCountUsage.vue'))) @@ -158,6 +162,7 @@ export default { }, groupAction: true, popup: true, + requireNameConfirmation: true, groupMap: (selection, values) => { return selection.map(x => { return { id: x, cleanup: values.cleanup || null } }) }, args: (record, store) => { const fields = [] diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index bcd48944497b..75432314b034 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -39,7 +39,7 @@ export default { } }, columns: () => { - const fields = ['name', 'state', 'sizegb', 'type', 'vmname', 'vmstate'] + const fields = ['name', 'state', 'size', 'type', 'vmname', 'vmstate'] const metricsFields = ['diskkbsread', 'diskkbswrite', 'diskiopstotal'] if (store.getters.userInfo.roletype === 'Admin') { @@ -92,7 +92,7 @@ export default { } ], searchFilters: () => { - var filters = ['name', 'zoneid', 'domainid', 'account', 'state', 'tags', 'serviceofferingid', 'diskofferingid', 'isencrypted'] + const filters = ['name', 'zoneid', 'domainid', 'account', 'state', 'tags', 'serviceofferingid', 'diskofferingid', 'isencrypted'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { filters.push('storageid') } @@ -228,7 +228,7 @@ export default { label: 'label.change.offering.for.volume', args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'], dataView: true, - show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, + show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue'))) }, @@ -311,7 +311,10 @@ export default { permission: ['listSnapshots'], resourceType: 'Snapshot', columns: () => { - var fields = ['name', 'state', 'volumename', 'intervaltype', 'physicalsize', 'created'] + const fields = ['name', 'state', 'volumename', 'intervaltype', 'physicalsize', 'created'] + if (store.getters.features.snapshotshowchainsize) { + fields.splice(fields.indexOf('created'), 0, 'chainsize', 'parentname') + } if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { fields.push('account') if (store.getters.listAllProjects) { @@ -324,7 +327,13 @@ export default { fields.push('zonename') return fields }, - details: ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'account', 'domain', 'created'], + details: () => { + const fields = ['name', 'id', 'volumename', 'volumetype', 'snapshottype', 'intervaltype', 'physicalsize', 'virtualsize', 'account', 'domain', 'created'] + if (store.getters.features.snapshotshowchainsize) { + fields.splice(fields.indexOf('account'), 0, 'chainsize', 'parentname') + } + return fields + }, tabs: [ { name: 'details', @@ -346,7 +355,7 @@ export default { } ], searchFilters: () => { - var filters = ['name', 'domainid', 'account', 'tags', 'zoneid'] + const filters = ['name', 'domainid', 'account', 'tags', 'zoneid'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { filters.push('storageid') filters.push('imagestoreid') @@ -413,22 +422,82 @@ export default { } ] }, + { + name: 'snapshotpolicy', + title: 'label.snapshotpolicies', + icon: 'build-outlined', + docHelp: 'adminguide/storage.html#working-with-volume-snapshots', + permission: ['listSnapshotPolicies'], + resourceType: 'SnapshotPolicy', + params: { listall: true }, + columns: () => { + var fields = ['intervaltype', 'maxsnaps', 'schedule', 'timezone', 'volumename'] + return fields + }, + searchFilters: ['volumeid'], + actions: [ + { + api: 'createSnapshotPolicy', + icon: 'plus-outlined', + docHelp: 'adminguide/storage.html#working-with-volume-snapshots', + label: 'label.action.create.recurring.snapshot', + listView: true, + show: () => { return 'createSnapshotPolicy' in store.getters.apis }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/storage/RecurringSnapshotVolume.vue'))), + mapping: { + intervaltype: { + options: ['HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY'] + } + } + }, + { + api: 'deleteSnapshotPolicies', + icon: 'delete-outlined', + label: 'label.delete.snapshot.policy', + message: 'message.action.delete.snapshot.policy', + dataView: true, + show: (record) => true, + args: ['id'], + mapping: { + id: { + value: (record) => record.id + } + } + } + ] + }, { name: 'backup', - title: 'label.backup', + title: 'label.backups', icon: 'cloud-upload-outlined', permission: ['listBackups'], - columns: [{ name: (record) => { return record.virtualmachinename } }, 'status', 'size', 'virtualsize', 'type', 'created', 'account', 'domain', 'zone'], - details: ['virtualmachinename', 'id', 'type', 'externalid', 'size', 'virtualsize', 'volumes', 'backupofferingname', 'zone', 'account', 'domain', 'created'], + params: { listvmdetails: 'true' }, + columns: ['name', 'status', 'size', 'virtualsize', 'virtualmachinename', 'backupofferingname', 'intervaltype', 'type', 'created', 'account', 'domain', 'zone'], + details: ['name', 'description', 'virtualmachinename', 'id', 'intervaltype', 'type', 'externalid', 'size', 'virtualsize', 'volumes', 'backupofferingname', 'zone', 'account', 'domain', 'created'], + searchFilters: () => { + var filters = ['name', 'zoneid', 'domainid', 'account', 'backupofferingid'] + return filters + }, + tabs: [ + { + name: 'details', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) + }, + { + name: 'instance.metadata', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/BackupMetadata.vue'))) + } + ], actions: [ { api: 'restoreBackup', icon: 'sync-outlined', - docHelp: 'adminguide/virtual_machines.html#restoring-vm-backups', + docHelp: 'adminguide/virtual_machines.html#restoring-instance-backups', label: 'label.backup.restore', message: 'message.backup.restore', dataView: true, - show: (record) => { return record.state !== 'Destroyed' } + show: (record) => { return record.status === 'BackedUp' } }, { api: 'restoreVolumeFromBackupAndAttachToVM', @@ -436,17 +505,28 @@ export default { label: 'label.backup.attach.restore', message: 'message.backup.attach.restore', dataView: true, - show: (record) => { return record.state !== 'Destroyed' }, + show: (record) => { return record.status === 'BackedUp' }, popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/storage/RestoreAttachBackupVolume.vue'))) }, + { + api: 'createVMFromBackup', + icon: 'caret-right-outlined', + docHelp: 'adminguide/virtual_machines.html#creating-a-new-instance-from-backup', + label: 'label.create.instance.from.backup', + message: 'message.backup.restore', + dataView: true, + popup: true, + show: (record) => { return record.status === 'BackedUp' }, + component: shallowRef(defineAsyncComponent(() => import('@/views/storage/CreateVMFromBackup.vue'))) + }, { api: 'removeVirtualMachineFromBackupOffering', icon: 'scissor-outlined', label: 'label.backup.offering.remove', message: 'message.backup.offering.remove', dataView: true, - show: (record) => { return record.state !== 'Destroyed' }, + show: (record) => { return record.state !== 'Destroyed' && record.vmbackupofferingremoved !== true }, args: ['forced', 'virtualmachineid'], mapping: { forced: { @@ -471,6 +551,51 @@ export default { } ] }, + { + name: 'backupschedule', + title: 'label.backup.schedules', + icon: 'build-outlined', + docHelp: 'adminguide/storage.html#working-with-volume-snapshots', + permission: ['listBackupSchedule'], + resourceType: 'backupSchedule', + params: { listall: true }, + columns: () => { + var fields = ['intervaltype', 'maxbackups', 'schedule', 'timezone', 'virtualmachinename'] + return fields + }, + searchFilters: ['virtualmachineid'], + actions: [ + { + api: 'createBackupSchedule', + icon: 'plus-outlined', + docHelp: 'adminguide/storage.html#working-with-volume-snapshots', + label: 'label.action.create.backup.schedule', + listView: true, + show: () => { return 'createBackupSchedule' in store.getters.apis }, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/backup/CreateBackupSchedule.vue'))), + mapping: { + intervaltype: { + options: ['HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY'] + } + } + }, + { + api: 'deleteBackupSchedule', + icon: 'delete-outlined', + label: 'label.delete.backup.schedule', + message: 'message.action.delete.backup.schedule', + dataView: true, + show: (record) => true, + args: ['id'], + mapping: { + id: { + value: (record) => record.id + } + } + } + ] + }, { name: 'buckets', title: 'label.buckets', diff --git a/ui/src/config/section/tools.js b/ui/src/config/section/tools.js index a07228ca87b4..5b7f4b9af325 100644 --- a/ui/src/config/section/tools.js +++ b/ui/src/config/section/tools.js @@ -116,6 +116,10 @@ export default { name: 'details', component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue'))) }, + { + name: 'filters', + component: shallowRef(defineAsyncComponent(() => import('@/components/view/WebhookFiltersTab.vue'))) + }, { name: 'recent.deliveries', component: shallowRef(defineAsyncComponent(() => import('@/components/view/WebhookDeliveriesTab.vue'))) diff --git a/ui/src/config/section/user.js b/ui/src/config/section/user.js index a18994fd6ce1..eaaca983dc0a 100644 --- a/ui/src/config/section/user.js +++ b/ui/src/config/section/user.js @@ -82,12 +82,34 @@ export default { popup: true, component: shallowRef(defineAsyncComponent(() => import('@/views/iam/EditUser.vue'))) }, + { + api: 'updateUser', + icon: 'redo-outlined', + label: 'label.change.password.reset', + message: 'message.change.password.reset', + dataView: true, + args: ['passwordchangerequired'], + mapping: { + passwordchangerequired: { + value: (record) => { return true } + } + }, + popup: true, + show: (record, store) => { + return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && !record.isdefault && + store.userInfo.id !== record.id && record.state === 'enabled' && record.usersource === 'native' + } + }, { api: 'updateUser', icon: 'key-outlined', label: 'label.action.change.password', dataView: true, popup: true, + show: (record, store) => { + return (['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) || store.userInfo.id === record.id) && + ['native'].includes(record.usersource) && record.state === 'enabled' + }, component: shallowRef(defineAsyncComponent(() => import('@/views/iam/ChangeUserPassword.vue'))) }, { @@ -105,9 +127,10 @@ export default { message: 'message.enable.user', dataView: true, show: (record, store) => { - return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && !record.isdefault && - !(record.domain === 'ROOT' && record.account === 'admin' && record.accounttype === 1) && - ['disabled', 'locked'].includes(record.state) + if (!['disabled', 'locked'].includes(record.state) || record.isdefault || !['Admin', 'DomainAdmin'].includes(store.userInfo.roletype)) { + return false + } + return ![1, 4].includes(record.accounttype) || store.userInfo.roletype === 'Admin' } }, { @@ -117,9 +140,10 @@ export default { message: 'message.disable.user', dataView: true, show: (record, store) => { - return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && !record.isdefault && - !(record.domain === 'ROOT' && record.account === 'admin' && record.accounttype === 1) && - record.state === 'enabled' + if (record.state !== 'enabled' || record.isdefault || !['Admin', 'DomainAdmin'].includes(store.userInfo.roletype)) { + return false + } + return ![1, 4].includes(record.accounttype) || (store.userInfo.roletype === 'Admin' && record.id !== store.userInfo.id) } }, { @@ -131,9 +155,10 @@ export default { dataView: true, popup: true, show: (record, store) => { - return ['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && !record.isdefault && - !(record.domain === 'ROOT' && record.account === 'admin' && record.accounttype === 1) && - record.state === 'enabled' + if (record.state !== 'enabled' || record.isdefault || !['Admin', 'DomainAdmin'].includes(store.userInfo.roletype)) { + return false + } + return ![1, 4].includes(record.accounttype) || (store.userInfo.roletype === 'Admin' && record.id !== store.userInfo.id) } }, { @@ -154,7 +179,7 @@ export default { dataView: true, popup: true, show: (record, store) => { - return (record.is2faenabled === false && record.id === store.userInfo.id) + return (!record.is2faenabled && record.id === store.userInfo.id) }, component: shallowRef(defineAsyncComponent(() => import('@/views/iam/SetupTwoFaAtUserProfile.vue'))) }, diff --git a/ui/src/core/ext.js b/ui/src/core/ext.js index 06bea8cd7d21..ac8e0e45fcb5 100644 --- a/ui/src/core/ext.js +++ b/ui/src/core/ext.js @@ -19,10 +19,10 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { faCentos, faUbuntu, faDebian, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava } from '@fortawesome/free-brands-svg-icons' -import { fas, faCompactDisc, faCameraRetro, faDharmachakra } from '@fortawesome/free-solid-svg-icons' +import { fas, faCompactDisc, faCameraRetro, faDharmachakra, faMicrochip } from '@fortawesome/free-solid-svg-icons' library.add(faCentos, faUbuntu, faDebian, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava) -library.add(fas, faCompactDisc, faCameraRetro, faDharmachakra) +library.add(fas, faCompactDisc, faCameraRetro, faDharmachakra, faMicrochip) export default { install: (app) => { diff --git a/ui/src/core/lazy_lib/components_use.js b/ui/src/core/lazy_lib/components_use.js index 3ee5d07a49d3..6f716bfbd949 100644 --- a/ui/src/core/lazy_lib/components_use.js +++ b/ui/src/core/lazy_lib/components_use.js @@ -48,6 +48,7 @@ import { Divider, DatePicker, TimePicker, + Typography, Upload, Progress, Skeleton, @@ -117,6 +118,7 @@ export default { app.use(Divider) app.use(DatePicker) app.use(TimePicker) + app.use(Typography) app.use(Upload) app.use(Progress) app.use(Skeleton) diff --git a/ui/src/core/lazy_lib/icons_use.js b/ui/src/core/lazy_lib/icons_use.js index 8595454b679c..502eb5de0b63 100644 --- a/ui/src/core/lazy_lib/icons_use.js +++ b/ui/src/core/lazy_lib/icons_use.js @@ -19,6 +19,7 @@ import { AimOutlined, ApartmentOutlined, ApiOutlined, + AppstoreAddOutlined, AppstoreOutlined, ArrowDownOutlined, ArrowRightOutlined, @@ -82,7 +83,9 @@ import { FieldTimeOutlined, FileDoneOutlined, FileProtectOutlined, + FileSyncOutlined, FileTextOutlined, + FileZipOutlined, FilterOutlined, FilterTwoTone, FireOutlined, @@ -99,6 +102,7 @@ import { GlobalOutlined, GoldOutlined, GoogleOutlined, + GroupOutlined, HddOutlined, HomeOutlined, IdcardOutlined, @@ -135,6 +139,7 @@ import { PictureOutlined, PieChartOutlined, PlayCircleOutlined, + PlaySquareOutlined, PlusCircleOutlined, PlusOutlined, PlusSquareOutlined, @@ -189,6 +194,7 @@ export default { app.component('AimOutlined', AimOutlined) app.component('ApartmentOutlined', ApartmentOutlined) app.component('ApiOutlined', ApiOutlined) + app.component('AppstoreAddOutlined', AppstoreAddOutlined) app.component('AppstoreOutlined', AppstoreOutlined) app.component('ArrowDownOutlined', ArrowDownOutlined) app.component('ArrowRightOutlined', ArrowRightOutlined) @@ -252,7 +258,9 @@ export default { app.component('FieldTimeOutlined', FieldTimeOutlined) app.component('FileDoneOutlined', FileDoneOutlined) app.component('FileProtectOutlined', FileProtectOutlined) + app.component('FileSyncOutlined', FileSyncOutlined) app.component('FileTextOutlined', FileTextOutlined) + app.component('FileZipOutlined', FileZipOutlined) app.component('FilterOutlined', FilterOutlined) app.component('FilterTwoTone', FilterTwoTone) app.component('FireOutlined', FireOutlined) @@ -269,6 +277,7 @@ export default { app.component('GlobalOutlined', GlobalOutlined) app.component('GoldOutlined', GoldOutlined) app.component('GoogleOutlined', GoogleOutlined) + app.component('GroupOutlined', GroupOutlined) app.component('HddOutlined', HddOutlined) app.component('HomeOutlined', HomeOutlined) app.component('IdcardOutlined', IdcardOutlined) @@ -305,6 +314,7 @@ export default { app.component('PictureOutlined', PictureOutlined) app.component('PieChartOutlined', PieChartOutlined) app.component('PlayCircleOutlined', PlayCircleOutlined) + app.component('PlaySquareOutlined', PlaySquareOutlined) app.component('PlusCircleOutlined', PlusCircleOutlined) app.component('PlusOutlined', PlusOutlined) app.component('PlusSquareOutlined', PlusSquareOutlined) diff --git a/ui/src/main.js b/ui/src/main.js index e22cca334e55..7441f8010865 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +import { createApp, h } from 'vue' import { vueApp, vueProps } from './vue-app' import router from './router' import store from './store' @@ -35,10 +36,18 @@ import { resourceTypePlugin, fileSizeUtilPlugin, genericUtilPlugin, - localesPlugin + localesPlugin, + dialogUtilPlugin, + cpuArchitectureUtilPlugin, + imagesUtilPlugin, + extensionsUtilPlugin, + backupUtilPlugin } from './utils/plugins' import { VueAxios } from './utils/request' import directives from './utils/directives' +import Cookies from 'js-cookie' +import { getAPI } from '@/api' +import { applyCustomGuiTheme } from './utils/guiTheme' vueApp.use(VueAxios, router) vueApp.use(pollJobPlugin) @@ -51,23 +60,71 @@ vueApp.use(resourceTypePlugin) vueApp.use(fileSizeUtilPlugin) vueApp.use(localesPlugin) vueApp.use(genericUtilPlugin) +vueApp.use(dialogUtilPlugin) +vueApp.use(cpuArchitectureUtilPlugin) +vueApp.use(imagesUtilPlugin) +vueApp.use(extensionsUtilPlugin) +vueApp.use(backupUtilPlugin) vueApp.use(extensions) vueApp.use(directives) -fetch('config.json?ts=' + Date.now()).then(response => response.json()).then(config => { - vueProps.$config = config - let basUrl = config.apiBase - if (config.multipleServer) { - basUrl = (config.servers[0].apiHost || '') + config.servers[0].apiBase +const renderError = (err) => { + console.error('Fatal error during app initialization: ', err) + const ErrorComponent = { + render: () => h( + 'div', + { style: 'font-family: sans-serif; text-align: center; padding: 2rem;' }, + [ + h('h2', { style: 'color: #ff4d4f;' }, 'We\'re experiencing a problem'), + h('p', 'The application could not be loaded due to a configuration issue. Please try again later.'), + h('details', { style: 'margin-top: 20px;' }, [ + h('summary', { style: 'cursor: pointer;' }, 'Technical details'), + h('pre', { + style: 'text-align: left; display: inline-block; margin-top: 10px;' + }, 'Missing or malformed config.json. Please ensure the file is present, accessible, and contains valid JSON. Check the browser console for more information.') + ]) + ] + ) } + createApp(ErrorComponent).mount('#app') +} - vueProps.axios.defaults.baseURL = basUrl +fetch('config.json?ts=' + Date.now()) + .then(response => { + if (!response.ok) { + throw new Error(`Failed to fetch config.json: ${response.status} ${response.statusText}`) + } + return response.json() + }) + .then(async config => { + vueProps.$config = config + let baseUrl = config.apiBase + if (config.multipleServer) { + baseUrl = (config.servers[0].apiHost || '') + config.servers[0].apiBase + } + + vueProps.axios.defaults.baseURL = baseUrl + + const userid = Cookies.get('userid') + let accountid = null + let domainid = null + + if (userid !== undefined && Cookies.get('sessionkey')) { + await getAPI('listUsers', { userid: userid }).then(response => { + accountid = response.listusersresponse.user[0].accountid + domainid = response.listusersresponse.user[0].domainid + }) + } + + await applyCustomGuiTheme(accountid, domainid) - loadLanguageAsync().then(() => { - vueApp.use(store) - .use(router) - .use(i18n) - .use(bootstrap) - .mount('#app') + loadLanguageAsync().then(() => { + vueApp.use(store) + .use(router) + .use(i18n) + .use(bootstrap) + .mount('#app') + }) + }).catch(error => { + renderError(error) }) -}) diff --git a/ui/src/permission.js b/ui/src/permission.js index 266dc992c8db..0b87de92c6b4 100644 --- a/ui/src/permission.js +++ b/ui/src/permission.js @@ -93,6 +93,17 @@ router.beforeEach((to, from, next) => { return } store.commit('SET_LOGIN_FLAG', true) + store.commit('SET_MS_ID', Cookies.get('managementserverid')) + } + // store already loaded + if (store.getters.passwordChangeRequired) { + if (to.path === '/user/forceChangePassword') { + next() + } else { + next({ path: '/user/forceChangePassword' }) + NProgress.done() + } + return } if (Object.keys(store.getters.apis).length === 0) { const cachedApis = vueProps.$localStorage.get(APIS, {}) @@ -102,6 +113,19 @@ router.beforeEach((to, from, next) => { store .dispatch('GetInfo') .then(apis => { + // Essential for Page Refresh scenarios + if (store.getters.passwordChangeRequired) { + // Only allow the Change Password page + if (to.path === '/user/forceChangePassword') { + next() + } else { + // Redirect everything else (including dashboard, wildcards) to Change Password + next({ path: '/user/forceChangePassword' }) + NProgress.done() + } + return + } + store.dispatch('GenerateRoutes', { apis }).then(() => { store.getters.addRouters.map(route => { router.addRoute(route) diff --git a/ui/src/store/getters.js b/ui/src/store/getters.js index 911234d9b715..c7ab2f0c536b 100644 --- a/ui/src/store/getters.js +++ b/ui/src/store/getters.js @@ -55,7 +55,8 @@ const getters = { loginFlag: state => state.user.loginFlag, allProjects: (state) => state.app.allProjects, customHypervisorName: state => state.user.customHypervisorName, - readyForShutdownPollingJob: state => state.user.readyForShutdownPollingJob + readyForShutdownPollingJob: state => state.user.readyForShutdownPollingJob, + passwordChangeRequired: state => state.user.passwordChangeRequired } export default getters diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index 1dacc09a54e3..6a818d587233 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -23,7 +23,7 @@ import semver from 'semver' import { vueProps } from '@/vue-app' import router from '@/router' import store from '@/store' -import { oauthlogin, login, logout, api } from '@/api' +import { oauthlogin, login, logout, getAPI } from '@/api' import { i18n } from '@/locales' import { axios } from '../../utils/request' import { getParsedVersion } from '@/utils/util' @@ -44,9 +44,14 @@ import { MS_ID, OAUTH_DOMAIN, OAUTH_PROVIDER, - LATEST_CS_VERSION + LATEST_CS_VERSION, + PASSWORD_CHANGE_REQUIRED } from '@/store/mutation-types' +import { + applyCustomGuiTheme +} from '@/utils/guiTheme' + const user = { state: { token: '', @@ -76,7 +81,8 @@ const user = { twoFaProvider: '', twoFaIssuer: '', customHypervisorName: 'Custom', - readyForShutdownPollingJob: '' + readyForShutdownPollingJob: '', + passwordChangeRequired: false }, mutations: { @@ -192,6 +198,14 @@ const user = { vueProps.$localStorage.set(LATEST_CS_VERSION, version) state.latestVersion = version } + }, + SET_PASSWORD_CHANGE_REQUIRED: (state, required) => { + state.passwordChangeRequired = required + if (required) { + vueProps.$localStorage.set(PASSWORD_CHANGE_REQUIRED, true) + } else { + vueProps.$localStorage.remove(PASSWORD_CHANGE_REQUIRED) + } } }, @@ -240,10 +254,16 @@ const user = { if (result && result.managementserverid) { commit('SET_MS_ID', result.managementserverid) } + if (result.passwordchangerequired) { + commit('SET_PASSWORD_CHANGE_REQUIRED', true) + commit('SET_APIS', {}) + vueProps.$localStorage.remove(APIS) + } else { + commit('SET_PASSWORD_CHANGE_REQUIRED', false) + } const latestVersion = vueProps.$localStorage.get(LATEST_CS_VERSION, { version: '', fetchedTs: 0 }) commit('SET_LATEST_VERSION', latestVersion) notification.destroy() - resolve() }).catch(error => { reject(error) @@ -320,6 +340,15 @@ const user = { commit('SET_DOMAIN_STORE', domainStore) commit('SET_DARK_MODE', darkMode) commit('SET_LATEST_VERSION', latestVersion) + + // This block is to enforce password change for first time login after admin resets password + const isPwdChangeRequired = vueProps.$localStorage.get(PASSWORD_CHANGE_REQUIRED) + commit('SET_PASSWORD_CHANGE_REQUIRED', isPwdChangeRequired) + if (isPwdChangeRequired) { + resolve() + return + } + if (hasAuth) { console.log('Login detected, using cached APIs') commit('SET_ZONES', cachedZones) @@ -331,24 +360,23 @@ const user = { commit('SET_MS_ID', msId) // Ensuring we get the user info so that store.getters.user is never empty when the page is freshly loaded - api('listUsers', { username: Cookies.get('username'), listall: true }).then(response => { + getAPI('listUsers', { id: Cookies.get('userid'), listall: true }).then(response => { const result = response.listusersresponse.user[0] commit('SET_INFO', result) commit('SET_NAME', result.firstname + ' ' + result.lastname) - store.dispatch('SetCsLatestVersion', result.rolename) resolve(cachedApis) }).catch(error => { reject(error) }) } else if (store.getters.loginFlag) { const hide = message.loading(i18n.global.t('message.discovering.feature'), 0) - api('listZones').then(json => { + getAPI('listZones').then(json => { const zones = json.listzonesresponse.zone || [] commit('SET_ZONES', zones) }).catch(error => { reject(error) }) - api('listApis').then(response => { + getAPI('listApis').then(response => { const apis = {} const apiList = response.listapisresponse.api for (var idx = 0; idx < apiList.length; idx++) { @@ -375,7 +403,7 @@ const user = { reject(error) }) - api('listNetworks', { restartrequired: true, forvpc: false }).then(response => { + getAPI('listNetworks', { restartrequired: true, forvpc: false }).then(response => { if (response.listnetworksresponse.count > 0) { store.dispatch('AddHeaderNotice', { key: 'NETWORK_RESTART_REQUIRED', @@ -389,7 +417,7 @@ const user = { } }).catch(ignored => {}) - api('listVPCs', { restartrequired: true }).then(response => { + getAPI('listVPCs', { restartrequired: true }).then(response => { if (response.listvpcsresponse.count > 0) { store.dispatch('AddHeaderNotice', { key: 'VPC_RESTART_REQUIRED', @@ -404,16 +432,18 @@ const user = { }).catch(ignored => {}) } - api('listUsers', { username: Cookies.get('username') }).then(response => { + getAPI('listUsers', { id: Cookies.get('userid'), showicon: true }).then(response => { const result = response.listusersresponse.user[0] + applyCustomGuiTheme(result.accountid, result.domainid) commit('SET_INFO', result) commit('SET_NAME', result.firstname + ' ' + result.lastname) + commit('SET_AVATAR', result.icon?.base64image || '') store.dispatch('SetCsLatestVersion', result.rolename) }).catch(error => { reject(error) }) - api( + getAPI( 'listNetworkServiceProviders', { name: 'SecurityGroupProvider', state: 'Enabled' } ).then(response => { @@ -422,7 +452,7 @@ const user = { }).catch(ignored => { }) - api('listCapabilities').then(response => { + getAPI('listCapabilities').then(response => { const result = response.listcapabilitiesresponse.capability commit('SET_FEATURES', result) if (result && result.defaultuipagesize) { @@ -438,14 +468,14 @@ const user = { reject(error) }) - api('listLdapConfigurations').then(response => { + getAPI('listLdapConfigurations').then(response => { const ldapEnable = (response.ldapconfigurationresponse.count > 0) commit('SET_LDAP', ldapEnable) }).catch(error => { reject(error) }) - api('cloudianIsEnabled').then(response => { + getAPI('cloudianIsEnabled').then(response => { const cloudian = response.cloudianisenabledresponse.cloudianisenabled || {} commit('SET_CLOUDIAN', cloudian) }).catch(ignored => { @@ -481,6 +511,8 @@ const user = { vueProps.$localStorage.remove(ACCESS_TOKEN) vueProps.$localStorage.remove(HEADER_NOTICES) + commit('SET_PASSWORD_CHANGE_REQUIRED', false) + logout(state.token).then(() => { message.destroy() if (cloudianUrl) { @@ -491,9 +523,17 @@ const user = { }).catch(() => { resolve() }).finally(() => { + const paths = ['/', '/client'] + const hostname = window.location.hostname + const domains = [undefined, hostname, `.${hostname}`] Object.keys(Cookies.get()).forEach(cookieName => { - Cookies.remove(cookieName) - Cookies.remove(cookieName, { path: '/client' }) + paths.forEach(path => { + domains.forEach(domain => { + const options = { path } + if (domain) options.domain = domain + Cookies.remove(cookieName, options) + }) + }) }) }) }) @@ -518,7 +558,7 @@ const user = { }, ProjectView ({ commit }, projectid) { return new Promise((resolve, reject) => { - api('listApis', { projectid: projectid }).then(response => { + getAPI('listApis', { projectid: projectid }).then(response => { const apis = {} const apiList = response.listapisresponse.api for (var idx = 0; idx < apiList.length; idx++) { @@ -543,27 +583,28 @@ const user = { }, RefreshFeatures ({ commit }) { return new Promise((resolve, reject) => { - api('listCapabilities').then(response => { + getAPI('listCapabilities').then(response => { const result = response.listcapabilitiesresponse.capability resolve(result) commit('SET_FEATURES', result) }).catch(error => { reject(error) }) - - api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => { - if (json.listconfigurationsresponse.configuration !== null) { - const config = json.listconfigurationsresponse.configuration[0] - commit('SET_CUSTOM_HYPERVISOR_NAME', config.value) - } - }).catch(error => { - reject(error) - }) + if ('listConfigurations' in store.getters.apis) { + getAPI('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => { + if (json.listconfigurationsresponse.configuration !== null) { + const config = json.listconfigurationsresponse.configuration[0] + commit('SET_CUSTOM_HYPERVISOR_NAME', config.value) + } + }).catch(error => { + reject(error) + }) + } }) }, UpdateConfiguration ({ commit }) { return new Promise((resolve, reject) => { - api('listLdapConfigurations').then(response => { + getAPI('listLdapConfigurations').then(response => { const ldapEnable = (response.ldapconfigurationresponse.count > 0) commit('SET_LDAP', ldapEnable) }).catch(error => { @@ -575,6 +616,9 @@ const user = { commit('SET_DOMAIN_STORE', domainStore) }, SetCsLatestVersion ({ commit }, rolename) { + if (!vueProps.$config.notifyLatestCSVersion) { + return + } const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0 if (rolename === 'Root Admin' && (+new Date() - lastFetchTs) > 24 * 60 * 60 * 1000) { axios.get( diff --git a/ui/src/store/mutation-types.js b/ui/src/store/mutation-types.js index 0b1f921ab86e..5fc2cd74d213 100644 --- a/ui/src/store/mutation-types.js +++ b/ui/src/store/mutation-types.js @@ -43,6 +43,7 @@ export const RELOAD_ALL_PROJECTS = 'RELOAD_ALL_PROJECTS' export const MS_ID = 'MS_ID' export const OAUTH_DOMAIN = 'OAUTH_DOMAIN' export const OAUTH_PROVIDER = 'OAUTH_PROVIDER' +export const PASSWORD_CHANGE_REQUIRED = 'PASSWORD_CHANGE_REQUIRED' export const CONTENT_WIDTH_TYPE = { Fluid: 'Fluid', diff --git a/ui/src/style/README.md b/ui/src/style/README.md index 6cdf3dfea39a..ee54d6ed7cd2 100644 --- a/ui/src/style/README.md +++ b/ui/src/style/README.md @@ -1,3 +1,22 @@ + + # index.less - src/styles/index.less imports all necessary rules for cloudstack @@ -5,7 +24,7 @@ ## main .less entry points: 1. dist/antd.less - - imports everthing with index.less + components.less + - imports everything with index.less + components.less 2. lib/style/index.less - themes/default.less - color/colors' @@ -13,7 +32,7 @@ - core/index.less - includes base styles, motion rules and iconfont -# src/style/ explaination +# src/style/ explanation - index.less includes ant styles, as well as all custom variables and rules @@ -25,7 +44,7 @@ - include all rules that reset styles, define global stuffs without classes at all - e.g. body {} p, ul, li {} h1, h2, h3 {} 3. ant-overwrite - - any styles that overwrites the existin ant rules by any reason + - any styles that overwrites the existing ant rules by any reason - e.g. classes like .ant-layout-header .anticon {} 4. frame - everything that belongs to the frame @@ -34,7 +53,7 @@ - rules that modify the page at all if new layout class is set. - e.g. #html class="layout-ant-black"# 6. objects - - repeatly used elements like buttons, inputs + - repeatedly used elements like buttons, inputs 7. components - complex elements like dropdown, forms, table, search (usually include this to components/FooterToolbar/ folder) diff --git a/ui/src/style/ant-overwrite/ant-form.less b/ui/src/style/ant-overwrite/ant-form.less index 52a2086fb4ff..882724b8ecc3 100644 --- a/ui/src/style/ant-overwrite/ant-form.less +++ b/ui/src/style/ant-overwrite/ant-form.less @@ -23,6 +23,6 @@ transition: transform .3s, -webkit-transform .3s; } -.ant-select-open .ant-select-arrow .ant-select-suffix svg { +.ant-select-open .ant-select-arrow .ant-select-suffix:not(.anticon-search) svg { transform: rotateZ(-180deg); } diff --git a/ui/src/utils/acsrepo/index.js b/ui/src/utils/acsrepo/index.js new file mode 100644 index 000000000000..809bd7f17483 --- /dev/null +++ b/ui/src/utils/acsrepo/index.js @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +const BASE_KUBERNETES_ISO_URL = 'https://download.cloudstack.org/cks/' + +function getDefaultLatestKubernetesIsoParams (arch) { + return { + name: 'v1.33.1-calico-' + arch, + semanticversion: '1.33.1', + url: BASE_KUBERNETES_ISO_URL + 'setup-v1.33.1-calico-' + arch + '.iso', + arch: arch, + mincpunumber: 2, + minmemory: 2048 + } +} + +/** + * Returns the latest Kubernetes ISO info for the given architecture. + * Falls back to a hardcoded default if fetching fails. + * @param {string} arch + * @returns {Promise<{name: string, semanticversion: string, url: string, arch: string}>} + */ +export async function getLatestKubernetesIsoParams (arch) { + arch = arch || 'x86_64' + try { + const html = await fetch(BASE_KUBERNETES_ISO_URL, { cache: 'no-store' }).then(r => r.text()) + + const hrefs = [...html.matchAll(/href="([^"]+\.iso)"/gi)].map(m => m[1]) + + // Prefer files that explicitly include the arch (e.g. ...-x86_64.iso) + let isoHrefs = hrefs.filter(h => new RegExp(`${arch}\\.iso$`, 'i').test(h)) + + // Fallback: older files without arch suffix (e.g. setup-1.28.4.iso) + if (isoHrefs.length === 0) { + isoHrefs = hrefs.filter(h => /setup-\d+\.\d+\.\d+\.iso$/i.test(h)) + } + + const entries = isoHrefs.map(h => { + const m = h.match(/setup-(?:v)?(\d+\.\d+\.\d+)(?:-calico)?(?:-(x86_64|arm64))?/i) + return m + ? { + name: h.replace('.iso', ''), + semanticversion: m[1], + url: new URL(h, BASE_KUBERNETES_ISO_URL).toString(), + arch: m[2] || arch, + mincpunumber: 2, + minmemory: 2048 + } + : null + }).filter(Boolean) + + if (entries.length === 0) throw new Error('No matching ISOs found') + + entries.sort((a, b) => { + const pa = a.semanticversion.split('.').map(Number) + const pb = b.semanticversion.split('.').map(Number) + for (let i = 0; i < 3; i++) { + if ((pb[i] ?? 0) !== (pa[i] ?? 0)) return (pb[i] ?? 0) - (pa[i] ?? 0) + } + return 0 + }) + + return entries[0] + } catch { + return { ...getDefaultLatestKubernetesIsoParams(arch) } + } +} diff --git a/ui/src/utils/extension.js b/ui/src/utils/extension.js new file mode 100644 index 000000000000..cd8d0c4dacac --- /dev/null +++ b/ui/src/utils/extension.js @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +export function getFilteredExternalDetails (details) { + if (!details || typeof details !== 'object') { + return null + } + const prefix = 'External:' + const result = {} + for (const key in details) { + if (key.startsWith(prefix)) { + result[key.substring(prefix.length)] = details[key] + } + } + return Object.keys(result).length > 0 ? result : null +} diff --git a/ui/src/utils/guiTheme.js b/ui/src/utils/guiTheme.js new file mode 100644 index 000000000000..438ce9333a4e --- /dev/null +++ b/ui/src/utils/guiTheme.js @@ -0,0 +1,127 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +import { vueProps } from '@/vue-app' +import { getAPI } from '@/api' +import { loadLanguageAsync } from '../locales' + +export async function applyCustomGuiTheme (accountid, domainid) { + await fetch('config.json').then(response => response.json()).then(config => { + vueProps.$config = config + }) + + let guiTheme + + if (accountid != null) { + guiTheme = await fetchGuiTheme({ accountid: accountid }) + } + + if (guiTheme === undefined && domainid != null) { + guiTheme = await fetchGuiTheme({ domainid: domainid }) + } + + if (guiTheme === undefined) { + guiTheme = await fetchGuiTheme({ commonname: window.location.hostname }) + } + + if (guiTheme === undefined) { + guiTheme = await fetchGuiTheme({ listonlydefaulttheme: true }) + } + + await applyDynamicCustomization(guiTheme) +} + +async function fetchGuiTheme (params) { + return await getAPI('listGuiThemes', params).then(response => { + if (response.listguithemesresponse.guiThemes) { + return response.listguithemesresponse.guiThemes[0] + } + }).catch(error => { + console.error('Error fetching GUI theme:', error) + return null + }) +} + +async function applyDynamicCustomization (response) { + let jsonConfig + + if (response?.jsonconfiguration) { + jsonConfig = JSON.parse(response?.jsonconfiguration) + } + + // Sets custom GUI fields only if is not nullish. + vueProps.$config.appTitle = jsonConfig?.appTitle ?? vueProps.$config.appTitle + vueProps.$config.footer = jsonConfig?.footer ?? vueProps.$config.footer + vueProps.$config.loginFooter = jsonConfig?.loginFooter ?? vueProps.$config.loginFooter + vueProps.$config.logo = jsonConfig?.logo ?? vueProps.$config.logo + vueProps.$config.minilogo = jsonConfig?.minilogo ?? vueProps.$config.minilogo + vueProps.$config.banner = jsonConfig?.banner ?? vueProps.$config.banner + vueProps.$config.docBase = jsonConfig?.docBase ?? vueProps.$config.docBase + vueProps.$config.apidocs = jsonConfig?.apidocs ?? vueProps.$config.apidocs + vueProps.$config.docHelpMappings = jsonConfig?.docHelpMappings ?? vueProps.$config.docHelpMappings + vueProps.$config.keyboardOptions = jsonConfig?.keyboardOptions ?? vueProps.$config.keyboardOptions + vueProps.$config.defaultLanguage = vueProps.$localStorage.get('LOCALE') ?? jsonConfig?.defaultLanguage ?? vueProps.$config.defaultLanguage + + applyJsonConfigToObject(jsonConfig?.error, vueProps.$config.error) + applyJsonConfigToObject(jsonConfig?.userCard, vueProps.$config.userCard) + applyJsonConfigToObject(jsonConfig?.theme, vueProps.$config.theme) + + if (jsonConfig?.plugins) { + jsonConfig.plugins.forEach(plugin => { + vueProps.$config.plugins.push(plugin) + }) + } + + if (vueProps.$store) { + vueProps.$store.dispatch('SetDarkMode', (vueProps.$config.theme['@layout-mode'] === 'dark')) + } + window.less.modifyVars(vueProps.$config.theme) + + vueProps.$config.favicon = jsonConfig?.favicon ?? vueProps.$config.favicon + vueProps.$config.css = response?.css ?? null + + if (vueProps.$config.defaultLanguage) { + vueProps.$localStorage.set('LOCALE', vueProps.$config.defaultLanguage) + loadLanguageAsync() + } + + await applyStaticCustomization(vueProps.$config.favicon, vueProps.$config.css) +} + +function applyJsonConfigToObject (sourceConfig, targetObject) { + if (!sourceConfig) { + return + } + + for (const [variableName, value] of Object.entries(targetObject)) { + targetObject[variableName] = sourceConfig?.[variableName] ?? value + } +} + +async function applyStaticCustomization (favicon, css) { + document.getElementById('favicon').href = favicon + + let style = document.getElementById('guiThemeCSS') + if (style != null) { + style.innerHTML = css + } else { + style = document.createElement('style') + style.setAttribute('id', 'guiThemeCSS') + style.innerHTML = css + document.body.appendChild(style) + } +} diff --git a/ui/src/utils/links.js b/ui/src/utils/links.js index fa650cdd7b8b..9beafc4a9869 100644 --- a/ui/src/utils/links.js +++ b/ui/src/utils/links.js @@ -15,6 +15,27 @@ // specific language governing permissions and limitations // under the License. +import { getAPI } from '@/api' + +async function isValidObject (apiName, id, params) { + try { + const allParams = { ...params, listAll: true, id } + const json = await getAPI(apiName, allParams) + const responseName = Object.keys(json).find(key => key.endsWith('response')) || apiName.toLowerCase() + 'response' + const response = json?.[responseName] + if (!response) { + return false + } + const objectName = Object.keys(response).find(key => key !== 'count') + if (!objectName || !Array.isArray(response[objectName])) { + return false + } + return response[objectName].some(item => item.id === id) + } catch (e) { + return false + } +} + export function validateLinks (router, isStatic, resource) { const validLinks = { volume: false @@ -34,3 +55,54 @@ export function validateLinks (router, isStatic, resource) { return validLinks } + +export async function validateLinksAsync (router, isStatic, resource) { + const validLinks = { + volume: false, + template: false, + iso: false + } + const pendingChecks = [] + + if (isStatic) { + return validLinks + } + + if (resource.volumeid && router.resolve('/volume/' + resource.volumeid).matched[0].redirect !== '/exception/404') { + if (resource.volumestate) { + validLinks.volume = resource.volumestate !== 'Expunged' + } else { + validLinks.volume = true + } + } + + if (resource.templateid) { + const templatePath = (resource.templateformat === 'ISO' ? '/iso/' : '/template/') + resource.templateid + if (router.resolve(templatePath).matched[0].redirect !== '/exception/404') { + pendingChecks.push( + isValidObject('listTemplates', resource.templateid, { templatefilter: 'executable' }).then(result => { + validLinks.template = result + }) + ) + } + } + + if (resource.isoid) { + const isoPath = '/iso/' + resource.isoid + if (router.resolve(isoPath).matched[0].redirect !== '/exception/404') { + pendingChecks.push( + isValidObject('listIsos', resource.isoid, { isofilter: 'executable' }).then(result => { + validLinks.iso = result + }) + ) + } + } + + if (pendingChecks.length) { + await Promise.all(pendingChecks).catch(error => { + console.error('Error validating links:', error) + }) + } + + return validLinks +} diff --git a/ui/src/utils/network.js b/ui/src/utils/network.js new file mode 100644 index 000000000000..c3054f48ff77 --- /dev/null +++ b/ui/src/utils/network.js @@ -0,0 +1,51 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +// Parsing CIDR into Gateway,Netmask Placeholders + +export function getNetmaskFromCidr (cidr) { + if (!cidr?.includes('/')) return undefined + const [, maskBits] = cidr.split('/') + const subnetMasks = { + 8: '255.0.0.0', + 9: '255.128.0.0', + 10: '255.192.0.0', + 11: '255.224.0.0', + 12: '255.240.0.0', + 13: '255.248.0.0', + 14: '255.252.0.0', + 15: '255.254.0.0', + 16: '255.255.0.0', + 17: '255.255.128.0', + 18: '255.255.192.0', + 19: '255.255.224.0', + 20: '255.255.240.0', + 21: '255.255.248.0', + 22: '255.255.252.0', + 23: '255.255.254.0', + 24: '255.255.255.0', + 25: '255.255.255.128', + 26: '255.255.255.192', + 27: '255.255.255.224', + 28: '255.255.255.240', + 29: '255.255.255.248', + 30: '255.255.255.252', + 31: '255.255.255.254', + 32: '255.255.255.255' + } + return subnetMasks[+maskBits] || '255.255.255.0' +} diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js index 353fe2ac0529..b8856c7c9b00 100644 --- a/ui/src/utils/plugins.js +++ b/ui/src/utils/plugins.js @@ -17,8 +17,8 @@ import _ from 'lodash' import { i18n } from '@/locales' -import { api } from '@/api' -import { message, notification } from 'ant-design-vue' +import { getAPI } from '@/api' +import { message, notification, Modal } from 'ant-design-vue' import eventBus from '@/config/eventBus' import store from '@/store' import { sourceToken } from '@/utils/request' @@ -32,6 +32,7 @@ export const pollJobPlugin = { * @param {String} [name=''] * @param {String} [title=''] * @param {String} [description=''] + * @param {Boolean} [showSuccessMessage=true] * @param {String} [successMessage=Success] * @param {Function} [successMethod=() => {}] * @param {String} [errorMessage=Error] @@ -49,6 +50,7 @@ export const pollJobPlugin = { name = '', title = '', description = '', + showSuccessMessage = true, successMessage = i18n.global.t('label.success'), successMethod = () => {}, errorMessage = i18n.global.t('label.error'), @@ -88,22 +90,26 @@ export const pollJobPlugin = { }) options.originalPage = options.originalPage || this.$router.currentRoute.value.path - api('queryAsyncJobResult', { jobId }).then(json => { + getAPI('queryAsyncJobResult', { jobId }).then(json => { const result = json.queryasyncjobresultresponse eventBus.emit('update-job-details', { jobId, resourceId }) if (result.jobstatus === 1) { - var content = successMessage - if (successMessage === 'Success' && action && action.label) { - content = i18n.global.t(action.label) - } - if (name) { - content = content + ' - ' + name + if (showSuccessMessage) { + var content = successMessage + if (successMessage === 'Success' && action && action.label) { + content = i18n.global.t(action.label) + } + if (name) { + content = content + ' - ' + name + } + message.success({ + content, + key: jobId, + duration: 2 + }) + } else { + message.destroy(jobId) } - message.success({ - content, - key: jobId, - duration: 2 - }) store.dispatch('AddHeaderNotice', { key: jobId, title, @@ -218,18 +224,19 @@ export const notifierPlugin = { if (error.response.status) { msg = `${i18n.global.t('message.request.failed')} (${error.response.status})` } - if (error.message) { - desc = error.message - } - if (error.response.headers && 'x-description' in error.response.headers) { + if (error.response.headers?.['x-description']) { desc = error.response.headers['x-description'] - } - if (desc === '' && error.response.data) { + } else if (error.response.data) { const responseKey = _.findKey(error.response.data, 'errortext') if (responseKey) { desc = error.response.data[responseKey].errortext + } else if (typeof error.response.data === 'string') { + desc = error.response.data } } + if (!desc && error.message) { + desc = error.message + } } let countNotify = store.getters.countNotify countNotify++ @@ -338,7 +345,7 @@ export const showIconPlugin = { if (resource) { resourceType = resource } - if (['zone', 'zones', 'template', 'iso', 'account', 'accountuser', 'vm', 'domain', 'project', 'vpc', 'guestnetwork'].includes(resourceType)) { + if (['zone', 'zones', 'template', 'iso', 'account', 'accountuser', 'vm', 'domain', 'project', 'vpc', 'guestnetwork', 'guestoscategory'].includes(resourceType)) { return true } else { return false @@ -384,6 +391,8 @@ export const resourceTypePlugin = { return 'kubernetes' case 'KubernetesSupportedVersion': return 'kubernetesiso' + case 'ExtensionCustomAction': + return 'customaction' case 'SystemVm': case 'PhysicalNetwork': case 'Backup': @@ -412,6 +421,8 @@ export const resourceTypePlugin = { case 'VpnCustomerGateway': case 'AutoScaleVmGroup': case 'QuotaTariff': + case 'GuestOsCategory': + case 'Extension': return resourceType.toLowerCase() } return '' @@ -421,6 +432,9 @@ export const resourceTypePlugin = { var routePath = this.$getRouteFromResourceType(resourceType) if (!routePath) return '' var route = this.$router.resolve('/' + routePath) + if (routePath === 'kubernetes') { + return route?.meta?.icon[0] + } return route?.meta?.icon || '' } } @@ -523,3 +537,87 @@ export function createPathBasedOnVmType (vmtype, virtualmachineid) { return path + virtualmachineid } + +export const dialogUtilPlugin = { + install (app) { + app.config.globalProperties.$resetConfigurationValueConfirm = function (configRecord, callback) { + Modal.confirm({ + title: i18n.global.t('label.reset.config.value'), + content: `${i18n.global.t('message.confirm.reset.configuration.value').replace('%x', configRecord.name)}`, + okText: i18n.global.t('label.yes'), + cancelText: i18n.global.t('label.no'), + okType: 'primary', + onOk: () => callback(configRecord) + }) + } + + app.config.globalProperties.$notifyConfigurationValueChange = function (configRecord) { + if (!configRecord || configRecord.isdynamic || store.getters.userInfo?.roletype !== 'Admin') { + return + } + const server = configRecord.group === 'Usage Server' ? 'usage' : 'mgmt' + this.$notification.warning({ + message: this.$t('label.status'), + description: this.$t('message.restart.' + server + '.server') + }) + } + } +} + +export const cpuArchitectureUtilPlugin = { + install (app) { + app.config.globalProperties.$fetchCpuArchitectureTypes = function () { + const architectures = [ + { id: 'x86_64', name: 'Intel/AMD 64 bits (x86_64)' }, + { id: 'aarch64', name: 'ARM 64 bits (aarch64)' }, + { id: 's390x', name: 'IBM Z 64 bits (s390x)' } + ] + return architectures.map(item => ({ ...item, description: item.name })) + } + } +} + +export const imagesUtilPlugin = { + install (app) { + app.config.globalProperties.$fetchTemplateTypes = function (hypervisor) { + const baseTypes = ['USER'] + if (hypervisor === 'External') { + return baseTypes.map(type => ({ id: type, name: type, description: type })) + } + baseTypes.push('VNF') + const adminTypes = ['SYSTEM', 'BUILTIN', 'ROUTING'] + const types = [...baseTypes] + if (store.getters.userInfo?.roletype === 'Admin') { + types.push(...adminTypes) + } + return types.map(type => ({ id: type, name: type, description: type })) + } + } +} + +export const extensionsUtilPlugin = { + install (app) { + app.config.globalProperties.$fetchCustomActionRoleTypes = function () { + const roleTypes = [] + const roleTypesList = ['Admin', 'Resource Admin', 'Domain Admin', 'User'] + roleTypesList.forEach((item) => { + roleTypes.push({ + id: item.replace(' ', ''), + description: item + }) + }) + return roleTypes + } + } +} + +export const backupUtilPlugin = { + install (app) { + app.config.globalProperties.$isBackupProviderSupportsQuiesceVm = function (provider) { + if (!provider && typeof provider !== 'string') { + return false + } + return ['nas'].includes(provider.toLowerCase()) + } + } +} diff --git a/ui/src/utils/quota.js b/ui/src/utils/quota.js index 485c99131d26..b8adbb93518a 100644 --- a/ui/src/utils/quota.js +++ b/ui/src/utils/quota.js @@ -107,7 +107,7 @@ export const QUOTA_TYPES = [ }, { id: 29, - type: 'VPC' + type: 'BUCKET' }, { id: 30, @@ -115,7 +115,7 @@ export const QUOTA_TYPES = [ }, { id: 31, - type: 'BACKUP_OBJECT' + type: 'VPC' } ] diff --git a/ui/src/utils/renderIcon.js b/ui/src/utils/renderIcon.js index 8d982fd4adc0..b92fba28548b 100644 --- a/ui/src/utils/renderIcon.js +++ b/ui/src/utils/renderIcon.js @@ -45,8 +45,9 @@ export default { const props = Object.assign({}, this.props) props.width = '1em' props.height = '1em' - props.class = 'custom-icon' - + if (!this.$attrs.style) { + props.class = 'custom-icon' + } return h('span', { role: 'img', class: 'anticon' }, [ h(this.svgIcon, { ...props }, this.event) ]) diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js index 7c757691f2b3..2317aac04465 100644 --- a/ui/src/utils/request.js +++ b/ui/src/utils/request.js @@ -54,7 +54,7 @@ const err = (error) => { if (response.config && response.config.params && ['forgotPassword', 'listIdps', 'cloudianIsEnabled'].includes(response.config.params.command)) { return } - const originalPath = router.currentRoute.value.fullPath + const originalPath = router.currentRoute.value.path for (const key in response.data) { if (key.includes('response')) { if (response.data[key].errortext.includes('not available for user')) { @@ -149,6 +149,15 @@ const err = (error) => { service.interceptors.request.use(config => { source = sourceToken.getSource() config.cancelToken = source.token + + handleGetRequestParams(config) + + handlePostRequestParams(config) + + return config +}, err) + +function handleGetRequestParams (config) { if (config && config.params) { config.params.response = 'json' const project = vueProps.$localStorage.get(CURRENT_PROJECT) @@ -160,11 +169,30 @@ service.interceptors.request.use(config => { } } if (config.params.ignoreproject !== undefined) { - config.params.ignoreproject = null + delete config.params.ignoreproject } } - return config -}, err) +} + +function handlePostRequestParams (config) { + if (config && config.data && config.data instanceof URLSearchParams) { + const project = vueProps.$localStorage.get(CURRENT_PROJECT) + const command = config.data.get('command') + const hasProjectId = config.data.has('projectid') + const ignoreProject = config.data.has('ignoreproject') + + if (!hasProjectId && !ignoreProject && project && project.id) { + if (command === 'listTags') { + config.data.append('projectid', '-1') + } else if (command !== 'assignVirtualMachine') { + config.data.append('projectid', project.id) + } + } + if (config.data.has('ignoreproject')) { + config.data.delete('ignoreproject') + } + } +} // response interceptor service.interceptors.response.use((response) => { diff --git a/ui/src/utils/util.js b/ui/src/utils/util.js index 8773f07446e6..3c51096ac53e 100644 --- a/ui/src/utils/util.js +++ b/ui/src/utils/util.js @@ -102,3 +102,24 @@ export function toCsv ({ keys = null, data = null, columnDelimiter = ',', lineDe return result } + +export function isValidIPv4Cidr (rule, value) { + return new Promise((resolve, reject) => { + if (!value) { + reject(new Error()) + return + } + const cidrRegex = /^(\d{1,3}\.){3}\d{1,3}\/([0-9]|[1-2][0-9]|3[0-2])$/ + if (!cidrRegex.test(value)) { + reject(new Error('Invalid CIDR format')) + return + } + const ip = value.split('/')[0] + const octets = ip.split('.').map(Number) + if (octets.some(octet => octet < 0 || octet > 255)) { + reject(new Error('Invalid CIDR format')) + return + } + resolve() + }) +} diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index e2ac07fbf7bd..436f61a37da3 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -17,10 +17,19 @@ @@ -146,7 +182,8 @@ @refresh-data="fetchData" @poll-action="pollActionCompletion" @close-action="closeAction" - @cancel-bulk-action="handleCancel"/> + @cancel-bulk-action="handleCancel" + /> @@ -158,8 +195,6 @@ :footer="null" style="top: 20px;" :width="modalWidth" - :ok-button-props="getOkProps()" - :cancel-button-props="getCancelProps()" :confirmLoading="actionLoading" @cancel="cancelAction" centered @@ -170,33 +205,47 @@ v-if="currentAction.docHelp || $route.meta.docHelp" style="margin-left: 5px" :href="$config.docBase + '/' + (currentAction.docHelp || $route.meta.docHelp)" - target="_blank"> + target="_blank" + > - - + +
    + type="error" + > - +
    @@ -218,15 +267,29 @@ -
    -
    - +
    +
    + + + + + + +
    + -
    + layout="vertical" + > +
    - + :tooltip="field.description" + /> + + = 0 }" > - {{ }} + {{ }} + :label="opt" + > {{ opt }} @@ -280,11 +357,15 @@ }" v-focus="fieldIndex === firstIndex" > - {{ }} + {{ }} + :label="opt.name || opt.description || opt.traffictype || opt.publicip" + > {{ opt.name || opt.description || opt.traffictype || opt.publicip }} @@ -300,44 +381,96 @@ }" v-focus="fieldIndex === firstIndex" > - {{ }} - + {{ }} +
    - + - + - + - + - + - + - + - + - + - + - + - + {{ opt.name || opt.description || opt.traffictype || opt.publicip }}
    @@ -359,10 +492,14 @@ - {{ opt.name && opt.type ? opt.name + ' (' + opt.type + ')' : opt.name || opt.description }} + :label="(opt.name && opt.type ? opt.name + ' (' + opt.type + ')' : opt.name || opt.description)" + > + {{ (opt.name && opt.type ? opt.name + ' (' + opt.type + ')' : opt.name || opt.description) }} + + :placeholder="field.description" + />
    -
    +
    {{ $t('label.cancel') }} - {{ $t('label.ok') }} + {{ $t('label.ok') }}
    @@ -402,16 +548,28 @@
    -
    +
    - + + :tabs="$route.meta.tabs" + />
    -
    +
    + + showQuickJumper + > @@ -450,14 +609,15 @@ :selectedItems="selectedItems" :selectedColumns="bulkColumns" :message="modalInfo" - @handle-cancel="handleCancel" /> + @handle-cancel="handleCancel" + />
    + + diff --git a/ui/src/views/compute/CreateAffinityGroup.vue b/ui/src/views/compute/CreateAffinityGroup.vue new file mode 100644 index 000000000000..27d9828138d4 --- /dev/null +++ b/ui/src/views/compute/CreateAffinityGroup.vue @@ -0,0 +1,173 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + + + diff --git a/ui/src/views/compute/CreateAutoScaleVmGroup.vue b/ui/src/views/compute/CreateAutoScaleVmGroup.vue index 981c2b0ab183..9e8ebb8a4d59 100644 --- a/ui/src/views/compute/CreateAutoScaleVmGroup.vue +++ b/ui/src/views/compute/CreateAutoScaleVmGroup.vue @@ -34,72 +34,70 @@
    {{ $t('message.select.a.zone') }}
    -
    - -
    - - - - - - - {{ zoneItem.name }} - - - - -
    -
    -
    - - - - - - {{ zone1.name }} - - - +
    + + + + + diff --git a/ui/src/views/iam/DeleteAccountWrapper.vue b/ui/src/views/iam/DeleteAccountWrapper.vue new file mode 100644 index 000000000000..2c6a07ca3c64 --- /dev/null +++ b/ui/src/views/iam/DeleteAccountWrapper.vue @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + + + + + + diff --git a/ui/src/views/iam/DomainActionForm.vue b/ui/src/views/iam/DomainActionForm.vue index ab53a5974e40..8ee185f7e28f 100644 --- a/ui/src/views/iam/DomainActionForm.vue +++ b/ui/src/views/iam/DomainActionForm.vue @@ -134,7 +134,7 @@ + + diff --git a/ui/src/views/iam/ImportRole.vue b/ui/src/views/iam/ImportRole.vue index 857787244746..7a8e17c5691b 100644 --- a/ui/src/views/iam/ImportRole.vue +++ b/ui/src/views/iam/ImportRole.vue @@ -105,7 +105,7 @@ diff --git a/ui/src/views/infra/ConfigureHostOOBM.vue b/ui/src/views/infra/ConfigureHostOOBM.vue index d80ac68fc067..a873baab83fe 100644 --- a/ui/src/views/infra/ConfigureHostOOBM.vue +++ b/ui/src/views/infra/ConfigureHostOOBM.vue @@ -91,7 +91,7 @@ diff --git a/ui/src/views/infra/HostInfo.vue b/ui/src/views/infra/HostInfo.vue index 259445154a01..cb16a5a8bbee 100644 --- a/ui/src/views/infra/HostInfo.vue +++ b/ui/src/views/infra/HostInfo.vue @@ -56,6 +56,38 @@
    + +
    + {{ $t('label.host.virtv2v.version') }} +
    + {{ host.details['host.virtv2v.version'] }} +
    +
    +
    + +
    + {{ $t('label.host.vddk.support') }} +
    + {{ host.details['host.vddk.support'] }} +
    +
    +
    + +
    + {{ $t('label.host.vddk.version') }} +
    + {{ host.details['host.vddk.version'] }} +
    +
    +
    + +
    + {{ $t('label.host.ovftool.version') }} +
    + {{ host.details['host.ovftool.version'] }} +
    +
    +
    {{ $t('label.hosttags') }} @@ -70,6 +102,14 @@
    + +
    + {{ $t('label.storageaccessgroups') }} +
    + {{ host.storageaccessgroups }} +
    +
    +
    {{ $t('label.oscategoryid') }} @@ -165,7 +205,7 @@ + + diff --git a/ui/src/views/infra/Resources.vue b/ui/src/views/infra/Resources.vue index 3d0c4a27099d..0055343b30df 100644 --- a/ui/src/views/infra/Resources.vue +++ b/ui/src/views/infra/Resources.vue @@ -35,7 +35,7 @@ v-if="item.tagged" class="list-item__collapse" @change="handleCollapseChange(item.type)"> - + @@ -66,7 +66,7 @@ + + diff --git a/ui/src/views/infra/network/DedicatedVLANTab.vue b/ui/src/views/infra/network/DedicatedVLANTab.vue index 7343b30b692e..9d47138f0ae7 100644 --- a/ui/src/views/infra/network/DedicatedVLANTab.vue +++ b/ui/src/views/infra/network/DedicatedVLANTab.vue @@ -174,7 +174,7 @@ + + diff --git a/ui/src/views/infra/zone/ZoneWizardZoneDetailsStep.vue b/ui/src/views/infra/zone/ZoneWizardZoneDetailsStep.vue index 05c5adc1bd20..f007142fca34 100644 --- a/ui/src/views/infra/zone/ZoneWizardZoneDetailsStep.vue +++ b/ui/src/views/infra/zone/ZoneWizardZoneDetailsStep.vue @@ -195,7 +195,8 @@ optionFilterProp="label" :filterOption="(input, option) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }" > + }" + @change="val => { fetchDomainAccounts(val) }"> {{ dom.path }} @@ -213,7 +214,20 @@ :label="$t('label.account')" v-bind="formItemLayout" v-if="isDedicated"> - + + + {{ acc.name }} + + import { ref, reactive, toRaw } from 'vue' -import { api } from '@/api' +import { getAPI } from '@/api' export default { props: { @@ -276,7 +290,8 @@ export default { availableNetworkOfferings: null, ipV4Regex: /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i, ipV6Regex: /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i, - formModel: {} + formModel: {}, + selectedDomainAccounts: [] }), created () { this.hypervisors = this.prefillContent?.hypervisors || null @@ -454,8 +469,19 @@ export default { hypervisor: [{ required: true, message: this.$t('message.error.hypervisor.type') }] }) }, + fetchDomainAccounts (domainid) { + getAPI('listAccounts', { + domainid: domainid + }).then(response => { + // Clean up the selected account from a previous domain + this.form.account = null + this.selectedDomainAccounts = response.listaccountsresponse.account || [] + }).catch(error => { + this.$notifyError(error) + }) + }, fetchData () { - api('listHypervisors').then(json => { + getAPI('listHypervisors').then(json => { this.hypervisors = json.listhypervisorsresponse.hypervisor if ('listSimulatorHAStateTransitions' in this.$store.getters.apis) { this.hypervisors.push({ name: 'Simulator' }) @@ -465,7 +491,7 @@ export default { }) if (!this.isAdvancedZone || this.securityGroupsEnabled) { - api('listNetworkOfferings', { state: 'Enabled', guestiptype: 'Shared' }).then(json => { + getAPI('listNetworkOfferings', { state: 'Enabled', guestiptype: 'Shared' }).then(json => { this.networkOfferings = {} json.listnetworkofferingsresponse.networkoffering.forEach(offering => { this.setupNetworkOfferingAdditionalFlags(offering) @@ -477,7 +503,7 @@ export default { }) } - api('listDomains', { listAll: true }).then(json => { + getAPI('listDomains', { listAll: true }).then(json => { this.domains = {} json.listdomainsresponse.domain.forEach(dom => { this.domains[dom.id] = dom diff --git a/ui/src/views/network/AclListRulesTab.vue b/ui/src/views/network/AclRulesTab.vue similarity index 95% rename from ui/src/views/network/AclListRulesTab.vue rename to ui/src/views/network/AclRulesTab.vue index e01e61289e50..e452e495a224 100644 --- a/ui/src/views/network/AclListRulesTab.vue +++ b/ui/src/views/network/AclRulesTab.vue @@ -25,13 +25,19 @@ :disabled="!('createNetworkACL' in $store.getters.apis)" @click="openAddRuleModal"> - {{ $t('label.add') }} {{ $t('label.aclid') }} + {{ $t('label.add.acl.rule') }} + + + + + {{ $t('label.acl.import') }} {{ $t('label.acl.export') }} +