-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHost.gen.go
2494 lines (2167 loc) · 74.9 KB
/
Host.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w Host.gen.go
package go_xen_client
import (
"reflect"
"strconv"
"time"
"github.com/nilshell/xmlrpc"
)
//Host: A physical host
type Host struct {
Uuid string // Unique identifier/object reference
NameLabel string // a human-readable name
NameDescription string // a notes field containing human-readable description
MemoryOverhead int // Virtualization memory overhead (bytes).
AllowedOperations []HostAllowedOperations // list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client.
CurrentOperations map[string]HostAllowedOperations // links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
APIVersionMajor int // major version number
APIVersionMinor int // minor version number
APIVersionVendor string // identification of vendor
APIVersionVendorImplementation map[string]string // details of vendor implementation
Enabled bool // True if the host is currently enabled
SoftwareVersion map[string]string // version strings
OtherConfig map[string]string // additional configuration
Capabilities []string // Xen capabilities
CpuConfiguration map[string]string // The CPU configuration on this host. May contain keys such as "nr_nodes", "sockets_per_node", "cores_per_socket", or "threads_per_core"
SchedPolicy string // Scheduler policy currently in force on this host
SupportedBootloaders []string // a list of the bootloaders installed on the machine
ResidentVMs []string // list of VMs currently resident on host
Logging map[string]string // logging configuration
PIFs []string // physical network interfaces
SuspendImageSr string // The SR in which VDIs for suspend images are created
CrashDumpSr string // The SR in which VDIs for crash dumps are created
Crashdumps []string // Set of host crash dumps
Patches []string // Set of host patches
Updates []string // Set of updates
PBDs []string // physical blockdevices
HostCPUs []string // The physical CPUs on this host
CpuInfo map[string]string // Details about the physical CPUs on this host
Hostname string // The hostname of this host
Address string // The address by which this host can be contacted from any other host in the pool
Metrics string // metrics associated with this host
LicenseParams map[string]string // State of the current license
HaStatefiles []string // The set of statefiles accessible from this host
HaNetworkPeers []string // The set of hosts visible via the network from this host
Blobs map[string]string // Binary blobs associated with this host
Tags []string // user-specified tags for categorization purposes
ExternalAuthType string // type of external authentication service configured; empty if none configured.
ExternalAuthServiceName string // name of external authentication service configured; empty if none configured.
ExternalAuthConfiguration map[string]string // configuration specific to external authentication service
Edition string // Product edition
LicenseServer map[string]string // Contact information of the license server
BiosStrings map[string]string // BIOS strings
PowerOnMode string // The power on mode
PowerOnConfig map[string]string // The power on config
LocalCacheSr string // The SR that is used as a local cache
ChipsetInfo map[string]string // Information about chipset features
PCIs []string // List of PCI devices in the host
PGPUs []string // List of physical GPUs in the host
PUSBs []string // List of physical USBs in the host
SslLegacy bool // Allow SSLv3 protocol and ciphersuites as used by older server versions. This controls both incoming and outgoing connections. When this is set to a different value, the host immediately restarts its SSL/TLS listening service; typically this takes less than a second but existing connections to it will be broken. API login sessions will remain valid.
GuestVCPUsParams map[string]string // VCPUs params to apply to all resident guests
Display HostDisplay // indicates whether the host is configured to output its console to a physical display device
VirtualHardwarePlatformVersions []int // The set of versions of the virtual hardware platform that the host can offer to its guests
ControlDomain string // The control domain (domain 0)
UpdatesRequiringReboot []string // List of updates which require reboot
Features []string // List of features available on this host
IscsiIqn string // The initiator IQN for the host
Multipathing bool // Specifies whether multipathing is enabled
UefiCertificates string // The UEFI certificates allowing Secure Boot
}
func FromHostToXml(host *Host) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = host.Uuid
result["name_label"] = host.NameLabel
result["name_description"] = host.NameDescription
result["memory_overhead"] = strconv.Itoa(host.MemoryOverhead)
result["allowed_operations"] = host.AllowedOperations
current_operations := make(xmlrpc.Struct)
for key, value := range host.CurrentOperations {
current_operations[key] = value
}
result["current_operations"] = current_operations
result["API_version_major"] = strconv.Itoa(host.APIVersionMajor)
result["API_version_minor"] = strconv.Itoa(host.APIVersionMinor)
result["API_version_vendor"] = host.APIVersionVendor
API_version_vendor_implementation := make(xmlrpc.Struct)
for key, value := range host.APIVersionVendorImplementation {
API_version_vendor_implementation[key] = value
}
result["API_version_vendor_implementation"] = API_version_vendor_implementation
result["enabled"] = host.Enabled
software_version := make(xmlrpc.Struct)
for key, value := range host.SoftwareVersion {
software_version[key] = value
}
result["software_version"] = software_version
other_config := make(xmlrpc.Struct)
for key, value := range host.OtherConfig {
other_config[key] = value
}
result["other_config"] = other_config
result["capabilities"] = host.Capabilities
cpu_configuration := make(xmlrpc.Struct)
for key, value := range host.CpuConfiguration {
cpu_configuration[key] = value
}
result["cpu_configuration"] = cpu_configuration
result["sched_policy"] = host.SchedPolicy
result["supported_bootloaders"] = host.SupportedBootloaders
result["resident_VMs"] = host.ResidentVMs
logging := make(xmlrpc.Struct)
for key, value := range host.Logging {
logging[key] = value
}
result["logging"] = logging
result["PIFs"] = host.PIFs
result["suspend_image_sr"] = host.SuspendImageSr
result["crash_dump_sr"] = host.CrashDumpSr
result["crashdumps"] = host.Crashdumps
result["patches"] = host.Patches
result["updates"] = host.Updates
result["PBDs"] = host.PBDs
result["host_CPUs"] = host.HostCPUs
cpu_info := make(xmlrpc.Struct)
for key, value := range host.CpuInfo {
cpu_info[key] = value
}
result["cpu_info"] = cpu_info
result["hostname"] = host.Hostname
result["address"] = host.Address
result["metrics"] = host.Metrics
license_params := make(xmlrpc.Struct)
for key, value := range host.LicenseParams {
license_params[key] = value
}
result["license_params"] = license_params
result["ha_statefiles"] = host.HaStatefiles
result["ha_network_peers"] = host.HaNetworkPeers
blobs := make(xmlrpc.Struct)
for key, value := range host.Blobs {
blobs[key] = value
}
result["blobs"] = blobs
result["tags"] = host.Tags
result["external_auth_type"] = host.ExternalAuthType
result["external_auth_service_name"] = host.ExternalAuthServiceName
external_auth_configuration := make(xmlrpc.Struct)
for key, value := range host.ExternalAuthConfiguration {
external_auth_configuration[key] = value
}
result["external_auth_configuration"] = external_auth_configuration
result["edition"] = host.Edition
license_server := make(xmlrpc.Struct)
for key, value := range host.LicenseServer {
license_server[key] = value
}
result["license_server"] = license_server
bios_strings := make(xmlrpc.Struct)
for key, value := range host.BiosStrings {
bios_strings[key] = value
}
result["bios_strings"] = bios_strings
result["power_on_mode"] = host.PowerOnMode
power_on_config := make(xmlrpc.Struct)
for key, value := range host.PowerOnConfig {
power_on_config[key] = value
}
result["power_on_config"] = power_on_config
result["local_cache_sr"] = host.LocalCacheSr
chipset_info := make(xmlrpc.Struct)
for key, value := range host.ChipsetInfo {
chipset_info[key] = value
}
result["chipset_info"] = chipset_info
result["PCIs"] = host.PCIs
result["PGPUs"] = host.PGPUs
result["PUSBs"] = host.PUSBs
result["ssl_legacy"] = host.SslLegacy
guest_VCPUs_params := make(xmlrpc.Struct)
for key, value := range host.GuestVCPUsParams {
guest_VCPUs_params[key] = value
}
result["guest_VCPUs_params"] = guest_VCPUs_params
result["display"] = host.Display.String()
result["virtual_hardware_platform_versions"] = host.VirtualHardwarePlatformVersions
result["control_domain"] = host.ControlDomain
result["updates_requiring_reboot"] = host.UpdatesRequiringReboot
result["features"] = host.Features
result["iscsi_iqn"] = host.IscsiIqn
result["multipathing"] = host.Multipathing
result["uefi_certificates"] = host.UefiCertificates
return result
}
func ToHost(obj interface{}) (resultObj *Host) {
objValue := reflect.ValueOf(obj)
resultObj = &Host{}
for _, oKey := range objValue.MapKeys() {
keyName := oKey.String()
keyValue := objValue.MapIndex(oKey).Interface()
switch keyName {
case "uuid":
if v, ok := keyValue.(string); ok {
resultObj.Uuid = v
}
case "name_label":
if v, ok := keyValue.(string); ok {
resultObj.NameLabel = v
}
case "name_description":
if v, ok := keyValue.(string); ok {
resultObj.NameDescription = v
}
case "memory_overhead":
if v, ok := keyValue.(int); ok {
resultObj.MemoryOverhead = v
}
case "allowed_operations":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.AllowedOperations = make([]HostAllowedOperations, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(HostAllowedOperations); ok {
resultObj.AllowedOperations[i] = v
}
}
}
case "current_operations":
resultObj.CurrentOperations = map[string]HostAllowedOperations{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.CurrentOperations[mapKeyName] = ToHostAllowedOperations(v)
} else {
resultObj.CurrentOperations[mapKeyName] = 0
}
}
case "API_version_major":
if v, ok := keyValue.(int); ok {
resultObj.APIVersionMajor = v
}
case "API_version_minor":
if v, ok := keyValue.(int); ok {
resultObj.APIVersionMinor = v
}
case "API_version_vendor":
if v, ok := keyValue.(string); ok {
resultObj.APIVersionVendor = v
}
case "API_version_vendor_implementation":
resultObj.APIVersionVendorImplementation = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.APIVersionVendorImplementation[mapKeyName] = v
} else {
resultObj.APIVersionVendorImplementation[mapKeyName] = ""
}
}
case "enabled":
if v, ok := keyValue.(bool); ok {
resultObj.Enabled = v
}
case "software_version":
resultObj.SoftwareVersion = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.SoftwareVersion[mapKeyName] = v
} else {
resultObj.SoftwareVersion[mapKeyName] = ""
}
}
case "other_config":
resultObj.OtherConfig = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.OtherConfig[mapKeyName] = v
} else {
resultObj.OtherConfig[mapKeyName] = ""
}
}
case "capabilities":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Capabilities = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Capabilities[i] = v
}
}
}
case "cpu_configuration":
resultObj.CpuConfiguration = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.CpuConfiguration[mapKeyName] = v
} else {
resultObj.CpuConfiguration[mapKeyName] = ""
}
}
case "sched_policy":
if v, ok := keyValue.(string); ok {
resultObj.SchedPolicy = v
}
case "supported_bootloaders":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.SupportedBootloaders = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.SupportedBootloaders[i] = v
}
}
}
case "resident_VMs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.ResidentVMs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.ResidentVMs[i] = v
}
}
}
case "logging":
resultObj.Logging = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.Logging[mapKeyName] = v
} else {
resultObj.Logging[mapKeyName] = ""
}
}
case "PIFs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.PIFs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.PIFs[i] = v
}
}
}
case "suspend_image_sr":
if v, ok := keyValue.(string); ok {
resultObj.SuspendImageSr = v
}
case "crash_dump_sr":
if v, ok := keyValue.(string); ok {
resultObj.CrashDumpSr = v
}
case "crashdumps":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Crashdumps = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Crashdumps[i] = v
}
}
}
case "patches":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Patches = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Patches[i] = v
}
}
}
case "updates":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Updates = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Updates[i] = v
}
}
}
case "PBDs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.PBDs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.PBDs[i] = v
}
}
}
case "host_CPUs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.HostCPUs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.HostCPUs[i] = v
}
}
}
case "cpu_info":
resultObj.CpuInfo = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.CpuInfo[mapKeyName] = v
} else {
resultObj.CpuInfo[mapKeyName] = ""
}
}
case "hostname":
if v, ok := keyValue.(string); ok {
resultObj.Hostname = v
}
case "address":
if v, ok := keyValue.(string); ok {
resultObj.Address = v
}
case "metrics":
if v, ok := keyValue.(string); ok {
resultObj.Metrics = v
}
case "license_params":
resultObj.LicenseParams = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.LicenseParams[mapKeyName] = v
} else {
resultObj.LicenseParams[mapKeyName] = ""
}
}
case "ha_statefiles":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.HaStatefiles = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.HaStatefiles[i] = v
}
}
}
case "ha_network_peers":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.HaNetworkPeers = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.HaNetworkPeers[i] = v
}
}
}
case "blobs":
resultObj.Blobs = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.Blobs[mapKeyName] = v
} else {
resultObj.Blobs[mapKeyName] = ""
}
}
case "tags":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Tags = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Tags[i] = v
}
}
}
case "external_auth_type":
if v, ok := keyValue.(string); ok {
resultObj.ExternalAuthType = v
}
case "external_auth_service_name":
if v, ok := keyValue.(string); ok {
resultObj.ExternalAuthServiceName = v
}
case "external_auth_configuration":
resultObj.ExternalAuthConfiguration = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.ExternalAuthConfiguration[mapKeyName] = v
} else {
resultObj.ExternalAuthConfiguration[mapKeyName] = ""
}
}
case "edition":
if v, ok := keyValue.(string); ok {
resultObj.Edition = v
}
case "license_server":
resultObj.LicenseServer = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.LicenseServer[mapKeyName] = v
} else {
resultObj.LicenseServer[mapKeyName] = ""
}
}
case "bios_strings":
resultObj.BiosStrings = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.BiosStrings[mapKeyName] = v
} else {
resultObj.BiosStrings[mapKeyName] = ""
}
}
case "power_on_mode":
if v, ok := keyValue.(string); ok {
resultObj.PowerOnMode = v
}
case "power_on_config":
resultObj.PowerOnConfig = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.PowerOnConfig[mapKeyName] = v
} else {
resultObj.PowerOnConfig[mapKeyName] = ""
}
}
case "local_cache_sr":
if v, ok := keyValue.(string); ok {
resultObj.LocalCacheSr = v
}
case "chipset_info":
resultObj.ChipsetInfo = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.ChipsetInfo[mapKeyName] = v
} else {
resultObj.ChipsetInfo[mapKeyName] = ""
}
}
case "PCIs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.PCIs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.PCIs[i] = v
}
}
}
case "PGPUs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.PGPUs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.PGPUs[i] = v
}
}
}
case "PUSBs":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.PUSBs = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.PUSBs[i] = v
}
}
}
case "ssl_legacy":
if v, ok := keyValue.(bool); ok {
resultObj.SslLegacy = v
}
case "guest_VCPUs_params":
resultObj.GuestVCPUsParams = map[string]string{}
interimMap := reflect.ValueOf(keyValue).MapKeys()
for _, mapKey := range interimMap {
mapKeyName := mapKey.String()
mapKeyValue := reflect.ValueOf(keyValue).MapIndex(mapKey).Interface()
if v, ok := mapKeyValue.(string); ok {
resultObj.GuestVCPUsParams[mapKeyName] = v
} else {
resultObj.GuestVCPUsParams[mapKeyName] = ""
}
}
case "display":
if v, ok := keyValue.(HostDisplay); ok {
resultObj.Display = v
}
case "virtual_hardware_platform_versions":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.VirtualHardwarePlatformVersions = make([]int, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(int); ok {
resultObj.VirtualHardwarePlatformVersions[i] = v
}
}
}
case "control_domain":
if v, ok := keyValue.(string); ok {
resultObj.ControlDomain = v
}
case "updates_requiring_reboot":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.UpdatesRequiringReboot = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.UpdatesRequiringReboot[i] = v
}
}
}
case "features":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Features = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Features[i] = v
}
}
}
case "iscsi_iqn":
if v, ok := keyValue.(string); ok {
resultObj.IscsiIqn = v
}
case "multipathing":
if v, ok := keyValue.(bool); ok {
resultObj.Multipathing = v
}
case "uefi_certificates":
if v, ok := keyValue.(string); ok {
resultObj.UefiCertificates = v
}
}
}
return resultObj
}
/* GetAllRecords: Return a map of host references to host records for all hosts known to the system. */
func (client *XenClient) HostGetAllRecords() (result map[string]Host, err error) {
obj, err := client.APICall("host.get_all_records")
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]Host{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
mapObj := ToHost(obj.Interface())
result[key.String()] = *mapObj
}
return
}
/* GetAll: Return a list of all the hosts known to the system. */
func (client *XenClient) HostGetAll() (result []string, err error) {
obj, err := client.APICall("host.get_all")
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* SetUefiCertificates: Sets the UEFI certificates on a host */
func (client *XenClient) HostSetUefiCertificates(host string, value string) (err error) {
_, err = client.APICall("host.set_uefi_certificates", host, value)
if err != nil {
return
}
// no return result
return
}
/* SetMultipathing: Specifies whether multipathing is enabled */
func (client *XenClient) HostSetMultipathing(host string, value bool) (err error) {
_, err = client.APICall("host.set_multipathing", host, value)
if err != nil {
return
}
// no return result
return
}
/* SetIscsiIqn: Sets the initiator IQN for the host */
func (client *XenClient) HostSetIscsiIqn(host string, value string) (err error) {
_, err = client.APICall("host.set_iscsi_iqn", host, value)
if err != nil {
return
}
// no return result
return
}
/* SetSslLegacy: Enable/disable SSLv3 for interoperability with older server versions. When this is set to a different value, the host immediately restarts its SSL/TLS listening service; typically this takes less than a second but existing connections to it will be broken. API login sessions will remain valid. */
func (client *XenClient) HostSetSslLegacy(self string, value bool) (err error) {
_, err = client.APICall("host.set_ssl_legacy", self, value)
if err != nil {
return
}
// no return result
return
}
/* DisableDisplay: Disable console output to the physical display device next time this host boots */
func (client *XenClient) HostDisableDisplay(host string) (result HostDisplay, err error) {
obj, err := client.APICall("host.disable_display", host)
if err != nil {
return
}
result = ToHostDisplay(obj.(string))
return
}
/* EnableDisplay: Enable console output to the physical display device next time this host boots */
func (client *XenClient) HostEnableDisplay(host string) (result HostDisplay, err error) {
obj, err := client.APICall("host.enable_display", host)
if err != nil {
return
}
result = ToHostDisplay(obj.(string))
return
}
/* DeclareDead: Declare that a host is dead. This is a dangerous operation, and should only be called if the administrator is absolutely sure the host is definitely dead */
func (client *XenClient) HostDeclareDead(host string) (err error) {
_, err = client.APICall("host.declare_dead", host)
if err != nil {
return
}
// no return result
return
}
/* MigrateReceive: Prepare to receive a VM, returning a token which can be passed to VM.migrate. */
func (client *XenClient) HostMigrateReceive(host string, network string, options map[string]string) (result map[string]string, err error) {
obj, err := client.APICall("host.migrate_receive", host, network, options)
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]string{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
result[key.String()] = obj.String()
}
return
}
/* DisableLocalStorageCaching: Disable the use of a local SR for caching purposes */
func (client *XenClient) HostDisableLocalStorageCaching(host string) (err error) {
_, err = client.APICall("host.disable_local_storage_caching", host)
if err != nil {
return
}
// no return result
return
}
/* EnableLocalStorageCaching: Enable the use of a local SR for caching purposes */
func (client *XenClient) HostEnableLocalStorageCaching(host string, sr string) (err error) {
_, err = client.APICall("host.enable_local_storage_caching", host, sr)
if err != nil {
return
}
// no return result
return
}
/* ResetCpuFeatures: Remove the feature mask, such that after a reboot all features of the CPU are enabled. */
func (client *XenClient) HostResetCpuFeatures(host string) (err error) {
_, err = client.APICall("host.reset_cpu_features", host)
if err != nil {
return
}
// no return result
return
}
/* SetCpuFeatures: Set the CPU features to be used after a reboot, if the given features string is valid. */
func (client *XenClient) HostSetCpuFeatures(host string, features string) (err error) {
_, err = client.APICall("host.set_cpu_features", host, features)
if err != nil {
return
}
// no return result
return
}
/* SetPowerOnMode: Set the power-on-mode, host, user and password */
func (client *XenClient) HostSetPowerOnMode(self string, power_on_mode string, power_on_config map[string]string) (err error) {
_, err = client.APICall("host.set_power_on_mode", self, power_on_mode, power_on_config)
if err != nil {
return
}
// no return result
return
}
/* RefreshPackInfo: Refresh the list of installed Supplemental Packs. */
func (client *XenClient) HostRefreshPackInfo(host string) (err error) {
_, err = client.APICall("host.refresh_pack_info", host)
if err != nil {
return
}
// no return result
return
}
/* ApplyEdition: Change to another edition, or reactivate the current edition after a license has expired. This may be subject to the successful checkout of an appropriate license. */
func (client *XenClient) HostApplyEdition(host string, edition string, force bool) (err error) {
_, err = client.APICall("host.apply_edition", host, edition, force)
if err != nil {
return
}
// no return result
return
}
/* GetServerCertificate: Get the installed server public TLS certificate. */
func (client *XenClient) HostGetServerCertificate(host string) (result string, err error) {
obj, err := client.APICall("host.get_server_certificate", host)
if err != nil {
return
}
result = obj.(string)
return
}
/* RetrieveWlbEvacuateRecommendations: Retrieves recommended host migrations to perform when evacuating the host from the wlb server. If a VM cannot be migrated from the host the reason is listed instead of a recommendation. */
func (client *XenClient) HostRetrieveWlbEvacuateRecommendations(self string) (result map[string][]string, err error) {
obj, err := client.APICall("host.retrieve_wlb_evacuate_recommendations", self)
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string][]string{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
interimObj := obj.Interface().([]interface{})
interimResult := make([]string, len(interimObj))
for i, interimValue := range interimObj {
interimResult[i] = interimValue.(string)
}
result[key.String()] = interimResult
}
return
}
/* DisableExternalAuth: This call disables external authentication on the local host */
func (client *XenClient) HostDisableExternalAuth(host string, config map[string]string) (err error) {
_, err = client.APICall("host.disable_external_auth", host, config)
if err != nil {
return
}
// no return result
return
}
/* EnableExternalAuth: This call enables external authentication on a host */
func (client *XenClient) HostEnableExternalAuth(host string, config map[string]string, service_name string, auth_type string) (err error) {
_, err = client.APICall("host.enable_external_auth", host, config, service_name, auth_type)
if err != nil {
return
}
// no return result
return
}
/* GetServerLocaltime: This call queries the host's clock for the current time in the host's local timezone */
func (client *XenClient) HostGetServerLocaltime(host string) (result time.Time, err error) {
obj, err := client.APICall("host.get_server_localtime", host)
if err != nil {
return
}
result = obj.(time.Time)
return
}
/* GetServertime: This call queries the host's clock for the current time */
func (client *XenClient) HostGetServertime(host string) (result time.Time, err error) {