mirror of https://github.com/apache/cloudstack.git
Merge branch 'apache:main' into Backroll
This commit is contained in:
commit
ad6ffca6e3
|
|
@ -53,11 +53,12 @@ github:
|
|||
- acs-robot
|
||||
- gpordeus
|
||||
- hsato03
|
||||
- bernardodemarco
|
||||
- abh1sar
|
||||
- FelipeM525
|
||||
- lucas-a-martins
|
||||
- nicoschmdt
|
||||
- abh1sar
|
||||
- rosi-shapeblue
|
||||
- sudo87
|
||||
|
||||
protected_branches: ~
|
||||
|
||||
|
|
|
|||
|
|
@ -86,3 +86,6 @@ MD046: false
|
|||
|
||||
# MD052/reference-links-images Reference links and images should use a label that is defined
|
||||
MD052: false
|
||||
|
||||
# MD059/descriptive-link-text Link text should be descriptive
|
||||
MD059: false
|
||||
|
|
|
|||
|
|
@ -32,13 +32,12 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
architecture: x64
|
||||
cache: maven
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
|
|
|
|||
|
|
@ -89,7 +89,10 @@ jobs:
|
|||
smoke/test_nested_virtualization
|
||||
smoke/test_set_sourcenat
|
||||
smoke/test_webhook_lifecycle
|
||||
smoke/test_purge_expunged_vms",
|
||||
smoke/test_purge_expunged_vms
|
||||
smoke/test_extension_lifecycle
|
||||
smoke/test_extension_custom_action_lifecycle
|
||||
smoke/test_extension_custom",
|
||||
"smoke/test_network
|
||||
smoke/test_network_acl
|
||||
smoke/test_network_ipv6
|
||||
|
|
@ -137,6 +140,7 @@ jobs:
|
|||
smoke/test_vm_deployment_planner
|
||||
smoke/test_vm_strict_host_tags
|
||||
smoke/test_vm_schedule
|
||||
smoke/test_deploy_vgpu_enabled_vm
|
||||
smoke/test_vm_life_cycle
|
||||
smoke/test_vm_lifecycle_unmanage_import
|
||||
smoke/test_vm_snapshot_kvm
|
||||
|
|
@ -164,7 +168,8 @@ jobs:
|
|||
component/test_cpu_limits
|
||||
component/test_cpu_max_limits
|
||||
component/test_cpu_project_limits
|
||||
component/test_deploy_vm_userdata_multi_nic",
|
||||
component/test_deploy_vm_userdata_multi_nic
|
||||
component/test_deploy_vm_lease",
|
||||
"component/test_egress_fw_rules
|
||||
component/test_invalid_gw_nm
|
||||
component/test_ip_reservation",
|
||||
|
|
@ -215,13 +220,12 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
architecture: x64
|
||||
cache: maven
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
|
|
@ -236,7 +240,7 @@ jobs:
|
|||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid
|
||||
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose
|
||||
|
||||
- name: Install jacoco dependencies
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
name: CodeQL Analysis
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
jobs:
|
||||
codeql:
|
||||
name: CodeQL
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ["actions"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "Security"
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
name: Lint
|
||||
name: pre-commit
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml', '*/pom.xml', '*/*/pom.xml', '*/*/*/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-m2
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ jobs:
|
|||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml', '*/pom.xml', '*/*/pom.xml', '*/*/*/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-m2
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ jobs:
|
|||
npm run test:unit
|
||||
|
||||
- uses: codecov/codecov-action@v4
|
||||
if: github.repository == 'apache/cloudstack'
|
||||
with:
|
||||
working-directory: ui
|
||||
files: ./coverage/lcov.info
|
||||
|
|
|
|||
|
|
@ -15,23 +15,31 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
---
|
||||
default_stages: [commit, push]
|
||||
default_stages: [pre-commit, pre-push]
|
||||
default_language_version:
|
||||
# force all unspecified Python hooks to run python3
|
||||
python: python3
|
||||
minimum_pre_commit_version: "2.17.0"
|
||||
minimum_pre_commit_version: "3.2.0"
|
||||
repos:
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: identity
|
||||
- id: check-hooks-apply
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.27.2
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
name: run gitleaks
|
||||
description: detect hardcoded secrets
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
#- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
#- id: check-executables-have-shebangs
|
||||
- id: check-merge-conflict
|
||||
- id: check-shebang-scripts-are-executable
|
||||
files: \.sh$
|
||||
- id: check-symlinks
|
||||
- id: check-vcs-permalinks
|
||||
#- id: check-yaml
|
||||
|
|
@ -42,6 +50,7 @@ repos:
|
|||
exclude: >
|
||||
(?x)
|
||||
^scripts/vm/systemvm/id_rsa\.cloud$|
|
||||
^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java$|
|
||||
^server/src/test/java/com/cloud/keystore/KeystoreTest\.java$|
|
||||
^server/src/test/resources/certs/dsa_self_signed\.key$|
|
||||
^server/src/test/resources/certs/non_root\.key$|
|
||||
|
|
@ -51,7 +60,8 @@ repos:
|
|||
^server/src/test/resources/certs/rsa_self_signed\.key$|
|
||||
^services/console-proxy/rdpconsole/src/test/doc/rdp-key\.pem$|
|
||||
^systemvm/agent/certs/localhost\.key$|
|
||||
^systemvm/agent/certs/realhostip\.key$
|
||||
^systemvm/agent/certs/realhostip\.key$|
|
||||
^test/integration/smoke/test_ssl_offloading.py$
|
||||
- id: end-of-file-fixer
|
||||
exclude: \.vhd$
|
||||
- id: fix-byte-order-marker
|
||||
|
|
@ -59,7 +69,7 @@ repos:
|
|||
- id: mixed-line-ending
|
||||
exclude: \.cs$
|
||||
- id: trailing-whitespace
|
||||
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$
|
||||
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
|
|
@ -69,25 +79,14 @@ repos:
|
|||
name: run codespell
|
||||
description: Check spelling with codespell
|
||||
args: [--ignore-words=.github/linters/codespell.txt]
|
||||
exclude: ^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
|
||||
exclude: ^systemvm/agent/noVNC/|^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$|^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java$|^test/integration/smoke/test_ssl_offloading.py$
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 7.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: [--config, .github/linters/.flake8]
|
||||
exclude: >
|
||||
(?x)
|
||||
^agent/bindir/cloud-setup-agent\.in$|
|
||||
^client/bindir/cloud-update-xenserver-licenses\.in$|
|
||||
^cloud-cli/bindir/cloud-tool$|
|
||||
^python/bindir/cloud-grab-dependent-library-versions$|
|
||||
^python/bindir/cloud-setup-baremetal$|
|
||||
^scripts/vm/hypervisor/xenserver/storagePlugin$|
|
||||
^scripts/vm/hypervisor/xenserver/vmopspremium$|
|
||||
^setup/bindir/cloud-setup-encryption\.in$|
|
||||
^venv/.*$
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.43.0
|
||||
rev: v0.45.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
name: run markdownlint
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ Contributing to Apache CloudStack (ACS)
|
|||
Summary
|
||||
-------
|
||||
This document covers how to contribute to the ACS project. ACS uses GitHub PRs to manage code contributions.
|
||||
These instructions assume you have a GitHub.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to your own fork of the ACS project and you will submit a Pull Request for your changes to be added.
|
||||
These instructions assume you have a GitHub.com account, so if you don't have one you will have to create one. Your proposed code changes will be published to your own fork of the ACS project, and you will submit a Pull Request for your changes to be added.
|
||||
|
||||
_Lets get started!!!_
|
||||
_Let's get started!!!_
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
|
|
@ -26,7 +26,7 @@ No back porting / cherry-picking features to existing branches!
|
|||
|
||||
PendingReleaseNotes file
|
||||
------------------------
|
||||
When developing a new feature or making a (major) change to a existing feature you are encouraged to append this to the PendingReleaseNotes file so that the Release Manager can
|
||||
When developing a new feature or making a (major) change to an existing feature you are encouraged to append this to the PendingReleaseNotes file so that the Release Manager can
|
||||
use this file as a source of information when compiling the Release Notes for a new release.
|
||||
|
||||
When adding information to the PendingReleaseNotes file make sure that you write a good and understandable description of the new feature or change which you have developed.
|
||||
|
|
@ -38,9 +38,9 @@ Fork the code
|
|||
|
||||
In your browser, navigate to: [https://github.com/apache/cloudstack](https://github.com/apache/cloudstack)
|
||||
|
||||
Fork the repository by clicking on the 'Fork' button on the top right hand side. The fork will happen and you will be taken to your own fork of the repository. Copy the Git repository URL by clicking on the clipboard next to the URL on the right hand side of the page under '**HTTPS** clone URL'. You will paste this URL when doing the following `git clone` command.
|
||||
Fork the repository by clicking on the 'Fork' button on the top right hand side. The fork will happen, and you will be taken to your own fork of the repository. Copy the Git repository URL by clicking on the clipboard next to the URL on the right hand side of the page under '**HTTPS** clone URL'. You will paste this URL when doing the following `git clone` command.
|
||||
|
||||
On your computer, follow these steps to setup a local repository for working on ACS:
|
||||
On your computer, follow these steps to set up a local repository for working on ACS:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/YOUR_ACCOUNT/cloudstack.git
|
||||
|
|
@ -92,9 +92,9 @@ $ git rebase main
|
|||
Make a GitHub Pull Request to contribute your changes
|
||||
-----------------------------------------------------
|
||||
|
||||
When you are happy with your changes and you are ready to contribute them, you will create a Pull Request on GitHub to do so. This is done by pushing your local changes to your forked repository (default remote name is `origin`) and then initiating a pull request on GitHub.
|
||||
When you are happy with your changes, and you are ready to contribute them, you will create a Pull Request on GitHub to do so. This is done by pushing your local changes to your forked repository (default remote name is `origin`) and then initiating a pull request on GitHub.
|
||||
|
||||
Please include JIRA id, detailed information about the bug/feature, what all tests are executed, how the reviewer can test this feature etc. Incase of UI PRs, a screenshot is preferred.
|
||||
Please include JIRA id, detailed information about the bug/feature, what all tests are executed, how the reviewer can test this feature etc. In case of UI PRs, a screenshot is preferred.
|
||||
|
||||
> **IMPORTANT:** Make sure you have rebased your `feature_x` branch to include the latest code from `upstream/main` _before_ you do this.
|
||||
|
||||
|
|
|
|||
39
INSTALL.md
39
INSTALL.md
|
|
@ -18,25 +18,26 @@ Install tools and dependencies used for development:
|
|||
# yum -y install git java-17-openjdk java-17-openjdk-devel \
|
||||
mysql mysql-server mkisofs git gcc python MySQL-python openssh-clients wget
|
||||
|
||||
Set up Maven (3.6.0):
|
||||
Set up Maven (3.9.10):
|
||||
|
||||
# wget http://www.us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
|
||||
# tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /usr/local
|
||||
# wget https://dlcdn.apache.org/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz
|
||||
# sudo tar -zxvf apache-maven-3.9.10-bin.tar.gz -C /usr/local
|
||||
# cd /usr/local
|
||||
# ln -s apache-maven-3.6.3 maven
|
||||
# sudo ln -s apache-maven-3.9.10 maven
|
||||
# echo export M2_HOME=/usr/local/maven >> ~/.bashrc # or .zshrc or .profile
|
||||
# echo export PATH=/usr/local/maven/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile
|
||||
# source ~/.bashrc
|
||||
|
||||
Setup up NodeJS (LTS):
|
||||
Setup up Node.js 16:
|
||||
|
||||
# curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
|
||||
# curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
|
||||
# sudo yum install nodejs
|
||||
# sudo npm install -g @vue/cli npm-check-updates
|
||||
|
||||
Start the MySQL service:
|
||||
|
||||
$ service mysqld start
|
||||
$ mysql_secure_installation
|
||||
|
||||
### Using jenv and/or pyenv for Version Management
|
||||
|
||||
|
|
@ -86,13 +87,33 @@ Start the management server:
|
|||
|
||||
If this works, you've successfully setup a single server Apache CloudStack installation.
|
||||
|
||||
Open the following URL on your browser to access the Management Server UI:
|
||||
|
||||
http://localhost:8080/client/
|
||||
To access the Management Server UI, follow the following procedure:
|
||||
|
||||
The default credentials are; user: admin, password: password and the domain
|
||||
field should be left blank which is defaulted to the ROOT domain.
|
||||
|
||||
## To bring up CloudStack UI
|
||||
|
||||
Move to UI Directory
|
||||
|
||||
$ cd /path/to/cloudstack/ui
|
||||
|
||||
To install dependencies.
|
||||
|
||||
$ npm install
|
||||
|
||||
To build the project.
|
||||
|
||||
$ npm run build
|
||||
|
||||
For Development Mode.
|
||||
|
||||
$ npm start
|
||||
|
||||
Make sure to set `CS_URL=http://localhost:8080` on the `.env.local` file on UI.
|
||||
|
||||
You should be able to run the management server on http://localhost:5050
|
||||
|
||||
## Building with non-redistributable plugins
|
||||
|
||||
CloudStack supports several plugins that depend on libraries with distribution restrictions.
|
||||
|
|
|
|||
20
README.md
20
README.md
|
|
@ -1,4 +1,14 @@
|
|||
# Apache CloudStack [](https://github.com/apache/cloudstack/actions/workflows/build.yml) [](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [](https://sonarcloud.io/dashboard?id=apache_cloudstack) [](https://codecov.io/gh/apache/cloudstack)
|
||||
# Apache CloudStack
|
||||
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/build.yml)
|
||||
[](https://codecov.io/gh/apache/cloudstack)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/docker-cloudstack-simulator.yml)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/rat.yml)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/linter.yml)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/merge-conflict-checker.yml)
|
||||
[](https://sonarcloud.io/dashboard?id=apache_cloudstack)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/ci.yml)
|
||||
[](https://github.com/apache/cloudstack/actions/workflows/ui.yml)
|
||||
|
||||
[](https://cloudstack.apache.org/)
|
||||
|
||||
|
|
@ -160,3 +170,11 @@ The following provides more details on the included cryptographic software:
|
|||
* CloudStack makes use of the Bouncy Castle general-purpose encryption library.
|
||||
* CloudStack can optionally interact with and control OpenSwan-based VPNs.
|
||||
* CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://www.star-history.com/#apache/cloudstack&Date)
|
||||
|
||||
## Contributors
|
||||
|
||||
[](https://github.com/apache/cloudstack/graphs/contributors)
|
||||
|
|
|
|||
|
|
@ -20,9 +20,22 @@ import os
|
|||
import logging
|
||||
import sys
|
||||
import socket
|
||||
|
||||
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
|
||||
# ---- We do this so cloud_utils can be looked up in the following order:
|
||||
# ---- 1) Sources directory
|
||||
# ---- 2) waf configured PYTHONDIR
|
||||
# ---- 3) System Python path
|
||||
for pythonpath in (
|
||||
"@PYTHONDIR@",
|
||||
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
|
||||
):
|
||||
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
|
||||
# ---- End snippet of code ----
|
||||
|
||||
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
|
||||
from cloudutils.utilities import initLoging, bash
|
||||
from cloudutils.configFileOps import configFileOps
|
||||
from cloudutils.configFileOps import configFileOps
|
||||
from cloudutils.globalEnv import globalEnv
|
||||
from cloudutils.networkConfig import networkConfig
|
||||
from cloudutils.syscfg import sysConfigFactory
|
||||
|
|
@ -30,35 +43,41 @@ from cloudutils.serviceConfig import configureLibvirtConfig, configure_libvirt_t
|
|||
|
||||
from optparse import OptionParser
|
||||
|
||||
|
||||
def getUserInputs():
|
||||
print("Welcome to the CloudStack Agent Setup:")
|
||||
|
||||
cfo = configFileOps("@AGENTSYSCONFDIR@/agent.properties")
|
||||
oldMgt = cfo.getEntry("host")
|
||||
|
||||
mgtSvr = input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt)
|
||||
mgtSvr = input(
|
||||
"Please input the Management Server Hostname/IP-Address:[%s]" % oldMgt
|
||||
)
|
||||
if mgtSvr == "":
|
||||
mgtSvr = oldMgt
|
||||
try:
|
||||
socket.getaddrinfo(mgtSvr, 443)
|
||||
except:
|
||||
print("Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr)
|
||||
print(
|
||||
"Failed to resolve %s. Please input a valid hostname or IP-Address."
|
||||
% mgtSvr
|
||||
)
|
||||
exit(1)
|
||||
|
||||
oldToken = cfo.getEntry("zone")
|
||||
zoneToken = input("Please input the Zone Id:[%s]"%oldToken)
|
||||
zoneToken = input("Please input the Zone Id:[%s]" % oldToken)
|
||||
|
||||
if zoneToken == "":
|
||||
zoneToken = oldToken
|
||||
|
||||
oldPod = cfo.getEntry("pod")
|
||||
podId = input("Please input the Pod Id:[%s]"%oldPod)
|
||||
podId = input("Please input the Pod Id:[%s]" % oldPod)
|
||||
|
||||
if podId == "":
|
||||
podId = oldToken
|
||||
podId = oldToken
|
||||
|
||||
oldCluster = cfo.getEntry("cluster")
|
||||
clusterId = input("Please input the Cluster Id:[%s]"%oldCluster)
|
||||
clusterId = input("Please input the Cluster Id:[%s]" % oldCluster)
|
||||
if clusterId == "":
|
||||
clusterId = oldCluster
|
||||
|
||||
|
|
@ -66,18 +85,20 @@ def getUserInputs():
|
|||
if oldHypervisor == "":
|
||||
oldHypervisor = "kvm"
|
||||
|
||||
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor)
|
||||
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]" % oldHypervisor)
|
||||
if hypervisor == "":
|
||||
hypervisor = oldHypervisor
|
||||
|
||||
try:
|
||||
defaultNic = networkConfig.getDefaultNetwork()
|
||||
except:
|
||||
print("Failed to get default route. Please configure your network to have a default route")
|
||||
print(
|
||||
"Failed to get default route. Please configure your network to have a default route"
|
||||
)
|
||||
exit(1)
|
||||
|
||||
defNic = defaultNic.name
|
||||
network = input("Please choose which network used to create VM:[%s]"%defNic)
|
||||
network = input("Please choose which network used to create VM:[%s]" % defNic)
|
||||
if network == "":
|
||||
if defNic == "":
|
||||
print("You need to specify one of Nic or bridge on your system")
|
||||
|
|
@ -87,7 +108,8 @@ def getUserInputs():
|
|||
|
||||
return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor]
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
initLoging("@AGENTLOGDIR@/setup.log")
|
||||
glbEnv = globalEnv()
|
||||
|
||||
|
|
@ -95,13 +117,23 @@ if __name__ == '__main__':
|
|||
glbEnv.agentMode = "Agent"
|
||||
parser = OptionParser()
|
||||
parser.add_option("-a", action="store_true", dest="auto", help="auto mode")
|
||||
parser.add_option("-m", "--host", dest="mgt", help="Management server hostname or IP-Address")
|
||||
parser.add_option(
|
||||
"-m", "--host", dest="mgt", help="Management server hostname or IP-Address"
|
||||
)
|
||||
parser.add_option("-z", "--zone", dest="zone", help="zone id")
|
||||
parser.add_option("-p", "--pod", dest="pod", help="pod id")
|
||||
parser.add_option("-c", "--cluster", dest="cluster", help="cluster id")
|
||||
parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type")
|
||||
parser.add_option(
|
||||
"-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type"
|
||||
)
|
||||
parser.add_option("-g", "--guid", dest="guid", help="guid")
|
||||
parser.add_option("-s", action="store_true", default=False, dest="secure", help="Secure and enable TLS for libvirtd")
|
||||
parser.add_option(
|
||||
"-s",
|
||||
action="store_true",
|
||||
default=False,
|
||||
dest="secure",
|
||||
help="Secure and enable TLS for libvirtd",
|
||||
)
|
||||
parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface")
|
||||
parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface")
|
||||
parser.add_option("--guestNic", dest="guestNic", help="Guest traffic interface")
|
||||
|
|
@ -127,15 +159,15 @@ if __name__ == '__main__':
|
|||
glbEnv.pod = userInputs[3]
|
||||
glbEnv.cluster = userInputs[4]
|
||||
glbEnv.hypervisor = userInputs[5]
|
||||
#generate UUID
|
||||
# generate UUID
|
||||
glbEnv.uuid = old_config.getEntry("guid")
|
||||
if glbEnv.uuid == "":
|
||||
glbEnv.uuid = bash("uuidgen").getStdout()
|
||||
else:
|
||||
for para, value in list(options.__dict__.items()):
|
||||
if value is None:
|
||||
print("Missing operand:%s"%para)
|
||||
print("Try %s --help for more information"%sys.argv[0])
|
||||
print("Missing operand:%s" % para)
|
||||
print("Try %s --help for more information" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
glbEnv.uuid = options.guid
|
||||
|
|
@ -155,7 +187,7 @@ if __name__ == '__main__':
|
|||
try:
|
||||
syscfg.config()
|
||||
print("CloudStack Agent setup is done!")
|
||||
except (CloudRuntimeException,CloudInternalException) as e:
|
||||
except (CloudRuntimeException, CloudInternalException) as e:
|
||||
print(e)
|
||||
print("Try to restore your system:")
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,19 @@ import sys
|
|||
import os
|
||||
import subprocess
|
||||
from threading import Timer
|
||||
|
||||
# ---- This snippet of code adds the sources path and the waf configured PYTHONDIR to the Python path ----
|
||||
# ---- We do this so cloud_utils can be looked up in the following order:
|
||||
# ---- 1) Sources directory
|
||||
# ---- 2) waf configured PYTHONDIR
|
||||
# ---- 3) System Python path
|
||||
for pythonpath in (
|
||||
"@PYTHONDIR@",
|
||||
os.path.join(os.path.dirname(__file__),os.path.pardir,os.path.pardir,"python","lib"),
|
||||
):
|
||||
if os.path.isdir(pythonpath): sys.path.insert(0,pythonpath)
|
||||
# ---- End snippet of code ----
|
||||
|
||||
from xml.dom.minidom import parse
|
||||
from cloudutils.configFileOps import configFileOps
|
||||
from cloudutils.networkConfig import networkConfig
|
||||
|
|
|
|||
|
|
@ -213,8 +213,9 @@ hypervisor.type=kvm
|
|||
# If null (default), defaults to the VM's OS architecture
|
||||
#guest.cpu.arch=
|
||||
|
||||
# This param will require CPU features on the CPU section.
|
||||
# The features listed in this property must be separated by a blank space (e.g.: vmx vme)
|
||||
# Specifies required CPU features for end-user and system VMs.
|
||||
# These features must be present on the host CPU for VM deployment.
|
||||
# Multiple features should be separated by whitespace (e.g.: vmx vme).
|
||||
#guest.cpu.features=
|
||||
|
||||
# Disables memory ballooning on VM guests for overcommit.
|
||||
|
|
@ -441,3 +442,12 @@ iscsi.session.cleanup.enabled=false
|
|||
|
||||
# Wait(in seconds) during agent reconnections. When no value is set then default value of 5s will be used
|
||||
#backoff.seconds=
|
||||
|
||||
# Timeout (in seconds) to wait for the snapshot reversion to complete.
|
||||
# revert.snapshot.timeout=10800
|
||||
|
||||
# Timeout (in seconds) to wait for the incremental snapshot to complete.
|
||||
# incremental.snapshot.timeout=10800
|
||||
|
||||
# If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise.
|
||||
# create.full.clone=false
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.21.0.0-SNAPSHOT</version>
|
||||
<version>4.22.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ import com.cloud.utils.nio.Link;
|
|||
import com.cloud.utils.nio.NioClient;
|
||||
import com.cloud.utils.nio.NioConnection;
|
||||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.script.OutputInterpreter;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
/**
|
||||
|
|
@ -342,7 +341,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...", e);
|
||||
}
|
||||
}
|
||||
shell.updateConnectedHost();
|
||||
shell.updateConnectedHost(((NioClient)connection).getHost());
|
||||
scavengeOldAgentObjects();
|
||||
}
|
||||
|
||||
|
|
@ -453,22 +452,30 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
certExecutor.schedule(new PostCertificateRenewalTask(this), 5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void scheduleHostLBCheckerTask(final long checkInterval) {
|
||||
private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long checkInterval) {
|
||||
String name = "HostLBCheckerTask";
|
||||
if (hostLbCheckExecutor != null && !hostLbCheckExecutor.isShutdown()) {
|
||||
logger.info("Shutting down the preferred host checker task {}", name);
|
||||
hostLbCheckExecutor.shutdown();
|
||||
try {
|
||||
if (!hostLbCheckExecutor.awaitTermination(1, TimeUnit.SECONDS)) {
|
||||
hostLbCheckExecutor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
logger.debug("Forcing {} shutdown as it did not shutdown in the desired time due to: {}",
|
||||
logger.debug("Forcing the preferred host checker task {} shutdown as it did not shutdown in the desired time due to: {}",
|
||||
name, e.getMessage());
|
||||
hostLbCheckExecutor.shutdownNow();
|
||||
}
|
||||
}
|
||||
if (checkInterval > 0L) {
|
||||
logger.info("Scheduling preferred host task with host.lb.interval={}ms", checkInterval);
|
||||
if ("shuffle".equalsIgnoreCase(lbAlgorithm)) {
|
||||
logger.info("Scheduling the preferred host checker task to trigger once (to apply lb algorithm '{}') after host.lb.interval={} ms", lbAlgorithm, checkInterval);
|
||||
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
|
||||
hostLbCheckExecutor.schedule(new PreferredHostCheckerTask(), checkInterval, TimeUnit.MILLISECONDS);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Scheduling a recurring preferred host checker task with host.lb.interval={} ms", checkInterval);
|
||||
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
|
||||
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
|
||||
TimeUnit.MILLISECONDS);
|
||||
|
|
@ -606,9 +613,9 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
}
|
||||
|
||||
protected String getAgentArch() {
|
||||
final Script command = new Script("/usr/bin/arch", 500, logger);
|
||||
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
|
||||
return command.execute(parser);
|
||||
String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 1000);
|
||||
logger.debug("Arch for agent: {} found: {}", _name, arch);
|
||||
return arch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -617,15 +624,11 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
}
|
||||
|
||||
protected void reconnect(final Link link) {
|
||||
reconnect(link, null, null, false);
|
||||
reconnect(link, null, false);
|
||||
}
|
||||
|
||||
protected void reconnect(final Link link, String preferredHost, List<String> avoidHostList, boolean forTransfer) {
|
||||
protected void reconnect(final Link link, String preferredMSHost, boolean forTransfer) {
|
||||
if (!(forTransfer || reconnectAllowed)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!reconnectAllowed) {
|
||||
logger.debug("Reconnect requested but it is not allowed {}", () -> getLinkLog(link));
|
||||
return;
|
||||
}
|
||||
|
|
@ -637,19 +640,26 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
serverResource.disconnected();
|
||||
logger.info("Lost connection to host: {}. Attempting reconnection while we still have {} commands in progress.", shell.getConnectedHost(), commandsInProgress.get());
|
||||
stopAndCleanupConnection(true);
|
||||
String host = preferredMSHost;
|
||||
if (org.apache.commons.lang3.StringUtils.isBlank(host)) {
|
||||
host = shell.getNextHost();
|
||||
}
|
||||
List<String> avoidMSHostList = shell.getAvoidHosts();
|
||||
do {
|
||||
final String host = shell.getNextHost();
|
||||
connection = new NioClient(getAgentName(), host, shell.getPort(), shell.getWorkers(), shell.getSslHandshakeTimeout(), this);
|
||||
logger.info("Reconnecting to host: {}", host);
|
||||
try {
|
||||
connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
stopAndCleanupConnection(false);
|
||||
if (CollectionUtils.isEmpty(avoidMSHostList) || !avoidMSHostList.contains(host)) {
|
||||
connection = new NioClient(getAgentName(), host, shell.getPort(), shell.getWorkers(), shell.getSslHandshakeTimeout(), this);
|
||||
logger.info("Reconnecting to host: {}", host);
|
||||
try {
|
||||
connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
stopAndCleanupConnection(false);
|
||||
}
|
||||
}
|
||||
shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
host = shell.getNextHost();
|
||||
} while (!connection.isStartup());
|
||||
shell.updateConnectedHost();
|
||||
shell.updateConnectedHost(((NioClient)connection).getHost());
|
||||
logger.info("Connected to the host: {}", shell.getConnectedHost());
|
||||
}
|
||||
|
||||
|
|
@ -797,6 +807,9 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
}
|
||||
commandsInProgress.incrementAndGet();
|
||||
try {
|
||||
if (cmd.isReconcile()) {
|
||||
cmd.setRequestSequence(request.getSequence());
|
||||
}
|
||||
answer = serverResource.executeRequest(cmd);
|
||||
} finally {
|
||||
commandsInProgress.decrementAndGet();
|
||||
|
|
@ -922,7 +935,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
return new SetupCertificateAnswer(true);
|
||||
}
|
||||
|
||||
private void processManagementServerList(final List<String> msList, final String lbAlgorithm, final Long lbCheckInterval) {
|
||||
private void processManagementServerList(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final boolean triggerHostLB) {
|
||||
if (CollectionUtils.isNotEmpty(msList) && StringUtils.isNotEmpty(lbAlgorithm)) {
|
||||
try {
|
||||
final String newMSHosts = String.format("%s%s%s", com.cloud.utils.StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm);
|
||||
|
|
@ -934,24 +947,31 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
throw new CloudRuntimeException("Could not persist received management servers list", e);
|
||||
}
|
||||
}
|
||||
if ("shuffle".equals(lbAlgorithm)) {
|
||||
scheduleHostLBCheckerTask(0);
|
||||
} else {
|
||||
scheduleHostLBCheckerTask(shell.getLbCheckerInterval(lbCheckInterval));
|
||||
shell.setAvoidHosts(avoidMsList);
|
||||
if (triggerHostLB) {
|
||||
logger.info("Triggering the preferred host checker task now");
|
||||
ScheduledExecutorService hostLbExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HostLB-Executor"));
|
||||
hostLbExecutor.schedule(new PreferredHostCheckerTask(), 0, TimeUnit.MILLISECONDS);
|
||||
hostLbExecutor.shutdown();
|
||||
}
|
||||
scheduleHostLBCheckerTask(lbAlgorithm, shell.getLbCheckerInterval(lbCheckInterval));
|
||||
}
|
||||
|
||||
private Answer setupManagementServerList(final SetupMSListCommand cmd) {
|
||||
processManagementServerList(cmd.getMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
|
||||
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), cmd.getTriggerHostLb());
|
||||
return new SetupMSListAnswer(true);
|
||||
}
|
||||
|
||||
private Answer migrateAgentToOtherMS(final MigrateAgentConnectionCommand cmd) {
|
||||
try {
|
||||
if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
|
||||
processManagementServerList(cmd.getMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
|
||||
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);
|
||||
}
|
||||
migrateAgentConnection(cmd.getAvoidMsList());
|
||||
ScheduledExecutorService migrateAgentConnectionService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job"));
|
||||
migrateAgentConnectionService.schedule(() -> {
|
||||
migrateAgentConnection(cmd.getAvoidMsList());
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
migrateAgentConnectionService.shutdown();
|
||||
} catch (Exception e) {
|
||||
String errMsg = "Migrate agent connection failed, due to " + e.getMessage();
|
||||
logger.debug(errMsg, e);
|
||||
|
|
@ -972,25 +992,26 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
throw new CloudRuntimeException("No other Management Server hosts to migrate");
|
||||
}
|
||||
|
||||
String preferredHost = null;
|
||||
String preferredMSHost = null;
|
||||
for (String msHost : msHostsList) {
|
||||
try (final Socket socket = new Socket()) {
|
||||
socket.connect(new InetSocketAddress(msHost, shell.getPort()), 5000);
|
||||
preferredHost = msHost;
|
||||
preferredMSHost = msHost;
|
||||
break;
|
||||
} catch (final IOException e) {
|
||||
throw new CloudRuntimeException("Management server host: " + msHost + " is not reachable, to migrate connection");
|
||||
}
|
||||
}
|
||||
|
||||
if (preferredHost == null) {
|
||||
if (preferredMSHost == null) {
|
||||
throw new CloudRuntimeException("Management server host(s) are not reachable, to migrate connection");
|
||||
}
|
||||
|
||||
logger.debug("Management server host " + preferredHost + " is found to be reachable, trying to reconnect");
|
||||
logger.debug("Management server host " + preferredMSHost + " is found to be reachable, trying to reconnect");
|
||||
shell.resetHostCounter();
|
||||
shell.setAvoidHosts(avoidMsList);
|
||||
shell.setConnectionTransfer(true);
|
||||
reconnect(link, preferredHost, avoidMsList, true);
|
||||
reconnect(link, preferredMSHost, true);
|
||||
}
|
||||
|
||||
public void processResponse(final Response response, final Link link) {
|
||||
|
|
@ -1003,14 +1024,23 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
for (final IAgentControlListener listener : controlListeners) {
|
||||
listener.processControlResponse(response, (AgentControlAnswer)answer);
|
||||
}
|
||||
} else if (answer instanceof PingAnswer && (((PingAnswer) answer).isSendStartup()) && reconnectAllowed) {
|
||||
logger.info("Management server requested startup command to reinitialize the agent");
|
||||
sendStartup(link);
|
||||
} else if (answer instanceof PingAnswer) {
|
||||
processPingAnswer((PingAnswer) answer);
|
||||
} else {
|
||||
updateLastPingResponseTime();
|
||||
}
|
||||
}
|
||||
|
||||
private void processPingAnswer(final PingAnswer answer) {
|
||||
if ((answer.isSendStartup()) && reconnectAllowed) {
|
||||
logger.info("Management server requested startup command to reinitialize the agent");
|
||||
sendStartup(link);
|
||||
} else {
|
||||
serverResource.processPingAnswer((PingAnswer) answer);
|
||||
}
|
||||
shell.setAvoidHosts(answer.getAvoidMsList());
|
||||
}
|
||||
|
||||
public void processReadyCommand(final Command cmd) {
|
||||
final ReadyCommand ready = (ReadyCommand)cmd;
|
||||
// Set human readable sizes;
|
||||
|
|
@ -1027,7 +1057,7 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
}
|
||||
|
||||
verifyAgentArch(ready.getArch());
|
||||
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
|
||||
processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval(), false);
|
||||
|
||||
logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName());
|
||||
}
|
||||
|
|
@ -1073,6 +1103,9 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
Answer answer = null;
|
||||
commandsInProgress.incrementAndGet();
|
||||
try {
|
||||
if (command.isReconcile()) {
|
||||
command.setRequestSequence(req.getSequence());
|
||||
}
|
||||
answer = serverResource.executeRequest(command);
|
||||
} finally {
|
||||
commandsInProgress.decrementAndGet();
|
||||
|
|
@ -1374,26 +1407,26 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
|
|||
if (msList == null || msList.length < 1) {
|
||||
return;
|
||||
}
|
||||
final String preferredHost = msList[0];
|
||||
final String preferredMSHost = msList[0];
|
||||
final String connectedHost = shell.getConnectedHost();
|
||||
logger.debug("Running preferred host checker task, connected host={}, preferred host={}",
|
||||
connectedHost, preferredHost);
|
||||
if (preferredHost == null || preferredHost.equals(connectedHost) || link == null) {
|
||||
connectedHost, preferredMSHost);
|
||||
if (preferredMSHost == null || preferredMSHost.equals(connectedHost) || link == null) {
|
||||
return;
|
||||
}
|
||||
boolean isHostUp = false;
|
||||
try (final Socket socket = new Socket()) {
|
||||
socket.connect(new InetSocketAddress(preferredHost, shell.getPort()), 5000);
|
||||
socket.connect(new InetSocketAddress(preferredMSHost, shell.getPort()), 5000);
|
||||
isHostUp = true;
|
||||
} catch (final IOException e) {
|
||||
logger.debug("Host: {} is not reachable", preferredHost);
|
||||
logger.debug("Host: {} is not reachable", preferredMSHost);
|
||||
}
|
||||
if (isHostUp && link != null && commandsInProgress.get() == 0) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Preferred host {} is found to be reachable, trying to reconnect", preferredHost);
|
||||
logger.debug("Preferred host {} is found to be reachable, trying to reconnect", preferredMSHost);
|
||||
}
|
||||
shell.resetHostCounter();
|
||||
reconnect(link);
|
||||
reconnect(link, preferredMSHost, false);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.error("Error caught while attempting to connect to preferred host", t);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
private String _zone;
|
||||
private String _pod;
|
||||
private String _host;
|
||||
private List<String> _avoidHosts;
|
||||
private String _privateIp;
|
||||
private int _port;
|
||||
private int _proxyPort;
|
||||
|
|
@ -76,7 +77,6 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
private volatile boolean _exit = false;
|
||||
private int _pingRetries;
|
||||
private final List<Agent> _agents = new ArrayList<Agent>();
|
||||
private String hostToConnect;
|
||||
private String connectedHost;
|
||||
private Long preferredHostCheckInterval;
|
||||
private boolean connectionTransfer = false;
|
||||
|
|
@ -121,7 +121,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
if (_hostCounter >= hosts.length) {
|
||||
_hostCounter = 0;
|
||||
}
|
||||
hostToConnect = hosts[_hostCounter % hosts.length];
|
||||
String hostToConnect = hosts[_hostCounter % hosts.length];
|
||||
_hostCounter++;
|
||||
return hostToConnect;
|
||||
}
|
||||
|
|
@ -143,11 +143,10 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateConnectedHost() {
|
||||
connectedHost = hostToConnect;
|
||||
public void updateConnectedHost(String connectedHost) {
|
||||
this.connectedHost = connectedHost;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resetHostCounter() {
|
||||
_hostCounter = 0;
|
||||
|
|
@ -166,6 +165,16 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAvoidHosts(List<String> avoidHosts) {
|
||||
_avoidHosts = avoidHosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAvoidHosts() {
|
||||
return _avoidHosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrivateIp() {
|
||||
return _privateIp;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.agent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
@ -63,9 +64,13 @@ public interface IAgentShell {
|
|||
|
||||
String[] getHosts();
|
||||
|
||||
void setAvoidHosts(List<String> hosts);
|
||||
|
||||
List<String> getAvoidHosts();
|
||||
|
||||
long getLbCheckerInterval(Long receivedLbInterval);
|
||||
|
||||
void updateConnectedHost();
|
||||
void updateConnectedHost(String connectedHost);
|
||||
|
||||
String getConnectedHost();
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,14 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Integer> CMDS_TIMEOUT = new Property<>("cmds.timeout", 7200);
|
||||
|
||||
/**
|
||||
* The timeout (in seconds) for the snapshot merge operation, mainly used for classic volume snapshots and disk-only VM snapshots on file-based storage.<br>
|
||||
* This configuration is only considered if libvirt.events.enabled is also true. <br>
|
||||
* Data type: Integer.<br>
|
||||
* Default value: <code>259200</code>
|
||||
*/
|
||||
public static final Property<Integer> QCOW2_DELTA_MERGE_TIMEOUT = new Property<>("qcow2.delta.merge.timeout", 60 * 60 * 72);
|
||||
|
||||
/**
|
||||
* This parameter sets the VM migration speed (in mbps). The default value is -1,<br>
|
||||
* which means that the agent will try to guess the speed of the guest network and consume all possible bandwidth.<br>
|
||||
|
|
@ -213,6 +221,15 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.script", "libvirt-vm-xml-transformer.groovy");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir property to define the Libvirt VM XML transformer shell script.<br>
|
||||
* The shell script is used to execute the Libvirt VM XML transformer script.<br>
|
||||
* For more information see the agent.properties file.<br>
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>libvirt-vm-xml-transformer.sh</code>
|
||||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.shell_script", "libvirt-vm-xml-transformer.sh");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_xml_transformer.script properties to define the Libvirt VM XML transformer method.<br>
|
||||
* Libvirt XML transformer hook does XML-to-XML transformation.<br>
|
||||
|
|
@ -233,6 +250,15 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_START_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.script", "libvirt-vm-state-change.groovy");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir property to define the Libvirt VM on start shell script.<br>
|
||||
* The shell script is used to execute the Libvirt VM on start script.<br>
|
||||
* For more information see the agent.properties file.<br>
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>libvirt-vm-state-change.sh</code>
|
||||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_START_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.shell_script", "libvirt-vm-state-change.sh");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_start.script properties to define the Libvirt VM on start method.<br>
|
||||
* The hook is called right after Libvirt successfully launched the VM.<br>
|
||||
|
|
@ -252,6 +278,15 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.script", "libvirt-vm-state-change.groovy");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir property to define the Libvirt VM on stop shell script.<br>
|
||||
* The shell script is used to execute the Libvirt VM on stop script.<br>
|
||||
* For more information see the agent.properties file.<br>
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>libvirt-vm-state-change.sh</code>
|
||||
*/
|
||||
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.shell_script", "libvirt-vm-state-change.sh");
|
||||
|
||||
/**
|
||||
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_stop.script properties to define the Libvirt VM on stop method.<br>
|
||||
* The hook is called right after libvirt successfully stopped the VM.<br>
|
||||
|
|
@ -390,8 +425,9 @@ public class AgentProperties{
|
|||
public static final Property<String> GUEST_CPU_ARCH = new Property<>("guest.cpu.arch", null, String.class);
|
||||
|
||||
/**
|
||||
* This param will require CPU features on the CPU section.<br>
|
||||
* The features listed in this property must be separated by a blank space (see example below).<br>
|
||||
* Specifies required CPU features for end-user and system VMs.<br>
|
||||
* These features must be present on the host CPU for VM deployment.<br>
|
||||
* Multiple features should be separated by whitespace (see example below).<br>
|
||||
* Possible values: vmx vme <br>
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>null</code>
|
||||
|
|
@ -816,14 +852,32 @@ public class AgentProperties{
|
|||
* Data type: Integer.<br>
|
||||
* Default value: <code>null</code>
|
||||
*/
|
||||
public static final Property<Integer> SSL_HANDSHAKE_TIMEOUT = new Property<>("ssl.handshake.timeout", null, Integer.class);
|
||||
public static final Property<Integer> SSL_HANDSHAKE_TIMEOUT = new Property<>("ssl.handshake.timeout", 30, Integer.class);
|
||||
|
||||
/**
|
||||
* Timeout (in seconds) to wait for the incremental snapshot to complete.
|
||||
* */
|
||||
public static final Property<Integer> INCREMENTAL_SNAPSHOT_TIMEOUT = new Property<>("incremental.snapshot.timeout", 10800);
|
||||
|
||||
/**
|
||||
* Timeout (in seconds) to wait for the snapshot reversion to complete.
|
||||
* */
|
||||
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
|
||||
|
||||
/**
|
||||
* If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise. <br>
|
||||
* Data type: Boolean. <br>
|
||||
* Default value: <code>false</code>
|
||||
*/
|
||||
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
|
||||
|
||||
|
||||
public static class Property <T>{
|
||||
private String name;
|
||||
private T defaultValue;
|
||||
private Class<T> typeClass;
|
||||
|
||||
Property(String name, T value) {
|
||||
public Property(String name, T value) {
|
||||
init(name, value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
|
|
@ -40,6 +39,7 @@ import com.cloud.resource.ServerResource;
|
|||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.UuidUtils;
|
||||
|
||||
public class DummyResource implements ServerResource {
|
||||
String _name;
|
||||
|
|
@ -133,7 +133,7 @@ public class DummyResource implements ServerResource {
|
|||
String hostIp = getConfiguredProperty("private.ip.address", "127.0.0.1");
|
||||
String localStoragePath = getConfiguredProperty("local.storage.path", "/mnt");
|
||||
String lh = hostIp + localStoragePath;
|
||||
String uuid = UUID.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString();
|
||||
String uuid = UuidUtils.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString();
|
||||
|
||||
String capacity = getConfiguredProperty("local.storage.capacity", "1000000000");
|
||||
String available = getConfiguredProperty("local.storage.avail", "10000000");
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ public class AgentShellTest {
|
|||
AgentShell shell = new AgentShell();
|
||||
shell.setHosts("test");
|
||||
shell.getNextHost();
|
||||
shell.updateConnectedHost();
|
||||
shell.updateConnectedHost("test");
|
||||
|
||||
Assert.assertEquals(expected, shell.getConnectedHost());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.21.0.0-SNAPSHOT</version>
|
||||
<version>4.22.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ package com.cloud.agent.api;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.LogLevel.Log4jLevel;
|
||||
|
||||
/**
|
||||
* implemented by classes that extends the Command class. Command specifies
|
||||
|
|
@ -35,6 +36,23 @@ public abstract class Command {
|
|||
Continue, Stop
|
||||
}
|
||||
|
||||
public enum State {
|
||||
CREATED, // Command is created by management server
|
||||
STARTED, // Command is started by agent
|
||||
PROCESSING, // Processing by agent
|
||||
PROCESSING_IN_BACKEND, // Processing in backend by agent
|
||||
COMPLETED, // Operation succeeds by agent or management server
|
||||
FAILED, // Operation fails by agent
|
||||
RECONCILE_RETRY, // Ready for retry of reconciliation
|
||||
RECONCILING, // Being reconciled by management server
|
||||
RECONCILED, // Reconciled by management server
|
||||
RECONCILE_SKIPPED, // Skip the reconciliation as the resource state is inconsistent with the command
|
||||
RECONCILE_FAILED, // Fail to reconcile by management server
|
||||
TIMED_OUT, // Timed out on management server or agent
|
||||
INTERRUPTED, // Interrupted by management server or agent (for example agent is restarted),
|
||||
DANGLED_IN_BACKEND // Backend process which cannot be processed normally (for example agent is restarted)
|
||||
}
|
||||
|
||||
public static final String HYPERVISOR_TYPE = "hypervisorType";
|
||||
|
||||
// allow command to carry over hypervisor or other environment related context info
|
||||
|
|
@ -42,6 +60,8 @@ public abstract class Command {
|
|||
protected Map<String, String> contextMap = new HashMap<String, String>();
|
||||
private int wait; //in second
|
||||
private boolean bypassHostMaintenance = false;
|
||||
private transient long requestSequence = 0L;
|
||||
protected Map<String, Map<String, String>> externalDetails;
|
||||
|
||||
protected Command() {
|
||||
this.wait = 0;
|
||||
|
|
@ -82,6 +102,10 @@ public abstract class Command {
|
|||
return contextMap.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getContextMap() {
|
||||
return contextMap;
|
||||
}
|
||||
|
||||
public boolean allowCaching() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -94,6 +118,26 @@ public abstract class Command {
|
|||
this.bypassHostMaintenance = bypassHostMaintenance;
|
||||
}
|
||||
|
||||
public boolean isReconcile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getRequestSequence() {
|
||||
return requestSequence;
|
||||
}
|
||||
|
||||
public void setRequestSequence(long requestSequence) {
|
||||
this.requestSequence = requestSequence;
|
||||
}
|
||||
|
||||
public void setExternalDetails(Map<String, Map<String, String>> externalDetails) {
|
||||
this.externalDetails = externalDetails;
|
||||
}
|
||||
|
||||
public Map<String, Map<String, String>> getExternalDetails() {
|
||||
return externalDetails;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,24 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import org.apache.cloudstack.gpu.GpuDevice;
|
||||
|
||||
public class VgpuTypesInfo {
|
||||
|
||||
private boolean passthroughEnabled = true;
|
||||
private GpuDevice.DeviceType deviceType;
|
||||
private String parentBusAddress;
|
||||
private String busAddress;
|
||||
private String numaNode;
|
||||
private String pciRoot;
|
||||
private String deviceId;
|
||||
private String deviceName;
|
||||
private String vendorId;
|
||||
private String vendorName;
|
||||
private String modelName;
|
||||
private String groupName;
|
||||
private String vmName;
|
||||
private Long maxHeads;
|
||||
private Long videoRam;
|
||||
private Long maxResolutionX;
|
||||
|
|
@ -26,6 +40,7 @@ public class VgpuTypesInfo {
|
|||
private Long maxVgpuPerGpu;
|
||||
private Long remainingCapacity;
|
||||
private Long maxCapacity;
|
||||
private boolean display = false;
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
|
|
@ -39,22 +54,42 @@ public class VgpuTypesInfo {
|
|||
return videoRam;
|
||||
}
|
||||
|
||||
public void setVideoRam(Long videoRam) {
|
||||
this.videoRam = videoRam;
|
||||
}
|
||||
|
||||
public Long getMaxHeads() {
|
||||
return maxHeads;
|
||||
}
|
||||
|
||||
public void setMaxHeads(Long maxHeads) {
|
||||
this.maxHeads = maxHeads;
|
||||
}
|
||||
|
||||
public Long getMaxResolutionX() {
|
||||
return maxResolutionX;
|
||||
}
|
||||
|
||||
public void setMaxResolutionX(Long maxResolutionX) {
|
||||
this.maxResolutionX = maxResolutionX;
|
||||
}
|
||||
|
||||
public Long getMaxResolutionY() {
|
||||
return maxResolutionY;
|
||||
}
|
||||
|
||||
public void setMaxResolutionY(Long maxResolutionY) {
|
||||
this.maxResolutionY = maxResolutionY;
|
||||
}
|
||||
|
||||
public Long getMaxVpuPerGpu() {
|
||||
return maxVgpuPerGpu;
|
||||
}
|
||||
|
||||
public void setMaxVgpuPerGpu(Long maxVgpuPerGpu) {
|
||||
this.maxVgpuPerGpu = maxVgpuPerGpu;
|
||||
}
|
||||
|
||||
public Long getRemainingCapacity() {
|
||||
return remainingCapacity;
|
||||
}
|
||||
|
|
@ -71,8 +106,133 @@ public class VgpuTypesInfo {
|
|||
this.maxCapacity = maxCapacity;
|
||||
}
|
||||
|
||||
public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY, Long maxVgpuPerGpu,
|
||||
Long remainingCapacity, Long maxCapacity) {
|
||||
public boolean isPassthroughEnabled() {
|
||||
return passthroughEnabled;
|
||||
}
|
||||
|
||||
public void setPassthroughEnabled(boolean passthroughEnabled) {
|
||||
this.passthroughEnabled = passthroughEnabled;
|
||||
}
|
||||
|
||||
public GpuDevice.DeviceType getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setDeviceType(GpuDevice.DeviceType deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public String getParentBusAddress() {
|
||||
return parentBusAddress;
|
||||
}
|
||||
|
||||
public void setParentBusAddress(String parentBusAddress) {
|
||||
this.parentBusAddress = parentBusAddress;
|
||||
}
|
||||
|
||||
public String getBusAddress() {
|
||||
return busAddress;
|
||||
}
|
||||
|
||||
public void setBusAddress(String busAddress) {
|
||||
this.busAddress = busAddress;
|
||||
}
|
||||
|
||||
public String getNumaNode() {
|
||||
return numaNode;
|
||||
}
|
||||
|
||||
public void setNumaNode(String numaNode) {
|
||||
this.numaNode = numaNode;
|
||||
}
|
||||
|
||||
public String getPciRoot() {
|
||||
return pciRoot;
|
||||
}
|
||||
|
||||
public void setPciRoot(String pciRoot) {
|
||||
this.pciRoot = pciRoot;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getVendorId() {
|
||||
return vendorId;
|
||||
}
|
||||
|
||||
public void setVendorId(String vendorId) {
|
||||
this.vendorId = vendorId;
|
||||
}
|
||||
|
||||
public String getVendorName() {
|
||||
return vendorName;
|
||||
}
|
||||
|
||||
public void setVendorName(String vendorName) {
|
||||
this.vendorName = vendorName;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public void setVmName(String vmName) {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
|
||||
public boolean isDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(boolean display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress,
|
||||
String vendorId, String vendorName, String deviceId, String deviceName, String numaNode, String pciRoot
|
||||
) {
|
||||
this.deviceType = deviceType;
|
||||
this.groupName = groupName;
|
||||
this.modelName = modelName;
|
||||
this.busAddress = busAddress;
|
||||
this.deviceId = deviceId;
|
||||
this.deviceName = deviceName;
|
||||
this.vendorId = vendorId;
|
||||
this.vendorName = vendorName;
|
||||
this.numaNode = numaNode;
|
||||
this.pciRoot = pciRoot;
|
||||
}
|
||||
|
||||
public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress,
|
||||
String vendorId, String vendorName, String deviceId, String deviceName
|
||||
) {
|
||||
this.deviceType = deviceType;
|
||||
this.groupName = groupName;
|
||||
this.modelName = modelName;
|
||||
this.busAddress = busAddress;
|
||||
this.deviceId = deviceId;
|
||||
this.deviceName = deviceName;
|
||||
this.vendorId = vendorId;
|
||||
this.vendorName = vendorName;
|
||||
}
|
||||
|
||||
public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX,
|
||||
Long maxResolutionY, Long maxVgpuPerGpu, Long remainingCapacity, Long maxCapacity
|
||||
) {
|
||||
this.groupName = groupName;
|
||||
this.modelName = modelName;
|
||||
this.videoRam = videoRam;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DiskTO {
|
|||
private Long diskSeq;
|
||||
private String path;
|
||||
private Volume.Type type;
|
||||
private Map<String, String> _details;
|
||||
private Map<String, String> details;
|
||||
|
||||
public DiskTO() {
|
||||
|
||||
|
|
@ -92,10 +92,10 @@ public class DiskTO {
|
|||
}
|
||||
|
||||
public void setDetails(Map<String, String> details) {
|
||||
_details = details;
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return _details;
|
||||
return details;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class FirewallRuleTO implements InternalIdentity {
|
|||
int[] srcPortRange;
|
||||
boolean revoked;
|
||||
boolean alreadyAdded;
|
||||
private List<String> sourceCidrList;
|
||||
protected List<String> sourceCidrList;
|
||||
private List<String> destCidrList;
|
||||
FirewallRule.Purpose purpose;
|
||||
private Integer icmpType;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.agent.api.VgpuTypesInfo;
|
||||
|
||||
|
|
@ -24,9 +26,23 @@ public class GPUDeviceTO {
|
|||
|
||||
private String gpuGroup;
|
||||
private String vgpuType;
|
||||
private int gpuCount;
|
||||
private HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<String, HashMap<String, VgpuTypesInfo>>();
|
||||
private List<VgpuTypesInfo> gpuDevices = new ArrayList<>();
|
||||
|
||||
public GPUDeviceTO( String gpuGroup, String vgpuType, HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
|
||||
public GPUDeviceTO(String gpuGroup, String vgpuType, int gpuCount,
|
||||
HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails,
|
||||
List<VgpuTypesInfo> gpuDevices) {
|
||||
this.gpuGroup = gpuGroup;
|
||||
this.vgpuType = vgpuType;
|
||||
this.groupDetails = groupDetails;
|
||||
this.gpuCount = gpuCount;
|
||||
this.gpuDevices = gpuDevices;
|
||||
|
||||
}
|
||||
|
||||
public GPUDeviceTO(String gpuGroup, String vgpuType,
|
||||
HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails) {
|
||||
this.gpuGroup = gpuGroup;
|
||||
this.vgpuType = vgpuType;
|
||||
this.groupDetails = groupDetails;
|
||||
|
|
@ -48,6 +64,14 @@ public class GPUDeviceTO {
|
|||
this.vgpuType = vgpuType;
|
||||
}
|
||||
|
||||
public int getGpuCount() {
|
||||
return gpuCount;
|
||||
}
|
||||
|
||||
public void setGpuCount(int gpuCount) {
|
||||
this.gpuCount = gpuCount;
|
||||
}
|
||||
|
||||
public HashMap<String, HashMap<String, VgpuTypesInfo>> getGroupDetails() {
|
||||
return groupDetails;
|
||||
}
|
||||
|
|
@ -56,4 +80,11 @@ public class GPUDeviceTO {
|
|||
this.groupDetails = groupDetails;
|
||||
}
|
||||
|
||||
public List<VgpuTypesInfo> getGpuDevices() {
|
||||
return gpuDevices;
|
||||
}
|
||||
|
||||
public void setGpuDevices(List<VgpuTypesInfo> gpuDevices) {
|
||||
this.gpuDevices = gpuDevices;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class LoadBalancerTO {
|
|||
this.destinations = new DestinationTO[destinations.size()];
|
||||
this.stickinessPolicies = null;
|
||||
this.sslCert = null;
|
||||
this.lbProtocol = null;
|
||||
this.lbProtocol = protocol;
|
||||
int i = 0;
|
||||
for (LbDestination destination : destinations) {
|
||||
this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.isRevoked(), false);
|
||||
|
|
@ -205,6 +205,10 @@ public class LoadBalancerTO {
|
|||
return this.sslCert;
|
||||
}
|
||||
|
||||
public void setLbSslCert(LbSslCert sslCert) {
|
||||
this.sslCert = sslCert;
|
||||
}
|
||||
|
||||
public String getSrcIpVlan() {
|
||||
return srcIpVlan;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class NetworkTO {
|
|||
protected TrafficType type;
|
||||
protected URI broadcastUri;
|
||||
protected URI isolationUri;
|
||||
protected boolean isSecurityGroupEnabled;
|
||||
protected boolean securityGroupEnabled;
|
||||
protected String name;
|
||||
protected String ip6address;
|
||||
protected String ip6gateway;
|
||||
|
|
@ -112,7 +112,7 @@ public class NetworkTO {
|
|||
}
|
||||
|
||||
public void setSecurityGroupEnabled(boolean enabled) {
|
||||
this.isSecurityGroupEnabled = enabled;
|
||||
this.securityGroupEnabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -221,7 +221,7 @@ public class NetworkTO {
|
|||
}
|
||||
|
||||
public boolean isSecurityGroupEnabled() {
|
||||
return this.isSecurityGroupEnabled;
|
||||
return this.securityGroupEnabled;
|
||||
}
|
||||
|
||||
public void setIp6Dns1(String ip6Dns1) {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,14 @@ public class NicTO extends NetworkTO {
|
|||
this.nicUuid = uuid;
|
||||
}
|
||||
|
||||
public String getNicUuid() {
|
||||
return nicUuid;
|
||||
}
|
||||
|
||||
public void setNicUuid(String nicUuid) {
|
||||
this.nicUuid = nicUuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString();
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import com.cloud.network.rules.PortForwardingRule;
|
|||
import com.cloud.utils.net.NetUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* PortForwardingRuleTO specifies one port forwarding rule.
|
||||
*
|
||||
|
|
@ -32,8 +30,6 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
|
|||
String dstIp;
|
||||
int[] dstPortRange;
|
||||
|
||||
List<String> sourceCidrList;
|
||||
|
||||
protected PortForwardingRuleTO() {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class RemoteInstanceTO implements Serializable {
|
|||
|
||||
private Hypervisor.HypervisorType hypervisorType;
|
||||
private String instanceName;
|
||||
private String instancePath;
|
||||
|
||||
// VMware Remote Instances parameters (required for exporting OVA through ovftool)
|
||||
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
|
||||
|
|
@ -44,9 +45,10 @@ public class RemoteInstanceTO implements Serializable {
|
|||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public RemoteInstanceTO(String instanceName, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
|
||||
public RemoteInstanceTO(String instanceName, String instancePath, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
|
||||
this.hypervisorType = Hypervisor.HypervisorType.VMware;
|
||||
this.instanceName = instanceName;
|
||||
this.instancePath = instancePath;
|
||||
this.vcenterHost = vcenterHost;
|
||||
this.vcenterUsername = vcenterUsername;
|
||||
this.vcenterPassword = vcenterPassword;
|
||||
|
|
@ -61,6 +63,10 @@ public class RemoteInstanceTO implements Serializable {
|
|||
return this.instanceName;
|
||||
}
|
||||
|
||||
public String getInstancePath() {
|
||||
return this.instancePath;
|
||||
}
|
||||
|
||||
public String getVcenterUsername() {
|
||||
return vcenterUsername;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,20 +19,22 @@ package com.cloud.agent.api.to;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.cloud.agent.api.LogLevel;
|
||||
import com.cloud.network.element.NetworkElement;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
import com.cloud.vm.VmDetailConstants;
|
||||
|
||||
public class VirtualMachineTO {
|
||||
private long id;
|
||||
private String name;
|
||||
private BootloaderType bootloader;
|
||||
private VirtualMachine.State state;
|
||||
Type type;
|
||||
int cpus;
|
||||
private Type type;
|
||||
private int cpus;
|
||||
|
||||
/**
|
||||
'speed' is still here since 4.0.X/4.1.X management servers do not support
|
||||
|
|
@ -43,49 +45,50 @@ public class VirtualMachineTO {
|
|||
So this is here for backwards compatibility with 4.0.X/4.1.X management servers
|
||||
and newer agents.
|
||||
*/
|
||||
Integer speed;
|
||||
Integer minSpeed;
|
||||
Integer maxSpeed;
|
||||
private Integer speed;
|
||||
private Integer minSpeed;
|
||||
private Integer maxSpeed;
|
||||
|
||||
long minRam;
|
||||
long maxRam;
|
||||
String hostName;
|
||||
String arch;
|
||||
String os;
|
||||
String platformEmulator;
|
||||
String bootArgs;
|
||||
String[] bootupScripts;
|
||||
boolean enableHA;
|
||||
boolean limitCpuUse;
|
||||
boolean enableDynamicallyScaleVm;
|
||||
private long minRam;
|
||||
private long maxRam;
|
||||
private String hostName;
|
||||
private String arch;
|
||||
private String os;
|
||||
private String platformEmulator;
|
||||
private String bootArgs;
|
||||
private String[] bootupScripts;
|
||||
private boolean enableHA;
|
||||
private boolean limitCpuUse;
|
||||
private boolean enableDynamicallyScaleVm;
|
||||
@LogLevel(LogLevel.Log4jLevel.Off)
|
||||
String vncPassword;
|
||||
String vncAddr;
|
||||
Map<String, String> params;
|
||||
String uuid;
|
||||
String bootType;
|
||||
String bootMode;
|
||||
boolean enterHardwareSetup;
|
||||
private String vncPassword;
|
||||
private String vncAddr;
|
||||
private Map<String, String> details;
|
||||
private Map<String, String> params;
|
||||
private String uuid;
|
||||
private String bootType;
|
||||
private String bootMode;
|
||||
private boolean enterHardwareSetup;
|
||||
|
||||
DiskTO[] disks;
|
||||
NicTO[] nics;
|
||||
GPUDeviceTO gpuDevice;
|
||||
Integer vcpuMaxLimit;
|
||||
List<String[]> vmData = null;
|
||||
private DiskTO[] disks;
|
||||
private NicTO[] nics;
|
||||
private GPUDeviceTO gpuDevice;
|
||||
private Integer vcpuMaxLimit;
|
||||
private List<String[]> vmData = null;
|
||||
|
||||
String configDriveLabel = null;
|
||||
String configDriveIsoRootFolder = null;
|
||||
String configDriveIsoFile = null;
|
||||
NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
|
||||
private String configDriveLabel = null;
|
||||
private String configDriveIsoRootFolder = null;
|
||||
private String configDriveIsoFile = null;
|
||||
private NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
|
||||
|
||||
Double cpuQuotaPercentage = null;
|
||||
private Double cpuQuotaPercentage = null;
|
||||
|
||||
Map<String, String> guestOsDetails = new HashMap<String, String>();
|
||||
Map<String, String> extraConfig = new HashMap<>();
|
||||
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
|
||||
DeployAsIsInfoTO deployAsIsInfo;
|
||||
String metadataManufacturer;
|
||||
String metadataProductName;
|
||||
private Map<String, String> guestOsDetails = new HashMap<String, String>();
|
||||
private Map<String, String> extraConfig = new HashMap<>();
|
||||
private Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
|
||||
private DeployAsIsInfoTO deployAsIsInfo;
|
||||
private String metadataManufacturer;
|
||||
private String metadataProductName;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
|
||||
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
|
||||
|
|
@ -191,7 +194,11 @@ public class VirtualMachineTO {
|
|||
return maxSpeed;
|
||||
}
|
||||
|
||||
public boolean getLimitCpuUse() {
|
||||
public boolean isEnableHA() {
|
||||
return enableHA;
|
||||
}
|
||||
|
||||
public boolean isLimitCpuUse() {
|
||||
return limitCpuUse;
|
||||
}
|
||||
|
||||
|
|
@ -256,6 +263,10 @@ public class VirtualMachineTO {
|
|||
this.bootupScripts = bootupScripts;
|
||||
}
|
||||
|
||||
public void setEnableHA(boolean enableHA) {
|
||||
this.enableHA = enableHA;
|
||||
}
|
||||
|
||||
public DiskTO[] getDisks() {
|
||||
return disks;
|
||||
}
|
||||
|
|
@ -289,11 +300,11 @@ public class VirtualMachineTO {
|
|||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return params;
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(Map<String, String> params) {
|
||||
this.params = params;
|
||||
this.details = params;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
|
|
@ -431,6 +442,42 @@ public class VirtualMachineTO {
|
|||
this.deployAsIsInfo = deployAsIsInfo;
|
||||
}
|
||||
|
||||
public void setSpeed(Integer speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public void setMinSpeed(Integer minSpeed) {
|
||||
this.minSpeed = minSpeed;
|
||||
}
|
||||
|
||||
public void setMaxSpeed(Integer maxSpeed) {
|
||||
this.maxSpeed = maxSpeed;
|
||||
}
|
||||
|
||||
public void setMinRam(long minRam) {
|
||||
this.minRam = minRam;
|
||||
}
|
||||
|
||||
public void setMaxRam(long maxRam) {
|
||||
this.maxRam = maxRam;
|
||||
}
|
||||
|
||||
public void setLimitCpuUse(boolean limitCpuUse) {
|
||||
this.limitCpuUse = limitCpuUse;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public void setExtraConfig(Map<String, String> extraConfig) {
|
||||
this.extraConfig = extraConfig;
|
||||
}
|
||||
|
||||
public String getMetadataManufacturer() {
|
||||
return metadataManufacturer;
|
||||
}
|
||||
|
|
@ -451,4 +498,16 @@ public class VirtualMachineTO {
|
|||
public String toString() {
|
||||
return String.format("VM {id: \"%s\", name: \"%s\", uuid: \"%s\", type: \"%s\"}", id, name, uuid, type);
|
||||
}
|
||||
|
||||
public Map<String, String> getExternalDetails() {
|
||||
if (details == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return details.entrySet().stream()
|
||||
.filter(entry -> entry.getKey().startsWith(VmDetailConstants.EXTERNAL_DETAIL_PREFIX))
|
||||
.collect(Collectors.toMap(
|
||||
entry -> entry.getKey().substring(VmDetailConstants.EXTERNAL_DETAIL_PREFIX.length()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,13 +34,17 @@ public interface Capacity extends InternalIdentity, Identity {
|
|||
public static final short CAPACITY_TYPE_LOCAL_STORAGE = 9;
|
||||
public static final short CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = 10;
|
||||
public static final short CAPACITY_TYPE_GPU = 19;
|
||||
public static final short CAPACITY_TYPE_OBJECT_STORAGE = 20;
|
||||
public static final short CAPACITY_TYPE_BACKUP_STORAGE = 21;
|
||||
|
||||
public static final short CAPACITY_TYPE_CPU_CORE = 90;
|
||||
|
||||
public static final List<Short> STORAGE_CAPACITY_TYPES = List.of(CAPACITY_TYPE_STORAGE,
|
||||
CAPACITY_TYPE_STORAGE_ALLOCATED,
|
||||
CAPACITY_TYPE_SECONDARY_STORAGE,
|
||||
CAPACITY_TYPE_LOCAL_STORAGE);
|
||||
CAPACITY_TYPE_LOCAL_STORAGE,
|
||||
CAPACITY_TYPE_BACKUP_STORAGE,
|
||||
CAPACITY_TYPE_OBJECT_STORAGE);
|
||||
|
||||
public Long getHostOrPoolId();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@
|
|||
package com.cloud.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.command.admin.config.ResetCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateGuestNetworkIpv6PrefixCmd;
|
||||
|
|
@ -201,11 +205,12 @@ public interface ConfigurationService {
|
|||
* TODO
|
||||
* @param allocationState
|
||||
* TODO
|
||||
* @param storageAccessGroups
|
||||
* @return the new pod if successful, null otherwise
|
||||
* @throws
|
||||
* @throws
|
||||
*/
|
||||
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState);
|
||||
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List<String> storageAccessGroups);
|
||||
|
||||
/**
|
||||
* Creates a mutual exclusive IP range in the pod with same gateway, netmask.
|
||||
|
|
@ -372,4 +377,16 @@ public interface ConfigurationService {
|
|||
List<? extends PortableIp> listPortableIps(long id);
|
||||
|
||||
Boolean isAccountAllowedToCreateOfferingsWithTags(IsAccountAllowedToCreateOfferingsWithTagsCmd cmd);
|
||||
|
||||
public static final Map<String, String> ProviderDetailKeyMap = Map.of(
|
||||
Network.Provider.Nsx.getName(), ApiConstants.NSX_DETAIL_KEY,
|
||||
Network.Provider.Netris.getName(), ApiConstants.NETRIS_DETAIL_KEY
|
||||
);
|
||||
|
||||
public static boolean IsIpRangeForProvider(Network.Provider provider) {
|
||||
if (Objects.isNull(provider)) {
|
||||
return false;
|
||||
}
|
||||
return ProviderDetailKeyMap.containsKey(provider.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ public interface Resource {
|
|||
backup("backup", 12),
|
||||
backup_storage("backup_storage", 13),
|
||||
bucket("bucket", 14),
|
||||
object_storage("object_storage", 15);
|
||||
object_storage("object_storage", 15),
|
||||
gpu("gpu", 16);
|
||||
|
||||
private String name;
|
||||
private int ordinal;
|
||||
|
|
|
|||
|
|
@ -16,52 +16,55 @@
|
|||
// under the License.
|
||||
package com.cloud.cpu;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CPU {
|
||||
public enum CPUArch {
|
||||
x86("i686", 32),
|
||||
amd64("x86_64", 64),
|
||||
arm64("aarch64", 64);
|
||||
|
||||
public static final String archX86Identifier = "i686";
|
||||
public static final String archX86_64Identifier = "x86_64";
|
||||
public static final String archARM64Identifier = "aarch64";
|
||||
private final String type;
|
||||
private final int bits;
|
||||
|
||||
public static class CPUArch {
|
||||
private static final Map<String, CPUArch> cpuArchMap = new LinkedHashMap<>();
|
||||
|
||||
public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32);
|
||||
public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64);
|
||||
public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64);
|
||||
|
||||
private String type;
|
||||
private int bits;
|
||||
|
||||
public CPUArch(String type, int bits) {
|
||||
CPUArch(String type, int bits) {
|
||||
this.type = type;
|
||||
this.bits = bits;
|
||||
cpuArchMap.put(type, this);
|
||||
}
|
||||
|
||||
public static CPUArch getDefault() {
|
||||
return amd64;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getBits() {
|
||||
return this.bits;
|
||||
return bits;
|
||||
}
|
||||
|
||||
public static CPUArch fromType(String type) {
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return amd64;
|
||||
return getDefault();
|
||||
}
|
||||
switch (type) {
|
||||
case archX86Identifier: return archX86;
|
||||
case archX86_64Identifier: return amd64;
|
||||
case archARM64Identifier: return arm64;
|
||||
default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type));
|
||||
for (CPUArch arch : values()) {
|
||||
if (arch.type.equals(type)) {
|
||||
return arch;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unsupported arch type: " + type);
|
||||
}
|
||||
|
||||
public static String getTypesAsCSV() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (CPUArch arch : values()) {
|
||||
sb.append(arch.getType()).append(",");
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.setLength(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,6 @@ public interface Pod extends InfrastructureEntity, Grouping, Identity, InternalI
|
|||
AllocationState getAllocationState();
|
||||
|
||||
boolean getExternalDhcp();
|
||||
|
||||
String getStorageAccessGroups();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
|||
"vm.allocation.algorithm",
|
||||
"Advanced",
|
||||
"random",
|
||||
"Order in which hosts within a cluster will be considered for VM/volume allocation. The value can be 'random', 'firstfit', 'userdispersing', 'userconcentratedpod_random', 'userconcentratedpod_firstfit', or 'firstfitleastconsumed'.",
|
||||
"Order in which hosts within a cluster will be considered for VM allocation. The value can be 'random', 'firstfit', 'userdispersing', 'userconcentratedpod_random', 'userconcentratedpod_firstfit', or 'firstfitleastconsumed'.",
|
||||
true,
|
||||
ConfigKey.Scope.Global, null, null, null, null, null,
|
||||
ConfigKey.Kind.Select,
|
||||
|
|
|
|||
|
|
@ -29,13 +29,18 @@ import org.apache.cloudstack.api.response.PodResponse;
|
|||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.config.Configuration;
|
||||
import org.apache.cloudstack.datacenter.DataCenterIpv4GuestSubnet;
|
||||
import org.apache.cloudstack.extension.Extension;
|
||||
import org.apache.cloudstack.extension.ExtensionCustomAction;
|
||||
import org.apache.cloudstack.gpu.GpuCard;
|
||||
import org.apache.cloudstack.gpu.GpuDevice;
|
||||
import org.apache.cloudstack.gpu.VgpuProfile;
|
||||
import org.apache.cloudstack.ha.HAConfig;
|
||||
import org.apache.cloudstack.network.BgpPeer;
|
||||
import org.apache.cloudstack.network.Ipv4GuestSubnetNetworkMap;
|
||||
import org.apache.cloudstack.quota.QuotaTariff;
|
||||
import org.apache.cloudstack.storage.sharedfs.SharedFS;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.cloudstack.storage.sharedfs.SharedFS;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
import org.apache.cloudstack.vm.schedule.VMSchedule;
|
||||
|
||||
|
|
@ -289,6 +294,8 @@ public class EventTypes {
|
|||
|
||||
//registering userdata events
|
||||
public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA";
|
||||
public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG";
|
||||
public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG";
|
||||
|
||||
//register for user API and secret keys
|
||||
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
|
||||
|
|
@ -374,6 +381,21 @@ public class EventTypes {
|
|||
public static final String EVENT_DISK_OFFERING_EDIT = "DISK.OFFERING.EDIT";
|
||||
public static final String EVENT_DISK_OFFERING_DELETE = "DISK.OFFERING.DELETE";
|
||||
|
||||
// GPU Cards
|
||||
public static final String EVENT_GPU_CARD_CREATE = "GPU.CARD.CREATE";
|
||||
public static final String EVENT_GPU_CARD_EDIT = "GPU.CARD.EDIT";
|
||||
public static final String EVENT_GPU_CARD_DELETE = "GPU.CARD.DELETE";
|
||||
|
||||
// vGPU Profile
|
||||
public static final String EVENT_VGPU_PROFILE_CREATE = "VGPU.PROFILE.CREATE";
|
||||
public static final String EVENT_VGPU_PROFILE_EDIT = "VGPU.PROFILE.EDIT";
|
||||
public static final String EVENT_VGPU_PROFILE_DELETE = "VGPU.PROFILE.DELETE";
|
||||
|
||||
// GPU Devices
|
||||
public static final String EVENT_GPU_DEVICE_CREATE = "GPU.DEVICE.CREATE";
|
||||
public static final String EVENT_GPU_DEVICE_EDIT = "GPU.DEVICE.EDIT";
|
||||
public static final String EVENT_GPU_DEVICE_DELETE = "GPU.DEVICE.DELETE";
|
||||
|
||||
// Network offerings
|
||||
public static final String EVENT_NETWORK_OFFERING_CREATE = "NETWORK.OFFERING.CREATE";
|
||||
public static final String EVENT_NETWORK_OFFERING_ASSIGN = "NETWORK.OFFERING.ASSIGN";
|
||||
|
|
@ -465,6 +487,7 @@ public class EventTypes {
|
|||
public static final String EVENT_ENABLE_PRIMARY_STORAGE = "ENABLE.PS";
|
||||
public static final String EVENT_DISABLE_PRIMARY_STORAGE = "DISABLE.PS";
|
||||
public static final String EVENT_SYNC_STORAGE_POOL = "SYNC.STORAGE.POOL";
|
||||
public static final String EVENT_CONFIGURE_STORAGE_ACCESS = "CONFIGURE.STORAGE.ACCESS";
|
||||
public static final String EVENT_CHANGE_STORAGE_POOL_SCOPE = "CHANGE.STORAGE.POOL.SCOPE";
|
||||
|
||||
// VPN
|
||||
|
|
@ -496,6 +519,8 @@ public class EventTypes {
|
|||
|
||||
public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE";
|
||||
public static final String EVENT_ZONE_VXLAN_ASSIGN = "ZONE.VXLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VXLAN_RELEASE = "ZONE.VXLAN.RELEASE";
|
||||
|
||||
// Projects
|
||||
public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE";
|
||||
|
|
@ -607,11 +632,13 @@ public class EventTypes {
|
|||
public static final String EVENT_VM_BACKUP_CREATE = "BACKUP.CREATE";
|
||||
public static final String EVENT_VM_BACKUP_RESTORE = "BACKUP.RESTORE";
|
||||
public static final String EVENT_VM_BACKUP_DELETE = "BACKUP.DELETE";
|
||||
public static final String EVENT_VM_BACKUP_OFFERING_REMOVED_AND_BACKUPS_DELETED = "BACKUP.OFFERING.BACKUPS.DEL";
|
||||
public static final String EVENT_VM_BACKUP_RESTORE_VOLUME_TO_VM = "BACKUP.RESTORE.VOLUME.TO.VM";
|
||||
public static final String EVENT_VM_BACKUP_SCHEDULE_CONFIGURE = "BACKUP.SCHEDULE.CONFIGURE";
|
||||
public static final String EVENT_VM_BACKUP_SCHEDULE_DELETE = "BACKUP.SCHEDULE.DELETE";
|
||||
public static final String EVENT_VM_BACKUP_USAGE_METRIC = "BACKUP.USAGE.METRIC";
|
||||
public static final String EVENT_VM_BACKUP_EDIT = "BACKUP.OFFERING.EDIT";
|
||||
public static final String EVENT_VM_CREATE_FROM_BACKUP = "VM.CREATE.FROM.BACKUP";
|
||||
|
||||
// external network device events
|
||||
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD";
|
||||
|
|
@ -687,6 +714,9 @@ public class EventTypes {
|
|||
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE";
|
||||
|
||||
//Guest OS related events
|
||||
public static final String EVENT_GUEST_OS_CATEGORY_ADD = "GUEST.OS.CATEGORY.ADD";
|
||||
public static final String EVENT_GUEST_OS_CATEGORY_DELETE = "GUEST.OS.CATEGORY.DELETE";
|
||||
public static final String EVENT_GUEST_OS_CATEGORY_UPDATE = "GUEST.OS.CATEGORY.UPDATE";
|
||||
public static final String EVENT_GUEST_OS_ADD = "GUEST.OS.ADD";
|
||||
public static final String EVENT_GUEST_OS_REMOVE = "GUEST.OS.REMOVE";
|
||||
public static final String EVENT_GUEST_OS_UPDATE = "GUEST.OS.UPDATE";
|
||||
|
|
@ -739,6 +769,13 @@ public class EventTypes {
|
|||
//Purge resources
|
||||
public static final String EVENT_PURGE_EXPUNGED_RESOURCES = "PURGE.EXPUNGED.RESOURCES";
|
||||
|
||||
// Management Server
|
||||
public static final String EVENT_MS_MAINTENANCE_PREPARE = "MS.MAINTENANCE.PREPARE";
|
||||
public static final String EVENT_MS_MAINTENANCE_CANCEL = "MS.MAINTENANCE.CANCEL";
|
||||
public static final String EVENT_MS_SHUTDOWN_PREPARE = "MS.SHUTDOWN.PREPARE";
|
||||
public static final String EVENT_MS_SHUTDOWN_CANCEL = "MS.SHUTDOWN.CANCEL";
|
||||
public static final String EVENT_MS_SHUTDOWN = "MS.SHUTDOWN";
|
||||
|
||||
// OBJECT STORE
|
||||
public static final String EVENT_OBJECT_STORE_CREATE = "OBJECT.STORE.CREATE";
|
||||
public static final String EVENT_OBJECT_STORE_DELETE = "OBJECT.STORE.DELETE";
|
||||
|
|
@ -788,6 +825,33 @@ public class EventTypes {
|
|||
// Resource Limit
|
||||
public static final String EVENT_RESOURCE_LIMIT_UPDATE = "RESOURCE.LIMIT.UPDATE";
|
||||
|
||||
// Management Server
|
||||
public static final String EVENT_MANAGEMENT_SERVER_REMOVE = "MANAGEMENT.SERVER.REMOVE";
|
||||
|
||||
// VM Lease
|
||||
public static final String VM_LEASE_EXPIRED = "VM.LEASE.EXPIRED";
|
||||
public static final String VM_LEASE_DISABLED = "VM.LEASE.DISABLED";
|
||||
public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED";
|
||||
public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING";
|
||||
|
||||
// GUI Theme
|
||||
public static final String EVENT_GUI_THEME_CREATE = "GUI.THEME.CREATE";
|
||||
public static final String EVENT_GUI_THEME_REMOVE = "GUI.THEME.REMOVE";
|
||||
public static final String EVENT_GUI_THEME_UPDATE = "GUI.THEME.UPDATE";
|
||||
|
||||
// Extension
|
||||
public static final String EVENT_EXTENSION_CREATE = "EXTENSION.CREATE";
|
||||
public static final String EVENT_EXTENSION_UPDATE = "EXTENSION.UPDATE";
|
||||
public static final String EVENT_EXTENSION_DELETE = "EXTENSION.DELETE";
|
||||
public static final String EVENT_EXTENSION_RESOURCE_REGISTER = "EXTENSION.RESOURCE.REGISTER";
|
||||
public static final String EVENT_EXTENSION_RESOURCE_UNREGISTER = "EXTENSION.RESOURCE.UNREGISTER";
|
||||
public static final String EVENT_EXTENSION_CUSTOM_ACTION_ADD = "EXTENSION.CUSTOM.ACTION.ADD";
|
||||
public static final String EVENT_EXTENSION_CUSTOM_ACTION_UPDATE = "EXTENSION.CUSTOM.ACTION.UPDATE";
|
||||
public static final String EVENT_EXTENSION_CUSTOM_ACTION_DELETE = "EXTENSION.CUSTOM.ACTION.DELETE";
|
||||
|
||||
// Custom Action
|
||||
public static final String EVENT_CUSTOM_ACTION = "CUSTOM.ACTION";
|
||||
|
||||
static {
|
||||
|
||||
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
|
||||
|
|
@ -982,6 +1046,21 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class);
|
||||
entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class);
|
||||
|
||||
// GPU Cards
|
||||
entityEventDetails.put(EVENT_GPU_CARD_CREATE, GpuCard.class);
|
||||
entityEventDetails.put(EVENT_GPU_CARD_EDIT, GpuCard.class);
|
||||
entityEventDetails.put(EVENT_GPU_CARD_DELETE, GpuCard.class);
|
||||
|
||||
// vGPU Profiles
|
||||
entityEventDetails.put(EVENT_VGPU_PROFILE_CREATE, VgpuProfile.class);
|
||||
entityEventDetails.put(EVENT_VGPU_PROFILE_EDIT, VgpuProfile.class);
|
||||
entityEventDetails.put(EVENT_VGPU_PROFILE_DELETE, VgpuProfile.class);
|
||||
|
||||
// GPU Devices
|
||||
entityEventDetails.put(EVENT_GPU_DEVICE_CREATE, GpuDevice.class);
|
||||
entityEventDetails.put(EVENT_GPU_DEVICE_EDIT, GpuDevice.class);
|
||||
entityEventDetails.put(EVENT_GPU_DEVICE_DELETE, GpuDevice.class);
|
||||
|
||||
// Network offerings
|
||||
entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class);
|
||||
entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class);
|
||||
|
|
@ -1233,6 +1312,12 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_UPDATE_IMAGE_STORE_ACCESS_STATE, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_LIVE_PATCH_SYSTEMVM, "SystemVMs");
|
||||
|
||||
entityEventDetails.put(EVENT_MS_MAINTENANCE_PREPARE, "ManagementServer");
|
||||
entityEventDetails.put(EVENT_MS_MAINTENANCE_CANCEL, "ManagementServer");
|
||||
entityEventDetails.put(EVENT_MS_SHUTDOWN_PREPARE, "ManagementServer");
|
||||
entityEventDetails.put(EVENT_MS_SHUTDOWN_CANCEL, "ManagementServer");
|
||||
entityEventDetails.put(EVENT_MS_SHUTDOWN, "ManagementServer");
|
||||
|
||||
//Object Store
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_CREATE, ObjectStore.class);
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_UPDATE, ObjectStore.class);
|
||||
|
|
@ -1276,6 +1361,30 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_SHAREDFS_DESTROY, SharedFS.class);
|
||||
entityEventDetails.put(EVENT_SHAREDFS_EXPUNGE, SharedFS.class);
|
||||
entityEventDetails.put(EVENT_SHAREDFS_RECOVER, SharedFS.class);
|
||||
|
||||
// Management Server
|
||||
entityEventDetails.put(EVENT_MANAGEMENT_SERVER_REMOVE, "ManagementServer");
|
||||
|
||||
// VM Lease
|
||||
entityEventDetails.put(VM_LEASE_EXPIRED, VirtualMachine.class);
|
||||
entityEventDetails.put(VM_LEASE_EXPIRING, VirtualMachine.class);
|
||||
entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class);
|
||||
entityEventDetails.put(VM_LEASE_CANCELLED, VirtualMachine.class);
|
||||
|
||||
// GUI theme
|
||||
entityEventDetails.put(EVENT_GUI_THEME_CREATE, "GuiTheme");
|
||||
entityEventDetails.put(EVENT_GUI_THEME_REMOVE, "GuiTheme");
|
||||
entityEventDetails.put(EVENT_GUI_THEME_UPDATE, "GuiTheme");
|
||||
|
||||
// Extension
|
||||
entityEventDetails.put(EVENT_EXTENSION_CREATE, Extension.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_UPDATE, Extension.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_DELETE, Extension.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_RESOURCE_REGISTER, Extension.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_RESOURCE_UNREGISTER, Extension.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_ADD, ExtensionCustomAction.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_UPDATE, ExtensionCustomAction.class);
|
||||
entityEventDetails.put(EVENT_EXTENSION_CUSTOM_ACTION_DELETE, ExtensionCustomAction.class);
|
||||
}
|
||||
|
||||
public static boolean isNetworkEvent(String eventType) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class OperationTimedoutException extends CloudException {
|
|||
boolean _isActive;
|
||||
|
||||
public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) {
|
||||
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time);
|
||||
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time + " secs");
|
||||
_agentId = agentId;
|
||||
_seqId = seqId;
|
||||
_time = time;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,12 @@ public interface Host extends StateObject<Status>, Identity, Partition, HAResour
|
|||
return strs;
|
||||
}
|
||||
}
|
||||
public static final String HOST_UEFI_ENABLE = "host.uefi.enable";
|
||||
public static final String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
|
||||
public static final String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
|
||||
|
||||
String HOST_UEFI_ENABLE = "host.uefi.enable";
|
||||
String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
|
||||
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
|
||||
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
|
||||
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
|
||||
|
||||
/**
|
||||
* @return name of the machine.
|
||||
|
|
@ -213,4 +216,6 @@ public interface Host extends StateObject<Status>, Identity, Partition, HAResour
|
|||
ResourceState getResourceState();
|
||||
|
||||
CPU.CPUArch getArch();
|
||||
|
||||
String getStorageAccessGroups();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,20 +31,22 @@ import java.util.stream.Collectors;
|
|||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate;
|
||||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.RootDiskSizeOverride;
|
||||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigration;
|
||||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigrationWithSnapshots;
|
||||
|
||||
public class Hypervisor {
|
||||
public static class HypervisorType {
|
||||
public enum Functionality {
|
||||
DirectDownloadTemplate,
|
||||
RootDiskSizeOverride,
|
||||
VmStorageMigration
|
||||
VmStorageMigration,
|
||||
VmStorageMigrationWithSnapshots
|
||||
}
|
||||
|
||||
private static final Map<String, HypervisorType> hypervisorTypeMap = new LinkedHashMap<>();
|
||||
public static final HypervisorType None = new HypervisorType("None"); //for storage hosts
|
||||
public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
|
||||
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2, EnumSet.of(DirectDownloadTemplate, RootDiskSizeOverride, VmStorageMigration));
|
||||
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
|
||||
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration, VmStorageMigrationWithSnapshots));
|
||||
public static final HypervisorType Hyperv = new HypervisorType("Hyperv");
|
||||
public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox");
|
||||
public static final HypervisorType Parralels = new HypervisorType("Parralels");
|
||||
|
|
@ -54,6 +56,7 @@ public class Hypervisor {
|
|||
public static final HypervisorType Ovm3 = new HypervisorType("Ovm3", ImageFormat.RAW);
|
||||
public static final HypervisorType LXC = new HypervisorType("LXC");
|
||||
public static final HypervisorType Custom = new HypervisorType("Custom", null, EnumSet.of(RootDiskSizeOverride));
|
||||
public static final HypervisorType External = new HypervisorType("External", null, EnumSet.of(RootDiskSizeOverride));
|
||||
public static final HypervisorType Any = new HypervisorType("Any"); /*If you don't care about the hypervisor type*/
|
||||
private final String name;
|
||||
private final ImageFormat imageFormat;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ public interface KubernetesCluster extends ControlledEntity, com.cloud.utils.fsm
|
|||
AutoscaleRequested,
|
||||
ScaleUpRequested,
|
||||
ScaleDownRequested,
|
||||
AddNodeRequested,
|
||||
RemoveNodeRequested,
|
||||
UpgradeRequested,
|
||||
OperationSucceeded,
|
||||
OperationFailed,
|
||||
|
|
@ -58,7 +60,10 @@ public interface KubernetesCluster extends ControlledEntity, com.cloud.utils.fsm
|
|||
Stopping("Resources for the Kubernetes cluster are being destroyed"),
|
||||
Stopped("All resources for the Kubernetes cluster are destroyed, Kubernetes cluster may still have ephemeral resource like persistent volumes provisioned"),
|
||||
Scaling("Transient state in which resources are either getting scaled up/down"),
|
||||
ScalingStoppedCluster("Transient state in which the service offerings of stopped clusters are getting scaled"),
|
||||
Upgrading("Transient state in which cluster is getting upgraded"),
|
||||
Importing("Transient state in which additional nodes are added as worker nodes to a cluster"),
|
||||
RemovingNodes("Transient state in which additional nodes are removed from a cluster"),
|
||||
Alert("State to represent Kubernetes clusters which are not in expected desired state (operationally in active control place, stopped cluster VM's etc)."),
|
||||
Recovering("State in which Kubernetes cluster is recovering from alert state"),
|
||||
Destroyed("End state of Kubernetes cluster in which all resources are destroyed, cluster will not be usable further"),
|
||||
|
|
@ -89,13 +94,27 @@ public interface KubernetesCluster extends ControlledEntity, com.cloud.utils.fsm
|
|||
s_fsm.addTransition(State.Running, Event.AutoscaleRequested, State.Scaling);
|
||||
s_fsm.addTransition(State.Running, Event.ScaleUpRequested, State.Scaling);
|
||||
s_fsm.addTransition(State.Running, Event.ScaleDownRequested, State.Scaling);
|
||||
s_fsm.addTransition(State.Stopped, Event.ScaleUpRequested, State.ScalingStoppedCluster);
|
||||
s_fsm.addTransition(State.Scaling, Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Scaling, Event.OperationFailed, State.Alert);
|
||||
s_fsm.addTransition(State.ScalingStoppedCluster, Event.OperationSucceeded, State.Stopped);
|
||||
s_fsm.addTransition(State.ScalingStoppedCluster, Event.OperationFailed, State.Alert);
|
||||
|
||||
s_fsm.addTransition(State.Running, Event.UpgradeRequested, State.Upgrading);
|
||||
s_fsm.addTransition(State.Upgrading, Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Upgrading, Event.OperationFailed, State.Alert);
|
||||
|
||||
s_fsm.addTransition(State.Running, Event.AddNodeRequested, State.Importing);
|
||||
s_fsm.addTransition(State.Alert, Event.AddNodeRequested, State.Importing);
|
||||
s_fsm.addTransition(State.Importing, Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Importing, Event.OperationFailed, State.Running);
|
||||
s_fsm.addTransition(State.Alert, Event.OperationSucceeded, State.Running);
|
||||
|
||||
s_fsm.addTransition(State.Running, Event.RemoveNodeRequested, State.RemovingNodes);
|
||||
s_fsm.addTransition(State.Alert, Event.RemoveNodeRequested, State.RemovingNodes);
|
||||
s_fsm.addTransition(State.RemovingNodes, Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.RemovingNodes, Event.OperationFailed, State.Running);
|
||||
|
||||
s_fsm.addTransition(State.Alert, Event.RecoveryRequested, State.Recovering);
|
||||
s_fsm.addTransition(State.Recovering, Event.OperationSucceeded, State.Running);
|
||||
s_fsm.addTransition(State.Recovering, Event.OperationFailed, State.Alert);
|
||||
|
|
@ -142,4 +161,13 @@ public interface KubernetesCluster extends ControlledEntity, com.cloud.utils.fsm
|
|||
Long getMaxSize();
|
||||
Long getSecurityGroupId();
|
||||
ClusterType getClusterType();
|
||||
Long getControlNodeServiceOfferingId();
|
||||
Long getWorkerNodeServiceOfferingId();
|
||||
Long getEtcdNodeServiceOfferingId();
|
||||
Long getControlNodeTemplateId();
|
||||
Long getWorkerNodeTemplateId();
|
||||
Long getEtcdNodeTemplateId();
|
||||
Long getEtcdNodeCount();
|
||||
Long getCniConfigId();
|
||||
String getCniConfigDetails();
|
||||
}
|
||||
|
|
@ -18,12 +18,23 @@ package com.cloud.kubernetes.cluster;
|
|||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
public interface KubernetesServiceHelper extends Adapter {
|
||||
|
||||
enum KubernetesClusterNodeType {
|
||||
CONTROL, WORKER, ETCD, DEFAULT
|
||||
}
|
||||
|
||||
ControlledEntity findByUuid(String uuid);
|
||||
ControlledEntity findByVmId(long vmId);
|
||||
void checkVmCanBeDestroyed(UserVm userVm);
|
||||
boolean isValidNodeType(String nodeType);
|
||||
Map<String, Long> getServiceOfferingNodeTypeMap(Map<String, Map<String, String>> serviceOfferingNodeTypeMap);
|
||||
Map<String, Long> getTemplateNodeTypeMap(Map<String, Map<String, String>> templateNodeTypeMap);
|
||||
void cleanupForAccount(Account account);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,4 +99,5 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
|
|||
|
||||
boolean isForSystemVms();
|
||||
|
||||
boolean isForRouter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
public static final Provider Tungsten = new Provider("Tungsten", false);
|
||||
|
||||
public static final Provider Nsx = new Provider("Nsx", false);
|
||||
public static final Provider Netris = new Provider("Netris", false);
|
||||
|
||||
private final String name;
|
||||
private final boolean isExternal;
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ public interface NetworkModel {
|
|||
|
||||
NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri);
|
||||
|
||||
NicProfile getNicProfile(VirtualMachine vm, Nic nic, DataCenter dataCenter);
|
||||
|
||||
Set<Long> getAvailableIps(Network network, String requestedIp);
|
||||
|
||||
String getDomainNetworkDomain(long domainId, long zoneId);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package com.cloud.network;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.command.admin.address.ReleasePodIpCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
|
||||
|
|
@ -39,13 +38,16 @@ import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd;
|
|||
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
|
||||
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.Network.IpAddresses;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
|
|
@ -57,7 +59,6 @@ import com.cloud.utils.Pair;
|
|||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
|
||||
/**
|
||||
* The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
|
||||
|
|
@ -268,4 +269,10 @@ public interface NetworkService {
|
|||
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
|
||||
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
|
||||
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
|
||||
|
||||
boolean handleCksIsoOnNetworkVirtualRouter(Long virtualRouterId, boolean mount) throws ResourceUnavailableException;
|
||||
|
||||
IpAddresses getIpAddressesFromIps(String ipAddress, String ip6Address, String macAddress);
|
||||
|
||||
String getNicVlanValueForExternalVm(NicTO nic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ public class Networks {
|
|||
UnDecided(null, null),
|
||||
OpenDaylight("opendaylight", String.class),
|
||||
TUNGSTEN("tf", String.class),
|
||||
NSX("nsx", String.class);
|
||||
NSX("nsx", String.class),
|
||||
Netris("netris", String.class);
|
||||
|
||||
private final String scheme;
|
||||
private final Class<?> type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,358 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SDNProviderNetworkRule {
|
||||
|
||||
protected long domainId;
|
||||
protected long accountId;
|
||||
protected long zoneId;
|
||||
protected Long networkResourceId;
|
||||
protected String networkResourceName;
|
||||
protected boolean isVpcResource;
|
||||
protected long vmId;
|
||||
protected long ruleId;
|
||||
protected String publicIp;
|
||||
protected String vmIp;
|
||||
protected String publicPort;
|
||||
protected String privatePort;
|
||||
protected String protocol;
|
||||
protected String algorithm;
|
||||
protected List<String> sourceCidrList;
|
||||
protected List<String> destinationCidrList;
|
||||
protected Integer icmpCode;
|
||||
|
||||
protected Integer icmpType;
|
||||
protected String trafficType;
|
||||
protected Network.Service service;
|
||||
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public void setDomainId(long domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkResourceId() {
|
||||
return networkResourceId;
|
||||
}
|
||||
|
||||
public void setNetworkResourceId(Long networkResourceId) {
|
||||
this.networkResourceId = networkResourceId;
|
||||
}
|
||||
|
||||
public String getNetworkResourceName() {
|
||||
return networkResourceName;
|
||||
}
|
||||
|
||||
public void setNetworkResourceName(String networkResourceName) {
|
||||
this.networkResourceName = networkResourceName;
|
||||
}
|
||||
|
||||
public boolean isVpcResource() {
|
||||
return isVpcResource;
|
||||
}
|
||||
|
||||
public void setVpcResource(boolean vpcResource) {
|
||||
isVpcResource = vpcResource;
|
||||
}
|
||||
|
||||
public long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public void setVmId(long vmId) {
|
||||
this.vmId = vmId;
|
||||
}
|
||||
|
||||
public long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
public void setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
}
|
||||
|
||||
public String getVmIp() {
|
||||
return vmIp;
|
||||
}
|
||||
|
||||
public void setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
}
|
||||
|
||||
public String getPublicPort() {
|
||||
return publicPort;
|
||||
}
|
||||
|
||||
public void setPublicPort(String publicPort) {
|
||||
this.publicPort = publicPort;
|
||||
}
|
||||
|
||||
public String getPrivatePort() {
|
||||
return privatePort;
|
||||
}
|
||||
|
||||
public void setPrivatePort(String privatePort) {
|
||||
this.privatePort = privatePort;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public Network.Service getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public void setService(Network.Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Integer getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
public void setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public List<String> getSourceCidrList() {
|
||||
return sourceCidrList;
|
||||
}
|
||||
|
||||
public void setSourceCidrList(List<String> sourceCidrList) {
|
||||
this.sourceCidrList = sourceCidrList;
|
||||
}
|
||||
|
||||
public List<String> getDestinationCidrList() {
|
||||
return destinationCidrList;
|
||||
}
|
||||
|
||||
public void setDestinationCidrList(List<String> destinationCidrList) {
|
||||
this.destinationCidrList = destinationCidrList;
|
||||
}
|
||||
|
||||
public String getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public void setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public long domainId;
|
||||
public long accountId;
|
||||
public long zoneId;
|
||||
public Long networkResourceId;
|
||||
public String networkResourceName;
|
||||
public boolean isVpcResource;
|
||||
public long vmId;
|
||||
|
||||
public long ruleId;
|
||||
public String publicIp;
|
||||
public String vmIp;
|
||||
public String publicPort;
|
||||
public String privatePort;
|
||||
public String protocol;
|
||||
public String algorithm;
|
||||
public List<String> sourceCidrList;
|
||||
public List<String> destinationCidrList;
|
||||
public String trafficType;
|
||||
public Integer icmpType;
|
||||
public Integer icmpCode;
|
||||
public Network.Service service;
|
||||
|
||||
public Builder() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
public Builder setDomainId(long domainId) {
|
||||
this.domainId = domainId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNetworkResourceId(Long networkResourceId) {
|
||||
this.networkResourceId = networkResourceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNetworkResourceName(String networkResourceName) {
|
||||
this.networkResourceName = networkResourceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVpcResource(boolean isVpcResource) {
|
||||
this.isVpcResource = isVpcResource;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setVmId(long vmId) {
|
||||
this.vmId = vmId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRuleId(long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPublicPort(String publicPort) {
|
||||
this.publicPort = publicPort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPrivatePort(String privatePort) {
|
||||
this.privatePort = privatePort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSourceCidrList(List<String> sourceCidrList) {
|
||||
this.sourceCidrList = sourceCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDestinationCidrList(List<String> destinationCidrList) {
|
||||
this.destinationCidrList = destinationCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setService(Network.Service service) {
|
||||
this.service = service;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SDNProviderNetworkRule build() {
|
||||
SDNProviderNetworkRule rule = new SDNProviderNetworkRule();
|
||||
rule.setDomainId(this.domainId);
|
||||
rule.setAccountId(this.accountId);
|
||||
rule.setZoneId(this.zoneId);
|
||||
rule.setNetworkResourceId(this.networkResourceId);
|
||||
rule.setNetworkResourceName(this.networkResourceName);
|
||||
rule.setVpcResource(this.isVpcResource);
|
||||
rule.setVmId(this.vmId);
|
||||
rule.setVmIp(this.vmIp);
|
||||
rule.setPublicIp(this.publicIp);
|
||||
rule.setPublicPort(this.publicPort);
|
||||
rule.setPrivatePort(this.privatePort);
|
||||
rule.setProtocol(this.protocol);
|
||||
rule.setRuleId(this.ruleId);
|
||||
rule.setAlgorithm(this.algorithm);
|
||||
rule.setIcmpType(this.icmpType);
|
||||
rule.setIcmpCode(this.icmpCode);
|
||||
rule.setSourceCidrList(this.sourceCidrList);
|
||||
rule.setDestinationCidrList(this.destinationCidrList);
|
||||
rule.setTrafficType(this.trafficType);
|
||||
rule.setService(service);
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||
|
||||
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable {
|
||||
enum State {
|
||||
Pending, Connecting, Connected, Disconnected, Error,
|
||||
Pending, Connecting, Connected, Disconnected, Error, Removed
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.cloud.deploy.DeployDestination;
|
|||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
|
|
@ -87,6 +88,14 @@ public interface NetworkElement extends Adapter {
|
|||
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Release IP from the network provider if reserved
|
||||
* @param ipAddress
|
||||
*/
|
||||
default boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The network is being shutdown.
|
||||
* @param network
|
||||
|
|
|
|||
|
|
@ -17,12 +17,40 @@
|
|||
package com.cloud.network.element;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
|
||||
public interface PortForwardingServiceProvider extends NetworkElement, IpDeployingRequester {
|
||||
|
||||
static String getPublicPortRange(PortForwardingRule rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePFPortRange(PortForwardingRule rule) {
|
||||
return rule.getDestinationPortStart() == rule.getDestinationPortEnd() ?
|
||||
String.valueOf(rule.getDestinationPortStart()) :
|
||||
String.valueOf(rule.getDestinationPortStart()).concat("-").concat(String.valueOf(rule.getDestinationPortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePortRange(FirewallRule rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePortRangeForACLRule(NetworkACLItem rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply rules
|
||||
* @param network
|
||||
|
|
|
|||
|
|
@ -55,4 +55,8 @@ public interface VpcProvider extends NetworkElement {
|
|||
boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
|
||||
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
|
||||
default boolean updateVpc(Vpc vpc, String previousVpcName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,4 +215,8 @@ public interface NetworkGuru extends Adapter {
|
|||
default boolean isSlaacV6Only() {
|
||||
return true;
|
||||
}
|
||||
|
||||
default boolean update(Network network, String prevNetworkName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public interface LoadBalancingRulesService {
|
|||
|
||||
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
|
||||
|
||||
boolean assignCertToLoadBalancer(long lbRuleId, Long certId);
|
||||
boolean assignCertToLoadBalancer(long lbRuleId, Long certId, boolean isForced);
|
||||
|
||||
boolean removeCertFromLoadBalancer(long lbRuleId);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,28 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.vmware.util;
|
||||
package com.cloud.network.netris;
|
||||
|
||||
import com.cloud.exception.CloudException;
|
||||
public class NetrisLbBackend {
|
||||
private long vmId;
|
||||
private String vmIp;
|
||||
private int port;
|
||||
|
||||
public class VmwareClientException extends CloudException {
|
||||
public VmwareClientException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
public NetrisLbBackend(long vmId, String vmIp, int port) {
|
||||
this.vmId = vmId;
|
||||
this.vmIp = vmIp;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public VmwareClientException(String msg) {
|
||||
super(msg);
|
||||
public long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
// TODO embed vmware classes in this one for use downstream
|
||||
public VmwareClientException(String msg, Exception embedded) {
|
||||
super(msg, embedded);
|
||||
|
||||
public String getVmIp() {
|
||||
return vmIp;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.netris;
|
||||
|
||||
import com.cloud.network.SDNProviderNetworkRule;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NetrisNetworkRule {
|
||||
public enum NetrisRuleAction {
|
||||
PERMIT, DENY
|
||||
}
|
||||
|
||||
private SDNProviderNetworkRule baseRule;
|
||||
private NetrisRuleAction aclAction;
|
||||
private List<NetrisLbBackend> lbBackends;
|
||||
private String lbRuleName;
|
||||
private String lbCidrList;
|
||||
private String reason;
|
||||
|
||||
public NetrisNetworkRule(Builder builder) {
|
||||
this.baseRule = builder.baseRule;
|
||||
this.aclAction = builder.aclAction;
|
||||
this.lbBackends = builder.lbBackends;
|
||||
this.reason = builder.reason;
|
||||
this.lbCidrList = builder.lbCidrList;
|
||||
this.lbRuleName = builder.lbRuleName;
|
||||
}
|
||||
|
||||
public NetrisRuleAction getAclAction() {
|
||||
return aclAction;
|
||||
}
|
||||
|
||||
public List<NetrisLbBackend> getLbBackends() {
|
||||
return lbBackends;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String getLbCidrList() {return lbCidrList; }
|
||||
|
||||
public String getLbRuleName() { return lbRuleName; }
|
||||
|
||||
public SDNProviderNetworkRule getBaseRule() {
|
||||
return baseRule;
|
||||
}
|
||||
|
||||
// Builder class extending the parent builder
|
||||
public static class Builder {
|
||||
private SDNProviderNetworkRule baseRule;
|
||||
private NetrisRuleAction aclAction;
|
||||
private List<NetrisLbBackend> lbBackends;
|
||||
private String reason;
|
||||
private String lbCidrList;
|
||||
private String lbRuleName;
|
||||
|
||||
public Builder baseRule(SDNProviderNetworkRule baseRule) {
|
||||
this.baseRule = baseRule;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder aclAction(NetrisRuleAction aclAction) {
|
||||
this.aclAction = aclAction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbBackends(List<NetrisLbBackend> lbBackends) {
|
||||
this.lbBackends = lbBackends;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder reason(String reason) {
|
||||
this.reason = reason;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbCidrList(String lbCidrList) {
|
||||
this.lbCidrList = lbCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbRuleName(String lbRuleName) {
|
||||
this.lbRuleName = lbRuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetrisNetworkRule build() {
|
||||
return new NetrisNetworkRule(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.netris;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface NetrisProvider extends InternalIdentity, Identity {
|
||||
long getZoneId();
|
||||
String getName();
|
||||
String getUrl();
|
||||
String getUsername();
|
||||
String getSiteName();
|
||||
String getTenantName();
|
||||
String getNetrisTag();
|
||||
}
|
||||
|
|
@ -0,0 +1,310 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.netris;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.SDNProviderNetworkRule;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface for Netris Services that provides methods to manage VPCs, networks,
|
||||
* NAT rules, network rules, and static routes in an SDN (Software Defined Networking) environment.
|
||||
*/
|
||||
|
||||
public interface NetrisService {
|
||||
|
||||
/**
|
||||
* Creates IPAM (IP Address Management) allocations for zone-level public ranges.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createIPAMAllocationsForZoneLevelPublicRanges(long zoneId);
|
||||
|
||||
/**
|
||||
* Creates a VPC (Virtual Private Cloud) resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param vpcName the name of the VPC
|
||||
* @param sourceNatEnabled true if source NAT is enabled
|
||||
* @param cidr the CIDR of the VPC
|
||||
* @param isVpcNetwork true if it is a VPC network
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled, String cidr, boolean isVpcNetwork);
|
||||
|
||||
/**
|
||||
* Updates an existing VPC resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param vpcName the new name of the VPC
|
||||
* @param previousVpcName the previous name of the VPC
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean updateVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, String previousVpcName);
|
||||
|
||||
/**
|
||||
* Deletes a VPC resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpc the VPC to delete
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteVpcResource(long zoneId, long accountId, long domainId, Vpc vpc);
|
||||
|
||||
/**
|
||||
* Creates a virtual network (vNet) resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param cidr the CIDR of the network
|
||||
* @param globalRouting true if global routing is enabled
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr, Boolean globalRouting);
|
||||
|
||||
/**
|
||||
* Updates an existing vNet resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the new name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param prevNetworkName the previous name of the network
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean updateVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String prevNetworkName);
|
||||
|
||||
/**
|
||||
* Deletes an existing vNet resource.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param cidr the CIDR of the network
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteVnetResource(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr);
|
||||
|
||||
/**
|
||||
* Creates a source NAT rule for a VPC or network.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param isForVpc true if the rule applies to a VPC
|
||||
* @param vpcCidr the VPC CIDR
|
||||
* @param sourceNatIp the source NAT IP
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createSnatRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, long networkId, boolean isForVpc, String vpcCidr, String sourceNatIp);
|
||||
|
||||
/**
|
||||
* Creates a port forwarding rule for a VPC or network.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param isForVpc true if the rule applies to a VPC
|
||||
* @param vpcCidr the VPC CIDR
|
||||
* @param networkRule the network rule to forward
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createPortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
|
||||
|
||||
/**
|
||||
* Deletes a port forwarding rule for a VPC or network.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param vpcName the name of the VPC
|
||||
* @param vpcId the ID of the VPC
|
||||
* @param networkName the name of the network
|
||||
* @param networkId the ID of the network
|
||||
* @param isForVpc true if the rule applies to a VPC
|
||||
* @param vpcCidr the VPC CIDR
|
||||
* @param networkRule the network rule to remove
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deletePortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
|
||||
|
||||
/**
|
||||
* Updates the source NAT IP for a specified VPC.
|
||||
*
|
||||
* @param vpc the VPC to updates
|
||||
* @param address the new source NAT IP address
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
|
||||
/**
|
||||
* Creates a static NAT rule for a specific VM.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param networkResourceName the name of the network resource
|
||||
* @param networkResourceId the ID of the network resource
|
||||
* @param isForVpc true if the rule applies to a VPC
|
||||
* @param vpcCidr the VPC CIDR
|
||||
* @param staticNatIp the static NAT IP
|
||||
* @param vmIp the VM's IP address
|
||||
* @param vmId the ID of the VM
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String vpcCidr, String staticNatIp, String vmIp, long vmId);
|
||||
|
||||
/**
|
||||
* Deletes a static NAT rule for a specific VM.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param networkResourceName the name of the network resource
|
||||
* @param networkResourceId the ID of the network resource
|
||||
* @param isForVpc true if the rule applies to a VPC
|
||||
* @param staticNatIp the static NAT IP
|
||||
* @param vmId the ID of the VM
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String staticNatIp, long vmId);
|
||||
|
||||
/**
|
||||
* Adds firewall rules to a specific network.
|
||||
*
|
||||
* @param network the target network
|
||||
* @param firewallRules the list of firewall rules to add
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean addFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
|
||||
|
||||
/**
|
||||
* Deletes firewall rules from a specific network.
|
||||
*
|
||||
* @param network the target network
|
||||
* @param firewallRules the list of firewall rules to delete
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
|
||||
|
||||
/**
|
||||
* Adds or updates a static route for a specific network or VPC.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param networkResourceName the name of the network resource
|
||||
* @param networkResourceId the ID of the network resource
|
||||
* @param isForVpc true if it is for a VPC
|
||||
* @param prefix the IP prefix of the route
|
||||
* @param nextHop the next hop address
|
||||
* @param routeId the ID of the route
|
||||
* @param updateRoute true if the route should be updated
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean addOrUpdateStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId, boolean updateRoute);
|
||||
|
||||
/**
|
||||
* Deletes a specific static route for a network or VPC.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param networkResourceName the name of the network resource
|
||||
* @param networkResourceId the ID of the network resource
|
||||
* @param isForVpc true if it is for a VPC
|
||||
* @param prefix the IP prefix of the route
|
||||
* @param nextHop the next hop address
|
||||
* @param routeId the ID of the route
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
|
||||
|
||||
/**
|
||||
* Lists static routes for a specific network or VPC.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param accountId the ID of the account
|
||||
* @param domainId the ID of the domain
|
||||
* @param networkResourceName the name of the network resource
|
||||
* @param networkResourceId the ID of the network resource
|
||||
* @param isForVpc true if it is for a VPC
|
||||
* @param prefix the IP prefix of the route
|
||||
* @param nextHop the next hop address
|
||||
* @param routeId the ID of the route
|
||||
* @return a list of static routes
|
||||
*/
|
||||
List<StaticRoute> listStaticRoutes(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
|
||||
|
||||
/**
|
||||
* Releases a NAT IP address.
|
||||
*
|
||||
* @param zoneId the ID of the zone
|
||||
* @param publicIp the public NAT IP to release
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean releaseNatIp(long zoneId, String publicIp);
|
||||
|
||||
/**
|
||||
* Creates or updates a load balancer (LB) rule.
|
||||
*
|
||||
* @param rule the network rule for the load balancer
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean createOrUpdateLbRule(NetrisNetworkRule rule);
|
||||
|
||||
/**
|
||||
* Deletes a load balancer (LB) rule.
|
||||
*
|
||||
* @param rule the network rule to delete
|
||||
* @return true if the operation is successful, false otherwise
|
||||
*/
|
||||
boolean deleteLbRule(NetrisNetworkRule rule);
|
||||
}
|
||||
|
|
@ -16,9 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.network.nsx;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
public interface NsxService {
|
||||
|
||||
|
|
@ -33,4 +34,5 @@ public interface NsxService {
|
|||
|
||||
boolean createVpcNetwork(Long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled);
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
String getSegmentId(long domainId, long accountId, long zoneId, Long vpcId, long networkId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
|
|||
Staged, // route been created but has never got through network rule conflict detection. Routes in this state can not be sent to VPC virtual router.
|
||||
Add, // Add means the route has been created and has gone through network rule conflict detection.
|
||||
Active, // Route has been sent to the VPC router and reported to be active.
|
||||
Update,
|
||||
Revoke, // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database.
|
||||
Deleting // rule has been revoked and is scheduled for deletion
|
||||
}
|
||||
|
|
@ -32,7 +33,9 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
long getVpcGatewayId();
|
||||
Long getVpcGatewayId();
|
||||
|
||||
String getNextHop();
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
private String targetCidr;
|
||||
private long accountId;
|
||||
private long domainId;
|
||||
private long gatewayId;
|
||||
private Long gatewayId;
|
||||
private String nextHop;
|
||||
private StaticRoute.State state;
|
||||
private long vpcId;
|
||||
String vlanTag;
|
||||
|
|
@ -46,6 +47,18 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
ipAddress = gateway.getIp4Address();
|
||||
}
|
||||
|
||||
public StaticRouteProfile(StaticRoute staticRoute) {
|
||||
id = staticRoute.getId();
|
||||
uuid = staticRoute.getUuid();
|
||||
targetCidr = staticRoute.getCidr();
|
||||
accountId = staticRoute.getAccountId();
|
||||
domainId = staticRoute.getDomainId();
|
||||
gatewayId = staticRoute.getVpcGatewayId();
|
||||
state = staticRoute.getState();
|
||||
vpcId = staticRoute.getVpcId();
|
||||
gateway = staticRoute.getNextHop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
|
|
@ -57,10 +70,15 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getVpcGatewayId() {
|
||||
public Long getVpcGatewayId() {
|
||||
return gatewayId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNextHop() {
|
||||
return nextHop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCidr() {
|
||||
return targetCidr;
|
||||
|
|
|
|||
|
|
@ -105,4 +105,6 @@ public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
|
|||
String getIp6Dns1();
|
||||
|
||||
String getIp6Dns2();
|
||||
|
||||
boolean useRouterIpAsResolver();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
public static final String redundantVPCOfferingName = "Redundant VPC offering";
|
||||
public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode";
|
||||
public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode";
|
||||
public static final String DEFAULT_VPC_ROUTE_NETRIS_OFFERING_NAME = "VPC offering with Netris - Route Mode";
|
||||
public static final String DEFAULT_VPC_NAT_NETRIS_OFFERING_NAME = "VPC offering with Netris - NAT Mode";
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -56,8 +58,6 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
*/
|
||||
boolean isDefault();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
NetworkOffering.NetworkMode getNetworkMode();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public interface VpcProvisioningService {
|
|||
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
|
||||
Map<String, List<String>> serviceProviders,
|
||||
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
|
||||
Long serviceOfferingId, Boolean forNsx, NetworkOffering.NetworkMode networkMode,
|
||||
Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode,
|
||||
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state,
|
||||
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@ public interface VpcService {
|
|||
* @param vpcName
|
||||
* @param displayText
|
||||
* @param cidr
|
||||
* @param networkDomain TODO
|
||||
* @param networkDomain TODO
|
||||
* @param ip4Dns1
|
||||
* @param ip4Dns2
|
||||
* @param displayVpc TODO
|
||||
* @param displayVpc TODO
|
||||
* @param useVrIpResolver
|
||||
* @return
|
||||
* @throws ResourceAllocationException TODO
|
||||
*/
|
||||
Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
|
||||
String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize,
|
||||
Long asNumber, List<Long> bgpPeerIds)
|
||||
throws ResourceAllocationException;
|
||||
Long asNumber, List<Long> bgpPeerIds, Boolean useVrIpResolver) throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Persists VPC record in the database
|
||||
|
|
@ -238,7 +238,7 @@ public interface VpcService {
|
|||
* @param cidr
|
||||
* @return
|
||||
*/
|
||||
StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException;
|
||||
StaticRoute createStaticRoute(Long gatewayId, Long vpcId, String nextHop, String cidr) throws NetworkRuleConflictException;
|
||||
|
||||
/**
|
||||
* Lists static routes based on parameters passed to the call
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@ public class DiskOfferingInfo {
|
|||
_diskOffering = diskOffering;
|
||||
}
|
||||
|
||||
public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) {
|
||||
_diskOffering = diskOffering;
|
||||
_size = size;
|
||||
_minIops = minIops;
|
||||
_maxIops = maxIops;
|
||||
}
|
||||
|
||||
public void setDiskOffering(DiskOffering diskOffering) {
|
||||
_diskOffering = diskOffering;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC = "DefaultNATNSXNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC_WITH_ILB = "DefaultNATNSXNetworkOfferingForVpcWithInternalLB";
|
||||
public static final String DEFAULT_ROUTED_NSX_OFFERING_FOR_VPC = "DefaultRoutedNSXNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_ROUTED_NETRIS_OFFERING_FOR_VPC = "DefaultRoutedNetrisNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NETRIS_OFFERING_FOR_VPC = "DefaultNATNetrisNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
|
||||
public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
|
||||
public final static String QuickCloudNoServices = "QuickCloudNoServices";
|
||||
|
|
@ -102,10 +104,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
boolean isForVpc();
|
||||
|
||||
boolean isForTungsten();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
NetworkMode getNetworkMode();
|
||||
|
||||
TrafficType getTrafficType();
|
||||
|
|
|
|||
|
|
@ -142,4 +142,8 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
|
|||
Boolean getDiskOfferingStrictness();
|
||||
|
||||
void setDiskOfferingStrictness(boolean diskOfferingStrictness);
|
||||
|
||||
Long getVgpuProfileId();
|
||||
|
||||
Integer getGpuCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,6 @@ public interface Cluster extends Grouping, Partition {
|
|||
ManagedState getManagedState();
|
||||
|
||||
CPU.CPUArch getArch();
|
||||
|
||||
String getStorageAccessGroups();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,4 +95,11 @@ public interface ResourceService {
|
|||
|
||||
boolean releaseHostReservation(Long hostId);
|
||||
|
||||
void updatePodStorageAccessGroups(long podId, List<String> newStorageAccessGroups);
|
||||
|
||||
void updateZoneStorageAccessGroups(long zoneId, List<String> newStorageAccessGroups);
|
||||
|
||||
void updateClusterStorageAccessGroups(Long clusterId, List<String> newStorageAccessGroups);
|
||||
|
||||
void updateHostStorageAccessGroups(Long hostId, List<String> newStorageAccessGroups);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ public enum ResourceState {
|
|||
}
|
||||
}
|
||||
|
||||
public static List<ResourceState> s_maintenanceStates = List.of(ResourceState.Maintenance,
|
||||
ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance,
|
||||
ResourceState.ErrorInPrepareForMaintenance);
|
||||
|
||||
public ResourceState getNextState(Event a) {
|
||||
return s_fsm.getNextState(this, a);
|
||||
}
|
||||
|
|
@ -98,8 +102,7 @@ public enum ResourceState {
|
|||
}
|
||||
|
||||
public static boolean isMaintenanceState(ResourceState state) {
|
||||
return Arrays.asList(ResourceState.Maintenance, ResourceState.ErrorInMaintenance,
|
||||
ResourceState.PrepareForMaintenance, ResourceState.ErrorInPrepareForMaintenance).contains(state);
|
||||
return s_maintenanceStates.contains(state);
|
||||
}
|
||||
|
||||
public static boolean canAttemptMaintenance(ResourceState state) {
|
||||
|
|
|
|||
|
|
@ -25,16 +25,20 @@ import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
|
|||
import org.apache.cloudstack.api.command.admin.config.ListCfgGroupsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCategoryCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.AddGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.DeleteGuestOsCategoryCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.GetHypervisorGuestOsNamesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.ListGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.RemoveGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCategoryCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd;
|
||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
|
||||
|
|
@ -59,8 +63,10 @@ import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
|||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
||||
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
|
||||
import org.apache.cloudstack.api.command.user.userdata.DeleteCniConfigurationCmd;
|
||||
import org.apache.cloudstack.api.command.user.userdata.DeleteUserDataCmd;
|
||||
import org.apache.cloudstack.api.command.user.userdata.ListUserDataCmd;
|
||||
import org.apache.cloudstack.api.command.user.userdata.RegisterCniConfigurationCmd;
|
||||
import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
|
||||
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
|
||||
|
|
@ -168,6 +174,12 @@ public interface ManagementService {
|
|||
*/
|
||||
Pair<List<? extends GuestOsCategory>, Integer> listGuestOSCategoriesByCriteria(ListGuestOsCategoriesCmd cmd);
|
||||
|
||||
GuestOsCategory addGuestOsCategory(AddGuestOsCategoryCmd cmd);
|
||||
|
||||
GuestOsCategory updateGuestOsCategory(UpdateGuestOsCategoryCmd cmd);
|
||||
|
||||
boolean deleteGuestOsCategory(DeleteGuestOsCategoryCmd cmd);
|
||||
|
||||
/**
|
||||
* Obtains a list of all guest OS mappings
|
||||
*
|
||||
|
|
@ -360,17 +372,23 @@ public interface ManagementService {
|
|||
* The api command class.
|
||||
* @return The list of userdatas found.
|
||||
*/
|
||||
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd);
|
||||
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd, boolean forCks);
|
||||
|
||||
/**
|
||||
* Registers a cni configuration.
|
||||
*
|
||||
* @param cmd The api command class.
|
||||
* @return A VO with the registered user data.
|
||||
*/
|
||||
UserData registerCniConfiguration(RegisterCniConfigurationCmd cmd);
|
||||
|
||||
/**
|
||||
* Registers a userdata.
|
||||
*
|
||||
* @param cmd
|
||||
* The api command class.
|
||||
* @param cmd The api command class.
|
||||
* @return A VO with the registered userdata.
|
||||
*/
|
||||
UserData registerUserData(RegisterUserDataCmd cmd);
|
||||
|
||||
/**
|
||||
* Deletes a userdata.
|
||||
*
|
||||
|
|
@ -380,6 +398,14 @@ public interface ManagementService {
|
|||
*/
|
||||
boolean deleteUserData(DeleteUserDataCmd cmd);
|
||||
|
||||
/**
|
||||
* Deletes user data.
|
||||
*
|
||||
* @param cmd
|
||||
* The api command class.
|
||||
* @return True on success. False otherwise.
|
||||
*/
|
||||
boolean deleteCniConfiguration(DeleteCniConfigurationCmd cmd);
|
||||
/**
|
||||
* Search registered key pairs for the logged in user.
|
||||
*
|
||||
|
|
@ -481,4 +507,6 @@ public interface ManagementService {
|
|||
|
||||
Pair<Boolean, String> patchSystemVM(PatchSystemVMCmd cmd);
|
||||
|
||||
boolean removeManagementServer(RemoveManagementServerCmd cmd);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.server;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ResourceIconManager {
|
||||
|
||||
|
|
@ -25,4 +27,8 @@ public interface ResourceIconManager {
|
|||
boolean deleteResourceIcon(List<String> resourceIds, ResourceTag.ResourceObjectType resourceType);
|
||||
|
||||
ResourceIcon getByResourceTypeAndUuid(ResourceTag.ResourceObjectType type, String resourceId);
|
||||
|
||||
Map<Long, ResourceIcon> getByResourceTypeAndIds(ResourceTag.ResourceObjectType type, Collection<Long> resourceIds);
|
||||
|
||||
Map<String, ResourceIcon> getByResourceTypeAndUuids(ResourceTag.ResourceObjectType type, Collection<String> resourceUuids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
LBStickinessPolicy(false, true),
|
||||
LBHealthCheckPolicy(false, true),
|
||||
SnapshotPolicy(true, true),
|
||||
GuestOsCategory(false, false, true),
|
||||
GuestOs(false, true),
|
||||
NetworkOffering(false, true),
|
||||
VpcOffering(true, false),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
|
@ -27,4 +29,7 @@ public interface GuestOsCategory extends Identity, InternalIdentity {
|
|||
|
||||
void setName(String name);
|
||||
|
||||
boolean isFeatured();
|
||||
|
||||
Date getCreated();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class MigrationOptions implements Serializable {
|
|||
|
||||
private String srcPoolUuid;
|
||||
private Storage.StoragePoolType srcPoolType;
|
||||
private Long srcPoolClusterId;
|
||||
private Type type;
|
||||
private ScopeType scopeType;
|
||||
private String srcBackingFilePath;
|
||||
|
|
@ -38,21 +39,23 @@ public class MigrationOptions implements Serializable {
|
|||
public MigrationOptions() {
|
||||
}
|
||||
|
||||
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType) {
|
||||
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType, Long srcPoolClusterId) {
|
||||
this.srcPoolUuid = srcPoolUuid;
|
||||
this.srcPoolType = srcPoolType;
|
||||
this.type = Type.LinkedClone;
|
||||
this.scopeType = scopeType;
|
||||
this.srcBackingFilePath = srcBackingFilePath;
|
||||
this.copySrcTemplate = copySrcTemplate;
|
||||
this.srcPoolClusterId = srcPoolClusterId;
|
||||
}
|
||||
|
||||
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType) {
|
||||
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType, Long srcPoolClusterId) {
|
||||
this.srcPoolUuid = srcPoolUuid;
|
||||
this.srcPoolType = srcPoolType;
|
||||
this.type = Type.FullClone;
|
||||
this.scopeType = scopeType;
|
||||
this.srcVolumeUuid = srcVolumeUuid;
|
||||
this.srcPoolClusterId = srcPoolClusterId;
|
||||
}
|
||||
|
||||
public String getSrcPoolUuid() {
|
||||
|
|
@ -63,6 +66,10 @@ public class MigrationOptions implements Serializable {
|
|||
return srcPoolType;
|
||||
}
|
||||
|
||||
public Long getSrcPoolClusterId() {
|
||||
return srcPoolClusterId;
|
||||
}
|
||||
|
||||
public ScopeType getScopeType() { return scopeType; }
|
||||
|
||||
public String getSrcBackingFilePath() {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
|
|||
}
|
||||
|
||||
public enum State {
|
||||
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed,
|
||||
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed, Hidden,
|
||||
//it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage
|
||||
Error;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class Storage {
|
|||
OVA(true, true, true, "ova"),
|
||||
VHDX(true, true, true, "vhdx"),
|
||||
BAREMETAL(false, false, false, "BAREMETAL"),
|
||||
EXTERNAL(false, false, false, "EXTERNAL"),
|
||||
VMDK(true, true, false, "vmdk"),
|
||||
VDI(true, true, false, "vdi"),
|
||||
TAR(false, false, false, "tar"),
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ChangeStoragePoolScopeCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ConfigureStorageAccessCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
|
||||
|
|
@ -99,6 +100,8 @@ public interface StorageService {
|
|||
|
||||
StoragePool disablePrimaryStoragePool(Long id);
|
||||
|
||||
boolean configureStorageAccess(ConfigureStorageAccessCmd cmd);
|
||||
|
||||
StoragePool getStoragePool(long id);
|
||||
|
||||
boolean deleteImageStore(DeleteImageStoreCmd cmd);
|
||||
|
|
@ -131,7 +134,7 @@ public interface StorageService {
|
|||
|
||||
void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||
ObjectStore discoverObjectStore(String name, String url, Long size, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||
|
||||
boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.cloud.storage;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
|
@ -25,6 +26,8 @@ public interface VMTemplateStorageResourceAssoc extends InternalIdentity {
|
|||
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
|
||||
}
|
||||
|
||||
List<Status> PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS);
|
||||
|
||||
String getInstallPath();
|
||||
|
||||
long getTemplateId();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ import java.net.MalformedURLException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.volume.AssignVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ChangeOfferingForVolumeCmd;
|
||||
|
|
@ -37,13 +42,9 @@ import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
|
|||
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
public interface VolumeApiService {
|
||||
|
||||
ConfigKey<Long> ConcurrentMigrationsThresholdPerDatastore = new ConfigKey<Long>("Advanced"
|
||||
ConfigKey<Long> ConcurrentMigrationsThresholdPerDatastore = new ConfigKey<>("Advanced"
|
||||
, Long.class
|
||||
, "concurrent.migrations.per.target.datastore"
|
||||
, "0"
|
||||
|
|
@ -51,7 +52,7 @@ public interface VolumeApiService {
|
|||
, true // not sure if this is to be dynamic
|
||||
, ConfigKey.Scope.Global);
|
||||
|
||||
ConfigKey<Boolean> UseHttpsToUpload = new ConfigKey<Boolean>("Advanced",
|
||||
ConfigKey<Boolean> UseHttpsToUpload = new ConfigKey<>("Advanced",
|
||||
Boolean.class,
|
||||
"use.https.to.upload",
|
||||
"true",
|
||||
|
|
@ -85,7 +86,7 @@ public interface VolumeApiService {
|
|||
* @param cmd
|
||||
* the API command wrapping the criteria
|
||||
* @return the volume object
|
||||
* @throws ResourceAllocationException
|
||||
* @throws ResourceAllocationException no capacity to allocate the new volume size
|
||||
*/
|
||||
Volume resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
|
|
@ -112,10 +113,10 @@ public interface VolumeApiService {
|
|||
|
||||
Volume detachVolumeFromVM(DetachVolumeCmd cmd);
|
||||
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds)
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds, List<Long> poolIds, Boolean useStorageReplication)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds, List<Long> storagePoolIds, Boolean useStorageReplication) throws ResourceAllocationException;
|
||||
|
||||
Volume updateVolume(long volumeId, String path, String state, Long storageId,
|
||||
Boolean displayVolume, Boolean deleteProtection,
|
||||
|
|
@ -136,16 +137,16 @@ public interface VolumeApiService {
|
|||
|
||||
void updateDisplay(Volume volume, Boolean displayVolume);
|
||||
|
||||
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName) throws ResourceAllocationException;
|
||||
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName, Long vmSnapshotId) throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Checks if the target storage supports the disk offering.
|
||||
* Checks if the storage pool supports the disk offering tags.
|
||||
* This validation is consistent with the mechanism used to select a storage pool to deploy a volume when a virtual machine is deployed or when a data disk is allocated.
|
||||
*
|
||||
* The scenarios when this method returns true or false is presented in the following table.
|
||||
* <table border="1">
|
||||
* <tr>
|
||||
* <th>#</th><th>Disk offering tags</th><th>Storage tags</th><th>Does the storage support the disk offering?</th>
|
||||
* <th>#</th><th>Disk offering diskOfferingTags</th><th>Storage diskOfferingTags</th><th>Does the storage support the disk offering?</th>
|
||||
* </tr>
|
||||
* <body>
|
||||
* <tr>
|
||||
|
|
@ -169,7 +170,15 @@ public interface VolumeApiService {
|
|||
* </body>
|
||||
* </table>
|
||||
*/
|
||||
boolean doesTargetStorageSupportDiskOffering(StoragePool destPool, String diskOfferingTags);
|
||||
boolean doesStoragePoolSupportDiskOffering(StoragePool destPool, DiskOffering diskOffering);
|
||||
|
||||
/**
|
||||
* Checks if the storage pool supports the required disk offering tags
|
||||
* destPool the storage pool to check the disk offering tags
|
||||
* diskOfferingTags the tags that should be supported
|
||||
* return whether the tags are supported in the storage pool
|
||||
*/
|
||||
boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags);
|
||||
|
||||
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,10 +58,23 @@ public interface TemplateApiService {
|
|||
VirtualMachineTemplate prepareTemplate(long templateId, long zoneId, Long storageId);
|
||||
|
||||
|
||||
/**
|
||||
* Detach ISO from VM
|
||||
* @param vmId id of the VM
|
||||
* @param isoId id of the ISO (when passed). If it is not passed, it will get it from user_vm table
|
||||
* @param extraParams forced, isVirtualRouter
|
||||
* @return true when operation succeeds, false if not
|
||||
*/
|
||||
boolean detachIso(long vmId, Long isoId, Boolean... extraParams);
|
||||
|
||||
boolean detachIso(long vmId, boolean forced);
|
||||
|
||||
boolean attachIso(long isoId, long vmId, boolean forced);
|
||||
/**
|
||||
* Attach ISO to a VM
|
||||
* @param isoId id of the ISO to attach
|
||||
* @param vmId id of the VM to attach the ISO to
|
||||
* @param extraParams: forced, isVirtualRouter
|
||||
* @return true when operation succeeds, false if not
|
||||
*/
|
||||
boolean attachIso(long isoId, long vmId, Boolean... extraParams);
|
||||
|
||||
/**
|
||||
* Deletes a template
|
||||
|
|
|
|||
|
|
@ -145,10 +145,14 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
|||
|
||||
boolean isDeployAsIs();
|
||||
|
||||
boolean isForCks();
|
||||
|
||||
Long getUserDataId();
|
||||
|
||||
UserData.UserDataOverridePolicy getUserDataOverridePolicy();
|
||||
|
||||
CPU.CPUArch getArch();
|
||||
|
||||
Long getExtensionId();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
|||
}
|
||||
|
||||
public static final long ACCOUNT_ID_SYSTEM = 1;
|
||||
public static final long ACCOUNT_ID_ADMIN = 2;
|
||||
|
||||
public String getAccountName();
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ public interface AccountService {
|
|||
|
||||
boolean isDomainAdmin(Long accountId);
|
||||
|
||||
boolean isResourceDomainAdmin(Long accountId);
|
||||
|
||||
boolean isNormalUser(long accountId);
|
||||
|
||||
User getActiveUserByRegistrationToken(String registrationToken);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,14 @@ public interface ResourceLimitService {
|
|||
"The default maximum number of projects that can be created for an account",false);
|
||||
static final ConfigKey<Long> DefaultMaxDomainProjects = new ConfigKey<>("Domain Defaults",Long.class,"max.domain.projects","50",
|
||||
"The default maximum number of projects that can be created for a domain",false);
|
||||
static final ConfigKey<Long> DefaultMaxAccountGpus = new ConfigKey<>("Account Defaults",Long.class,"max.account.gpus","20",
|
||||
"The default maximum number of GPU devices that can be used for an account", false);
|
||||
static final ConfigKey<Long> DefaultMaxDomainGpus = new ConfigKey<>("Domain Defaults",Long.class,"max.domain.gpus","20",
|
||||
"The default maximum number of GPU devices that can be used for a domain", false);
|
||||
static final ConfigKey<Long> DefaultMaxProjectGpus = new ConfigKey<>("Project Defaults",Long.class,"max.project.gpus","20",
|
||||
"The default maximum number of GPU devices that can be used for a project", false);
|
||||
|
||||
static final List<ResourceType> HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory);
|
||||
static final List<ResourceType> HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory, ResourceType.gpu);
|
||||
static final List<ResourceType> StorageTagsSupportingTypes = List.of(ResourceType.volume, ResourceType.primary_storage);
|
||||
|
||||
/**
|
||||
|
|
@ -284,4 +290,8 @@ public interface ResourceLimitService {
|
|||
void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
|
||||
void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
|
||||
|
||||
void checkVmGpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu) throws ResourceAllocationException;
|
||||
void incrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
|
||||
void decrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,5 @@ public interface UserData extends ControlledEntity, InternalIdentity, Identity {
|
|||
String getUserData();
|
||||
|
||||
String getParams();
|
||||
boolean isForCks();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,18 @@
|
|||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Volume;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
|
||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.CreateVMFromBackupCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
|
||||
|
|
@ -111,7 +115,7 @@ public interface UserVmService {
|
|||
|
||||
UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ResourceAllocationException;
|
||||
|
||||
void startVirtualMachine(UserVm vm) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
void startVirtualMachine(UserVm vm, DeploymentPlan plan) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
void startVirtualMachineForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object> params,
|
||||
DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException,
|
||||
|
|
@ -217,11 +221,11 @@ public interface UserVmService {
|
|||
* available.
|
||||
*/
|
||||
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
|
||||
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
|
||||
String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
|
||||
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
|
||||
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
|
||||
Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId) throws InsufficientCapacityException,
|
||||
Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
|
|
@ -294,10 +298,10 @@ public interface UserVmService {
|
|||
* available.
|
||||
*/
|
||||
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
|
||||
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
|
||||
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor,
|
||||
HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
|
||||
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
|
||||
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
|
||||
|
|
@ -366,10 +370,10 @@ public interface UserVmService {
|
|||
* available.
|
||||
*/
|
||||
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner,
|
||||
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||
String hostName, String displayName, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
|
||||
Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
|
||||
Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
|
||||
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId)
|
||||
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot)
|
||||
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
|
||||
|
||||
|
|
@ -513,4 +517,8 @@ public interface UserVmService {
|
|||
* @return true if the VM is successfully unmanaged, false if not.
|
||||
*/
|
||||
boolean unmanageUserVM(Long vmId);
|
||||
|
||||
UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws InsufficientCapacityException, ResourceAllocationException, ResourceUnavailableException;
|
||||
|
||||
UserVm restoreVMFromBackup(CreateVMFromBackupCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Partition,
|
|||
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Stopped, Event.RestoringRequested, State.Restoring, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Expunging, Event.RestoringRequested, State.Restoring, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Destroyed, Event.RestoringRequested, State.Restoring, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Restoring, Event.RestoringSuccess, State.Stopped, null));
|
||||
s_fsm.addTransition(new Transition<State, Event>(State.Restoring, Event.RestoringFailed, State.Stopped, null));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public interface VmDetailConstants {
|
|||
String KVM_VNC_PORT = "kvm.vnc.port";
|
||||
String KVM_VNC_ADDRESS = "kvm.vnc.address";
|
||||
String KVM_VNC_PASSWORD = "kvm.vnc.password";
|
||||
String KVM_GUEST_OS_MACHINE_TYPE = "kvm.guest.os.machine.type";
|
||||
|
||||
// KVM specific, custom virtual GPU hardware
|
||||
String VIDEO_HARDWARE = "video.hardware";
|
||||
|
|
@ -89,6 +90,9 @@ public interface VmDetailConstants {
|
|||
String DEPLOY_AS_IS_CONFIGURATION = "configurationId";
|
||||
String KEY_PAIR_NAMES = "keypairnames";
|
||||
String CKS_CONTROL_NODE_LOGIN_USER = "controlNodeLoginUser";
|
||||
String CKS_NODE_TYPE = "node";
|
||||
String OFFERING = "offering";
|
||||
String TEMPLATE = "template";
|
||||
|
||||
// VMware to KVM VM migrations specific
|
||||
String VMWARE_TO_KVM_PREFIX = "vmware-to-kvm";
|
||||
|
|
@ -101,4 +105,25 @@ public interface VmDetailConstants {
|
|||
String VMWARE_HOST_NAME = String.format("%s-host", VMWARE_TO_KVM_PREFIX);
|
||||
String VMWARE_DISK = String.format("%s-disk", VMWARE_TO_KVM_PREFIX);
|
||||
String VMWARE_MAC_ADDRESSES = String.format("%s-mac-addresses", VMWARE_TO_KVM_PREFIX);
|
||||
|
||||
// TPM
|
||||
String VIRTUAL_TPM_ENABLED = "virtual.tpm.enabled";
|
||||
String VIRTUAL_TPM_MODEL = "virtual.tpm.model";
|
||||
String VIRTUAL_TPM_VERSION = "virtual.tpm.version";
|
||||
|
||||
// CPU mode and model, ADMIN only
|
||||
String GUEST_CPU_MODE = "guest.cpu.mode";
|
||||
String GUEST_CPU_MODEL = "guest.cpu.model";
|
||||
|
||||
// Lease related
|
||||
String INSTANCE_LEASE_EXPIRY_DATE = "leaseexpirydate";
|
||||
String INSTANCE_LEASE_EXPIRY_ACTION = "leaseexpiryaction";
|
||||
String INSTANCE_LEASE_EXECUTION = "leaseactionexecution";
|
||||
|
||||
// External orchestrator related
|
||||
String MAC_ADDRESS = "mac_address";
|
||||
String EXPUNGE_EXTERNAL_VM = "expunge.external.vm";
|
||||
String EXTERNAL_DETAIL_PREFIX = "External:";
|
||||
String CLOUDSTACK_VM_DETAILS = "cloudstack.vm.details";
|
||||
String CLOUDSTACK_VLAN = "cloudstack.vlan";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.cloud.vm;
|
||||
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.DiskOfferingInfo;
|
||||
|
||||
public class VmDiskInfo extends DiskOfferingInfo {
|
||||
private Long _deviceId;
|
||||
|
||||
public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops) {
|
||||
super(diskOffering, size, minIops, maxIops);
|
||||
}
|
||||
|
||||
public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops, Long deviceId) {
|
||||
super(diskOffering, size, minIops, maxIops);
|
||||
_deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return _deviceId;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,8 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
|
|||
enum State {
|
||||
Allocated("The VM snapshot is allocated but has not been created yet."), Creating("The VM snapshot is being created."), Ready(
|
||||
"The VM snapshot is ready to be used."), Reverting("The VM snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed(
|
||||
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered");
|
||||
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered"),
|
||||
Hidden("The VM snapshot is hidden from the user and cannot be recovered.");
|
||||
|
||||
String _description;
|
||||
|
||||
|
|
@ -60,6 +61,8 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
|
|||
s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
|
||||
s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
|
||||
s_fsm.addTransition(Expunging, Event.OperationFailed, Error);
|
||||
s_fsm.addTransition(Expunging, Event.Hide, Hidden);
|
||||
s_fsm.addTransition(Hidden, Event.ExpungeRequested, Expunging);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +71,7 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
|
|||
}
|
||||
|
||||
enum Event {
|
||||
CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested,
|
||||
CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested, Hide,
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,8 +23,11 @@ import com.google.common.base.Enums;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
// Enum for default roles in CloudStack
|
||||
public enum RoleType {
|
||||
|
|
@ -100,6 +103,30 @@ public enum RoleType {
|
|||
return roleId;
|
||||
}
|
||||
|
||||
public static int toCombinedMask(Collection<RoleType> roles) {
|
||||
int combinedMask = 0;
|
||||
if (roles != null) {
|
||||
for (RoleType role : roles) {
|
||||
combinedMask |= role.getMask();
|
||||
}
|
||||
}
|
||||
return combinedMask;
|
||||
}
|
||||
|
||||
public static Set<RoleType> fromCombinedMask(int combinedMask) {
|
||||
Set<RoleType> roles = EnumSet.noneOf(RoleType.class);
|
||||
for (RoleType roleType : RoleType.values()) {
|
||||
if ((combinedMask & roleType.getMask()) != 0) {
|
||||
roles.add(roleType);
|
||||
}
|
||||
}
|
||||
if (roles.isEmpty()) {
|
||||
roles.add(Unknown);
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the role account type if the role isn't null, else it returns the default account type.
|
||||
* */
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ public interface AlertService {
|
|||
public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true);
|
||||
public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
|
||||
public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);
|
||||
public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true);
|
||||
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
|
||||
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);
|
||||
|
||||
public short getType() {
|
||||
return type;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue