libvirt_ffi 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b00c5abd950bc50a399401e1cd58739b9e730aa51854d0e1e6a33367ca6a5a9
4
- data.tar.gz: 78cf9477468e8f3ce2501f516ccaa0036ca2423bba115ca2838d10587e80496a
3
+ metadata.gz: 8e90f40ae66ad4112b924b384083ffb6c4d570ef216ad5c72d7c3d20a043d626
4
+ data.tar.gz: c8b476a622973d27d269d136a1040bee40b7358c334361b12a0c5a0fcc703598
5
5
  SHA512:
6
- metadata.gz: c8b57bc7809f3d25297a5e051753777f092ef11b9609b5d1c3046f6f5961b452c55a2dfc0501bab92d53b9ca847b1657eea066ff9f6865dd46cc111ae7dbe66c
7
- data.tar.gz: 2bb593a6571ba042f8f838523a21a4f4ff91c5242c08d55821af983d4561b2aa5faaed88e53d489457b6eae8fdb97c3802b099693c90f69c8ac169b52ec238bb
6
+ metadata.gz: 1d1f5d665e72e42bed01e86eed59201d30158a4977651667d2d6bb592381d5fdd90dc19f75ce5c47b98234408321824b50155b984ee25f08d6d399e398238d18
7
+ data.tar.gz: 9bb95047323c0667af10a2d74884ffe749514303635853185f439582074226a702f7b99afa653cd76096c0bea2d7bb77a4596b07e94f3f8e34edb16ccfc886a7
@@ -56,6 +56,24 @@ module Libvirt
56
56
  FFI::Domain.virDomainGetMaxVcpus(@dom_ptr)
57
57
  end
58
58
 
59
+ # @return [Boolean]
60
+ # @raise [Libvirt::Errors::LibError]
61
+ def auto_start
62
+ value = ::FFI::MemoryPointer.new(:int)
63
+ result = FFI::Domain.virDomainGetAutostart(@dom_ptr, value)
64
+ raise Errors::LibError, "Couldn't get domain uuid" if result.negative?
65
+
66
+ value.read_int == 1
67
+ end
68
+
69
+ # @param value [Boolean]
70
+ # @raise [Libvirt::Errors::LibError]
71
+ def set_auto_start(value)
72
+ value = value ? 1 : 0
73
+ result = FFI::Domain.virDomainSetAutostart(@dom_ptr, value)
74
+ raise Errors::LibError, "Couldn't get domain uuid" if result.negative?
75
+ end
76
+
59
77
  # def vcpus
60
78
  # # https://github.com/libvirt/ruby-libvirt/blob/9f71ff5add1f57ffef7cf513b72638d92d9fd84f/ext/libvirt/domain.c#L787
61
79
  # # dominfo = virDomainGetInfo
@@ -290,17 +290,17 @@ module Libvirt
290
290
  :MIGRATABLE, 0x8 # dump XML suitable for migration
291
291
  ]
292
292
 
293
- # int virDomainFree (
293
+ # int virDomainFree (
294
294
  # virDomainPtr domain
295
295
  # )
296
296
  attach_function :virDomainFree, [:pointer], :int
297
297
 
298
- # int virDomainRef (
298
+ # int virDomainRef (
299
299
  # virDomainPtr domain
300
300
  # )
301
301
  attach_function :virDomainRef, [:pointer], :int
302
302
 
303
- # int virConnectDomainEventRegisterAny(
303
+ # int virConnectDomainEventRegisterAny(
304
304
  # virConnectPtr conn,
305
305
  # virDomainPtr dom,
306
306
  # int eventID,
@@ -317,20 +317,20 @@ module Libvirt
317
317
  :pointer
318
318
  ], :int
319
319
 
320
- # int virConnectDomainEventDeregisterAny (
320
+ # int virConnectDomainEventDeregisterAny (
321
321
  # virConnectPtr conn,
322
322
  # int callbackID
323
323
  # )
324
324
  attach_function :virConnectDomainEventDeregisterAny, [:pointer, :int], :int
325
325
 
326
- # int virConnectListAllDomains (
326
+ # int virConnectListAllDomains (
327
327
  # virConnectPtr conn,
328
328
  # virDomainPtr **domains,
329
329
  # unsigned int flags
330
330
  # )
331
331
  attach_function :virConnectListAllDomains, [:pointer, :pointer, :uint], :int
332
332
 
333
- # int virDomainGetState (
333
+ # int virDomainGetState (
334
334
  # virDomainPtr domain,
335
335
  # int *state,
