1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Merge branch 'master' into f-3951

This commit is contained in:
Tino Vazquez 2021-01-25 18:04:03 +01:00
commit d056a45eea
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
32 changed files with 668 additions and 117 deletions

View File

@ -346,6 +346,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \
$VAR_LOCATION/remotes/im/dummy-probes.d/host/system \
$VAR_LOCATION/remotes/im/dummy-probes.d/vm/monitor \
$VAR_LOCATION/remotes/im/dummy-probes.d/vm/status \
$VAR_LOCATION/remotes/im/dummy-probes.d/vm/snapshot \
$VAR_LOCATION/remotes/im/lxd.d \
$VAR_LOCATION/remotes/im/lxd-probes.d/host/beacon \
$VAR_LOCATION/remotes/im/lxd-probes.d/host/monitor \
@ -367,24 +368,28 @@ VAR_DIRS="$VAR_LOCATION/remotes \
$VAR_LOCATION/remotes/im/ec2-probes.d/host/system \
$VAR_LOCATION/remotes/im/ec2-probes.d/vm/monitor \
$VAR_LOCATION/remotes/im/ec2-probes.d/vm/status \
$VAR_LOCATION/remotes/im/ec2-probes.d/vm/snapshot \
$VAR_LOCATION/remotes/im/az.d \
$VAR_LOCATION/remotes/im/az-probes.d/host/beacon \
$VAR_LOCATION/remotes/im/az-probes.d/host/monitor \
$VAR_LOCATION/remotes/im/az-probes.d/host/system \
$VAR_LOCATION/remotes/im/az-probes.d/vm/monitor \
$VAR_LOCATION/remotes/im/az-probes.d/vm/status \
$VAR_LOCATION/remotes/im/az-probes.d/vm/snapshot \
$VAR_LOCATION/remotes/im/one.d \
$VAR_LOCATION/remotes/im/one-probes.d/host/beacon \
$VAR_LOCATION/remotes/im/one-probes.d/host/monitor \
$VAR_LOCATION/remotes/im/one-probes.d/host/system \
$VAR_LOCATION/remotes/im/one-probes.d/vm/monitor \
$VAR_LOCATION/remotes/im/one-probes.d/vm/status \
$VAR_LOCATION/remotes/im/one-probes.d/vm/snapshot \
$VAR_LOCATION/remotes/im/packet.d \
$VAR_LOCATION/remotes/im/packet-probes.d/host/beacon \
$VAR_LOCATION/remotes/im/packet-probes.d/host/monitor \
$VAR_LOCATION/remotes/im/packet-probes.d/host/system \
$VAR_LOCATION/remotes/im/packet-probes.d/vm/monitor \
$VAR_LOCATION/remotes/im/packet-probes.d/vm/status \
$VAR_LOCATION/remotes/im/packet-probes.d/vm/snapshot \
$VAR_LOCATION/remotes/vmm \
$VAR_LOCATION/remotes/vmm/lib \
$VAR_LOCATION/remotes/vmm/kvm \

View File

@ -451,6 +451,20 @@ VM_MAD = [
disk-detach, nic-attach, nic-detach, snapshot-create, snapshot-delete"
]
# This variant should be used for nested virtualization
VM_MAD = [
NAME = "qemu",
SUNSTONE_NAME = "QEMU",
EXECUTABLE = "one_vmm_exec",
ARGUMENTS = "-t 15 -r 0 kvm",
DEFAULT = "vmm_exec/vmm_exec_kvm.conf",
TYPE = "qemu",
KEEP_SNAPSHOTS = "yes",
LIVE_RESIZE = "yes",
IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
resume, delete, reboot, reboot-hard, resched, unresched, disk-attach,
disk-detach, nic-attach, nic-detach, snapshot-create, snapshot-delete"
]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@ -531,66 +545,6 @@ VM_MAD = [
]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# EC2 Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of actions performed at the same time
# -w Timeout in seconds to execute external commands (default unlimited)
# -p more than one action per host in parallel, needs support from hypervisor
#-------------------------------------------------------------------------------
#VM_MAD = [
# NAME = "ec2",
# SUNSTONE_NAME = "Amazon EC2",
# EXECUTABLE = "one_vmm_sh",
# ARGUMENTS = "-t 15 -r 0 -w 600 -p ec2",
# TYPE = "xml",
# KEEP_SNAPSHOTS = "no",
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
# snap-create, snap-delete"
#]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Azure Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of actions performed at the same time
# -w Timeout in seconds to execute external commands (default unlimited)
#-------------------------------------------------------------------------------
#VM_MAD = [
# NAME = "az",
# SUNSTONE_NAME = "Microsoft Azure",
# EXECUTABLE = "one_vmm_sh",
# ARGUMENTS = "-t 15 -r 0 az",
# TYPE = "xml",
# KEEP_SNAPSHOTS = "no",
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
# snap-create, snap-delete"
#]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Hybrid OpenNebula Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of actions performed at the same time
#-------------------------------------------------------------------------------
# VM_MAD = [
# NAME = "one",
# SUNSTONE_NAME = "OpenNebula",
# EXECUTABLE = "one_vmm_sh",
# ARGUMENTS = "-t 15 -r 0 one",
# TYPE = "xml",
# KEEP_SNAPSHOTS = "no",
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard"
# ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Dummy Virtualization Driver Configuration
#-------------------------------------------------------------------------------

View File

@ -9,17 +9,16 @@ plain:
location_key: 'region'
connection:
access_key: 'Encrypted AWS access key'
secret_key: 'Encrypted AWS secret key'
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-central-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0e342d72b12109f91'
- 'ami-0b793c1e0d1dc4d28'
- 'ami-04c21037b3f953d37'
- name: 'aws_instance_type'
type: 'list'
options:
- 'i3-metal'
- 'i3.metal'

View File

@ -0,0 +1,24 @@
name: 'aws-london'
description: 'Elastic cluster on AWS in London'
provider: 'aws'
plain:
provision_type: 'hybrid+_qemu'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-west-2'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0bab5c8be0975423b'
- name: 'aws_instance_type'
type: 'list'
options:
- 'i3.metal'

View File

@ -9,18 +9,16 @@ plain:
location_key: 'region'
connection:
access_key: 'Encrypted AWS access key'
secret_key: 'Encrypted AWS secret key'
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-east-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-096fda3c22c1c990a'
- 'ami-00ddb0e5626798373'
- 'ami-0d6e9a57f6259ba3a'
- name: 'aws_instance_type'
type: 'list'
options:
- 'i3-metal'
- 'i3.large'
- 'i3.metal'

View File

@ -0,0 +1,24 @@
name: 'aws-north-california'
description: 'Elastic cluster on AWS in North California'
provider: 'aws'
plain:
provision_type: 'hybrid+'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-west-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-08b547f0dcb46c4d3'
- name: 'aws_instance_type'
type: 'list'
options:
- 'i3.metal'

View File

@ -9,16 +9,15 @@ plain:
location_key: 'facility'
connection:
token: 'Encrypted Packet token'
project: 'Encrypted Packet project'
token: 'Packet token'
project: 'Packet project'
facility: 'ams1'
inputs:
- name: 'packet_os'
type: 'list'
options:
- 'centos_7'
- 'ubuntu_18_04'
- 'centos_8'
- name: 'packet_plan'
type: 'list'
options:

View File

@ -0,0 +1,26 @@
name: 'packet-ewr1'
description: 'Elastic cluster on Packet in Parsippany, USA, NJ'
provider: 'packet'
plain:
provision_type: 'hybrid+'
image: 'EQUINIX.webp'
location_key: 'facility'
connection:
token: 'Packet token'
project: 'Packet project'
facility: 'ewr1'
inputs:
- name: 'packet_os'
type: 'list'
options:
- 'centos_8'
- name: 'packet_plan'
type: 'list'
options:
- 't1.small'
- 'c1.small'
- 'm1.xlarge'

View File

@ -0,0 +1,26 @@
name: 'packet-nrt1'
description: 'Elastic cluster on Packet in Tokyo, Japan'
provider: 'packet'
plain:
provision_type: 'hybrid+'
image: 'EQUINIX.webp'
location_key: 'facility'
connection:
token: 'Packet token'
project: 'Packet project'
facility: 'nrt1'
inputs:
- name: 'packet_os'
type: 'list'
options:
- 'centos_8'
- name: 'packet_plan'
type: 'list'
options:
- 't1.small'
- 'c1.small'
- 'm1.xlarge'

View File

@ -0,0 +1,26 @@
name: 'packet-sjc1'
description: 'Elastic cluster on Packet in Sunnyvale, USA, CA'
provider: 'packet'
plain:
provision_type: 'hybrid+'
image: 'EQUINIX.webp'
location_key: 'facility'
connection:
token: 'Packet token'
project: 'Packet project'
facility: 'sjc1'
inputs:
- name: 'packet_os'
type: 'list'
options:
- 'centos_8'
- name: 'packet_plan'
type: 'list'
options:
- 't1.small'
- 'c1.small'
- 'm1.xlarge'

View File

@ -58,6 +58,8 @@ defaults:
ami: "${input.aws_ami_image}"
instancetype: "${input.aws_instance_type}"
cloud_init: true
connection:
remote_user: 'centos'
#-------------------------------------------------------------------------------
# cluster: Parameters for the OpenNebula cluster. Applies to all the Hosts

View File

@ -0,0 +1,7 @@
The QEMU provision uses nested virtualization (KVM) to start emulated VMs in virtualized hosts. It is useful for developing and testing purposes. It features the following characteristics:
* Hosts are provisioned as VMs in the selected provider
* The provision includes a public network (Internet reachable IPs)
* It also includes a virtual network template to create private VLANs. You need to instantiate this network template.
More information about using this provision can be found in the [OpenNebula documentation](https://opennebula.io)

View File

@ -0,0 +1,26 @@
name: 'aws-frankfurt'
description: 'Elastic cluster on AWS in Frankfurt'
provider: 'aws'
plain:
provision_type: 'hybrid+_qemu'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-central-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-04c21037b3f953d37'
- name: 'aws_instance_type'
type: 'list'
options:
- 't2.micro'
- 't2.small'
- 't2.medium'

View File

@ -0,0 +1,26 @@
name: 'aws-london'
description: 'Elastic cluster on AWS in London'
provider: 'aws'
plain:
provision_type: 'hybrid+_qemu'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-west-2'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0bab5c8be0975423b'
- name: 'aws_instance_type'
type: 'list'
options:
- 't2.micro'
- 't2.small'
- 't2.medium'

View File

@ -0,0 +1,26 @@
name: 'aws-north-virginia'
description: 'Elastic cluster on AWS in North Virginia'
provider: 'aws'
plain:
provision_type: 'hybrid+_qemu'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-east-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0d6e9a57f6259ba3a'
- name: 'aws_instance_type'
type: 'list'
options:
- 't2.micro'
- 't2.small'
- 't2.medium'

View File

@ -0,0 +1,26 @@
name: 'aws-north-california'
description: 'Elastic cluster on AWS in North California'
provider: 'aws'
plain:
provision_type: 'hybrid+_qemu'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-west-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-08b547f0dcb46c4d3'
- name: 'aws_instance_type'
type: 'list'
options:
- 't2.micro'
- 't2.small'
- 't2.medium'

View File

@ -0,0 +1,39 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# datastores: Defines the storage area for the cluster using the SSH replication
# drivers. It creates the following datastores, using Replica driver:
# 1. Image datastore, ${cluster_name}-image
# 2. System datastore, ${cluster_name}-system
#
# Configuration/Input attributes:
# - replica_host: The host that will hold the cluster replicas and snapshots.
#-------------------------------------------------------------------------------
datastores:
- name: "${provision}-image"
type: 'image_ds'
ds_mad: 'fs'
tm_mad: 'ssh'
safe_dirs: "/var/tmp /tmp"
- name: "${provision}-system"
type: 'system_ds'
tm_mad: 'ssh'
safe_dirs: "/var/tmp /tmp"
replica_host: "use-first-host"

View File

@ -0,0 +1,26 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
# configuration: Ansible role parameters.
#--------------------------------------------------------------------------------
# Check defaults/main.yml in each role for the available variables
#-------------------------------------------------------------------------------
...

View File

@ -0,0 +1,38 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
inputs:
- name: 'number_hosts'
type: text
description: 'Number of AWS instances to create'
default: '1'
- name: 'number_public_ips'
type: text
description: 'Number of public IPs to get'
default: '1'
- name: 'aws_ami_image'
type: text
description: "AWS ami image used for host deployments"
default: ''
- name: 'aws_instance_type'
type: text
description: "AWS instance type, use bare-metal instances, otherwise use QEMU"
default: ''
...

View File

@ -0,0 +1,40 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
networks:
- name: "${provision}-public"
vn_mad: 'elastic'
bridge: 'br0'
netrole: 'public'
provision:
count: "${input.number_public_ips}"
ar:
- provison_id: "${provision_id}"
size: '1'
ipam_mad: 'aws'
cidr: "${cluster.0.cidr}"
vntemplates:
- name: "${provision}-private"
vn_mad: 'vxlan'
phydev: 'eth0'
automatic_vlan_id: 'yes'
netrole: 'private'
vxlan_mode: 'evpn'
vxlan_tep: 'dev'
ip_link_conf: 'nolearning='
cluster_ids: "${cluster.0.id}"

View File

@ -0,0 +1,80 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# This is the canonical description file for a cluster build with 'AWS'
# resources using the KVM hypervisor.
# ------------------------------------------------------------------------------
name: 'aws-cluster'
provision_type: 'hybrid+_qemu'
provider: 'aws'
image: 'OPENNEBULA-AWS.png'
extends:
- common.d/defaults.yml
- common.d/resources.yml
- common.d/qemu_hosts.yml
- aws.d/datastores.yml
- aws.d/defaults.yml
- aws.d/inputs.yml
- aws.d/networks.yml
#-------------------------------------------------------------------------------
# playbook: Ansible playbook used for hosts configuration.The aws playbook
# include the following roles:
# - ddc
# - opennebula-repository
# - opennebula-node-kvm
# - opennebula-ssh
# - tuntap
# - bridged-networking
# - iptables
#-------------------------------------------------------------------------------
playbook:
- aws
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
defaults:
provision:
provider_name: 'aws'
ami: "${input.aws_ami_image}"
instancetype: "${input.aws_instance_type}"
cloud_init: true
connection:
remote_user: 'centos'
#-------------------------------------------------------------------------------
# cluster: Parameters for the OpenNebula cluster. Applies to all the Hosts
#--------------------------------------------------------------------------------
# name: of the cluster
# description: Additional information
# reserved_cpu: In percentage. It will be subtracted from the TOTAL CPU
# reserved_memory: In percentage. It will be subtracted from the TOTAL MEM
#--------------------------------------------------------------------------------
cluster:
name: "${provision}"
description: 'AWS cluster'
reserved_cpu: '0'
reserved_mem: '0'
datastores:
- 1
provision:
cidr: '10.0.0.0/16'

View File

@ -0,0 +1,32 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
defaults:
configuration:
opennebula_node_kvm_use_ev: true
# required for copying recovery VM snaphosts to the replica host
opennebula_ssh_deploy_private_key: true
# Options to enable nested virtualization
opennebula_node_kvm_param_nested: True
opennebula_node_kvm_manage_kvm: False

View File

@ -0,0 +1,35 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# hosts: Packet or AWS metal servers
# provision:
# - count: Number of servers to create
# - hostname: kvm-host1, kvm-host2 .... of the server
#
# You can define specific OpenNebula configuration attributes for all the hosts:
# - reserved_cpu: In percentage. It will be subtracted from the TOTAL CPU
# - reserved_memory: In percentage. It will be subtracted from the TOTAL MEM
#-------------------------------------------------------------------------------
hosts:
- im_mad: 'kvm'
vm_mad: 'qemu'
provision:
count: "${input.number_hosts}"
hostname: "qemu-host${index}"
...

View File

@ -0,0 +1,38 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# Use this file to define custom resources associated to the cluster, example:
# - images
# - marketplaceapps
# - templates
# - vntemplates
# - flowtemplates
#
# Cross-references to other objects can be made:
# - by name, eg. ${datastore.images.id} to get the OpenNebula ID of the
# datastore with name "images"
# - by index, eg. ${datastore.0.id} to get the OpenNebula ID of the **first**
# datastore defined in the provision
#-------------------------------------------------------------------------------
marketplaceapps:
- appname: "Alpine Linux 3.10"
name: "alpine"
dsid: "${datastore.0.id}"
meta:
wait: true
wait_timeout: 60

View File

@ -489,6 +489,9 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
def resources_operation(args, operation, options, type)
parse_options(options)
OneProvision::Utils.print_cmd("#{type} #{operation[:operation]}",
options)
objects = names_to_ids(args[0], type)
return [-1, objects.message] if OpenNebula.is_error?(objects)
@ -498,7 +501,7 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
operation[:message]) do |obj|
rc = obj.info
return rc if OpenNebula.is_error?(rc)
return [-1, rc.message] if OpenNebula.is_error?(rc)
case type
when 'HOSTS'
@ -515,14 +518,14 @@ class OneProvisionHelper < OpenNebulaHelper::OneHelper
end
unless p_id
return OpenNebula::Error.new('No provision ID found')
return [-1, 'No provision ID found']
end
provision = OneProvision::Provision.new_with_id(p_id, @client)
rc = provision.info
return rc if OpenNebula.is_error?(rc)
return [-1, rc.message] if OpenNebula.is_error?(rc)
provision.update_objects(type.downcase, :remove, obj['ID'])
end

View File

@ -99,6 +99,8 @@ CommandParser::CmdParser.new(ARGV) do
:options => OneProvisionHelper::CREATE_OPTIONS do
helper.parse_options(options)
OneProvision::Utils.print_cmd('create', options)
if options[:cleanup_timeout].nil?
timeout = 20
else
@ -123,7 +125,7 @@ CommandParser::CmdParser.new(ARGV) do
if OpenNebula.is_error?(rc)
STDERR.puts rc.message
exit(-1)
elsif rc < 0
elsif rc.to_i < 0
puts "ID: #{rc}"
rc
else
@ -191,6 +193,8 @@ CommandParser::CmdParser.new(ARGV) do
[OpenNebulaHelper::FORMAT] do
helper.parse_options(options)
OneProvision::Utils.print_cmd('configure', options)
rc = helper.configure(args[0], options.key?(:force))
if OpenNebula.is_error?(rc)
@ -217,6 +221,8 @@ CommandParser::CmdParser.new(ARGV) do
[OpenNebulaHelper::FORMAT] do
helper.parse_options(options)
OneProvision::Utils.print_cmd('delete', options)
if options[:cleanup_timeout].nil?
timeout = 20
else
@ -354,14 +360,18 @@ CommandParser::CmdParser.new(ARGV) do
:options => [OneProvisionHelper::MODES,
OneProvisionHelper::FORCE] do
rc = helper.resources_operation(args,
{},
{ :operation => 'delete' },
options,
resource.upcase)
return 0 if rc[0] == 0
STDERR.puts rc[1]
exit(-1)
if rc.is_a?(Array) && rc[0] == 0
0
elsif rc.is_a?(Array)
STDERR.puts rc[1]
exit(-1)
else
0
end
end
end
end

View File

@ -69,7 +69,7 @@ const Template = () => ({
const RenderDescription = ({ description = '' }) => (
<p>{(sanitize`${description}`)?.split(' ').map((string, idx) =>
isExternalURL(string)
? <Link key={`link-${idx}`} color='textPrimary' href={string}>{string}</Link>
? <Link key={`link-${idx}`} color='textPrimary' target='_blank' href={string}>{string}</Link>
: ` ${string}`
)}</p>
)

View File

@ -76,7 +76,7 @@ const Template = () => ({
const RenderDescription = ({ description = '' }) => (
<p>{(sanitize`${description}`)?.split(' ').map((string, idx) =>
isExternalURL(string)
? <Link key={`link-${idx}`} color='textPrimary' href={string}>{string}</Link>
? <Link key={`link-${idx}`} color='textPrimary' target='_blank' href={string}>{string}</Link>
: ` ${string}`
)}</p>
)

View File

@ -257,7 +257,16 @@ module OneProvision
if cfg['inputs'].nil?
cfg['inputs'] = provider.inputs
else
cfg['inputs'] << provider.inputs unless provider.inputs.nil?
unless provider.inputs.nil?
provider.inputs.each do |input|
i = cfg['inputs'].find do |v|
v['name'] == input['name']
end
cfg['inputs'].delete(i) if i
cfg['inputs'] << input
end
end
end
cfg.validate(false)
@ -424,7 +433,7 @@ module OneProvision
def update_objects(object, operation, id, name = nil)
rc = info
return rc if OpenNebula.is_error?(rc)
return [-1, rc.message] if OpenNebula.is_error?(rc)
if FULL_CLUSTER.include?(object)
path = 'infrastructure'
@ -438,11 +447,11 @@ module OneProvision
o = Resource.object(object, provider)
rc = o.info(id)
return rc if OpenNebula.is_error?(rc)
return [-1, rc.message] if OpenNebula.is_error?(rc)
rc = o.delete(FULL_CLUSTER.include?(object) ? tf : nil)
return rc if OpenNebula.is_error?(rc)
return [-1, rc.message] if OpenNebula.is_error?(rc)
# If it is an array, a host has been deleted
if rc.is_a? Array
@ -455,7 +464,11 @@ module OneProvision
end
end
update
rc = update
[-1, rc.message] if OpenNebula.is_error?(rc)
0
end
# Reads provider name from template

View File

@ -49,6 +49,27 @@ module OneProvision
ERROR_OPEN = 'ERROR MESSAGE --8<------'
ERROR_CLOSE = 'ERROR MESSAGE ------>8--'
# Prints command and options in the debug output
#
# @param cmd [String] Command executed
# @param options [Hash] Command optioms
def print_cmd(cmd, options)
cmd_options = []
options.each do |key, value|
if value
cmd_options << "[#{key}, #{value}]"
else
cmd_options << key
end
end
cmd_options = cmd_options.join(' ')
OneProvisionLogger.debug("Executing command: `#{cmd}`")
OneProvisionLogger.debug("Command options: #{cmd_options}")
end
# Checks if the file can be read
#
# @param name [String] Path to file to read

View File

@ -19,8 +19,6 @@
dir="$1"
vms=$(ls "$dir" | grep '^[0-9]\+$')
one_dir=$(dirname $0 | sed -e 's/tm\/ssh//')
xpath="$one_dir/datastore/xpath.rb --stdin"
for vm in $vms; do
vmdir="${dir}/${vm}"
@ -52,28 +50,6 @@ for vm in $vms; do
"[ ID=${snap}, DISK_ID=${disk_id}, SIZE=${snap_size}]"
done
fi
# create disk recovery snapshot if required
if [ -f "${dir}/${vm}/vm.xml" ] && [ -f "${dir}/${vm}/ds.xml" ] ; then
freq=$(awk 'gsub(/[\0]/, x)' <(cat "${dir}/${vm}/vm.xml"| $xpath \
/VM/TEMPLATE/DISK[DISK_ID=$disk_id]/RECOVERY_SNAPSHOT_FREQ))
replica_host=$(awk 'gsub(/[\0]/, x)' <(cat "${dir}/${vm}/ds.xml"| $xpath \
/DATASTORE/TEMPLATE/REPLICA_HOST))
if [ -n "$freq" ] && [ -n "$replica_host" ]; then
snap_ts=$($one_dir/tm/ssh/recovery_snap_create_live \
$vm $vmdir/$disk $freq $replica_host)
rc=$?
if [ -n "$snap_ts" ] && [ "$rc" = "0" ]; then
vm_monitor="${vm_monitor}\nDISK_RECOVERY_SNAPSHOT = [ ID=${disk_id}, TIMESTAMP=${snap_ts}]"
else
vm_monitor="${vm_monitor}\nDISK_RECOVERY_SNAPSHOT = [ ID=${disk_id}, MSG=\"ERROR $rc ${snap_ts}\"]"
fi
fi
fi
done
echo -e "$vm_monitor" | base64 -w 0 -

View File

@ -167,9 +167,10 @@ void VirtualMachineNic::to_xml_short(std::ostringstream& oss) const
std::string ip = vector_value("IP");
std::string ip6 = vector_value("IP6");
std::string ip6_ula = vector_value("IP6_ULA");
std::string ip6_link = vector_value("IP6_LINK");
std::string ip6_global = vector_value("IP6_GLOBAL");
std::string ip6_link = vector_value("IP6_LINK");
std::string ip6_global = vector_value("IP6_GLOBAL");
std::string ip_external = vector_value("EXTERNAL"); /* PROVISION AWS_IPAM */
std::string reqs = vector_value("SCHED_REQUIREMENTS");
std::string rank = vector_value("SCHED_RANK");
@ -182,6 +183,11 @@ void VirtualMachineNic::to_xml_short(std::ostringstream& oss) const
oss << "<IP>" << one_util::escape_xml(ip) << "</IP>";
}
if (!ip_external.empty())
{
oss << "<EXTERNAL>" << one_util::escape_xml(ip_external) << "</EXTERNAL>";
}
if (!ip6.empty())
{
oss << "<IP6>" << one_util::escape_xml(ip6) << "</IP6>";