mirror of https://github.com/apache/cloudstack.git
merge main
This commit is contained in:
commit
54518159ff
|
|
@ -55,6 +55,8 @@ github:
|
|||
- erikbocks
|
||||
- Imvedansh
|
||||
- Damans227
|
||||
- jmsperu
|
||||
- GaOrtiga
|
||||
|
||||
protected_branches: ~
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
73
.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md
generated
vendored
Normal file
73
.github/aw/imports/github/gh-aw/359795d49ada21681ab616bd4cbcb144a7387115/.github_workflows_shared_reporting.md
generated
vendored
Normal file
|
|
@ -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 `<details><summary>Section Name</summary>` 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 `<details><summary>Section Name</summary>` 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]
|
||||
|
||||
<details>
|
||||
<summary>View Detailed Results</summary>
|
||||
|
||||
[Comprehensive details, logs, traces]
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>View All Warnings</summary>
|
||||
|
||||
[Minor issues and potential problems]
|
||||
|
||||
</details>
|
||||
|
||||
### 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)
|
||||
|
|
@ -31,6 +31,8 @@ updates:
|
|||
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"
|
||||
|
|
|
|||
|
|
@ -16,40 +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@v6
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
- 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
|
||||
|
|
@ -60,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)
|
||||
|
|
|
|||
|
|
@ -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-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:
|
||||
|
|
@ -215,30 +250,16 @@ jobs:
|
|||
smoke/test_list_service_offerings
|
||||
smoke/test_list_storage_pools
|
||||
smoke/test_list_volumes"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
persist-credentials: false
|
||||
- name: Setup Environment
|
||||
uses: ./.github/actions/setup-env
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
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-openbsd 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: Setup IPMI Tool for CloudStack
|
||||
run: |
|
||||
# Create cloudstack-common directory if it doesn't exist
|
||||
|
|
@ -256,28 +277,13 @@ jobs:
|
|||
/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 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
|
||||
|
|
@ -286,25 +292,28 @@ jobs:
|
|||
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/[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"
|
||||
|
|
@ -315,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
|
||||
|
|
@ -335,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@v6
|
||||
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
with:
|
||||
files: jacoco-coverage.xml
|
||||
fail_ci_if_error: true
|
||||
|
|
|
|||
|
|
@ -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@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
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@v6
|
||||
with:
|
||||
files: ./client/target/site/jacoco-aggregate/jacoco.xml
|
||||
fail_ci_if_error: true
|
||||
flags: unittests
|
||||
verbose: true
|
||||
name: codecov
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
@ -35,14 +35,16 @@ jobs:
|
|||
language: ["actions"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
uses: github/codeql-action/init@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
uses: github/codeql-action/autobuild@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
uses: github/codeql-action/analyze@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
|
||||
with:
|
||||
category: "Security"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,15 +22,19 @@ tools:
|
|||
# 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]
|
||||
source: githubnext/agentics/workflows/daily-repo-status.md@d19056381ba48cb1f7c78510c23069701fa7ae87
|
||||
close-older-issues: true
|
||||
source: githubnext/agentics/workflows/repo-status.md@main
|
||||
---
|
||||
|
||||
# Daily Repo Status
|
||||
# Repo Status
|
||||
|
||||
Create an upbeat daily status report for the repo as a GitHub issue.
|
||||
|
||||
|
|
|
|||
|
|
@ -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@v4
|
||||
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@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set ACS version
|
||||
run: echo "ACS_VERSION=$(grep '<version>' pom.xml | head -2 | tail -1 | cut -d'>' -f2 |cut -d'<' -f1)" >> $GITHUB_ENV
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
on:
|
||||
schedule: 0 14 * * 1-5
|
||||
schedule: daily around 14:00 on weekdays
|
||||
workflow_dispatch: null
|
||||
permissions:
|
||||
issues: read
|
||||
imports:
|
||||
- github/gh-aw/.github/workflows/shared/reporting.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4
|
||||
- github/gh-aw/.github/workflows/shared/reporting.md@359795d49ada21681ab616bd4cbcb144a7387115
|
||||
safe-outputs:
|
||||
add-comment: {}
|
||||
add-labels:
|
||||
|
|
@ -17,10 +17,12 @@ safe-outputs:
|
|||
- question
|
||||
- help-wanted
|
||||
- good-first-issue
|
||||
source: github/gh-aw/.github/workflows/issue-triage-agent.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4
|
||||
emoji: 🔧
|
||||
source: github/gh-aw/.github/workflows/issue-triage-agent.md@359795d49ada21681ab616bd4cbcb144a7387115
|
||||
strict: true
|
||||
timeout-minutes: 5
|
||||
tools:
|
||||
cli-proxy: true
|
||||
github:
|
||||
toolsets:
|
||||
- issues
|
||||
|
|
@ -45,7 +47,7 @@ Hi @{author}! I've categorized this issue as **{label_name}** based on the follo
|
|||
**Reasoning**: {brief_explanation_of_why_this_label}
|
||||
|
||||
<details>
|
||||
<summary><b>View Triage Details</b></summary>
|
||||
<summary>View Triage Details</summary>
|
||||
|
||||
#### Analysis
|
||||
- **Keywords detected**: {list_of_keywords_that_matched}
|
||||
|
|
@ -76,3 +78,15 @@ For efficiency, if multiple issues are triaged in a single run:
|
|||
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.
|
||||
|
||||
{{#runtime-import shared/noop-reminder.md}}
|
||||
|
|
|
|||
|
|
@ -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@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK17
|
||||
uses: actions/setup-java@v5
|
||||
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@v5
|
||||
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@v5
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml', '*/pom.xml', '*/*/pom.xml', '*/*/*/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 }}
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ concurrency:
|
|||
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@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."
|
||||
- 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."
|
||||
|
|
|
|||
|
|
@ -29,17 +29,23 @@ 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@v6
|
||||
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@v5
|
||||
- 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') }}
|
||||
|
|
|
|||
|
|
@ -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@v6
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
- 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()
|
||||
|
|
|
|||
|
|
@ -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@v6
|
||||
- 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@v5
|
||||
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@v5
|
||||
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@v5
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml', '*/pom.xml', '*/*/pom.xml', '*/*/*/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 }}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v10
|
||||
- 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.'
|
||||
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
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@v10
|
||||
- uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
|
||||
with:
|
||||
stale-issue-label: 'archive'
|
||||
days-before-stale: 240
|
||||
|
|
|
|||
|
|
@ -28,15 +28,19 @@ permissions:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v6
|
||||
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,7 @@ jobs:
|
|||
npm run lint
|
||||
npm run test:unit
|
||||
|
||||
- uses: codecov/codecov-action@v6
|
||||
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
if: github.repository == 'apache/cloudstack'
|
||||
with:
|
||||
working-directory: ui
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ 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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -123,6 +123,20 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<String> LOCAL_STORAGE_PATH = new Property<>("local.storage.path", "/var/lib/libvirt/images/");
|
||||
|
||||
/**
|
||||
* Enables TLS on the KVM image server transfer endpoint.<br>
|
||||
* Data type: Boolean.<br>
|
||||
* Default value: <code>true</code>
|
||||
*/
|
||||
public static final Property<Boolean> IMAGE_SERVER_TLS_ENABLED = new Property<>("image.server.tls.enabled", true);
|
||||
|
||||
/**
|
||||
* The IP address that the KVM image server listens on.<br>
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>null</code>
|
||||
*/
|
||||
public static final Property<String> IMAGE_SERVER_LISTEN_ADDRESS = new Property<>("image.server.listen.address", null, String.class);
|
||||
|
||||
/**
|
||||
* Directory where Qemu sockets are placed.<br>
|
||||
* These sockets are for the Qemu Guest Agent and SSVM provisioning.<br>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.net.MalformedURLException;
|
|||
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;
|
||||
|
|
@ -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
|
||||
*
|
||||
|
|
@ -203,4 +210,6 @@ public interface VolumeApiService {
|
|||
Pair<String, String> checkAndRepairVolume(CheckAndRepairVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
Long getVolumePhysicalSize(Storage.ImageFormat format, String path, String chainInfo);
|
||||
|
||||
Long getCustomDiskOfferingIdForVolumeUpload(Account owner, DataCenter zone, boolean encryptEnabledOnly);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,10 +88,16 @@ public interface AccountService {
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -130,4 +130,10 @@ public interface VmDetailConstants {
|
|||
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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ public class ApiConstants {
|
|||
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";
|
||||
|
|
@ -77,6 +79,7 @@ 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";
|
||||
|
|
@ -171,6 +174,7 @@ public class ApiConstants {
|
|||
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";
|
||||
|
|
@ -217,6 +221,7 @@ 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";
|
||||
|
|
@ -260,6 +265,7 @@ public class ApiConstants {
|
|||
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";
|
||||
|
|
@ -332,6 +338,7 @@ public class ApiConstants {
|
|||
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";
|
||||
|
|
@ -608,6 +615,7 @@ public class ApiConstants {
|
|||
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";
|
||||
|
|
|
|||
|
|
@ -21,8 +21,11 @@ import java.util.Map;
|
|||
|
||||
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 {
|
||||
|
|
@ -52,4 +55,20 @@ public interface ApiServerService {
|
|||
String getDomainId(Map<String, Object[]> params);
|
||||
|
||||
boolean isPostRequestsAndTimestampsEnforced();
|
||||
|
||||
AsyncCmdResult processAsyncCmd(BaseAsyncCmd cmdObj, Map<String, String> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ 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;
|
||||
protected String customId;
|
||||
|
||||
public String getCustomId() {
|
||||
return customId;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<ImageTransferResponse> responses = kvmBackupExportService.listImageTransfers(this);
|
||||
ListResponse<ImageTransferResponse> 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<CheckpointResponse> responses = kvmBackupExportService.listVmCheckpoints(this);
|
||||
ListResponse<CheckpointResponse> response = new ListResponse<>();
|
||||
response.setResponses(responses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,23 +19,23 @@ package org.apache.cloudstack.api.command.admin.config;
|
|||
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;
|
||||
|
|
@ -94,6 +94,13 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
description = "The ID of the Image Store to update 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;
|
||||
|
||||
@Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "Lists configuration by group name (primarily used for UI)", since = "4.18.0")
|
||||
private String groupName;
|
||||
|
||||
|
|
@ -139,6 +146,10 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
return imageStoreId;
|
||||
}
|
||||
|
||||
public Long getManagementServerId() {
|
||||
return managementServerId;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
|
@ -200,6 +211,9 @@ public class ListCfgsByCmd extends BaseListCmd {
|
|||
if (getImageStoreId() != null){
|
||||
cfgResponse.setScope("imagestore");
|
||||
}
|
||||
if (getManagementServerId() != null){
|
||||
cfgResponse.setScope("managementserver");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@ 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.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;
|
||||
|
|
@ -84,6 +84,13 @@ public class ResetCfgCmd extends BaseCmd {
|
|||
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 class ResetCfgCmd extends BaseCmd {
|
|||
return imageStoreId;
|
||||
}
|
||||
|
||||
public Long getManagementServerId() {
|
||||
return managementServerId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -149,6 +160,9 @@ public class ResetCfgCmd extends BaseCmd {
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -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.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.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)
|
||||
|
|
@ -88,6 +90,13 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
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 class UpdateCfgCmd extends BaseCmd {
|
|||
return clusterId;
|
||||
}
|
||||
|
||||
public Long getStoragepoolId() {
|
||||
public Long getStoragePoolId() {
|
||||
return storagePoolId;
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +137,10 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
return imageStoreId;
|
||||
}
|
||||
|
||||
public Long getManagementServerId() {
|
||||
return managementServerId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -182,7 +195,7 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
if (getClusterId() != null) {
|
||||
response.setScope("cluster");
|
||||
}
|
||||
if (getStoragepoolId() != null) {
|
||||
if (getStoragePoolId() != null) {
|
||||
response.setScope("storagepool");
|
||||
}
|
||||
if (getAccountId() != null) {
|
||||
|
|
@ -191,6 +204,9 @@ public class UpdateCfgCmd extends BaseCmd {
|
|||
if (getDomainId() != null) {
|
||||
response.setScope("domain");
|
||||
}
|
||||
if (getManagementServerId() != null) {
|
||||
response.setScope(ConfigKey.Scope.ManagementServer.name().toLowerCase());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ public class AssignVMCmd extends BaseCmd {
|
|||
"In case no security groups are provided the Instance is part of the default security group.")
|
||||
private List<Long> securityGroupIdList;
|
||||
|
||||
// Internal flag to allow assignment without adding a network
|
||||
private boolean skipNetwork = false;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -113,6 +116,34 @@ public class AssignVMCmd extends BaseCmd {
|
|||
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///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -41,6 +41,19 @@ public class DeployVMCmdByAdmin extends DeployVMCmd implements AdminCmd {
|
|||
@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 class DeployVMCmdByAdmin extends DeployVMCmd implements AdminCmd {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -27,4 +29,20 @@ import com.cloud.vm.VirtualMachine;
|
|||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import javax.inject.Inject;
|
|||
|
||||
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;
|
||||
|
|
@ -102,6 +103,16 @@ public class AssignVirtualMachineToBackupOfferingCmd extends BaseAsyncCmd {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,12 @@ public class CreateBackupCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.Backup;
|
||||
return ApiCommandResourceType.VirtualMachine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getApiResourceId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import javax.inject.Inject;
|
|||
|
||||
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;
|
||||
|
|
@ -81,7 +82,7 @@ public class CreateBackupScheduleCmd extends BaseCmd {
|
|||
@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. " +
|
||||
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")
|
||||
|
|
@ -139,4 +140,14 @@ public class CreateBackupScheduleCmd extends BaseCmd {
|
|||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getApiResourceId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.VirtualMachine;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import javax.inject.Inject;
|
|||
|
||||
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;
|
||||
|
|
@ -99,6 +100,16 @@ public class RemoveVirtualMachineFromBackupOfferingCmd extends BaseAsyncCmd {
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ 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;
|
||||
|
|
@ -127,4 +128,14 @@ public class RestoreVolumeFromBackupAndAttachToVMCmd extends BaseAsyncCmd {
|
|||
public String getEventDescription() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,22 @@ public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesC
|
|||
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///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -100,6 +100,26 @@ public class AddNicToVMCmd extends BaseAsyncCmd implements UserCmd {
|
|||
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///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ 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;
|
||||
import com.cloud.utils.net.Dhcp;
|
||||
|
||||
public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd implements SecurityGroupAction, UserCmd {
|
||||
|
||||
|
|
@ -75,13 +75,13 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "availability zone for the virtual machine")
|
||||
private Long zoneId;
|
||||
protected Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "host name for the virtual machine", validations = {ApiArgValidator.RFCComplianceDomainName})
|
||||
private String name;
|
||||
protected String name;
|
||||
|
||||
@Parameter(name = ApiConstants.DISPLAY_NAME, type = CommandType.STRING, description = "an optional user generated name for the virtual machine")
|
||||
private String displayName;
|
||||
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")
|
||||
|
|
@ -89,21 +89,21 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
|
||||
//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;
|
||||
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.")
|
||||
private Long domainId;
|
||||
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")
|
||||
private List<Long> networkIds;
|
||||
protected List<Long> 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;
|
||||
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")
|
||||
private String bootMode;
|
||||
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;
|
||||
|
|
@ -138,7 +138,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
|
||||
@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;
|
||||
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. " +
|
||||
|
|
@ -147,10 +147,10 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
"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;
|
||||
protected 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;
|
||||
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;
|
||||
|
|
@ -160,7 +160,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
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<String> sshKeyPairNames;
|
||||
protected List<String> 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;
|
||||
|
|
@ -168,7 +168,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
@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<Long> securityGroupIdList;
|
||||
protected List<Long> 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."
|
||||
|
|
@ -189,10 +189,10 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
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")
|
||||
private String keyboard;
|
||||
protected String keyboard;
|
||||
|
||||
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project")
|
||||
private Long projectId;
|
||||
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;
|
||||
|
|
@ -200,7 +200,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
@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<Long> affinityGroupIdList;
|
||||
protected List<Long> 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."
|
||||
|
|
@ -208,10 +208,10 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
private List<String> 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;
|
||||
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")
|
||||
private Map 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;
|
||||
|
|
@ -225,7 +225,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
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;
|
||||
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;
|
||||
|
|
@ -798,6 +798,11 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getInstanceType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.vm;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -40,6 +41,7 @@ import com.cloud.exception.InsufficientServerCapacityException;
|
|||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
@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},
|
||||
|
|
@ -88,6 +90,111 @@ public class DeployVMCmd extends BaseDeployVMCmd {
|
|||
return volumeId != null || snapshotId != null;
|
||||
}
|
||||
|
||||
public boolean isBlankInstance() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
////////////////// Setters //////////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
public void setZoneId(Long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
public void setDomainId(Long domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public void setNetworkIds(List<Long> networkIds) {
|
||||
this.networkIds = networkIds;
|
||||
}
|
||||
|
||||
public void setBootType(String bootType) {
|
||||
this.bootType = bootType;
|
||||
}
|
||||
|
||||
public void setBootMode(String bootMode) {
|
||||
this.bootMode = bootMode;
|
||||
}
|
||||
|
||||
public void setHypervisor(String hypervisor) {
|
||||
this.hypervisor = hypervisor;
|
||||
}
|
||||
|
||||
public void setUserData(String userData) {
|
||||
this.userData = userData;
|
||||
}
|
||||
|
||||
public void setKeyboard(String keyboard) {
|
||||
this.keyboard = keyboard;
|
||||
}
|
||||
|
||||
public void setProjectId(Long projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public void setDisplayVm(Boolean displayVm) {
|
||||
this.displayVm = displayVm;
|
||||
}
|
||||
|
||||
public void setUserDataId(Long userDataId) {
|
||||
this.userdataId = userDataId;
|
||||
}
|
||||
|
||||
public void setAffinityGroupIds(List<Long> ids) {
|
||||
this.affinityGroupIdList = ids;
|
||||
}
|
||||
|
||||
public void setDetails(Map details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void setExtraConfig(String extraConfig) {
|
||||
this.extraConfig = extraConfig;
|
||||
}
|
||||
|
||||
public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {
|
||||
this.dynamicScalingEnabled = dynamicScalingEnabled;
|
||||
}
|
||||
|
||||
public void setServiceOfferingId(Long serviceOfferingId) {
|
||||
this.serviceOfferingId = serviceOfferingId;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public void setVolumeId(Long volumeId) {
|
||||
this.volumeId = volumeId;
|
||||
}
|
||||
|
||||
public void setSnapshotId(Long snapshotId) {
|
||||
this.snapshotId = snapshotId;
|
||||
}
|
||||
|
||||
public void setSshKeyPairNames(List<String> sshKeyPairNames) {
|
||||
this.sshKeyPairNames = sshKeyPairNames;
|
||||
}
|
||||
|
||||
public void setSecurityGroupList(List<Long> securityGroupIdList) {
|
||||
this.securityGroupIdList = securityGroupIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
UserVm result;
|
||||
|
|
@ -132,7 +239,7 @@ public class DeployVMCmd extends BaseDeployVMCmd {
|
|||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
if (Stream.of(templateId, snapshotId, volumeId).filter(Objects::nonNull).count() != 1) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ public class DestroyVMCmd extends BaseAsyncCmd implements UserCmd {
|
|||
return volumeIds;
|
||||
}
|
||||
|
||||
public boolean isForced() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -288,6 +288,14 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
|
|||
return Boolean.TRUE.equals(cleanupExtraConfig);
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setSecurityGroupIdList(List<Long> securityGroupIdList) {
|
||||
this.securityGroupIdList = securityGroupIdList;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -70,6 +70,21 @@ public class AssignVolumeCmd extends BaseCmd implements UserCmd {
|
|||
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///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC
|
|||
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})
|
||||
authorized = {RoleType.Admin},
|
||||
since = "4.22.1")
|
||||
private Long storageId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -150,6 +151,10 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +168,8 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC
|
|||
|
||||
public Long getStorageId() {
|
||||
if (snapshotId != null && storageId != null) {
|
||||
throw new IllegalArgumentException("StorageId parameter cannot be specified with the SnapshotId parameter.");
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR,
|
||||
"Storage ID cannot be specified with the Snapshot ID.");
|
||||
}
|
||||
return storageId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ public class DetachVolumeCmd extends BaseAsyncCmd implements UserCmd {
|
|||
return virtualMachineId;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -127,6 +127,18 @@ public class BackupResponse extends BaseResponse {
|
|||
@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;
|
||||
}
|
||||
|
|
@ -314,4 +326,28 @@ public class BackupResponse extends BaseResponse {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -30,8 +30,16 @@ import com.cloud.storage.Volume;
|
|||
|
||||
public interface Backup extends ControlledEntity, InternalIdentity, Identity {
|
||||
|
||||
String getFromCheckpointId();
|
||||
|
||||
String getToCheckpointId();
|
||||
|
||||
Long getCheckpointCreateTime();
|
||||
|
||||
Long getHostId();
|
||||
|
||||
enum Status {
|
||||
Allocated, Queued, BackingUp, BackedUp, Error, Failed, Restoring, Removed, Expunged
|
||||
Allocated, Queued, BackingUp, ReadyForImageTransfer, FinalizingImageTransfer, BackedUp, Error, Failed, Restoring, Removed, Expunged
|
||||
}
|
||||
|
||||
class Metric {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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<Integer> 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<Boolean> 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<ImageTransferResponse> listImageTransfers(ListImageTransfersCmd cmd);
|
||||
|
||||
/**
|
||||
* List checkpoints for a VM
|
||||
*/
|
||||
List<CheckpointResponse> 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<Long> listCompatibleDataCenterIds();
|
||||
}
|
||||
|
|
@ -23,6 +23,10 @@ import org.apache.cloudstack.api.command.user.storage.sharedfs.ChangeSharedFSDis
|
|||
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.ResourceAllocationException;
|
|||
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<SharedFSProvider> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
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;
|
||||
|
|
@ -41,6 +42,7 @@ 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;
|
||||
|
|
@ -480,4 +482,146 @@ public class DeployVMCmdTest {
|
|||
});
|
||||
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<Long> 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<Long> affinityGroupIds = Arrays.asList(21L, 22L);
|
||||
cmd.setAffinityGroupIds(affinityGroupIds);
|
||||
assertEquals(affinityGroupIds, cmd.getAffinityGroupIdList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetDetails() {
|
||||
Map<String, String> 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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -612,6 +612,11 @@
|
|||
<artifactId>cloud-plugin-backup-nas</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-integrations-veeam-control-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-integrations-kubernetes-service</artifactId>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<String, String> diskPathUuidMap;
|
||||
private boolean stoppedVM;
|
||||
|
||||
public DeleteVmCheckpointCommand() {
|
||||
}
|
||||
|
||||
public DeleteVmCheckpointCommand(String vmName, String checkpointId, Map<String, String> 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<String, String> getDiskPathUuidMap() {
|
||||
return diskPathUuidMap;
|
||||
}
|
||||
|
||||
public boolean isStoppedVM() {
|
||||
return stoppedVM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<String, String> diskPathUuidMap;
|
||||
private boolean stoppedVM;
|
||||
@LogLevel(LogLevel.Log4jLevel.Off)
|
||||
private Map<String, byte[]> diskPathPassphraseMap;
|
||||
|
||||
public StartBackupCommand() {
|
||||
}
|
||||
|
||||
public StartBackupCommand(String vmName, String toCheckpointId, String fromCheckpointId, Long fromCheckpointCreateTime,
|
||||
String socket, Map<String, String> diskPathUuidMap, Map<String, byte[]> 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<String, String> getDiskPathUuidMap() {
|
||||
return diskPathUuidMap;
|
||||
}
|
||||
|
||||
public boolean isIncremental() {
|
||||
return fromCheckpointId != null && !fromCheckpointId.isEmpty();
|
||||
}
|
||||
|
||||
public boolean isStoppedVM() {
|
||||
return stoppedVM;
|
||||
}
|
||||
|
||||
public Map<String, byte[]> getDiskPathPassphraseMap() {
|
||||
return diskPathPassphraseMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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, ovmf, swtpm, 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
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ import com.cloud.utils.fsm.NoTransitionException;
|
|||
*/
|
||||
public interface VirtualMachineManager extends Manager {
|
||||
|
||||
String KVM_BLANK_VM_TEMPLATE_NAME = "kvm-blank-vm-template";
|
||||
|
||||
ConfigKey<Boolean> 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);
|
||||
|
||||
|
|
@ -314,4 +316,8 @@ public interface VirtualMachineManager extends Manager {
|
|||
ServiceOffering serviceOffering, Account systemAccount, DeploymentPlan plan)
|
||||
throws InsufficientServerCapacityException;
|
||||
|
||||
boolean isBlankInstanceDefaultTemplate(VirtualMachineTemplate template);
|
||||
|
||||
boolean isBlankInstance(VirtualMachineTemplate template);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ import com.cloud.vm.VirtualMachine.PowerState;
|
|||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.VMInstanceDetailsDao;
|
||||
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;
|
||||
|
|
@ -576,7 +576,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
|
||||
logger.debug("Allocating disks for {}", persistedVm);
|
||||
|
||||
allocateRootVolume(persistedVm, template, rootDiskOfferingInfo, owner, rootDiskSizeFinal, volume, snapshot);
|
||||
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);
|
||||
|
|
@ -6708,4 +6714,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
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;
|
||||
|
|
@ -292,9 +293,11 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
|
||||
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);
|
||||
|
|
@ -345,7 +348,7 @@ public class CloudOrchestrator implements OrchestrationService {
|
|||
|
||||
HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor);
|
||||
|
||||
_itMgr.allocate(vm.getInstanceName(), _templateDao.findByIdIncludingRemoved(new Long(isoId)), computeOffering, rootDiskOfferingInfo, dataDiskOfferings, dataDiskDeviceIds,
|
||||
_itMgr.allocate(vm.getInstanceName(), iso, computeOffering, rootDiskOfferingInfo, dataDiskOfferings, dataDiskDeviceIds,
|
||||
networkIpMap, plan, hypervisorType, extraDhcpOptionMap, null, volume, snapshot);
|
||||
|
||||
return vmEntity;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
<entry key="VirtualMachineManagerImpl" value-ref="clusteredVirtualMachineManagerImpl" />
|
||||
<entry key="VolumeApiServiceImpl" value-ref="volumeApiServiceImpl" />
|
||||
<entry key="VMSnapshotManagerImpl" value-ref="vMSnapshotManagerImpl" />
|
||||
<entry key="KVMBackupExportServiceImpl" value-ref="kvmBackupExportService" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ 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<ClusterVO, Long> {
|
||||
|
|
@ -61,4 +62,6 @@ public interface ClusterDao extends GenericDao<ClusterVO, Long> {
|
|||
List<String> listDistinctStorageAccessGroups(String name, String keyword);
|
||||
|
||||
List<Long> listEnabledClusterIdsByZoneHypervisorArch(Long zoneId, HypervisorType hypervisorType, CPU.CPUArch arch);
|
||||
|
||||
List<ClusterVO> listByZonesAndHypervisorType(List<Long> zoneIds, HypervisorType hypervisorType, Filter filter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -27,6 +28,7 @@ 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;
|
||||
|
|
@ -38,6 +40,7 @@ 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;
|
||||
|
|
@ -413,4 +416,19 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
|||
}
|
||||
return customSearch(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByZonesAndHypervisorType(List<Long> zoneIds, HypervisorType hypervisorType, Filter filter) {
|
||||
if (CollectionUtils.isEmpty(zoneIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
SearchBuilder<ClusterVO> sb = createSearchBuilder();
|
||||
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.IN);
|
||||
sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||
sb.done();
|
||||
SearchCriteria<ClusterVO> sc = sb.create();
|
||||
sc.setParameters("dataCenterId", zoneIds.toArray());
|
||||
sc.setParameters("hypervisorType", hypervisorType.toString());
|
||||
return listBy(sc, filter);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ 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;
|
||||
|
|
@ -96,8 +97,13 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long>, StateDao<State,
|
|||
|
||||
boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap);
|
||||
|
||||
List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType, Filter filter);
|
||||
|
||||
List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
||||
|
||||
List<NetworkVO> listByZonesTrafficTypeAndOwners(List<Long> zoneIds, final TrafficType trafficType,
|
||||
List<Long> accountIds, List<Long> domainIds, Filter filter);
|
||||
|
||||
void setCheckForGc(long networkId);
|
||||
|
||||
int getNetworkCountByNetworkOffId(long networkOfferingId);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.network.dao;
|
|||
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.annotation.PostConstruct;
|
|||
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.Func;
|
|||
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
|
||||
|
|
@ -632,12 +634,46 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>implements Ne
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) {
|
||||
public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType, Filter filter) {
|
||||
final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("datacenter", zoneId);
|
||||
sc.setParameters("trafficType", trafficType);
|
||||
|
||||
return listBy(sc, null);
|
||||
return listBy(sc, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) {
|
||||
return listByZoneAndTrafficType(zoneId, trafficType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NetworkVO> listByZonesTrafficTypeAndOwners(List<Long> zoneIds, final TrafficType trafficType,
|
||||
List<Long> accountIds, List<Long> domainIds, Filter filter) {
|
||||
if (CollectionUtils.isEmpty(zoneIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
SearchBuilder<NetworkVO> 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<NetworkVO> 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
|
||||
|
|
|
|||
|
|
@ -31,4 +31,6 @@ public interface SecurityGroupDao extends GenericDao<SecurityGroupVO, Long> {
|
|||
List<SecurityGroupVO> findByAccountAndNames(Long accountId, String... names);
|
||||
|
||||
int removeByAccountId(long accountId);
|
||||
|
||||
List<SecurityGroupVO> listByIds(List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,14 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
|||
txn.commit();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SecurityGroupVO> listByIds(List<Long> ids) {
|
||||
SearchBuilder<SecurityGroupVO> idsSearch = createSearchBuilder();
|
||||
idsSearch.and("ids", idsSearch.entity().getId(), SearchCriteria.Op.IN);
|
||||
idsSearch.done();
|
||||
SearchCriteria<SecurityGroupVO> sc = idsSearch.create();
|
||||
sc.setParameters("ids", ids.toArray());
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public interface DiskOfferingDao extends GenericDao<DiskOfferingVO, Long> {
|
|||
|
||||
List<DiskOfferingVO> listAllBySizeAndProvisioningType(long size, Storage.ProvisioningType provisioningType);
|
||||
|
||||
List<DiskOfferingVO> findCustomDiskOfferings();
|
||||
List<DiskOfferingVO> listCustomDiskOfferings();
|
||||
|
||||
List<DiskOfferingVO> listByStorageTag(String tag);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -33,6 +35,7 @@ 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;
|
||||
|
|
@ -138,13 +141,14 @@ public class DiskOfferingDaoImpl extends GenericDaoBase<DiskOfferingVO, Long> im
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DiskOfferingVO> findCustomDiskOfferings() {
|
||||
public List<DiskOfferingVO> listCustomDiskOfferings() {
|
||||
SearchBuilder<DiskOfferingVO> sb = createSearchBuilder();
|
||||
sb.and("customized", sb.entity().isCustomized(), SearchCriteria.Op.EQ);
|
||||
sb.done();
|
||||
SearchCriteria<DiskOfferingVO> sc = sb.create();
|
||||
sc.setParameters("customized", true);
|
||||
return listBy(sc);
|
||||
Filter searchFilter = new Filter(DiskOfferingVO.class, "sortKey", SortKeyAscending.value());
|
||||
return listBy(sc, searchFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -106,4 +106,6 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>, StateDao<
|
|||
|
||||
VMTemplateVO findActiveSystemTemplateByHypervisorArchAndUrlPath(HypervisorType hypervisorType,
|
||||
CPU.CPUArch arch, String urlPathSuffix);
|
||||
|
||||
VMTemplateVO findByAccountAndName(Long accountId, String templateName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -945,4 +945,12 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
}
|
||||
return rows > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findByAccountAndName(Long accountId, String templateName) {
|
||||
SearchCriteria<VMTemplateVO> sc = NameAccountIdSearch.create();
|
||||
sc.setParameters("name", templateName);
|
||||
sc.setParameters("accountId", accountId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
|
|||
|
||||
List<VolumeVO> findByInstanceAndType(long id, Volume.Type vType);
|
||||
|
||||
List<VolumeVO> findByInstanceAndNotStates(long id, Volume.State...states);
|
||||
|
||||
List<VolumeVO> findIncludingRemovedByInstanceAndType(long id, Volume.Type vType);
|
||||
|
||||
List<VolumeVO> findNonDestroyedVolumesByInstanceIdAndPoolId(long instanceId, long poolId);
|
||||
|
|
|
|||
|
|
@ -208,6 +208,17 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByInstanceAndNotStates(long id, Volume.State...states) {
|
||||
SearchBuilder<VolumeVO> sb = createSearchBuilder();
|
||||
sb.and("instanceId", sb.entity().getInstanceId(), Op.EQ);
|
||||
sb.and("state", sb.entity().getState(), Op.NIN);
|
||||
SearchCriteria<VolumeVO> sc = sb.create();
|
||||
sc.setParameters("instanceId", id);
|
||||
sc.setParameters("state", (Object[]) states);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findIncludingRemovedByInstanceAndType(long id, Type vType) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
|
|
|
|||
|
|
@ -20,11 +20,13 @@ import java.util.List;
|
|||
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<ResourceTagVO, Long> {
|
||||
|
||||
|
|
@ -60,4 +62,13 @@ public interface ResourceTagDao extends GenericDao<ResourceTagVO, Long> {
|
|||
void removeByResourceIdAndKey(long resourceId, ResourceObjectType resourceType, String key);
|
||||
|
||||
List<? extends ResourceTag> listByResourceUuid(String resourceUuid);
|
||||
|
||||
List<String> listByResourceTypeKeyPrefixAndOwners(ResourceObjectType resourceType, String key,
|
||||
List<Long> accountIds, List<Long> domainIds,
|
||||
Filter filter);
|
||||
|
||||
ResourceTagVO findByResourceTypeKeyPrefixAndValue(ResourceObjectType resourceType, String key, String value);
|
||||
|
||||
List<ResourceTagVO> listByResourceTypeIdAndKeyPrefix(ResourceObjectType resourceType, long resourceId, String key);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 class ResourceTagsDaoImpl extends GenericDaoBase<ResourceTagVO, Long> imp
|
|||
sc.setParameters("resourceUuid", resourceUuid);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listByResourceTypeKeyPrefixAndOwners(ResourceObjectType resourceType, String key,
|
||||
List<Long> accountIds, List<Long> domainIds,
|
||||
Filter filter) {
|
||||
GenericSearchBuilder<ResourceTagVO, String> 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<String> 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<ResourceTagVO> 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<ResourceTagVO> sc = sb.create();
|
||||
sc.setParameters("resourceType", resourceType);
|
||||
sc.setParameters("key", key + "%");
|
||||
sc.setParameters("value", value);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceTagVO> listByResourceTypeIdAndKeyPrefix(ResourceObjectType resourceType, long resourceId,
|
||||
String key) {
|
||||
SearchBuilder<ResourceTagVO> 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<ResourceTagVO> sc = sb.create();
|
||||
sc.setParameters("resourceType", resourceType);
|
||||
sc.setParameters("resourceId", resourceId);
|
||||
sc.setParameters("key", key + "%");
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import com.cloud.vm.VirtualMachine;
|
|||
public interface NicDao extends GenericDao<NicVO, Long> {
|
||||
List<NicVO> listByVmId(long instanceId);
|
||||
|
||||
int countByVmId(long instanceId);
|
||||
|
||||
List<NicVO> listByVmIdOrderByDeviceId(long instanceId);
|
||||
|
||||
List<String> listIpAddressInNetwork(long networkConfigId);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue