ovirt-engine-sdk 4.1.9 → 4.1.10
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 +21 -0
- data/README.adoc +27 -2
- data/ext/ovirtsdk4c/ov_http_client.c +111 -20
- data/ext/ovirtsdk4c/ov_http_client.h +6 -1
- data/ext/ovirtsdk4c/ov_http_request.c +65 -40
- data/ext/ovirtsdk4c/ov_http_request.h +11 -10
- data/lib/ovirtsdk4/connection.rb +7 -2
- data/lib/ovirtsdk4/services.rb +70 -22
- data/lib/ovirtsdk4/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a13beb0ec3a34430b8b4c88dbca6733bd11ff2df
|
|
4
|
+
data.tar.gz: 5e7347f6145b8a9427cf4d1acd479d41707794c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0f2fb994b048d4928a3291c8c4b77fd4e464ac9906d9782f51f3c44047be82099c132b95a224e1a6c39f7fca4132c4e970027c49edbc1842ff070d20b3fb093
|
|
7
|
+
data.tar.gz: 7082c6f72b823c3d9adcaa537bb5bd265e7754d5f57b76a920e06f1cd604f61da5623556106b27fbeeb74b37d16ef00edb5f1223aec8843bae7f7416f3e21626
|
data/CHANGES.adoc
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
This document describes the relevant changes between releases of the SDK.
|
|
4
4
|
|
|
5
|
+
== 4.1.10 / Nov 3 2017
|
|
6
|
+
|
|
7
|
+
Update to model 4.1.40:
|
|
8
|
+
|
|
9
|
+
* Add `image` parameter to `HostService.upgrade`
|
|
10
|
+
https://bugzilla.redhat.com/1488434[#1488434].
|
|
11
|
+
|
|
12
|
+
New features:
|
|
13
|
+
|
|
14
|
+
* Add support for cookies.
|
|
15
|
+
|
|
16
|
+
* Add `connect_timeout` parameter
|
|
17
|
+
https://bugzilla.redhat.com/1508944[#1508944].
|
|
18
|
+
|
|
19
|
+
Bug fixes:
|
|
20
|
+
|
|
21
|
+
* Check the types of the `HttpClient` constructor parameters.
|
|
22
|
+
|
|
23
|
+
* Require `redhat-rpm-config` for building
|
|
24
|
+
https://bugzilla.redhat.com/1505427[#1505427].
|
|
25
|
+
|
|
5
26
|
== 4.1.9 / Oct 13 2017
|
|
6
27
|
|
|
7
28
|
Update to model 4.1.39:
|
data/README.adoc
CHANGED
|
@@ -41,16 +41,41 @@ CentOS:
|
|
|
41
41
|
gcc \
|
|
42
42
|
libcurl-devel \
|
|
43
43
|
libxml2-devel \
|
|
44
|
-
|
|
44
|
+
redhat-rpm-config \
|
|
45
|
+
ruby \
|
|
46
|
+
ruby-devel \
|
|
47
|
+
rubygems \
|
|
48
|
+
rubygems-devel
|
|
49
|
+
|
|
50
|
+
NOTE: The installation of the `ruby`, `ruby-devel`, `rubygems` and
|
|
51
|
+
`rubygems-devel` packages is necessary if you are going to use the Ruby
|
|
52
|
+
version included in your distribution. If you are using tools like
|
|
53
|
+
`rbenv` or `rvm` then this is not necessary.
|
|
45
54
|
|
|
46
55
|
If you are using distributions like Debian, or Ubuntu:
|
|
47
56
|
|
|
48
57
|
# apt-get --assume-yes install \
|
|
49
58
|
gcc \
|
|
59
|
+
libcurl4-openssl-dev \
|
|
50
60
|
libxml2-dev \
|
|
51
|
-
|
|
61
|
+
ruby \
|
|
52
62
|
ruby-dev
|
|
53
63
|
|
|
64
|
+
NOTE: The installation of the `ruby` and `ruby-dev` packages is
|
|
65
|
+
necessary if you are going to use the Ruby version included in your
|
|
66
|
+
distribution. If you are using tools like `rbenv` or `rvm` then this is
|
|
67
|
+
not necessary.
|
|
68
|
+
|
|
69
|
+
Some Linux distributions, like Debian and Ubuntu, provide multiple
|
|
70
|
+
versions of `libcurl`, compiled with support for different TLS
|
|
71
|
+
libraries: OpenSSL, NSS and GnuTLS. Currently the SDK only supports
|
|
72
|
+
OpenSSL, so make sure that you have that version of `libcurl` installed.
|
|
73
|
+
For example, in Ubuntu 16.04 if you have the NSS version installed, you
|
|
74
|
+
will have to remove it and then install the OpenSSL version:
|
|
75
|
+
|
|
76
|
+
# apt-get --assume-yes remove libcurl4-nss-dev
|
|
77
|
+
# apt-get --assume-yes install libcurl4-openssl-dev
|
|
78
|
+
|
|
54
79
|
NOTE: The examples above use the `dnf` command, which is the default in
|
|
55
80
|
Fedora 24. In CentOS 7 you may need to use the `yum` command, as `dnf`
|
|
56
81
|
is optional.
|
|
@@ -50,7 +50,8 @@ static VALUE PROXY_PASSWORD_SYMBOL;
|
|
|
50
50
|
static VALUE PROXY_URL_SYMBOL;
|
|
51
51
|
static VALUE PROXY_USERNAME_SYMBOL;
|
|
52
52
|
static VALUE TIMEOUT_SYMBOL;
|
|
53
|
-
static VALUE
|
|
53
|
+
static VALUE CONNECT_TIMEOUT_SYMBOL;
|
|
54
|
+
static VALUE COOKIES_SYMBOL;
|
|
54
55
|
|
|
55
56
|
/* Method identifiers: */
|
|
56
57
|
static ID COMPARE_BY_IDENTITY_ID;
|
|
@@ -154,6 +155,7 @@ static void ov_http_client_free(void* vptr) {
|
|
|
154
155
|
/* Release the resources used by libcurl: */
|
|
155
156
|
if (ptr->handle != NULL) {
|
|
156
157
|
curl_multi_cleanup(ptr->handle);
|
|
158
|
+
curl_share_cleanup(ptr->share);
|
|
157
159
|
ptr->handle = NULL;
|
|
158
160
|
}
|
|
159
161
|
|
|
@@ -162,6 +164,7 @@ static void ov_http_client_free(void* vptr) {
|
|
|
162
164
|
ov_string_free(ptr->proxy_url);
|
|
163
165
|
ov_string_free(ptr->proxy_username);
|
|
164
166
|
ov_string_free(ptr->proxy_password);
|
|
167
|
+
ov_string_free(ptr->cookies);
|
|
165
168
|
|
|
166
169
|
/* Free this object: */
|
|
167
170
|
xfree(ptr);
|
|
@@ -186,6 +189,21 @@ static VALUE ov_http_client_alloc(VALUE klass) {
|
|
|
186
189
|
ov_http_client_object* ptr;
|
|
187
190
|
|
|
188
191
|
ptr = ALLOC(ov_http_client_object);
|
|
192
|
+
ptr->handle = NULL;
|
|
193
|
+
ptr->share = NULL;
|
|
194
|
+
ptr->log = Qnil;
|
|
195
|
+
ptr->pending = Qnil;
|
|
196
|
+
ptr->completed = Qnil;
|
|
197
|
+
ptr->compress = false;
|
|
198
|
+
ptr->debug = false;
|
|
199
|
+
ptr->insecure = false;
|
|
200
|
+
ptr->ca_file = NULL;
|
|
201
|
+
ptr->proxy_url = NULL;
|
|
202
|
+
ptr->proxy_username = NULL;
|
|
203
|
+
ptr->proxy_password = NULL;
|
|
204
|
+
ptr->timeout = 0;
|
|
205
|
+
ptr->connect_timeout = 0;
|
|
206
|
+
ptr->cookies = NULL;
|
|
189
207
|
return TypedData_Wrap_Struct(klass, &ov_http_client_type, ptr);
|
|
190
208
|
}
|
|
191
209
|
|
|
@@ -466,7 +484,13 @@ static VALUE ov_http_client_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
466
484
|
|
|
467
485
|
/* Get the value of the 'ca_file' parameter: */
|
|
468
486
|
opt = rb_hash_aref(opts, CA_FILE_SYMBOL);
|
|
469
|
-
|
|
487
|
+
if (NIL_P(opt)) {
|
|
488
|
+
ptr->ca_file = NULL;
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
Check_Type(opt, T_STRING);
|
|
492
|
+
ptr->ca_file = ov_string_dup(opt);
|
|
493
|
+
}
|
|
470
494
|
|
|
471
495
|
/* Get the value of the 'insecure' parameter: */
|
|
472
496
|
opt = rb_hash_aref(opts, INSECURE_SYMBOL);
|
|
@@ -490,17 +514,45 @@ static VALUE ov_http_client_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
490
514
|
ptr->timeout = NUM2INT(opt);
|
|
491
515
|
}
|
|
492
516
|
|
|
517
|
+
/* Get the value of the 'connect_timeout' parameter: */
|
|
518
|
+
opt = rb_hash_aref(opts, CONNECT_TIMEOUT_SYMBOL);
|
|
519
|
+
if (NIL_P(opt)) {
|
|
520
|
+
ptr->connect_timeout = 0;
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
Check_Type(opt, T_FIXNUM);
|
|
524
|
+
ptr->connect_timeout = NUM2INT(opt);
|
|
525
|
+
}
|
|
526
|
+
|
|
493
527
|
/* Get the value of the 'proxy_url' parameter: */
|
|
494
528
|
opt = rb_hash_aref(opts, PROXY_URL_SYMBOL);
|
|
495
|
-
|
|
529
|
+
if (NIL_P(opt)) {
|
|
530
|
+
ptr->proxy_url = NULL;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
Check_Type(opt, T_STRING);
|
|
534
|
+
ptr->proxy_url = ov_string_dup(opt);
|
|
535
|
+
}
|
|
496
536
|
|
|
497
537
|
/* Get the value of the 'proxy_username' parameter: */
|
|
498
538
|
opt = rb_hash_aref(opts, PROXY_USERNAME_SYMBOL);
|
|
499
|
-
|
|
539
|
+
if (NIL_P(opt)) {
|
|
540
|
+
ptr->proxy_username = NULL;
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
Check_Type(opt, T_STRING);
|
|
544
|
+
ptr->proxy_username = ov_string_dup(opt);
|
|
545
|
+
}
|
|
500
546
|
|
|
501
547
|
/* Get the value of the 'proxy_password' parameter: */
|
|
502
548
|
opt = rb_hash_aref(opts, PROXY_PASSWORD_SYMBOL);
|
|
503
|
-
|
|
549
|
+
if (NIL_P(opt)) {
|
|
550
|
+
ptr->proxy_password = NULL;
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
Check_Type(opt, T_STRING);
|
|
554
|
+
ptr->proxy_password = ov_string_dup(opt);
|
|
555
|
+
}
|
|
504
556
|
|
|
505
557
|
/* Get the value of the 'log' parameter: */
|
|
506
558
|
opt = rb_hash_aref(opts, LOG_SYMBOL);
|
|
@@ -526,6 +578,20 @@ static VALUE ov_http_client_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
526
578
|
connections = NUM2LONG(opt);
|
|
527
579
|
}
|
|
528
580
|
|
|
581
|
+
/* Get the value of the 'cookies' parameter. If it is a string it will be used as the path of the file where the
|
|
582
|
+
cookies will be stored. If it is any other thing it will be treated as a boolean flag indicating if cookies
|
|
583
|
+
should be enabled but not loaded/saved from/to any file. */
|
|
584
|
+
opt = rb_hash_aref(opts, COOKIES_SYMBOL);
|
|
585
|
+
if (TYPE(opt) == T_STRING) {
|
|
586
|
+
ptr->cookies = ov_string_dup(opt);
|
|
587
|
+
}
|
|
588
|
+
else if (RTEST(opt)) {
|
|
589
|
+
ptr->cookies = ov_string_dup(rb_str_new2(""));
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
ptr->cookies = NULL;
|
|
593
|
+
}
|
|
594
|
+
|
|
529
595
|
/* Create the hash that contains the transfers are pending an completed. Both use the identity of the request
|
|
530
596
|
as key. */
|
|
531
597
|
ptr->completed = rb_funcall(rb_hash_new(), COMPARE_BY_IDENTITY_ID, 0);
|
|
@@ -534,7 +600,16 @@ static VALUE ov_http_client_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
534
600
|
/* Create the libcurl multi handle: */
|
|
535
601
|
ptr->handle = curl_multi_init();
|
|
536
602
|
if (ptr->handle == NULL) {
|
|
537
|
-
rb_raise(ov_error_class, "Can't create libcurl object");
|
|
603
|
+
rb_raise(ov_error_class, "Can't create libcurl multi object");
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/* Create the libcurl share handle in order to share cookie data: */
|
|
607
|
+
ptr->share = curl_share_init();
|
|
608
|
+
if (ptr->share == NULL) {
|
|
609
|
+
rb_raise(ov_error_class, "Can't create libcurl share object");
|
|
610
|
+
}
|
|
611
|
+
if (ptr->cookies != NULL) {
|
|
612
|
+
curl_share_setopt(ptr->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
|
538
613
|
}
|
|
539
614
|
|
|
540
615
|
/* Enable pipelining: */
|
|
@@ -722,6 +797,14 @@ static void ov_http_client_prepare_handle(ov_http_client_object* client_ptr, ov_
|
|
|
722
797
|
VALUE header;
|
|
723
798
|
VALUE url;
|
|
724
799
|
int timeout;
|
|
800
|
+
int connect_timeout;
|
|
801
|
+
|
|
802
|
+
/* Configure sharing of cookies with other handlers created by the client: */
|
|
803
|
+
curl_easy_setopt(handle, CURLOPT_SHARE, client_ptr->share);
|
|
804
|
+
if (client_ptr->cookies != NULL && strlen(client_ptr->cookies) > 0) {
|
|
805
|
+
curl_easy_setopt(handle, CURLOPT_COOKIEFILE, client_ptr->cookies);
|
|
806
|
+
curl_easy_setopt(handle, CURLOPT_COOKIEJAR, client_ptr->cookies);
|
|
807
|
+
}
|
|
725
808
|
|
|
726
809
|
/* Configure TLS parameters: */
|
|
727
810
|
if (client_ptr->insecure) {
|
|
@@ -732,13 +815,20 @@ static void ov_http_client_prepare_handle(ov_http_client_object* client_ptr, ov_
|
|
|
732
815
|
curl_easy_setopt(handle, CURLOPT_CAINFO, client_ptr->ca_file);
|
|
733
816
|
}
|
|
734
817
|
|
|
735
|
-
/* Configure the timeout: */
|
|
818
|
+
/* Configure the total timeout: */
|
|
736
819
|
timeout = client_ptr->timeout;
|
|
737
820
|
if (!NIL_P(request_ptr->timeout)) {
|
|
738
821
|
timeout = NUM2INT(request_ptr->timeout);
|
|
739
822
|
}
|
|
740
823
|
curl_easy_setopt(handle, CURLOPT_TIMEOUT, timeout);
|
|
741
824
|
|
|
825
|
+
/* Configure the connect timeout: */
|
|
826
|
+
connect_timeout = client_ptr->connect_timeout;
|
|
827
|
+
if (!NIL_P(request_ptr->connect_timeout)) {
|
|
828
|
+
connect_timeout = NUM2INT(request_ptr->connect_timeout);
|
|
829
|
+
}
|
|
830
|
+
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, connect_timeout);
|
|
831
|
+
|
|
742
832
|
/* Configure compression of responses (setting the value to zero length string means accepting all the
|
|
743
833
|
compression types that libcurl supports): */
|
|
744
834
|
if (client_ptr->compress) {
|
|
@@ -941,19 +1031,20 @@ void ov_http_client_define(void) {
|
|
|
941
1031
|
rb_define_method(ov_http_client_class, "wait", ov_http_client_wait, 1);
|
|
942
1032
|
|
|
943
1033
|
/* Define the symbols: */
|
|
944
|
-
CA_FILE_SYMBOL
|
|
945
|
-
COMPRESS_SYMBOL
|
|
946
|
-
CONNECTIONS_SYMBOL
|
|
947
|
-
DEBUG_SYMBOL
|
|
948
|
-
INSECURE_SYMBOL
|
|
949
|
-
LOG_SYMBOL
|
|
950
|
-
PASSWORD_SYMBOL
|
|
951
|
-
PIPELINE_SYMBOL
|
|
952
|
-
PROXY_PASSWORD_SYMBOL
|
|
953
|
-
PROXY_URL_SYMBOL
|
|
954
|
-
PROXY_USERNAME_SYMBOL
|
|
955
|
-
TIMEOUT_SYMBOL
|
|
956
|
-
|
|
1034
|
+
CA_FILE_SYMBOL = ID2SYM(rb_intern("ca_file"));
|
|
1035
|
+
COMPRESS_SYMBOL = ID2SYM(rb_intern("compress"));
|
|
1036
|
+
CONNECTIONS_SYMBOL = ID2SYM(rb_intern("connections"));
|
|
1037
|
+
DEBUG_SYMBOL = ID2SYM(rb_intern("debug"));
|
|
1038
|
+
INSECURE_SYMBOL = ID2SYM(rb_intern("insecure"));
|
|
1039
|
+
LOG_SYMBOL = ID2SYM(rb_intern("log"));
|
|
1040
|
+
PASSWORD_SYMBOL = ID2SYM(rb_intern("password"));
|
|
1041
|
+
PIPELINE_SYMBOL = ID2SYM(rb_intern("pipeline"));
|
|
1042
|
+
PROXY_PASSWORD_SYMBOL = ID2SYM(rb_intern("proxy_password"));
|
|
1043
|
+
PROXY_URL_SYMBOL = ID2SYM(rb_intern("proxy_url"));
|
|
1044
|
+
PROXY_USERNAME_SYMBOL = ID2SYM(rb_intern("proxy_username"));
|
|
1045
|
+
TIMEOUT_SYMBOL = ID2SYM(rb_intern("timeout"));
|
|
1046
|
+
CONNECT_TIMEOUT_SYMBOL = ID2SYM(rb_intern("connect_timeout"));
|
|
1047
|
+
COOKIES_SYMBOL = ID2SYM(rb_intern("cookies"));
|
|
957
1048
|
|
|
958
1049
|
/* Define the method identifiers: */
|
|
959
1050
|
COMPARE_BY_IDENTITY_ID = rb_intern("compare_by_identity");
|
|
@@ -28,9 +28,12 @@ extern VALUE ov_http_client_class;
|
|
|
28
28
|
|
|
29
29
|
/* Content: */
|
|
30
30
|
typedef struct {
|
|
31
|
-
/* The libcurl multi handle: */
|
|
31
|
+
/* The libcurl multi handle, used to implement multiple simultaneous requests: */
|
|
32
32
|
CURLM* handle;
|
|
33
33
|
|
|
34
|
+
/* The libcurl share handle, used to share cookie data between multiple requests: */
|
|
35
|
+
CURLSH* share;
|
|
36
|
+
|
|
34
37
|
/* The logger: */
|
|
35
38
|
VALUE log;
|
|
36
39
|
|
|
@@ -51,6 +54,8 @@ typedef struct {
|
|
|
51
54
|
char* proxy_username;
|
|
52
55
|
char* proxy_password;
|
|
53
56
|
int timeout;
|
|
57
|
+
int connect_timeout;
|
|
58
|
+
char* cookies;
|
|
54
59
|
} ov_http_client_object;
|
|
55
60
|
|
|
56
61
|
/* Macro to get the pointer: */
|
|
@@ -40,6 +40,7 @@ static VALUE TOKEN_SYMBOL;
|
|
|
40
40
|
static VALUE KERBEROS_SYMBOL;
|
|
41
41
|
static VALUE BODY_SYMBOL;
|
|
42
42
|
static VALUE TIMEOUT_SYMBOL;
|
|
43
|
+
static VALUE CONNECT_TIMEOUT_SYMBOL;
|
|
43
44
|
|
|
44
45
|
static void ov_http_request_mark(void* vptr) {
|
|
45
46
|
ov_http_request_object* ptr;
|
|
@@ -55,6 +56,7 @@ static void ov_http_request_mark(void* vptr) {
|
|
|
55
56
|
rb_gc_mark(ptr->kerberos);
|
|
56
57
|
rb_gc_mark(ptr->body);
|
|
57
58
|
rb_gc_mark(ptr->timeout);
|
|
59
|
+
rb_gc_mark(ptr->connect_timeout);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
static void ov_http_request_free(void* vptr) {
|
|
@@ -83,16 +85,17 @@ static VALUE ov_http_request_alloc(VALUE klass) {
|
|
|
83
85
|
ov_http_request_object* ptr;
|
|
84
86
|
|
|
85
87
|
ptr = ALLOC(ov_http_request_object);
|
|
86
|
-
ptr->method
|
|
87
|
-
ptr->url
|
|
88
|
-
ptr->query
|
|
89
|
-
ptr->headers
|
|
90
|
-
ptr->username
|
|
91
|
-
ptr->password
|
|
92
|
-
ptr->token
|
|
93
|
-
ptr->kerberos
|
|
94
|
-
ptr->body
|
|
95
|
-
ptr->timeout
|
|
88
|
+
ptr->method = Qnil;
|
|
89
|
+
ptr->url = Qnil;
|
|
90
|
+
ptr->query = Qnil;
|
|
91
|
+
ptr->headers = Qnil;
|
|
92
|
+
ptr->username = Qnil;
|
|
93
|
+
ptr->password = Qnil;
|
|
94
|
+
ptr->token = Qnil;
|
|
95
|
+
ptr->kerberos = Qnil;
|
|
96
|
+
ptr->body = Qnil;
|
|
97
|
+
ptr->timeout = Qnil;
|
|
98
|
+
ptr->connect_timeout = Qnil;
|
|
96
99
|
return TypedData_Wrap_Struct(klass, &ov_http_request_type, ptr);
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -279,6 +282,24 @@ static VALUE ov_http_request_set_timeout(VALUE self, VALUE value) {
|
|
|
279
282
|
return Qnil;
|
|
280
283
|
}
|
|
281
284
|
|
|
285
|
+
static VALUE ov_http_request_get_connect_timeout(VALUE self) {
|
|
286
|
+
ov_http_request_object* ptr;
|
|
287
|
+
|
|
288
|
+
ov_http_request_ptr(self, ptr);
|
|
289
|
+
return ptr->connect_timeout;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
static VALUE ov_http_request_set_connect_timeout(VALUE self, VALUE value) {
|
|
293
|
+
ov_http_request_object* ptr;
|
|
294
|
+
|
|
295
|
+
ov_http_request_ptr(self, ptr);
|
|
296
|
+
if (!NIL_P(value)) {
|
|
297
|
+
Check_Type(value, T_FIXNUM);
|
|
298
|
+
}
|
|
299
|
+
ptr->connect_timeout = value;
|
|
300
|
+
return Qnil;
|
|
301
|
+
}
|
|
302
|
+
|
|
282
303
|
static VALUE ov_http_request_initialize(int argc, VALUE* argv, VALUE self) {
|
|
283
304
|
VALUE opts;
|
|
284
305
|
|
|
@@ -304,6 +325,7 @@ static VALUE ov_http_request_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
304
325
|
ov_http_request_set_token(self, rb_hash_aref(opts, TOKEN_SYMBOL));
|
|
305
326
|
ov_http_request_set_body(self, rb_hash_aref(opts, BODY_SYMBOL));
|
|
306
327
|
ov_http_request_set_timeout(self, rb_hash_aref(opts, TIMEOUT_SYMBOL));
|
|
328
|
+
ov_http_request_set_connect_timeout(self, rb_hash_aref(opts, CONNECT_TIMEOUT_SYMBOL));
|
|
307
329
|
|
|
308
330
|
return self;
|
|
309
331
|
}
|
|
@@ -317,38 +339,41 @@ void ov_http_request_define(void) {
|
|
|
317
339
|
rb_define_method(ov_http_request_class, "initialize", ov_http_request_initialize, -1);
|
|
318
340
|
|
|
319
341
|
/* Define the methods: */
|
|
320
|
-
rb_define_method(ov_http_request_class, "method",
|
|
321
|
-
rb_define_method(ov_http_request_class, "method=",
|
|
322
|
-
rb_define_method(ov_http_request_class, "url",
|
|
323
|
-
rb_define_method(ov_http_request_class, "url=",
|
|
324
|
-
rb_define_method(ov_http_request_class, "query",
|
|
325
|
-
rb_define_method(ov_http_request_class, "query=",
|
|
326
|
-
rb_define_method(ov_http_request_class, "headers",
|
|
327
|
-
rb_define_method(ov_http_request_class, "headers=",
|
|
328
|
-
rb_define_method(ov_http_request_class, "username",
|
|
329
|
-
rb_define_method(ov_http_request_class, "username=",
|
|
330
|
-
rb_define_method(ov_http_request_class, "password",
|
|
331
|
-
rb_define_method(ov_http_request_class, "password=",
|
|
332
|
-
rb_define_method(ov_http_request_class, "token",
|
|
333
|
-
rb_define_method(ov_http_request_class, "token=",
|
|
334
|
-
rb_define_method(ov_http_request_class, "kerberos",
|
|
335
|
-
rb_define_method(ov_http_request_class, "kerberos=",
|
|
336
|
-
rb_define_method(ov_http_request_class, "body",
|
|
337
|
-
rb_define_method(ov_http_request_class, "body=",
|
|
338
|
-
rb_define_method(ov_http_request_class, "timeout",
|
|
339
|
-
rb_define_method(ov_http_request_class, "timeout=",
|
|
342
|
+
rb_define_method(ov_http_request_class, "method", ov_http_request_get_method, 0);
|
|
343
|
+
rb_define_method(ov_http_request_class, "method=", ov_http_request_set_method, 1);
|
|
344
|
+
rb_define_method(ov_http_request_class, "url", ov_http_request_get_url, 0);
|
|
345
|
+
rb_define_method(ov_http_request_class, "url=", ov_http_request_set_url, 1);
|
|
346
|
+
rb_define_method(ov_http_request_class, "query", ov_http_request_get_query, 0);
|
|
347
|
+
rb_define_method(ov_http_request_class, "query=", ov_http_request_set_query, 1);
|
|
348
|
+
rb_define_method(ov_http_request_class, "headers", ov_http_request_get_headers, 0);
|
|
349
|
+
rb_define_method(ov_http_request_class, "headers=", ov_http_request_set_headers, 1);
|
|
350
|
+
rb_define_method(ov_http_request_class, "username", ov_http_request_get_username, 0);
|
|
351
|
+
rb_define_method(ov_http_request_class, "username=", ov_http_request_set_username, 1);
|
|
352
|
+
rb_define_method(ov_http_request_class, "password", ov_http_request_get_password, 0);
|
|
353
|
+
rb_define_method(ov_http_request_class, "password=", ov_http_request_set_password, 1);
|
|
354
|
+
rb_define_method(ov_http_request_class, "token", ov_http_request_get_token, 0);
|
|
355
|
+
rb_define_method(ov_http_request_class, "token=", ov_http_request_set_token, 1);
|
|
356
|
+
rb_define_method(ov_http_request_class, "kerberos", ov_http_request_get_kerberos, 0);
|
|
357
|
+
rb_define_method(ov_http_request_class, "kerberos=", ov_http_request_set_kerberos, 1);
|
|
358
|
+
rb_define_method(ov_http_request_class, "body", ov_http_request_get_body, 0);
|
|
359
|
+
rb_define_method(ov_http_request_class, "body=", ov_http_request_set_body, 1);
|
|
360
|
+
rb_define_method(ov_http_request_class, "timeout", ov_http_request_get_timeout, 0);
|
|
361
|
+
rb_define_method(ov_http_request_class, "timeout=", ov_http_request_set_timeout, 1);
|
|
362
|
+
rb_define_method(ov_http_request_class, "connect_timeout", ov_http_request_get_connect_timeout, 0);
|
|
363
|
+
rb_define_method(ov_http_request_class, "connect_timeout=", ov_http_request_set_connect_timeout, 1);
|
|
340
364
|
|
|
341
365
|
/* Define the symbols for the attributes: */
|
|
342
|
-
URL_SYMBOL
|
|
343
|
-
METHOD_SYMBOL
|
|
344
|
-
QUERY_SYMBOL
|
|
345
|
-
HEADERS_SYMBOL
|
|
346
|
-
USERNAME_SYMBOL
|
|
347
|
-
PASSWORD_SYMBOL
|
|
348
|
-
TOKEN_SYMBOL
|
|
349
|
-
KERBEROS_SYMBOL
|
|
350
|
-
BODY_SYMBOL
|
|
351
|
-
TIMEOUT_SYMBOL
|
|
366
|
+
URL_SYMBOL = ID2SYM(rb_intern("url"));
|
|
367
|
+
METHOD_SYMBOL = ID2SYM(rb_intern("method"));
|
|
368
|
+
QUERY_SYMBOL = ID2SYM(rb_intern("query"));
|
|
369
|
+
HEADERS_SYMBOL = ID2SYM(rb_intern("headers"));
|
|
370
|
+
USERNAME_SYMBOL = ID2SYM(rb_intern("username"));
|
|
371
|
+
PASSWORD_SYMBOL = ID2SYM(rb_intern("password"));
|
|
372
|
+
TOKEN_SYMBOL = ID2SYM(rb_intern("token"));
|
|
373
|
+
KERBEROS_SYMBOL = ID2SYM(rb_intern("kerberos"));
|
|
374
|
+
BODY_SYMBOL = ID2SYM(rb_intern("body"));
|
|
375
|
+
TIMEOUT_SYMBOL = ID2SYM(rb_intern("timeout"));
|
|
376
|
+
CONNECT_TIMEOUT_SYMBOL = ID2SYM(rb_intern("connect_timeout"));
|
|
352
377
|
|
|
353
378
|
/* Define the symbols for the HTTP methods: */
|
|
354
379
|
GET_SYMBOL = ID2SYM(rb_intern("GET"));
|
|
@@ -31,16 +31,17 @@ extern VALUE DELETE_SYMBOL;
|
|
|
31
31
|
|
|
32
32
|
/* Content: */
|
|
33
33
|
typedef struct {
|
|
34
|
-
VALUE method;
|
|
35
|
-
VALUE url;
|
|
36
|
-
VALUE query;
|
|
37
|
-
VALUE headers;
|
|
38
|
-
VALUE username;
|
|
39
|
-
VALUE password;
|
|
40
|
-
VALUE token;
|
|
41
|
-
VALUE kerberos;
|
|
42
|
-
VALUE body;
|
|
43
|
-
VALUE timeout;
|
|
34
|
+
VALUE method; /* Symbol */
|
|
35
|
+
VALUE url; /* String */
|
|
36
|
+
VALUE query; /* Hash<String, String> */
|
|
37
|
+
VALUE headers; /* Hash<String, String> */
|
|
38
|
+
VALUE username; /* String */
|
|
39
|
+
VALUE password; /* String */
|
|
40
|
+
VALUE token; /* String */
|
|
41
|
+
VALUE kerberos; /* Boolean */
|
|
42
|
+
VALUE body; /* String */
|
|
43
|
+
VALUE timeout; /* Integer */
|
|
44
|
+
VALUE connect_timeout; /* Integer */
|
|
44
45
|
} ov_http_request_object;
|
|
45
46
|
|
|
46
47
|
/* Macro to get the pointer: */
|
data/lib/ovirtsdk4/connection.rb
CHANGED
|
@@ -75,8 +75,11 @@ module OvirtSDK4
|
|
|
75
75
|
# instead of user name and password to obtain the OAuth token.
|
|
76
76
|
#
|
|
77
77
|
# @option opts [Integer] :timeout (0) The maximun total time to wait for the response, in seconds. A value of zero
|
|
78
|
-
# (the default) means wait for ever. If the timeout expires before the response is received
|
|
79
|
-
# raised.
|
|
78
|
+
# (the default) means wait for ever. If the timeout expires before the response is received a `TimeoutError`
|
|
79
|
+
# exception will be raised.
|
|
80
|
+
#
|
|
81
|
+
# @option opts [Integer] :connect_timeout (300) The maximun time to wait for connection establishment, in seconds.
|
|
82
|
+
# If the timeout expires before the connection is established a `TimeoutError` exception will be raised.
|
|
80
83
|
#
|
|
81
84
|
# @option opts [Boolean] :compress (true) A boolean flag indicating if the SDK should ask the server to send
|
|
82
85
|
# compressed responses. Note that this is a hint for the server, and that it may return uncompressed data even
|
|
@@ -117,6 +120,7 @@ module OvirtSDK4
|
|
|
117
120
|
@log = opts[:log]
|
|
118
121
|
@kerberos = opts[:kerberos] || false
|
|
119
122
|
@timeout = opts[:timeout] || 0
|
|
123
|
+
@connect_timeout = opts[:connect_timeout] || 0
|
|
120
124
|
@compress = opts[:compress] || true
|
|
121
125
|
@proxy_url = opts[:proxy_url]
|
|
122
126
|
@proxy_username = opts[:proxy_username]
|
|
@@ -156,6 +160,7 @@ module OvirtSDK4
|
|
|
156
160
|
debug: @debug,
|
|
157
161
|
log: @log,
|
|
158
162
|
timeout: @timeout,
|
|
163
|
+
connect_timeout: @connect_timeout,
|
|
159
164
|
compress: @compress,
|
|
160
165
|
proxy_url: @proxy_url,
|
|
161
166
|
proxy_username: @proxy_username,
|
data/lib/ovirtsdk4/services.rb
CHANGED
|
@@ -1103,8 +1103,13 @@ module OvirtSDK4
|
|
|
1103
1103
|
# ----
|
|
1104
1104
|
# <affinity_group>
|
|
1105
1105
|
# <name>AF_GROUP_001</name>
|
|
1106
|
-
# <
|
|
1107
|
-
#
|
|
1106
|
+
# <hosts_rule>
|
|
1107
|
+
# <enforcing>true</enforcing>
|
|
1108
|
+
# <positive>true</positive>
|
|
1109
|
+
# </hosts_rule>
|
|
1110
|
+
# <vms_rule>
|
|
1111
|
+
# <enabled>false</enabled>
|
|
1112
|
+
# </vms_rule>
|
|
1108
1113
|
# </affinity_group>
|
|
1109
1114
|
# ----
|
|
1110
1115
|
#
|
|
@@ -11582,7 +11587,7 @@ module OvirtSDK4
|
|
|
11582
11587
|
# Retrieves the list of image transfers that are currently
|
|
11583
11588
|
# being performed.
|
|
11584
11589
|
#
|
|
11585
|
-
# The order of the returned list of image transfers
|
|
11590
|
+
# The order of the returned list of image transfers is not guaranteed.
|
|
11586
11591
|
#
|
|
11587
11592
|
# @param opts [Hash] Additional options.
|
|
11588
11593
|
#
|
|
@@ -17764,7 +17769,40 @@ module OvirtSDK4
|
|
|
17764
17769
|
private_constant :ADD
|
|
17765
17770
|
|
|
17766
17771
|
#
|
|
17767
|
-
# Adds a
|
|
17772
|
+
# Adds a storage limit to a specified quota.
|
|
17773
|
+
#
|
|
17774
|
+
# To create a 100GiB storage limit for all storage domains in a data center, send a request like this:
|
|
17775
|
+
#
|
|
17776
|
+
# [source]
|
|
17777
|
+
# ----
|
|
17778
|
+
# POST /ovirt-engine/api/datacenters/123/quotas/456/quotastoragelimits
|
|
17779
|
+
# ----
|
|
17780
|
+
#
|
|
17781
|
+
# With a request body like this:
|
|
17782
|
+
#
|
|
17783
|
+
# [source,xml]
|
|
17784
|
+
# ----
|
|
17785
|
+
# <quota_storage_limit>
|
|
17786
|
+
# <limit>100</limit>
|
|
17787
|
+
# </quota_storage_limit>
|
|
17788
|
+
# ----
|
|
17789
|
+
#
|
|
17790
|
+
# To create a 50GiB storage limit for a storage domain with the ID `000`, send a request like this:
|
|
17791
|
+
#
|
|
17792
|
+
# [source]
|
|
17793
|
+
# ----
|
|
17794
|
+
# POST /ovirt-engine/api/datacenters/123/quotas/456/quotastoragelimits
|
|
17795
|
+
# ----
|
|
17796
|
+
#
|
|
17797
|
+
# With a request body like this:
|
|
17798
|
+
#
|
|
17799
|
+
# [source,xml]
|
|
17800
|
+
# ----
|
|
17801
|
+
# <quota_storage_limit>
|
|
17802
|
+
# <limit>50</limit>
|
|
17803
|
+
# <storage_domain id="000"/>
|
|
17804
|
+
# </quota_storage_limit>
|
|
17805
|
+
# ----
|
|
17768
17806
|
#
|
|
17769
17807
|
# @param limit [QuotaStorageLimit] The `limit` to add.
|
|
17770
17808
|
#
|
|
@@ -17794,11 +17832,11 @@ module OvirtSDK4
|
|
|
17794
17832
|
#
|
|
17795
17833
|
# Returns the list of storage limits configured for the quota.
|
|
17796
17834
|
#
|
|
17797
|
-
# The order of the returned list of storage limits
|
|
17835
|
+
# The order of the returned list of storage limits is not guaranteed.
|
|
17798
17836
|
#
|
|
17799
17837
|
# @param opts [Hash] Additional options.
|
|
17800
17838
|
#
|
|
17801
|
-
# @option opts [Integer] :max Sets the maximum number of limits to return. If not specified all the limits are returned.
|
|
17839
|
+
# @option opts [Integer] :max Sets the maximum number of limits to return. If not specified, all the limits are returned.
|
|
17802
17840
|
#
|
|
17803
17841
|
# @option opts [Hash] :headers ({}) Additional HTTP headers.
|
|
17804
17842
|
#
|
|
@@ -20212,7 +20250,9 @@ module OvirtSDK4
|
|
|
20212
20250
|
end
|
|
20213
20251
|
|
|
20214
20252
|
#
|
|
20215
|
-
#
|
|
20253
|
+
# Used for querying if the storage domain is already attached to a data center using
|
|
20254
|
+
# the is_attached boolean field, which is part of the storage server. IMPORTANT:
|
|
20255
|
+
# Executing this API will cause the host to disconnect from the storage domain.
|
|
20216
20256
|
#
|
|
20217
20257
|
# @param opts [Hash] Additional options.
|
|
20218
20258
|
#
|
|
@@ -20265,7 +20305,7 @@ module OvirtSDK4
|
|
|
20265
20305
|
#
|
|
20266
20306
|
# @param opts [Hash] Additional options.
|
|
20267
20307
|
#
|
|
20268
|
-
# @option opts [Array<LogicalUnit>] :logical_units The logical units that
|
|
20308
|
+
# @option opts [Array<LogicalUnit>] :logical_units The logical units that need to be reduced from the storage domain.
|
|
20269
20309
|
#
|
|
20270
20310
|
# @option opts [Hash] :headers ({}) Additional HTTP headers.
|
|
20271
20311
|
#
|
|
@@ -20286,7 +20326,7 @@ module OvirtSDK4
|
|
|
20286
20326
|
# After increasing the size of the underlying LUN on the storage server,
|
|
20287
20327
|
# the user can refresh the LUN size.
|
|
20288
20328
|
# This action forces a rescan of the provided LUNs and
|
|
20289
|
-
# updates the database with the new size if required.
|
|
20329
|
+
# updates the database with the new size, if required.
|
|
20290
20330
|
#
|
|
20291
20331
|
# For example, in order to refresh the size of two LUNs send a request like this:
|
|
20292
20332
|
#
|
|
@@ -20339,20 +20379,20 @@ module OvirtSDK4
|
|
|
20339
20379
|
# Removes the storage domain.
|
|
20340
20380
|
#
|
|
20341
20381
|
# Without any special parameters, the storage domain is detached from the system and removed from the database. The
|
|
20342
|
-
# storage domain can then be imported to the same or different setup, with all the data on it. If the storage
|
|
20343
|
-
# accessible the operation will fail.
|
|
20382
|
+
# storage domain can then be imported to the same or to a different setup, with all the data on it. If the storage is
|
|
20383
|
+
# not accessible the operation will fail.
|
|
20344
20384
|
#
|
|
20345
|
-
# If the `destroy` parameter is `true` then the operation will always succeed, even if the storage
|
|
20385
|
+
# If the `destroy` parameter is `true` then the operation will always succeed, even if the storage is not
|
|
20346
20386
|
# accessible, the failure is just ignored and the storage domain is removed from the database anyway.
|
|
20347
20387
|
#
|
|
20348
20388
|
# If the `format` parameter is `true` then the actual storage is formatted, and the metadata is removed from the
|
|
20349
|
-
# LUN or directory, so it can no longer be imported to the same or a different setup.
|
|
20389
|
+
# LUN or directory, so it can no longer be imported to the same or to a different setup.
|
|
20350
20390
|
#
|
|
20351
20391
|
# @param opts [Hash] Additional options.
|
|
20352
20392
|
#
|
|
20353
20393
|
# @option opts [Boolean] :async Indicates if the remove should be performed asynchronously.
|
|
20354
20394
|
# @option opts [Boolean] :destroy Indicates if the operation should succeed, and the storage domain removed from the database, even if the
|
|
20355
|
-
# storage
|
|
20395
|
+
# storage is not accessible.
|
|
20356
20396
|
#
|
|
20357
20397
|
# [source]
|
|
20358
20398
|
# ----
|
|
@@ -20360,6 +20400,7 @@ module OvirtSDK4
|
|
|
20360
20400
|
# ----
|
|
20361
20401
|
#
|
|
20362
20402
|
# This parameter is optional, and the default value is `false`.
|
|
20403
|
+
# When the value of `destroy` is `true` the `host` parameter will be ignored.
|
|
20363
20404
|
# @option opts [Boolean] :format Indicates if the actual storage should be formatted, removing all the metadata from the underlying LUN or
|
|
20364
20405
|
# directory:
|
|
20365
20406
|
#
|
|
@@ -20369,10 +20410,13 @@ module OvirtSDK4
|
|
|
20369
20410
|
# ----
|
|
20370
20411
|
#
|
|
20371
20412
|
# This parameter is optional, and the default value is `false`.
|
|
20372
|
-
# @option opts [String] :host Indicates
|
|
20413
|
+
# @option opts [String] :host Indicates which host should be used to remove the storage domain.
|
|
20373
20414
|
#
|
|
20374
|
-
# This parameter is mandatory,
|
|
20375
|
-
#
|
|
20415
|
+
# This parameter is mandatory, except if the `destroy` parameter is included and its value is `true`, in that
|
|
20416
|
+
# case the `host` parameter will be ignored.
|
|
20417
|
+
#
|
|
20418
|
+
# The value should contain the name or the identifier of the host. For example, to use the host named `myhost`
|
|
20419
|
+
# to remove the storage domain with identifier `123` send a request like this:
|
|
20376
20420
|
#
|
|
20377
20421
|
# [source]
|
|
20378
20422
|
# ----
|
|
@@ -20400,9 +20444,9 @@ module OvirtSDK4
|
|
|
20400
20444
|
#
|
|
20401
20445
|
# Updates a storage domain.
|
|
20402
20446
|
#
|
|
20403
|
-
# Not all of the <<types/storage_domain,StorageDomain>>'s attributes are updatable
|
|
20447
|
+
# Not all of the <<types/storage_domain,StorageDomain>>'s attributes are updatable after creation. Those that can be
|
|
20404
20448
|
# updated are: `name`, `description`, `comment`, `warning_low_space_indicator`, `critical_space_action_blocker` and
|
|
20405
|
-
# `wipe_after_delete
|
|
20449
|
+
# `wipe_after_delete.` (Note that changing the `wipe_after_delete` attribute will not change the wipe after delete
|
|
20406
20450
|
# property of disks that already exist).
|
|
20407
20451
|
#
|
|
20408
20452
|
# To update the `name` and `wipe_after_delete` attributes of a storage domain with an identifier `123`, send a
|
|
@@ -20447,9 +20491,9 @@ module OvirtSDK4
|
|
|
20447
20491
|
# This operation forces the update of the `OVF_STORE`
|
|
20448
20492
|
# of this storage domain.
|
|
20449
20493
|
#
|
|
20450
|
-
# The `OVF_STORE` is a disk image that contains the
|
|
20494
|
+
# The `OVF_STORE` is a disk image that contains the metadata
|
|
20451
20495
|
# of virtual machines and disks that reside in the
|
|
20452
|
-
# storage domain. This
|
|
20496
|
+
# storage domain. This metadata is used in case the
|
|
20453
20497
|
# domain is imported or exported to or from a different
|
|
20454
20498
|
# data center or a different installation.
|
|
20455
20499
|
#
|
|
@@ -20497,7 +20541,7 @@ module OvirtSDK4
|
|
|
20497
20541
|
end
|
|
20498
20542
|
|
|
20499
20543
|
#
|
|
20500
|
-
#
|
|
20544
|
+
# Reference to the service that manages the disks available in the storage domain.
|
|
20501
20545
|
#
|
|
20502
20546
|
# @return [DisksService] A reference to `disks` service.
|
|
20503
20547
|
#
|
|
@@ -32551,6 +32595,10 @@ module OvirtSDK4
|
|
|
32551
32595
|
#
|
|
32552
32596
|
# @option opts [Boolean] :async Indicates if the upgrade should be performed asynchronously.
|
|
32553
32597
|
#
|
|
32598
|
+
# @option opts [String] :image The image parameter specifies path to image, which is used
|
|
32599
|
+
# for upgrade. This parameter is used only to upgrade Vintage
|
|
32600
|
+
# Node hosts and it's not relevant for other hosts types.
|
|
32601
|
+
#
|
|
32554
32602
|
# @option opts [Hash] :headers ({}) Additional HTTP headers.
|
|
32555
32603
|
#
|
|
32556
32604
|
# @option opts [Hash] :query ({}) Additional URL query parameters.
|
data/lib/ovirtsdk4/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ovirt-engine-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.1.
|
|
4
|
+
version: 4.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Hernandez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|