mirror of https://github.com/apache/cloudstack.git
Merge branch 'main' into Backroll
This commit is contained in:
commit
bf2c03619c
20
.asf.yaml
20
.asf.yaml
|
|
@ -41,6 +41,7 @@ github:
|
|||
features:
|
||||
wiki: true
|
||||
issues: true
|
||||
discussions: true
|
||||
projects: true
|
||||
|
||||
enabled_merge_buttons:
|
||||
|
|
@ -49,11 +50,20 @@ github:
|
|||
rebase: false
|
||||
|
||||
collaborators:
|
||||
- kiranchavala
|
||||
- rajujith
|
||||
- alexandremattioli
|
||||
- vishesh92
|
||||
- soreana
|
||||
- acs-robot
|
||||
- rajujith
|
||||
- GaOrtiga
|
||||
- SadiJr
|
||||
- winterhazel
|
||||
- gpordeus
|
||||
- hsato03
|
||||
- bernardodemarco
|
||||
- abh1sar
|
||||
|
||||
protected_branches: ~
|
||||
|
||||
notifications:
|
||||
commits: commits@cloudstack.apache.org
|
||||
issues: commits@cloudstack.apache.org
|
||||
pullrequests: commits@cloudstack.apache.org
|
||||
discussions: users@cloudstack.apache.org
|
||||
|
|
|
|||
|
|
@ -15,11 +15,18 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# E112 Expected an indented block
|
||||
# E113 Unexpected indentation
|
||||
# E133 Closing bracket is missing indentation
|
||||
# E223 Tab before operator
|
||||
# E224 Tab after operator
|
||||
# E227 Missing whitespace around bitwise or shift operator
|
||||
# E242 Tab after ','
|
||||
# E271 Multiple spaces after keyword
|
||||
# E272 Multiple spaces before keyword
|
||||
# E273 Tab after keyword
|
||||
# E274 Tab before keyword
|
||||
# E713 Test for membership should be 'not in'
|
||||
# E742 Do not define classes named 'I', 'O', or 'l'
|
||||
# E743 Do not define functions named 'I', 'O', or 'l'
|
||||
# E901 SyntaxError or IndentationError
|
||||
|
|
@ -30,4 +37,7 @@
|
|||
# W391 Blank line at end of file
|
||||
|
||||
[flake8]
|
||||
select = E223,E224,E242,E273,E274,E742,E743,E901,E902,W291,W292,W293,W391
|
||||
exclude =
|
||||
.git,
|
||||
venv
|
||||
select = E112,E113,E133,E223,E224,E227,E242,E271,E272,E273,E274,E713,E742,E743,E901,E902,W291,W292,W293,W391
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# MD001/heading-increment Heading levels should only increment by one level at a time
|
||||
MD001: false
|
||||
|
||||
# MD003/heading-style Heading style
|
||||
MD003: false
|
||||
|
||||
# MD004/ul-style Unordered list style
|
||||
MD004: false
|
||||
|
||||
# MD007/ul-indent Unordered list indentation
|
||||
MD007: false
|
||||
|
||||
# MD009/no-trailing-spaces Trailing spaces
|
||||
MD009: false
|
||||
|
||||
# MD010/no-hard-tabs Hard tabs
|
||||
MD010: false
|
||||
|
||||
# MD012/no-multiple-blanks Multiple consecutive blank lines
|
||||
MD012: false
|
||||
|
||||
# MD013/line-length Line length
|
||||
MD013: false
|
||||
|
||||
# MD014/commands-show-output Dollar signs used before commands without showing output
|
||||
MD014: false
|
||||
|
||||
# MD018/no-missing-space-atx No space after hash on atx style heading
|
||||
MD018: false
|
||||
|
||||
# MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading
|
||||
MD019: false
|
||||
|
||||
# MD022/blanks-around-headings Headings should be surrounded by blank lines
|
||||
MD022: false
|
||||
|
||||
# MD023/heading-start-left Headings must start at the beginning of the line
|
||||
MD023: false
|
||||
|
||||
# MD024/no-duplicate-heading Multiple headings with the same content
|
||||
MD024: false
|
||||
|
||||
# MD025/single-title/single-h1 Multiple top-level headings in the same document
|
||||
MD025: false
|
||||
|
||||
# MD026/no-trailing-punctuation Trailing punctuation in heading
|
||||
MD026: false
|
||||
|
||||
# MD028/no-blanks-blockquote Blank line inside blockquote
|
||||
MD028: false
|
||||
|
||||
# MD029/ol-prefix Ordered list item prefix
|
||||
MD029: false
|
||||
|
||||
# MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines
|
||||
MD031: false
|
||||
|
||||
# MD032/blanks-around-lists Lists should be surrounded by blank lines
|
||||
MD032: false
|
||||
|
||||
# MD033/no-inline-html Inline HTML
|
||||
MD033: false
|
||||
|
||||
# MD034/no-bare-urls Bare URL used
|
||||
MD034: false
|
||||
|
||||
# MD036/no-emphasis-as-heading Emphasis used instead of a heading
|
||||
MD036: false
|
||||
|
||||
# MD037/no-space-in-emphasis Spaces inside emphasis markers
|
||||
MD037: false
|
||||
|
||||
# MD040/fenced-code-language Fenced code blocks should have a language specified
|
||||
MD040: false
|
||||
|
||||
# MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading
|
||||
MD041: false
|
||||
|
||||
# MD046/code-block-style Code block style
|
||||
MD046: false
|
||||
|
||||
# MD052/reference-links-images Reference links and images should use a label that is defined
|
||||
MD052: false
|
||||
|
|
@ -0,0 +1,526 @@
|
|||
accouns
|
||||
acheived
|
||||
acount
|
||||
actuall
|
||||
acuiring
|
||||
acumulate
|
||||
addreess
|
||||
addtion
|
||||
adminstrator
|
||||
afer
|
||||
afrer
|
||||
afterall
|
||||
againt
|
||||
ags
|
||||
aktive
|
||||
algoritm
|
||||
allo
|
||||
alloacate
|
||||
allocted
|
||||
alocation
|
||||
alogrithm
|
||||
alpha-numeric
|
||||
alue
|
||||
ammended
|
||||
ammount
|
||||
ans
|
||||
anull
|
||||
apche
|
||||
aplication
|
||||
apllication
|
||||
applicatio
|
||||
apporpriate
|
||||
appropritate
|
||||
aqcuire
|
||||
aqcuired
|
||||
aquire
|
||||
aquiring
|
||||
assiciate
|
||||
assigne
|
||||
assoication
|
||||
assosiate
|
||||
asssert
|
||||
astroid
|
||||
asynchroniously
|
||||
asyncronous
|
||||
atleast
|
||||
atomation
|
||||
attache
|
||||
attch
|
||||
attches
|
||||
authenciation
|
||||
authenitcation
|
||||
authenitication
|
||||
availiability
|
||||
avialable
|
||||
bais
|
||||
beacause
|
||||
beacuse
|
||||
becase
|
||||
becasue
|
||||
becaues
|
||||
behviour
|
||||
birdge
|
||||
bject
|
||||
boardcast
|
||||
bootstraper
|
||||
bu
|
||||
cant
|
||||
capabilites
|
||||
capablity
|
||||
capcity
|
||||
carrefully
|
||||
cavaet
|
||||
chaing
|
||||
checkd
|
||||
childs
|
||||
choosen
|
||||
chould
|
||||
clenup
|
||||
cliente
|
||||
clinet
|
||||
cluser
|
||||
cna
|
||||
collison
|
||||
comman
|
||||
commited
|
||||
comparision
|
||||
comparisions
|
||||
complient
|
||||
concious
|
||||
conectix
|
||||
confg
|
||||
configruation
|
||||
configuable
|
||||
conneciton
|
||||
connexion
|
||||
constrait
|
||||
constraits
|
||||
containg
|
||||
contex
|
||||
continuesly
|
||||
contro
|
||||
controler
|
||||
controles
|
||||
controll
|
||||
convienient
|
||||
convinience
|
||||
coputer
|
||||
correcponding
|
||||
correspoding
|
||||
correspoonds
|
||||
cosole
|
||||
coudl
|
||||
couldnt
|
||||
craete
|
||||
craeted
|
||||
crate
|
||||
crated
|
||||
createa
|
||||
createing
|
||||
credentail
|
||||
cros
|
||||
crresponding
|
||||
curren
|
||||
currentl
|
||||
datas
|
||||
decalared
|
||||
declatory
|
||||
decocdes
|
||||
decypher
|
||||
defalut
|
||||
defaut
|
||||
defered
|
||||
definiton
|
||||
deleteable
|
||||
dependancy
|
||||
dependant
|
||||
dependend
|
||||
deployement
|
||||
deply
|
||||
deplying
|
||||
dervied
|
||||
descktop
|
||||
descrption
|
||||
deserialzed
|
||||
desination
|
||||
detination
|
||||
detroy
|
||||
detroying
|
||||
dettach
|
||||
dettached
|
||||
dettaching
|
||||
diabling
|
||||
diasbled
|
||||
dictonary
|
||||
didnt
|
||||
differnet
|
||||
differnt
|
||||
direcotry
|
||||
directroy
|
||||
disale
|
||||
disbale
|
||||
discrepency
|
||||
disover
|
||||
dissapper
|
||||
dissassociated
|
||||
divice
|
||||
doesn'
|
||||
doesnot
|
||||
doesnt
|
||||
dont'
|
||||
doubleclick
|
||||
dows
|
||||
eanbled
|
||||
earch
|
||||
ect
|
||||
elemnt
|
||||
eles
|
||||
elments
|
||||
emmited
|
||||
enble
|
||||
encryted
|
||||
enebled
|
||||
enmpty
|
||||
entires
|
||||
enviornment
|
||||
environmnet
|
||||
equivalant
|
||||
erro
|
||||
erronous
|
||||
everthing
|
||||
everytime
|
||||
excetion
|
||||
excption
|
||||
excute
|
||||
execept
|
||||
execption
|
||||
execut
|
||||
executeable
|
||||
exeeded
|
||||
exisitng
|
||||
exisits
|
||||
existin
|
||||
existsing
|
||||
exitting
|
||||
expcted
|
||||
expection
|
||||
explaination
|
||||
explicitely
|
||||
faield
|
||||
faild
|
||||
failes
|
||||
falied
|
||||
fasion
|
||||
feild
|
||||
filenname
|
||||
fillled
|
||||
findout
|
||||
fisrt
|
||||
fo
|
||||
folowing
|
||||
fowarding
|
||||
frist
|
||||
fro
|
||||
frontent
|
||||
fuctionality
|
||||
genarate
|
||||
generallly
|
||||
gernerate
|
||||
get's
|
||||
gloabal
|
||||
gorry
|
||||
gracefull
|
||||
gradiant
|
||||
handeling
|
||||
hanling
|
||||
happend
|
||||
hasing
|
||||
hasnt
|
||||
hda
|
||||
hostanme
|
||||
hould
|
||||
hsould
|
||||
hte
|
||||
identifers
|
||||
identifyer
|
||||
identifyers
|
||||
igoring
|
||||
immediatley
|
||||
implememented
|
||||
implementor
|
||||
implementors
|
||||
implemnt
|
||||
implict
|
||||
implmeneted
|
||||
implmentation
|
||||
incase
|
||||
includeing
|
||||
incosistency
|
||||
indecates
|
||||
indien
|
||||
infor
|
||||
informations
|
||||
informaton
|
||||
infrastrcuture
|
||||
ingore
|
||||
inital
|
||||
initalize
|
||||
initator
|
||||
initilization
|
||||
inspite
|
||||
instace
|
||||
instal
|
||||
instnace
|
||||
intefaces
|
||||
intepret
|
||||
intereface
|
||||
interfer
|
||||
interpretted
|
||||
intialize
|
||||
intializes
|
||||
intializing
|
||||
invlaid
|
||||
invokation
|
||||
isnt
|
||||
ist
|
||||
klunky
|
||||
lable
|
||||
leve
|
||||
lief
|
||||
limite
|
||||
linke
|
||||
listner
|
||||
lokal
|
||||
lokales
|
||||
maintainence
|
||||
maintenace
|
||||
maintenence
|
||||
mamagement
|
||||
mambers
|
||||
manaully
|
||||
manuel
|
||||
maxium
|
||||
mehtod
|
||||
mergable
|
||||
mesage
|
||||
messge
|
||||
metatdata
|
||||
milisecond
|
||||
minumum
|
||||
mis
|
||||
modifers
|
||||
mor
|
||||
mot
|
||||
mulitply
|
||||
multipl
|
||||
multple
|
||||
mutliple
|
||||
nast
|
||||
nd
|
||||
neccessary
|
||||
necesary
|
||||
netowrk
|
||||
nin
|
||||
nodel
|
||||
nome
|
||||
noone
|
||||
nowe
|
||||
numbe
|
||||
numer
|
||||
occured
|
||||
occurence
|
||||
occuring
|
||||
offfering
|
||||
ofthe
|
||||
omited
|
||||
onother
|
||||
opeation
|
||||
optin
|
||||
orginal
|
||||
otherwse
|
||||
outter
|
||||
overriden
|
||||
overwritting
|
||||
paramater
|
||||
paramemeter
|
||||
paramenter
|
||||
paramete
|
||||
parametrs
|
||||
pararmeter
|
||||
parms
|
||||
parralels
|
||||
particualr
|
||||
passowrd
|
||||
perfromed
|
||||
permissble
|
||||
physcial
|
||||
plugable
|
||||
pluging
|
||||
polcies
|
||||
policys
|
||||
poluting
|
||||
possiblity
|
||||
potenial
|
||||
prefered
|
||||
preffered
|
||||
pressenter
|
||||
previleges
|
||||
primay
|
||||
priviledged
|
||||
procuct
|
||||
programatically
|
||||
progres
|
||||
properites
|
||||
propertie
|
||||
propertys
|
||||
propogate
|
||||
provison
|
||||
psudo
|
||||
pyhsical
|
||||
readabilty
|
||||
readd
|
||||
reccuring
|
||||
recevied
|
||||
recieved
|
||||
recursivelly
|
||||
redunant
|
||||
refference
|
||||
releease
|
||||
relese
|
||||
remaning
|
||||
remore
|
||||
remvoing
|
||||
renabling
|
||||
repeatly
|
||||
reponse
|
||||
reqest
|
||||
reqiured
|
||||
requieres
|
||||
requried
|
||||
reserv
|
||||
reserverd
|
||||
reseted
|
||||
reseting
|
||||
resorce
|
||||
responser
|
||||
resposne
|
||||
resturns
|
||||
retreive
|
||||
retreiving
|
||||
retrive
|
||||
retrived
|
||||
retriving
|
||||
retrun
|
||||
retuned
|
||||
returing
|
||||
re-use
|
||||
rever
|
||||
rocessor
|
||||
runing
|
||||
runnign
|
||||
sate
|
||||
scalled
|
||||
scipt
|
||||
scirpt
|
||||
scrip
|
||||
seconadry
|
||||
seconday
|
||||
seesion
|
||||
sepcified
|
||||
sepcify
|
||||
seprated
|
||||
ser
|
||||
servies
|
||||
seting
|
||||
settig
|
||||
sevices
|
||||
shoul
|
||||
shoule
|
||||
sie
|
||||
signle
|
||||
simplier
|
||||
singature
|
||||
skiping
|
||||
snaphsot
|
||||
snpashot
|
||||
specied
|
||||
specifed
|
||||
specifiy
|
||||
splitted
|
||||
spped
|
||||
standy
|
||||
statics
|
||||
stickyness
|
||||
stil
|
||||
stip
|
||||
storeage
|
||||
strat
|
||||
streched
|
||||
strutural
|
||||
succesfull
|
||||
successfull
|
||||
suceessful
|
||||
suces
|
||||
sucessfully
|
||||
suiteable
|
||||
suppots
|
||||
suppport
|
||||
syncronous
|
||||
syste
|
||||
tage
|
||||
te
|
||||
tempdate
|
||||
testng
|
||||
tha
|
||||
thats
|
||||
ther
|
||||
therefor
|
||||
theres
|
||||
theses
|
||||
thi
|
||||
thorugh
|
||||
throught
|
||||
ths
|
||||
tipically
|
||||
transction
|
||||
tring
|
||||
trough
|
||||
tyoe
|
||||
ue
|
||||
ues
|
||||
unavailibility
|
||||
uncommited
|
||||
uncompressible
|
||||
uneccessarily
|
||||
unexepected
|
||||
unexpect
|
||||
unknow
|
||||
unkonw
|
||||
unkown
|
||||
unneccessary
|
||||
unparseable
|
||||
unrecoginized
|
||||
unsupport
|
||||
unxpected
|
||||
updat
|
||||
uptodate
|
||||
usera
|
||||
usign
|
||||
usin
|
||||
utlization
|
||||
vaidate
|
||||
valiate
|
||||
valule
|
||||
valus
|
||||
varibles
|
||||
verfy
|
||||
verfying
|
||||
verifing
|
||||
virutal
|
||||
visable
|
||||
wakup
|
||||
wil
|
||||
wit
|
||||
wll
|
||||
wth
|
||||
|
|
@ -23,14 +23,17 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
|
@ -38,7 +41,7 @@ jobs:
|
|||
cache: maven
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.8'
|
||||
architecture: 'x64'
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'apache/cloudstack'
|
||||
|
|
@ -51,6 +54,7 @@ jobs:
|
|||
smoke/test_deploy_vm_with_userdata
|
||||
smoke/test_deploy_vms_in_parallel
|
||||
smoke/test_deploy_vms_with_varied_deploymentplanners
|
||||
smoke/test_restore_vm
|
||||
smoke/test_diagnostics
|
||||
smoke/test_direct_download
|
||||
smoke/test_disk_offerings
|
||||
|
|
@ -59,7 +63,8 @@ jobs:
|
|||
smoke/test_domain_network_offerings
|
||||
smoke/test_domain_service_offerings
|
||||
smoke/test_domain_vpc_offerings",
|
||||
"smoke/test_dynamicroles
|
||||
"smoke/test_cluster_drs
|
||||
smoke/test_dynamicroles
|
||||
smoke/test_enable_account_settings_for_domain
|
||||
smoke/test_enable_role_based_users_in_projects
|
||||
smoke/test_events_resource
|
||||
|
|
@ -81,7 +86,9 @@ jobs:
|
|||
smoke/test_migration
|
||||
smoke/test_multipleips_per_nic
|
||||
smoke/test_nested_virtualization
|
||||
smoke/test_set_sourcenat",
|
||||
smoke/test_set_sourcenat
|
||||
smoke/test_webhook_lifecycle
|
||||
smoke/test_purge_expunged_vms",
|
||||
"smoke/test_network
|
||||
smoke/test_network_acl
|
||||
smoke/test_network_ipv6
|
||||
|
|
@ -89,6 +96,7 @@ jobs:
|
|||
smoke/test_nic
|
||||
smoke/test_nic_adapter_type
|
||||
smoke/test_non_contigiousvlan
|
||||
smoke/test_object_stores
|
||||
smoke/test_outofbandmanagement
|
||||
smoke/test_outofbandmanagement_nestedplugin
|
||||
smoke/test_over_provisioning
|
||||
|
|
@ -107,7 +115,8 @@ jobs:
|
|||
smoke/test_reset_configuration_settings
|
||||
smoke/test_reset_vm_on_reboot
|
||||
smoke/test_resource_accounting
|
||||
smoke/test_resource_detail",
|
||||
smoke/test_resource_detail
|
||||
smoke/test_global_acls",
|
||||
"smoke/test_router_dhcphosts
|
||||
smoke/test_router_dns
|
||||
smoke/test_router_dnsservice
|
||||
|
|
@ -125,6 +134,7 @@ jobs:
|
|||
smoke/test_usage
|
||||
smoke/test_usage_events
|
||||
smoke/test_vm_deployment_planner
|
||||
smoke/test_vm_strict_host_tags
|
||||
smoke/test_vm_schedule
|
||||
smoke/test_vm_life_cycle
|
||||
smoke/test_vm_lifecycle_unmanage_import
|
||||
|
|
@ -173,7 +183,8 @@ jobs:
|
|||
"component/test_project_usage
|
||||
component/test_protocol_number_security_group
|
||||
component/test_public_ip
|
||||
component/test_resource_limits",
|
||||
component/test_resource_limits
|
||||
component/test_resource_limit_tags",
|
||||
"component/test_regions_accounts
|
||||
component/test_routers
|
||||
component/test_snapshots
|
||||
|
|
@ -188,16 +199,23 @@ jobs:
|
|||
component/test_vpc_network
|
||||
component/test_vpc_offerings
|
||||
component/test_vpc_routers
|
||||
component/test_vpn_users",
|
||||
"component/test_vpc_network_lbrules" ]
|
||||
component/test_vpn_users
|
||||
component/test_vpc_network_lbrules",
|
||||
"smoke/test_list_accounts
|
||||
smoke/test_list_disk_offerings
|
||||
smoke/test_list_domains
|
||||
smoke/test_list_hosts
|
||||
smoke/test_list_service_offerings
|
||||
smoke/test_list_storage_pools
|
||||
smoke/test_list_volumes"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
|
@ -205,7 +223,7 @@ jobs:
|
|||
cache: maven
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.8'
|
||||
architecture: 'x64'
|
||||
|
|
@ -272,7 +290,7 @@ jobs:
|
|||
while ! nc -vzw 5 localhost 8096 2>&1 > /dev/null; do grep Exception /tmp/jetty-log; sleep 10; done
|
||||
set -e
|
||||
echo -e "\nStarting Advanced Zone DataCenter deployment"
|
||||
python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advanced.cfg 2>&1 || true
|
||||
python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advdualzone.cfg 2>&1 || true
|
||||
|
||||
- name: Run Integration Tests with Simulator
|
||||
run: |
|
||||
|
|
@ -285,7 +303,7 @@ jobs:
|
|||
TESTS=($(echo $TESTS | tr -d '\n' | tr -s ' '))
|
||||
for suite in "${TESTS[@]}" ; do
|
||||
echo -e "Currently running test: $suite\n"
|
||||
time nosetests-3.4 --with-xunit --xunit-file=integration-test-results/$suite.xml --with-marvin --marvin-config=setup/dev/advanced.cfg test/integration/$suite.py -s -a tags=advanced,required_hardware=false --zone=Sandbox-simulator --hypervisor=simulator || true ;
|
||||
time nosetests-3.4 --with-xunit --xunit-file=integration-test-results/$suite.xml --with-marvin --marvin-config=setup/dev/advdualzone.cfg test/integration/$suite.py -s -a tags=advanced,required_hardware=false --zone=zim1 --hypervisor=simulator || true ;
|
||||
done
|
||||
|
||||
echo -e "Stopping Simulator, integration tests run completed\n"
|
||||
|
|
@ -299,10 +317,11 @@ jobs:
|
|||
echo -e "Simulator CI Test Results: (only failures listed)\n"
|
||||
python3 ./tools/marvin/xunit-reader.py integration-test-results/
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
- uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: jacoco-coverage.xml
|
||||
fail_ci_if_error: true
|
||||
flags: simulator-marvin-tests
|
||||
verbose: true
|
||||
name: codecov
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ jobs:
|
|||
name: codecov
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK11
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
|
|
@ -49,10 +49,11 @@ jobs:
|
|||
cd nonoss && bash -x install-non-oss.sh && cd ..
|
||||
mvn -P quality -Dsimulator -Dnoredist clean install -T$(nproc)
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
- uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./client/target/site/jacoco-aggregate/jacoco.xml
|
||||
fail_ci_if_error: true
|
||||
flags: unit-tests
|
||||
flags: unittests
|
||||
verbose: true
|
||||
name: codecov
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ jobs:
|
|||
- name: Set Docker repository name
|
||||
run: echo "DOCKER_REPOSITORY=apache" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set ACS version
|
||||
run: echo "ACS_VERSION=$(grep '<version>' pom.xml | head -2 | tail -1 | cut -d'>' -f2 |cut -d'<' -f1)" >> $GITHUB_ENV
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check Out
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Install
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pre-commit
|
||||
- name: Set PY
|
||||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
|
|
|||
|
|
@ -32,26 +32,26 @@ jobs:
|
|||
name: Main Sonar JaCoCo Build
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK11
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,16 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
|
|
|
|||
|
|
@ -29,31 +29,31 @@ concurrency:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'apache/cloudstack'
|
||||
if: github.repository == 'apache/cloudstack' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
name: Sonar JaCoCo Coverage
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: "refs/pull/${{ github.event.number }}/merge"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK11
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,15 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
|
|
@ -52,7 +55,7 @@ jobs:
|
|||
npm run lint
|
||||
npm run test:unit
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
- uses: codecov/codecov-action@v4
|
||||
with:
|
||||
working-directory: ui
|
||||
files: ./coverage/lcov.info
|
||||
|
|
@ -60,3 +63,4 @@ jobs:
|
|||
flags: uitests
|
||||
verbose: true
|
||||
name: codecov
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -15,93 +15,92 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
build/build.number
|
||||
.lock-wscript
|
||||
.waf-*
|
||||
waf-*
|
||||
target/
|
||||
override/
|
||||
.metadata
|
||||
dist/
|
||||
*~
|
||||
*_flymake.js
|
||||
*.bak
|
||||
cloud-*.tar.bz2
|
||||
*.log
|
||||
*.pyc
|
||||
*.patch
|
||||
*.css.map
|
||||
*.egginfo/
|
||||
*.egg-info/
|
||||
*.prefs
|
||||
build.number
|
||||
*.log.*
|
||||
cloud.log.*.*
|
||||
unittest
|
||||
deps/cloud.userlibraries
|
||||
.DS_Store
|
||||
.idea
|
||||
*.iml
|
||||
git-remote-https.exe.stackdump
|
||||
*.swp
|
||||
tools/devcloud/devcloudbox/.vagrant
|
||||
tools/cli/cloudmonkey/marvin/
|
||||
tools/cli/cloudmonkey/precache.py
|
||||
tools/marvin/marvin/cloudstackAPI/
|
||||
tools/marvin/build/
|
||||
tools/cli/build/
|
||||
tools/appliance/systemvmtemplate/packer_cache/
|
||||
*.jar
|
||||
*.war
|
||||
*.mar
|
||||
*.iso
|
||||
*.jar
|
||||
*.log
|
||||
*.log.*
|
||||
*.mar
|
||||
*.orig
|
||||
*.patch
|
||||
*.prefs
|
||||
*.pyc
|
||||
*.qcow2
|
||||
*.raw
|
||||
*.swp
|
||||
*.tar.gz
|
||||
*.tgz
|
||||
*.vscode
|
||||
*.css.map
|
||||
*.war
|
||||
.DS_Store
|
||||
.checkstyle
|
||||
.classpath
|
||||
.idea
|
||||
.lock-wscript
|
||||
.metadata
|
||||
.pmd
|
||||
.pmdruleset.xml
|
||||
.project
|
||||
.pydevproject
|
||||
.reviewboardrc
|
||||
.settings.xml
|
||||
.settings/
|
||||
.vscode
|
||||
.waf-*
|
||||
Gemfile.lock
|
||||
build/build.number
|
||||
build.number
|
||||
build-indep-stamp
|
||||
cloud.log.*.*
|
||||
cloud-*.tar.bz2
|
||||
configure-stamp
|
||||
db.properties.override
|
||||
debian/*.debhelper
|
||||
debian/*.substvars
|
||||
debian/cloudstack-*/*
|
||||
debian/files
|
||||
debian/tmp
|
||||
deps/cloud.userlibraries
|
||||
dist/
|
||||
docs/publish
|
||||
docs/runbook/publish
|
||||
docs/runbook/tmp
|
||||
docs/tmp
|
||||
engine/storage/integration-test/test-output
|
||||
git-remote-https.exe.stackdump
|
||||
node_modules
|
||||
override/
|
||||
plugins/hypervisors/kvm/.pydevproject
|
||||
plugins/network-elements/juniper-contrail/logs/
|
||||
replace.properties.override
|
||||
replace.properties.tmp
|
||||
scripts/.pydevproject
|
||||
scripts/vm/hypervisor/xenserver/vhd-util
|
||||
systemvm/.pydevproject
|
||||
target/
|
||||
target-eclipse
|
||||
test/.pydevprojec
|
||||
tools/apidoc/log/
|
||||
tools/appliance/box/
|
||||
tools/appliance/systemvmtemplate/packer_cache/
|
||||
tools/cli/build/
|
||||
tools/cli/cloudmonkey/marvin/
|
||||
tools/cli/cloudmonkey/precache.py
|
||||
tools/devcloud/devcloudbox/.vagrant
|
||||
tools/marvin/build/
|
||||
tools/marvin/marvin/cloudstackAPI/
|
||||
tools/marvin/marvin/cloudstackAPI/*
|
||||
unittest
|
||||
venv
|
||||
waf-*
|
||||
|
||||
# this ignores _all files starting with '.'. Don't do that!
|
||||
#.*
|
||||
|
||||
target-eclipse
|
||||
!.gitignore
|
||||
.classpath
|
||||
.settings.xml
|
||||
.settings/
|
||||
db.properties.override
|
||||
replace.properties.override
|
||||
tools/marvin/marvin/cloudstackAPI/*
|
||||
docs/tmp
|
||||
docs/publish
|
||||
docs/runbook/tmp
|
||||
docs/runbook/publish
|
||||
.project
|
||||
Gemfile.lock
|
||||
debian/tmp
|
||||
debian/files
|
||||
debian/cloudstack-*/*
|
||||
debian/*.substvars
|
||||
debian/*.debhelper
|
||||
replace.properties.tmp
|
||||
build-indep-stamp
|
||||
configure-stamp
|
||||
*_flymake.js
|
||||
engine/storage/integration-test/test-output
|
||||
tools/apidoc/log/
|
||||
plugins/network-elements/juniper-contrail/logs/
|
||||
scripts/vm/hypervisor/xenserver/vhd-util
|
||||
*.orig
|
||||
tools/appliance/box/
|
||||
.reviewboardrc
|
||||
.checkstyle
|
||||
.pmd
|
||||
.pmdruleset.xml
|
||||
.pydevproject
|
||||
systemvm/.pydevproject
|
||||
test/.pydevprojec
|
||||
plugins/hypervisors/kvm/.pydevproject
|
||||
scripts/.pydevproject
|
||||
*.qcow2
|
||||
*.raw
|
||||
venv
|
||||
node_modules
|
||||
.vscode
|
||||
*.bz2
|
||||
!.gitignore
|
||||
|
|
@ -19,21 +19,25 @@ default_stages: [commit, push]
|
|||
default_language_version:
|
||||
# force all unspecified Python hooks to run python3
|
||||
python: python3
|
||||
minimum_pre_commit_version: "2.18.0"
|
||||
minimum_pre_commit_version: "2.17.0"
|
||||
repos:
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: identity
|
||||
- id: check-hooks-apply
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
#- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
#- id: check-executables-have-shebangs
|
||||
#- id: check-merge-conflict
|
||||
- id: check-merge-conflict
|
||||
- id: check-symlinks
|
||||
- id: check-vcs-permalinks
|
||||
#- id: check-yaml
|
||||
- id: destroyed-symlinks
|
||||
- id: detect-aws-credentials
|
||||
args: [--allow-missing-credentials]
|
||||
- id: detect-private-key
|
||||
exclude: >
|
||||
(?x)
|
||||
|
|
@ -51,11 +55,23 @@ repos:
|
|||
- id: end-of-file-fixer
|
||||
exclude: \.vhd$
|
||||
#- id: fix-byte-order-marker
|
||||
- id: forbid-submodules
|
||||
- id: mixed-line-ending
|
||||
files: \.(java|md|py|txt|yaml|yml)$
|
||||
# - id: trailing-whitespace
|
||||
exclude: \.(cs|xml)$
|
||||
- id: trailing-whitespace
|
||||
files: \.(header|in|java|md|properties|py|rb|sh|sql|txt|vue|xml|yaml|yml)$
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.6
|
||||
hooks:
|
||||
- id: codespell
|
||||
name: run codespell
|
||||
description: Check spelling with codespell
|
||||
args: [--ignore-words=.github/linters/codespell.txt]
|
||||
exclude: ^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 6.1.0
|
||||
rev: 7.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: [--config, .github/linters/.flake8]
|
||||
|
|
@ -70,3 +86,12 @@ repos:
|
|||
^scripts/vm/hypervisor/xenserver/vmopspremium$|
|
||||
^setup/bindir/cloud-setup-encryption\.in$|
|
||||
^venv/.*$
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.40.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
name: run markdownlint
|
||||
description: check Markdown files with markdownlint
|
||||
args: [--config=.github/linters/.markdown-lint.yml]
|
||||
types: [markdown]
|
||||
files: \.(md|mdown|markdown)$
|
||||
|
|
|
|||
16
CHANGES.md
16
CHANGES.md
|
|
@ -430,11 +430,11 @@ Bug ID | Description
|
|||
[CLOUDSTACK-6099](https://issues.apache.org/jira/browse/CLOUDSTACK-6099) | live migration is failing for vm deployed using dynamic compute offerings with NPE
|
||||
[CLOUDSTACK-7528](https://issues.apache.org/jira/browse/CLOUDSTACK-7528) | More verbose logging when sending alert fails
|
||||
[CLOUDSTACK-6624](https://issues.apache.org/jira/browse/CLOUDSTACK-6624) | set specifyIpRanges to true if specifyVlan is set to true
|
||||
[CLOUDSTACK-7404](https://issues.apache.org/jira/browse/CLOUDSTACK-7404) | Failed to start an instance when originating template has been deleted
|
||||
[CLOUDSTACK-7404](https://issues.apache.org/jira/browse/CLOUDSTACK-7404) | Failed to start an instance when originating template has been deleted
|
||||
[CLOUDSTACK-6531](https://issues.apache.org/jira/browse/CLOUDSTACK-6531) | Stopping the router in case of command failures
|
||||
[CLOUDSTACK-6115](https://issues.apache.org/jira/browse/CLOUDSTACK-6115) | TravisCI configuration
|
||||
[CLOUDSTACK-7405](https://issues.apache.org/jira/browse/CLOUDSTACK-7405) | allowing VR meta-data to be accessed without trailing slash
|
||||
[CLOUDSTACK-7260](https://issues.apache.org/jira/browse/CLOUDSTACK-7260) | Management server not responding after some time for Vmware due to Oom
|
||||
[CLOUDSTACK-7260](https://issues.apache.org/jira/browse/CLOUDSTACK-7260) | Management server not responding after some time for Vmware due to Oom
|
||||
[CLOUDSTACK-7038](https://issues.apache.org/jira/browse/CLOUDSTACK-7038) | Add mysql client dependency for mgmt server pkg for debian
|
||||
[CLOUDSTACK-6892](https://issues.apache.org/jira/browse/CLOUDSTACK-6892) | Create separate package for the mysql HA component
|
||||
[CLOUDSTACK-7038](https://issues.apache.org/jira/browse/CLOUDSTACK-7038) | Add mysql client dependency for mgmt server/rpms
|
||||
|
|
@ -449,12 +449,12 @@ Bug ID | Description
|
|||
[CLOUDSTACK-7006](https://issues.apache.org/jira/browse/CLOUDSTACK-7006) | Restore template ID in ROOT volume usages
|
||||
[CLOUDSTACK-6747](https://issues.apache.org/jira/browse/CLOUDSTACK-6747) | test to allow all cidrs on other end of vpc
|
||||
[CLOUDSTACK-6272](https://issues.apache.org/jira/browse/CLOUDSTACK-6272) | Fix recover/restore VM actions
|
||||
[CLOUDSTACK-6927](https://issues.apache.org/jira/browse/CLOUDSTACK-6927) | store virsh list in list instead of querying libvirt
|
||||
[CLOUDSTACK-6927](https://issues.apache.org/jira/browse/CLOUDSTACK-6927) | store virsh list in list instead of querying libvirt
|
||||
[CLOUDSTACK-6317](https://issues.apache.org/jira/browse/CLOUDSTACK-6317) | [VMware] Tagged VLAN support broken for Management/Control/Storage traffic
|
||||
[CLOUDSTACK-5891](https://issues.apache.org/jira/browse/CLOUDSTACK-5891) | [VMware] If a template has been registered and "cpu.corespersocket=X" ,
|
||||
[CLOUDSTACK-6478](https://issues.apache.org/jira/browse/CLOUDSTACK-6478) | Failed to download Template when having 3 SSVM's in one
|
||||
[CLOUDSTACK-6464](https://issues.apache.org/jira/browse/CLOUDSTACK-6464) | if guest network type is vlan://untagged, and traffic label is used
|
||||
[CLOUDSTACK-6816](https://issues.apache.org/jira/browse/CLOUDSTACK-6816) | bugfix: cloudstack-setup-management make /root directory's permission 0777
|
||||
[CLOUDSTACK-6816](https://issues.apache.org/jira/browse/CLOUDSTACK-6816) | bugfix: cloudstack-setup-management make /root directory's permission 0777
|
||||
[CLOUDSTACK-6204](https://issues.apache.org/jira/browse/CLOUDSTACK-6204) | applying missed patch
|
||||
[CLOUDSTACK-6472](https://issues.apache.org/jira/browse/CLOUDSTACK-6472) | (4.3 specific) listUsageRecords: Pull information from removed items as well
|
||||
[CLOUDSTACK-5976](https://issues.apache.org/jira/browse/CLOUDSTACK-5976) | Typo in "ssh_keypairs" table's foreign key constraints on the Upgraded Setup
|
||||
|
|
@ -657,11 +657,11 @@ Version 4.1.0
|
|||
-------------
|
||||
|
||||
This is the second major release of CloudStack from within the Apache Software Foundation, and the
|
||||
first major release as a Top-Level Project (TLP).
|
||||
first major release as a Top-Level Project (TLP).
|
||||
|
||||
Build Tool Changes:
|
||||
|
||||
* The project now uses Maven 3 exclusively to build.
|
||||
* The project now uses Maven 3 exclusively to build.
|
||||
|
||||
New Features:
|
||||
* CLOUDSTACK-101: OVS support in KVM
|
||||
|
|
@ -976,14 +976,14 @@ Issues fixed in this release:
|
|||
* CLOUDSTACK-1845: KVM - storage migration often fails
|
||||
* CLOUDSTACK-1846: KVM - storage pools can silently fail to be unregistered, leading to failure to register later
|
||||
* CLOUDSTACK-2003: Deleting domain while deleted account is cleaning up leaves VMs expunging forever due to 'Failed to update resource count'
|
||||
* CLOUDSTACK-2090: Upgrade from version 4.0.1 to version 4.0.2 triggers the 4.0.0 to 4.0.1.
|
||||
* CLOUDSTACK-2090: Upgrade from version 4.0.1 to version 4.0.2 triggers the 4.0.0 to 4.0.1.
|
||||
* CLOUDSTACK-2091: Error in API documentation for 4.0.x.
|
||||
|
||||
|
||||
Version 4.0.1-incubating
|
||||
------------------------
|
||||
|
||||
This is a bugfix release for Apache CloudStack 4.0.0-incubating, with no new features.
|
||||
This is a bugfix release for Apache CloudStack 4.0.0-incubating, with no new features.
|
||||
|
||||
Security Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Contributing to Apache CloudStack (ACS)
|
|||
|
||||
Summary
|
||||
-------
|
||||
This document covers how to contribute to the ACS project. ACS uses GitHub PRs to manage code contributions.
|
||||
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.
|
||||
|
||||
_Lets get started!!!_
|
||||
|
|
@ -11,17 +11,17 @@ _Lets get started!!!_
|
|||
Bug fixes
|
||||
---------
|
||||
|
||||
It's very important that we can easily track bug fix commits, so their hashes should remain the same in all branches.
|
||||
Therefore, a pull request (PR) that fixes a bug, should be sent against a release branch.
|
||||
This can be either the "current release" or the "previous release", depending on which ones are maintained.
|
||||
It's very important that we can easily track bug fix commits, so their hashes should remain the same in all branches.
|
||||
Therefore, a pull request (PR) that fixes a bug, should be sent against a release branch.
|
||||
This can be either the "current release" or the "previous release", depending on which ones are maintained.
|
||||
Since the goal is a stable main, bug fixes should be "merged forward" to the next branch in order: "previous release" -> "current release" -> main (in other words: old to new)
|
||||
|
||||
Developing new features
|
||||
-----------------------
|
||||
|
||||
Development should be done in a feature branch, branched off of main.
|
||||
Send a PR(steps below) to get it into main (2x LGTM applies).
|
||||
PR will only be merged when main is open, will be held otherwise until main is open again.
|
||||
Development should be done in a feature branch, branched off of main.
|
||||
Send a PR(steps below) to get it into main (2x LGTM applies).
|
||||
PR will only be merged when main is open, will be held otherwise until main is open again.
|
||||
No back porting / cherry-picking features to existing branches!
|
||||
|
||||
PendingReleaseNotes file
|
||||
|
|
@ -33,7 +33,7 @@ When adding information to the PendingReleaseNotes file make sure that you write
|
|||
|
||||
Updating the PendingReleaseNotes file is preferably a part of the original Pull Request, but that is up to the developers' discretion.
|
||||
|
||||
Fork the code
|
||||
Fork the code
|
||||
-------------
|
||||
|
||||
In your browser, navigate to: [https://github.com/apache/cloudstack](https://github.com/apache/cloudstack)
|
||||
|
|
@ -136,4 +136,4 @@ $ git push origin :feature_x
|
|||
|
||||
Release Principles
|
||||
------------------
|
||||
Detailed information about ACS release principles is available at https://cwiki.apache.org/confluence/display/CLOUDSTACK/Release+principles+for+Apache+CloudStack+4.6+and+up
|
||||
Detailed information about ACS release principles is available at https://cwiki.apache.org/confluence/display/CLOUDSTACK/Release+principles+for+Apache+CloudStack+4.6+and+up
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ was tested against a CentOS 7 x86_64 setup.
|
|||
|
||||
Install tools and dependencies used for development:
|
||||
|
||||
# yum -y install git java-11-openjdk java-11-openjdk-devel \
|
||||
# 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):
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ This PR...
|
|||
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
|
||||
<!-- Fixes: # -->
|
||||
|
||||
<!--- ********************************************************************************* -->
|
||||
<!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
|
||||
<!--- ******************************************************************************* -->
|
||||
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
|
||||
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
|
||||
<!--- ********************************************************************************* -->
|
||||
<!--- ******************************************************************************* -->
|
||||
|
||||
### Types of changes
|
||||
|
||||
|
|
@ -22,6 +22,8 @@ This PR...
|
|||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] Enhancement (improves an existing feature and functionality)
|
||||
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
|
||||
- [ ] build/CI
|
||||
- [ ] test (unit or integration test code)
|
||||
|
||||
### Feature/Enhancement Scale or Bug Severity
|
||||
|
||||
|
|
@ -43,8 +45,12 @@ This PR...
|
|||
|
||||
|
||||
### How Has This Been Tested?
|
||||
|
||||
<!-- Please describe in detail how you tested your changes. -->
|
||||
<!-- Include details of your testing environment, and the tests you ran to -->
|
||||
|
||||
#### How did you try to break this feature and the system with this change?
|
||||
|
||||
<!-- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,13 @@ contribution. Note that you do not have to be a developer in order to contribute
|
|||
to Apache CloudStack. We need folks to help with documentation, translation,
|
||||
promotion etc. See our contribution [page](http://cloudstack.apache.org/contribute.html).
|
||||
|
||||
If you are a frequent contributors, you can request to be added as collaborators
|
||||
(see https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features#Git.asf.yamlfeatures-AssigningexternalcollaboratorswiththetriageroleonGitHub)
|
||||
to our GitHub repos. This allows you to use project GitHub with ability to report
|
||||
issue with tags, and be assigned to issues and PRs. This is done via the .asf.yaml
|
||||
file in this repo.
|
||||
You may do so by sharing your GitHub users ID or raise a GitHub issue.
|
||||
|
||||
If you're interested in learning more or participating in the Apache CloudStack
|
||||
project, the mailing lists are the best way to do that. While the project has
|
||||
several communications channels, the [mailing lists](http://cloudstack.apache.org/mailing-lists.html) are the most active and the
|
||||
|
|
@ -135,7 +142,7 @@ This distribution includes cryptographic software. The country in which you curr
|
|||
reside may have restrictions on the import, possession, use, and/or re-export to another
|
||||
country, of encryption software. BEFORE using any encryption software, please check your
|
||||
country's laws, regulations and policies concerning the import, possession, or use, and
|
||||
re-export of encryption software, to see if this is permitted. See [The Wassenaar Arrangement](http://www.wassenaar.org/)
|
||||
re-export of encryption software, to see if this is permitted. See [The Wassenaar Arrangement](http://www.wassenaar.org/)
|
||||
for more information.
|
||||
|
||||
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has
|
||||
|
|
|
|||
|
|
@ -6,9 +6,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
|
||||
|
|
|
|||
|
|
@ -6,9 +6,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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -279,6 +279,11 @@ hypervisor.type=kvm
|
|||
# If this parameter is used, property host.overcommit.mem.mb must be set to 0.
|
||||
#host.reserved.mem.mb=1024
|
||||
|
||||
# Number of CPU cores to subtract from advertised available cores.
|
||||
# These are reserved for system activity, or otherwise share host CPU resources with
|
||||
# CloudStack VM allocation.
|
||||
# host.reserved.cpu.count = 0
|
||||
|
||||
# The model of Watchdog timer to present to the Guest.
|
||||
# For all models refer to the libvirt documentation.
|
||||
#vm.watchdog.model=i6300esb
|
||||
|
|
@ -373,6 +378,10 @@ iscsi.session.cleanup.enabled=false
|
|||
# If the time is exceeded shutdown will be forced.
|
||||
#stop.script.timeout=120
|
||||
|
||||
# Time (in seconds) to wait for scripts to complete.
|
||||
# This is currently used only while checking if the host supports UEFI.
|
||||
#agent.script.timeout=60
|
||||
|
||||
# Definition of VMs video model type.
|
||||
#vm.video.hardware=
|
||||
|
||||
|
|
@ -402,3 +411,25 @@ iscsi.session.cleanup.enabled=false
|
|||
# The path of an executable file/script for host health check for CloudStack to Auto Disable/Enable the host
|
||||
# depending on the return value of the file/script
|
||||
# agent.health.check.script.path=
|
||||
|
||||
# Time interval (in milliseconds) between KVM heartbeats.
|
||||
# kvm.heartbeat.update.frequency=60000
|
||||
|
||||
# Number of maximum tries to KVM heartbeats.
|
||||
# kvm.heartbeat.update.max.tries=5
|
||||
|
||||
# Time amount (in milliseconds) for the KVM heartbeat retry sleep.
|
||||
# kvm.heartbeat.update.retry.sleep=10000
|
||||
|
||||
# Timeout (in milliseconds) of the KVM heartbeat checker.
|
||||
# kvm.heartbeat.checker.timeout=360000
|
||||
|
||||
# Instance Conversion from Vmware to KVM through virt-v2v. Enable verbose mode
|
||||
# virtv2v.verbose.enabled=false
|
||||
|
||||
# If set to "true", the agent will register for libvirt domain events, allowing for immediate updates on crashed or
|
||||
# unexpectedly stopped. Experimental, requires agent restart.
|
||||
# libvirt.events.enabled=false
|
||||
|
||||
# Implicit host tags managed by agent.properties
|
||||
# host.tags=
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
/var/log/cloudstack/agent/security_group.log /var/log/cloudstack/agent/resizevolume.log /var/log/cloudstack/agent/rolling-maintenance.log {
|
||||
/var/log/cloudstack/agent/security_group.log /var/log/cloudstack/agent/resizevolume.log /var/log/cloudstack/agent/rolling-maintenance.log /var/log/cloudstack/agent/agent.out /var/log/cloudstack/agent/agent.err {
|
||||
copytruncate
|
||||
daily
|
||||
rotate 5
|
||||
compress
|
||||
missingok
|
||||
size 10M
|
||||
dateext
|
||||
dateformat -%Y-%m-%d
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -17,91 +17,60 @@ KIND, either express or implied. See the License for the
|
|||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<Configuration monitorInterval="60">
|
||||
<Appenders>
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
|
||||
<!-- ================================= -->
|
||||
<!-- Preserve messages in a local file -->
|
||||
<!-- ================================= -->
|
||||
|
||||
<!-- ================================= -->
|
||||
<!-- Preserve messages in a local file -->
|
||||
<!-- ================================= -->
|
||||
<!-- A time/date based rolling appender -->
|
||||
<RollingFile name="FILE" append="true" fileName="@AGENTLOG@" filePattern="@AGENTLOG@.%d{yyyy-MM-dd}.gz">
|
||||
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
</Policies>
|
||||
<PatternLayout pattern="%d{ISO8601} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
|
||||
</RollingFile>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
|
||||
<param name="Append" value="true"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
|
||||
<param name="FileNamePattern" value="@AGENTLOG@.%d{yyyy-MM-dd}.gz"/>
|
||||
<param name="ActiveFileName" value="@AGENTLOG@"/>
|
||||
</rollingPolicy>
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- ============================== -->
|
||||
<!-- Append messages to the console -->
|
||||
<!-- ============================== -->
|
||||
<!-- ============================== -->
|
||||
<!-- Append messages to the console -->
|
||||
<!-- ============================== -->
|
||||
|
||||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
<Console name="CONSOLE" target="SYSTEM_OUT">
|
||||
<ThresholdFilter level="OFF" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<Loggers>
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
|
||||
<category name="com.cloud">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="com.cloud.agent.metrics">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="com.cloud.agent.resource.computing.ComputingResource$StorageMonitorTask">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="com.cloud" level="INFO"/>
|
||||
|
||||
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
|
||||
<category name="org.apache">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="org.apache" level="INFO"/>
|
||||
|
||||
<category name="org">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
|
||||
<category name="net">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="org" level="INFO"/>
|
||||
|
||||
<!-- Limit the com.amazonaws category to INFO as its DEBUG is verbose -->
|
||||
<category name="com.amazonaws">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="net" level="INFO"/>
|
||||
|
||||
<!-- Limit the httpclient.wire category to INFO as its DEBUG is verbose -->
|
||||
<category name="httpclient.wire">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="com.amazonaws" level="INFO"/>
|
||||
|
||||
<category name="org.apache.http.wire">
|
||||
<priority value="INFO"/>
|
||||
</category>
|
||||
<Logger name="httpclient.wire" level="INFO"/>
|
||||
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
<Logger name="org.apache.http.wire" level="INFO"/>
|
||||
|
||||
<root>
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
|
||||
</log4j:configuration>
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="CONSOLE"/>
|
||||
<AppenderRef ref="FILE"/>
|
||||
</Root>
|
||||
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.19.0.0-SNAPSHOT</version>
|
||||
<version>4.20.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.resource.AgentStatusUpdater;
|
||||
import com.cloud.resource.ResourceStatusUpdater;
|
||||
import com.cloud.agent.api.PingAnswer;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import org.apache.cloudstack.agent.lb.SetupMSListAnswer;
|
||||
import org.apache.cloudstack.agent.lb.SetupMSListCommand;
|
||||
|
|
@ -52,9 +55,10 @@ import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
|
|||
import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
import com.cloud.agent.api.AgentControlCommand;
|
||||
|
|
@ -86,6 +90,7 @@ import com.cloud.utils.nio.NioConnection;
|
|||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.script.OutputInterpreter;
|
||||
import com.cloud.utils.script.Script;
|
||||
import org.apache.logging.log4j.ThreadContext;
|
||||
|
||||
/**
|
||||
* @config
|
||||
|
|
@ -100,8 +105,8 @@ import com.cloud.utils.script.Script;
|
|||
* For more configuration options, see the individual types.
|
||||
*
|
||||
**/
|
||||
public class Agent implements HandlerFactory, IAgentControl {
|
||||
protected static Logger s_logger = Logger.getLogger(Agent.class);
|
||||
public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater {
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public enum ExitStatus {
|
||||
Normal(0), // Normal status = 0.
|
||||
|
|
@ -178,7 +183,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
final String value = _shell.getPersistentProperty(getResourceName(), "id");
|
||||
_id = value != null ? Long.parseLong(value) : null;
|
||||
s_logger.info("id is " + (_id != null ? _id : ""));
|
||||
logger.info("id is {}", ObjectUtils.defaultIfNull(_id, ""));
|
||||
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
|
||||
|
|
@ -196,7 +201,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
// ((NioClient)_connection).setBindAddress(_shell.getPrivateIp());
|
||||
|
||||
s_logger.debug("Adding shutdown hook");
|
||||
logger.debug("Adding shutdown hook");
|
||||
Runtime.getRuntime().addShutdownHook(_shutdownThread);
|
||||
|
||||
_ugentTaskPool =
|
||||
|
|
@ -207,8 +212,8 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
|
||||
"agentRequest-Handler"));
|
||||
|
||||
s_logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() +
|
||||
" : workers = " + _shell.getWorkers() + " : host = " + host + " : port = " + _shell.getPort());
|
||||
logger.info("Agent [id = {} : type = {} : zone = {} : pod = {} : workers = {} : host = {} : port = {}", ObjectUtils.defaultIfNull(_id, "new"), getResourceName(),
|
||||
_shell.getZone(), _shell.getPod(), _shell.getWorkers(), host, _shell.getPort());
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
|
|
@ -265,7 +270,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
public void start() {
|
||||
if (!_resource.start()) {
|
||||
s_logger.error("Unable to start the resource: " + _resource.getName());
|
||||
logger.error("Unable to start the resource: {}", _resource.getName());
|
||||
throw new CloudRuntimeException("Unable to start the resource: " + _resource.getName());
|
||||
}
|
||||
|
||||
|
|
@ -282,14 +287,13 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
s_logger.warn("NIO Connection Exception " + e);
|
||||
s_logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...");
|
||||
logger.warn("Attempt to connect to server generated NIO Connection Exception {}, trying again", e.getLocalizedMessage());
|
||||
}
|
||||
while (!_connection.isStartup()) {
|
||||
final String host = _shell.getNextHost();
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
_connection = new NioClient("Agent", host, _shell.getPort(), _shell.getWorkers(), this);
|
||||
s_logger.info("Connecting to host:" + host);
|
||||
logger.info("Connecting to host:{}", host);
|
||||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
|
|
@ -297,9 +301,9 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException ex) {
|
||||
s_logger.warn("Fail to clean up old connection. " + ex);
|
||||
logger.warn("Fail to clean up old connection. {}", ex);
|
||||
}
|
||||
s_logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...", e);
|
||||
logger.info("Attempted to connect to the server, but received an unexpected exception, trying again...", e);
|
||||
}
|
||||
}
|
||||
_shell.updateConnectedHost();
|
||||
|
|
@ -308,7 +312,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
|
||||
public void stop(final String reason, final String detail) {
|
||||
s_logger.info("Stopping the agent: Reason = " + reason + (detail != null ? ": Detail = " + detail : ""));
|
||||
logger.info("Stopping the agent: Reason = {} {}", reason, ": Detail = " + ObjectUtils.defaultIfNull(detail, ""));
|
||||
_reconnectAllowed = false;
|
||||
if (_connection != null) {
|
||||
final ShutdownCommand cmd = new ShutdownCommand(reason, detail);
|
||||
|
|
@ -318,15 +322,15 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_link.send(req.toBytes());
|
||||
}
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send: " + cmd.toString());
|
||||
logger.warn("Unable to send: {}", cmd.toString());
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Unable to send: " + cmd.toString() + " due to exception: ", e);
|
||||
logger.warn("Unable to send: {} due to exception: {}", cmd.toString(), e);
|
||||
}
|
||||
s_logger.debug("Sending shutdown to management server");
|
||||
logger.debug("Sending shutdown to management server");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (final InterruptedException e) {
|
||||
s_logger.debug("Who the heck interrupted me here?");
|
||||
logger.debug("Who the heck interrupted me here?");
|
||||
}
|
||||
_connection.stop();
|
||||
_connection = null;
|
||||
|
|
@ -373,7 +377,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
s_logger.info("Set agent id " + id);
|
||||
logger.debug("Set agent id {}", id);
|
||||
_id = id;
|
||||
_shell.setPersistentProperty(getResourceName(), "id", Long.toString(id));
|
||||
}
|
||||
|
|
@ -392,7 +396,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
hostLBTimer.cancel();
|
||||
}
|
||||
if (checkInterval > 0L) {
|
||||
s_logger.info("Scheduling preferred host timer task with host.lb.interval=" + checkInterval + "ms");
|
||||
logger.info("Scheduling preferred host timer task with host.lb.interval={}ms", checkInterval);
|
||||
hostLBTimer = new Timer("Host LB Timer");
|
||||
hostLBTimer.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval);
|
||||
}
|
||||
|
|
@ -400,23 +404,34 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
public void scheduleWatch(final Link link, final Request request, final long delay, final long period) {
|
||||
synchronized (_watchList) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Adding a watch list");
|
||||
}
|
||||
logger.debug("Adding task with request: {} to watch list", request.toString());
|
||||
|
||||
final WatchTask task = new WatchTask(link, request, this);
|
||||
_timer.schedule(task, 0, period);
|
||||
_watchList.add(task);
|
||||
}
|
||||
}
|
||||
|
||||
public void triggerUpdate() {
|
||||
PingCommand command = _resource.getCurrentStatus(getId());
|
||||
command.setOutOfBand(true);
|
||||
logger.debug("Sending out of band ping");
|
||||
|
||||
final Request request = new Request(_id, -1, command, false);
|
||||
request.setSequence(getNextSequence());
|
||||
try {
|
||||
_link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
logger.warn("Unable to send ping update: {}", request.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancelTasks() {
|
||||
synchronized (_watchList) {
|
||||
for (final WatchTask task : _watchList) {
|
||||
task.cancel();
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Clearing watch list: " + _watchList.size());
|
||||
}
|
||||
logger.debug("Clearing {} tasks of watch list", _watchList.size());
|
||||
_watchList.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -452,14 +467,16 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
final Request request = new Request(_id != null ? _id : -1, -1, commands, false, false);
|
||||
request.setSequence(getNextSequence());
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Sending Startup: " + request.toString());
|
||||
}
|
||||
logger.debug("Sending Startup: {}", request.toString());
|
||||
lockStartupTask(link);
|
||||
try {
|
||||
link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
logger.warn("Unable to send request: {}", request.toString());
|
||||
}
|
||||
|
||||
if (_resource instanceof ResourceStatusUpdater) {
|
||||
((ResourceStatusUpdater) _resource).registerStatusUpdater(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -469,11 +486,11 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
addr = InetAddress.getLocalHost();
|
||||
} catch (final UnknownHostException e) {
|
||||
s_logger.warn("unknown host? ", e);
|
||||
logger.warn("unknown host? ", e);
|
||||
throw new CloudRuntimeException("Cannot get local IP address");
|
||||
}
|
||||
|
||||
final Script command = new Script("hostname", 500, s_logger);
|
||||
final Script command = new Script("hostname", 500, logger);
|
||||
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
|
||||
final String result = command.execute(parser);
|
||||
final String hostname = result == null ? parser.getLine() : addr.toString();
|
||||
|
|
@ -515,14 +532,14 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
_resource.disconnected();
|
||||
|
||||
s_logger.info("Lost connection to host: " + _shell.getConnectedHost() + ". Attempting reconnection while we still have " + _inProgress.get() + " commands in progress.");
|
||||
logger.info("Lost connection to host: {}. Attempting reconnection while we still have {} commands in progress.", _shell.getConnectedHost(), _inProgress.get());
|
||||
|
||||
_connection.stop();
|
||||
|
||||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Fail to clean up old connection. " + e);
|
||||
logger.warn("Fail to clean up old connection. {}", e);
|
||||
}
|
||||
|
||||
while (_connection.isStartup()) {
|
||||
|
|
@ -532,22 +549,22 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
do {
|
||||
final String host = _shell.getNextHost();
|
||||
_connection = new NioClient("Agent", host, _shell.getPort(), _shell.getWorkers(), this);
|
||||
s_logger.info("Reconnecting to host:" + host);
|
||||
logger.info("Reconnecting to host:{}", host);
|
||||
try {
|
||||
_connection.start();
|
||||
} catch (final NioConnectionException e) {
|
||||
s_logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
logger.info("Attempted to re-connect to the server, but received an unexpected exception, trying again...", e);
|
||||
_connection.stop();
|
||||
try {
|
||||
_connection.cleanUp();
|
||||
} catch (final IOException ex) {
|
||||
s_logger.warn("Fail to clean up old connection. " + ex);
|
||||
logger.warn("Fail to clean up old connection. {}", ex);
|
||||
}
|
||||
}
|
||||
_shell.getBackoffAlgorithm().waitBeforeRetry();
|
||||
} while (!_connection.isStartup());
|
||||
_shell.updateConnectedHost();
|
||||
s_logger.info("Connected to the host: " + _shell.getConnectedHost());
|
||||
logger.info("Connected to the host: {}", _shell.getConnectedHost());
|
||||
}
|
||||
|
||||
public void processStartupAnswer(final Answer answer, final Response response, final Link link) {
|
||||
|
|
@ -562,15 +579,15 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
final StartupAnswer startup = (StartupAnswer)answer;
|
||||
if (!startup.getResult()) {
|
||||
s_logger.error("Not allowed to connect to the server: " + answer.getDetails());
|
||||
logger.error("Not allowed to connect to the server: {}", answer.getDetails());
|
||||
System.exit(1);
|
||||
}
|
||||
if (cancelled) {
|
||||
s_logger.warn("Threw away a startup answer because we're reconnecting.");
|
||||
logger.warn("Threw away a startup answer because we're reconnecting.");
|
||||
return;
|
||||
}
|
||||
|
||||
s_logger.info("Process agent startup answer, agent id = " + startup.getHostId());
|
||||
logger.info("Process agent startup answer, agent id = {}", startup.getHostId());
|
||||
|
||||
setId(startup.getHostId());
|
||||
_pingInterval = (long)startup.getPingInterval() * 1000; // change to ms.
|
||||
|
|
@ -580,7 +597,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
_ugentTaskPool.setKeepAliveTime(2 * _pingInterval, TimeUnit.MILLISECONDS);
|
||||
|
||||
s_logger.info("Startup Response Received: agent id = " + getId());
|
||||
logger.info("Startup Response Received: agent id = {}", getId());
|
||||
}
|
||||
|
||||
protected void processRequest(final Request request, final Link link) {
|
||||
|
|
@ -595,18 +612,18 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
Answer answer;
|
||||
try {
|
||||
if (cmd.getContextParam("logid") != null) {
|
||||
MDC.put("logcontextid", cmd.getContextParam("logid"));
|
||||
ThreadContext.put("logcontextid", cmd.getContextParam("logid"));
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (!requestLogged) // ensures request is logged only once per method call
|
||||
{
|
||||
final String requestMsg = request.toString();
|
||||
if (requestMsg != null) {
|
||||
s_logger.debug("Request:" + requestMsg);
|
||||
logger.debug("Request:{}",requestMsg);
|
||||
}
|
||||
requestLogged = true;
|
||||
}
|
||||
s_logger.debug("Processing command: " + cmd.toString());
|
||||
logger.debug("Processing command: {}", cmd.toString());
|
||||
}
|
||||
|
||||
if (cmd instanceof CronCommand) {
|
||||
|
|
@ -615,7 +632,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ShutdownCommand) {
|
||||
final ShutdownCommand shutdown = (ShutdownCommand)cmd;
|
||||
s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
|
||||
logger.debug("Received shutdownCommand, due to: {}", shutdown.getReason());
|
||||
cancelTasks();
|
||||
if (shutdown.isRemoveHost()) {
|
||||
cleanupAgentZoneProperties();
|
||||
|
|
@ -623,11 +640,11 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_reconnectAllowed = false;
|
||||
answer = new Answer(cmd, true, null);
|
||||
} else if (cmd instanceof ReadyCommand && ((ReadyCommand)cmd).getDetails() != null) {
|
||||
s_logger.debug("Not ready to connect to mgt server: " + ((ReadyCommand)cmd).getDetails());
|
||||
logger.debug("Not ready to connect to mgt server: {}", ((ReadyCommand)cmd).getDetails());
|
||||
System.exit(1);
|
||||
return;
|
||||
} else if (cmd instanceof MaintainCommand) {
|
||||
s_logger.debug("Received maintainCommand, do not cancel current tasks");
|
||||
logger.debug("Received maintainCommand, do not cancel current tasks");
|
||||
answer = new MaintainAnswer((MaintainCommand)cmd);
|
||||
} else if (cmd instanceof AgentControlCommand) {
|
||||
answer = null;
|
||||
|
|
@ -641,7 +658,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
|
||||
if (answer == null) {
|
||||
s_logger.warn("No handler found to process cmd: " + cmd.toString());
|
||||
logger.warn("No handler found to process cmd: {}", cmd.toString());
|
||||
answer = new AgentControlAnswer(cmd);
|
||||
}
|
||||
} else if (cmd instanceof SetupKeyStoreCommand && ((SetupKeyStoreCommand) cmd).isHandleByAgent()) {
|
||||
|
|
@ -664,12 +681,12 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_inProgress.decrementAndGet();
|
||||
}
|
||||
if (answer == null) {
|
||||
s_logger.debug("Response: unsupported command" + cmd.toString());
|
||||
logger.debug("Response: unsupported command {}", cmd.toString());
|
||||
answer = Answer.createUnsupportedCommandAnswer(cmd);
|
||||
}
|
||||
}
|
||||
} catch (final Throwable th) {
|
||||
s_logger.warn("Caught: ", th);
|
||||
logger.warn("Caught: ", th);
|
||||
final StringWriter writer = new StringWriter();
|
||||
th.printStackTrace(new PrintWriter(writer));
|
||||
answer = new Answer(cmd, false, writer.toString());
|
||||
|
|
@ -685,10 +702,10 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
response = new Response(request, answers);
|
||||
} finally {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
final String responseMsg = response.toString();
|
||||
if (responseMsg != null) {
|
||||
s_logger.debug(response.toString());
|
||||
logger.debug(response.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -696,7 +713,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
link.send(response.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send response: " + response.toString());
|
||||
logger.warn("Unable to send response: {}", response.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -706,7 +723,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
final String keyStorePassword = cmd.getKeystorePassword();
|
||||
final long validityDays = cmd.getValidityDays();
|
||||
|
||||
s_logger.debug("Setting up agent keystore file and generating CSR");
|
||||
logger.debug("Setting up agent keystore file and generating CSR");
|
||||
|
||||
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
|
||||
if (agentFile == null) {
|
||||
|
|
@ -721,7 +738,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_shell.setPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY, storedPassword);
|
||||
}
|
||||
|
||||
Script script = new Script(_keystoreSetupPath, 300000, s_logger);
|
||||
Script script = new Script(_keystoreSetupPath, 300000, logger);
|
||||
script.add(agentFile.getAbsolutePath());
|
||||
script.add(keyStoreFile);
|
||||
script.add(storedPassword);
|
||||
|
|
@ -746,7 +763,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
final String privateKey = cmd.getPrivateKey();
|
||||
final String caCertificates = cmd.getCaCertificates();
|
||||
|
||||
s_logger.debug("Importing received certificate to agent's keystore");
|
||||
logger.debug("Importing received certificate to agent's keystore");
|
||||
|
||||
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
|
||||
if (agentFile == null) {
|
||||
|
|
@ -760,13 +777,13 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
FileUtils.writeStringToFile(new File(certFile), certificate, Charset.defaultCharset());
|
||||
FileUtils.writeStringToFile(new File(caCertFile), caCertificates, Charset.defaultCharset());
|
||||
s_logger.debug("Saved received client certificate to: " + certFile);
|
||||
logger.debug("Saved received client certificate to: {}", certFile);
|
||||
} catch (IOException e) {
|
||||
throw new CloudRuntimeException("Unable to save received agent client and ca certificates", e);
|
||||
}
|
||||
|
||||
String ksPassphrase = _shell.getPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
|
||||
Script script = new Script(_keystoreCertImportPath, 300000, s_logger);
|
||||
Script script = new Script(_keystoreCertImportPath, 300000, logger);
|
||||
script.add(agentFile.getAbsolutePath());
|
||||
script.add(ksPassphrase);
|
||||
script.add(keyStoreFile);
|
||||
|
|
@ -791,7 +808,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_shell.setPersistentProperty(null, "host", newMSHosts);
|
||||
_shell.setHosts(newMSHosts);
|
||||
_shell.resetHostCounter();
|
||||
s_logger.info("Processed new management server list: " + newMSHosts);
|
||||
logger.info("Processed new management server list: {}", newMSHosts);
|
||||
} catch (final Exception e) {
|
||||
throw new CloudRuntimeException("Could not persist received management servers list", e);
|
||||
}
|
||||
|
|
@ -810,9 +827,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
public void processResponse(final Response response, final Link link) {
|
||||
final Answer answer = response.getAnswer();
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Received response: " + response.toString());
|
||||
}
|
||||
logger.debug("Received response: {}", response.toString());
|
||||
if (answer instanceof StartupAnswer) {
|
||||
processStartupAnswer(answer, response, link);
|
||||
} else if (answer instanceof AgentControlAnswer) {
|
||||
|
|
@ -822,6 +837,9 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
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 {
|
||||
setLastPingResponseTime();
|
||||
}
|
||||
|
|
@ -835,44 +853,42 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
NumbersUtil.enableHumanReadableSizes = humanReadable;
|
||||
}
|
||||
|
||||
s_logger.info("Processing agent ready command, agent id = " + ready.getHostId());
|
||||
logger.info("Processing agent ready command, agent id = {}", ready.getHostId());
|
||||
if (ready.getHostId() != null) {
|
||||
setId(ready.getHostId());
|
||||
}
|
||||
|
||||
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
|
||||
|
||||
s_logger.info("Ready command is processed for agent id = " + getId());
|
||||
logger.info("Ready command is processed for agent id = {}", getId());
|
||||
}
|
||||
|
||||
public void processOtherTask(final Task task) {
|
||||
final Object obj = task.get();
|
||||
if (obj instanceof Response) {
|
||||
if (System.currentTimeMillis() - _lastPingResponseTime > _pingInterval * _shell.getPingRetries()) {
|
||||
s_logger.error("Ping Interval has gone past " + _pingInterval * _shell.getPingRetries() + ". Won't reconnect to mgt server, as connection is still alive");
|
||||
logger.error("Ping Interval has gone past {}. Won't reconnect to mgt server, as connection is still alive", _pingInterval * _shell.getPingRetries());
|
||||
return;
|
||||
}
|
||||
|
||||
final PingCommand ping = _resource.getCurrentStatus(getId());
|
||||
final Request request = new Request(_id, -1, ping, false);
|
||||
request.setSequence(getNextSequence());
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Sending ping: " + request.toString());
|
||||
}
|
||||
logger.debug("Sending ping: {}", request.toString());
|
||||
|
||||
try {
|
||||
task.getLink().send(request.toBytes());
|
||||
//if i can send pingcommand out, means the link is ok
|
||||
setLastPingResponseTime();
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send request: " + request.toString());
|
||||
logger.warn("Unable to send request: {}", request.toString());
|
||||
}
|
||||
|
||||
} else if (obj instanceof Request) {
|
||||
final Request req = (Request)obj;
|
||||
final Command command = req.getCommand();
|
||||
if (command.getContextParam("logid") != null) {
|
||||
MDC.put("logcontextid", command.getContextParam("logid"));
|
||||
ThreadContext.put("logcontextid", command.getContextParam("logid"));
|
||||
}
|
||||
Answer answer = null;
|
||||
_inProgress.incrementAndGet();
|
||||
|
|
@ -884,17 +900,15 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
if (answer != null) {
|
||||
final Response response = new Response(req, answer);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Watch Sent: " + response.toString());
|
||||
}
|
||||
logger.debug("Watch Sent: {}", response.toString());
|
||||
try {
|
||||
task.getLink().send(response.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to send response: " + response.toString());
|
||||
logger.warn("Unable to send response: {}", response.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s_logger.warn("Ignoring an unknown task");
|
||||
logger.warn("Ignoring an unknown task");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +948,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
listener.wait(timeoutInMilliseconds);
|
||||
} catch (final InterruptedException e) {
|
||||
s_logger.warn("sendRequest is interrupted, exit waiting");
|
||||
logger.warn("sendRequest is interrupted, exit waiting");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -956,7 +970,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
try {
|
||||
_link.send(request.toBytes());
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to post agent control request: " + request.toString());
|
||||
logger.warn("Unable to post agent control request: {}", request.toString());
|
||||
throw new AgentControlChannelException("Unable to post agent control request due to " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1020,9 +1034,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Scheduling " + (_request instanceof Response ? "Ping" : "Watch Task"));
|
||||
}
|
||||
logger.trace("Scheduling {}", (_request instanceof Response ? "Ping" : "Watch Task"));
|
||||
try {
|
||||
if (_request instanceof Response) {
|
||||
_ugentTaskPool.submit(new ServerHandler(Task.Type.OTHER, _link, _request));
|
||||
|
|
@ -1030,7 +1042,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_link.schedule(new ServerHandler(Task.Type.OTHER, _link, _request));
|
||||
}
|
||||
} catch (final ClosedChannelException e) {
|
||||
s_logger.warn("Unable to schedule task because channel is closed");
|
||||
logger.warn("Unable to schedule task because channel is closed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1040,7 +1052,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
protected volatile boolean cancelled = false;
|
||||
|
||||
public StartupTask(final Link link) {
|
||||
s_logger.debug("Startup task created");
|
||||
logger.debug("Startup task created");
|
||||
_link = link;
|
||||
}
|
||||
|
||||
|
|
@ -1050,7 +1062,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
if (!cancelled) {
|
||||
cancelled = true;
|
||||
_startupWait = _startupWaitDefault;
|
||||
s_logger.debug("Startup task cancelled");
|
||||
logger.debug("Startup task cancelled");
|
||||
return super.cancel();
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1059,9 +1071,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
@Override
|
||||
protected synchronized void runInContext() {
|
||||
if (!cancelled) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("The startup command is now cancelled");
|
||||
}
|
||||
logger.info("The startup command is now cancelled");
|
||||
cancelled = true;
|
||||
_startup = null;
|
||||
_startupWait = _startupWaitDefault * 2;
|
||||
|
|
@ -1112,11 +1122,17 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
_executor.submit(new AgentRequestHandler(getType(), getLink(), request));
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to find this request ");
|
||||
logger.error("Unable to find this request ");
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("Error parsing task", e);
|
||||
logger.error("Error parsing task", e);
|
||||
}
|
||||
} else if (task.getType() == Task.Type.DISCONNECT) {
|
||||
try {
|
||||
// an issue has been found if reconnect immediately after disconnecting. please refer to https://github.com/apache/cloudstack/issues/8517
|
||||
// wait 5 seconds before reconnecting
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
reconnect(task.getLink());
|
||||
return;
|
||||
} else if (task.getType() == Task.Type.OTHER) {
|
||||
|
|
@ -1142,7 +1158,7 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
while (true) {
|
||||
try {
|
||||
if (_inProgress.get() == 0) {
|
||||
s_logger.debug("Running post certificate renewal task to restart services.");
|
||||
logger.debug("Running post certificate renewal task to restart services.");
|
||||
|
||||
// Let the resource perform any post certificate renewal cleanups
|
||||
_resource.executeRequest(new PostCertificateRenewalCommand());
|
||||
|
|
@ -1167,12 +1183,11 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
shell.launchNewAgent(resource);
|
||||
return;
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.debug("Other tasks are in progress, will retry post certificate renewal command after few seconds");
|
||||
}
|
||||
logger.debug("Other tasks are in progress, will retry post certificate renewal command after few seconds");
|
||||
|
||||
Thread.sleep(5000);
|
||||
} catch (final Exception e) {
|
||||
s_logger.warn("Failed to execute post certificate renewal command:", e);
|
||||
logger.warn("Failed to execute post certificate renewal command:", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1190,29 +1205,26 @@ public class Agent implements HandlerFactory, IAgentControl {
|
|||
}
|
||||
final String preferredHost = msList[0];
|
||||
final String connectedHost = _shell.getConnectedHost();
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Running preferred host checker task, connected host=" + connectedHost + ", preferred host=" + preferredHost);
|
||||
}
|
||||
logger.trace("Running preferred host checker task, connected host={}, preferred host={}", connectedHost, preferredHost);
|
||||
|
||||
if (preferredHost != null && !preferredHost.equals(connectedHost) && _link != null) {
|
||||
boolean isHostUp = true;
|
||||
try (final Socket socket = new Socket()) {
|
||||
socket.connect(new InetSocketAddress(preferredHost, _shell.getPort()), 5000);
|
||||
} catch (final IOException e) {
|
||||
isHostUp = false;
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Host: " + preferredHost + " is not reachable");
|
||||
}
|
||||
logger.trace("Host: {} is not reachable", preferredHost);
|
||||
|
||||
}
|
||||
if (isHostUp && _link != null && _inProgress.get() == 0) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Preferred host " + preferredHost + " is found to be reachable, trying to reconnect");
|
||||
}
|
||||
logger.debug("Preferred host {} is found to be reachable, trying to reconnect", preferredHost);
|
||||
|
||||
_shell.resetHostCounter();
|
||||
reconnect(_link);
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
s_logger.error("Error caught while attempting to connect to preferred host", t);
|
||||
logger.error("Error caught while attempting to connect to preferred host", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ import org.apache.commons.daemon.DaemonInitException;
|
|||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.File;
|
||||
|
|
@ -53,7 +54,7 @@ import java.util.Properties;
|
|||
import java.util.UUID;
|
||||
|
||||
public class AgentShell implements IAgentShell, Daemon {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class.getName());
|
||||
protected static Logger LOGGER = LogManager.getLogger(AgentShell.class);
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
|
||||
|
|
@ -221,7 +222,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
throw new ConfigurationException("Unable to find agent.properties.");
|
||||
}
|
||||
|
||||
s_logger.info("agent.properties found at " + file.getAbsolutePath());
|
||||
LOGGER.info("agent.properties found at {}", file.getAbsolutePath());
|
||||
|
||||
try {
|
||||
PropertiesUtil.loadFromFile(_properties, file);
|
||||
|
|
@ -349,7 +350,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
|
||||
@Override
|
||||
public void init(DaemonContext dc) throws DaemonInitException {
|
||||
s_logger.debug("Initializing AgentShell from JSVC");
|
||||
LOGGER.debug("Initializing AgentShell from JSVC");
|
||||
try {
|
||||
init(dc.getArguments());
|
||||
} catch (ConfigurationException ex) {
|
||||
|
|
@ -369,11 +370,11 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
}
|
||||
|
||||
if (null != file) {
|
||||
DOMConfigurator.configureAndWatch(file.getAbsolutePath());
|
||||
Configurator.initialize(null, file.getAbsolutePath());
|
||||
|
||||
s_logger.info("Agent started");
|
||||
LOGGER.info("Agent started");
|
||||
} else {
|
||||
s_logger.error("Could not start the Agent because the absolute path of the \"log4j-cloud.xml\" file cannot be determined.");
|
||||
LOGGER.error("Could not start the Agent because the absolute path of the \"log4j-cloud.xml\" file cannot be determined.");
|
||||
}
|
||||
|
||||
final Class<?> c = this.getClass();
|
||||
|
|
@ -381,19 +382,19 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
if (_version == null) {
|
||||
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
|
||||
}
|
||||
s_logger.info("Implementation Version is " + _version);
|
||||
LOGGER.info("Implementation Version is {}", _version);
|
||||
|
||||
loadProperties();
|
||||
parseCommand(args);
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
|
||||
for (String property : properties) {
|
||||
s_logger.debug("Found property: " + property);
|
||||
LOGGER.debug("Found property: {}", property);
|
||||
}
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to using properties file for storage");
|
||||
LOGGER.info("Defaulting to using properties file for storage");
|
||||
_storage = new PropertiesStorage();
|
||||
_storage.configure("Storage", new HashMap<String, Object>());
|
||||
|
||||
|
|
@ -403,14 +404,14 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
|
||||
}
|
||||
|
||||
s_logger.info("Defaulting to the constant time backoff algorithm");
|
||||
LOGGER.info("Defaulting to the constant time backoff algorithm");
|
||||
_backoff = new ConstantTimeBackoff();
|
||||
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
private void launchAgent() throws ConfigurationException {
|
||||
String resourceClassNames = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.RESOURCE);
|
||||
s_logger.trace("resource=" + resourceClassNames);
|
||||
LOGGER.trace("resource={}", resourceClassNames);
|
||||
if (resourceClassNames != null) {
|
||||
launchAgentFromClassInfo(resourceClassNames);
|
||||
return;
|
||||
|
|
@ -440,10 +441,10 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
private void launchAgentFromTypeInfo() throws ConfigurationException {
|
||||
String typeInfo = getProperty(null, "type");
|
||||
if (typeInfo == null) {
|
||||
s_logger.error("Unable to retrieve the type");
|
||||
LOGGER.error("Unable to retrieve the type");
|
||||
throw new ConfigurationException("Unable to retrieve the type of this agent.");
|
||||
}
|
||||
s_logger.trace("Launching agent based on type=" + typeInfo);
|
||||
LOGGER.trace("Launching agent based on type={}", typeInfo);
|
||||
}
|
||||
|
||||
public void launchNewAgent(ServerResource resource) throws ConfigurationException {
|
||||
|
|
@ -477,17 +478,17 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
}
|
||||
|
||||
if (ipv6disabled) {
|
||||
s_logger.info("Preferring IPv4 address family for agent connection");
|
||||
LOGGER.info("Preferring IPv4 address family for agent connection");
|
||||
System.setProperty("java.net.preferIPv4Stack", "true");
|
||||
if (ipv6prefer) {
|
||||
s_logger.info("ipv6prefer is set to true, but ipv6disabled is false. Not preferring IPv6 for agent connection");
|
||||
LOGGER.info("ipv6prefer is set to true, but ipv6disabled is false. Not preferring IPv6 for agent connection");
|
||||
}
|
||||
} else {
|
||||
if (ipv6prefer) {
|
||||
s_logger.info("Preferring IPv6 address family for agent connection");
|
||||
LOGGER.info("Preferring IPv6 address family for agent connection");
|
||||
System.setProperty("java.net.preferIPv6Addresses", "true");
|
||||
} else {
|
||||
s_logger.info("Using default Java settings for IPv6 preference for agent connection");
|
||||
LOGGER.info("Using default Java settings for IPv6 preference for agent connection");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -505,7 +506,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
String pidDir = getProperty(null, "piddir");
|
||||
|
||||
final String run = "agent." + instance + "pid";
|
||||
s_logger.debug("Checking to see if " + run + " exists.");
|
||||
LOGGER.debug("Checking to see if {} exists.", run);
|
||||
ProcessUtil.pidCheck(pidDir, run);
|
||||
|
||||
launchAgent();
|
||||
|
|
@ -514,11 +515,11 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
while (!_exit)
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
s_logger.debug("[ignored] AgentShell was interrupted.");
|
||||
LOGGER.debug("[ignored] AgentShell was interrupted.");
|
||||
}
|
||||
|
||||
} catch (final Exception e) {
|
||||
s_logger.error("Unable to start agent: ", e);
|
||||
LOGGER.error("Unable to start agent: ", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
|
|
@ -535,7 +536,7 @@ public class AgentShell implements IAgentShell, Daemon {
|
|||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
s_logger.debug("Initializing AgentShell from main");
|
||||
LOGGER.debug("Initializing AgentShell from main");
|
||||
AgentShell shell = new AgentShell();
|
||||
shell.init(args);
|
||||
shell.start();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ import java.util.Map;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.dao.StorageComponent;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
|
|
@ -36,7 +37,7 @@ import com.cloud.utils.PropertiesUtil;
|
|||
* path to the properties _file | String | db/db.properties || * }
|
||||
**/
|
||||
public class PropertiesStorage implements StorageComponent {
|
||||
private static final Logger s_logger = Logger.getLogger(PropertiesStorage.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
Properties _properties = new Properties();
|
||||
File _file;
|
||||
String _name;
|
||||
|
|
@ -49,7 +50,7 @@ public class PropertiesStorage implements StorageComponent {
|
|||
@Override
|
||||
public synchronized void persist(String key, String value) {
|
||||
if (!loadFromFile(_file)) {
|
||||
s_logger.error("Failed to load changes and then write to them");
|
||||
logger.error("Failed to load changes and then write to them");
|
||||
}
|
||||
_properties.setProperty(key, value);
|
||||
FileOutputStream output = null;
|
||||
|
|
@ -59,7 +60,7 @@ public class PropertiesStorage implements StorageComponent {
|
|||
output.flush();
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
s_logger.error("Uh-oh: ", e);
|
||||
logger.error("Uh-oh: ", e);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(output);
|
||||
}
|
||||
|
|
@ -70,10 +71,10 @@ public class PropertiesStorage implements StorageComponent {
|
|||
PropertiesUtil.loadFromFile(_properties, file);
|
||||
_file = file;
|
||||
} catch (FileNotFoundException e) {
|
||||
s_logger.error("How did we get here? ", e);
|
||||
logger.error("How did we get here? ", e);
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
s_logger.error("IOException: ", e);
|
||||
logger.error("IOException: ", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -92,11 +93,12 @@ public class PropertiesStorage implements StorageComponent {
|
|||
file = new File(path);
|
||||
try {
|
||||
if (!file.createNewFile()) {
|
||||
s_logger.error("Unable to create _file: " + file.getAbsolutePath());
|
||||
logger.error("Unable to create _file: {}", file.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.error("Unable to create _file: " + file.getAbsolutePath(), e);
|
||||
logger.error("Unable to create file: {}", file.getAbsolutePath());
|
||||
logger.debug("IOException while trying to create file: {}", file.getAbsolutePath(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,13 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
public class DhcpProtocolParserServer extends Thread {
|
||||
private static final Logger s_logger = Logger.getLogger(DhcpProtocolParserServer.class);;
|
||||
protected Logger logger = LogManager.getLogger(DhcpProtocolParserServer.class);;
|
||||
protected ExecutorService _executor;
|
||||
private int dhcpServerPort = 67;
|
||||
private int bufferSize = 300;
|
||||
|
|
@ -54,7 +55,7 @@ public class DhcpProtocolParserServer extends Thread {
|
|||
dhcpSocket.receive(dgp);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
s_logger.debug(e.getMessage());
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,161 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.agent.dhcp;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
public class FakeDhcpSnooper implements DhcpSnooper {
|
||||
private static final Logger s_logger = Logger.getLogger(FakeDhcpSnooper.class);
|
||||
private Queue<String> _ipAddresses = new ConcurrentLinkedQueue<String>();
|
||||
private Map<String, String> _macIpMap = new ConcurrentHashMap<String, String>();
|
||||
private Map<String, InetAddress> _vmIpMap = new ConcurrentHashMap<String, InetAddress>();
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
String guestIpRange = (String)params.get("guest.ip.range");
|
||||
if (guestIpRange != null) {
|
||||
String[] guestIps = guestIpRange.split("-");
|
||||
if (guestIps.length == 2) {
|
||||
long start = NetUtils.ip2Long(guestIps[0]);
|
||||
long end = NetUtils.ip2Long(guestIps[1]);
|
||||
while (start <= end) {
|
||||
_ipAddresses.offer(NetUtils.long2Ip(start++));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "FakeDhcpSnooper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetAddress getIPAddr(String macAddr, String vmName) {
|
||||
String ipAddr = _ipAddresses.poll();
|
||||
if (ipAddr == null) {
|
||||
s_logger.warn("No ip addresses left in queue");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
InetAddress inetAddr = InetAddress.getByName(ipAddr);
|
||||
_macIpMap.put(macAddr.toLowerCase(), ipAddr);
|
||||
_vmIpMap.put(vmName, inetAddr);
|
||||
s_logger.info("Got ip address " + ipAddr + " for vm " + vmName + " mac=" + macAddr.toLowerCase());
|
||||
return inetAddr;
|
||||
} catch (UnknownHostException e) {
|
||||
s_logger.warn("Failed to get InetAddress for " + ipAddr);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup(String macAddr, String vmName) {
|
||||
try {
|
||||
if (macAddr == null) {
|
||||
return;
|
||||
}
|
||||
InetAddress inetAddr = _vmIpMap.remove(vmName);
|
||||
String ipAddr = inetAddr.getHostName();
|
||||
for (Map.Entry<String, String> entry : _macIpMap.entrySet()) {
|
||||
if (entry.getValue().equalsIgnoreCase(ipAddr)) {
|
||||
macAddr = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ipAddr = _macIpMap.remove(macAddr);
|
||||
|
||||
s_logger.info("Cleaning up for mac address: " + macAddr + " ip=" + ipAddr + " inetAddr=" + inetAddr);
|
||||
if (ipAddr != null) {
|
||||
_ipAddresses.offer(ipAddr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to cleanup: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, InetAddress> syncIpAddr() {
|
||||
return _vmIpMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeMacTable(List<Pair<String, String>> macVmNameList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetAddress getDhcpServerIP() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigParams(Map<String, Object> params) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConfigParams() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRunLevel() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -22,14 +22,15 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
||||
public class MockVmMgr implements VmMgr {
|
||||
private static final Logger s_logger = Logger.getLogger(MockVmMgr.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private static final int DEFAULT_DOM0_MEM_MB = 128;
|
||||
private static final Random randSeed = new Random();
|
||||
|
|
@ -56,14 +57,14 @@ public class MockVmMgr implements VmMgr {
|
|||
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP,
|
||||
String publicMac, String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword) {
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Start VM. name: " + vmName + ", vnet: " + vnetId + ", dns: " + dns);
|
||||
sb.append(", privateIP: " + privateIP + ", privateMac: " + privateMac + ", privateMask: " + privateMask);
|
||||
sb.append(", publicIP: " + publicIP + ", publicMac: " + publicMac + ", publicMask: " + publicMask);
|
||||
sb.append(", cpu count: " + cpuCount + ", cpuUtilization: " + cpuUtilization + ", ram : " + ramSize);
|
||||
sb.append(", localPath: " + localPath);
|
||||
s_logger.info(sb.toString());
|
||||
logger.info(sb.toString());
|
||||
}
|
||||
|
||||
synchronized (this) {
|
||||
|
|
@ -86,8 +87,7 @@ public class MockVmMgr implements VmMgr {
|
|||
|
||||
@Override
|
||||
public String stopVM(String vmName, boolean force) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Stop VM. name: " + vmName);
|
||||
logger.info("Stop VM. name: {}", vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
|
|
@ -102,8 +102,7 @@ public class MockVmMgr implements VmMgr {
|
|||
|
||||
@Override
|
||||
public String rebootVM(String vmName) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Reboot VM. name: " + vmName);
|
||||
logger.info("Reboot VM. name: {}", vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
|
|
@ -115,8 +114,7 @@ public class MockVmMgr implements VmMgr {
|
|||
|
||||
@Override
|
||||
public boolean migrate(String vmName, String params) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Migrate VM. name: " + vmName);
|
||||
logger.info("Migrate VM. name: {}", vmName);
|
||||
|
||||
synchronized (this) {
|
||||
MockVm vm = vms.get(vmName);
|
||||
|
|
@ -258,13 +256,13 @@ public class MockVmMgr implements VmMgr {
|
|||
vm = vms.get(vmName);
|
||||
if (vm == null) {
|
||||
if (ramSize > getHostFreeMemory()) {
|
||||
s_logger.debug("host is out of memory");
|
||||
logger.debug("host is out of memory");
|
||||
throw new CloudRuntimeException("Host is out of Memory");
|
||||
}
|
||||
|
||||
int vncPort = allocVncPort();
|
||||
if (vncPort < 0) {
|
||||
s_logger.debug("Unable to allocate VNC port");
|
||||
logger.debug("Unable to allocate VNC port");
|
||||
throw new CloudRuntimeException("Unable to allocate vnc port");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
package com.cloud.agent.properties;
|
||||
|
||||
import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
|
||||
/**
|
||||
* Class of constant agent's properties available to configure on
|
||||
* "agent.properties".
|
||||
|
|
@ -502,6 +504,15 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Integer> HOST_RESERVED_MEM_MB = new Property<>("host.reserved.mem.mb", 1024);
|
||||
|
||||
/**
|
||||
* How many host CPUs to reserve for non-allocation.<br>
|
||||
* This can be used to set aside CPU cores on the host for other tasks, such as running hyperconverged storage<br>
|
||||
* processes, etc.
|
||||
* Data type: Integer.<br>
|
||||
* Default value: <code>0</code>
|
||||
*/
|
||||
public static final Property<Integer> HOST_RESERVED_CPU_CORE_COUNT = new Property<>("host.reserved.cpu.count", 0);
|
||||
|
||||
/**
|
||||
* The model of Watchdog timer to present to the Guest.<br>
|
||||
* For all models refer to the libvirt documentation.<br>
|
||||
|
|
@ -530,10 +541,10 @@ public class AgentProperties{
|
|||
/**
|
||||
* Heartbeat update timeout (in ms).<br>
|
||||
* Depending on the use case, this timeout might need increasing/decreasing.<br>
|
||||
* Data type: Integer.<br>
|
||||
* Default value: <code>60000</code>
|
||||
* Data type: Long.<br>
|
||||
* Default value: <code>60000L</code>
|
||||
*/
|
||||
public static final Property<Integer> HEARTBEAT_UPDATE_TIMEOUT = new Property<>("heartbeat.update.timeout", 60000);
|
||||
public static final Property<Long> HEARTBEAT_UPDATE_TIMEOUT = new Property<>("heartbeat.update.timeout", 60000L);
|
||||
|
||||
/**
|
||||
* The timeout (in seconds) to retrieve the target's domain ID when migrating a VM with KVM. <br>
|
||||
|
|
@ -648,6 +659,14 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Integer> STOP_SCRIPT_TIMEOUT = new Property<>("stop.script.timeout", 120);
|
||||
|
||||
/**
|
||||
* Time (in seconds) to wait for scripts to complete.<br>
|
||||
* This is currently used only while checking if the host supports UEFI.<br>
|
||||
* Data type: Integer.<br>
|
||||
* Default value: <code>60</code>
|
||||
*/
|
||||
public static final Property<Integer> AGENT_SCRIPT_TIMEOUT = new Property<>("agent.script.timeout", 60);
|
||||
|
||||
/**
|
||||
* Definition of VMs video model type.<br>
|
||||
* Data type: String.<br>
|
||||
|
|
@ -676,6 +695,13 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Boolean> DEVELOPER = new Property<>("developer", false);
|
||||
|
||||
/**
|
||||
* If set to "true", the agent will register for libvirt domain events, allowing for immediate updates on crashed or unexpectedly
|
||||
* stopped VMs. Experimental, requires agent restart.
|
||||
* Default value: <code>false</code>
|
||||
*/
|
||||
public static final Property<Boolean> LIBVIRT_EVENTS_ENABLED = new Property<>("libvirt.events.enabled", false);
|
||||
|
||||
/**
|
||||
* Can only be used if developer = true. This property is used to define the local bridge name and private network name.<br>
|
||||
* Data type: String.<br>
|
||||
|
|
@ -724,6 +750,13 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Integer> IOTHREADS = new Property<>("iothreads", 1);
|
||||
|
||||
/**
|
||||
* Enable verbose mode for virt-v2v Instance Conversion from VMware to KVM
|
||||
* Data type: Boolean.<br>
|
||||
* Default value: <code>false</code>
|
||||
*/
|
||||
public static final Property<Boolean> VIRTV2V_VERBOSE_ENABLED = new Property<>("virtv2v.verbose.enabled", false);
|
||||
|
||||
/**
|
||||
* BGP controll CIDR
|
||||
* Data type: String.<br>
|
||||
|
|
@ -731,6 +764,52 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<String> CONTROL_CIDR = new Property<>("control.cidr", "169.254.0.0/16");
|
||||
|
||||
/**
|
||||
* Time interval (in milliseconds) between KVM heartbeats. <br>
|
||||
* This property is for KVM only.
|
||||
* Data type: Long.<br>
|
||||
* Default value: <code>60000l</code>
|
||||
*/
|
||||
public static final Property<Long> KVM_HEARTBEAT_UPDATE_FREQUENCY = new Property<>("kvm.heartbeat.update.frequency", 60000L);
|
||||
|
||||
/**
|
||||
* Number of maximum tries to KVM heartbeats. <br>
|
||||
* This property is for KVM only.
|
||||
* Data type: Long.<br>
|
||||
* Default value: <code>5l</code>
|
||||
*/
|
||||
public static final Property<Long> KVM_HEARTBEAT_UPDATE_MAX_TRIES = new Property<>("kvm.heartbeat.update.max.tries", 5L);
|
||||
|
||||
/**
|
||||
* Time amount (in milliseconds) for the KVM heartbeat retry sleep. <br>
|
||||
* This property is for KVM only.
|
||||
* Data type: Long.<br>
|
||||
* Default value: <code>10000l</code>
|
||||
*/
|
||||
public static final Property<Long> KVM_HEARTBEAT_UPDATE_RETRY_SLEEP = new Property<>("kvm.heartbeat.update.retry.sleep", 10000L);
|
||||
|
||||
/**
|
||||
* Timeout (in milliseconds) of the KVM heartbeat checker. <br>
|
||||
* This property is for KVM only.
|
||||
* Data type: Long.<br>
|
||||
* Default value: <code>360000l</code>
|
||||
*/
|
||||
public static final Property<Long> KVM_HEARTBEAT_CHECKER_TIMEOUT = new Property<>("kvm.heartbeat.checker.timeout", 360000L);
|
||||
|
||||
/**
|
||||
* Keystore passphrase
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>null</code>
|
||||
*/
|
||||
public static final Property<String> KEYSTORE_PASSPHRASE = new Property<>(KeyStoreUtils.KS_PASSPHRASE_PROPERTY, null, String.class);
|
||||
|
||||
/**
|
||||
* Implicit host tags
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>null</code>
|
||||
*/
|
||||
public static final Property<String> HOST_TAGS = new Property<>("host.tags", null, String.class);
|
||||
|
||||
public static class Property <T>{
|
||||
private String name;
|
||||
private T defaultValue;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ import org.apache.commons.beanutils.ConvertUtils;
|
|||
import org.apache.commons.beanutils.converters.IntegerConverter;
|
||||
import org.apache.commons.beanutils.converters.LongConverter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
/**
|
||||
* This class provides a facility to read the agent's properties file and get
|
||||
|
|
@ -31,7 +32,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class AgentPropertiesFileHandler {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AgentPropertiesFileHandler.class);
|
||||
protected static Logger LOGGER = LogManager.getLogger(AgentPropertiesFileHandler.class);
|
||||
|
||||
/**
|
||||
* This method reads the property in the agent.properties file.
|
||||
|
|
@ -47,7 +48,7 @@ public class AgentPropertiesFileHandler {
|
|||
File agentPropertiesFile = PropertiesUtil.findConfigFile(KeyStoreUtils.AGENT_PROPSFILE);
|
||||
|
||||
if (agentPropertiesFile == null) {
|
||||
logger.debug(String.format("File [%s] was not found, we will use default defined values. Property [%s]: [%s].", KeyStoreUtils.AGENT_PROPSFILE, name, defaultValue));
|
||||
LOGGER.debug("File [{}] was not found, we will use default defined values. Property [{}]: [{}].", KeyStoreUtils.AGENT_PROPSFILE, name, defaultValue);
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
|
@ -55,7 +56,7 @@ public class AgentPropertiesFileHandler {
|
|||
try {
|
||||
String configValue = PropertiesUtil.loadFromFile(agentPropertiesFile).getProperty(name);
|
||||
if (StringUtils.isBlank(configValue)) {
|
||||
logger.debug(String.format("Property [%s] has empty or null value. Using default value [%s].", name, defaultValue));
|
||||
LOGGER.debug("Property [{}] has empty or null value. Using default value [{}].", name, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
|
@ -67,11 +68,11 @@ public class AgentPropertiesFileHandler {
|
|||
ConvertUtils.register(new LongConverter(defaultValue), Long.class);
|
||||
}
|
||||
|
||||
logger.debug(String.format("Property [%s] was altered. Now using the value [%s].", name, configValue));
|
||||
LOGGER.debug("Property [{}] was altered. Now using the value [{}].", name, configValue);
|
||||
return (T)ConvertUtils.convert(configValue, property.getTypeClass());
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.debug(String.format("Failed to get property [%s]. Using default value [%s].", name, defaultValue), ex);
|
||||
LOGGER.debug("Failed to get property [{}]. Using default value [{}].", name, defaultValue, ex);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import javax.naming.ConfigurationException;
|
|||
|
||||
import com.cloud.agent.api.proxy.AllowConsoleAccessCommand;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.Agent.ExitStatus;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
|
|
@ -81,18 +80,17 @@ import com.google.gson.Gson;
|
|||
*
|
||||
*/
|
||||
public class ConsoleProxyResource extends ServerResourceBase implements ServerResource {
|
||||
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
private Thread _consoleProxyMain = null;
|
||||
private final Properties properties = new Properties();
|
||||
private Thread consoleProxyMain = null;
|
||||
|
||||
long _proxyVmId;
|
||||
int _proxyPort;
|
||||
long proxyVmId;
|
||||
int proxyPort;
|
||||
|
||||
String _localgw;
|
||||
String _eth1ip;
|
||||
String _eth1mask;
|
||||
String _pubIp;
|
||||
String localGateway;
|
||||
String eth1Ip;
|
||||
String eth1Mask;
|
||||
String publicIp;
|
||||
|
||||
@Override
|
||||
public Answer executeRequest(final Command cmd) {
|
||||
|
|
@ -101,7 +99,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
|
||||
return execute((WatchConsoleProxyLoadCommand)cmd);
|
||||
} else if (cmd instanceof ReadyCommand) {
|
||||
s_logger.info("Receive ReadyCommand, response with ReadyAnswer");
|
||||
logger.info("Receive ReadyCommand, response with ReadyAnswer");
|
||||
return new ReadyAnswer((ReadyCommand)cmd);
|
||||
} else if (cmd instanceof CheckHealthCommand) {
|
||||
return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
|
||||
|
|
@ -123,13 +121,13 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
return new Answer(cmd);
|
||||
} catch (SecurityException | NoSuchMethodException | ClassNotFoundException | InvocationTargetException | IllegalAccessException e) {
|
||||
String errorMsg = "Unable to add allowed session due to: " + e.getMessage();
|
||||
s_logger.error(errorMsg, e);
|
||||
logger.error(errorMsg, e);
|
||||
return new Answer(cmd, false, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private Answer execute(StartConsoleProxyAgentHttpHandlerCommand cmd) {
|
||||
s_logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
logger.info("Invoke launchConsoleProxy() in responding to StartConsoleProxyAgentHttpHandlerCommand");
|
||||
launchConsoleProxy(cmd.getKeystoreBits(), cmd.getKeystorePassword(), cmd.getEncryptorPassword(), cmd.isSourceIpCheckEnabled());
|
||||
return new Answer(cmd);
|
||||
}
|
||||
|
|
@ -140,7 +138,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
{
|
||||
out.write("0");
|
||||
} catch (IOException e) {
|
||||
s_logger.warn("Unable to disable rp_filter");
|
||||
logger.warn("Unable to disable rp_filter");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,12 +175,12 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
try {
|
||||
is.close();
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Exception when closing , console proxy address : " + proxyManagementIp);
|
||||
logger.warn("Exception when closing , console proxy address : {}", proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
s_logger.warn("Unable to open console proxy command port url, console proxy address : " + proxyManagementIp);
|
||||
logger.warn("Unable to open console proxy command port url, console proxy address : {}", proxyManagementIp);
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
|
@ -203,10 +201,10 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
public synchronized StartupCommand[] initialize() {
|
||||
final StartupProxyCommand cmd = new StartupProxyCommand();
|
||||
fillNetworkInformation(cmd);
|
||||
cmd.setProxyPort(_proxyPort);
|
||||
cmd.setProxyVmId(_proxyVmId);
|
||||
if (_pubIp != null)
|
||||
cmd.setPublicIpAddress(_pubIp);
|
||||
cmd.setProxyPort(proxyPort);
|
||||
cmd.setProxyVmId(proxyVmId);
|
||||
if (publicIp != null)
|
||||
cmd.setPublicIpAddress(publicIp);
|
||||
return new StartupCommand[] {cmd};
|
||||
}
|
||||
|
||||
|
|
@ -221,79 +219,78 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_localgw = (String)params.get("localgw");
|
||||
_eth1mask = (String)params.get("eth1mask");
|
||||
_eth1ip = (String)params.get("eth1ip");
|
||||
if (_eth1ip != null) {
|
||||
localGateway = (String)params.get("localgw");
|
||||
eth1Mask = (String)params.get("eth1mask");
|
||||
eth1Ip = (String)params.get("eth1ip");
|
||||
if (eth1Ip != null) {
|
||||
params.put("private.network.device", "eth1");
|
||||
} else {
|
||||
s_logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
|
||||
logger.info("eth1ip parameter has not been configured, assuming that we are not inside a system vm");
|
||||
}
|
||||
|
||||
String eth2ip = (String)params.get("eth2ip");
|
||||
if (eth2ip != null) {
|
||||
params.put("public.network.device", "eth2");
|
||||
} else {
|
||||
s_logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
|
||||
logger.info("eth2ip parameter is not found, assuming that we are not inside a system vm");
|
||||
}
|
||||
|
||||
super.configure(name, params);
|
||||
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
_properties.put(entry.getKey(), entry.getValue());
|
||||
properties.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String value = (String)params.get("premium");
|
||||
if (value != null && value.equals("premium"))
|
||||
_proxyPort = 443;
|
||||
proxyPort = 443;
|
||||
else {
|
||||
value = (String)params.get("consoleproxy.httpListenPort");
|
||||
_proxyPort = NumbersUtil.parseInt(value, 80);
|
||||
proxyPort = NumbersUtil.parseInt(value, 80);
|
||||
}
|
||||
|
||||
value = (String)params.get("proxy_vm");
|
||||
_proxyVmId = NumbersUtil.parseLong(value, 0);
|
||||
proxyVmId = NumbersUtil.parseLong(value, 0);
|
||||
|
||||
if (_localgw != null) {
|
||||
if (localGateway != null) {
|
||||
String mgmtHosts = (String)params.get("host");
|
||||
if (_eth1ip != null) {
|
||||
if (eth1Ip != null) {
|
||||
for (final String mgmtHost : mgmtHosts.split(",")) {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost);
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, mgmtHost);
|
||||
}
|
||||
String internalDns1 = (String) params.get("internaldns1");
|
||||
if (internalDns1 == null) {
|
||||
s_logger.warn("No DNS entry found during configuration of ConsoleProxy");
|
||||
logger.warn("No DNS entry found during configuration of ConsoleProxy");
|
||||
} else {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, internalDns1);
|
||||
}
|
||||
String internalDns2 = (String) params.get("internaldns2");
|
||||
if (internalDns2 != null) {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2);
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, internalDns2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_pubIp = (String)params.get("public.ip");
|
||||
publicIp = (String)params.get("public.ip");
|
||||
|
||||
value = (String)params.get("disable_rp_filter");
|
||||
if (value != null && value.equalsIgnoreCase("true")) {
|
||||
disableRpFilter();
|
||||
}
|
||||
|
||||
if (s_logger.isInfoEnabled())
|
||||
s_logger.info("Receive proxyVmId in ConsoleProxyResource configuration as " + _proxyVmId);
|
||||
logger.info("Receive proxyVmId in ConsoleProxyResource configuration as {}", proxyVmId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) {
|
||||
s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr);
|
||||
logger.debug("addRouteToInternalIp: localgw={}, eth1ip={}, eth1mask={}, destIp={}", localgw, eth1ip, eth1mask, destIpOrCidr);
|
||||
if (destIpOrCidr == null) {
|
||||
s_logger.debug("addRouteToInternalIp: destIp is null");
|
||||
logger.debug("addRouteToInternalIp: destIp is null");
|
||||
return;
|
||||
}
|
||||
if (!NetUtils.isValidIp4(destIpOrCidr) && !NetUtils.isValidIp4Cidr(destIpOrCidr)) {
|
||||
s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr);
|
||||
logger.warn(" destIp is not a valid ip address or cidr destIp={}", destIpOrCidr);
|
||||
return;
|
||||
}
|
||||
boolean inSameSubnet = false;
|
||||
|
|
@ -301,75 +298,75 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
if (eth1ip != null && eth1mask != null) {
|
||||
inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask);
|
||||
} else {
|
||||
s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask);
|
||||
logger.warn("addRouteToInternalIp: unable to determine same subnet: eth1ip={}, dest ip={}, eth1mask={}", eth1ip, destIpOrCidr, eth1mask);
|
||||
}
|
||||
} else {
|
||||
inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask));
|
||||
}
|
||||
if (inSameSubnet) {
|
||||
s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip);
|
||||
logger.debug("addRouteToInternalIp: dest ip {} is in the same subnet as eth1 ip {}", destIpOrCidr, eth1ip);
|
||||
return;
|
||||
}
|
||||
Script command = new Script("/bin/bash", s_logger);
|
||||
Script command = new Script("/bin/bash", logger);
|
||||
command.add("-c");
|
||||
command.add("ip route delete " + destIpOrCidr);
|
||||
command.execute();
|
||||
command = new Script("/bin/bash", s_logger);
|
||||
command = new Script("/bin/bash", logger);
|
||||
command.add("-c");
|
||||
command.add("ip route add " + destIpOrCidr + " via " + localgw);
|
||||
String result = command.execute();
|
||||
if (result != null) {
|
||||
s_logger.warn("Error in configuring route to internal ip err=" + result);
|
||||
logger.warn("Error in configuring route to internal ip err={}", result);
|
||||
} else {
|
||||
s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw);
|
||||
logger.debug("addRouteToInternalIp: added route to internal ip={} via {}", destIpOrCidr, localgw);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
return name;
|
||||
}
|
||||
|
||||
private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, final String encryptorPassword, final Boolean isSourceIpCheckEnabled) {
|
||||
final Object resource = this;
|
||||
s_logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
if (_consoleProxyMain == null) {
|
||||
s_logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password=" + encryptorPassword);
|
||||
_consoleProxyMain = new Thread(new ManagedContextRunnable() {
|
||||
logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
if (consoleProxyMain == null) {
|
||||
logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", encryptorPassword);
|
||||
consoleProxyMain = new Thread(new ManagedContextRunnable() {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
try {
|
||||
s_logger.info("Invoke startWithContext()");
|
||||
logger.info("Invoke startWithContext()");
|
||||
Method method = consoleProxyClazz.getMethod("startWithContext", Properties.class, Object.class, byte[].class, String.class, String.class, Boolean.class);
|
||||
method.invoke(null, _properties, resource, ksBits, ksPassword, encryptorPassword, isSourceIpCheckEnabled);
|
||||
method.invoke(null, properties, resource, ksBits, ksPassword, encryptorPassword, isSourceIpCheckEnabled);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (NoSuchMethodException e) {
|
||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
logger.error("Unable to launch console proxy due to InvocationTargetException {}", e.getTargetException().toString(), e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
||||
logger.error("Unable to launch console proxy due to ClassNotFoundException");
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
}, "Console-Proxy-Main");
|
||||
_consoleProxyMain.setDaemon(true);
|
||||
_consoleProxyMain.start();
|
||||
consoleProxyMain.setDaemon(true);
|
||||
consoleProxyMain.start();
|
||||
} else {
|
||||
s_logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
logger.info("com.cloud.consoleproxy.ConsoleProxy is already running");
|
||||
|
||||
try {
|
||||
Class<?> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
|
||||
|
|
@ -378,22 +375,22 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
methodSetup = consoleProxyClazz.getMethod("setIsSourceIpCheckEnabled", Boolean.class);
|
||||
methodSetup.invoke(null, isSourceIpCheckEnabled);
|
||||
} catch (SecurityException e) {
|
||||
s_logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
logger.error("Unable to launch console proxy due to SecurityException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (NoSuchMethodException e) {
|
||||
s_logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
logger.error("Unable to launch console proxy due to NoSuchMethodException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalArgumentException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalArgumentException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (IllegalAccessException e) {
|
||||
s_logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
logger.error("Unable to launch console proxy due to IllegalAccessException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (InvocationTargetException e) {
|
||||
s_logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
logger.error("Unable to launch console proxy due to InvocationTargetException " + e.getTargetException().toString(), e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
} catch (final ClassNotFoundException e) {
|
||||
s_logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
|
||||
logger.error("Unable to launch console proxy due to ClassNotFoundException", e);
|
||||
System.exit(ExitStatus.Error.value());
|
||||
}
|
||||
}
|
||||
|
|
@ -420,39 +417,36 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
result.setTunnelUrl(authAnswer.getTunnelUrl());
|
||||
result.setTunnelSession(authAnswer.getTunnelSession());
|
||||
} else {
|
||||
s_logger.error("Authentication failed for vm: " + vmId + " with sid: " + sid);
|
||||
logger.error("Authentication failed for vm: {} with sid: {}", vmId, sid);
|
||||
}
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error("Unable to send out console access authentication request due to " + e.getMessage(), e);
|
||||
logger.error("Unable to send out console access authentication request due to {}", e.getMessage(), e);
|
||||
}
|
||||
|
||||
return new Gson().toJson(result);
|
||||
}
|
||||
|
||||
public void reportLoadInfo(String gsonLoadInfo) {
|
||||
ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(_proxyVmId, gsonLoadInfo);
|
||||
ConsoleProxyLoadReportCommand cmd = new ConsoleProxyLoadReportCommand(proxyVmId, gsonLoadInfo);
|
||||
try {
|
||||
getAgentControl().postRequest(cmd);
|
||||
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Report proxy load info, proxy : " + _proxyVmId + ", load: " + gsonLoadInfo);
|
||||
logger.debug("Report proxy load info, proxy : {}, load: {}", proxyVmId, gsonLoadInfo);
|
||||
} catch (AgentControlChannelException e) {
|
||||
s_logger.error("Unable to send out load info due to " + e.getMessage(), e);
|
||||
logger.error("Unable to send out load info due to {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureRoute(String address) {
|
||||
if (_localgw != null) {
|
||||
if (s_logger.isDebugEnabled())
|
||||
s_logger.debug("Ensure route for " + address + " via " + _localgw);
|
||||
if (localGateway != null) {
|
||||
logger.debug("Ensure route for {} via {}", address, localGateway);
|
||||
|
||||
// this method won't be called in high frequency, serialize access
|
||||
// to script execution
|
||||
synchronized (this) {
|
||||
try {
|
||||
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, address);
|
||||
addRouteToInternalIpOrCidr(localGateway, eth1Ip, eth1Mask, address);
|
||||
} catch (Throwable e) {
|
||||
s_logger.warn("Unexpected exception while adding internal route to " + address, e);
|
||||
logger.warn("Unexpected exception while adding internal route to {}", address, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,4 +350,16 @@ public class AgentShellTest {
|
|||
|
||||
Mockito.verify(agentShellSpy).setHosts(expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateAndGetConnectedHost() {
|
||||
String expected = "test";
|
||||
|
||||
AgentShell shell = new AgentShell();
|
||||
shell.setHosts("test");
|
||||
shell.getNextHost();
|
||||
shell.updateConnectedHost();
|
||||
|
||||
Assert.assertEquals(expected, shell.getConnectedHost());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
mock-maker-inline
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.19.0.0-SNAPSHOT</version>
|
||||
<version>4.20.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
@ -36,6 +36,11 @@
|
|||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-math3</artifactId>
|
||||
<version>${cs.commons-math3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ 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;
|
||||
|
||||
/**
|
||||
* implemented by classes that extends the Command class. Command specifies
|
||||
|
|
@ -27,6 +29,8 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
|
|||
*/
|
||||
public abstract class Command {
|
||||
|
||||
protected transient Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public static enum OnError {
|
||||
Continue, Stop
|
||||
}
|
||||
|
|
@ -47,6 +51,13 @@ public abstract class Command {
|
|||
return wait;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the time in seconds that the agent will wait before waiting for an answer from the endpoint.
|
||||
* The actual wait time is twice the value of this variable.
|
||||
* See {@link com.cloud.agent.manager.AgentAttache#send(com.cloud.agent.transport.Request, int) AgentAttache#send} implementation for more details.
|
||||
*
|
||||
* @param wait
|
||||
**/
|
||||
public void setWait(int wait) {
|
||||
this.wait = wait;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
@ -41,7 +41,7 @@ public @interface LogLevel {
|
|||
}
|
||||
|
||||
public boolean enabled(Logger logger) {
|
||||
return _level != Level.OFF && logger.isEnabledFor(_level);
|
||||
return _level != Level.OFF && logger.isEnabled(_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@ public class StoragePoolInfo {
|
|||
this.details = details;
|
||||
}
|
||||
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, StoragePoolType poolType, long capacityBytes, long availableBytes,
|
||||
Map<String, String> details, String name) {
|
||||
this(uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
|
||||
this.details = details;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getCapacityBytes() {
|
||||
return capacityBytes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ import org.apache.cloudstack.utils.security.ParserUtils;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
|
@ -63,7 +64,7 @@ import com.cloud.utils.compression.CompressionUtil;
|
|||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class OVFHelper {
|
||||
private static final Logger s_logger = Logger.getLogger(OVFHelper.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private final OVFParser ovfParser;
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ public class OVFHelper {
|
|||
boolean password = StringUtils.isNotBlank(passStr) && passStr.equalsIgnoreCase("true");
|
||||
String label = ovfParser.getChildNodeValue(node, "Label");
|
||||
String description = ovfParser.getChildNodeValue(node, "Description");
|
||||
s_logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category)
|
||||
logger.debug("Creating OVF property index " + index + (category == null ? "" : " for category " + category)
|
||||
+ " with key = " + key);
|
||||
return new OVFPropertyTO(key, type, value, qualifiers, userConfigurable,
|
||||
label, description, password, index, category);
|
||||
|
|
@ -151,7 +152,7 @@ public class OVFHelper {
|
|||
if (child.getNodeName().equalsIgnoreCase("Category") ||
|
||||
child.getNodeName().endsWith(":Category")) {
|
||||
lastCategoryFound = child.getTextContent();
|
||||
s_logger.info("Category found " + lastCategoryFound);
|
||||
logger.info("Category found " + lastCategoryFound);
|
||||
} else if (child.getNodeName().equalsIgnoreCase("Property") ||
|
||||
child.getNodeName().endsWith(":Property")) {
|
||||
OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound);
|
||||
|
|
@ -249,13 +250,13 @@ public class OVFHelper {
|
|||
int diskNumber = 0;
|
||||
for (OVFVirtualHardwareItemTO diskItem : diskHardwareItems) {
|
||||
if (StringUtils.isBlank(diskItem.getHostResource())) {
|
||||
s_logger.error("Missing disk information for hardware item " + diskItem.getElementName() + " " + diskItem.getInstanceId());
|
||||
logger.error("Missing disk information for hardware item " + diskItem.getElementName() + " " + diskItem.getInstanceId());
|
||||
continue;
|
||||
}
|
||||
String diskId = extractDiskIdFromDiskHostResource(diskItem.getHostResource());
|
||||
OVFDisk diskDefinition = getDiskDefinitionFromDiskId(diskId, disks);
|
||||
if (diskDefinition == null) {
|
||||
s_logger.error("Missing disk definition for disk ID " + diskId);
|
||||
logger.error("Missing disk definition for disk ID " + diskId);
|
||||
}
|
||||
OVFFile fileDefinition = getFileDefinitionFromDiskDefinition(diskDefinition._fileRef, files);
|
||||
DatadiskTO datadiskTO = generateDiskTO(fileDefinition, diskDefinition, ovfParentPath, diskNumber, diskItem);
|
||||
|
|
@ -277,7 +278,7 @@ public class OVFHelper {
|
|||
if (StringUtils.isNotBlank(path)) {
|
||||
File f = new File(path);
|
||||
if (!f.exists() || f.isDirectory()) {
|
||||
s_logger.error("One of the attached disk or iso does not exists " + path);
|
||||
logger.error("One of the attached disk or iso does not exists " + path);
|
||||
throw new InternalErrorException("One of the attached disk or iso as stated on OVF does not exists " + path);
|
||||
}
|
||||
}
|
||||
|
|
@ -333,8 +334,8 @@ public class OVFHelper {
|
|||
od._controller = getControllerType(items, od._diskId);
|
||||
vd.add(od);
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d disk definitions",vd.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d disk definitions",vd.size()));
|
||||
}
|
||||
return vd;
|
||||
}
|
||||
|
|
@ -365,8 +366,8 @@ public class OVFHelper {
|
|||
vf.add(of);
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d file definitions in %s",vf.size(), ovfFile.getPath()));
|
||||
}
|
||||
return vf;
|
||||
}
|
||||
|
|
@ -461,7 +462,7 @@ public class OVFHelper {
|
|||
Element disk = (Element)disks.item(i);
|
||||
String fileRef = ovfParser.getNodeAttribute(disk, "fileRef");
|
||||
if (keepfile == null) {
|
||||
s_logger.info("FATAL: OVA format error");
|
||||
logger.info("FATAL: OVA format error");
|
||||
} else if (keepfile.equals(fileRef)) {
|
||||
keepdisk = ovfParser.getNodeAttribute(disk, "diskId");
|
||||
} else {
|
||||
|
|
@ -505,7 +506,7 @@ public class OVFHelper {
|
|||
outfile.write(writer.toString());
|
||||
outfile.close();
|
||||
} catch (IOException | TransformerException e) {
|
||||
s_logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e);
|
||||
logger.info("Unexpected exception caught while rewriting OVF:" + e.getMessage(), e);
|
||||
throw new CloudRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
|
@ -521,8 +522,8 @@ public class OVFHelper {
|
|||
|
||||
public List<OVFNetworkTO> getNetPrerequisitesFromDocument(Document doc) throws InternalErrorException {
|
||||
if (doc == null) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("no document to parse; returning no prerequisite networks");
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("no document to parse; returning no prerequisite networks");
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -539,8 +540,8 @@ public class OVFHelper {
|
|||
private void matchNicsToNets(Map<String, OVFNetworkTO> nets, Node systemElement) {
|
||||
final DocumentTraversal traversal = (DocumentTraversal) systemElement;
|
||||
final NodeIterator iterator = traversal.createNodeIterator(systemElement, NodeFilter.SHOW_ELEMENT, null, true);
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("starting out with %d network-prerequisites, parsing hardware",nets.size()));
|
||||
}
|
||||
int nicCount = 0;
|
||||
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
|
||||
|
|
@ -549,8 +550,8 @@ public class OVFHelper {
|
|||
nicCount++;
|
||||
String name = e.getTextContent(); // should be in our nets
|
||||
if(nets.get(name) == null) {
|
||||
if(s_logger.isInfoEnabled()) {
|
||||
s_logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name));
|
||||
if(logger.isInfoEnabled()) {
|
||||
logger.info(String.format("found a nic definition without a network definition byname %s, adding it to the list.", name));
|
||||
}
|
||||
nets.put(name, new OVFNetworkTO());
|
||||
}
|
||||
|
|
@ -560,8 +561,8 @@ public class OVFHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("ending up with %d network-prerequisites, parsed %d nics", nets.size(), nicCount));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +585,7 @@ public class OVFHelper {
|
|||
int addressOnParent = Integer.parseInt(addressOnParentStr);
|
||||
nic.setAddressOnParent(addressOnParent);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr);
|
||||
logger.warn("Encountered element of type \"AddressOnParent\", that could not be parse to an integer number: " + addressOnParentStr);
|
||||
}
|
||||
|
||||
boolean automaticAllocation = StringUtils.isNotBlank(automaticAllocationStr) && Boolean.parseBoolean(automaticAllocationStr);
|
||||
|
|
@ -596,7 +597,7 @@ public class OVFHelper {
|
|||
int instanceId = Integer.parseInt(instanceIdStr);
|
||||
nic.setInstanceID(instanceId);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr);
|
||||
logger.warn("Encountered element of type \"InstanceID\", that could not be parse to an integer number: " + instanceIdStr);
|
||||
}
|
||||
|
||||
nic.setResourceSubType(resourceSubType);
|
||||
|
|
@ -608,7 +609,7 @@ public class OVFHelper {
|
|||
NodeList systemElements = ovfParser.getElementsFromOVFDocument(doc, "VirtualSystem");
|
||||
if (systemElements.getLength() != 1) {
|
||||
String msg = "found " + systemElements.getLength() + " system definitions in OVA, can only handle exactly one.";
|
||||
s_logger.warn(msg);
|
||||
logger.warn(msg);
|
||||
throw new InternalErrorException(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -629,8 +630,8 @@ public class OVFHelper {
|
|||
|
||||
nets.put(networkName,network);
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace(String.format("found %d networks in template", nets.size()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(String.format("found %d networks in template", nets.size()));
|
||||
}
|
||||
return nets;
|
||||
}
|
||||
|
|
@ -770,7 +771,7 @@ public class OVFHelper {
|
|||
try {
|
||||
return Long.parseLong(value);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -781,7 +782,7 @@ public class OVFHelper {
|
|||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
logger.debug("Could not parse the value: " + value + ", ignoring it");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -807,9 +808,11 @@ public class OVFHelper {
|
|||
String eulaLicense = null;
|
||||
for (int i = 0; i < eulaChildNodes.getLength(); i++) {
|
||||
Node eulaItem = eulaChildNodes.item(i);
|
||||
if (eulaItem.getNodeName().equalsIgnoreCase("Info")) {
|
||||
if (eulaItem.getNodeName().equalsIgnoreCase("Info")
|
||||
|| eulaItem.getNodeName().endsWith(":Info")) {
|
||||
eulaInfo = eulaItem.getTextContent();
|
||||
} else if (eulaItem.getNodeName().equalsIgnoreCase("License")) {
|
||||
} else if (eulaItem.getNodeName().equalsIgnoreCase("License")
|
||||
|| eulaItem.getNodeName().endsWith(":License")) {
|
||||
eulaLicense = eulaItem.getTextContent();
|
||||
}
|
||||
}
|
||||
|
|
@ -817,7 +820,7 @@ public class OVFHelper {
|
|||
try {
|
||||
compressedLicense = compressOVFEula(eulaLicense);
|
||||
} catch (IOException e) {
|
||||
s_logger.error("Could not compress the license for info " + eulaInfo);
|
||||
logger.error("Could not compress the license for info " + eulaInfo);
|
||||
continue;
|
||||
}
|
||||
OVFEulaSectionTO eula = new OVFEulaSectionTO(eulaInfo, compressedLicense, eulaIndex);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
|
||||
import org.apache.cloudstack.utils.security.ParserUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
|
@ -36,7 +37,7 @@ import org.xml.sax.InputSource;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
public class OVFParser {
|
||||
private static final Logger s_logger = Logger.getLogger(OVFParser.class);
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private static final String DEFAULT_OVF_SCHEMA = "http://schemas.dmtf.org/ovf/envelope/1";
|
||||
private static final String VMW_SCHEMA = "http://www.vmware.com/schema/ovf";
|
||||
|
|
@ -53,7 +54,7 @@ public class OVFParser {
|
|||
documentBuilderFactory.setNamespaceAware(true);
|
||||
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
s_logger.error("Cannot start the OVF parser: " + e.getMessage(), e);
|
||||
logger.error("Cannot start the OVF parser: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ public class OVFParser {
|
|||
try {
|
||||
return documentBuilder.parse(new File(ovfFilePath));
|
||||
} catch (SAXException | IOException e) {
|
||||
s_logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e);
|
||||
logger.error("Error parsing " + ovfFilePath + " " + e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class HostTO {
|
|||
private NetworkTO publicNetwork;
|
||||
private NetworkTO storageNetwork1;
|
||||
private NetworkTO storageNetwork2;
|
||||
private String parent;
|
||||
|
||||
protected HostTO() {
|
||||
}
|
||||
|
|
@ -40,6 +41,9 @@ public class HostTO {
|
|||
if (vo.getStorageIpAddressDeux() != null) {
|
||||
storageNetwork2 = new NetworkTO(vo.getStorageIpAddressDeux(), vo.getStorageNetmaskDeux(), vo.getStorageMacAddressDeux());
|
||||
}
|
||||
if (vo.getParent() != null) {
|
||||
parent = vo.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
|
|
@ -81,4 +85,12 @@ public class HostTO {
|
|||
public void setStorageNetwork2(NetworkTO storageNetwork2) {
|
||||
this.storageNetwork2 = storageNetwork2;
|
||||
}
|
||||
|
||||
public String getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public class NicTO extends NetworkTO {
|
|||
Map<NetworkOffering.Detail, String> details;
|
||||
boolean dpdkEnabled;
|
||||
Integer mtu;
|
||||
Long networkId;
|
||||
|
||||
String networkSegmentName;
|
||||
|
||||
public NicTO() {
|
||||
super();
|
||||
|
|
@ -127,4 +130,20 @@ public class NicTO extends NetworkTO {
|
|||
public void setMtu(Integer mtu) {
|
||||
this.mtu = mtu;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public void setNetworkId(Long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public String getNetworkSegmentName() {
|
||||
return networkSegmentName;
|
||||
}
|
||||
|
||||
public void setNetworkSegmentName(String networkSegmentName) {
|
||||
this.networkSegmentName = networkSegmentName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package com.cloud.agent.api.to;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.cloud.agent.api.LogLevel;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
|
||||
public class RemoteInstanceTO implements Serializable {
|
||||
|
||||
private Hypervisor.HypervisorType hypervisorType;
|
||||
private String instanceName;
|
||||
|
||||
// VMware Remote Instances parameters (required for exporting OVA through ovftool)
|
||||
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
|
||||
private String vcenterUsername;
|
||||
@LogLevel(LogLevel.Log4jLevel.Off)
|
||||
private String vcenterPassword;
|
||||
private String vcenterHost;
|
||||
private String datacenterName;
|
||||
|
||||
public RemoteInstanceTO() {
|
||||
}
|
||||
|
||||
public RemoteInstanceTO(String instanceName) {
|
||||
this.hypervisorType = Hypervisor.HypervisorType.VMware;
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public RemoteInstanceTO(String instanceName, String vcenterHost, String vcenterUsername, String vcenterPassword, String datacenterName) {
|
||||
this.hypervisorType = Hypervisor.HypervisorType.VMware;
|
||||
this.instanceName = instanceName;
|
||||
this.vcenterHost = vcenterHost;
|
||||
this.vcenterUsername = vcenterUsername;
|
||||
this.vcenterPassword = vcenterPassword;
|
||||
this.datacenterName = datacenterName;
|
||||
}
|
||||
|
||||
public Hypervisor.HypervisorType getHypervisorType() {
|
||||
return this.hypervisorType;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return this.instanceName;
|
||||
}
|
||||
|
||||
public String getVcenterUsername() {
|
||||
return vcenterUsername;
|
||||
}
|
||||
|
||||
public String getVcenterPassword() {
|
||||
return vcenterPassword;
|
||||
}
|
||||
|
||||
public String getVcenterHost() {
|
||||
return vcenterHost;
|
||||
}
|
||||
|
||||
public String getDatacenterName() {
|
||||
return datacenterName;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,6 +82,7 @@ public class VirtualMachineTO {
|
|||
|
||||
Map<String, String> guestOsDetails = new HashMap<String, String>();
|
||||
Map<String, String> extraConfig = new HashMap<>();
|
||||
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
|
||||
DeployAsIsInfoTO deployAsIsInfo;
|
||||
|
||||
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
|
||||
|
|
@ -392,6 +393,14 @@ public class VirtualMachineTO {
|
|||
return extraConfig;
|
||||
}
|
||||
|
||||
public Map<Long, String> getNetworkIdToNetworkNameMap() {
|
||||
return networkIdToNetworkNameMap;
|
||||
}
|
||||
|
||||
public void setNetworkIdToNetworkNameMap(Map<Long, String> networkIdToNetworkNameMap) {
|
||||
this.networkIdToNetworkNameMap = networkIdToNetworkNameMap;
|
||||
}
|
||||
|
||||
public String getBootType() {
|
||||
return bootType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
// under the License.
|
||||
package com.cloud.capacity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
|
@ -35,6 +37,11 @@ public interface Capacity extends InternalIdentity, Identity {
|
|||
|
||||
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);
|
||||
|
||||
public Long getHostOrPoolId();
|
||||
|
||||
public Long getDataCenterId();
|
||||
|
|
@ -54,4 +61,6 @@ public interface Capacity extends InternalIdentity, Identity {
|
|||
public Float getUsedPercentage();
|
||||
|
||||
public Long getAllocatedCapacity();
|
||||
|
||||
public String getTag();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,5 +85,6 @@ public interface Resource {
|
|||
long getOwnerId();
|
||||
|
||||
ResourceOwnerType getResourceOwnerType();
|
||||
String getTag();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package com.cloud.hypervisor.vmware;
|
||||
package com.cloud.dc;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
|
@ -57,6 +57,17 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
|||
false,
|
||||
ConfigKey.Scope.Global);
|
||||
|
||||
static final ConfigKey<String> VmAllocationAlgorithm = new ConfigKey<>(
|
||||
String.class,
|
||||
"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'.",
|
||||
true,
|
||||
ConfigKey.Scope.Global, null, null, null, null, null,
|
||||
ConfigKey.Kind.Select,
|
||||
"random,firstfit,userdispersing,userconcentratedpod_random,userconcentratedpod_firstfit,firstfitleastconsumed");
|
||||
|
||||
/**
|
||||
* This is called to determine list of possible clusters where a virtual
|
||||
* machine can be deployed.
|
||||
|
|
|
|||
|
|
@ -21,8 +21,12 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.exception.CloudException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InsufficientServerCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
|
|
@ -75,7 +79,7 @@ public interface DeploymentPlanner extends Adapter {
|
|||
|
||||
public static class ExcludeList implements Serializable {
|
||||
private static final long serialVersionUID = -482175549460148301L;
|
||||
|
||||
protected static Logger LOGGER = LogManager.getLogger(ExcludeList.class);
|
||||
private Set<Long> _dcIds;
|
||||
private Set<Long> _podIds;
|
||||
private Set<Long> _clusterIds;
|
||||
|
|
@ -104,13 +108,26 @@ public interface DeploymentPlanner extends Adapter {
|
|||
}
|
||||
}
|
||||
|
||||
private void logAvoid(Class<?> scope, CloudException e) {
|
||||
Long id = null;
|
||||
if (e instanceof InsufficientCapacityException) {
|
||||
id = ((InsufficientCapacityException) e).getId();
|
||||
} else if (e instanceof ResourceUnavailableException) {
|
||||
id = ((ResourceUnavailableException) e).getResourceId();
|
||||
} else {
|
||||
LOGGER.debug("Failed to log avoided component due to unexpected exception type [{}].", e.getMessage());
|
||||
return;
|
||||
}
|
||||
LOGGER.debug("Adding {} [{}] to the avoid set due to [{}].", scope.getSimpleName(), id, e.getMessage());
|
||||
}
|
||||
|
||||
public boolean add(InsufficientCapacityException e) {
|
||||
Class<?> scope = e.getScope();
|
||||
|
||||
if (scope == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logAvoid(scope, e);
|
||||
if (Host.class.isAssignableFrom(scope)) {
|
||||
addHost(e.getId());
|
||||
} else if (Pod.class.isAssignableFrom(scope)) {
|
||||
|
|
@ -128,13 +145,14 @@ public interface DeploymentPlanner extends Adapter {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean add(ResourceUnavailableException e) {
|
||||
Class<?> scope = e.getScope();
|
||||
|
||||
if (scope == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logAvoid(scope, e);
|
||||
if (Host.class.isAssignableFrom(scope)) {
|
||||
addHost(e.getResourceId());
|
||||
} else if (Pod.class.isAssignableFrom(scope)) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ import org.apache.cloudstack.api.response.PodResponse;
|
|||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.config.Configuration;
|
||||
import org.apache.cloudstack.ha.HAConfig;
|
||||
import org.apache.cloudstack.quota.QuotaTariff;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
import org.apache.cloudstack.vm.schedule.VMSchedule;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterGuestIpv6Prefix;
|
||||
|
|
@ -84,7 +88,6 @@ import com.cloud.user.User;
|
|||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.NicSecondaryIp;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import org.apache.cloudstack.vm.schedule.VMSchedule;
|
||||
|
||||
public class EventTypes {
|
||||
|
||||
|
|
@ -301,6 +304,7 @@ public class EventTypes {
|
|||
public static final String EVENT_VOLUME_CREATE = "VOLUME.CREATE";
|
||||
public static final String EVENT_VOLUME_DELETE = "VOLUME.DELETE";
|
||||
public static final String EVENT_VOLUME_ATTACH = "VOLUME.ATTACH";
|
||||
public static final String EVENT_VOLUME_CHECK = "VOLUME.CHECK";
|
||||
public static final String EVENT_VOLUME_DETACH = "VOLUME.DETACH";
|
||||
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
|
||||
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
|
||||
|
|
@ -312,14 +316,18 @@ public class EventTypes {
|
|||
public static final String EVENT_VOLUME_UPDATE = "VOLUME.UPDATE";
|
||||
public static final String EVENT_VOLUME_DESTROY = "VOLUME.DESTROY";
|
||||
public static final String EVENT_VOLUME_RECOVER = "VOLUME.RECOVER";
|
||||
public static final String EVENT_VOLUME_IMPORT = "VOLUME.IMPORT";
|
||||
public static final String EVENT_VOLUME_UNMANAGE = "VOLUME.UNMANAGE";
|
||||
public static final String EVENT_VOLUME_CHANGE_DISK_OFFERING = "VOLUME.CHANGE.DISK.OFFERING";
|
||||
|
||||
// Domains
|
||||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
public static final String EVENT_DOMAIN_DELETE = "DOMAIN.DELETE";
|
||||
public static final String EVENT_DOMAIN_UPDATE = "DOMAIN.UPDATE";
|
||||
public static final String EVENT_DOMAIN_MOVE = "DOMAIN.MOVE";
|
||||
|
||||
// Snapshots
|
||||
public static final String EVENT_SNAPSHOT_COPY = "SNAPSHOT.COPY";
|
||||
public static final String EVENT_SNAPSHOT_CREATE = "SNAPSHOT.CREATE";
|
||||
public static final String EVENT_SNAPSHOT_ON_PRIMARY = "SNAPSHOT.ON_PRIMARY";
|
||||
public static final String EVENT_SNAPSHOT_OFF_PRIMARY = "SNAPSHOT.OFF_PRIMARY";
|
||||
|
|
@ -394,6 +402,9 @@ public class EventTypes {
|
|||
public static final String EVENT_STORAGE_IP_RANGE_UPDATE = "STORAGE.IP.RANGE.UPDATE";
|
||||
|
||||
public static final String EVENT_IMAGE_STORE_DATA_MIGRATE = "IMAGE.STORE.MIGRATE.DATA";
|
||||
public static final String EVENT_IMAGE_STORE_RESOURCES_MIGRATE = "IMAGE.STORE.MIGRATE.RESOURCES";
|
||||
public static final String EVENT_IMAGE_STORE_OBJECT_DOWNLOAD = "IMAGE.STORE.OBJECT.DOWNLOAD";
|
||||
public static final String EVENT_UPDATE_IMAGE_STORE_ACCESS_STATE = "IMAGE.STORE.ACCESS.UPDATED";
|
||||
|
||||
// Configuration Table
|
||||
public static final String EVENT_CONFIGURATION_VALUE_EDIT = "CONFIGURATION.VALUE.EDIT";
|
||||
|
|
@ -440,6 +451,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_CHANGE_STORAGE_POOL_SCOPE = "CHANGE.STORAGE.POOL.SCOPE";
|
||||
|
||||
// VPN
|
||||
public static final String EVENT_REMOTE_ACCESS_VPN_CREATE = "VPN.REMOTE.ACCESS.CREATE";
|
||||
|
|
@ -677,6 +689,11 @@ public class EventTypes {
|
|||
//Usage related events
|
||||
public static final String EVENT_USAGE_REMOVE_USAGE_RECORDS = "USAGE.REMOVE.USAGE.RECORDS";
|
||||
|
||||
// DRS Events
|
||||
public static final String EVENT_CLUSTER_DRS = "CLUSTER.DRS";
|
||||
public static final String EVENT_CLUSTER_DRS_GENERATE = "CLUSTER.DRS.GENERATE";
|
||||
|
||||
|
||||
// Netscaler Service Package events
|
||||
public static final String EVENT_NETSCALER_SERVICEPACKAGE_ADD = "NETSCALER.SERVICEPACKAGE.ADD";
|
||||
public static final String EVENT_NETSCALER_SERVICEPACKAGE_DELETE = "NETSCALER.SERVICEPACKAGE.DELETE";
|
||||
|
|
@ -705,6 +722,23 @@ public class EventTypes {
|
|||
|
||||
// SystemVM
|
||||
public static final String EVENT_LIVE_PATCH_SYSTEMVM = "LIVE.PATCH.SYSTEM.VM";
|
||||
//Purge resources
|
||||
public static final String EVENT_PURGE_EXPUNGED_RESOURCES = "PURGE.EXPUNGED.RESOURCES";
|
||||
|
||||
// OBJECT STORE
|
||||
public static final String EVENT_OBJECT_STORE_CREATE = "OBJECT.STORE.CREATE";
|
||||
public static final String EVENT_OBJECT_STORE_DELETE = "OBJECT.STORE.DELETE";
|
||||
public static final String EVENT_OBJECT_STORE_UPDATE = "OBJECT.STORE.UPDATE";
|
||||
|
||||
// BUCKETS
|
||||
public static final String EVENT_BUCKET_CREATE = "BUCKET.CREATE";
|
||||
public static final String EVENT_BUCKET_DELETE = "BUCKET.DELETE";
|
||||
public static final String EVENT_BUCKET_UPDATE = "BUCKET.UPDATE";
|
||||
|
||||
// Quota
|
||||
public static final String EVENT_QUOTA_TARIFF_CREATE = "QUOTA.TARIFF.CREATE";
|
||||
public static final String EVENT_QUOTA_TARIFF_DELETE = "QUOTA.TARIFF.DELETE";
|
||||
public static final String EVENT_QUOTA_TARIFF_UPDATE = "QUOTA.TARIFF.UPDATE";
|
||||
|
||||
static {
|
||||
|
||||
|
|
@ -858,6 +892,7 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_MOVE, Domain.class);
|
||||
|
||||
// Snapshots
|
||||
entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class);
|
||||
|
|
@ -968,6 +1003,7 @@ public class EventTypes {
|
|||
// Primary storage pool
|
||||
entityEventDetails.put(EVENT_ENABLE_PRIMARY_STORAGE, StoragePool.class);
|
||||
entityEventDetails.put(EVENT_DISABLE_PRIMARY_STORAGE, StoragePool.class);
|
||||
entityEventDetails.put(EVENT_CHANGE_STORAGE_POOL_SCOPE, StoragePool.class);
|
||||
|
||||
// VPN
|
||||
entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class);
|
||||
|
|
@ -1141,9 +1177,30 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_IMPORT_VCENTER_STORAGE_POLICIES, "StoragePolicies");
|
||||
|
||||
entityEventDetails.put(EVENT_IMAGE_STORE_DATA_MIGRATE, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_IMAGE_STORE_OBJECT_DOWNLOAD, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_UPDATE_IMAGE_STORE_ACCESS_STATE, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_LIVE_PATCH_SYSTEMVM, "SystemVMs");
|
||||
|
||||
//Object Store
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_CREATE, ObjectStore.class);
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_UPDATE, ObjectStore.class);
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_DELETE, ObjectStore.class);
|
||||
|
||||
//Buckets
|
||||
entityEventDetails.put(EVENT_BUCKET_CREATE, Bucket.class);
|
||||
entityEventDetails.put(EVENT_BUCKET_UPDATE, Bucket.class);
|
||||
entityEventDetails.put(EVENT_BUCKET_DELETE, Bucket.class);
|
||||
|
||||
// Quota
|
||||
entityEventDetails.put(EVENT_QUOTA_TARIFF_CREATE, QuotaTariff.class);
|
||||
entityEventDetails.put(EVENT_QUOTA_TARIFF_DELETE, QuotaTariff.class);
|
||||
entityEventDetails.put(EVENT_QUOTA_TARIFF_UPDATE, QuotaTariff.class);
|
||||
}
|
||||
|
||||
public static boolean isNetworkEvent(String eventType) {
|
||||
return EVENT_NETWORK_CREATE.equals(eventType) || EVENT_NETWORK_DELETE.equals(eventType) ||
|
||||
EVENT_NETWORK_UPDATE.equals(eventType);
|
||||
}
|
||||
public static String getEntityForEvent(String eventName) {
|
||||
Object entityClass = entityEventDetails.get(eventName);
|
||||
if (entityClass == null) {
|
||||
|
|
@ -1172,4 +1229,12 @@ public class EventTypes {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isVpcEvent(String eventType) {
|
||||
return EventTypes.EVENT_VPC_CREATE.equals(eventType) || EventTypes.EVENT_VPC_DELETE.equals(eventType);
|
||||
}
|
||||
|
||||
public static void addEntityEventDetail(String event, Class<?> clazz) {
|
||||
entityEventDetails.put(event, clazz);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,13 +25,104 @@ public class GPU {
|
|||
}
|
||||
|
||||
public enum GPUType {
|
||||
GRID_K100("GRID K100"),
|
||||
GRID_K120Q("GRID K120Q"),
|
||||
GRID_K140Q("GRID K140Q"),
|
||||
GRID_K200("GRID K200"),
|
||||
GRID_K220Q("GRID K220Q"),
|
||||
GRID_K240Q("GRID K240Q"),
|
||||
GRID_K260("GRID K260Q"),
|
||||
GRID_V100D_32A("GRID V100D-32A"),
|
||||
GRID_V100D_8Q("GRID V100D-8Q"),
|
||||
GRID_V100D_4A("GRID V100D-4A"),
|
||||
GRID_V100D_1B("GRID V100D-1B"),
|
||||
GRID_V100D_2Q("GRID V100D-2Q"),
|
||||
GRID_V100D_4Q("GRID V100D-4Q"),
|
||||
GRID_V100D_2A("GRID V100D-2A"),
|
||||
GRID_V100D_2B("GRID V100D-2B"),
|
||||
GRID_V100D_32Q("GRID V100D-32Q"),
|
||||
GRID_V100D_16A("GRID V100D-16A"),
|
||||
GRID_V100D_1Q("GRID V100D-1Q"),
|
||||
GRID_V100D_2B4("GRID V100D-2B4"),
|
||||
GRID_V100D_16Q("GRID V100D-16Q"),
|
||||
GRID_V100D_8A("GRID V100D-8A"),
|
||||
GRID_V100D_1A("GRID V100D-1A"),
|
||||
GRID_T4_16A("GRID T4-16A"),
|
||||
GRID_T4_2B4("GRID T4-2B4"),
|
||||
GRID_T4_4Q("GRID T4-4Q"),
|
||||
GRID_T4_16Q("GRID T4-16Q"),
|
||||
GRID_T4_4A("GRID T4-4A"),
|
||||
GRID_T4_1A("GRID T4-1A"),
|
||||
GRID_T4_2Q("GRID T4-2Q"),
|
||||
GRID_T4_2B("GRID T4-2B"),
|
||||
GRID_T4_8Q("GRID T4-8Q"),
|
||||
GRID_T4_2A("GRID T4-2A"),
|
||||
GRID_T4_1B("GRID T4-1B"),
|
||||
GRID_T4_1Q("GRID T4-1Q"),
|
||||
GRID_T4_8A("GRID T4-8A"),
|
||||
NVIDIA_RTX5500_1A("NVIDIA RTXA5500-1A"),
|
||||
NVIDIA_RTX5500_1B("NVIDIA RTXA5500-1B"),
|
||||
NVIDIA_RTX5500_1Q("NVIDIA RTXA5500-1Q"),
|
||||
NVIDIA_RTX5500_2A("NVIDIA RTXA5500-2A"),
|
||||
NVIDIA_RTX5500_2B("NVIDIA RTXA5500-2B"),
|
||||
NVIDIA_RTX5500_2Q("NVIDIA RTXA5500-2Q"),
|
||||
NVIDIA_RTX5500_3A("NVIDIA RTXA5500-3A"),
|
||||
NVIDIA_RTX5500_3Q("NVIDIA RTXA5500-3Q"),
|
||||
NVIDIA_RTX5500_4A("NVIDIA RTXA5500-4A"),
|
||||
NVIDIA_RTX5500_4Q("NVIDIA RTXA5500-4Q"),
|
||||
NVIDIA_RTX5500_6A("NVIDIA RTXA5500-6A"),
|
||||
NVIDIA_RTX5500_6Q("NVIDIA RTXA5500-6Q"),
|
||||
NVIDIA_RTX5500_8A("NVIDIA RTXA5500-8A"),
|
||||
NVIDIA_RTX5500_8Q("NVIDIA RTXA5500-8Q"),
|
||||
NVIDIA_RTX5500_12A("NVIDIA RTXA5500-12A"),
|
||||
NVIDIA_RTX5500_12Q("NVIDIA RTXA5500-12Q"),
|
||||
NVIDIA_RTX5500_24A("NVIDIA RTXA5500-24A"),
|
||||
NVIDIA_RTX5500_24Q("NVIDIA RTXA5500-24Q"),
|
||||
NVIDIA_A40_1A("NVIDIA A40-1A"),
|
||||
NVIDIA_A40_1B("NVIDIA A40-1B"),
|
||||
NVIDIA_A40_1Q("NVIDIA A40-1Q"),
|
||||
NVIDIA_A40_2A("NVIDIA A40-2A"),
|
||||
NVIDIA_A40_2B("NVIDIA A40-2B"),
|
||||
NVIDIA_A40_2Q("NVIDIA A40-2Q"),
|
||||
NVIDIA_A40_3A("NVIDIA A40-3A"),
|
||||
NVIDIA_A40_3Q("NVIDIA A40-3Q"),
|
||||
NVIDIA_A40_4A("NVIDIA A40-4A"),
|
||||
NVIDIA_A40_4Q("NVIDIA A40-4Q"),
|
||||
NVIDIA_A40_6A("NVIDIA A40-6A"),
|
||||
NVIDIA_A40_6Q("NVIDIA A40-6Q"),
|
||||
NVIDIA_A40_8A("NVIDIA A40-8A"),
|
||||
NVIDIA_A40_8Q("NVIDIA A40-8Q"),
|
||||
NVIDIA_A40_12A("NVIDIA A40-12A"),
|
||||
NVIDIA_A40_12Q("NVIDIA A40-12Q"),
|
||||
NVIDIA_A40_16A("NVIDIA A40-16A"),
|
||||
NVIDIA_A40_16Q("NVIDIA A40-16Q"),
|
||||
NVIDIA_A40_24A("NVIDIA A40-24A"),
|
||||
NVIDIA_A40_24Q("NVIDIA A40-24Q"),
|
||||
NVIDIA_A40_48A("NVIDIA A40-48A"),
|
||||
NVIDIA_A40_48Q("NVIDIA A40-48Q"),
|
||||
NVIDIA_A2_1A("NVIDIA A2-1A"),
|
||||
NVIDIA_A2_1B("NVIDIA A2-1B"),
|
||||
NVIDIA_A2_1Q("NVIDIA A2-1Q"),
|
||||
NVIDIA_A2_2A("NVIDIA A2-2A"),
|
||||
NVIDIA_A2_2B("NVIDIA A2-2B"),
|
||||
NVIDIA_A2_2Q("NVIDIA A2-2Q"),
|
||||
NVIDIA_A2_4A("NVIDIA A2-4A"),
|
||||
NVIDIA_A2_4Q("NVIDIA A2-4Q"),
|
||||
NVIDIA_A2_8A("NVIDIA A2-8A"),
|
||||
NVIDIA_A2_8Q("NVIDIA A2-8Q"),
|
||||
NVIDIA_A2_16A("NVIDIA A2-16A"),
|
||||
NVIDIA_A2_16Q("NVIDIA A2-16Q"),
|
||||
NVIDIA_A10_1A("NVIDIA A10-1A"),
|
||||
NVIDIA_A10_1B("NVIDIA A10-1B"),
|
||||
NVIDIA_A10_1Q("NVIDIA A10-1Q"),
|
||||
NVIDIA_A10_2A("NVIDIA A10-2A"),
|
||||
NVIDIA_A10_2B("NVIDIA A10-2B"),
|
||||
NVIDIA_A10_2Q("NVIDIA A10-2Q"),
|
||||
NVIDIA_A10_3A("NVIDIA A10-3A"),
|
||||
NVIDIA_A10_3Q("NVIDIA A10-3Q"),
|
||||
NVIDIA_A10_4A("NVIDIA A10-4A"),
|
||||
NVIDIA_A10_4Q("NVIDIA A10-4Q"),
|
||||
NVIDIA_A10_6A("NVIDIA A10-6A"),
|
||||
NVIDIA_A10_6Q("NVIDIA A10-6Q"),
|
||||
NVIDIA_A10_8A("NVIDIA A10-8A"),
|
||||
NVIDIA_A10_8Q("NVIDIA A10-8Q"),
|
||||
NVIDIA_A10_12A("NVIDIA A10-12A"),
|
||||
NVIDIA_A10_12Q("NVIDIA A10-12Q"),
|
||||
NVIDIA_A10_24A("NVIDIA A10-24A"),
|
||||
NVIDIA_A10_24Q("NVIDIA A10-24Q"),
|
||||
passthrough("passthrough");
|
||||
|
||||
private String type;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public interface Host extends StateObject<Status>, Identity, Partition, HAResour
|
|||
}
|
||||
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";
|
||||
|
||||
/**
|
||||
* @return name of the machine.
|
||||
|
|
|
|||
|
|
@ -17,55 +17,45 @@
|
|||
package com.cloud.hypervisor;
|
||||
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Hypervisor {
|
||||
public static class HypervisorType {
|
||||
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);
|
||||
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2);
|
||||
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA);
|
||||
public static final HypervisorType Hyperv = new HypervisorType("Hyperv");
|
||||
public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox");
|
||||
public static final HypervisorType Parralels = new HypervisorType("Parralels");
|
||||
public static final HypervisorType BareMetal = new HypervisorType("BareMetal");
|
||||
public static final HypervisorType Simulator = new HypervisorType("Simulator");
|
||||
public static final HypervisorType Ovm = new HypervisorType("Ovm", ImageFormat.RAW);
|
||||
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");
|
||||
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;
|
||||
|
||||
static Map<String, HypervisorType> hypervisorTypeMap;
|
||||
static Map<HypervisorType, ImageFormat> supportedImageFormatMap;
|
||||
public HypervisorType(String name) {
|
||||
this(name, null);
|
||||
}
|
||||
|
||||
public enum HypervisorType {
|
||||
None, //for storage hosts
|
||||
XenServer,
|
||||
KVM,
|
||||
VMware,
|
||||
Hyperv,
|
||||
VirtualBox,
|
||||
Parralels,
|
||||
BareMetal,
|
||||
Simulator,
|
||||
Ovm,
|
||||
Ovm3,
|
||||
LXC,
|
||||
Custom,
|
||||
|
||||
Any; /*If you don't care about the hypervisor type*/
|
||||
|
||||
static {
|
||||
hypervisorTypeMap = new HashMap<>();
|
||||
hypervisorTypeMap.put("xenserver", HypervisorType.XenServer);
|
||||
hypervisorTypeMap.put("kvm", HypervisorType.KVM);
|
||||
hypervisorTypeMap.put("vmware", HypervisorType.VMware);
|
||||
hypervisorTypeMap.put("hyperv", HypervisorType.Hyperv);
|
||||
hypervisorTypeMap.put("virtualbox", HypervisorType.VirtualBox);
|
||||
hypervisorTypeMap.put("parallels", HypervisorType.Parralels);
|
||||
hypervisorTypeMap.put("baremetal", HypervisorType.BareMetal);
|
||||
hypervisorTypeMap.put("simulator", HypervisorType.Simulator);
|
||||
hypervisorTypeMap.put("ovm", HypervisorType.Ovm);
|
||||
hypervisorTypeMap.put("lxc", HypervisorType.LXC);
|
||||
hypervisorTypeMap.put("any", HypervisorType.Any);
|
||||
hypervisorTypeMap.put("ovm3", HypervisorType.Ovm3);
|
||||
hypervisorTypeMap.put("custom", HypervisorType.Custom);
|
||||
|
||||
supportedImageFormatMap = new HashMap<>();
|
||||
supportedImageFormatMap.put(HypervisorType.XenServer, ImageFormat.VHD);
|
||||
supportedImageFormatMap.put(HypervisorType.KVM, ImageFormat.QCOW2);
|
||||
supportedImageFormatMap.put(HypervisorType.VMware, ImageFormat.OVA);
|
||||
supportedImageFormatMap.put(HypervisorType.Ovm, ImageFormat.RAW);
|
||||
supportedImageFormatMap.put(HypervisorType.Ovm3, ImageFormat.RAW);
|
||||
public HypervisorType(String name, ImageFormat imageFormat) {
|
||||
this.name = name;
|
||||
this.imageFormat = imageFormat;
|
||||
if (name.equals("Parralels")){ // typo in the original code
|
||||
hypervisorTypeMap.put("parallels", this);
|
||||
} else {
|
||||
hypervisorTypeMap.putIfAbsent(name.toLowerCase(Locale.ROOT), this);
|
||||
}
|
||||
}
|
||||
|
||||
public static HypervisorType getType(String hypervisor) {
|
||||
|
|
@ -75,24 +65,62 @@ public class Hypervisor {
|
|||
hypervisorTypeMap.getOrDefault(hypervisor.toLowerCase(Locale.ROOT), HypervisorType.None));
|
||||
}
|
||||
|
||||
public static HypervisorType[] values() {
|
||||
return hypervisorTypeMap.values().toArray(HypervisorType[]::new).clone();
|
||||
}
|
||||
|
||||
public static HypervisorType valueOf(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HypervisorType hypervisorType = hypervisorTypeMap.get(name.toLowerCase(Locale.ROOT));
|
||||
if (hypervisorType == null) {
|
||||
throw new IllegalArgumentException("HypervisorType '" + name + "' not found");
|
||||
}
|
||||
return hypervisorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name of a hypervisor type in case the custom hypervisor is used,
|
||||
* using the 'hypervisor.custom.display.name' setting. Otherwise, returns hypervisor name
|
||||
*/
|
||||
public String getHypervisorDisplayName() {
|
||||
return !Hypervisor.HypervisorType.Custom.equals(this) ?
|
||||
this.toString() :
|
||||
HypervisorGuru.HypervisorCustomDisplayName.value();
|
||||
return HypervisorType.Custom.equals(this) ? HypervisorGuru.HypervisorCustomDisplayName.value() : name;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method really needs to be part of the properties of the hypervisor type itself.
|
||||
*
|
||||
* @param hyperType
|
||||
* @return
|
||||
*/
|
||||
public static ImageFormat getSupportedImageFormat(HypervisorType hyperType) {
|
||||
return supportedImageFormatMap.getOrDefault(hyperType, null);
|
||||
public ImageFormat getSupportedImageFormat() {
|
||||
return imageFormat;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
} else if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HypervisorType that = (HypervisorType) o;
|
||||
return Objects.equals(name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.cloudstack.backup.Backup;
|
|||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.to.DataStoreTO;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
|
@ -33,6 +34,7 @@ import com.cloud.utils.component.Adapter;
|
|||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import org.apache.cloudstack.vm.UnmanagedInstanceTO;
|
||||
|
||||
public interface HypervisorGuru extends Adapter {
|
||||
|
||||
|
|
@ -100,8 +102,45 @@ public interface HypervisorGuru extends Adapter {
|
|||
* Will generate commands to migrate a vm to a pool. For now this will only work for stopped VMs on Vmware.
|
||||
*
|
||||
* @param vm the stopped vm to migrate
|
||||
* @param destination the primary storage pool to migrate to
|
||||
* @param volumeToPool the primary storage pools to migrate to
|
||||
* @return a list of commands to perform for a successful migration
|
||||
*/
|
||||
List<Command> finalizeMigrate(VirtualMachine vm, Map<Volume, StoragePool> volumeToPool);
|
||||
|
||||
|
||||
/**
|
||||
* Will return the hypervisor VM (clone VM for PowerOn VMs), performs a clone of a VM if required on an external host (if the guru can handle)
|
||||
* @param hostIp VM's source host IP
|
||||
* @param vmName name of the source VM (clone VM name if cloned)
|
||||
* @param params hypervisor specific additional parameters
|
||||
* @return a reference to the hypervisor or cloned VM, and cloned flag
|
||||
*/
|
||||
Pair<UnmanagedInstanceTO, Boolean> getHypervisorVMOutOfBandAndCloneIfRequired(String hostIp, String vmName, Map<String, String> params);
|
||||
|
||||
/**
|
||||
* Removes a VM created as a clone of a VM on an external host
|
||||
* @param hostIp VM's source host IP
|
||||
* @param vmName name of the VM to remove
|
||||
* @param params hypervisor specific additional parameters
|
||||
* @return true if the operation succeeds, false if not
|
||||
*/
|
||||
boolean removeClonedHypervisorVMOutOfBand(String hostIp, String vmName, Map<String, String> params);
|
||||
|
||||
/**
|
||||
* Create an OVA/OVF template of a VM on an external host (if the guru can handle)
|
||||
* @param hostIp VM's source host IP
|
||||
* @param vmName name of the source VM to create template from
|
||||
* @param params hypervisor specific additional parameters
|
||||
* @param templateLocation datastore to create the template file
|
||||
* @return the created template dir/name
|
||||
*/
|
||||
String createVMTemplateOutOfBand(String hostIp, String vmName, Map<String, String> params, DataStoreTO templateLocation, int threadsCountToExportOvf);
|
||||
|
||||
/**
|
||||
* Removes the template on the location
|
||||
* @param templateLocation datastore to remove the template file
|
||||
* @param templateDir the template dir to remove from datastore
|
||||
* @return true if the operation succeeds, false if not
|
||||
*/
|
||||
boolean removeVMTemplateOutOfBand(DataStoreTO templateLocation, String templateDir);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,14 @@
|
|||
// under the License.
|
||||
package com.cloud.kubernetes.cluster;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
|
||||
public interface KubernetesClusterHelper extends Adapter {
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.component.Adapter;
|
||||
|
||||
public interface KubernetesServiceHelper extends Adapter {
|
||||
|
||||
ControlledEntity findByUuid(String uuid);
|
||||
ControlledEntity findByVmId(long vmId);
|
||||
void checkVmCanBeDestroyed(UserVm userVm);
|
||||
}
|
||||
|
|
@ -97,4 +97,6 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
|
|||
|
||||
void setRuleState(State ruleState);
|
||||
|
||||
boolean isForSystemVms();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
//Add Tungsten Fabric provider
|
||||
public static final Provider Tungsten = new Provider("Tungsten", false);
|
||||
|
||||
public static final Provider Nsx = new Provider("Nsx", false);
|
||||
|
||||
private final String name;
|
||||
private final boolean isExternal;
|
||||
|
||||
|
|
@ -427,6 +429,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
|
||||
long getDataCenterId();
|
||||
|
||||
long getAccountId();
|
||||
|
||||
long getNetworkOfferingId();
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public interface NetworkModel {
|
|||
String HYPERVISOR_HOST_NAME_FILE = "hypervisor-host-name";
|
||||
String CLOUD_DOMAIN_FILE = "cloud-domain";
|
||||
String CLOUD_DOMAIN_ID_FILE = "cloud-domain-id";
|
||||
String CLOUD_NAME_FILE = "cloud-name";
|
||||
int CONFIGDATA_DIR = 0;
|
||||
int CONFIGDATA_FILE = 1;
|
||||
int CONFIGDATA_CONTENT = 2;
|
||||
|
|
@ -83,11 +84,12 @@ public interface NetworkModel {
|
|||
.put(PUBLIC_HOSTNAME_FILE, "name")
|
||||
.put(CLOUD_DOMAIN_FILE, CLOUD_DOMAIN_FILE)
|
||||
.put(CLOUD_DOMAIN_ID_FILE, CLOUD_DOMAIN_ID_FILE)
|
||||
.put(CLOUD_NAME_FILE, CLOUD_NAME_FILE)
|
||||
.put(HYPERVISOR_HOST_NAME_FILE, HYPERVISOR_HOST_NAME_FILE)
|
||||
.build();
|
||||
|
||||
List<String> metadataFileNames = new ArrayList<>(Arrays.asList(SERVICE_OFFERING_FILE, AVAILABILITY_ZONE_FILE, LOCAL_HOSTNAME_FILE, LOCAL_IPV4_FILE, PUBLIC_HOSTNAME_FILE, PUBLIC_IPV4_FILE,
|
||||
INSTANCE_ID_FILE, VM_ID_FILE, PUBLIC_KEYS_FILE, CLOUD_IDENTIFIER_FILE, HYPERVISOR_HOST_NAME_FILE));
|
||||
INSTANCE_ID_FILE, VM_ID_FILE, PUBLIC_KEYS_FILE, CLOUD_IDENTIFIER_FILE, CLOUD_NAME_FILE, HYPERVISOR_HOST_NAME_FILE));
|
||||
|
||||
static final ConfigKey<Integer> MACIdentifier = new ConfigKey<>("Advanced",Integer.class, "mac.identifier", "0",
|
||||
"This value will be used while generating the mac addresses for isolated and shared networks. The hexadecimal equivalent value will be present at the 2nd octet of the mac address. Default value is zero (0) which means that the DB id of the zone will be used.", true, ConfigKey.Scope.Zone);
|
||||
|
|
@ -315,6 +317,8 @@ public interface NetworkModel {
|
|||
|
||||
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
|
||||
|
||||
void checkIp6CidrSizeEqualTo64(String ip6Cidr) throws InvalidParameterValueException;
|
||||
|
||||
void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException;
|
||||
|
||||
String getStartIpv6Address(long id);
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ import java.util.Date;
|
|||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.Networks.Mode;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class NetworkProfile implements Network {
|
||||
static final Logger s_logger = Logger.getLogger(NetworkProfile.class);
|
||||
private final long id;
|
||||
private final String uuid;
|
||||
private final long dataCenterId;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,15 @@ 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;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.ListGuestVlansCmd;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.RemoveQuarantinedIpCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.UpdateQuarantinedIpCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkPermissionsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkPermissionsCmd;
|
||||
|
|
@ -53,6 +57,7 @@ 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
|
||||
|
|
@ -85,6 +90,8 @@ public interface NetworkService {
|
|||
|
||||
IpAddress reserveIpAddress(Account account, Boolean displayIp, Long ipAddressId) throws ResourceAllocationException;
|
||||
|
||||
IpAddress reserveIpAddressWithVlanDetail(Account account, DataCenter zone, Boolean displayIp, String vlanDetailKey) throws ResourceAllocationException;
|
||||
|
||||
boolean releaseReservedIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||
|
||||
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
|
||||
|
|
@ -96,6 +103,10 @@ public interface NetworkService {
|
|||
|
||||
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
|
||||
|
||||
Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
|
||||
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
|
||||
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
|
||||
|
||||
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
|
||||
|
||||
boolean deleteNetwork(long networkId, boolean forced);
|
||||
|
|
@ -112,6 +123,8 @@ public interface NetworkService {
|
|||
|
||||
IpAddress getIp(long id);
|
||||
|
||||
IpAddress getIp(String ipAddress);
|
||||
|
||||
Network updateGuestNetwork(final UpdateNetworkCmd cmd);
|
||||
|
||||
/**
|
||||
|
|
@ -246,4 +259,13 @@ public interface NetworkService {
|
|||
boolean resetNetworkPermissions(ResetNetworkPermissionsCmd resetNetworkPermissionsCmd);
|
||||
|
||||
void validateIfServiceOfferingIsActiveAndSystemVmTypeIsDomainRouter(final Long serviceOfferingId) throws InvalidParameterValueException;
|
||||
|
||||
PublicIpQuarantine updatePublicIpAddressInQuarantine(UpdateQuarantinedIpCmd cmd);
|
||||
|
||||
void removePublicIpAddressFromQuarantine(RemoveQuarantinedIpCmd cmd);
|
||||
|
||||
InternalLoadBalancerElementService getInternalLoadBalancerElementByType(VirtualRouterProvider.Type type);
|
||||
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
|
||||
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
|
||||
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,8 @@ public class Networks {
|
|||
},
|
||||
UnDecided(null, null),
|
||||
OpenDaylight("opendaylight", String.class),
|
||||
TUNGSTEN("tf", String.class);
|
||||
TUNGSTEN("tf", String.class),
|
||||
NSX("nsx", String.class);
|
||||
|
||||
private final String scheme;
|
||||
private final Class<?> type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface PublicIpQuarantine extends InternalIdentity, Identity {
|
||||
Long getPublicIpAddressId();
|
||||
|
||||
Long getPreviousOwnerId();
|
||||
|
||||
Date getEndDate();
|
||||
|
||||
String getRemovalReason();
|
||||
|
||||
Long getRemoverAccountId();
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
Date getCreated();
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES 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 org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class VNF {
|
||||
|
||||
public enum AccessMethod {
|
||||
SSH_WITH_PASSWORD("ssh-password"),
|
||||
SSH_WITH_KEY("ssh-key"),
|
||||
HTTP("http"),
|
||||
HTTPS("https"),
|
||||
CONSOLE("console");
|
||||
|
||||
String _method;
|
||||
|
||||
AccessMethod(String method) {
|
||||
_method = method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return _method;
|
||||
}
|
||||
|
||||
public static AccessMethod fromValue(String method) {
|
||||
if (StringUtils.isBlank(method)) {
|
||||
return null;
|
||||
} else {
|
||||
for (AccessMethod accessMethod : AccessMethod.values()) {
|
||||
if (accessMethod.toString().equalsIgnoreCase(method)) {
|
||||
return accessMethod;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public enum AccessDetail {
|
||||
ACCESS_METHODS,
|
||||
USERNAME,
|
||||
PASSWORD,
|
||||
SSH_USER,
|
||||
SSH_PASSWORD,
|
||||
SSH_PORT,
|
||||
WEB_USER,
|
||||
WEB_PASSWORD,
|
||||
HTTP_PATH,
|
||||
HTTP_PORT,
|
||||
HTTPS_PATH,
|
||||
HTTPS_PORT
|
||||
}
|
||||
|
||||
public enum VnfDetail {
|
||||
VERSION,
|
||||
VENDOR,
|
||||
MAINTAINER
|
||||
}
|
||||
|
||||
public static class VnfNic {
|
||||
long deviceId;
|
||||
String name;
|
||||
boolean required;
|
||||
boolean management;
|
||||
String description;
|
||||
|
||||
public VnfNic(long deviceId, String nicName, boolean required, boolean management, String nicDescription) {
|
||||
this.deviceId = deviceId;
|
||||
this.name = nicName;
|
||||
this.required = required;
|
||||
this.management = management;
|
||||
this.description = nicDescription;
|
||||
}
|
||||
|
||||
public long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public boolean isManagement() {
|
||||
return management;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,17 +17,22 @@
|
|||
package com.cloud.network;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
|
||||
|
||||
import com.cloud.deploy.DeploymentPlanner;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
public interface VirtualNetworkApplianceService {
|
||||
/**
|
||||
|
|
@ -62,6 +67,10 @@ public interface VirtualNetworkApplianceService {
|
|||
|
||||
VirtualRouter startRouter(long id) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
void startRouterForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlanner planner)
|
||||
throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
|
||||
OperationTimedoutException;
|
||||
|
||||
VirtualRouter destroyRouter(long routerId, Account caller, Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
VirtualRouter findRouter(long routerId);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||
|
||||
public interface VirtualRouterProvider extends InternalIdentity, Identity {
|
||||
public enum Type {
|
||||
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm
|
||||
VirtualRouter, ElasticLoadBalancerVm, VPCVirtualRouter, InternalLbVm, NetScalerVm, Nsx
|
||||
}
|
||||
|
||||
public Type getType();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
|||
/**
|
||||
* @param router
|
||||
* @param network
|
||||
* @param isRedundant
|
||||
* @param params TODO
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
|
|
@ -42,11 +41,30 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
|||
/**
|
||||
* @param router
|
||||
* @param network
|
||||
* @param isRedundant
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean removeVpcRouterFromGuestNetwork(VirtualRouter router, Network network) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
|
||||
/**
|
||||
* @param router
|
||||
* @param network
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean stopKeepAlivedOnRouter(VirtualRouter router, Network network) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
|
||||
/**
|
||||
* @param router
|
||||
* @param network
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
boolean startKeepAlivedOnRouter(VirtualRouter router, Network network) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,7 @@ public interface LoadBalancingServiceProvider extends NetworkElement, IpDeployin
|
|||
List<LoadBalancerTO> updateHealthChecks(Network network, List<LoadBalancingRule> lbrules);
|
||||
|
||||
boolean handlesOnlyRulesInTransitionState();
|
||||
|
||||
default void expungeLbVmRefs(List<Long> vmIds, Long batchSize) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
public interface NetworkACLServiceProvider extends NetworkElement {
|
||||
|
||||
|
|
@ -32,4 +33,6 @@ public interface NetworkACLServiceProvider extends NetworkElement {
|
|||
*/
|
||||
boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
|
||||
|
||||
boolean reorderAclRules(Vpc vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,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.vpc.NetworkACLItem;
|
||||
import com.cloud.network.vpc.PrivateGateway;
|
||||
import com.cloud.network.vpc.StaticRouteProfile;
|
||||
|
|
@ -52,4 +53,6 @@ public interface VpcProvider extends NetworkElement {
|
|||
boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
|
||||
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,20 +79,24 @@ public interface NetworkGuru extends Adapter {
|
|||
* be used to make determination can be isolation methods, services
|
||||
* provided on the guest network and the service provider that's on the
|
||||
* guest network.
|
||||
*
|
||||
* <p>
|
||||
* If a network is already fully substantiated with the necessary resources
|
||||
* during this design phase, then the state should be set to Setup. If
|
||||
* the resources are not allocated at this point, the state should be set
|
||||
* to Allocated.
|
||||
*
|
||||
* @param offering network offering that contains the package of services
|
||||
* the end user intends to use on that network.
|
||||
* @param plan where is this network being deployed.
|
||||
* @param offering network offering that contains the package of services
|
||||
* the end user intends to use on that network.
|
||||
* @param plan where is this network being deployed.
|
||||
* @param userSpecified user specified parameters for this network.
|
||||
* @param owner owner of this network.
|
||||
* @param name
|
||||
* @param vpcId
|
||||
* @param owner owner of this network.
|
||||
* @return Network
|
||||
*/
|
||||
Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner);
|
||||
Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, String name, Long vpcId, Account owner);
|
||||
|
||||
void setup(Network network, long networkId);
|
||||
|
||||
/**
|
||||
* For guest networks that are in Allocated state after the design stage,
|
||||
|
|
@ -208,4 +212,7 @@ public interface NetworkGuru extends Adapter {
|
|||
|
||||
boolean isMyTrafficType(TrafficType type);
|
||||
|
||||
default boolean isSlaacV6Only() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.nsx;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface NsxProvider extends InternalIdentity, Identity {
|
||||
String getHostname();
|
||||
|
||||
String getPort();
|
||||
String getProviderName();
|
||||
String getUsername();
|
||||
long getZoneId();
|
||||
|
||||
String getTier0Gateway();
|
||||
String getEdgeCluster();
|
||||
|
||||
String getTransportZone();
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network.nsx;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
public interface NsxService {
|
||||
|
||||
boolean createVpcNetwork(Long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled);
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
}
|
||||
|
|
@ -29,6 +29,8 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
public static final String defaultVPCOfferingName = "Default VPC offering";
|
||||
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
|
||||
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";
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -53,6 +55,10 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
*/
|
||||
boolean isDefault();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
String getNsxMode();
|
||||
|
||||
/**
|
||||
* @return service offering id used by VPC virtual router
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ public interface VpcProvisioningService {
|
|||
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
|
||||
Map<String, List<String>> serviceProviders,
|
||||
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
|
||||
Long serviceOfferingId, List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);
|
||||
Long serviceOfferingId, Boolean forNsx, String mode,
|
||||
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);
|
||||
|
||||
Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ public interface VpcService {
|
|||
*/
|
||||
boolean startVpc(long vpcId, boolean destroyOnFailure) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
void startVpc(CreateVPCCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Shuts down the VPC which includes shutting down all VPC provider and rules cleanup on the backend
|
||||
*
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription, PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RelatedNetworkOffering, domainid, zoneid, pvlanType, internetProtocol
|
||||
}
|
||||
|
||||
public enum NsxMode {
|
||||
NATTED,
|
||||
ROUTED
|
||||
}
|
||||
|
||||
public final static String SystemPublicNetwork = "System-Public-Network";
|
||||
public final static String SystemControlNetwork = "System-Control-Network";
|
||||
public final static String SystemManagementNetwork = "System-Management-Network";
|
||||
|
|
@ -52,6 +57,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
|
||||
public static final String DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE = "DefaultTungstenSharedNetworkOfferingWithSGService";
|
||||
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_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
|
||||
public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
|
||||
public final static String QuickCloudNoServices = "QuickCloudNoServices";
|
||||
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
|
||||
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
|
||||
|
|
@ -90,6 +100,10 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
boolean isForTungsten();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
String getNsxMode();
|
||||
|
||||
TrafficType getTrafficType();
|
||||
|
||||
boolean isSpecifyVlan();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
|
|||
static final String internalLbVmDefaultOffUniqueName = "Cloud.Com-InternalLBVm";
|
||||
// leaving cloud.com references as these are identifyers and no real world addresses (check against DB)
|
||||
|
||||
|
||||
static final String PURGE_DB_ENTITIES_KEY = "purge.db.entities";
|
||||
|
||||
enum State {
|
||||
Inactive, Active,
|
||||
}
|
||||
|
|
@ -102,7 +105,7 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
boolean getDefaultUse();
|
||||
|
||||
String getSystemVmType();
|
||||
String getVmType();
|
||||
|
||||
String getDeploymentPlanner();
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public interface ManagementService {
|
|||
Pair<List<? extends Configuration>, Integer> searchForConfigurations(ListCfgsByCmd c);
|
||||
|
||||
/**
|
||||
* returns the the configuration groups
|
||||
* returns the configuration groups
|
||||
*
|
||||
* @return list of configuration groups
|
||||
*/
|
||||
|
|
@ -441,16 +441,19 @@ public interface ManagementService {
|
|||
*/
|
||||
Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize, String keyword);
|
||||
|
||||
Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> listHostsForMigrationOfVM(VirtualMachine vm, Long startIndex, Long pageSize, String keyword, List<VirtualMachine> vmList);
|
||||
|
||||
/**
|
||||
* List storage pools for live migrating of a volume. The API returns list of all pools in the cluster to which the
|
||||
* volume can be migrated. Current pool is not included in the list. In case of vSphere datastore cluster storage pools,
|
||||
* this method removes the child storage pools and adds the corresponding parent datastore cluster for API response listing
|
||||
*
|
||||
* @param Long volumeId
|
||||
* @param String keyword if passed, will only return storage pools that contain this keyword in the name
|
||||
* @return Pair<List<? extends StoragePool>, List<? extends StoragePool>> List of storage pools in cluster and list
|
||||
* of pools with enough capacity.
|
||||
*/
|
||||
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(Long volumeId);
|
||||
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(Long volumeId, String keyword);
|
||||
|
||||
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForSystemMigrationOfVolume(Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
public enum ResourceObjectType {
|
||||
UserVm(true, true, true),
|
||||
Template(true, true, true),
|
||||
VnfTemplate(false, false, true),
|
||||
ISO(true, false, true),
|
||||
Volume(true, true),
|
||||
Snapshot(true, false),
|
||||
|
|
@ -68,7 +69,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
GuestOs(false, true),
|
||||
NetworkOffering(false, true),
|
||||
VpcOffering(true, false),
|
||||
Domain(false, false, true);
|
||||
Domain(false, false, true),
|
||||
ObjectStore(false, false, true);
|
||||
|
||||
|
||||
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ package com.cloud.storage;
|
|||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
|
||||
public enum DataStoreRole {
|
||||
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup");
|
||||
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup"), Object("object");
|
||||
|
||||
public boolean isImageStore() {
|
||||
return (role.equalsIgnoreCase("image") || role.equalsIgnoreCase("imagecache")) ? true : false;
|
||||
|
|
@ -45,6 +46,8 @@ public enum DataStoreRole {
|
|||
return ImageCache;
|
||||
} else if (role.equalsIgnoreCase("backup")) {
|
||||
return Backup;
|
||||
} else if (role.equalsIgnoreCase("object")) {
|
||||
return Object;
|
||||
} else {
|
||||
throw new CloudRuntimeException("can't identify the role");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.util.Date;
|
|||
|
||||
public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<Snapshot.State> {
|
||||
public enum Type {
|
||||
MANUAL, RECURRING, TEMPLATE, HOURLY, DAILY, WEEKLY, MONTHLY, GROUP;
|
||||
MANUAL, RECURRING, TEMPLATE, HOURLY, DAILY, WEEKLY, MONTHLY, GROUP, FROM_GROUP;
|
||||
private int max = 8;
|
||||
|
||||
public void setMax(int max) {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,14 @@
|
|||
// under the License.
|
||||
package com.cloud.storage;
|
||||
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class Storage {
|
||||
public static enum ImageFormat {
|
||||
|
|
@ -77,13 +81,18 @@ public class Storage {
|
|||
}
|
||||
|
||||
public static enum Capability {
|
||||
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION");
|
||||
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION"),
|
||||
ALLOW_MIGRATE_OTHER_POOLS("ALLOW_MIGRATE_OTHER_POOLS");
|
||||
|
||||
private final String capability;
|
||||
|
||||
private Capability(String capability) {
|
||||
this.capability = capability;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.capability;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ProvisioningType {
|
||||
|
|
@ -125,40 +134,77 @@ public class Storage {
|
|||
BUILTIN, /* buildin template */
|
||||
PERHOST, /* every host has this template, don't need to install it in secondary storage */
|
||||
USER, /* User supplied template/iso */
|
||||
VNF, /* VNFs (virtual network functions) template */
|
||||
DATADISK, /* Template corresponding to a datadisk(non root disk) present in an OVA */
|
||||
ISODISK /* Template corresponding to a iso (non root disk) present in an OVA */
|
||||
}
|
||||
|
||||
public static enum StoragePoolType {
|
||||
Filesystem(false, true, true), // local directory
|
||||
NetworkFilesystem(true, true, true), // NFS
|
||||
IscsiLUN(true, false, false), // shared LUN, with a clusterfs overlay
|
||||
Iscsi(true, false, false), // for e.g., ZFS Comstar
|
||||
ISO(false, false, false), // for iso image
|
||||
LVM(false, false, false), // XenServer local LVM SR
|
||||
CLVM(true, false, false),
|
||||
RBD(true, true, false), // http://libvirt.org/storage.html#StorageBackendRBD
|
||||
SharedMountPoint(true, false, true),
|
||||
VMFS(true, true, false), // VMware VMFS storage
|
||||
PreSetup(true, true, false), // for XenServer, Storage Pool is set up by customers.
|
||||
EXT(false, true, false), // XenServer local EXT SR
|
||||
OCFS2(true, false, false),
|
||||
SMB(true, false, false),
|
||||
Gluster(true, false, false),
|
||||
PowerFlex(true, true, true), // Dell EMC PowerFlex/ScaleIO (formerly VxFlexOS)
|
||||
ManagedNFS(true, false, false),
|
||||
Linstor(true, true, false),
|
||||
DatastoreCluster(true, true, false), // for VMware, to abstract pool of clusters
|
||||
StorPool(true, true, true);
|
||||
/**
|
||||
* StoragePoolTypes carry some details about the format and capabilities of a storage pool. While not necessarily a
|
||||
* 1:1 with PrimaryDataStoreDriver (and for KVM agent, KVMStoragePool and StorageAdaptor) implementations, it is
|
||||
* often used to decide which storage plugin or storage command to call, so it may be necessary for new storage
|
||||
* plugins to add a StoragePoolType. This can be done by adding it below, or by creating a new public static final
|
||||
* instance of StoragePoolType in the plugin itself, which registers it with the map.
|
||||
*
|
||||
* Note that if the StoragePoolType is for KVM and defined in plugin code rather than below, care must be taken to
|
||||
* ensure this is available on the agent side as well. This is best done by defining the StoragePoolType in a common
|
||||
* package available on both management server and agent plugin jars.
|
||||
*/
|
||||
public static class StoragePoolType {
|
||||
private static final Map<String, StoragePoolType> map = new LinkedHashMap<>();
|
||||
|
||||
public static final StoragePoolType Filesystem = new StoragePoolType("Filesystem", false, true, true);
|
||||
public static final StoragePoolType NetworkFilesystem = new StoragePoolType("NetworkFilesystem", true, true, true);
|
||||
public static final StoragePoolType IscsiLUN = new StoragePoolType("IscsiLUN", true, false, false);
|
||||
public static final StoragePoolType Iscsi = new StoragePoolType("Iscsi", true, false, false);
|
||||
public static final StoragePoolType ISO = new StoragePoolType("ISO", false, false, false);
|
||||
public static final StoragePoolType LVM = new StoragePoolType("LVM", false, false, false);
|
||||
public static final StoragePoolType CLVM = new StoragePoolType("CLVM", true, false, false);
|
||||
public static final StoragePoolType RBD = new StoragePoolType("RBD", true, true, false);
|
||||
public static final StoragePoolType SharedMountPoint = new StoragePoolType("SharedMountPoint", true, true, true);
|
||||
public static final StoragePoolType VMFS = new StoragePoolType("VMFS", true, true, false);
|
||||
public static final StoragePoolType PreSetup = new StoragePoolType("PreSetup", true, true, false);
|
||||
public static final StoragePoolType EXT = new StoragePoolType("EXT", false, true, false);
|
||||
public static final StoragePoolType OCFS2 = new StoragePoolType("OCFS2", true, false, false);
|
||||
public static final StoragePoolType SMB = new StoragePoolType("SMB", true, false, false);
|
||||
public static final StoragePoolType Gluster = new StoragePoolType("Gluster", true, false, false);
|
||||
public static final StoragePoolType PowerFlex = new StoragePoolType("PowerFlex", true, true, true);
|
||||
public static final StoragePoolType ManagedNFS = new StoragePoolType("ManagedNFS", true, false, false);
|
||||
public static final StoragePoolType Linstor = new StoragePoolType("Linstor", true, true, false);
|
||||
public static final StoragePoolType DatastoreCluster = new StoragePoolType("DatastoreCluster", true, true, false);
|
||||
public static final StoragePoolType StorPool = new StoragePoolType("StorPool", true,true,true);
|
||||
public static final StoragePoolType FiberChannel = new StoragePoolType("FiberChannel", true,true,false);
|
||||
|
||||
|
||||
private final String name;
|
||||
private final boolean shared;
|
||||
private final boolean overprovisioning;
|
||||
private final boolean overProvisioning;
|
||||
private final boolean encryption;
|
||||
|
||||
StoragePoolType(boolean shared, boolean overprovisioning, boolean encryption) {
|
||||
/**
|
||||
* New StoragePoolType, set the name to check with it in Dao (Note: Do not register it into the map of pool types).
|
||||
* @param name name of the StoragePoolType.
|
||||
*/
|
||||
public StoragePoolType(String name) {
|
||||
this.name = name;
|
||||
this.shared = false;
|
||||
this.overProvisioning = false;
|
||||
this.encryption = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a new StoragePoolType, and register it into the map of pool types known to the management server.
|
||||
* @param name Simple unique name of the StoragePoolType.
|
||||
* @param shared Storage pool is shared/accessible to multiple hypervisors
|
||||
* @param overProvisioning Storage pool supports overProvisioning
|
||||
* @param encryption Storage pool supports encrypted volumes
|
||||
*/
|
||||
public StoragePoolType(String name, boolean shared, boolean overProvisioning, boolean encryption) {
|
||||
this.name = name;
|
||||
this.shared = shared;
|
||||
this.overprovisioning = overprovisioning;
|
||||
this.overProvisioning = overProvisioning;
|
||||
this.encryption = encryption;
|
||||
addStoragePoolType(this);
|
||||
}
|
||||
|
||||
public boolean isShared() {
|
||||
|
|
@ -166,14 +212,58 @@ public class Storage {
|
|||
}
|
||||
|
||||
public boolean supportsOverProvisioning() {
|
||||
return overprovisioning;
|
||||
return overProvisioning;
|
||||
}
|
||||
|
||||
public boolean supportsEncryption() { return encryption; }
|
||||
public boolean supportsEncryption() {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
private static void addStoragePoolType(StoragePoolType storagePoolType) {
|
||||
map.putIfAbsent(storagePoolType.name, storagePoolType);
|
||||
}
|
||||
|
||||
public static StoragePoolType[] values() {
|
||||
return map.values().toArray(StoragePoolType[]::new).clone();
|
||||
}
|
||||
|
||||
public static StoragePoolType valueOf(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StoragePoolType storage = map.get(name);
|
||||
if (storage == null) {
|
||||
throw new IllegalArgumentException("StoragePoolType '" + name + "' not found");
|
||||
}
|
||||
return storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
StoragePoolType that = (StoragePoolType) o;
|
||||
return Objects.equals(name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<StoragePoolType> getNonSharedStoragePoolTypes() {
|
||||
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<StoragePoolType>();
|
||||
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<>();
|
||||
for (StoragePoolType storagePoolType : StoragePoolType.values()) {
|
||||
if (!storagePoolType.isShared()) {
|
||||
nonSharedStoragePoolTypes.add(storagePoolType);
|
||||
|
|
|
|||
|
|
@ -21,19 +21,29 @@ import java.net.UnknownHostException;
|
|||
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.CreateSecondaryStagingStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteObjectStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.SyncStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateObjectStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateImageStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.CreateSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.RemoveSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.UpdateSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
|
||||
public interface StorageService {
|
||||
/**
|
||||
|
|
@ -103,10 +113,25 @@ public interface StorageService {
|
|||
*/
|
||||
ImageStore migrateToObjectStore(String name, String url, String providerName, Map<String, String> details) throws DiscoveryException;
|
||||
|
||||
ImageStore updateImageStore(UpdateImageStoreCmd cmd);
|
||||
|
||||
ImageStore updateImageStoreStatus(Long id, Boolean readonly);
|
||||
|
||||
void updateStorageCapabilities(Long poolId, boolean failOnChecks);
|
||||
|
||||
StoragePool syncStoragePool(SyncStoragePoolCmd cmd);
|
||||
|
||||
Heuristic createSecondaryStorageHeuristic(CreateSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
Heuristic updateSecondaryStorageHeuristic(UpdateSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||
|
||||
boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);
|
||||
|
||||
ObjectStore updateObjectStore(Long id, UpdateObjectStoragePoolCmd cmd);
|
||||
|
||||
void changeStoragePoolScope(ChangeStoragePoolScopeCmd cmd) throws IllegalArgumentException, InvalidParameterValueException, PermissionDeniedException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import com.cloud.utils.fsm.StateObject;
|
|||
|
||||
public interface Volume extends ControlledEntity, Identity, InternalIdentity, BasedOn, StateObject<Volume.State>, Displayable {
|
||||
|
||||
static final long DISK_OFFERING_SUITABILITY_CHECK_VOLUME_ID = -1;
|
||||
|
||||
// Managed storage volume parameters (specified in the compute/disk offering for PowerFlex)
|
||||
String BANDWIDTH_LIMIT_IN_MBPS = "bandwidthLimitInMbps";
|
||||
String IOPS_LIMIT = "iopsLimit";
|
||||
|
|
@ -39,30 +41,38 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
};
|
||||
|
||||
enum State {
|
||||
Allocated("The volume is allocated but has not been created yet."),
|
||||
Creating("The volume is being created. getPoolId() should reflect the pool where it is being created."),
|
||||
Ready("The volume is ready to be used."),
|
||||
Migrating("The volume is migrating to other storage pool"),
|
||||
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
|
||||
RevertSnapshotting("There is a snapshot created on this volume, the volume is being reverting from snapshot"),
|
||||
Resizing("The volume is being resized"),
|
||||
Expunging("The volume is being expunging"),
|
||||
Expunged("The volume has been expunged, and can no longer be recovered"),
|
||||
Destroy("The volume is destroyed, and can be recovered."),
|
||||
Destroying("The volume is destroying, and can't be recovered."),
|
||||
UploadOp("The volume upload operation is in progress or in short the volume is on secondary storage"),
|
||||
Copying("Volume is copying from image store to primary, in case it's an uploaded volume"),
|
||||
Uploaded("Volume is uploaded"),
|
||||
NotUploaded("The volume entry is just created in DB, not yet uploaded"),
|
||||
UploadInProgress("Volume upload is in progress"),
|
||||
UploadError("Volume upload encountered some error"),
|
||||
UploadAbandoned("Volume upload is abandoned since the upload was never initiated within a specified time"),
|
||||
Attaching("The volume is attaching to a VM from Ready state."),
|
||||
Restoring("The volume is being restored from backup.");
|
||||
Allocated(false, "The volume is allocated but has not been created yet."),
|
||||
Creating(true, "The volume is being created. getPoolId() should reflect the pool where it is being created."),
|
||||
Ready(false, "The volume is ready to be used."),
|
||||
Migrating(true, "The volume is migrating to other storage pool"),
|
||||
Snapshotting(true, "There is a snapshot created on this volume, not backed up to secondary storage yet"),
|
||||
RevertSnapshotting(true, "There is a snapshot created on this volume, the volume is being reverting from snapshot"),
|
||||
Resizing(true, "The volume is being resized"),
|
||||
Expunging(true, "The volume is being expunging"),
|
||||
Expunged(false, "The volume has been expunged, and can no longer be recovered"),
|
||||
Destroy(false, "The volume is destroyed, and can be recovered."),
|
||||
Destroying(false, "The volume is destroying, and can't be recovered."),
|
||||
UploadOp(true, "The volume upload operation is in progress or in short the volume is on secondary storage"),
|
||||
Copying(true, "Volume is copying from image store to primary, in case it's an uploaded volume"),
|
||||
Uploaded(false, "Volume is uploaded"),
|
||||
NotUploaded(true, "The volume entry is just created in DB, not yet uploaded"),
|
||||
UploadInProgress(true, "Volume upload is in progress"),
|
||||
UploadError(false, "Volume upload encountered some error"),
|
||||
UploadAbandoned(false, "Volume upload is abandoned since the upload was never initiated within a specified time"),
|
||||
Attaching(true, "The volume is attaching to a VM from Ready state."),
|
||||
Restoring(true, "The volume is being restored from backup.");
|
||||
|
||||
boolean _transitional;
|
||||
|
||||
String _description;
|
||||
|
||||
private State(String description) {
|
||||
/**
|
||||
* Volume State
|
||||
* @param transitional true for transition/non-final state, otherwise false
|
||||
* @param description description of the state
|
||||
*/
|
||||
private State(boolean transitional, String description) {
|
||||
_transitional = transitional;
|
||||
_description = description;
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +80,10 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
|
|||
return s_fsm;
|
||||
}
|
||||
|
||||
public boolean isTransitional() {
|
||||
return _transitional;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return _description;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,14 @@
|
|||
package com.cloud.storage;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
import com.cloud.utils.Pair;
|
||||
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;
|
||||
import org.apache.cloudstack.api.command.user.volume.CheckAndRepairVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
|
||||
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
|
||||
|
|
@ -37,6 +39,7 @@ 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 {
|
||||
|
||||
|
|
@ -105,10 +108,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)
|
||||
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType) throws ResourceAllocationException;
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
|
||||
|
||||
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo, String name);
|
||||
|
||||
|
|
@ -172,9 +175,13 @@ public interface VolumeApiService {
|
|||
|
||||
boolean validateVolumeSizeInBytes(long size);
|
||||
|
||||
void validateDestroyVolume(Volume volume, Account caller, boolean expunge, boolean forceExpunge);
|
||||
|
||||
Volume changeDiskOfferingForVolume(ChangeOfferingForVolumeCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
void publishVolumeCreationUsageEvent(Volume volume);
|
||||
|
||||
boolean stateTransitTo(Volume vol, Volume.Event event) throws NoTransitionException;
|
||||
|
||||
Pair<String, String> checkAndRepairVolume(CheckAndRepairVolumeCmd cmd) throws ResourceAllocationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,20 @@ package com.cloud.storage.snapshot;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.snapshot.CopySnapshotCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.UpdateSnapshotPolicyCmd;
|
||||
|
||||
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.command.user.snapshot.UpdateSnapshotPolicyCmd;
|
||||
|
||||
public interface SnapshotApiService {
|
||||
|
||||
|
|
@ -50,7 +52,7 @@ public interface SnapshotApiService {
|
|||
* @param snapshotId
|
||||
* TODO
|
||||
*/
|
||||
boolean deleteSnapshot(long snapshotId);
|
||||
boolean deleteSnapshot(long snapshotId, Long zoneId);
|
||||
|
||||
/**
|
||||
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be
|
||||
|
|
@ -88,7 +90,7 @@ public interface SnapshotApiService {
|
|||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType) throws ResourceAllocationException;
|
||||
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, Boolean isFromVmSnapshot)
|
||||
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, Boolean isFromVmSnapshot, List<Long> zoneIds)
|
||||
throws ResourceAllocationException;
|
||||
|
||||
|
||||
|
|
@ -124,4 +126,6 @@ public interface SnapshotApiService {
|
|||
SnapshotPolicy updateSnapshotPolicy(UpdateSnapshotPolicyCmd updateSnapshotPolicyCmd);
|
||||
|
||||
void markVolumeSnapshotsAsDestroyed(Volume volume);
|
||||
|
||||
Snapshot copySnapshot(CopySnapshotCmd cmd) throws StorageUnavailableException, ResourceAllocationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
|||
* Account states.
|
||||
* */
|
||||
enum State {
|
||||
DISABLED, ENABLED, LOCKED;
|
||||
DISABLED, ENABLED, LOCKED, REMOVED;
|
||||
|
||||
/**
|
||||
* The toString method was overridden to maintain consistency in the DB, as the GenericDaoBase uses toString in the enum value to make the sql statements
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public interface AccountService {
|
|||
|
||||
UserAccount getActiveUserAccount(String username, Long domainId);
|
||||
|
||||
List<UserAccount> getActiveUserAccountByEmail(String email, Long domainId);
|
||||
|
||||
UserAccount updateUser(UpdateUserCmd updateUserCmd);
|
||||
|
||||
Account getActiveAccountById(long accountId);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import java.util.List;
|
|||
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.MoveDomainCmd;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface DomainService {
|
||||
|
|
@ -66,4 +68,5 @@ public interface DomainService {
|
|||
*/
|
||||
Domain findDomainByIdOrPath(Long id, String domainPath);
|
||||
|
||||
Domain moveDomainAndChildrenToNewParentDomain(MoveDomainCmd cmd) throws ResourceAllocationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,18 @@ package com.cloud.user;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.ResourceCount;
|
||||
import com.cloud.configuration.ResourceLimit;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.user.ResourceReservation;
|
||||
import com.cloud.offering.DiskOffering;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
public interface ResourceLimitService {
|
||||
|
||||
|
|
@ -33,7 +38,21 @@ public interface ResourceLimitService {
|
|||
static final ConfigKey<Long> MaxProjectSecondaryStorage = new ConfigKey<>("Project Defaults", Long.class, "max.project.secondary.storage", "400",
|
||||
"The default maximum secondary storage space (in GiB) that can be used for a project", false);
|
||||
static final ConfigKey<Long> ResourceCountCheckInterval = new ConfigKey<>("Advanced", Long.class, "resourcecount.check.interval", "300",
|
||||
"Time (in seconds) to wait before running resource recalculation and fixing task. Default is 300 seconds, Setting this to 0 disables execution of the task", false);
|
||||
"Time (in seconds) to wait before running resource recalculation and fixing tasks like stale resource reservation cleanup" +
|
||||
". Default is 300 seconds, Setting this to 0 disables execution of the task", true);
|
||||
static final ConfigKey<Long> ResourceReservationCleanupDelay = new ConfigKey<>("Advanced", Long.class, "resource.reservation.cleanup.delay", "3600",
|
||||
"Time (in seconds) after which a resource reservation gets deleted. Default is 3600 seconds, Setting this to 0 disables execution of the task", true);
|
||||
static final ConfigKey<String> ResourceLimitHostTags = new ConfigKey<>("Advanced", String.class, "resource.limit.host.tags", "",
|
||||
"A comma-separated list of tags for host resource limits", true);
|
||||
static final ConfigKey<String> ResourceLimitStorageTags = new ConfigKey<>("Advanced", String.class, "resource.limit.storage.tags", "",
|
||||
"A comma-separated list of tags for storage resource limits", true);
|
||||
static final ConfigKey<Long> DefaultMaxAccountProjects = new ConfigKey<>("Account Defaults",Long.class,"max.account.projects","10",
|
||||
"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 List<ResourceType> HostTagsSupportingTypes = List.of(ResourceType.user_vm, ResourceType.cpu, ResourceType.memory);
|
||||
static final List<ResourceType> StorageTagsSupportingTypes = List.of(ResourceType.volume, ResourceType.primary_storage);
|
||||
|
||||
/**
|
||||
* Updates an existing resource limit with the specified details. If a limit doesn't exist, will create one.
|
||||
|
|
@ -46,22 +65,27 @@ public interface ResourceLimitService {
|
|||
* TODO
|
||||
* @param max
|
||||
* TODO
|
||||
* @param tag
|
||||
* tag for the resource type
|
||||
*
|
||||
* @return the updated/created resource limit
|
||||
*/
|
||||
ResourceLimit updateResourceLimit(Long accountId, Long domainId, Integer resourceType, Long max);
|
||||
ResourceLimit updateResourceLimit(Long accountId, Long domainId, Integer resourceType, Long max, String tag);
|
||||
|
||||
/**
|
||||
* Updates an existing resource count details for the account/domain
|
||||
*
|
||||
* @param accountId
|
||||
* TODO
|
||||
* Id of the account for which resource recalculation to be done
|
||||
* @param domainId
|
||||
* TODO
|
||||
* Id of the domain for which resource recalculation to be doneDO
|
||||
* @param typeId
|
||||
* TODO
|
||||
* type of the resource for which recalculation to be done
|
||||
* @param tag
|
||||
* tag for the resource type for which recalculation to be done
|
||||
* @return the updated/created resource counts
|
||||
*/
|
||||
List<? extends ResourceCount> recalculateResourceCount(Long accountId, Long domainId, Integer typeId, String tag);
|
||||
List<? extends ResourceCount> recalculateResourceCount(Long accountId, Long domainId, Integer typeId);
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +101,7 @@ public interface ResourceLimitService {
|
|||
* TODO
|
||||
* @return a list of limits that match the criteria
|
||||
*/
|
||||
public List<? extends ResourceLimit> searchForLimits(Long id, Long accountId, Long domainId, ResourceType resourceType, Long startIndex, Long pageSizeVal);
|
||||
public List<? extends ResourceLimit> searchForLimits(Long id, Long accountId, Long domainId, ResourceType resourceType, String tag, Long startIndex, Long pageSizeVal);
|
||||
|
||||
/**
|
||||
* Finds the resource limit for a specified account and type. If the account has an infinite limit, will check
|
||||
|
|
@ -85,9 +109,10 @@ public interface ResourceLimitService {
|
|||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @param tag
|
||||
* @return resource limit
|
||||
*/
|
||||
public long findCorrectResourceLimitForAccount(Account account, ResourceType type);
|
||||
public long findCorrectResourceLimitForAccount(Account account, ResourceType type, String tag);
|
||||
|
||||
/**
|
||||
* This call should be used when we have already queried resource limit for an account. This is to handle
|
||||
|
|
@ -105,9 +130,10 @@ public interface ResourceLimitService {
|
|||
*
|
||||
* @param domain
|
||||
* @param type
|
||||
* @param tag
|
||||
* @return resource limit
|
||||
*/
|
||||
public long findCorrectResourceLimitForDomain(Domain domain, ResourceType type);
|
||||
public long findCorrectResourceLimitForDomain(Domain domain, ResourceType type, String tag);
|
||||
|
||||
/**
|
||||
* Finds the default resource limit for a specified type.
|
||||
|
|
@ -122,9 +148,10 @@ public interface ResourceLimitService {
|
|||
*
|
||||
* @param domain
|
||||
* @param type
|
||||
* @param tag
|
||||
* @return resource limit
|
||||
*/
|
||||
public long findCorrectResourceLimitForAccountAndDomain(Account account, Domain domain, ResourceType type);
|
||||
public long findCorrectResourceLimitForAccountAndDomain(Account account, Domain domain, ResourceType type, String tag);
|
||||
|
||||
/**
|
||||
* Increments the resource count
|
||||
|
|
@ -134,6 +161,7 @@ public interface ResourceLimitService {
|
|||
* @param delta
|
||||
*/
|
||||
public void incrementResourceCount(long accountId, ResourceType type, Long... delta);
|
||||
public void incrementResourceCountWithTag(long accountId, ResourceType type, String tag, Long... delta);
|
||||
|
||||
/**
|
||||
* Decrements the resource count
|
||||
|
|
@ -143,6 +171,7 @@ public interface ResourceLimitService {
|
|||
* @param delta
|
||||
*/
|
||||
public void decrementResourceCount(long accountId, ResourceType type, Long... delta);
|
||||
public void decrementResourceCountWithTag(long accountId, ResourceType type, String tag, Long... delta);
|
||||
|
||||
/**
|
||||
* Checks if a limit has been exceeded for an account
|
||||
|
|
@ -155,15 +184,17 @@ public interface ResourceLimitService {
|
|||
* @throws ResourceAllocationException
|
||||
*/
|
||||
public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException;
|
||||
public void checkResourceLimitWithTag(Account account, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Gets the count of resources for a resource type and account
|
||||
*
|
||||
* @param account
|
||||
* @param type
|
||||
* @param tag
|
||||
* @return count of resources
|
||||
*/
|
||||
public long getResourceCount(Account account, ResourceType type);
|
||||
public long getResourceCount(Account account, ResourceType type, String tag);
|
||||
|
||||
/**
|
||||
* Checks if a limit has been exceeded for an account if displayResource flag is on
|
||||
|
|
@ -208,15 +239,49 @@ public interface ResourceLimitService {
|
|||
*/
|
||||
void decrementResourceCount(long accountId, ResourceType type, Boolean displayResource, Long... delta);
|
||||
|
||||
/**
|
||||
* Adds a reservation that will be counted in subsequent calls to {count}getResourceCount{code} until {code}this[code}
|
||||
* is closed. It will create a reservation record that will be counted when resource limits are checked.
|
||||
* @param account The account for which the reservation is.
|
||||
* @param displayResource whether this resource is shown to users at all (if not it is not counted to limits)
|
||||
* @param type resource type
|
||||
* @param delta amount to reserve (will not be <+ 0)
|
||||
* @return a {code}AutoClosable{Code} object representing the resource the user needs
|
||||
*/
|
||||
ResourceReservation getReservation(Account account, Boolean displayResource, ResourceType type, Long delta) throws ResourceAllocationException;
|
||||
List<String> getResourceLimitHostTags();
|
||||
List<String> getResourceLimitHostTags(ServiceOffering serviceOffering, VirtualMachineTemplate template);
|
||||
List<String> getResourceLimitStorageTags();
|
||||
List<String> getResourceLimitStorageTags(DiskOffering diskOffering);
|
||||
void updateTaggedResourceLimitsAndCountsForAccounts(List<AccountResponse> responses, String tag);
|
||||
void updateTaggedResourceLimitsAndCountsForDomains(List<DomainResponse> responses, String tag);
|
||||
void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
|
||||
|
||||
void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize,
|
||||
DiskOffering currentOffering, DiskOffering newOffering) throws ResourceAllocationException;
|
||||
|
||||
void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
|
||||
|
||||
void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
|
||||
void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
|
||||
|
||||
void updateVmResourceCountForTemplateChange(long accountId, Boolean display, ServiceOffering offering, VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate);
|
||||
|
||||
void updateVmResourceCountForServiceOfferingChange(long accountId, Boolean display, Long currentCpu, Long newCpu, Long currentMemory,
|
||||
Long newMemory,
|
||||
ServiceOffering currentOffering, ServiceOffering newOffering,
|
||||
VirtualMachineTemplate template);
|
||||
|
||||
void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean display, Long currentSize, Long newSize,
|
||||
DiskOffering currentDiskOffering, DiskOffering newDiskOffering);
|
||||
|
||||
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
|
||||
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
|
||||
void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
|
||||
void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
|
||||
void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
|
||||
|
||||
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
|
||||
Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
|
||||
|
||||
void checkVmResourceLimitsForTemplateChange(Account owner, Boolean display, ServiceOffering offering,
|
||||
VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate) throws ResourceAllocationException;
|
||||
|
||||
void checkVmCpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu) throws ResourceAllocationException;
|
||||
void incrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
|
||||
void decrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
|
||||
void checkVmMemoryResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory) throws ResourceAllocationException;
|
||||
void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
|
||||
void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public interface User extends OwnedBy, InternalIdentity {
|
|||
|
||||
// UNKNOWN and NATIVE can be used interchangeably
|
||||
public enum Source {
|
||||
LDAP, SAML2, SAML2DISABLED, UNKNOWN, NATIVE
|
||||
OAUTH2, LDAP, SAML2, SAML2DISABLED, UNKNOWN, NATIVE
|
||||
}
|
||||
|
||||
public static final long UID_SYSTEM = 1;
|
||||
|
|
|
|||
|
|
@ -48,4 +48,6 @@ public interface UserVm extends VirtualMachine, ControlledEntity {
|
|||
void setAccountId(long accountId);
|
||||
|
||||
public boolean isDisplayVm();
|
||||
|
||||
String getUserVmType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public class NicProfile implements InternalIdentity, Serializable {
|
|||
String iPv4Dns1;
|
||||
String iPv4Dns2;
|
||||
String requestedIPv4;
|
||||
boolean ipv4AllocationRaceCheck;
|
||||
|
||||
// IPv6
|
||||
String iPv6Address;
|
||||
|
|
@ -405,6 +406,13 @@ public class NicProfile implements InternalIdentity, Serializable {
|
|||
this.mtu = mtu;
|
||||
}
|
||||
|
||||
public boolean getIpv4AllocationRaceCheck() {
|
||||
return this.ipv4AllocationRaceCheck;
|
||||
}
|
||||
|
||||
public void setIpv4AllocationRaceCheck(boolean ipv4AllocationRaceCheck) {
|
||||
this.ipv4AllocationRaceCheck = ipv4AllocationRaceCheck;
|
||||
}
|
||||
|
||||
//
|
||||
// OTHER METHODS
|
||||
|
|
@ -442,6 +450,6 @@ public class NicProfile implements InternalIdentity, Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("NicProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "vmId", "reservationId", "iPv4Address", "broadcastUri"));
|
||||
return String.format("NicProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "vmId", "deviceId", "broadcastUri", "reservationId", "iPv4Address"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -41,9 +42,11 @@ import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
|||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.deploy.DeploymentPlanner;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ManagementServerException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
|
|
@ -65,10 +68,7 @@ public interface UserVmService {
|
|||
/**
|
||||
* Destroys one virtual machine
|
||||
*
|
||||
* @param userId
|
||||
* the id of the user performing the action
|
||||
* @param vmId
|
||||
* the id of the virtual machine.
|
||||
* @param cmd the API Command Object containg the parameters to use for this service action
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
|
|
@ -109,7 +109,13 @@ public interface UserVmService {
|
|||
UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException, ResourceAllocationException;
|
||||
|
||||
UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ResourceAllocationException;
|
||||
|
||||
void startVirtualMachine(UserVm vm) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
void startVirtualMachineForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object> params,
|
||||
DeploymentPlanner planner) throws InsufficientCapacityException, ResourceUnavailableException,
|
||||
ConcurrentOperationException, OperationTimedoutException;
|
||||
|
||||
UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
|
|
@ -147,14 +153,6 @@ public interface UserVmService {
|
|||
* Creates a Basic Zone User VM in the database and returns the VM to the
|
||||
* caller.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param sshKeyPair
|
||||
* - name of the ssh key pair used to login to the virtual
|
||||
* machine
|
||||
* @param cpuSpeed
|
||||
* @param memory
|
||||
* @param cpuNumber
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -230,9 +228,6 @@ public interface UserVmService {
|
|||
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in
|
||||
* the database and returns the VM to the caller.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -308,14 +303,6 @@ public interface UserVmService {
|
|||
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
|
||||
* in the database and returns the VM to the caller.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param sshKeyPair
|
||||
* - name of the ssh key pair used to login to the virtual
|
||||
* machine
|
||||
* @param cpuSpeed
|
||||
* @param memory
|
||||
* @param cpuNumber
|
||||
* @param zone
|
||||
* - availability zone for the virtual machine
|
||||
* @param serviceOffering
|
||||
|
|
@ -489,9 +476,9 @@ public interface UserVmService {
|
|||
|
||||
VirtualMachine vmStorageMigration(Long vmId, Map<String, String> volumeToPool);
|
||||
|
||||
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ResourceAllocationException;
|
||||
|
||||
UserVm restoreVirtualMachine(Account caller, long vmId, Long newTemplateId) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
UserVm restoreVirtualMachine(Account caller, long vmId, Long newTemplateId, Long rootDiskOfferingId, boolean expunge, Map<String, String> details) throws InsufficientCapacityException, ResourceUnavailableException;
|
||||
|
||||
UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
|
||||
VirtualMachineMigrationException;
|
||||
|
|
@ -518,7 +505,8 @@ public interface UserVmService {
|
|||
|
||||
UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceName, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
|
||||
final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey,
|
||||
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters, final VirtualMachine.PowerState powerState) throws InsufficientCapacityException;
|
||||
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters,
|
||||
final VirtualMachine.PowerState powerState, final LinkedHashMap<String, List<NicProfile>> networkNicMap) throws InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Unmanage a guest VM from CloudStack
|
||||
|
|
|
|||
|
|
@ -315,6 +315,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Partition,
|
|||
@Override
|
||||
Long getHostId();
|
||||
|
||||
|
||||
void setHostId(Long hostId);
|
||||
|
||||
/**
|
||||
* @return should HA be enabled for this machine?
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public interface VirtualMachineProfile {
|
|||
|
||||
void setConfigDriveLocation(NetworkElement.Location location);
|
||||
|
||||
void setServiceOffering(ServiceOffering offering);
|
||||
|
||||
public static class Param {
|
||||
|
||||
public static final Param VmPassword = new Param("VmPassword");
|
||||
|
|
@ -190,6 +192,10 @@ public interface VirtualMachineProfile {
|
|||
|
||||
Map<Param, Object> getParameters();
|
||||
|
||||
void setCpuOvercommitRatio(Float cpuOvercommitRatio);
|
||||
|
||||
void setMemoryOvercommitRatio(Float memoryOvercommitRatio);
|
||||
|
||||
Float getCpuOvercommitRatio();
|
||||
|
||||
Float getMemoryOvercommitRatio();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue