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 #
|
|
@@ -19,115 +19,115 @@ require 'opennebula/datastore'
|
|
|
19
19
|
require 'opennebula/datastore_pool'
|
|
20
20
|
require 'opennebula/image'
|
|
21
21
|
|
|
22
|
+
# Helper class for Datastore commands
|
|
22
23
|
class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
24
|
+
|
|
23
25
|
DATASTORE = {
|
|
24
|
-
:name =>
|
|
25
|
-
:short =>
|
|
26
|
-
:large =>
|
|
27
|
-
:description =>
|
|
26
|
+
:name => 'datastore',
|
|
27
|
+
:short => '-d id|name',
|
|
28
|
+
:large => '--datastore id|name',
|
|
29
|
+
:description => 'Selects the datastore',
|
|
28
30
|
:format => String,
|
|
29
|
-
:proc => lambda {
|
|
30
|
-
OpenNebulaHelper.rname_to_id(o,
|
|
31
|
+
:proc => lambda {|o, _options|
|
|
32
|
+
OpenNebulaHelper.rname_to_id(o, 'DATASTORE')
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
FILE_DATASTORE = {
|
|
35
|
-
:name =>
|
|
36
|
-
:large =>
|
|
37
|
-
:description =>
|
|
37
|
+
:name => 'file_datastore',
|
|
38
|
+
:large => '--file-datastore id|name',
|
|
39
|
+
:description => 'Selects the file datastore',
|
|
38
40
|
:format => String,
|
|
39
|
-
:proc => lambda {
|
|
40
|
-
OpenNebulaHelper.rname_to_id(o,
|
|
41
|
+
:proc => lambda {|o, _options|
|
|
42
|
+
OpenNebulaHelper.rname_to_id(o, 'DATASTORE')
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
def self.rname
|
|
45
|
-
|
|
47
|
+
'DATASTORE'
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def self.conf_file
|
|
49
|
-
|
|
51
|
+
'onedatastore.yaml'
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
def format_pool(options)
|
|
53
55
|
config_file = self.class.table_conf
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
column :ID,
|
|
57
|
-
d[
|
|
57
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
58
|
+
column :ID, 'ONE identifier for the Datastore', :size=>4 do |d|
|
|
59
|
+
d['ID']
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
column :USER,
|
|
61
|
-
|
|
62
|
+
column :USER, 'Username of the Datastore owner', :left,
|
|
63
|
+
:size=>10 do |d|
|
|
62
64
|
helper.user_name(d, options)
|
|
63
65
|
end
|
|
64
66
|
|
|
65
|
-
column :GROUP,
|
|
66
|
-
|
|
67
|
+
column :GROUP, 'Group of the Datastore', :left,
|
|
68
|
+
:size=>10 do |d|
|
|
67
69
|
helper.group_name(d, options)
|
|
68
70
|
end
|
|
69
71
|
|
|
70
|
-
column :NAME,
|
|
71
|
-
d[
|
|
72
|
+
column :NAME, 'Name of the Datastore', :left, :size=>13 do |d|
|
|
73
|
+
d['NAME']
|
|
72
74
|
end
|
|
73
75
|
|
|
74
|
-
column :SIZE,
|
|
76
|
+
column :SIZE, 'Datastore total size', :size =>10 do |d|
|
|
75
77
|
shared = d['TEMPLATE']['SHARED']
|
|
76
|
-
if shared
|
|
77
|
-
|
|
78
|
+
if !shared.nil? && shared.upcase == 'NO'
|
|
79
|
+
'-'
|
|
78
80
|
else
|
|
79
81
|
OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M')
|
|
80
82
|
end
|
|
81
83
|
end
|
|
82
84
|
|
|
83
|
-
column :AVAIL,
|
|
85
|
+
column :AVAIL, 'Datastore free size', :left, :size =>5 do |d|
|
|
84
86
|
if d['TOTAL_MB'].to_i == 0
|
|
85
|
-
|
|
87
|
+
'-'
|
|
86
88
|
else
|
|
87
|
-
"#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round
|
|
89
|
+
"#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round}%"
|
|
88
90
|
end
|
|
89
91
|
end
|
|
90
92
|
|
|
91
|
-
column :CLUSTERS,
|
|
92
|
-
OpenNebulaHelper.clusters_str(d[
|
|
93
|
+
column :CLUSTERS, 'Cluster IDs', :left, :size=>12 do |d|
|
|
94
|
+
OpenNebulaHelper.clusters_str(d['CLUSTERS']['ID'])
|
|
93
95
|
end
|
|
94
96
|
|
|
95
|
-
column :IMAGES,
|
|
96
|
-
if d[
|
|
97
|
-
|
|
97
|
+
column :IMAGES, 'Number of Images', :size=>6 do |d|
|
|
98
|
+
if d['IMAGES']['ID'].nil?
|
|
99
|
+
'0'
|
|
98
100
|
else
|
|
99
|
-
[d[
|
|
101
|
+
[d['IMAGES']['ID']].flatten.size
|
|
100
102
|
end
|
|
101
103
|
end
|
|
102
104
|
|
|
103
|
-
column :TYPE,
|
|
104
|
-
type = OpenNebula::Datastore::DATASTORE_TYPES[d[
|
|
105
|
+
column :TYPE, 'Datastore type', :left, :size=>4 do |d|
|
|
106
|
+
type = OpenNebula::Datastore::DATASTORE_TYPES[d['TYPE'].to_i]
|
|
105
107
|
OpenNebula::Datastore::SHORT_DATASTORE_TYPES[type]
|
|
106
108
|
end
|
|
107
109
|
|
|
108
|
-
column :DS,
|
|
109
|
-
d[
|
|
110
|
+
column :DS, 'Datastore driver', :left, :size=>7 do |d|
|
|
111
|
+
d['DS_MAD']
|
|
110
112
|
end
|
|
111
113
|
|
|
112
|
-
column :TM,
|
|
113
|
-
d[
|
|
114
|
+
column :TM, 'Transfer driver', :left, :size=>7 do |d|
|
|
115
|
+
d['TM_MAD']
|
|
114
116
|
end
|
|
115
117
|
|
|
116
|
-
column :STAT,
|
|
117
|
-
state = OpenNebula::Datastore::DATASTORE_STATES[d[
|
|
118
|
+
column :STAT, 'State of the Datastore', :left, :size=>3 do |d|
|
|
119
|
+
state = OpenNebula::Datastore::DATASTORE_STATES[d['STATE'].to_i]
|
|
118
120
|
OpenNebula::Datastore::SHORT_DATASTORE_STATES[state]
|
|
119
121
|
end
|
|
120
122
|
|
|
121
123
|
default :ID, :USER, :GROUP, :NAME, :SIZE, :AVAIL, :CLUSTERS, :IMAGES,
|
|
122
124
|
:TYPE, :DS, :TM, :STAT
|
|
123
125
|
end
|
|
124
|
-
|
|
125
|
-
table
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
private
|
|
129
129
|
|
|
130
|
-
def factory(id=nil)
|
|
130
|
+
def factory(id = nil)
|
|
131
131
|
if id
|
|
132
132
|
OpenNebula::Datastore.new_with_id(id, @client)
|
|
133
133
|
else
|
|
@@ -136,62 +136,69 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
def factory_pool(
|
|
139
|
+
def factory_pool(_user_flag = -2)
|
|
140
140
|
OpenNebula::DatastorePool.new(@client)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
-
def format_resource(datastore,
|
|
144
|
-
str=
|
|
145
|
-
str_h1=
|
|
143
|
+
def format_resource(datastore, _options = {})
|
|
144
|
+
str='%-15s: %-20s'
|
|
145
|
+
str_h1='%-80s'
|
|
146
146
|
|
|
147
147
|
CLIHelper.print_header(str_h1 % "DATASTORE #{datastore['ID']} INFORMATION")
|
|
148
|
-
puts str
|
|
149
|
-
puts str
|
|
150
|
-
puts str
|
|
151
|
-
puts str
|
|
152
|
-
puts str
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
puts str
|
|
156
|
-
puts str
|
|
157
|
-
puts str
|
|
158
|
-
puts str
|
|
159
|
-
puts str
|
|
160
|
-
puts str
|
|
148
|
+
puts format(str, 'ID', datastore.id.to_s)
|
|
149
|
+
puts format(str, 'NAME', datastore.name)
|
|
150
|
+
puts format(str, 'USER', datastore['UNAME'])
|
|
151
|
+
puts format(str, 'GROUP', datastore['GNAME'])
|
|
152
|
+
puts format(str, 'CLUSTERS',
|
|
153
|
+
OpenNebulaHelper.clusters_str(datastore.retrieve_elements('CLUSTERS/ID')))
|
|
154
|
+
|
|
155
|
+
puts format(str, 'TYPE', datastore.type_str)
|
|
156
|
+
puts format(str, 'DS_MAD', datastore['DS_MAD'])
|
|
157
|
+
puts format(str, 'TM_MAD', datastore['TM_MAD'])
|
|
158
|
+
puts format(str, 'BASE PATH', datastore['BASE_PATH'])
|
|
159
|
+
puts format(str, 'DISK_TYPE', Image::DISK_TYPES[datastore['DISK_TYPE'].to_i])
|
|
160
|
+
puts format(str, 'STATE', datastore.state_str)
|
|
161
161
|
puts
|
|
162
162
|
|
|
163
|
-
CLIHelper.print_header(str_h1 %
|
|
163
|
+
CLIHelper.print_header(str_h1 % 'DATASTORE CAPACITY', false)
|
|
164
164
|
|
|
165
165
|
shared = datastore['TEMPLATE/SHARED']
|
|
166
|
-
local = shared
|
|
166
|
+
local = !shared.nil? && shared.upcase == 'NO'
|
|
167
167
|
limit_mb = datastore['TEMPLATE/LIMIT_MB']
|
|
168
168
|
|
|
169
|
-
puts str
|
|
170
|
-
|
|
171
|
-
puts str
|
|
172
|
-
|
|
169
|
+
puts format(str, 'TOTAL:',
|
|
170
|
+
local ? '-' : OpenNebulaHelper.unit_to_str(datastore['TOTAL_MB'].to_i, {}, 'M'))
|
|
171
|
+
puts format(str, 'FREE:',
|
|
172
|
+
local ? '-' : OpenNebulaHelper.unit_to_str(datastore['FREE_MB'].to_i, {}, 'M'))
|
|
173
|
+
puts format(str, 'USED: ',
|
|
174
|
+
local ? '-' : OpenNebulaHelper.unit_to_str(datastore['USED_MB'].to_i, {}, 'M'))
|
|
175
|
+
puts format(str, 'LIMIT:',
|
|
176
|
+
local || limit_mb.nil? ? '-' : OpenNebulaHelper.unit_to_str(
|
|
177
|
+
limit_mb.to_i, {}, 'M'
|
|
178
|
+
))
|
|
173
179
|
puts
|
|
174
180
|
|
|
175
|
-
CLIHelper.print_header(str_h1 %
|
|
181
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
176
182
|
|
|
177
|
-
[
|
|
178
|
-
mask =
|
|
179
|
-
mask[0] =
|
|
180
|
-
mask[1] =
|
|
181
|
-
mask[2] =
|
|
183
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
184
|
+
mask = '---'
|
|
185
|
+
mask[0] = 'u' if datastore["PERMISSIONS/#{e}_U"] == '1'
|
|
186
|
+
mask[1] = 'm' if datastore["PERMISSIONS/#{e}_M"] == '1'
|
|
187
|
+
mask[2] = 'a' if datastore["PERMISSIONS/#{e}_A"] == '1'
|
|
182
188
|
|
|
183
|
-
puts str
|
|
184
|
-
|
|
189
|
+
puts format(str, e, mask)
|
|
190
|
+
end
|
|
185
191
|
puts
|
|
186
192
|
|
|
187
|
-
CLIHelper.print_header(str_h1 %
|
|
193
|
+
CLIHelper.print_header(str_h1 % 'DATASTORE TEMPLATE', false)
|
|
188
194
|
puts datastore.template_str
|
|
189
195
|
|
|
190
196
|
puts
|
|
191
197
|
|
|
192
|
-
CLIHelper.print_header(
|
|
198
|
+
CLIHelper.print_header(format('%-15s', 'IMAGES'))
|
|
193
199
|
datastore.img_ids.each do |id|
|
|
194
|
-
puts
|
|
200
|
+
puts format('%-15s', id)
|
|
195
201
|
end
|
|
196
202
|
end
|
|
203
|
+
|
|
197
204
|
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 #
|
|
@@ -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 #
|
|
@@ -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 #
|
|
@@ -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 #
|
|
@@ -18,24 +18,26 @@ require 'one_helper'
|
|
|
18
18
|
require 'opennebula/marketplace'
|
|
19
19
|
require 'opennebula/marketplace_pool'
|
|
20
20
|
|
|
21
|
+
# Helper class for Marketplace commands
|
|
21
22
|
class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
|
|
23
|
+
|
|
22
24
|
MARKETPLACE = {
|
|
23
|
-
:name =>
|
|
24
|
-
:short =>
|
|
25
|
-
:large =>
|
|
26
|
-
:description =>
|
|
25
|
+
:name => 'marketplace',
|
|
26
|
+
:short => '-m id|name',
|
|
27
|
+
:large => '--marketplace id|name',
|
|
28
|
+
:description => 'Selects the marketplace',
|
|
27
29
|
:format => String,
|
|
28
|
-
:proc => lambda {
|
|
29
|
-
OpenNebulaHelper.rname_to_id(o,
|
|
30
|
+
:proc => lambda {|o, _options|
|
|
31
|
+
OpenNebulaHelper.rname_to_id(o, 'MARKETPLACE')
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
def self.rname
|
|
34
|
-
|
|
36
|
+
'MARKETPLACE'
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def self.conf_file
|
|
38
|
-
|
|
40
|
+
'onemarket.yaml'
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def self.state_to_str(id)
|
|
@@ -47,51 +49,51 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
|
|
|
47
49
|
def format_pool(options)
|
|
48
50
|
config_file = self.class.table_conf
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
column :ID,
|
|
52
|
-
d[
|
|
52
|
+
CLIHelper::ShowTable.new(config_file, self) do
|
|
53
|
+
column :ID, 'ONE identifier for the Marketplace', :size=>4 do |d|
|
|
54
|
+
d['ID']
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
column :USER,
|
|
56
|
-
|
|
57
|
+
column :USER, 'Username of the Marketplace owner', :left,
|
|
58
|
+
:size=>10 do |d|
|
|
57
59
|
helper.user_name(d, options)
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
column :GROUP,
|
|
61
|
-
|
|
62
|
+
column :GROUP, 'Group of the Marketplace', :left,
|
|
63
|
+
:size=>10 do |d|
|
|
62
64
|
helper.group_name(d, options)
|
|
63
65
|
end
|
|
64
66
|
|
|
65
|
-
column :NAME,
|
|
66
|
-
d[
|
|
67
|
+
column :NAME, 'Name of the Marketplace', :left, :size=>30 do |d|
|
|
68
|
+
d['NAME']
|
|
67
69
|
end
|
|
68
70
|
|
|
69
|
-
column :SIZE,
|
|
71
|
+
column :SIZE, 'Marketplace total size', :size =>10 do |d|
|
|
70
72
|
OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M')
|
|
71
73
|
end
|
|
72
74
|
|
|
73
|
-
column :AVAIL,
|
|
75
|
+
column :AVAIL, 'Marketplace free size', :left, :size =>10 do |d|
|
|
74
76
|
if d['TOTAL_MB'].to_i == 0
|
|
75
|
-
|
|
77
|
+
'-'
|
|
76
78
|
else
|
|
77
|
-
"#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round
|
|
79
|
+
"#{((d['FREE_MB'].to_f/d['TOTAL_MB'].to_f) * 100).round}%"
|
|
78
80
|
end
|
|
79
81
|
end
|
|
80
82
|
|
|
81
|
-
column :APPS,
|
|
82
|
-
if d[
|
|
83
|
-
|
|
83
|
+
column :APPS, 'Number of marketplace apps', :size=>6 do |d|
|
|
84
|
+
if d['MARKETPLACEAPPS']['ID'].nil?
|
|
85
|
+
'0'
|
|
84
86
|
else
|
|
85
|
-
[d[
|
|
87
|
+
[d['MARKETPLACEAPPS']['ID']].flatten.size
|
|
86
88
|
end
|
|
87
89
|
end
|
|
88
90
|
|
|
89
|
-
column :MAD,
|
|
90
|
-
d[
|
|
91
|
+
column :MAD, 'Marketplace driver', :left, :size=>7 do |d|
|
|
92
|
+
d['MARKET_MAD']
|
|
91
93
|
end
|
|
92
94
|
|
|
93
|
-
column :ZONE,
|
|
94
|
-
d[
|
|
95
|
+
column :ZONE, 'Zone ID', :size=>4 do |d|
|
|
96
|
+
d['ZONE_ID']
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
column :STAT, 'Markeplace status', :left, :size => 4 do |d|
|
|
@@ -100,13 +102,11 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
|
|
|
100
102
|
|
|
101
103
|
default :ID, :NAME, :SIZE, :AVAIL, :APPS, :MAD, :ZONE, :STAT
|
|
102
104
|
end
|
|
103
|
-
|
|
104
|
-
table
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
private
|
|
108
108
|
|
|
109
|
-
def factory(id=nil)
|
|
109
|
+
def factory(id = nil)
|
|
110
110
|
if id
|
|
111
111
|
OpenNebula::MarketPlace.new_with_id(id, @client)
|
|
112
112
|
else
|
|
@@ -115,51 +115,52 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper
|
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
def factory_pool(
|
|
118
|
+
def factory_pool(_user_flag = -2)
|
|
119
119
|
OpenNebula::MarketPlacePool.new(@client)
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
def format_resource(market,
|
|
123
|
-
str=
|
|
124
|
-
str_h1=
|
|
122
|
+
def format_resource(market, _options = {})
|
|
123
|
+
str='%-15s: %-20s'
|
|
124
|
+
str_h1='%-80s'
|
|
125
125
|
|
|
126
126
|
CLIHelper.print_header(str_h1 % "MARKETPLACE #{market['ID']} INFORMATION")
|
|
127
|
-
puts str
|
|
128
|
-
puts str
|
|
129
|
-
puts str
|
|
130
|
-
puts str
|
|
131
|
-
puts str
|
|
127
|
+
puts format(str, 'ID', market.id.to_s)
|
|
128
|
+
puts format(str, 'NAME', market.name)
|
|
129
|
+
puts format(str, 'USER', market['UNAME'])
|
|
130
|
+
puts format(str, 'GROUP', market['GNAME'])
|
|
131
|
+
puts format(str, 'STATE', market.state_str)
|
|
132
132
|
|
|
133
|
-
puts str
|
|
133
|
+
puts format(str, 'MARKET_MAD', market['MARKET_MAD'])
|
|
134
134
|
puts
|
|
135
135
|
|
|
136
|
-
CLIHelper.print_header(str_h1 %
|
|
136
|
+
CLIHelper.print_header(str_h1 % 'MARKETPLACE CAPACITY', false)
|
|
137
137
|
|
|
138
|
-
puts str
|
|
139
|
-
puts str
|
|
140
|
-
puts str
|
|
138
|
+
puts format(str, 'TOTAL:', OpenNebulaHelper.unit_to_str(market['TOTAL_MB'].to_i, {}, 'M'))
|
|
139
|
+
puts format(str, 'FREE:', OpenNebulaHelper.unit_to_str(market['FREE_MB'].to_i, {}, 'M'))
|
|
140
|
+
puts format(str, 'USED: ', OpenNebulaHelper.unit_to_str(market['USED_MB'].to_i, {}, 'M'))
|
|
141
141
|
puts
|
|
142
142
|
|
|
143
|
-
CLIHelper.print_header(str_h1 %
|
|
143
|
+
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
144
144
|
|
|
145
|
-
[
|
|
146
|
-
mask =
|
|
147
|
-
mask[0] =
|
|
148
|
-
mask[1] =
|
|
149
|
-
mask[2] =
|
|
145
|
+
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
|
146
|
+
mask = '---'
|
|
147
|
+
mask[0] = 'u' if market["PERMISSIONS/#{e}_U"] == '1'
|
|
148
|
+
mask[1] = 'm' if market["PERMISSIONS/#{e}_M"] == '1'
|
|
149
|
+
mask[2] = 'a' if market["PERMISSIONS/#{e}_A"] == '1'
|
|
150
150
|
|
|
151
|
-
puts str
|
|
152
|
-
|
|
151
|
+
puts format(str, e, mask)
|
|
152
|
+
end
|
|
153
153
|
puts
|
|
154
154
|
|
|
155
|
-
CLIHelper.print_header(str_h1 %
|
|
155
|
+
CLIHelper.print_header(str_h1 % 'MARKETPLACE TEMPLATE', false)
|
|
156
156
|
puts market.template_str
|
|
157
157
|
|
|
158
158
|
puts
|
|
159
159
|
|
|
160
|
-
CLIHelper.print_header(
|
|
160
|
+
CLIHelper.print_header(format('%-15s', 'MARKETAPPS'))
|
|
161
161
|
market.marketapp_ids.each do |id|
|
|
162
|
-
puts
|
|
162
|
+
puts format('%-15s', id)
|
|
163
163
|
end
|
|
164
164
|
end
|
|
165
|
+
|
|
165
166
|
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 #
|