336
336
  # int *reason,
@@ -343,12 +343,12 @@ module Libvirt
343
343
  # )
344
344
  attach_function :virDomainGetName, [:pointer], :string
345
345
 
346
- # int virDomainGetMaxVcpus (
346
+ # int virDomainGetMaxVcpus (
347
347
  # virDomainPtr domain
348
348
  # )
349
349
  attach_function :virDomainGetMaxVcpus, [:pointer], :int
350
350
 
351
- # int virDomainGetVcpus (
351
+ # int virDomainGetVcpus (
352
352
  # virDomainPtr domain,
353
353
  # virVcpuInfoPtr info,
354
354
  # int maxinfo,
@@ -357,18 +357,18 @@ module Libvirt
357
357
  # )
358
358
  attach_function :virDomainGetVcpus, [:pointer, :pointer, :int, :pointer, :int], :int
359
359
 
360
- # int virDomainGetUUIDString (
360
+ # int virDomainGetUUIDString (
361
361
  # virDomainPtr domain,
362
362
  # char * buf
363
363
  # )
364
364
  attach_function :virDomainGetUUIDString, [:pointer, :pointer], :int
365
365
 
366
- # unsigned long virDomainGetMaxMemory (
366
+ # unsigned long virDomainGetMaxMemory (
367
367
  # virDomainPtr domain
368
368
  # )
369
369
  attach_function :virDomainGetMaxMemory, [:pointer], :ulong
370
370
 
371
- # char *virDomainGetXMLDesc (
371
+ # char *virDomainGetXMLDesc (
372
372
  # virDomainPtr domain,
373
373
  # unsigned int flags
374
374
  # )
@@ -382,7 +382,7 @@ module Libvirt
382
382
  # )
383
383
  attach_function :virDomainScreenshot, [:pointer, :pointer, :uint, :uint], :strptr
384
384
 
385
- # typedef int (*virConnectDomainEventCallback) (
385
+ # typedef int (*virConnectDomainEventCallback) (
386
386
  # virConnectPtr conn,
387
387
  # virDomainPtr dom,
388
388
  # int event,
@@ -411,7 +411,7 @@ module Libvirt
411
411
  :pointer
412
412
  ], :void
413
413
 
414
- # typedef void (*virConnectDomainEventWatchdogCallback) (
414
+ # typedef void (*virConnectDomainEventWatchdogCallback) (
415
415
  # virConnectPtr conn,
416
416
  # virDomainPtr dom,
417
417
  # int action,
@@ -441,7 +441,7 @@ module Libvirt
441
441
  :pointer
442
442
  ], :void
443
443
 
444
- # typedef void (*virConnectDomainEventGraphicsCallback) (
444
+ # typedef void (*virConnectDomainEventGraphicsCallback) (
445
445
  # virConnectPtr conn,
446
446
  # virDomainPtr dom,
447
447
  # int phase,
@@ -462,7 +462,7 @@ module Libvirt
462
462
  :pointer
463
463
  ], :void
464
464
 
465
- # typedef void (*virConnectDomainEventIOErrorReasonCallback) (
465
+ # typedef void (*virConnectDomainEventIOErrorReasonCallback) (
466
466
  # virConnectPtr conn,
467
467
  # virDomainPtr dom,
468
468
  # const char * srcPath,
@@ -481,7 +481,7 @@ module Libvirt
481
481
  :pointer
482
482
  ], :void
483
483
 
484
- # typedef void (*virConnectDomainEventBlockJobCallback) (
484
+ # typedef void (*virConnectDomainEventBlockJobCallback) (
485
485
  # virConnectPtr conn,
486
486
  # virDomainPtr dom,
487
487
  # const char * disk,
@@ -498,7 +498,7 @@ module Libvirt
498
498
  :pointer
499
499
  ], :void
500
500
 
501
- # typedef void (*virConnectDomainEventDiskChangeCallback) (
501
+ # typedef void (*virConnectDomainEventDiskChangeCallback) (
502
502
  # virConnectPtr conn,
503
503
  # virDomainPtr dom,
504
504
  # const char * oldSrcPath,
@@ -517,7 +517,7 @@ module Libvirt
517
517
  :pointer
518
518
  ], :void
519
519
 
520
- # typedef void (*virConnectDomainEventTrayChangeCallback) (
520
+ # typedef void (*virConnectDomainEventTrayChangeCallback) (
521
521
  # virConnectPtr conn,
522
522
  # virDomainPtr dom,
523
523
  # const char * devAlias,
@@ -532,7 +532,7 @@ module Libvirt
532
532
  :pointer
533
533
  ], :void
534
534
 
535
- # typedef void (*virConnectDomainEventPMWakeupCallback) (
535
+ # typedef void (*virConnectDomainEventPMWakeupCallback) (
536
536
  # virConnectPtr conn,
537
537
  # virDomainPtr dom,
538
538
  # int reason,
@@ -545,7 +545,7 @@ module Libvirt
545
545
  :pointer
546
546
  ], :void
547
547
 
548
- # typedef void (*virConnectDomainEventPMSuspendCallback) (
548
+ # typedef void (*virConnectDomainEventPMSuspendCallback) (
549
549
  # virConnectPtr conn,
550
550
  # virDomainPtr dom,
551
551
  # int reason,
@@ -558,7 +558,7 @@ module Libvirt
558
558
  :pointer
559
559
  ], :void
560
560
 
561
- # typedef void (*virConnectDomainEventBalloonChangeCallback) (
561
+ # typedef void (*virConnectDomainEventBalloonChangeCallback) (
562
562
  # virConnectPtr conn,
563
563
  # virDomainPtr dom,
564
564
  # unsigned long long actual,
@@ -571,7 +571,7 @@ module Libvirt
571
571
  :pointer
572
572
  ], :void
573
573
 
574
- # typedef void (*virConnectDomainEventPMSuspendDiskCallback) (
574
+ # typedef void (*virConnectDomainEventPMSuspendDiskCallback) (
575
575
  # virConnectPtr conn,
576
576
  # virDomainPtr dom,
577
577
  # int reason,
@@ -584,7 +584,7 @@ module Libvirt
584
584
  :pointer
585
585
  ], :void
586
586
 
587
- # typedef void (*virConnectDomainEventDeviceRemovedCallback) (
587
+ # typedef void (*virConnectDomainEventDeviceRemovedCallback) (
588
588
  # virConnectPtr conn,
589
589
  # virDomainPtr dom,
590
590
  # const char * devAlias,
@@ -597,7 +597,7 @@ module Libvirt
597
597
  :pointer
598
598
  ], :void
599
599
 
600
- # typedef void (*virConnectDomainEventTunableCallback) (
600
+ # typedef void (*virConnectDomainEventTunableCallback) (
601
601
  # virConnectPtr conn,
602
602
  # virDomainPtr dom,
603
603
  # virTypedParameterPtr params,
@@ -612,7 +612,7 @@ module Libvirt
612
612
  :pointer
613
613
  ], :void
614
614
 
615
- # typedef void (*virConnectDomainEventAgentLifecycleCallback) (
615
+ # typedef void (*virConnectDomainEventAgentLifecycleCallback) (
616
616
  # virConnectPtr conn,
617
617
  # virDomainPtr dom,
618
618
  # int state,
@@ -627,7 +627,7 @@ module Libvirt
627
627
  :pointer
628
628
  ], :void
629
629
 
630
- # typedef void (*virConnectDomainEventDeviceAddedCallback) (
630
+ # typedef void (*virConnectDomainEventDeviceAddedCallback) (
631
631
  # virConnectPtr conn,
632
632
  # virDomainPtr dom,
633
633
  # const char * devAlias,
@@ -640,7 +640,7 @@ module Libvirt
640
640
  :pointer
641
641
  ], :void
642
642
 
643
- # typedef void (*virConnectDomainEventMigrationIterationCallback) (
643
+ # typedef void (*virConnectDomainEventMigrationIterationCallback) (
644
644
  # virConnectPtr conn,
645
645
  # virDomainPtr dom,
646
646
  # int iteration,
@@ -653,7 +653,7 @@ module Libvirt
653
653
  :pointer
654
654
  ], :void
655
655
 
656
- # typedef void (*virConnectDomainEventJobCompletedCallback) (
656
+ # typedef void (*virConnectDomainEventJobCompletedCallback) (
657
657
  # virConnectPtr conn,
658
658
  # virDomainPtr dom,
659
659
  # virTypedParameterPtr params,
@@ -668,7 +668,7 @@ module Libvirt
668
668
  :pointer
669
669
  ], :void
670
670
 
671
- # typedef void (*virConnectDomainEventDeviceRemovalFailedCallback) (
671
+ # typedef void (*virConnectDomainEventDeviceRemovalFailedCallback) (
672
672
  # virConnectPtr conn,
673
673
  # virDomainPtr dom,
674
674
  # const char * devAlias,
@@ -681,7 +681,7 @@ module Libvirt
681
681
  :pointer
