opennebula 5.12.12 → 5.13.80.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/DriverExecHelper.rb +43 -27
- data/lib/OpenNebulaDriver.rb +7 -3
- data/lib/VirtualMachineDriver.rb +8 -1
- data/lib/cloud/CloudClient.rb +1 -1
- data/lib/datacenter.rb +1258 -0
- data/lib/datastore.rb +1025 -0
- data/lib/distributed_firewall.rb +280 -0
- data/lib/file_helper.rb +370 -0
- data/lib/host.rb +1517 -0
- data/lib/logical_port.rb +50 -0
- data/lib/logical_switch.rb +77 -0
- data/lib/memoize.rb +74 -0
- data/lib/models/role.rb +1126 -0
- data/lib/models/service.rb +709 -0
- data/lib/models.rb +32 -0
- data/lib/network.rb +635 -0
- data/lib/nsx_client.rb +144 -0
- data/lib/nsx_component.rb +28 -0
- data/lib/nsx_constants.rb +149 -0
- data/lib/nsx_driver.rb +78 -0
- data/lib/nsx_error.rb +77 -0
- data/lib/nsx_rule.rb +193 -0
- data/lib/nsxt_client.rb +176 -0
- data/lib/nsxt_dfw.rb +196 -0
- data/lib/nsxt_logical_port.rb +94 -0
- data/lib/nsxt_rule.rb +188 -0
- data/lib/nsxt_tz.rb +38 -0
- data/lib/nsxv_client.rb +176 -0
- data/lib/nsxv_dfw.rb +202 -0
- data/lib/nsxv_logical_port.rb +107 -0
- data/lib/nsxv_rule.rb +172 -0
- data/lib/nsxv_tz.rb +41 -0
- data/lib/opaque_network.rb +134 -0
- data/lib/opennebula/document.rb +7 -28
- data/lib/opennebula/document_json.rb +41 -11
- data/lib/opennebula/error.rb +3 -0
- data/lib/opennebula/flow/grammar.rb +1195 -0
- data/lib/opennebula/flow/service_pool.rb +190 -0
- data/lib/opennebula/flow/service_template.rb +572 -0
- data/lib/opennebula/flow/service_template_ext.rb +84 -0
- data/lib/opennebula/flow/service_template_pool.rb +32 -0
- data/lib/opennebula/flow/validator.rb +499 -0
- data/lib/opennebula/flow.rb +23 -0
- data/lib/opennebula/hook.rb +4 -11
- data/lib/opennebula/image.rb +16 -13
- data/lib/opennebula/lockable_ext.rb +163 -0
- data/lib/opennebula/marketplaceapp.rb +8 -118
- data/lib/opennebula/marketplaceapp_ext.rb +522 -0
- data/lib/opennebula/oneflow_client.rb +3 -2
- data/lib/opennebula/pool.rb +3 -2
- data/lib/opennebula/template.rb +3 -12
- data/lib/opennebula/template_ext.rb +325 -0
- data/lib/opennebula/user.rb +25 -1
- data/lib/opennebula/virtual_machine.rb +24 -206
- data/lib/opennebula/virtual_machine_ext.rb +469 -0
- data/lib/opennebula/virtual_machine_pool.rb +0 -4
- data/lib/opennebula/virtual_network.rb +3 -9
- data/lib/opennebula/virtual_router.rb +3 -11
- data/lib/opennebula/vm_group.rb +3 -10
- data/lib/opennebula/vntemplate.rb +3 -12
- data/lib/opennebula/wait_ext.rb +222 -0
- data/lib/opennebula.rb +4 -1
- data/lib/rest_client.rb +201 -0
- data/lib/scripts_common.rb +180 -0
- data/lib/transport_zone.rb +43 -0
- data/lib/vcenter_driver.rb +8 -21
- data/lib/vcenter_importer.rb +616 -0
- data/lib/vi_client.rb +281 -0
- data/lib/vi_helper.rb +312 -0
- data/lib/virtual_machine.rb +3477 -0
- data/lib/virtual_wire.rb +158 -0
- data/lib/vm_device.rb +80 -0
- data/lib/vm_disk.rb +202 -0
- data/lib/vm_folder.rb +69 -0
- data/lib/vm_helper.rb +30 -0
- data/lib/vm_monitor.rb +303 -0
- data/lib/vm_nic.rb +70 -0
- data/lib/vm_template.rb +1961 -0
- data/lib/vmm_importer.rb +121 -0
- metadata +140 -26
data/lib/logical_port.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -------------------------------------------------------------------------- #
|
2
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
3
|
+
# #
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
+
# not use this file except in compliance with the License. You may obtain #
|
6
|
+
# a copy of the License at #
|
7
|
+
# #
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
+
# #
|
10
|
+
# Unless required by applicable law or agreed to in writing, software #
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
+
# See the License for the specific language governing permissions and #
|
14
|
+
# limitations under the License. #
|
15
|
+
#--------------------------------------------------------------------------- #
|
16
|
+
module NSXDriver
|
17
|
+
|
18
|
+
# Class Logical Switch
|
19
|
+
class LogicalPort < NSXComponent
|
20
|
+
|
21
|
+
# ATTRIBUTES
|
22
|
+
|
23
|
+
def self.new_child(nsx_client, id = nil)
|
24
|
+
case nsx_client.nsx_type.upcase
|
25
|
+
when NSXConstants::NSXT
|
26
|
+
NSXTLogicalPort.new(nsx_client, id)
|
27
|
+
when NSXConstants::NSXV
|
28
|
+
NSXVLogicalPort.new(nsx_client, id)
|
29
|
+
else
|
30
|
+
error_msg = "Unknown NSX type: #{type}"
|
31
|
+
error = NSXError::UnknownObject.new(error_msg)
|
32
|
+
raise error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Check if logical port exists
|
37
|
+
def lp?; end
|
38
|
+
|
39
|
+
# Get logical port id
|
40
|
+
def lp_id; end
|
41
|
+
|
42
|
+
# Get logical port display name
|
43
|
+
def lp_name; end
|
44
|
+
|
45
|
+
# Get resource type
|
46
|
+
def lp_type; end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -------------------------------------------------------------------------- #
|
2
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
3
|
+
# #
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
+
# not use this file except in compliance with the License. You may obtain #
|
6
|
+
# a copy of the License at #
|
7
|
+
# #
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
+
# #
|
10
|
+
# Unless required by applicable law or agreed to in writing, software #
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
+
# See the License for the specific language governing permissions and #
|
14
|
+
# limitations under the License. #
|
15
|
+
#--------------------------------------------------------------------------- #
|
16
|
+
module NSXDriver
|
17
|
+
|
18
|
+
# Class Logical Switch
|
19
|
+
class LogicalSwitch < NSXComponent
|
20
|
+
|
21
|
+
# ATTRIBUTES
|
22
|
+
attr_reader :ls_id
|
23
|
+
attr_reader :tz_id
|
24
|
+
attr_reader :replication_mode
|
25
|
+
attr_reader :display_name
|
26
|
+
attr_reader :description
|
27
|
+
|
28
|
+
def ls?; end
|
29
|
+
|
30
|
+
# Get logical switch's name
|
31
|
+
def ls_name; end
|
32
|
+
|
33
|
+
# Get logical switch's vni
|
34
|
+
def ls_vni; end
|
35
|
+
|
36
|
+
# Get the Transport Zone of the logical switch
|
37
|
+
def ls_tz; end
|
38
|
+
|
39
|
+
# Create a new logical switch
|
40
|
+
def new_logical_switch(ls_data); end
|
41
|
+
|
42
|
+
# Delete a logical switch
|
43
|
+
def delete_logical_switch; end
|
44
|
+
|
45
|
+
# Update a logical switch
|
46
|
+
def update_logical_switch; end
|
47
|
+
|
48
|
+
# Return nsx nics of type NSX-V and NSX-T
|
49
|
+
# If only_new_attached = true --> Only returns new attached nsx nics
|
50
|
+
def self.nsx_nics(template_xml, only_new_attached = true)
|
51
|
+
if only_new_attached == true
|
52
|
+
nics = template_xml.xpath('//TEMPLATE/NIC[ATTACH="YES"]')
|
53
|
+
else
|
54
|
+
nics = template_xml.xpath('//TEMPLATE/NIC')
|
55
|
+
end
|
56
|
+
nics_array = []
|
57
|
+
nics.each do |nic|
|
58
|
+
network_id = nic.xpath('NETWORK_ID').text
|
59
|
+
# Check Networks exists
|
60
|
+
one_vnet = VCenterDriver::VIHelper
|
61
|
+
.one_item(OpenNebula::VirtualNetwork, network_id)
|
62
|
+
rc = one_vnet.info
|
63
|
+
if OpenNebula.is_error?(rc)
|
64
|
+
err_msg = rc.message
|
65
|
+
raise err_msg
|
66
|
+
end
|
67
|
+
pg_type = one_vnet['TEMPLATE/VCENTER_PORTGROUP_TYPE']
|
68
|
+
nics_array << nic if [NSXConstants::NSXV_LS_TYPE,
|
69
|
+
NSXConstants::NSXT_LS_TYPE]
|
70
|
+
.include?(pg_type)
|
71
|
+
end
|
72
|
+
nics_array
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
data/lib/memoize.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# -------------------------------------------------------------------------- #
|
2
|
+
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
|
3
|
+
# #
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
|
+
# not use this file except in compliance with the License. You may obtain #
|
6
|
+
# a copy of the License at #
|
7
|
+
# #
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
9
|
+
# #
|
10
|
+
# Unless required by applicable law or agreed to in writing, software #
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
13
|
+
# See the License for the specific language governing permissions and #
|
14
|
+
# limitations under the License. #
|
15
|
+
#--------------------------------------------------------------------------- #
|
16
|
+
|
17
|
+
##############################################################################
|
18
|
+
# Module Memoize
|
19
|
+
##############################################################################
|
20
|
+
module Memoize
|
21
|
+
|
22
|
+
def [](property)
|
23
|
+
@memoize = {} unless defined?(@memoize)
|
24
|
+
|
25
|
+
if (value = @memoize[property])
|
26
|
+
return value
|
27
|
+
end
|
28
|
+
|
29
|
+
current_item = @item
|
30
|
+
|
31
|
+
property_path = ''
|
32
|
+
|
33
|
+
property.split('.').each do |elem|
|
34
|
+
if property_path.empty?
|
35
|
+
property_path << elem
|
36
|
+
else
|
37
|
+
property_path << '.' << elem
|
38
|
+
end
|
39
|
+
|
40
|
+
if (val = @memoize[property_path])
|
41
|
+
current_item = val
|
42
|
+
else
|
43
|
+
begin
|
44
|
+
current_item = current_item.send(elem)
|
45
|
+
rescue StandardError
|
46
|
+
current_item = nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
break if current_item.nil?
|
51
|
+
|
52
|
+
@memoize[property_path] = current_item
|
53
|
+
end
|
54
|
+
|
55
|
+
@memoize[property] = current_item
|
56
|
+
end
|
57
|
+
|
58
|
+
def clear(property)
|
59
|
+
@memoize = {} unless defined?(@memoize)
|
60
|
+
@memoize.clear[property] if @memoize[property]
|
61
|
+
end
|
62
|
+
|
63
|
+
def clear_all
|
64
|
+
@memoize = {}
|
65
|
+
end
|
66
|
+
|
67
|
+
def []=(property, value)
|
68
|
+
@memoize = {} unless defined?(@memoize)
|
69
|
+
|
70
|
+
@memoize[property] = value
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
# module Memoize
|