opennebula-cli 7.2.0 → 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/onevm +1 -1
- data/lib/command_parser.rb +134 -125
- data/lib/load_opennebula_paths.rb +5 -0
- data/lib/ods_helper.rb +541 -0
- data/lib/one_helper/oneacct_helper.rb +116 -108
- data/lib/one_helper/onedatastore_helper.rb +86 -79
- data/lib/one_helper/onemarket_helper.rb +58 -57
- data/lib/one_helper/onequota_helper.rb +239 -189
- data/lib/one_helper/onesecgroup_helper.rb +86 -84
- data/lib/one_helper/onetemplate_helper.rb +63 -63
- data/lib/one_helper/onevdc_helper.rb +44 -44
- data/lib/one_helper/onevm_helper.rb +5 -7
- data/lib/one_helper/onevmgroup_helper.rb +64 -62
- data/lib/one_helper/onevntemplate_helper.rb +42 -39
- data/lib/one_helper/onevrouter_helper.rb +85 -86
- data/lib/one_helper/onezone_helper.rb +97 -100
- data/lib/one_helper.rb +88 -69
- 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 +1 -0
- 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 +6 -4
|
@@ -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)
|
|
@@ -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
|
|
@@ -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
|