opennebula-cli 7.1.80.pre → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/oneacct +1 -1
- data/bin/oneacl +1 -1
- data/bin/onebackupjob +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/oneform +1 -1
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +1 -1
- data/bin/oneirb +1 -1
- data/bin/onelog +1 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +1 -1
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +1 -1
- data/bin/onevdc +1 -1
- data/bin/onevm +2 -2
- data/bin/onevmgroup +1 -1
- data/bin/onevnet +1 -1
- data/bin/onevntemplate +1 -1
- data/bin/onevrouter +1 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +1 -1
- data/lib/command_parser.rb +135 -126
- data/lib/load_opennebula_paths.rb +5 -0
- data/lib/ods_helper.rb +541 -0
- data/lib/one_helper/oneacct_helper.rb +117 -109
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onebackupjob_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +87 -80
- data/lib/one_helper/oneflow_helper.rb +1 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
- data/lib/one_helper/oneform_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +1 -1
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onemarket_helper.rb +59 -58
- data/lib/one_helper/onemarketapp_helper.rb +1 -1
- data/lib/one_helper/onequota_helper.rb +240 -190
- data/lib/one_helper/onesecgroup_helper.rb +87 -85
- data/lib/one_helper/onetemplate_helper.rb +64 -64
- data/lib/one_helper/oneuser_helper.rb +2 -2
- data/lib/one_helper/onevdc_helper.rb +45 -45
- data/lib/one_helper/onevm_helper.rb +6 -8
- data/lib/one_helper/onevmgroup_helper.rb +65 -63
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +43 -40
- data/lib/one_helper/onevrouter_helper.rb +86 -87
- data/lib/one_helper/onezone_helper.rb +98 -101
- data/lib/one_helper.rb +90 -71
- data/share/schemas/xsd/acct.xsd +3 -104
- data/share/schemas/xsd/cluster.xsd +4 -21
- data/share/schemas/xsd/datastore.xsd +4 -29
- data/share/schemas/xsd/document.xsd +3 -25
- data/share/schemas/xsd/group.xsd +2 -14
- data/share/schemas/xsd/group_pool.xsd +2 -14
- data/share/schemas/xsd/hook.xsd +2 -0
- data/share/schemas/xsd/host.xsd +5 -7
- data/share/schemas/xsd/image.xsd +2 -25
- data/share/schemas/xsd/marketplace.xsd +3 -22
- data/share/schemas/xsd/marketplaceapp.xsd +3 -25
- data/share/schemas/xsd/opennebula_configuration.xsd +3 -2
- data/share/schemas/xsd/requirements.xsd +3 -21
- data/share/schemas/xsd/security_group.xsd +6 -43
- data/share/schemas/xsd/shared.xsd +3 -3
- data/share/schemas/xsd/vdc.xsd +2 -7
- data/share/schemas/xsd/vm_group.xsd +3 -25
- data/share/schemas/xsd/vm_pool.xsd +2 -0
- data/share/schemas/xsd/vmtemplate.xsd +3 -25
- data/share/schemas/xsd/vnet.xsd +9 -67
- data/share/schemas/xsd/vnet_pool.xsd +8 -57
- data/share/schemas/xsd/vntemplate.xsd +3 -25
- data/share/schemas/xsd/vrouter.xsd +4 -32
- metadata +8 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -18,14 +18,15 @@ require 'one_helper'
|
|
|
18
18
|
require 'opennebula/vdc'
|
|
19
19
|
require 'opennebula/vdc_pool'
|
|
20
20
|
|
|
21
|
+
# Helper class for VDC commands
|
|
21
22
|
class OneVdcHelper < OpenNebulaHelper::OneHelper
|
|
22
23
|
|
|
23
24
|
def self.rname
|
|
24
|
-
|
|
25
|
+
'VDC'
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def self.conf_file
|
|
28
|
-
|
|
29
|
+
'onevdc.yaml'
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def id_list_size(list, resource)
|
|
@@ -39,20 +40,20 @@ class OneVdcHelper < OpenNebulaHelper::OneHelper
|
|
|
39
40
|
end
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
def format_pool(
|
|
43
|
+
def format_pool(_options)
|
|
43
44
|
config_file = self.class.table_conf
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
column :ID,
|
|
47
|
-
d[
|
|
46
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
47
|
+
column :ID, 'ONE identifier for the VDC', :size=>5 do |d|
|
|
48
|
+
d['ID']
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
column :NAME,
|
|
51
|
-
d[
|
|
51
|
+
column :NAME, 'Name of the VDC', :left, :size=>30 do |d|
|
|
52
|
+
d['NAME']
|
|
52
53
|
end
|
|
53
54
|
|
|
54
|
-
column :GROUPS,
|
|
55
|
-
ids = d[
|
|
55
|
+
column :GROUPS, 'Number of Groups', :size=>6 do |d|
|
|
56
|
+
ids = d['GROUPS']['ID']
|
|
56
57
|
case ids
|
|
57
58
|
when String
|
|
58
59
|
1
|
|
@@ -63,31 +64,29 @@ class OneVdcHelper < OpenNebulaHelper::OneHelper
|
|
|
63
64
|
end
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
column :CLUSTERS,
|
|
67
|
-
@ext.id_list_size(d[
|
|
67
|
+
column :CLUSTERS, 'Number of Clusters', :size=>8 do |d|
|
|
68
|
+
@ext.id_list_size(d['CLUSTERS']['CLUSTER'], 'CLUSTER') rescue '-'
|
|
68
69
|
end
|
|
69
70
|
|
|
70
|
-
column :HOSTS,
|
|
71
|
-
@ext.id_list_size(d[
|
|
71
|
+
column :HOSTS, 'Number of Hosts', :size=>5 do |d|
|
|
72
|
+
@ext.id_list_size(d['HOSTS']['HOST'], 'HOST') rescue '-'
|
|
72
73
|
end
|
|
73
74
|
|
|
74
|
-
column :VNETS,
|
|
75
|
-
@ext.id_list_size(d[
|
|
75
|
+
column :VNETS, 'Number of Networks', :size=>5 do |d|
|
|
76
|
+
@ext.id_list_size(d['VNETS']['VNET'], 'VNET') rescue '-'
|
|
76
77
|
end
|
|
77
78
|
|
|
78
|
-
column :DATASTORES,
|
|
79
|
-
@ext.id_list_size(d[
|
|
79
|
+
column :DATASTORES, 'Number of Datastores', :size=>10 do |d|
|
|
80
|
+
@ext.id_list_size(d['DATASTORES']['DATASTORE'], 'DATASTORE') rescue '-'
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
default :ID, :NAME, :GROUPS, :CLUSTERS, :HOSTS, :VNETS, :DATASTORES
|
|
83
84
|
end
|
|
84
|
-
|
|
85
|
-
table
|
|
86
85
|
end
|
|
87
86
|
|
|
88
87
|
private
|
|
89
88
|
|
|
90
|
-
def factory(id=nil)
|
|
89
|
+
def factory(id = nil)
|
|
91
90
|
if id
|
|
92
91
|
OpenNebula::Vdc.new_with_id(id, @client)
|
|
93
92
|
else
|
|
@@ -96,26 +95,26 @@ class OneVdcHelper < OpenNebulaHelper::OneHelper
|
|
|
96
95
|
end
|
|
97
96
|
end
|
|
98
97
|
|
|
99
|
-
def factory_pool(
|
|
98
|
+
def factory_pool(_user_flag = -2)
|
|
100
99
|
OpenNebula::VdcPool.new(@client)
|
|
101
100
|
end
|
|
102
101
|
|
|
103
|
-
def format_resource(vdc,
|
|
104
|
-
str=
|
|
105
|
-
str_h1=
|
|
102
|
+
def format_resource(vdc, _options = {})
|
|
103
|
+
str='%-18s: %-20s'
|
|
104
|
+
str_h1='%-80s'
|
|
106
105
|
|
|
107
106
|
CLIHelper.print_header(str_h1 % "VDC #{vdc['ID']} INFORMATION")
|
|
108
|
-
puts str
|
|
109
|
-
puts str
|
|
107
|
+
puts format(str, 'ID', vdc.id.to_s)
|
|
108
|
+
puts format(str, 'NAME', vdc.name)
|
|
110
109
|
|
|
111
110
|
vdc_hash = vdc.to_hash
|
|
112
111
|
|
|
113
112
|
groups = vdc_hash['VDC']['GROUPS']['ID']
|
|
114
|
-
if(groups
|
|
113
|
+
if(!groups.nil?)
|
|
115
114
|
puts
|
|
116
115
|
|
|
117
116
|
CLIHelper::ShowTable.new(nil, self) do
|
|
118
|
-
column :
|
|
117
|
+
column :GROUPS, '', :right, :size=>7 do |d|
|
|
119
118
|
d
|
|
120
119
|
end
|
|
121
120
|
end.show([groups].flatten, {})
|
|
@@ -123,24 +122,25 @@ class OneVdcHelper < OpenNebulaHelper::OneHelper
|
|
|
123
122
|
|
|
124
123
|
['CLUSTER', 'HOST', 'DATASTORE', 'VNET'].each do |resource|
|
|
125
124
|
res_array = vdc_hash['VDC']["#{resource}S"][resource]
|
|
126
|
-
if
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
end
|
|
139
|
-
end
|
|
125
|
+
next if res_array.nil?
|
|
126
|
+
|
|
127
|
+
puts
|
|
128
|
+
CLIHelper.print_header(str_h1 % "#{resource}S", false)
|
|
129
|
+
|
|
130
|
+
CLIHelper::ShowTable.new(nil, self) do
|
|
131
|
+
column :ZONE, '', :right, :size=>7 do |d|
|
|
132
|
+
d['ZONE_ID']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
column :"#{resource}", '', :right, :size=>9 do |d|
|
|
136
|
+
d["#{resource}_ID"] == Vdc::ALL_RESOURCES ? 'ALL' : d["#{resource}_ID"]
|
|
137
|
+
end
|
|
138
|
+
end.show([res_array].flatten, {})
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
puts
|
|
143
|
-
CLIHelper.print_header(str_h1 %
|
|
142
|
+
CLIHelper.print_header(str_h1 % 'VDC TEMPLATE', false)
|
|
144
143
|
puts vdc.template_str
|
|
145
144
|
end
|
|
145
|
+
|
|
146
146
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -135,13 +135,13 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
POFF = {
|
|
138
|
-
:name => '
|
|
138
|
+
:name => 'poff',
|
|
139
139
|
:large => '--poff',
|
|
140
140
|
:description => 'Do the migrate by poweringoff the vm'
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
POFFHARD = {
|
|
144
|
-
:name => '
|
|
144
|
+
:name => 'poff-hard',
|
|
145
145
|
:large => '--poff-hard',
|
|
146
146
|
:description => 'Do the migrate by poweringoff hard the vm'
|
|
147
147
|
}
|
|
@@ -558,9 +558,9 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
|
558
558
|
end
|
|
559
559
|
|
|
560
560
|
def get_migration_type(options)
|
|
561
|
-
if options[:
|
|
561
|
+
if options[:poff]
|
|
562
562
|
1
|
|
563
|
-
elsif options[:
|
|
563
|
+
elsif options[:'poff-hard']
|
|
564
564
|
2
|
|
565
565
|
else
|
|
566
566
|
0
|
|
@@ -644,9 +644,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
|
644
644
|
end
|
|
645
645
|
end
|
|
646
646
|
|
|
647
|
-
|
|
648
|
-
$?.exitstatus
|
|
649
|
-
# rubocop:enable Style/SpecialGlobalVars
|
|
647
|
+
$CHILD_STATUS.exitstatus
|
|
650
648
|
end
|
|
651
649
|
|
|
652
650
|
def get_backup_mode(vm_id)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -18,69 +18,69 @@ require 'one_helper'
|
|
|
18
18
|
require 'opennebula/vm_group'
|
|
19
19
|
require 'opennebula/vm_group_pool'
|
|
20
20
|
|
|
21
|
+
# Helper class for VMGroup commands
|
|
21
22
|
class OneVMGroupHelper < OpenNebulaHelper::OneHelper
|
|
23
|
+
|
|
22
24
|
def self.rname
|
|
23
|
-
|
|
25
|
+
'VM_GROUP'
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def self.conf_file
|
|
27
|
-
|
|
29
|
+
'onevmgroup.yaml'
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def format_pool(options)
|
|
31
33
|
config_file = self.class.table_conf
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
column :ID,
|
|
35
|
-
d[
|
|
35
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
36
|
+
column :ID, 'ONE identifier for the VM Group', :size=>4 do |d|
|
|
37
|
+
d['ID']
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
column :NAME,
|
|
39
|
-
d[
|
|
40
|
+
column :NAME, 'Name of the VM Group', :left, :size=>15 do |d|
|
|
41
|
+
d['NAME']
|
|
40
42
|
end
|
|
41
43
|
|
|
42
|
-
column :USER,
|
|
43
|
-
|
|
44
|
+
column :USER, 'Username of the VM Group owner', :left,
|
|
45
|
+
:size=>8 do |d|
|
|
44
46
|
helper.user_name(d, options)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
column :GROUP,
|
|
49
|
+
column :GROUP, 'Group of the VM Group', :left, :size=>8 do |d|
|
|
48
50
|
helper.group_name(d, options)
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
column :VMS,
|
|
52
|
-
vms
|
|
53
|
+
column :VMS, 'Number of VMs in the VM Group', :left, :size=>4 do |d|
|
|
54
|
+
vms = 0
|
|
53
55
|
|
|
54
|
-
if !d[
|
|
55
|
-
|
|
56
|
-
roles.each
|
|
57
|
-
vms += r[
|
|
58
|
-
|
|
56
|
+
if !d['ROLES']['ROLE'].nil?
|
|
57
|
+
roles = [d['ROLES']['ROLE']].flatten
|
|
58
|
+
roles.each do |r|
|
|
59
|
+
vms += r['VMS'].split(',').size unless r['VMS'].nil?
|
|
60
|
+
end
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
vms
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
column :ROLES,
|
|
66
|
+
column :ROLES, 'Roles in the VM Group', :left, :size=>36 do |d|
|
|
65
67
|
begin
|
|
66
|
-
roles = [d[
|
|
67
|
-
roles_names =
|
|
68
|
+
roles = [d['ROLES']['ROLE']].flatten
|
|
69
|
+
roles_names = ''
|
|
68
70
|
|
|
69
71
|
if !roles.nil?
|
|
70
|
-
rnames = roles.collect {
|
|
71
|
-
roles_names = rnames.join(
|
|
72
|
+
rnames = roles.collect {|i| i['NAME'] }
|
|
73
|
+
roles_names = rnames.join(', ') unless rnames.empty?
|
|
72
74
|
end
|
|
73
75
|
|
|
74
76
|
roles_names
|
|
75
|
-
rescue
|
|
76
|
-
|
|
77
|
+
rescue StandardError
|
|
78
|
+
'-'
|
|
77
79
|
end
|
|
78
80
|
end
|
|
79
81
|
|
|
80
82
|
default :ID, :USER, :GROUP, :NAME, :VMS, :ROLES
|
|
81
83
|
end
|
|
82
|
-
|
|
83
|
-
table
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def retrieve_role_id(vmg_id, id)
|
|
@@ -100,7 +100,7 @@ class OneVMGroupHelper < OpenNebulaHelper::OneHelper
|
|
|
100
100
|
|
|
101
101
|
private
|
|
102
102
|
|
|
103
|
-
def factory(id=nil)
|
|
103
|
+
def factory(id = nil)
|
|
104
104
|
if id
|
|
105
105
|
OpenNebula::VMGroup.new_with_id(id, @client)
|
|
106
106
|
else
|
|
@@ -109,84 +109,86 @@ class OneVMGroupHelper < OpenNebulaHelper::OneHelper
|
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
def factory_pool(user_flag
|
|
112
|
+
def factory_pool(user_flag = -2)
|
|
113
113
|
OpenNebula::VMGroupPool.new(@client, user_flag)
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
-
def format_resource(vmgroup,
|
|
117
|
-
str=
|
|
118
|
-
str_h1=
|
|
116
|
+
def format_resource(vmgroup, _options = {})
|
|
117
|
+
str='%-15s: %-20s'
|
|
118
|
+
str_h1='%-80s'
|
|
119
119
|
|
|
120
120
|
CLIHelper.print_header(
|
|
121
|
-
str_h1 % "VM GROUP #{vmgroup['ID']} INFORMATION"
|
|
122
|
-
|
|
123
|
-
puts str
|
|
124
|
-
puts str
|
|
125
|
-
puts str
|
|
126
|
-
puts str
|
|
121
|
+
str_h1 % "VM GROUP #{vmgroup['ID']} INFORMATION"
|
|
122
|
+
)
|
|
123
|
+
puts format(str, 'ID', vmgroup.id.to_s)
|
|
124
|
+
puts format(str, 'NAME', vmgroup.name)
|
|
125
|
+
puts format(str, 'USER', vmgroup['UNAME'])
|
|
126
|
+
puts format(str, 'GROUP', vmgroup['GNAME'])
|
|
127
|
+
puts format(str, 'LOCK', OpenNebulaHelper.level_lock_to_str(vmgroup['LOCK/LOCKED']))
|
|
127
128
|
|
|
128
|
-
CLIHelper.print_header(str_h1 %
|
|
129
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
129
130
|
|
|
130
131
|
puts
|
|
131
132
|
|
|
132
|
-
[
|
|
133
|
-
mask =
|
|
134
|
-
mask[0] =
|
|
135
|
-
mask[1] =
|
|
136
|
-
mask[2] =
|
|
133
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
134
|
+
mask = '---'
|
|
135
|
+
mask[0] = 'u' if vmgroup["PERMISSIONS/#{e}_U"] == '1'
|
|
136
|
+
mask[1] = 'm' if vmgroup["PERMISSIONS/#{e}_M"] == '1'
|
|
137
|
+
mask[2] = 'a' if vmgroup["PERMISSIONS/#{e}_A"] == '1'
|
|
137
138
|
|
|
138
|
-
puts str
|
|
139
|
-
|
|
139
|
+
puts format(str, e, mask)
|
|
140
|
+
end
|
|
140
141
|
|
|
141
142
|
puts
|
|
142
143
|
|
|
143
|
-
CLIHelper.print_header(str_h1 %
|
|
144
|
+
CLIHelper.print_header(str_h1 % 'ROLES', false)
|
|
144
145
|
|
|
145
146
|
if !vmgroup.to_hash['VM_GROUP']['ROLES']['ROLE'].nil?
|
|
146
147
|
roles = [vmgroup.to_hash['VM_GROUP']['ROLES']['ROLE']].flatten
|
|
147
148
|
end
|
|
148
149
|
|
|
149
150
|
CLIHelper::ShowTable.new(nil, self) do
|
|
150
|
-
column :ID,
|
|
151
|
-
d[
|
|
151
|
+
column :ID, '', :left, :size=>4 do |d|
|
|
152
|
+
d['ID']
|
|
152
153
|
end
|
|
153
154
|
|
|
154
|
-
column :NAME,
|
|
155
|
-
d[
|
|
155
|
+
column :NAME, '', :left, :size=>8 do |d|
|
|
156
|
+
d['NAME']
|
|
156
157
|
end
|
|
157
158
|
|
|
158
|
-
column :POLICY,
|
|
159
|
-
if d[
|
|
159
|
+
column :POLICY, '', :left, :size=>12 do |d|
|
|
160
|
+
if d['POLICY'].nil?
|
|
160
161
|
'-'
|
|
161
162
|
else
|
|
162
|
-
d[
|
|
163
|
+
d['POLICY']
|
|
163
164
|
end
|
|
164
165
|
end
|
|
165
166
|
|
|
166
|
-
column :AFFINED_HOSTS,
|
|
167
|
-
if d[
|
|
167
|
+
column :AFFINED_HOSTS, '', :left, :size=>18 do |d|
|
|
168
|
+
if d['HOST_AFFINED'].nil?
|
|
168
169
|
'-'
|
|
169
170
|
else
|
|
170
|
-
d[
|
|
171
|
+
d['HOST_AFFINED']
|
|
171
172
|
end
|
|
172
173
|
end
|
|
173
174
|
|
|
174
|
-
column :ANTI_AFFINED_HOST,
|
|
175
|
-
if d[
|
|
175
|
+
column :ANTI_AFFINED_HOST, '', :left, :size=>18 do |d|
|
|
176
|
+
if d['HOST_ANTI_AFFINED'].nil?
|
|
176
177
|
'-'
|
|
177
178
|
else
|
|
178
|
-
d[
|
|
179
|
+
d['HOST_ANTI_AFFINED']
|
|
179
180
|
end
|
|
180
181
|
end
|
|
181
182
|
|
|
182
|
-
column :VIRTUAL_MACHINES,
|
|
183
|
-
d[
|
|
183
|
+
column :VIRTUAL_MACHINES, '', :left, :size=>20 do |d|
|
|
184
|
+
d['VMS']
|
|
184
185
|
end
|
|
185
186
|
end.show(roles, {})
|
|
186
187
|
|
|
187
188
|
puts
|
|
188
189
|
|
|
189
|
-
CLIHelper.print_header(str_h1 %
|
|
190
|
+
CLIHelper.print_header(str_h1 % 'TEMPLATE CONTENTS', false)
|
|
190
191
|
puts vmgroup.template_str
|
|
191
192
|
end
|
|
193
|
+
|
|
192
194
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2026, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -19,39 +19,41 @@ require 'one_helper/onetemplate_helper'
|
|
|
19
19
|
require 'opennebula/vntemplate'
|
|
20
20
|
require 'opennebula/vntemplate_pool'
|
|
21
21
|
|
|
22
|
+
# Helper class for VNTemplate commands
|
|
22
23
|
class OneVNTemplateHelper < OneTemplateHelper
|
|
24
|
+
|
|
23
25
|
VN_NAME={
|
|
24
|
-
:name =>
|
|
25
|
-
:large =>
|
|
26
|
+
:name => 'name',
|
|
27
|
+
:large => '--name name',
|
|
26
28
|
:format => String,
|
|
27
|
-
:description =>
|
|
28
|
-
Name of the new VN TEMPLATE. When instantiating
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
EOT
|
|
29
|
+
:description => <<~EOT.strip
|
|
30
|
+
Name of the new VN TEMPLATE. When instantiating
|
|
31
|
+
multiple VNs you can use the \"%i\" wildcard to produce
|
|
32
|
+
different names such as vm-0, vm-1...
|
|
33
|
+
EOT
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
MULTIPLE={
|
|
35
|
-
:name =>
|
|
36
|
-
:short =>
|
|
37
|
-
:large =>
|
|
37
|
+
:name => 'multiple',
|
|
38
|
+
:short => '-m x',
|
|
39
|
+
:large => '--multiple x',
|
|
38
40
|
:format => Integer,
|
|
39
|
-
:description =>
|
|
41
|
+
:description => 'Instance multiple VNs'
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
EXTENDED={
|
|
43
|
-
:name =>
|
|
44
|
-
:large =>
|
|
45
|
-
:description =>
|
|
46
|
-
|
|
45
|
+
:name => 'extended',
|
|
46
|
+
:large => '--extended',
|
|
47
|
+
:description => 'Process the template and included extended '+
|
|
48
|
+
'information'
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
def self.rname
|
|
50
|
-
|
|
52
|
+
'VNTEMPLATE'
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
def self.conf_file
|
|
54
|
-
|
|
56
|
+
'onevntemplate.yaml'
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
INT_EXP = /^-?\d+$/
|
|
@@ -59,7 +61,7 @@ EOT
|
|
|
59
61
|
|
|
60
62
|
private
|
|
61
63
|
|
|
62
|
-
def factory(id=nil)
|
|
64
|
+
def factory(id = nil)
|
|
63
65
|
if id
|
|
64
66
|
OpenNebula::VNTemplate.new_with_id(id, @client)
|
|
65
67
|
else
|
|
@@ -68,38 +70,39 @@ EOT
|
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
|
|
71
|
-
def factory_pool(user_flag
|
|
73
|
+
def factory_pool(user_flag = -2)
|
|
72
74
|
OpenNebula::VNTemplatePool.new(@client, user_flag)
|
|
73
75
|
end
|
|
74
76
|
|
|
75
|
-
def format_resource(template,
|
|
76
|
-
str=
|
|
77
|
-
str_h1=
|
|
77
|
+
def format_resource(template, _options = {})
|
|
78
|
+
str='%-15s: %-20s'
|
|
79
|
+
str_h1='%-80s'
|
|
78
80
|
|
|
79
81
|
CLIHelper.print_header(
|
|
80
|
-
str_h1 % "TEMPLATE #{template['ID']} INFORMATION"
|
|
81
|
-
|
|
82
|
-
puts str
|
|
83
|
-
puts str
|
|
84
|
-
puts str
|
|
85
|
-
puts str
|
|
86
|
-
puts str
|
|
87
|
-
|
|
82
|
+
str_h1 % "TEMPLATE #{template['ID']} INFORMATION"
|
|
83
|
+
)
|
|
84
|
+
puts format(str, 'ID', template.id.to_s)
|
|
85
|
+
puts format(str, 'NAME', template.name)
|
|
86
|
+
puts format(str, 'USER', template['UNAME'])
|
|
87
|
+
puts format(str, 'GROUP', template['GNAME'])
|
|
88
|
+
puts format(str, 'LOCK', OpenNebulaHelper.level_lock_to_str(template['LOCK/LOCKED']))
|
|
89
|
+
puts format(str, 'REGISTER TIME', OpenNebulaHelper.time_to_str(template['REGTIME']))
|
|
88
90
|
puts
|
|
89
91
|
|
|
90
|
-
CLIHelper.print_header(str_h1 %
|
|
92
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
91
93
|
|
|
92
|
-
[
|
|
93
|
-
mask =
|
|
94
|
-
mask[0] =
|
|
95
|
-
mask[1] =
|
|
96
|
-
mask[2] =
|
|
94
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
95
|
+
mask = '---'
|
|
96
|
+
mask[0] = 'u' if template["PERMISSIONS/#{e}_U"] == '1'
|
|
97
|
+
mask[1] = 'm' if template["PERMISSIONS/#{e}_M"] == '1'
|
|
98
|
+
mask[2] = 'a' if template["PERMISSIONS/#{e}_A"] == '1'
|
|
97
99
|
|
|
98
|
-
puts str
|
|
99
|
-
|
|
100
|
+
puts format(str, e, mask)
|
|
101
|
+
end
|
|
100
102
|
puts
|
|
101
103
|
|
|
102
|
-
CLIHelper.print_header(str_h1 %
|
|
104
|
+
CLIHelper.print_header(str_h1 % 'TEMPLATE CONTENTS', false)
|
|
103
105
|
puts template.template_str
|
|
104
106
|
end
|
|
107
|
+
|
|
105
108
|
end
|