682
682
  ], :void
683
683
 
684
- # typedef void (*virConnectDomainEventMetadataChangeCallback) (
684
+ # typedef void (*virConnectDomainEventMetadataChangeCallback) (
685
685
  # virConnectPtr conn,
686
686
  # virDomainPtr dom,
687
687
  # int type,
@@ -696,7 +696,7 @@ module Libvirt
696
696
  :pointer
697
697
  ], :void
698
698
 
699
- # typedef void (*virConnectDomainEventBlockThresholdCallback) (
699
+ # typedef void (*virConnectDomainEventBlockThresholdCallback) (
700
700
  # virConnectPtr conn,
701
701
  # virDomainPtr dom,
702
702
  # const char * dev,
@@ -715,53 +715,53 @@ module Libvirt
715
715
  :pointer
716
716
  ], :void
717
717
 
718
- # int virDomainReboot (
718
+ # int virDomainReboot (
719
719
  # virDomainPtr domain,
720
720
  # unsigned int flags
721
721
  # )
722
722
  attach_function :virDomainReboot, [:pointer, :uint], :int
723
723
 
724
- # int virDomainShutdownFlags (
724
+ # int virDomainShutdownFlags (
725
725
  # virDomainPtr domain,
726
726
  # unsigned int flags
727
727
  # )
728
728
  attach_function :virDomainShutdownFlags, [:pointer, :shutdown_flags], :int
729
729
 
730
- # int virDomainDestroyFlags (
730
+ # int virDomainDestroyFlags (
731
731
  # virDomainPtr domain,
732
732
  # unsigned int flags
733
733
  # )
734
734
  attach_function :virDomainDestroyFlags, [:pointer, :uint], :int
735
735
 
736
- # int virDomainReset (
736
+ # int virDomainReset (
737
737
  # virDomainPtr domain,
738
738
  # unsigned int flags
739
739
  # )
740
740
  attach_function :virDomainReset, [:pointer, :uint], :int
741
741
 
742
- # int virDomainSuspend (
742
+ # int virDomainSuspend (
743
743
  # virDomainPtr domain
744
744
  # )
745
745
  attach_function :virDomainSuspend, [:pointer], :int
746
746
 
747
- # int virDomainResume (
747
+ # int virDomainResume (
748
748
  # virDomainPtr domain
749
749
  # )
750
750
  attach_function :virDomainResume, [:pointer], :int
751
751
 
752
- # int virDomainCreateWithFlags (
752
+ # int virDomainCreateWithFlags (
753
753
  # virDomainPtr domain,
754
754
  # unsigned int flags
755
755
  # )
756
756
  attach_function :virDomainCreateWithFlags, [:pointer, :uint], :int
757
757
 
758
- # int virDomainManagedSave (
758
+ # int virDomainManagedSave (
759
759
  # virDomainPtr dom,
760
760
  # unsigned int flags
761
761
  # )
762
762
  attach_function :virDomainManagedSave, [:pointer, :save_restore_flags], :int
763
763
 
764
- # int virDomainUndefineFlags (
764
+ # int virDomainUndefineFlags (
765
765
  # virDomainPtr domain,
766
766
  # unsigned int flags
767
767
  # )
@@ -774,7 +774,7 @@ module Libvirt
774
774
  # )
775
775
  attach_function :virDomainDefineXMLFlags, [:pointer, :string, :uint], :pointer
776
776
 
777
- # int virDomainSetMetadata (
777
+ # int virDomainSetMetadata (
778
778
  # virDomainPtr domain,
779
779
  # int type,
780
780
  # const char * metadata,
@@ -801,6 +801,18 @@ module Libvirt
801
801
  # )
802
802
  attach_function :virDomainIsPersistent, [:pointer], :int
803
803
 
804
+ # int virDomainGetAutostart (
805
+ # virDomainPtr domain,
806
+ # int * autostart
807
+ # )
808
+ attach_function :virDomainGetAutostart, [:pointer, :pointer], :int
809
+
810
+ # int virDomainSetAutostart (
811
+ # virDomainPtr domain,
812
+ # int autostart
813
+ # )
814
+ attach_function :virDomainSetAutostart, [:pointer, :int], :int
815
+
804
816
  # Converts detail from lifecycle callback from integer to symbol name.
805
817
  # @param event [Symbol] enum :event_type (virDomainEventType)
806
818
  # @param detail [Integer]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Libvirt
4
- VERSION = '0.6.2'
4
+ VERSION = '0.7.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libvirt_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi