diff --git a/install.sh b/install.sh index 36383285ad..d07af7f2f2 100755 --- a/install.sh +++ b/install.sh @@ -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 \ diff --git a/share/etc/oned.conf b/share/etc/oned.conf index b0249559b2..cd8c1d5909 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -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 #------------------------------------------------------------------------------- diff --git a/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-central-1.yml b/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-central-1.yml index 54812494e3..5c3850d61b 100644 --- a/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-central-1.yml +++ b/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-central-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-west-2.yml b/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-west-2.yml new file mode 100644 index 0000000000..77cb4ab708 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+/providers/aws/aws-eu-west-2.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-east-1.yml b/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-east-1.yml index afc3d9fe99..6407edd5ea 100644 --- a/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-east-1.yml +++ b/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-east-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-west-1.yml b/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-west-1.yml new file mode 100644 index 0000000000..c2283da77d --- /dev/null +++ b/share/oneprovision/provisions/hybrid+/providers/aws/aws-us-west-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/packet/packet-amsterdam.yml b/share/oneprovision/provisions/hybrid+/providers/packet/packet-ams1.yml similarity index 75% rename from share/oneprovision/provisions/hybrid+/providers/packet/packet-amsterdam.yml rename to share/oneprovision/provisions/hybrid+/providers/packet/packet-ams1.yml index b2c69a2c56..5aa2932599 100644 --- a/share/oneprovision/provisions/hybrid+/providers/packet/packet-amsterdam.yml +++ b/share/oneprovision/provisions/hybrid+/providers/packet/packet-ams1.yml @@ -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: diff --git a/share/oneprovision/provisions/hybrid+/providers/packet/packet-ewr1.yml b/share/oneprovision/provisions/hybrid+/providers/packet/packet-ewr1.yml new file mode 100644 index 0000000000..fa1135da6b --- /dev/null +++ b/share/oneprovision/provisions/hybrid+/providers/packet/packet-ewr1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/packet/packet-nrt1.yml b/share/oneprovision/provisions/hybrid+/providers/packet/packet-nrt1.yml new file mode 100644 index 0000000000..c4c5388988 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+/providers/packet/packet-nrt1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/providers/packet/packet-sjc1.yml b/share/oneprovision/provisions/hybrid+/providers/packet/packet-sjc1.yml new file mode 100644 index 0000000000..09937442f1 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+/providers/packet/packet-sjc1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+/provisions/aws.yml b/share/oneprovision/provisions/hybrid+/provisions/aws.yml index e4e48c5e13..0daaf331a9 100644 --- a/share/oneprovision/provisions/hybrid+/provisions/aws.yml +++ b/share/oneprovision/provisions/hybrid+/provisions/aws.yml @@ -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 diff --git a/share/oneprovision/provisions/hybrid+_qemu/description.txt b/share/oneprovision/provisions/hybrid+_qemu/description.txt new file mode 100644 index 0000000000..779606e0d9 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/description.txt @@ -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) diff --git a/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-central-1.yml b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-central-1.yml new file mode 100644 index 0000000000..46e3946585 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-central-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-west-2.yml b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-west-2.yml new file mode 100644 index 0000000000..28b030eca6 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-eu-west-2.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-east-1.yml b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-east-1.yml new file mode 100644 index 0000000000..1f54061062 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-east-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-west-1.yml b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-west-1.yml new file mode 100644 index 0000000000..0b041f3a0e --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/providers/aws/aws-us-west-1.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/datastores.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/datastores.yml new file mode 100644 index 0000000000..04ec0b320c --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/datastores.yml @@ -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" diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/defaults.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/defaults.yml new file mode 100644 index 0000000000..343ee0a312 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/defaults.yml @@ -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 +#------------------------------------------------------------------------------- + +... diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/inputs.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/inputs.yml new file mode 100644 index 0000000000..a095876f31 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/inputs.yml @@ -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: '' +... diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/networks.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/networks.yml new file mode 100644 index 0000000000..159031b6b0 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.d/networks.yml @@ -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}" diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.yml new file mode 100644 index 0000000000..7ac74dc451 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/aws.yml @@ -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' diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/defaults.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/defaults.yml new file mode 100644 index 0000000000..43499ddf65 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/defaults.yml @@ -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 diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/qemu_hosts.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/qemu_hosts.yml new file mode 100644 index 0000000000..042fa7100a --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/qemu_hosts.yml @@ -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}" +... diff --git a/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/resources.yml b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/resources.yml new file mode 100644 index 0000000000..8cd361b23c --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_qemu/provisions/common.d/resources.yml @@ -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 diff --git a/src/cli/one_helper/oneprovision_helper.rb b/src/cli/one_helper/oneprovision_helper.rb index 9c528c1722..162bc510c6 100644 --- a/src/cli/one_helper/oneprovision_helper.rb +++ b/src/cli/one_helper/oneprovision_helper.rb @@ -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 diff --git a/src/cli/oneprovision b/src/cli/oneprovision index 83bdce9fc6..38df95cbef 100755 --- a/src/cli/oneprovision +++ b/src/cli/oneprovision @@ -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 diff --git a/src/fireedge/src/client/containers/Providers/Form/Create/Steps/Template/index.js b/src/fireedge/src/client/containers/Providers/Form/Create/Steps/Template/index.js index 82ec920b4a..5b660d36d7 100644 --- a/src/fireedge/src/client/containers/Providers/Form/Create/Steps/Template/index.js +++ b/src/fireedge/src/client/containers/Providers/Form/Create/Steps/Template/index.js @@ -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> ) diff --git a/src/fireedge/src/client/containers/Provisions/Form/Create/Steps/Template/index.js b/src/fireedge/src/client/containers/Provisions/Form/Create/Steps/Template/index.js index a413357f20..ce6cc05e49 100644 --- a/src/fireedge/src/client/containers/Provisions/Form/Create/Steps/Template/index.js +++ b/src/fireedge/src/client/containers/Provisions/Form/Create/Steps/Template/index.js @@ -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> ) diff --git a/src/oneprovision/lib/provision/provision.rb b/src/oneprovision/lib/provision/provision.rb index 1e9b4eefa5..001dd8b522 100644 --- a/src/oneprovision/lib/provision/provision.rb +++ b/src/oneprovision/lib/provision/provision.rb @@ -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 diff --git a/src/oneprovision/lib/provision/utils.rb b/src/oneprovision/lib/provision/utils.rb index 2098aac971..0d55c58bf6 100644 --- a/src/oneprovision/lib/provision/utils.rb +++ b/src/oneprovision/lib/provision/utils.rb @@ -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 diff --git a/src/tm_mad/ssh/monitor_ds b/src/tm_mad/ssh/monitor_ds index 603771ca61..4feb45e48e 100755 --- a/src/tm_mad/ssh/monitor_ds +++ b/src/tm_mad/ssh/monitor_ds @@ -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 - diff --git a/src/vm/VirtualMachineNic.cc b/src/vm/VirtualMachineNic.cc index ea6b502f0a..d6352e9ba8 100644 --- a/src/vm/VirtualMachineNic.cc +++ b/src/vm/VirtualMachineNic.cc @@ -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>";