ovirt-engine-sdk 4.0.12 → 4.1.0.alpha2
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/CHANGES.adoc +50 -33
- data/ext/ovirtsdk4c/extconf.rb +7 -17
- data/ext/ovirtsdk4c/ov_http_client.c +0 -36
- data/lib/ovirtsdk4/connection.rb +13 -47
- data/lib/ovirtsdk4/reader.rb +3 -40
- data/lib/ovirtsdk4/readers.rb +409 -107
- data/lib/ovirtsdk4/services.rb +1983 -4279
- data/lib/ovirtsdk4/types.rb +1033 -21
- data/lib/ovirtsdk4/version.rb +1 -1
- data/lib/ovirtsdk4/writer.rb +2 -2
- data/lib/ovirtsdk4/writers.rb +147 -24
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01492a98ce30994bf24efc6a20606a0632a43a92
|
4
|
+
data.tar.gz: b1febb7296118d3039f7014e2311c89a9a5b9f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258f0e168ebf10d9a860e5d8b0f236dd151359d446f8eff7a8ad132815119e984586feee94919c9e89d68f0595376fbe9aa6d3296acaca50e3fb966a0481052b
|
7
|
+
data.tar.gz: 14622b76ff510f1b30ab42a40f5badbb8b8bd772f73bc992fbd4581d940c79804b7925067587fc39b6d45216941cfbb7b4de81989cc58fa4df4148ce77fb9a39
|
data/CHANGES.adoc
CHANGED
@@ -2,69 +2,86 @@
|
|
2
2
|
|
3
3
|
This document describes the relevant changes between releases of the SDK.
|
4
4
|
|
5
|
-
== 4.0
|
5
|
+
== 4.1.0-alpha2 / Jan 12 2017
|
6
|
+
|
7
|
+
Update to model 4.1.16:
|
8
|
+
|
9
|
+
* Add `succeeded` parameter to the operation that end an external job.
|
10
|
+
|
11
|
+
* Add `initial_size` attribute to the `Disk` type.
|
6
12
|
|
7
13
|
Bug fixes:
|
8
14
|
|
9
|
-
*
|
15
|
+
* Fix writing 'id' attribute for enum values.
|
16
|
+
https://bugzilla.redhat.com/1408839[#1408839].
|
10
17
|
|
11
|
-
*
|
12
|
-
https://bugzilla.redhat.com/
|
18
|
+
* Enable installation in Vagrant with embedded Ruby
|
19
|
+
https://bugzilla.redhat.com/1411594[#1411594].
|
13
20
|
|
14
|
-
== 4.0
|
21
|
+
== 4.1.0-alpha1 / Dec 19 2016
|
15
22
|
|
16
|
-
|
23
|
+
Update to model 4.1.24:
|
17
24
|
|
18
|
-
*
|
25
|
+
* Added new `v4` value to the `StorageFormat` enum.
|
19
26
|
|
20
|
-
*
|
27
|
+
* Add `seal` operation to the service that manages templates.
|
21
28
|
|
22
|
-
*
|
29
|
+
* Add `progress` attribute to the `Disk` and `Step` types.
|
23
30
|
|
24
|
-
*
|
31
|
+
* Add `allow_partial_import` parameter to the operations that import
|
32
|
+
virtual machines and templates.
|
25
33
|
|
26
|
-
|
34
|
+
* Add `ticket` operation to the service that manages the graphics
|
35
|
+
console of a virtual machine.
|
27
36
|
|
28
|
-
*
|
37
|
+
* Added `urandom` to the `RngSource` enumerated type.
|
29
38
|
|
30
|
-
|
39
|
+
* Added `migratable` flag to the `VnicProfile` type.
|
31
40
|
|
32
|
-
|
41
|
+
* Add `gluster_tuned_profile` to the `Cluster` type.
|
33
42
|
|
34
|
-
*
|
43
|
+
* Add `skip_if_gluster_bricks_up` and `skip_if_gluster_quorum_not_met`
|
44
|
+
attributes to the `FencingPolicy` type.
|
35
45
|
|
36
|
-
|
46
|
+
* Add the `ImageTransferDirection` enumerated type and the `direction`
|
47
|
+
attribute to the `ImageTransfer` type.
|
37
48
|
|
38
|
-
|
49
|
+
* Replace the generic `GraphicsConsole` and `GraphicsConsoles` with
|
50
|
+
specific services for virtual machines, templates and instance
|
51
|
+
types.
|
39
52
|
|
40
|
-
*
|
41
|
-
applications that need version 2.0 or newer.
|
53
|
+
* Deprecate the `legacy` USB type.
|
42
54
|
|
43
|
-
|
55
|
+
* Add `remoteviewerconnectionfile` action to the `GraphicsConsole`
|
56
|
+
service.
|
44
57
|
|
45
|
-
|
58
|
+
* Add `max` attribute to the `MemoryPolicy` type.
|
46
59
|
|
47
|
-
*
|
60
|
+
* Make `Ip.version` optional.
|
48
61
|
|
49
|
-
|
62
|
+
* Add the `active_slave` link to the `Bonding` type.
|
50
63
|
|
51
|
-
*
|
64
|
+
* Add DNS configuration support to `Network` and `NetworkAttachment`.
|
52
65
|
|
53
|
-
|
66
|
+
* Add the `uses_scsi_reservation` attribute to the `DiskAttachment`
|
67
|
+
type.
|
54
68
|
|
55
|
-
|
69
|
+
* Add the `sparsify` method to `DiskService`.
|
56
70
|
|
57
|
-
* Add
|
71
|
+
* Add the `discard_max_size` and `discard_zeroes_data` to the `LogicalUnit`
|
72
|
+
type.
|
58
73
|
|
59
|
-
*
|
74
|
+
* Add `logical_name` attribute to the disk attachment type.
|
60
75
|
|
61
|
-
|
76
|
+
* Add the `upgradecheck` action to the host service.
|
62
77
|
|
63
|
-
*
|
64
|
-
https://bugzilla.redhat.com/1408839[#1408839].
|
78
|
+
* Add the `original_template` link to the virtual machine type.
|
65
79
|
|
66
|
-
|
67
|
-
|
80
|
+
New features:
|
81
|
+
|
82
|
+
* Require Ruby 2.
|
83
|
+
|
84
|
+
* Enable compression by default https://bugzilla.redhat.com/1370464[#1370464].
|
68
85
|
|
69
86
|
== 4.0.6 / Oct 18 2016
|
70
87
|
|
data/ext/ovirtsdk4c/extconf.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
#
|
4
|
-
# Copyright (c) 2015-
|
4
|
+
# Copyright (c) 2015-2016 Red Hat, Inc.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -18,25 +18,15 @@
|
|
18
18
|
|
19
19
|
require 'mkmf'
|
20
20
|
|
21
|
-
# Check
|
22
|
-
|
23
|
-
if xml2_config
|
24
|
-
cflags = `#{xml2_config} --cflags`.strip
|
25
|
-
libs = `#{xml2_config} --libs`.strip
|
26
|
-
$CPPFLAGS = "#{cflags} #{$CPPFLAGS}"
|
27
|
-
$LDFLAGS = "#{libs} #{$LDFLAGS}"
|
28
|
-
elsif !pkg_config('libxml2')
|
21
|
+
# Check that "libxml2" is available:
|
22
|
+
unless find_executable('xml2-config')
|
29
23
|
raise 'The "libxml2" package isn\'t available.'
|
30
24
|
end
|
25
|
+
$CPPFLAGS = "#{`xml2-config --cflags`.strip} #{$CPPFLAGS}"
|
26
|
+
$LDFLAGS = "#{`xml2-config --libs`.strip} #{$LDFLAGS}"
|
31
27
|
|
32
|
-
# Check
|
33
|
-
|
34
|
-
if curl_config
|
35
|
-
cflags = `#{curl_config} --cflags`.strip
|
36
|
-
libs = `#{curl_config} --libs`.strip
|
37
|
-
$CPPFLAGS = "#{cflags} #{$CPPFLAGS}"
|
38
|
-
$LDFLAGS = "#{libs} #{$LDFLAGS}"
|
39
|
-
elsif !pkg_config('libcurl')
|
28
|
+
# Check that "libcurl" is available:
|
29
|
+
unless pkg_config('libcurl')
|
40
30
|
raise 'The "libcurl" package isn\'t available.'
|
41
31
|
end
|
42
32
|
|
@@ -19,7 +19,6 @@ limitations under the License.
|
|
19
19
|
|
20
20
|
#include <ctype.h>
|
21
21
|
#include <curl/curl.h>
|
22
|
-
#include <stdarg.h>
|
23
22
|
#include <stdbool.h>
|
24
23
|
#include <stdlib.h>
|
25
24
|
#include <string.h>
|
@@ -49,8 +48,6 @@ static VALUE PROXY_PASSWORD_SYMBOL;
|
|
49
48
|
/* Method identifiers: */
|
50
49
|
static ID DEBUG_ID;
|
51
50
|
static ID ENCODE_WWW_FORM_ID;
|
52
|
-
static ID INFO_ID;
|
53
|
-
static ID INFO_Q_ID;
|
54
51
|
static ID READ_ID;
|
55
52
|
static ID STRING_ID;
|
56
53
|
static ID STRING_IO_ID;
|
@@ -552,22 +549,6 @@ static void ov_http_client_perform_cancel(void* data) {
|
|
552
549
|
perform_context->cancel = true;
|
553
550
|
}
|
554
551
|
|
555
|
-
static void ov_http_client_log_info(VALUE log, const char* format, ...) {
|
556
|
-
VALUE enabled;
|
557
|
-
VALUE message;
|
558
|
-
va_list args;
|
559
|
-
|
560
|
-
if (!NIL_P(log)) {
|
561
|
-
enabled = rb_funcall(log, INFO_Q_ID, 0);
|
562
|
-
if (RTEST(enabled)) {
|
563
|
-
va_start(args, format);
|
564
|
-
message = rb_vsprintf(format, args);
|
565
|
-
rb_funcall(log, INFO_ID, 1, message);
|
566
|
-
va_end(args);
|
567
|
-
}
|
568
|
-
}
|
569
|
-
}
|
570
|
-
|
571
552
|
static VALUE ov_http_client_send(VALUE self, VALUE request, VALUE response) {
|
572
553
|
VALUE header;
|
573
554
|
VALUE url;
|
@@ -645,14 +626,6 @@ static VALUE ov_http_client_send(VALUE self, VALUE request, VALUE response) {
|
|
645
626
|
}
|
646
627
|
curl_easy_setopt(object->curl, CURLOPT_HTTPHEADER, headers);
|
647
628
|
|
648
|
-
/* Send a summary of the request to the log: */
|
649
|
-
ov_http_client_log_info(
|
650
|
-
object->log,
|
651
|
-
"Sending '%"PRIsVALUE"' request to URL '%"PRIsVALUE"'.",
|
652
|
-
request_object->method,
|
653
|
-
url
|
654
|
-
);
|
655
|
-
|
656
629
|
/* Performing the request is a potentially lengthy and blocking operation, so we need to make sure that it runs
|
657
630
|
without the global interpreter lock acquired as much as possible: */
|
658
631
|
perform_context.object = object;
|
@@ -701,13 +674,6 @@ static VALUE ov_http_client_send(VALUE self, VALUE request, VALUE response) {
|
|
701
674
|
/* Get the response body: */
|
702
675
|
response_object->body = rb_funcall(perform_context.out, STRING_ID, 0);
|
703
676
|
|
704
|
-
/* Send a summary of the response to the log: */
|
705
|
-
ov_http_client_log_info(
|
706
|
-
object->log,
|
707
|
-
"Received response code '%"PRIsVALUE"'.",
|
708
|
-
response_object->code
|
709
|
-
);
|
710
|
-
|
711
677
|
return Qnil;
|
712
678
|
}
|
713
679
|
|
@@ -746,8 +712,6 @@ void ov_http_client_define(void) {
|
|
746
712
|
/* Define the method identifiers: */
|
747
713
|
DEBUG_ID = rb_intern("debug");
|
748
714
|
ENCODE_WWW_FORM_ID = rb_intern("encode_www_form");
|
749
|
-
INFO_ID = rb_intern("info");
|
750
|
-
INFO_Q_ID = rb_intern("info?");
|
751
715
|
READ_ID = rb_intern("read");
|
752
716
|
STRING_ID = rb_intern("string");
|
753
717
|
STRING_IO_ID = rb_intern("StringIO");
|
data/lib/ovirtsdk4/connection.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2015-
|
2
|
+
# Copyright (c) 2015-2016 Red Hat, Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -15,7 +15,6 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require 'json'
|
18
|
-
require 'tempfile'
|
19
18
|
require 'uri'
|
20
19
|
|
21
20
|
module OvirtSDK4
|
@@ -55,14 +54,8 @@ module OvirtSDK4
|
|
55
54
|
# name should be checked.
|
56
55
|
#
|
57
56
|
# @option opts [String] :ca_file The name of a PEM file containing the trusted CA certificates. The certificate
|
58
|
-
# presented by the server will be verified using these CA certificates. If
|
59
|
-
#
|
60
|
-
# then the certificates from both options will be trusted.
|
61
|
-
#
|
62
|
-
# @option opts [Array<String>] :ca_certs An array of strings containing the trusted CA certificates, in PEM
|
63
|
-
# format. The certificate presented by the server will be verified using these CA certificates. If neither this
|
64
|
-
# nor the `ca_file` options are provided, then the system wide CA certificates store is used. If both options
|
65
|
-
# are provided, then the certificates from both options will be trusted.
|
57
|
+
# presented by the server will be verified using these CA certificates. If not set then the system wide CA
|
58
|
+
# certificates store is used.
|
66
59
|
#
|
67
60
|
# @option opts [Boolean] :debug (false) A boolean flag indicating if debug output should be generated. If the
|
68
61
|
# values is `true` and the `log` parameter isn't `nil` then the data sent to and received from the server will be
|
@@ -77,9 +70,11 @@ module OvirtSDK4
|
|
77
70
|
# (the default) means wait for ever. If the timeout expires before the response is received an exception will be
|
78
71
|
# raised.
|
79
72
|
#
|
80
|
-
# @option opts [Boolean] :compress (
|
73
|
+
# @option opts [Boolean] :compress (true) A boolean flag indicating if the SDK should ask the server to send
|
81
74
|
# compressed responses. Note that this is a hint for the server, and that it may return uncompressed data even
|
82
|
-
# when this parameter is set to `true`.
|
75
|
+
# when this parameter is set to `true`. Also, compression will be automatically disabled when the `debug`
|
76
|
+
# parameter is set to `true`, as otherwise the debug output will be compressed as well, and then it isn't
|
77
|
+
# useful.
|
83
78
|
#
|
84
79
|
# @option opts [String] :proxy_url A string containing the protocol, address and port number of the proxy server
|
85
80
|
# to use to connect to the server. For example, in order to use the HTTP proxy `proxy.example.com` that is
|
@@ -90,11 +85,6 @@ module OvirtSDK4
|
|
90
85
|
#
|
91
86
|
# @option opts [String] :proxy_password The password of the user to authenticate to the proxy server.
|
92
87
|
#
|
93
|
-
# @option opts [Hash] :headers Custom HTTP headers to send with all requests. The keys of the hash can be
|
94
|
-
# strings of symbols, and they will be used as the names of the headers. The values of the hash will be used
|
95
|
-
# as the names of the headers. If the same header is provided here and in the `headers` parameter of a specific
|
96
|
-
# method call, then the `headers` parameter of the specific method call will have precendence.
|
97
|
-
#
|
98
88
|
def initialize(opts = {})
|
99
89
|
# Get the values of the parameters and assign default values:
|
100
90
|
@url = opts[:url]
|
@@ -103,38 +93,23 @@ module OvirtSDK4
|
|
103
93
|
@token = opts[:token]
|
104
94
|
@insecure = opts[:insecure] || false
|
105
95
|
@ca_file = opts[:ca_file]
|
106
|
-
@ca_certs = opts[:ca_certs]
|
107
96
|
@debug = opts[:debug] || false
|
108
97
|
@log = opts[:log]
|
109
98
|
@kerberos = opts[:kerberos] || false
|
110
99
|
@timeout = opts[:timeout] || 0
|
111
|
-
@compress = opts[:compress] ||
|
100
|
+
@compress = opts[:compress] || true
|
112
101
|
@proxy_url = opts[:proxy_url]
|
113
102
|
@proxy_username = opts[:proxy_username]
|
114
103
|
@proxy_password = opts[:proxy_password]
|
115
|
-
|
116
|
-
|
117
|
-
#
|
118
|
-
|
119
|
-
|
120
|
-
# Create a temporary file to store the CA certificates, and populate it with the contents of the 'ca_file' and
|
121
|
-
# 'ca_certs' options. The file will be removed when the connection is closed.
|
122
|
-
@ca_store = nil
|
123
|
-
if @ca_file || @ca_certs
|
124
|
-
@ca_store = Tempfile.new('ca_store')
|
125
|
-
@ca_store.write(::File.read(@ca_file)) if @ca_file
|
126
|
-
if @ca_certs
|
127
|
-
@ca_certs.each do |ca_cert|
|
128
|
-
@ca_store.write(ca_cert)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
@ca_store.close
|
132
|
-
end
|
104
|
+
|
105
|
+
# Automatically disable compression when debug is enabled, as otherwise the debug output generated by
|
106
|
+
# libcurl is also compressed, and that isn't useful for debugging:
|
107
|
+
@compress = false if @debug
|
133
108
|
|
134
109
|
# Create the HTTP client:
|
135
110
|
@client = HttpClient.new(
|
136
111
|
insecure: @insecure,
|
137
|
-
ca_file: @
|
112
|
+
ca_file: @ca_file,
|
138
113
|
debug: @debug,
|
139
114
|
log: @log,
|
140
115
|
timeout: @timeout,
|
@@ -195,9 +170,6 @@ module OvirtSDK4
|
|
195
170
|
request.headers['All-Content'] = all_content unless all_content.nil?
|
196
171
|
end
|
197
172
|
|
198
|
-
# Add the global headers, but without replacing the values that may already exist:
|
199
|
-
request.headers.merge!(@headers) { |_name, local, _global| local } if @headers
|
200
|
-
|
201
173
|
# Set the authentication token:
|
202
174
|
@token ||= create_access_token
|
203
175
|
request.token = @token
|
@@ -278,9 +250,6 @@ module OvirtSDK4
|
|
278
250
|
body: URI.encode_www_form(parameters)
|
279
251
|
)
|
280
252
|
|
281
|
-
# Add the global headers:
|
282
|
-
request.headers.merge!(@headers) if @headers
|
283
|
-
|
284
253
|
# Create an empty response:
|
285
254
|
response = HttpResponse.new
|
286
255
|
|
@@ -436,9 +405,6 @@ module OvirtSDK4
|
|
436
405
|
|
437
406
|
# Close the HTTP client:
|
438
407
|
@client.close if @client
|
439
|
-
|
440
|
-
# Remove the temporary file that contains the trusted CA certificates:
|
441
|
-
@ca_store.unlink if @ca_store
|
442
408
|
end
|
443
409
|
end
|
444
410
|
end
|
data/lib/ovirtsdk4/reader.rb
CHANGED
@@ -121,7 +121,7 @@ module OvirtSDK4
|
|
121
121
|
#
|
122
122
|
# Converts the given text to a decimal value.
|
123
123
|
#
|
124
|
-
# @return [
|
124
|
+
# @return [Fixnum]
|
125
125
|
#
|
126
126
|
def self.parse_decimal(text)
|
127
127
|
return nil if text.nil?
|
@@ -136,7 +136,7 @@ module OvirtSDK4
|
|
136
136
|
# Reads a decimal value, assuming that the cursor is positioned at the start element that contains the value.
|
137
137
|
#
|
138
138
|
# @param reader [XmlReader]
|
139
|
-
# @return [
|
139
|
+
# @return [Fixnum]
|
140
140
|
#
|
141
141
|
def self.read_decimal(reader)
|
142
142
|
Reader.parse_decimal(reader.read_element)
|
@@ -147,7 +147,7 @@ module OvirtSDK4
|
|
147
147
|
# values.
|
148
148
|
#
|
149
149
|
# @param reader [XmlReader]
|
150
|
-
# @return [Array<
|
150
|
+
# @return [Array<Fixnum>]
|
151
151
|
#
|
152
152
|
def self.read_decimals(reader)
|
153
153
|
reader.read_elements.map { |text| Reader.parse_decimal(text) }
|
@@ -189,43 +189,6 @@ module OvirtSDK4
|
|
189
189
|
reader.read_elements.map { |text| Reader.parse_date(text) }
|
190
190
|
end
|
191
191
|
|
192
|
-
#
|
193
|
-
# Converts the given text to an enum.
|
194
|
-
#
|
195
|
-
# @param enum_module [Module]
|
196
|
-
# @param text [String]
|
197
|
-
# @return [String]
|
198
|
-
#
|
199
|
-
def self.parse_enum(enum_module, text)
|
200
|
-
return nil unless text
|
201
|
-
values = enum_module.constants.map { |const| enum_module.const_get(const) }
|
202
|
-
values.detect { |value| value.casecmp(text).zero? }
|
203
|
-
end
|
204
|
-
|
205
|
-
#
|
206
|
-
# Reads a enum value, assuming that the cursor is positioned at the
|
207
|
-
# start element that contains the value.
|
208
|
-
#
|
209
|
-
# @param enum_module [Module]
|
210
|
-
# @param reader [XmlReader]
|
211
|
-
# @return [Array<String>]
|
212
|
-
#
|
213
|
-
def self.read_enum(enum_module, reader)
|
214
|
-
Reader.parse_enum(enum_module, reader.read_element)
|
215
|
-
end
|
216
|
-
|
217
|
-
#
|
218
|
-
# Reads a list of enum values, assuming that the cursor is positioned
|
219
|
-
# at the start element of the element that contains the first value.
|
220
|
-
#
|
221
|
-
# @param enum_module [Module]
|
222
|
-
# @param reader [XmlReader]
|
223
|
-
# @return [Array<String>]
|
224
|
-
#
|
225
|
-
def self.read_enums(enum_module, reader)
|
226
|
-
reader.read_elements.map { |text| Reader.parse_enum(enum_module, text) }
|
227
|
-
end
|
228
|
-
|
229
192
|
#
|
230
193
|
# This hash stores for each known tag a reference to the method that read the object corresponding for that tag. For
|
231
194
|
# example, for the `vm` tag it will contain a reference to the `VmReader.read_one` method, and for the `vms` tag
|