-
Notifications
You must be signed in to change notification settings - Fork 25
/
vdi_gen.go
1945 lines (1850 loc) · 70.4 KB
/
vdi_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 VdiOperations string
const (
// Cloning the VDI
VdiOperationsClone VdiOperations = "clone"
// Copying the VDI
VdiOperationsCopy VdiOperations = "copy"
// Resizing the VDI
VdiOperationsResize VdiOperations = "resize"
// Resizing the VDI which may or may not be online
VdiOperationsResizeOnline VdiOperations = "resize_online"
// Snapshotting the VDI
VdiOperationsSnapshot VdiOperations = "snapshot"
// Mirroring the VDI
VdiOperationsMirror VdiOperations = "mirror"
// Destroying the VDI
VdiOperationsDestroy VdiOperations = "destroy"
// Forget about the VDI
VdiOperationsForget VdiOperations = "forget"
// Refreshing the fields of the VDI
VdiOperationsUpdate VdiOperations = "update"
// Forcibly unlocking the VDI
VdiOperationsForceUnlock VdiOperations = "force_unlock"
// Generating static configuration
VdiOperationsGenerateConfig VdiOperations = "generate_config"
// Enabling changed block tracking for a VDI
VdiOperationsEnableCbt VdiOperations = "enable_cbt"
// Disabling changed block tracking for a VDI
VdiOperationsDisableCbt VdiOperations = "disable_cbt"
// Deleting the data of the VDI
VdiOperationsDataDestroy VdiOperations = "data_destroy"
// Exporting a bitmap that shows the changed blocks between two VDIs
VdiOperationsListChangedBlocks VdiOperations = "list_changed_blocks"
// Setting the on_boot field of the VDI
VdiOperationsSetOnBoot VdiOperations = "set_on_boot"
// Operations on this VDI are temporarily blocked
VdiOperationsBlocked VdiOperations = "blocked"
)
type VdiType string
const (
// a disk that may be replaced on upgrade
VdiTypeSystem VdiType = "system"
// a disk that is always preserved on upgrade
VdiTypeUser VdiType = "user"
// a disk that may be reformatted on upgrade
VdiTypeEphemeral VdiType = "ephemeral"
// a disk that stores a suspend image
VdiTypeSuspend VdiType = "suspend"
// a disk that stores VM crashdump information
VdiTypeCrashdump VdiType = "crashdump"
// a disk used for HA storage heartbeating
VdiTypeHaStatefile VdiType = "ha_statefile"
// a disk used for HA Pool metadata
VdiTypeMetadata VdiType = "metadata"
// a disk used for a general metadata redo-log
VdiTypeRedoLog VdiType = "redo_log"
// a disk that stores SR-level RRDs
VdiTypeRrd VdiType = "rrd"
// a disk that stores PVS cache data
VdiTypePvsCache VdiType = "pvs_cache"
// Metadata about a snapshot VDI that has been deleted: the set of blocks that changed between some previous version of the disk and the version tracked by the snapshot.
VdiTypeCbtMetadata VdiType = "cbt_metadata"
)
type OnBoot string
const (
// When a VM containing this VDI is started, the contents of the VDI are reset to the state they were in when this flag was last set.
OnBootReset OnBoot = "reset"
// Standard behaviour.
OnBootPersist OnBoot = "persist"
)
type VDIRecord struct {
// Unique identifier/object reference
UUID string
// a human-readable name
NameLabel string
// a notes field containing human-readable description
NameDescription 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 []VdiOperations
// 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]VdiOperations
// storage repository in which the VDI resides
SR SRRef
// list of vbds that refer to this disk
VBDs []VBDRef
// list of crash dumps that refer to this disk
CrashDumps []CrashdumpRef
// size of disk as presented to the guest (in bytes). Note that, depending on storage backend type, requested size may not be respected exactly
VirtualSize int
// amount of physical space that the disk image is currently taking up on the storage repository (in bytes)
PhysicalUtilisation int
// type of the VDI
Type VdiType
// true if this disk may be shared
Sharable bool
// true if this disk may ONLY be mounted read-only
ReadOnly bool
// additional configuration
OtherConfig map[string]string
// true if this disk is locked at the storage level
StorageLock bool
// location information
Location string
//
Managed bool
// true if SR scan operation reported this VDI as not present on disk
Missing bool
// This field is always null. Deprecated
Parent VDIRef
// data to be inserted into the xenstore tree (/local/domain/0/backend/vbd/<domid>/<device-id>/sm-data) after the VDI is attached. This is generally set by the SM backends on vdi_attach.
XenstoreData map[string]string
// SM dependent data
SmConfig map[string]string
// true if this is a snapshot.
IsASnapshot bool
// Ref pointing to the VDI this snapshot is of.
SnapshotOf VDIRef
// List pointing to all the VDIs snapshots.
Snapshots []VDIRef
// Date/time when this snapshot was created.
SnapshotTime time.Time
// user-specified tags for categorization purposes
Tags []string
// true if this VDI is to be cached in the local cache SR
AllowCaching bool
// The behaviour of this VDI on a VM boot
OnBoot OnBoot
// The pool whose metadata is contained in this VDI
MetadataOfPool PoolRef
// Whether this VDI contains the latest known accessible metadata for the pool
MetadataLatest bool
// Whether this VDI is a Tools ISO
IsToolsIso bool
// True if changed blocks are tracked for this VDI
CbtEnabled bool
}
type VDIRef string
// A virtual disk image
type VDIClass struct {
client *Client
}
// GetAllRecords Return a map of VDI references to VDI records for all VDIs known to the system.
func (_class VDIClass) GetAllRecords(sessionID SessionRef) (_retval map[VDIRef]VDIRecord, _err error) {
_method := "VDI.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 = convertVDIRefToVDIRecordMapToGo(_method + " -> ", _result.Value)
return
}
// GetAll Return a list of all the VDIs known to the system.
func (_class VDIClass) GetAll(sessionID SessionRef) (_retval []VDIRef, _err error) {
_method := "VDI.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 = convertVDIRefSetToGo(_method + " -> ", _result.Value)
return
}
// GetNbdInfo Get details specifying how to access this VDI via a Network Block Device server. For each of a set of NBD server addresses on which the VDI is available, the return value set contains a vdi_nbd_server_info object that contains an exportname to request once the NBD connection is established, and connection details for the address. An empty list is returned if there is no network that has a PIF on a host with access to the relevant SR, or if no such network has been assigned an NBD-related purpose in its purpose field. To access the given VDI, any of the vdi_nbd_server_info objects can be used to make a connection to a server, and then the VDI will be available by requesting the exportname.
//
// Errors:
// VDI_INCOMPATIBLE_TYPE - This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)
func (_class VDIClass) GetNbdInfo(sessionID SessionRef, self VDIRef) (_retval []VdiNbdServerInfoRecord, _err error) {
_method := "VDI.get_nbd_info"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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 = convertVdiNbdServerInfoRecordSetToGo(_method + " -> ", _result.Value)
return
}
// ListChangedBlocks Compare two VDIs in 64k block increments and report which blocks differ. This operation is not allowed when vdi_to is attached to a VM.
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
// VDI_MISSING - This operation cannot be performed because the specified VDI could not be found on the storage substrate
// SR_NOT_ATTACHED - The SR is not attached.
// SR_HAS_NO_PBDS - The SR has no attached PBDs
// VDI_IN_USE - This operation cannot be performed because this VDI is in use by some other operation
func (_class VDIClass) ListChangedBlocks(sessionID SessionRef, vdiFrom VDIRef, vdiTo VDIRef) (_retval string, _err error) {
_method := "VDI.list_changed_blocks"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiFromArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi_from"), vdiFrom)
if _err != nil {
return
}
_vdiToArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi_to"), vdiTo)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vdiFromArg, _vdiToArg)
if _err != nil {
return
}
_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
return
}
// DataDestroy Delete the data of the snapshot VDI, but keep its changed block tracking metadata. When successful, this call changes the type of the VDI to cbt_metadata. This operation is idempotent: calling it on a VDI of type cbt_metadata results in a no-op, and no error will be thrown.
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
// VDI_MISSING - This operation cannot be performed because the specified VDI could not be found on the storage substrate
// SR_NOT_ATTACHED - The SR is not attached.
// SR_HAS_NO_PBDS - The SR has no attached PBDs
// OPERATION_NOT_ALLOWED - You attempted an operation that was not allowed.
// VDI_INCOMPATIBLE_TYPE - This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)
// VDI_NO_CBT_METADATA - The requested operation is not allowed because the specified VDI does not have changed block tracking metadata.
// VDI_IN_USE - This operation cannot be performed because this VDI is in use by some other operation
// VDI_IS_A_PHYSICAL_DEVICE - The operation cannot be performed on physical device
func (_class VDIClass) DataDestroy(sessionID SessionRef, self VDIRef) (_err error) {
_method := "VDI.data_destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// DisableCbt Disable changed block tracking for the VDI. This call is only allowed on VDIs that support enabling CBT. It is an idempotent operation - disabling CBT for a VDI for which CBT is not enabled results in a no-op, and no error will be thrown.
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
// VDI_MISSING - This operation cannot be performed because the specified VDI could not be found on the storage substrate
// SR_NOT_ATTACHED - The SR is not attached.
// SR_HAS_NO_PBDS - The SR has no attached PBDs
// OPERATION_NOT_ALLOWED - You attempted an operation that was not allowed.
// VDI_INCOMPATIBLE_TYPE - This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)
// VDI_ON_BOOT_MODE_INCOMPATIBLE_WITH_OPERATION - This operation is not permitted on VDIs in the 'on-boot=reset' mode, or on VMs having such VDIs.
func (_class VDIClass) DisableCbt(sessionID SessionRef, self VDIRef) (_err error) {
_method := "VDI.disable_cbt"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// EnableCbt Enable changed block tracking for the VDI. This call is idempotent - enabling CBT for a VDI for which CBT is already enabled results in a no-op, and no error will be thrown.
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
// VDI_MISSING - This operation cannot be performed because the specified VDI could not be found on the storage substrate
// SR_NOT_ATTACHED - The SR is not attached.
// SR_HAS_NO_PBDS - The SR has no attached PBDs
// OPERATION_NOT_ALLOWED - You attempted an operation that was not allowed.
// VDI_INCOMPATIBLE_TYPE - This operation cannot be performed because the specified VDI is of an incompatible type (eg: an HA statefile cannot be attached to a guest)
// VDI_ON_BOOT_MODE_INCOMPATIBLE_WITH_OPERATION - This operation is not permitted on VDIs in the 'on-boot=reset' mode, or on VMs having such VDIs.
func (_class VDIClass) EnableCbt(sessionID SessionRef, self VDIRef) (_err error) {
_method := "VDI.enable_cbt"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg)
return
}
// PoolMigrate Migrate a VDI, which may be attached to a running guest, to a different SR. The destination SR must be visible to the guest.
func (_class VDIClass) PoolMigrate(sessionID SessionRef, vdi VDIRef, sr SRRef, options map[string]string) (_retval VDIRef, _err error) {
_method := "VDI.pool_migrate"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "sr"), sr)
if _err != nil {
return
}
_optionsArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "options"), options)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vdiArg, _srArg, _optionsArg)
if _err != nil {
return
}
_retval, _err = convertVDIRefToGo(_method + " -> ", _result.Value)
return
}
// ReadDatabasePoolUUID Check the VDI cache for the pool UUID of the database on this VDI.
func (_class VDIClass) ReadDatabasePoolUUID(sessionID SessionRef, self VDIRef) (_retval string, _err error) {
_method := "VDI.read_database_pool_uuid"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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 = convertStringToGo(_method + " -> ", _result.Value)
return
}
// OpenDatabase Load the metadata found on the supplied VDI and return a session reference which can be used in XenAPI calls to query its contents.
func (_class VDIClass) OpenDatabase(sessionID SessionRef, self VDIRef) (_retval SessionRef, _err error) {
_method := "VDI.open_database"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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 = convertSessionRefToGo(_method + " -> ", _result.Value)
return
}
// SetAllowCaching Set the value of the allow_caching parameter. This value can only be changed when the VDI is not attached to a running VM. The caching behaviour is only affected by this flag for VHD-based VDIs that have one parent and no child VHDs. Moreover, caching only takes place when the host running the VM containing this VDI has a nominated SR for local caching.
func (_class VDIClass) SetAllowCaching(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_allow_caching"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetOnBoot Set the value of the on_boot parameter. This value can only be changed when the VDI is not attached to a running VM.
func (_class VDIClass) SetOnBoot(sessionID SessionRef, self VDIRef, value OnBoot) (_err error) {
_method := "VDI.set_on_boot"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertEnumOnBootToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// SetNameDescription Set the name description of the VDI. This can only happen when its SR is currently attached.
func (_class VDIClass) SetNameDescription(sessionID SessionRef, self VDIRef, value string) (_err error) {
_method := "VDI.set_name_description"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// SetNameLabel Set the name label of the VDI. This can only happen when then its SR is currently attached.
func (_class VDIClass) SetNameLabel(sessionID SessionRef, self VDIRef, value string) (_err error) {
_method := "VDI.set_name_label"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// SetMetadataOfPool Records the pool whose metadata is contained by this VDI.
func (_class VDIClass) SetMetadataOfPool(sessionID SessionRef, self VDIRef, value PoolRef) (_err error) {
_method := "VDI.set_metadata_of_pool"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertPoolRefToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// SetSnapshotTime Sets the snapshot time of this VDI.
func (_class VDIClass) SetSnapshotTime(sessionID SessionRef, self VDIRef, value time.Time) (_err error) {
_method := "VDI.set_snapshot_time"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_valueArg, _err := convertTimeToXen(fmt.Sprintf("%s(%s)", _method, "value"), value)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)
return
}
// SetSnapshotOf Sets the VDI of which this VDI is a snapshot
func (_class VDIClass) SetSnapshotOf(sessionID SessionRef, self VDIRef, value VDIRef) (_err error) {
_method := "VDI.set_snapshot_of"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetIsASnapshot Sets whether this VDI is a snapshot
func (_class VDIClass) SetIsASnapshot(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_is_a_snapshot"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetPhysicalUtilisation Sets the VDI's physical_utilisation field
func (_class VDIClass) SetPhysicalUtilisation(sessionID SessionRef, self VDIRef, value int) (_err error) {
_method := "VDI.set_physical_utilisation"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetVirtualSize Sets the VDI's virtual_size field
func (_class VDIClass) SetVirtualSize(sessionID SessionRef, self VDIRef, value int) (_err error) {
_method := "VDI.set_virtual_size"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetMissing Sets the VDI's missing field
func (_class VDIClass) SetMissing(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_missing"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetReadOnly Sets the VDI's read_only field
func (_class VDIClass) SetReadOnly(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_read_only"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// SetSharable Sets the VDI's sharable field
func (_class VDIClass) SetSharable(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_sharable"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// Forget Removes a VDI record from the database
func (_class VDIClass) Forget(sessionID SessionRef, vdi VDIRef) (_err error) {
_method := "VDI.forget"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vdiArg)
return
}
// SetManaged Sets the VDI's managed field
func (_class VDIClass) SetManaged(sessionID SessionRef, self VDIRef, value bool) (_err error) {
_method := "VDI.set_managed"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVDIRefToXen(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
}
// Copy Copy either a full VDI or the block differences between two VDIs into either a fresh VDI or an existing VDI.
//
// Errors:
// VDI_READONLY - The operation required write access but this VDI is read-only
// VDI_TOO_SMALL - The VDI is too small. Please resize it to at least the minimum size.
// VDI_NOT_SPARSE - The VDI is not stored using a sparse format. It is not possible to query and manipulate only the changed blocks (or 'block differences' or 'disk deltas') between two VDIs. Please select a VDI which uses a sparse-aware technology such as VHD.
func (_class VDIClass) Copy(sessionID SessionRef, vdi VDIRef, sr SRRef, baseVdi VDIRef, intoVdi VDIRef) (_retval VDIRef, _err error) {
_method := "VDI.copy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "sr"), sr)
if _err != nil {
return
}
_baseVdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "base_vdi"), baseVdi)
if _err != nil {
return
}
_intoVdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "into_vdi"), intoVdi)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vdiArg, _srArg, _baseVdiArg, _intoVdiArg)
if _err != nil {
return
}
_retval, _err = convertVDIRefToGo(_method + " -> ", _result.Value)
return
}
// Update Ask the storage backend to refresh the fields in the VDI object
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
func (_class VDIClass) Update(sessionID SessionRef, vdi VDIRef) (_err error) {
_method := "VDI.update"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vdiArg)
return
}
// DbForget Removes a VDI record from the database
func (_class VDIClass) DbForget(sessionID SessionRef, vdi VDIRef) (_err error) {
_method := "VDI.db_forget"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vdiArg)
return
}
// DbIntroduce Create a new VDI record in the database only
func (_class VDIClass) DbIntroduce(sessionID SessionRef, uuid string, nameLabel string, nameDescription string, sr SRRef, atype VdiType, sharable bool, readOnly bool, otherConfig map[string]string, location string, xenstoreData map[string]string, smConfig map[string]string, managed bool, virtualSize int, physicalUtilisation int, metadataOfPool PoolRef, isASnapshot bool, snapshotTime time.Time, snapshotOf VDIRef, cbtEnabled bool) (_retval VDIRef, _err error) {
_method := "VDI.db_introduce"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_uuidArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "uuid"), uuid)
if _err != nil {
return
}
_nameLabelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "name_label"), nameLabel)
if _err != nil {
return
}
_nameDescriptionArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "name_description"), nameDescription)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "SR"), sr)
if _err != nil {
return
}
_atypeArg, _err := convertEnumVdiTypeToXen(fmt.Sprintf("%s(%s)", _method, "type"), atype)
if _err != nil {
return
}
_sharableArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "sharable"), sharable)
if _err != nil {
return
}
_readOnlyArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "read_only"), readOnly)
if _err != nil {
return
}
_otherConfigArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "other_config"), otherConfig)
if _err != nil {
return
}
_locationArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "location"), location)
if _err != nil {
return
}
_xenstoreDataArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "xenstore_data"), xenstoreData)
if _err != nil {
return
}
_smConfigArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "sm_config"), smConfig)
if _err != nil {
return
}
_managedArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "managed"), managed)
if _err != nil {
return
}
_virtualSizeArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "virtual_size"), virtualSize)
if _err != nil {
return
}
_physicalUtilisationArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "physical_utilisation"), physicalUtilisation)
if _err != nil {
return
}
_metadataOfPoolArg, _err := convertPoolRefToXen(fmt.Sprintf("%s(%s)", _method, "metadata_of_pool"), metadataOfPool)
if _err != nil {
return
}
_isASnapshotArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "is_a_snapshot"), isASnapshot)
if _err != nil {
return
}
_snapshotTimeArg, _err := convertTimeToXen(fmt.Sprintf("%s(%s)", _method, "snapshot_time"), snapshotTime)
if _err != nil {
return
}
_snapshotOfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "snapshot_of"), snapshotOf)
if _err != nil {
return
}
_cbtEnabledArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "cbt_enabled"), cbtEnabled)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _uuidArg, _nameLabelArg, _nameDescriptionArg, _srArg, _atypeArg, _sharableArg, _readOnlyArg, _otherConfigArg, _locationArg, _xenstoreDataArg, _smConfigArg, _managedArg, _virtualSizeArg, _physicalUtilisationArg, _metadataOfPoolArg, _isASnapshotArg, _snapshotTimeArg, _snapshotOfArg, _cbtEnabledArg)
if _err != nil {
return
}
_retval, _err = convertVDIRefToGo(_method + " -> ", _result.Value)
return
}
// Introduce Create a new VDI record in the database only
//
// Errors:
// SR_OPERATION_NOT_SUPPORTED - The SR backend does not support the operation (check the SR's allowed operations)
func (_class VDIClass) Introduce(sessionID SessionRef, uuid string, nameLabel string, nameDescription string, sr SRRef, atype VdiType, sharable bool, readOnly bool, otherConfig map[string]string, location string, xenstoreData map[string]string, smConfig map[string]string, managed bool, virtualSize int, physicalUtilisation int, metadataOfPool PoolRef, isASnapshot bool, snapshotTime time.Time, snapshotOf VDIRef) (_retval VDIRef, _err error) {
_method := "VDI.introduce"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_uuidArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "uuid"), uuid)
if _err != nil {
return
}
_nameLabelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "name_label"), nameLabel)
if _err != nil {
return
}
_nameDescriptionArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "name_description"), nameDescription)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "SR"), sr)
if _err != nil {
return
}
_atypeArg, _err := convertEnumVdiTypeToXen(fmt.Sprintf("%s(%s)", _method, "type"), atype)
if _err != nil {
return
}
_sharableArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "sharable"), sharable)
if _err != nil {
return
}
_readOnlyArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "read_only"), readOnly)
if _err != nil {
return
}
_otherConfigArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "other_config"), otherConfig)
if _err != nil {
return
}
_locationArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "location"), location)
if _err != nil {
return
}
_xenstoreDataArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "xenstore_data"), xenstoreData)
if _err != nil {
return
}
_smConfigArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "sm_config"), smConfig)
if _err != nil {
return
}
_managedArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "managed"), managed)
if _err != nil {
return
}
_virtualSizeArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "virtual_size"), virtualSize)
if _err != nil {
return
}
_physicalUtilisationArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "physical_utilisation"), physicalUtilisation)
if _err != nil {
return
}
_metadataOfPoolArg, _err := convertPoolRefToXen(fmt.Sprintf("%s(%s)", _method, "metadata_of_pool"), metadataOfPool)
if _err != nil {
return
}
_isASnapshotArg, _err := convertBoolToXen(fmt.Sprintf("%s(%s)", _method, "is_a_snapshot"), isASnapshot)
if _err != nil {
return
}
_snapshotTimeArg, _err := convertTimeToXen(fmt.Sprintf("%s(%s)", _method, "snapshot_time"), snapshotTime)
if _err != nil {
return
}
_snapshotOfArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "snapshot_of"), snapshotOf)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _uuidArg, _nameLabelArg, _nameDescriptionArg, _srArg, _atypeArg, _sharableArg, _readOnlyArg, _otherConfigArg, _locationArg, _xenstoreDataArg, _smConfigArg, _managedArg, _virtualSizeArg, _physicalUtilisationArg, _metadataOfPoolArg, _isASnapshotArg, _snapshotTimeArg, _snapshotOfArg)
if _err != nil {
return
}
_retval, _err = convertVDIRefToGo(_method + " -> ", _result.Value)
return
}
// ResizeOnline Resize the VDI which may or may not be attached to running guests.
func (_class VDIClass) ResizeOnline(sessionID SessionRef, vdi VDIRef, size int) (_err error) {
_method := "VDI.resize_online"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_sizeArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "size"), size)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vdiArg, _sizeArg)
return
}
// Resize Resize the VDI.
func (_class VDIClass) Resize(sessionID SessionRef, vdi VDIRef, size int) (_err error) {
_method := "VDI.resize"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_sizeArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "size"), size)
if _err != nil {
return
}
_, _err = _class.client.APICall(_method, _sessionIDArg, _vdiArg, _sizeArg)
return
}
// Clone Take an exact copy of the VDI and return a reference to the new disk. If any driver_params are specified then these are passed through to the storage-specific substrate driver that implements the clone operation. NB the clone lives in the same Storage Repository as its parent.
func (_class VDIClass) Clone(sessionID SessionRef, vdi VDIRef, driverParams map[string]string) (_retval VDIRef, _err error) {
_method := "VDI.clone"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_driverParamsArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "driver_params"), driverParams)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vdiArg, _driverParamsArg)
if _err != nil {
return
}
_retval, _err = convertVDIRefToGo(_method + " -> ", _result.Value)
return
}
// Snapshot Take a read-only snapshot of the VDI, returning a reference to the snapshot. If any driver_params are specified then these are passed through to the storage-specific substrate driver that takes the snapshot. NB the snapshot lives in the same Storage Repository as its parent.
func (_class VDIClass) Snapshot(sessionID SessionRef, vdi VDIRef, driverParams map[string]string) (_retval VDIRef, _err error) {
_method := "VDI.snapshot"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_vdiArg, _err := convertVDIRefToXen(fmt.Sprintf("%s(%s)", _method, "vdi"), vdi)
if _err != nil {
return
}
_driverParamsArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "driver_params"), driverParams)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _vdiArg, _driverParamsArg)