forked from terra-farm/go-xen-api-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vm_gen.go
4403 lines (4189 loc) · 159 KB
/
vm_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 file is generated. To change the content of this file, please do not
// apply the change to this file because it will get overwritten. Instead,
// change xenapi.go and execute 'go generate'.
//
package xenAPI
import (
"fmt"
"github.com/amfranz/go-xmlrpc-client"
"reflect"
"strconv"
"time"
)
var _ = fmt.Errorf
var _ = xmlrpc.NewClient
var _ = reflect.TypeOf
var _ = strconv.Atoi
var _ = time.UTC
type VMPowerState string
const (
// VM is offline and not using any resources
VMPowerStateHalted VMPowerState = "Halted"
// All resources have been allocated but the VM itself is paused and its vCPUs are not running
VMPowerStatePaused VMPowerState = "Paused"
// Running
VMPowerStateRunning VMPowerState = "Running"
// VM state has been saved to disk and it is nolonger running. Note that disks remain in-use while the VM is suspended.
VMPowerStateSuspended VMPowerState = "Suspended"
)
type OnNormalExit string
const (
// destroy the VM state
OnNormalExitDestroy OnNormalExit = "destroy"
// restart the VM
OnNormalExitRestart OnNormalExit = "restart"
)
type OnCrashBehaviour string
const (
// destroy the VM state
OnCrashBehaviourDestroy OnCrashBehaviour = "destroy"
// record a coredump and then destroy the VM state
OnCrashBehaviourCoredumpAndDestroy OnCrashBehaviour = "coredump_and_destroy"
// restart the VM
OnCrashBehaviourRestart OnCrashBehaviour = "restart"
// record a coredump and then restart the VM
OnCrashBehaviourCoredumpAndRestart OnCrashBehaviour = "coredump_and_restart"
// leave the crashed VM paused
OnCrashBehaviourPreserve OnCrashBehaviour = "preserve"
// rename the crashed VM and start a new copy
OnCrashBehaviourRenameRestart OnCrashBehaviour = "rename_restart"
)
type VMOperations string
const (
// refers to the operation "snapshot"
VMOperationsSnapshot VMOperations = "snapshot"
// refers to the operation "clone"
VMOperationsClone VMOperations = "clone"
// refers to the operation "copy"
VMOperationsCopy VMOperations = "copy"
// refers to the operation "create_template"
VMOperationsCreateTemplate VMOperations = "create_template"
// refers to the operation "revert"
VMOperationsRevert VMOperations = "revert"
// refers to the operation "checkpoint"
VMOperationsCheckpoint VMOperations = "checkpoint"
// refers to the operation "snapshot_with_quiesce"
VMOperationsSnapshotWithQuiesce VMOperations = "snapshot_with_quiesce"
// refers to the operation "provision"
VMOperationsProvision VMOperations = "provision"
// refers to the operation "start"
VMOperationsStart VMOperations = "start"
// refers to the operation "start_on"
VMOperationsStartOn VMOperations = "start_on"
// refers to the operation "pause"
VMOperationsPause VMOperations = "pause"
// refers to the operation "unpause"
VMOperationsUnpause VMOperations = "unpause"
// refers to the operation "clean_shutdown"
VMOperationsCleanShutdown VMOperations = "clean_shutdown"
// refers to the operation "clean_reboot"
VMOperationsCleanReboot VMOperations = "clean_reboot"
// refers to the operation "hard_shutdown"
VMOperationsHardShutdown VMOperations = "hard_shutdown"
// refers to the operation "power_state_reset"
VMOperationsPowerStateReset VMOperations = "power_state_reset"
// refers to the operation "hard_reboot"
VMOperationsHardReboot VMOperations = "hard_reboot"
// refers to the operation "suspend"
VMOperationsSuspend VMOperations = "suspend"
// refers to the operation "csvm"
VMOperationsCsvm VMOperations = "csvm"
// refers to the operation "resume"
VMOperationsResume VMOperations = "resume"
// refers to the operation "resume_on"
VMOperationsResumeOn VMOperations = "resume_on"
// refers to the operation "pool_migrate"
VMOperationsPoolMigrate VMOperations = "pool_migrate"
// refers to the operation "migrate_send"
VMOperationsMigrateSend VMOperations = "migrate_send"
// refers to the operation "get_boot_record"
VMOperationsGetBootRecord VMOperations = "get_boot_record"
// refers to the operation "send_sysrq"
VMOperationsSendSysrq VMOperations = "send_sysrq"
// refers to the operation "send_trigger"
VMOperationsSendTrigger VMOperations = "send_trigger"
// refers to the operation "query_services"
VMOperationsQueryServices VMOperations = "query_services"
// refers to the operation "shutdown"
VMOperationsShutdown VMOperations = "shutdown"
// refers to the operation "call_plugin"
VMOperationsCallPlugin VMOperations = "call_plugin"
// Changing the memory settings
VMOperationsChangingMemoryLive VMOperations = "changing_memory_live"
// Waiting for the memory settings to change
VMOperationsAwaitingMemoryLive VMOperations = "awaiting_memory_live"
// Changing the memory dynamic range
VMOperationsChangingDynamicRange VMOperations = "changing_dynamic_range"
// Changing the memory static range
VMOperationsChangingStaticRange VMOperations = "changing_static_range"
// Changing the memory limits
VMOperationsChangingMemoryLimits VMOperations = "changing_memory_limits"
// Changing the shadow memory for a halted VM.
VMOperationsChangingShadowMemory VMOperations = "changing_shadow_memory"
// Changing the shadow memory for a running VM.
VMOperationsChangingShadowMemoryLive VMOperations = "changing_shadow_memory_live"
// Changing VCPU settings for a halted VM.
VMOperationsChangingVCPUs VMOperations = "changing_VCPUs"
// Changing VCPU settings for a running VM.
VMOperationsChangingVCPUsLive VMOperations = "changing_VCPUs_live"
//
VMOperationsAssertOperationValid VMOperations = "assert_operation_valid"
// Add, remove, query or list data sources
VMOperationsDataSourceOp VMOperations = "data_source_op"
//
VMOperationsUpdateAllowedOperations VMOperations = "update_allowed_operations"
// Turning this VM into a template
VMOperationsMakeIntoTemplate VMOperations = "make_into_template"
// importing a VM from a network stream
VMOperationsImport VMOperations = "import"
// exporting a VM to a network stream
VMOperationsExport VMOperations = "export"
// exporting VM metadata to a network stream
VMOperationsMetadataExport VMOperations = "metadata_export"
// Reverting the VM to a previous snapshotted state
VMOperationsReverting VMOperations = "reverting"
// refers to the act of uninstalling the VM
VMOperationsDestroy VMOperations = "destroy"
)
type VMRecord struct {
// Unique identifier/object reference
UUID string
// 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.
AllowedOperations []VMOperations
// links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task.
CurrentOperations map[string]VMOperations
// Current power state of the machine
PowerState VMPowerState
// a human-readable name
NameLabel string
// a notes field containing human-readable description
NameDescription string
// a user version number for this machine
UserVersion int
// true if this is a template. Template VMs can never be started, they are used only for cloning other VMs
IsATemplate bool
// The VDI that a suspend image is stored on. (Only has meaning if VM is currently suspended)
SuspendVDI VDIRef
// the host the VM is currently resident on
ResidentOn HostRef
// a host which the VM has some affinity for (or NULL). This is used as a hint to the start call when it decides where to run the VM. Implementations are free to ignore this field.
Affinity HostRef
// Virtualization memory overhead (bytes).
MemoryOverhead int
// Dynamically-set memory target (bytes). The value of this field indicates the current target for memory available to this VM.
MemoryTarget int
// Statically-set (i.e. absolute) maximum (bytes). The value of this field at VM start time acts as a hard limit of the amount of memory a guest can use. New values only take effect on reboot.
MemoryStaticMax int
// Dynamic maximum (bytes)
MemoryDynamicMax int
// Dynamic minimum (bytes)
MemoryDynamicMin int
// Statically-set (i.e. absolute) mininum (bytes). The value of this field indicates the least amount of memory this VM can boot with without crashing.
MemoryStaticMin int
// configuration parameters for the selected VCPU policy
VCPUsParams map[string]string
// Max number of VCPUs
VCPUsMax int
// Boot number of VCPUs
VCPUsAtStartup int
// action to take after the guest has shutdown itself
ActionsAfterShutdown OnNormalExit
// action to take after the guest has rebooted itself
ActionsAfterReboot OnNormalExit
// action to take if the guest crashes
ActionsAfterCrash OnCrashBehaviour
// virtual console devices
Consoles []ConsoleRef
// virtual network interfaces
VIFs []VIFRef
// virtual block devices
VBDs []VBDRef
// crash dumps associated with this VM
CrashDumps []CrashdumpRef
// virtual TPMs
VTPMs []VTPMRef
// name of or path to bootloader
PVBootloader string
// path to the kernel
PVKernel string
// path to the initrd
PVRamdisk string
// kernel command-line arguments
PVArgs string
// miscellaneous arguments for the bootloader
PVBootloaderArgs string
// to make Zurich guests boot
PVLegacyArgs string
// HVM boot policy
HVMBootPolicy string
// HVM boot params
HVMBootParams map[string]string
// multiplier applied to the amount of shadow that will be made available to the guest
HVMShadowMultiplier float64
// platform-specific configuration
Platform map[string]string
// PCI bus path for pass-through devices
PCIBus string
// additional configuration
OtherConfig map[string]string
// domain ID (if available, -1 otherwise)
Domid int
// Domain architecture (if available, null string otherwise)
Domarch string
// describes the CPU flags on which the VM was last booted
LastBootCPUFlags map[string]string
// true if this is a control domain (domain 0 or a driver domain)
IsControlDomain bool
// metrics associated with this VM
Metrics VMMetricsRef
// metrics associated with the running guest
GuestMetrics VMGuestMetricsRef
// marshalled value containing VM record at time of last boot, updated dynamically to reflect the runtime state of the domain
LastBootedRecord string
// An XML specification of recommended values and ranges for properties of this VM
Recommendations string
// data to be inserted into the xenstore tree (/local/domain/<domid>/vm-data) after the VM is created.
XenstoreData map[string]string
// if true then the system will attempt to keep the VM running as much as possible.
HaAlwaysRun bool
// has possible values: "best-effort" meaning "try to restart this VM if possible but don't consider the Pool to be overcommitted if this is not possible"; "restart" meaning "this VM should be restarted"; "" meaning "do not try to restart this VM"
HaRestartPriority string
// true if this is a snapshot. Snapshotted VMs can never be started, they are used only for cloning other VMs
IsASnapshot bool
// Ref pointing to the VM this snapshot is of.
SnapshotOf VMRef
// List pointing to all the VM snapshots.
Snapshots []VMRef
// Date/time when this snapshot was created.
SnapshotTime time.Time
// Transportable ID of the snapshot VM
TransportableSnapshotID string
// Binary blobs associated with this VM
Blobs map[string]BlobRef
// user-specified tags for categorization purposes
Tags []string
// List of operations which have been explicitly blocked and an error code
BlockedOperations map[VMOperations]string
// Human-readable information concerning this snapshot
SnapshotInfo map[string]string
// Encoded information about the VM's metadata this is a snapshot of
SnapshotMetadata string
// Ref pointing to the parent of this VM
Parent VMRef
// List pointing to all the children of this VM
Children []VMRef
// BIOS strings
BiosStrings map[string]string
// Ref pointing to a protection policy for this VM
ProtectionPolicy VMPPRef
// true if this snapshot was created by the protection policy
IsSnapshotFromVmpp bool
// the appliance to which this VM belongs
Appliance VMApplianceRef
// The delay to wait before proceeding to the next order in the startup sequence (seconds)
StartDelay int
// The delay to wait before proceeding to the next order in the shutdown sequence (seconds)
ShutdownDelay int
// The point in the startup or shutdown sequence at which this VM will be started
Order int
// Virtual GPUs
VGPUs []VGPURef
// Currently passed-through PCI devices
AttachedPCIs []PCIRef
// The SR on which a suspend image is stored
SuspendSR SRRef
// The number of times this VM has been recovered
Version int
// Generation ID of the VM
GenerationID string
// The host virtual hardware platform version the VM can run on
HardwarePlatformVersion int
// True if the Windows Update feature is enabled on the VM; false otherwise
AutoUpdateDrivers bool
}
type VMRef string
// A virtual machine (or 'guest').
type VMClass struct {
client *Client
}
// Return a map of VM references to VM records for all VMs known to the system.
func (_class VMClass) GetAllRecords(sessionID SessionRef) (_retval map[VMRef]VMRecord, _err error) {
_method := "VM.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
if _err != nil {
return
}
_retval, _err = convertVMRefToVMRecordMapToGo(_method + " -> ", _result.Value)
return
}
// Return a list of all the VMs known to the system.
func (_class VMClass) GetAll(sessionID SessionRef) (_retval []VMRef, _err error) {
_method := "VM.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
if _err != nil {
return
}
_retval, _err = convertVMRefSetToGo(_method + " -> ", _result.Value)
return
}
// Start the 'xenprep' process on the VM; the process will remove any tools and drivers for XenServer and then set auto update drivers true.
func (_class VMClass) XenprepStart(sessionID SessionRef, self VMRef) (_err error) {
_method := "VM.xenprep_start"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// Import an XVA from a URI
func (_class VMClass) Import(sessionID SessionRef, url string, sr SRRef, fullRestore bool, force bool) (_retval []VMRef, _err error) {
_method := "VM.import"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_urlArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "url"), url)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "sr"), sr)
if _err != nil {
return
}
_fullRestoreArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "full_restore"), fullRestore)
if _err != nil {
return
}
_forceArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "force"), force)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _urlArg, _srArg, _fullRestoreArg, _forceArg)
if _err != nil {
return
}
_retval, _err = convertVMRefSetToGo(_method + " -> ", _result.Value)
return
}
// Check if PV auto update can be set on Windows vm
func (_class VMClass) AssertCanSetAutoUpdateDrivers(sessionID SessionRef, self VMRef, value bool) (_err error) {
_method := "VM.assert_can_set_auto_update_drivers"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Enable or disable PV auto update on Windows vm
func (_class VMClass) SetAutoUpdateDrivers(sessionID SessionRef, self VMRef, value bool) (_err error) {
_method := "VM.set_auto_update_drivers"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Call a XenAPI plugin on this vm
func (_class VMClass) CallPlugin(sessionID SessionRef, vm VMRef, plugin string, fn string, args map[string]string) (_retval string, _err error) {
_method := "VM.call_plugin"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_pluginArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "plugin"), plugin)
if _err != nil {
return
}
_fnArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "fn"), fn)
if _err != nil {
return
}
_argsArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "args"), args)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg, _pluginArg, _fnArg, _argsArg)
if _err != nil {
return
}
_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
return
}
// Query the system services advertised by this VM and register them. This can only be applied to a system domain.
func (_class VMClass) QueryServices(sessionID SessionRef, self VMRef) (_retval map[string]string, _err error) {
_method := "VM.query_services"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
if _err != nil {
return
}
_retval, _err = convertStringToStringMapToGo(_method + " -> ", _result.Value)
return
}
// Assign this VM to an appliance.
func (_class VMClass) SetAppliance(sessionID SessionRef, self VMRef, value VMApplianceRef) (_err error) {
_method := "VM.set_appliance"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertVMApplianceRefToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Import using a conversion service.
func (_class VMClass) ImportConvert(sessionID SessionRef, atype string, username string, password string, sr SRRef, remoteConfig map[string]string) (_err error) {
_method := "VM.import_convert"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_atypeArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "type"), atype)
if _err != nil {
return
}
_usernameArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "username"), username)
if _err != nil {
return
}
_passwordArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "password"), password)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "sr"), sr)
if _err != nil {
return
}
_remoteConfigArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "remote_config"), remoteConfig)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _atypeArg, _usernameArg, _passwordArg, _srArg, _remoteConfigArg)
return
}
// Recover the VM
func (_class VMClass) Recover(sessionID SessionRef, self VMRef, sessionTo SessionRef, force bool) (_err error) {
_method := "VM.recover"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_sessionToArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_to"), sessionTo)
if _err != nil {
return
}
_forceArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "force"), force)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _sessionToArg, _forceArg)
return
}
// List all the SR's that are required for the VM to be recovered
func (_class VMClass) GetSRsRequiredForRecovery(sessionID SessionRef, self VMRef, sessionTo SessionRef) (_retval []SRRef, _err error) {
_method := "VM.get_SRs_required_for_recovery"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_sessionToArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_to"), sessionTo)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg, _sessionToArg)
if _err != nil {
return
}
_retval, _err = convertSRRefSetToGo(_method + " -> ", _result.Value)
return
}
// Assert whether all SRs required to recover this VM are available.
//
// Errors:
// VM_IS_PART_OF_AN_APPLIANCE - This operation is not allowed as the VM is part of an appliance.
// VM_REQUIRES_SR - You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR.
func (_class VMClass) AssertCanBeRecovered(sessionID SessionRef, self VMRef, sessionTo SessionRef) (_err error) {
_method := "VM.assert_can_be_recovered"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_sessionToArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_to"), sessionTo)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _sessionToArg)
return
}
// Set this VM's suspend VDI, which must be indentical to its current one
func (_class VMClass) SetSuspendVDI(sessionID SessionRef, self VMRef, value VDIRef) (_err error) {
_method := "VM.set_suspend_VDI"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Set this VM's boot order
func (_class VMClass) SetOrder(sessionID SessionRef, self VMRef, value int) (_err error) {
_method := "VM.set_order"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Set this VM's shutdown delay in seconds
func (_class VMClass) SetShutdownDelay(sessionID SessionRef, self VMRef, value int) (_err error) {
_method := "VM.set_shutdown_delay"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Set this VM's start delay in seconds
func (_class VMClass) SetStartDelay(sessionID SessionRef, self VMRef, value int) (_err error) {
_method := "VM.set_start_delay"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Set the value of the protection_policy field
func (_class VMClass) SetProtectionPolicy(sessionID SessionRef, self VMRef, value VMPPRef) (_err error) {
_method := "VM.set_protection_policy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertVMPPRefToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// Copy the BIOS strings from the given host to this VM
func (_class VMClass) CopyBiosStrings(sessionID SessionRef, vm VMRef, host HostRef) (_err error) {
_method := "VM.copy_bios_strings"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_hostArg, _err := convertHostRefToXen(fmt.Sprintf("%s(%s)", _method, "host"), host)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vmArg, _hostArg)
return
}
// Returns mapping of hosts to ratings, indicating the suitability of starting the VM at that location according to wlb. Rating is replaced with an error if the VM cannot boot there.
func (_class VMClass) RetrieveWlbRecommendations(sessionID SessionRef, vm VMRef) (_retval map[HostRef][]string, _err error) {
_method := "VM.retrieve_wlb_recommendations"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg)
if _err != nil {
return
}
_retval, _err = convertHostRefToStringSetMapToGo(_method + " -> ", _result.Value)
return
}
// Returns an error if the VM is not considered agile e.g. because it is tied to a resource local to a host
func (_class VMClass) AssertAgile(sessionID SessionRef, self VMRef) (_err error) {
_method := "VM.assert_agile"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// Create a placeholder for a named binary blob of data that is associated with this VM
func (_class VMClass) CreateNewBlob(sessionID SessionRef, vm VMRef, name string, mimeType string, public bool) (_retval BlobRef, _err error) {
_method := "VM.create_new_blob"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_nameArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "name"), name)
if _err != nil {
return
}
_mimeTypeArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "mime_type"), mimeType)
if _err != nil {
return
}
_publicArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "public"), public)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg, _nameArg, _mimeTypeArg, _publicArg)
if _err != nil {
return
}
_retval, _err = convertBlobRefToGo(_method + " -> ", _result.Value)
return
}
// Returns an error if the VM could not boot on this host for some reason
//
// Errors:
// HOST_NOT_ENOUGH_FREE_MEMORY - Not enough host memory is available to perform this operation
// VM_REQUIRES_SR - You attempted to run a VM on a host which doesn't have access to an SR needed by the VM. The VM has at least one VBD attached to a VDI in the SR.
// VM_HOST_INCOMPATIBLE_VERSION - This VM operation cannot be performed on an older-versioned host during an upgrade.
// VM_HOST_INCOMPATIBLE_VIRTUAL_HARDWARE_PLATFORM_VERSION - You attempted to run a VM on a host that cannot provide the VM's required Virtual Hardware Platform version.
func (_class VMClass) AssertCanBootHere(sessionID SessionRef, self VMRef, host HostRef) (_err error) {
_method := "VM.assert_can_boot_here"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_hostArg, _err := convertHostRefToXen(fmt.Sprintf("%s(%s)", _method, "host"), host)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _hostArg)
return
}
// Return the list of hosts on which this VM may run.
func (_class VMClass) GetPossibleHosts(sessionID SessionRef, vm VMRef) (_retval []HostRef, _err error) {
_method := "VM.get_possible_hosts"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg)
if _err != nil {
return
}
_retval, _err = convertHostRefSetToGo(_method + " -> ", _result.Value)
return
}
// Returns a list of the allowed values that a VIF device field can take
func (_class VMClass) GetAllowedVIFDevices(sessionID SessionRef, vm VMRef) (_retval []string, _err error) {
_method := "VM.get_allowed_VIF_devices"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg)
if _err != nil {
return
}
_retval, _err = convertStringSetToGo(_method + " -> ", _result.Value)
return
}
// Returns a list of the allowed values that a VBD device field can take
func (_class VMClass) GetAllowedVBDDevices(sessionID SessionRef, vm VMRef) (_retval []string, _err error) {
_method := "VM.get_allowed_VBD_devices"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vmArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "vm"), vm)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vmArg)
if _err != nil {
return
}
_retval, _err = convertStringSetToGo(_method + " -> ", _result.Value)
return
}
// Recomputes the list of acceptable operations
func (_class VMClass) UpdateAllowedOperations(sessionID SessionRef, self VMRef) (_err error) {
_method := "VM.update_allowed_operations"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// Check to see whether this operation is acceptable in the current state of the system, raising an error if the operation is invalid for some reason
func (_class VMClass) AssertOperationValid(sessionID SessionRef, self VMRef, op VMOperations) (_err error) {
_method := "VM.assert_operation_valid"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_opArg, _err := convertEnumVMOperationsToXen(fmt.Sprintf("%s(%s)", _method, "op"), op)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _opArg)
return
}
// Forget the recorded statistics related to the specified data source
func (_class VMClass) ForgetDataSourceArchives(sessionID SessionRef, self VMRef, dataSource string) (_err error) {
_method := "VM.forget_data_source_archives"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_dataSourceArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "data_source"), dataSource)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _dataSourceArg)
return
}
// Query the latest value of the specified data source
func (_class VMClass) QueryDataSource(sessionID SessionRef, self VMRef, dataSource string) (_retval float64, _err error) {
_method := "VM.query_data_source"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_dataSourceArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "data_source"), dataSource)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg, _dataSourceArg)
if _err != nil {
return
}
_retval, _err = convertFloatToGo(_method + " -> ", _result.Value)
return
}
// Start recording the specified data source
func (_class VMClass) RecordDataSource(sessionID SessionRef, self VMRef, dataSource string) (_err error) {
_method := "VM.record_data_source"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_dataSourceArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "data_source"), dataSource)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _dataSourceArg)
return
}
//
func (_class VMClass) GetDataSources(sessionID SessionRef, self VMRef) (_retval []DataSourceRecord, _err error) {
_method := "VM.get_data_sources"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
if _err != nil {
return
}
_retval, _err = convertDataSourceRecordSetToGo(_method + " -> ", _result.Value)
return
}
// Returns a record describing the VM's dynamic state, initialised when the VM boots and updated to reflect runtime configuration changes e.g. CPU hotplug
func (_class VMClass) GetBootRecord(sessionID SessionRef, self VMRef) (_retval VMRecord, _err error) {
_method := "VM.get_boot_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVMRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
if _err != nil {
return
}
_retval, _err = convertVMRecordToGo(_method + " -> ", _result.Value)
return
}