ruby-libvirt 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS CHANGED
@@ -1,3 +1,19 @@
1
+ 2011-07-27 0.4.0
2
+ * Updated Domain class, implementing dom.memory_parameters=,
3
+ dom.memory_parameters, dom.updated?, dom.migrate2, dom.migrate_to_uri2,
4
+ dom.migrate_set_max_speed, dom.qemu_monitor_command, dom.blkio_parameters,
5
+ dom.blkio_parameters=, dom.state, dom.open_console, dom.screenshot, and
6
+ dom.inject_nmi
7
+ * Implementation of the Stream class, which covers the libvirt virStream APIs
8
+ * Add the ability to build against non-system libvirt libraries
9
+ * Updated Error object, which now includes the libvirt code, component and
10
+ level of the error, as well as all of the error constants from libvirt.h
11
+ * Updated Connect class, implementing conn.sys_info, conn.stream,
12
+ conn.interface_change_begin, conn.interface_change_commit, and
13
+ conn.interface_change_rollback
14
+ * Updated StorageVol class, implementing vol.download and vol.upload
15
+ * Various bugfixes
16
+
1
17
  2010-12-12 0.3.0
2
18
  * Implementation of Libvirt::open_auth, Libvirt::event_register_impl
3
19
  * Updated Connect class, implementing conn.compare_cpu, conn.baseline_cpu,
data/README CHANGED
@@ -27,16 +27,13 @@ toplevel of your source checkout):
27
27
 
28
28
  Notes
29
29
  -----
30
- As of December 12, 2010, the ruby-libvirt bindings support all of the libvirt
31
- APIs up to libvirt commit hash e8d05c978da774b7abbbc38dfcc00b9b582fdf72
30
+ As of June 24, 2011, the ruby-libvirt bindings support all of the libvirt
31
+ APIs up to libvirt commit hash 2c5ded6e8269463d2daab3dfa0ecae1477730ee2
32
32
  with the following exceptions:
33
33
 
34
34
  - virConnectRef
35
35
  - virDomainGetConnect
36
36
  - virDomainRef
37
- - virDomainSetMemoryParameters
38
- - virDomainGetMemoryParameters
39
- - virDomainIsUpdated
40
37
  - virDomainOpenConsole
41
38
  - virNetworkGetConnect
42
39
  - virNetworkRef
@@ -49,16 +46,7 @@ with the following exceptions:
49
46
  - virNodeDeviceRef
50
47
  - virSecretGetConnect
51
48
  - virSecretRef
52
- - virStreamNew
53
49
  - virStreamRef
54
- - virStreamSend
55
- - virStreamRecv
56
- - virStreamSendAll
57
- - virStreamRecvAll
58
- - virStreamEventAddCallback
59
- - virStreamEventUpdateCallback
60
- - virStreamEventRemoveCallback
61
- - virStreamFinish
62
- - virStreamAbort
63
- - virStreamFree
64
50
  - virNWFilterRef
51
+ - virEventRegisterDefaultImpl
52
+ - virEventRunDefaultImpl
data/README.rdoc CHANGED
@@ -25,3 +25,4 @@ The various *Ptr types in Libvirt map loosely to the following Ruby classes:
25
25
  [virStorageVolInfoPtr] Libvirt::StorageVolInfo
26
26
  [virSecretPtr] Libvirt::Secret
27
27
  [virInterfacePtr] Libvirt::Interface
28
+ [virStreamPtr] Libvirt::Stream
data/Rakefile CHANGED
@@ -13,9 +13,10 @@ require 'rake/clean'
13
13
  require 'rake/rdoctask'
14
14
  require 'rake/testtask'
15
15
  require 'rake/gempackagetask'
16
+ require 'rbconfig'
16
17
 
17
18
  PKG_NAME='ruby-libvirt'
18
- PKG_VERSION='0.3.0'
19
+ PKG_VERSION='0.4.0'
19
20
 
20
21
  EXT_CONF='ext/libvirt/extconf.rb'
21
22
  MAKEFILE="ext/libvirt/Makefile"
@@ -39,50 +40,92 @@ CLOBBER.include [ "config.save", "ext/**/mkmf.log", "ext/**/extconf.h",
39
40
  #
40
41
  file MAKEFILE => EXT_CONF do |t|
41
42
  Dir::chdir(File::dirname(EXT_CONF)) do
42
- unless sh "ruby #{File::basename(EXT_CONF)}"
43
- $stderr.puts "Failed to run extconf"
44
- break
45
- end
43
+ extra = ""
44
+ args = ARGV.grep(/^--with-libvirt-include=/)
45
+ extra += args[0].chomp unless args.empty?
46
+ args = ARGV.grep(/^--with-libvirt-lib=/)
47
+ extra += " " + args[0].chomp unless args.empty?
48
+
49
+ unless sh "ruby #{File::basename(EXT_CONF)} #{extra}"
50
+ $stderr.puts "Failed to run extconf"
51
+ break
52
+ end
46
53
  end
47
54
  end
48
55
  file LIBVIRT_MODULE => LIBVIRT_SRC do |t|
49
56
  Dir::chdir(File::dirname(EXT_CONF)) do
50
- unless sh "make"
51
- $stderr.puts "make failed"
52
- break
53
- end
57
+ unless sh "make"
58
+ $stderr.puts "make failed"
59
+ break
60
+ end
54
61
  end
55
62
  end
56
63
  desc "Build the native library"
57
64
  task :build => LIBVIRT_MODULE
58
65
 
66
+ #
67
+ # Test task
68
+ #
69
+
59
70
  Rake::TestTask.new(:test) do |t|
60
- t.test_files = [ 'tests/test_conn.rb', 'tests/test_domain.rb', 'tests/test_interface.rb', 'tests/test_network.rb', 'tests/test_nodedevice.rb', 'tests/test_nwfilter.rb', 'tests/test_open.rb', 'tests/test_secret.rb', 'tests/test_storage.rb' ]
71
+ t.test_files = [ 'tests/test_conn.rb', 'tests/test_domain.rb',
72
+ 'tests/test_interface.rb', 'tests/test_network.rb',
73
+ 'tests/test_nodedevice.rb', 'tests/test_nwfilter.rb',
74
+ 'tests/test_open.rb', 'tests/test_secret.rb',
75
+ 'tests/test_storage.rb' ]
61
76
  t.libs = [ 'lib', 'ext/libvirt' ]
62
77
  end
63
78
  task :test => :build
64
79
 
80
+ #
81
+ # Documentation tasks
82
+ #
83
+
84
+ RDOC_FILES = FileList[ "README.rdoc", "lib/libvirt.rb",
85
+ "ext/libvirt/_libvirt.c", "ext/libvirt/connect.c",
86
+ "ext/libvirt/domain.c", "ext/libvirt/interface.c",
87
+ "ext/libvirt/network.c", "ext/libvirt/nodedevice.c",
88
+ "ext/libvirt/nwfilter.c", "ext/libvirt/secret.c",
89
+ "ext/libvirt/storage.c", "ext/libvirt/stream.c" ]
90
+
65
91
  Rake::RDocTask.new do |rd|
66
92
  rd.main = "README.rdoc"
67
93
  rd.rdoc_dir = "doc/site/api"
68
- rd.rdoc_files.include("README.rdoc", "lib/libvirt.rb", ["ext/libvirt/_libvirt.c", "ext/libvirt/connect.c", "ext/libvirt/domain.c", "ext/libvirt/interface.c", "ext/libvirt/network.c", "ext/libvirt/nodedevice.c", "ext/libvirt/nwfilter.c", "ext/libvirt/secret.c", "ext/libvirt/storage.c"])
94
+ rd.rdoc_files.include(RDOC_FILES)
95
+ end
96
+
97
+ Rake::RDocTask.new(:ri) do |rd|
98
+ rd.main = "README.rdoc"
99
+ rd.rdoc_dir = "doc/ri"
100
+ rd.options << "--ri-system"
101
+ rd.rdoc_files.include(RDOC_FILES)
102
+ end
103
+
104
+ #
105
+ # Splint task
106
+ #
107
+
108
+ task :splint => [ MAKEFILE ] do |t|
109
+ Dir::chdir(File::dirname(EXT_CONF)) do
110
+ unless sh "splint -I" + Config::CONFIG['vendorarchdir'] + " *.c"
111
+ $stderr.puts "Failed to run splint"
112
+ break
113
+ end
114
+ end
69
115
  end
70
116
 
71
117
  #
72
118
  # Package tasks
73
119
  #
74
120
 
75
- PKG_FILES = FileList[
76
- "Rakefile", "COPYING", "README", "NEWS", "README.rdoc",
77
- "lib/**/*.rb",
78
- "ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
79
- "tests/**/*",
80
- "spec/**/*"
81
- ]
121
+ PKG_FILES = FileList[ "Rakefile", "COPYING", "README", "NEWS", "README.rdoc",
122
+ "lib/**/*.rb",
123
+ "ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
124
+ "tests/**/*",
125
+ "spec/**/*" ]
82
126
 
83
- DIST_FILES = FileList[
84
- "pkg/*.src.rpm", "pkg/*.gem", "pkg/*.zip", "pkg/*.tgz"
85
- ]
127
+ DIST_FILES = FileList[ "pkg/*.src.rpm", "pkg/*.gem", "pkg/*.zip",
128
+ "pkg/*.tgz" ]
86
129
 
87
130
  SPEC = Gem::Specification.new do |s|
88
131
  s.name = PKG_NAME
@@ -95,9 +138,7 @@ SPEC = Gem::Specification.new do |s|
95
138
  s.extensions = "ext/libvirt/extconf.rb"
96
139
  s.author = "David Lutterkort, Chris Lalancette"
97
140
  s.rubyforge_project = "None"
98
- s.description = <<EOF
99
- Provides bindings for libvirt.
100
- EOF
141
+ s.description = "Ruby bindings for libvirt."
101
142
  end
102
143
 
103
144
  Rake::GemPackageTask.new(SPEC) do |pkg|
@@ -33,6 +33,7 @@
33
33
  #include "nwfilter.h"
34
34
  #include "interface.h"
35
35
  #include "domain.h"
36
+ #include "stream.h"
36
37
 
37
38
  static VALUE c_libvirt_version;
38
39
 
@@ -141,7 +142,7 @@ static int libvirt_auth_callback_wrapper(virConnectCredentialPtr cred,
141
142
  for (i = 0; i < ncred; i++) {
142
143
  newcred = rb_hash_new();
143
144
 
144
- rb_hash_aset(newcred, rb_str_new2("type"), INT2FIX(cred[i].type));
145
+ rb_hash_aset(newcred, rb_str_new2("type"), INT2NUM(cred[i].type));
145
146
  rb_hash_aset(newcred, rb_str_new2("prompt"),
146
147
  rb_str_new2(cred[i].prompt));
147
148
  if (cred[i].challenge)
@@ -452,10 +453,10 @@ static int internal_add_handle_func(int fd, int events,
452
453
  /* call out to the ruby object */
453
454
  if (strcmp(rb_obj_classname(add_handle), "Symbol") == 0)
454
455
  res = rb_funcall(rb_class_of(add_handle), rb_to_id(add_handle), 3,
455
- INT2FIX(fd), INT2FIX(events), rubyargs);
456
+ INT2NUM(fd), INT2NUM(events), rubyargs);
456
457
  else if (strcmp(rb_obj_classname(add_handle), "Proc") == 0)
457
- res = rb_funcall(add_handle, rb_intern("call"), 3, INT2FIX(fd),
458
- INT2FIX(events), rubyargs);
458
+ res = rb_funcall(add_handle, rb_intern("call"), 3, INT2NUM(fd),
459
+ INT2NUM(events), rubyargs);
459
460
  else
460
461
  rb_raise(rb_eTypeError,
461
462
  "wrong add handle callback argument type (expected Symbol or Proc)");
@@ -471,10 +472,10 @@ static void internal_update_handle_func(int watch, int event) {
471
472
  /* call out to the ruby object */
472
473
  if (strcmp(rb_obj_classname(update_handle), "Symbol") == 0)
473
474
  rb_funcall(rb_class_of(update_handle), rb_to_id(update_handle), 2,
474
- INT2FIX(watch), INT2FIX(event));
475
+ INT2NUM(watch), INT2NUM(event));
475
476
  else if (strcmp(rb_obj_classname(update_handle), "Proc") == 0)
476
- rb_funcall(update_handle, rb_intern("call"), 2, INT2FIX(watch),
477
- INT2FIX(event));
477
+ rb_funcall(update_handle, rb_intern("call"), 2, INT2NUM(watch),
478
+ INT2NUM(event));
478
479
  else
479
480
  rb_raise(rb_eTypeError,
480
481
  "wrong update handle callback argument type (expected Symbol or Proc)");
@@ -490,9 +491,9 @@ static int internal_remove_handle_func(int watch) {
490
491
  /* call out to the ruby object */
491
492
  if (strcmp(rb_obj_classname(remove_handle), "Symbol") == 0)
492
493
  res = rb_funcall(rb_class_of(remove_handle), rb_to_id(remove_handle),
493
- 1, INT2FIX(watch));
494
+ 1, INT2NUM(watch));
494
495
  else if (strcmp(rb_obj_classname(remove_handle), "Proc") == 0)
495
- res = rb_funcall(remove_handle, rb_intern("call"), 1, INT2FIX(watch));
496
+ res = rb_funcall(remove_handle, rb_intern("call"), 1, INT2NUM(watch));
496
497
  else
497
498
  rb_raise(rb_eTypeError,
498
499
  "wrong remove handle callback argument type (expected Symbol or Proc)");
@@ -537,9 +538,9 @@ static int internal_add_timeout_func(int interval, virEventTimeoutCallback cb,
537
538
  /* call out to the ruby object */
538
539
  if (strcmp(rb_obj_classname(add_timeout), "Symbol") == 0)
539
540
  res = rb_funcall(rb_class_of(add_timeout), rb_to_id(add_timeout), 2,
540
- INT2FIX(interval), rubyargs);
541
+ INT2NUM(interval), rubyargs);
541
542
  else if (strcmp(rb_obj_classname(add_timeout), "Proc") == 0)
542
- res = rb_funcall(add_timeout, rb_intern("call"), 2, INT2FIX(interval),
543
+ res = rb_funcall(add_timeout, rb_intern("call"), 2, INT2NUM(interval),
543
544
  rubyargs);
544
545
  else
545
546
  rb_raise(rb_eTypeError,
@@ -556,10 +557,10 @@ static void internal_update_timeout_func(int timer, int timeout) {
556
557
  /* call out to the ruby object */
557
558
  if (strcmp(rb_obj_classname(update_timeout), "Symbol") == 0)
558
559
  rb_funcall(rb_class_of(update_timeout), rb_to_id(update_timeout), 2,
559
- INT2FIX(timer), INT2FIX(timeout));
560
+ INT2NUM(timer), INT2NUM(timeout));
560
561
  else if (strcmp(rb_obj_classname(update_timeout), "Proc") == 0)
561
- rb_funcall(update_timeout, rb_intern("call"), 2, INT2FIX(timer),
562
- INT2FIX(timeout));
562
+ rb_funcall(update_timeout, rb_intern("call"), 2, INT2NUM(timer),
563
+ INT2NUM(timeout));
563
564
  else
564
565
  rb_raise(rb_eTypeError,
565
566
  "wrong update timeout callback argument type (expected Symbol or Proc)");
@@ -575,9 +576,9 @@ static int internal_remove_timeout_func(int timer) {
575
576
  /* call out to the ruby object */
576
577
  if (strcmp(rb_obj_classname(remove_timeout), "Symbol") == 0)
577
578
  res = rb_funcall(rb_class_of(remove_timeout), rb_to_id(remove_timeout),
578
- 1, INT2FIX(timer));
579
+ 1, INT2NUM(timer));
579
580
  else if (strcmp(rb_obj_classname(remove_timeout), "Proc") == 0)
580
- res = rb_funcall(remove_timeout, rb_intern("call"), 1, INT2FIX(timer));
581
+ res = rb_funcall(remove_timeout, rb_intern("call"), 1, INT2NUM(timer));
581
582
  else
582
583
  rb_raise(rb_eTypeError,
583
584
  "wrong remove timeout callback argument type (expected Symbol or Proc)");
@@ -730,6 +731,233 @@ void Init__libvirt() {
730
731
 
731
732
  rb_define_attr(e_Error, "libvirt_function_name", 1, 0);
732
733
  rb_define_attr(e_Error, "libvirt_message", 1, 0);
734
+ rb_define_attr(e_Error, "libvirt_code", 1, 0);
735
+ rb_define_attr(e_Error, "libvirt_component", 1, 0);
736
+ rb_define_attr(e_Error, "libvirt_level", 1, 0);
737
+
738
+ /* libvirt error components (domains) */
739
+ rb_define_const(e_Error, "FROM_NONE", INT2NUM(VIR_FROM_NONE));
740
+ rb_define_const(e_Error, "FROM_XEN", INT2NUM(VIR_FROM_XEN));
741
+ rb_define_const(e_Error, "FROM_XEND", INT2NUM(VIR_FROM_XEND));
742
+ rb_define_const(e_Error, "FROM_XENSTORE", INT2NUM(VIR_FROM_XENSTORE));
743
+ rb_define_const(e_Error, "FROM_SEXPR", INT2NUM(VIR_FROM_SEXPR));
744
+ rb_define_const(e_Error, "FROM_XML", INT2NUM(VIR_FROM_XML));
745
+ rb_define_const(e_Error, "FROM_DOM", INT2NUM(VIR_FROM_DOM));
746
+ rb_define_const(e_Error, "FROM_RPC", INT2NUM(VIR_FROM_RPC));
747
+ rb_define_const(e_Error, "FROM_PROXY", INT2NUM(VIR_FROM_PROXY));
748
+ rb_define_const(e_Error, "FROM_CONF", INT2NUM(VIR_FROM_CONF));
749
+ rb_define_const(e_Error, "FROM_QEMU", INT2NUM(VIR_FROM_QEMU));
750
+ rb_define_const(e_Error, "FROM_NET", INT2NUM(VIR_FROM_NET));
751
+ rb_define_const(e_Error, "FROM_TEST", INT2NUM(VIR_FROM_TEST));
752
+ rb_define_const(e_Error, "FROM_REMOTE", INT2NUM(VIR_FROM_REMOTE));
753
+ rb_define_const(e_Error, "FROM_OPENVZ", INT2NUM(VIR_FROM_OPENVZ));
754
+ #if HAVE_CONST_VIR_FROM_VMWARE
755
+ rb_define_const(e_Error, "FROM_VMWARE", INT2NUM(VIR_FROM_VMWARE));
756
+ #endif
757
+ #if HAVE_CONST_VIR_FROM_XENXM
758
+ rb_define_const(e_Error, "FROM_XENXM", INT2NUM(VIR_FROM_XENXM));
759
+ #endif
760
+ #if HAVE_CONST_VIR_FROM_STATS_LINUX
761
+ rb_define_const(e_Error, "FROM_STATS_LINUX", INT2NUM(VIR_FROM_STATS_LINUX));
762
+ #endif
763
+ #if HAVE_TYPE_VIR_FROM_LXC
764
+ rb_define_const(e_Error, "FROM_LXC", INT2NUM(VIR_FROM_LXC));
765
+ #endif
766
+ #if HAVE_TYPE_VIRSTORAGEPOOLPTR
767
+ rb_define_const(e_Error, "FROM_STORAGE", INT2NUM(VIR_FROM_STORAGE));
768
+ #endif
769
+ #if HAVE_CONST_VIR_FROM_NETWORK
770
+ rb_define_const(e_Error, "FROM_NETWORK", INT2NUM(VIR_FROM_NETWORK));
771
+ #endif
772
+ #if HAVE_CONST_VIR_FROM_DOMAIN
773
+ rb_define_const(e_Error, "FROM_DOMAIN", INT2NUM(VIR_FROM_DOMAIN));
774
+ #endif
775
+ #if HAVE_CONST_VIR_FROM_UML
776
+ rb_define_const(e_Error, "FROM_UML", INT2NUM(VIR_FROM_UML));
777
+ #endif
778
+ #if HAVE_TYPE_VIRNODEDEVICEPTR
779
+ rb_define_const(e_Error, "FROM_NODEDEV", INT2NUM(VIR_FROM_NODEDEV));
780
+ #endif
781
+ #if HAVE_CONST_VIR_FROM_XEN_INOTIFY
782
+ rb_define_const(e_Error, "FROM_XEN_INOTIFY", INT2NUM(VIR_FROM_XEN_INOTIFY));
783
+ #endif
784
+ #if HAVE_CONST_VIR_FROM_SECURITY
785
+ rb_define_const(e_Error, "FROM_SECURITY", INT2NUM(VIR_FROM_SECURITY));
786
+ #endif
787
+ #if HAVE_CONST_VIR_FROM_VBOX
788
+ rb_define_const(e_Error, "FROM_VBOX", INT2NUM(VIR_FROM_VBOX));
789
+ #endif
790
+ #if HAVE_TYPE_VIRINTERFACEPTR
791
+ rb_define_const(e_Error, "FROM_INTERFACE", INT2NUM(VIR_FROM_INTERFACE));
792
+ #endif
793
+ #if HAVE_CONST_VIR_FROM_ONE
794
+ rb_define_const(e_Error, "FROM_ONE", INT2NUM(VIR_FROM_ONE));
795
+ #endif
796
+ #if HAVE_CONST_VIR_FROM_ESX
797
+ rb_define_const(e_Error, "FROM_ESX", INT2NUM(VIR_FROM_ESX));
798
+ #endif
799
+ #if HAVE_CONST_VIR_FROM_PHYP
800
+ rb_define_const(e_Error, "FROM_PHYP", INT2NUM(VIR_FROM_PHYP));
801
+ #endif
802
+ #if HAVE_TYPE_VIRSECRETPTR
803
+ rb_define_const(e_Error, "FROM_SECRET", INT2NUM(VIR_FROM_SECRET));
804
+ #endif
805
+ #if HAVE_VIRCONNECTCOMPARECPU
806
+ rb_define_const(e_Error, "FROM_CPU", INT2NUM(VIR_FROM_CPU));
807
+ #endif
808
+ #if HAVE_CONST_VIR_FROM_XENAPI
809
+ rb_define_const(e_Error, "FROM_XENAPI", INT2NUM(VIR_FROM_XENAPI));
810
+ #endif
811
+ #if HAVE_TYPE_VIRNWFILTERPTR
812
+ rb_define_const(e_Error, "FROM_NWFILTER", INT2NUM(VIR_FROM_NWFILTER));
813
+ #endif
814
+ #if HAVE_CONST_VIR_FROM_HOOK
815
+ rb_define_const(e_Error, "FROM_HOOK", INT2NUM(VIR_FROM_HOOK));
816
+ #endif
817
+ #if HAVE_TYPE_VIRDOMAINSNAPSHOTPTR
818
+ rb_define_const(e_Error, "FROM_DOMAIN_SNAPSHOT",
819
+ INT2NUM(VIR_FROM_DOMAIN_SNAPSHOT));
820
+ #endif
821
+ #if HAVE_CONST_VIR_FROM_AUDIT
822
+ rb_define_const(e_Error, "FROM_AUDIT", INT2NUM(VIR_FROM_AUDIT));
823
+ #endif
824
+ #if HAVE_CONST_VIR_FROM_SYSINFO
825
+ rb_define_const(e_Error, "FROM_SYSINFO", INT2NUM(VIR_FROM_SYSINFO));
826
+ #endif
827
+ #if HAVE_CONST_VIR_FROM_STREAMS
828
+ rb_define_const(e_Error, "FROM_STREAMS", INT2NUM(VIR_FROM_STREAMS));
829
+ #endif
830
+
831
+ /* libvirt error codes */
832
+ rb_define_const(e_Error, "ERR_OK", INT2NUM(VIR_ERR_OK));
833
+ rb_define_const(e_Error, "ERR_INTERNAL_ERROR",
834
+ INT2NUM(VIR_ERR_INTERNAL_ERROR));
835
+ rb_define_const(e_Error, "ERR_NO_MEMORY", INT2NUM(VIR_ERR_NO_MEMORY));
836
+ rb_define_const(e_Error, "ERR_NO_SUPPORT", INT2NUM(VIR_ERR_NO_SUPPORT));
837
+ rb_define_const(e_Error, "ERR_UNKNOWN_HOST", INT2NUM(VIR_ERR_UNKNOWN_HOST));
838
+ rb_define_const(e_Error, "ERR_NO_CONNECT", INT2NUM(VIR_ERR_NO_CONNECT));
839
+ rb_define_const(e_Error, "ERR_INVALID_CONN", INT2NUM(VIR_ERR_INVALID_CONN));
840
+ rb_define_const(e_Error, "ERR_INVALID_DOMAIN",
841
+ INT2NUM(VIR_ERR_INVALID_DOMAIN));
842
+ rb_define_const(e_Error, "ERR_INVALID_ARG", INT2NUM(VIR_ERR_INVALID_ARG));
843
+ rb_define_const(e_Error, "ERR_OPERATION_FAILED",
844
+ INT2NUM(VIR_ERR_OPERATION_FAILED));
845
+ rb_define_const(e_Error, "ERR_GET_FAILED", INT2NUM(VIR_ERR_GET_FAILED));
846
+ rb_define_const(e_Error, "ERR_POST_FAILED", INT2NUM(VIR_ERR_POST_FAILED));
847
+ rb_define_const(e_Error, "ERR_HTTP_ERROR", INT2NUM(VIR_ERR_HTTP_ERROR));
848
+ rb_define_const(e_Error, "ERR_SEXPR_SERIAL", INT2NUM(VIR_ERR_SEXPR_SERIAL));
849
+ rb_define_const(e_Error, "ERR_NO_XEN", INT2NUM(VIR_ERR_NO_XEN));
850
+ rb_define_const(e_Error, "ERR_XEN_CALL", INT2NUM(VIR_ERR_XEN_CALL));
851
+ rb_define_const(e_Error, "ERR_OS_TYPE", INT2NUM(VIR_ERR_OS_TYPE));
852
+ rb_define_const(e_Error, "ERR_NO_KERNEL", INT2NUM(VIR_ERR_NO_KERNEL));
853
+ rb_define_const(e_Error, "ERR_NO_ROOT", INT2NUM(VIR_ERR_NO_ROOT));
854
+ rb_define_const(e_Error, "ERR_NO_SOURCE", INT2NUM(VIR_ERR_NO_SOURCE));
855
+ rb_define_const(e_Error, "ERR_NO_TARGET", INT2NUM(VIR_ERR_NO_TARGET));
856
+ rb_define_const(e_Error, "ERR_NO_NAME", INT2NUM(VIR_ERR_NO_NAME));
857
+ rb_define_const(e_Error, "ERR_NO_OS", INT2NUM(VIR_ERR_NO_OS));
858
+ rb_define_const(e_Error, "ERR_NO_DEVICE", INT2NUM(VIR_ERR_NO_DEVICE));
859
+ rb_define_const(e_Error, "ERR_NO_XENSTORE", INT2NUM(VIR_ERR_NO_XENSTORE));
860
+ rb_define_const(e_Error, "ERR_DRIVER_FULL", INT2NUM(VIR_ERR_DRIVER_FULL));
861
+ rb_define_const(e_Error, "ERR_CALL_FAILED", INT2NUM(VIR_ERR_CALL_FAILED));
862
+ rb_define_const(e_Error, "ERR_XML_ERROR", INT2NUM(VIR_ERR_XML_ERROR));
863
+ rb_define_const(e_Error, "ERR_DOM_EXIST", INT2NUM(VIR_ERR_DOM_EXIST));
864
+ rb_define_const(e_Error, "ERR_OPERATION_DENIED",
865
+ INT2NUM(VIR_ERR_OPERATION_DENIED));
866
+ rb_define_const(e_Error, "ERR_OPEN_FAILED", INT2NUM(VIR_ERR_OPEN_FAILED));
867
+ rb_define_const(e_Error, "ERR_READ_FAILED", INT2NUM(VIR_ERR_READ_FAILED));
868
+ rb_define_const(e_Error, "ERR_PARSE_FAILED", INT2NUM(VIR_ERR_PARSE_FAILED));
869
+ rb_define_const(e_Error, "ERR_CONF_SYNTAX", INT2NUM(VIR_ERR_CONF_SYNTAX));
870
+ rb_define_const(e_Error, "ERR_WRITE_FAILED", INT2NUM(VIR_ERR_WRITE_FAILED));
871
+ rb_define_const(e_Error, "ERR_XML_DETAIL", INT2NUM(VIR_ERR_XML_DETAIL));
872
+ rb_define_const(e_Error, "ERR_INVALID_NETWORK",
873
+ INT2NUM(VIR_ERR_INVALID_NETWORK));
874
+ rb_define_const(e_Error, "ERR_NETWORK_EXIST",
875
+ INT2NUM(VIR_ERR_NETWORK_EXIST));
876
+ rb_define_const(e_Error, "ERR_SYSTEM_ERROR", INT2NUM(VIR_ERR_SYSTEM_ERROR));
877
+ rb_define_const(e_Error, "ERR_RPC", INT2NUM(VIR_ERR_RPC));
878
+ rb_define_const(e_Error, "ERR_GNUTLS_ERROR", INT2NUM(VIR_ERR_GNUTLS_ERROR));
879
+ rb_define_const(e_Error, "WAR_NO_NETWORK", INT2NUM(VIR_WAR_NO_NETWORK));
880
+ rb_define_const(e_Error, "ERR_NO_DOMAIN", INT2NUM(VIR_ERR_NO_DOMAIN));
881
+ rb_define_const(e_Error, "ERR_NO_NETWORK", INT2NUM(VIR_ERR_NO_NETWORK));
882
+ rb_define_const(e_Error, "ERR_INVALID_MAC", INT2NUM(VIR_ERR_INVALID_MAC));
883
+ #if HAVE_CONST_VIR_ERR_AUTH_FAILED
884
+ rb_define_const(e_Error, "ERR_AUTH_FAILED", INT2NUM(VIR_ERR_AUTH_FAILED));
885
+ #endif
886
+ #if HAVE_TYPE_VIRSTORAGEPOOLPTR
887
+ rb_define_const(e_Error, "ERR_INVALID_STORAGE_POOL",
888
+ INT2NUM(VIR_ERR_INVALID_STORAGE_POOL));
889
+ rb_define_const(e_Error, "ERR_INVALID_STORAGE_VOL",
890
+ INT2NUM(VIR_ERR_INVALID_STORAGE_VOL));
891
+ rb_define_const(e_Error, "WAR_NO_STORAGE", INT2NUM(VIR_WAR_NO_STORAGE));
892
+ rb_define_const(e_Error, "ERR_NO_STORAGE_POOL",
893
+ INT2NUM(VIR_ERR_NO_STORAGE_POOL));
894
+ rb_define_const(e_Error, "ERR_NO_STORAGE_VOL",
895
+ INT2NUM(VIR_ERR_NO_STORAGE_VOL));
896
+ #endif
897
+ #if HAVE_TYPE_VIRNODEDEVICEPTR
898
+ rb_define_const(e_Error, "WAR_NO_NODE", INT2NUM(VIR_WAR_NO_NODE));
899
+ rb_define_const(e_Error, "ERR_INVALID_NODE_DEVICE",
900
+ INT2NUM(VIR_ERR_INVALID_NODE_DEVICE));
901
+ rb_define_const(e_Error, "ERR_NO_NODE_DEVICE",
902
+ INT2NUM(VIR_ERR_NO_NODE_DEVICE));
903
+ #endif
904
+ #if HAVE_CONST_VIR_ERR_NO_SECURITY_MODEL
905
+ rb_define_const(e_Error, "ERR_NO_SECURITY_MODEL",
906
+ INT2NUM(VIR_ERR_NO_SECURITY_MODEL));
907
+ #endif
908
+ #if HAVE_CONST_VIR_ERR_OPERATION_INVALID
909
+ rb_define_const(e_Error, "ERR_OPERATION_INVALID",
910
+ INT2NUM(VIR_ERR_OPERATION_INVALID));
911
+ #endif
912
+ #if HAVE_TYPE_VIRINTERFACEPTR
913
+ rb_define_const(e_Error, "WAR_NO_INTERFACE", INT2NUM(VIR_WAR_NO_INTERFACE));
914
+ rb_define_const(e_Error, "ERR_NO_INTERFACE", INT2NUM(VIR_ERR_NO_INTERFACE));
915
+ rb_define_const(e_Error, "ERR_INVALID_INTERFACE",
916
+ INT2NUM(VIR_ERR_INVALID_INTERFACE));
917
+ rb_define_const(e_Error, "ERR_MULTIPLE_INTERFACES",
918
+ INT2NUM(VIR_ERR_MULTIPLE_INTERFACES));
919
+ #endif
920
+ #if HAVE_TYPE_VIRNWFILTERPTR
921
+ rb_define_const(e_Error, "WAR_NO_NWFILTER", INT2NUM(VIR_WAR_NO_NWFILTER));
922
+ rb_define_const(e_Error, "ERR_INVALID_NWFILTER",
923
+ INT2NUM(VIR_ERR_INVALID_NWFILTER));
924
+ rb_define_const(e_Error, "ERR_NO_NWFILTER", INT2NUM(VIR_ERR_NO_NWFILTER));
925
+ rb_define_const(e_Error, "ERR_BUILD_FIREWALL",
926
+ INT2NUM(VIR_ERR_BUILD_FIREWALL));
927
+ #endif
928
+ #if HAVE_TYPE_VIRSECRETPTR
929
+ rb_define_const(e_Error, "WAR_NO_SECRET", INT2NUM(VIR_WAR_NO_SECRET));
930
+ rb_define_const(e_Error, "ERR_INVALID_SECRET",
931
+ INT2NUM(VIR_ERR_INVALID_SECRET));
932
+ rb_define_const(e_Error, "ERR_NO_SECRET", INT2NUM(VIR_ERR_NO_SECRET));
933
+ #endif
934
+ #if HAVE_CONST_VIR_ERR_CONFIG_UNSUPPORTED
935
+ rb_define_const(e_Error, "ERR_CONFIG_UNSUPPORTED",
936
+ INT2NUM(VIR_ERR_CONFIG_UNSUPPORTED));
937
+ #endif
938
+ #if HAVE_CONST_VIR_ERR_OPERATION_TIMEOUT
939
+ rb_define_const(e_Error, "ERR_OPERATION_TIMEOUT",
940
+ INT2NUM(VIR_ERR_OPERATION_TIMEOUT));
941
+ #endif
942
+ #if HAVE_CONST_VIR_ERR_MIGRATE_PERSIST_FAILED
943
+ rb_define_const(e_Error, "ERR_MIGRATE_PERSIST_FAILED",
944
+ INT2NUM(VIR_ERR_MIGRATE_PERSIST_FAILED));
945
+ #endif
946
+ #if HAVE_CONST_VIR_ERR_HOOK_SCRIPT_FAILED
947
+ rb_define_const(e_Error, "ERR_HOOK_SCRIPT_FAILED",
948
+ INT2NUM(VIR_ERR_HOOK_SCRIPT_FAILED));
949
+ #endif
950
+ #if HAVE_TYPE_VIRDOMAINSNAPSHOTPTR
951
+ rb_define_const(e_Error, "ERR_INVALID_DOMAIN_SNAPSHOT",
952
+ INT2NUM(VIR_ERR_INVALID_DOMAIN_SNAPSHOT));
953
+ rb_define_const(e_Error, "ERR_NO_DOMAIN_SNAPSHOT",
954
+ INT2NUM(VIR_ERR_NO_DOMAIN_SNAPSHOT));
955
+ #endif
956
+
957
+ /* libvirt levels */
958
+ rb_define_const(e_Error, "LEVEL_NONE", INT2NUM(VIR_ERR_NONE));
959
+ rb_define_const(e_Error, "LEVEL_WARNING", INT2NUM(VIR_ERR_WARNING));
960
+ rb_define_const(e_Error, "LEVEL_ERROR", INT2NUM(VIR_ERR_ERROR));
733
961
 
734
962
  rb_define_module_function(m_libvirt, "version", libvirt_version, -1);
735
963
  rb_define_module_function(m_libvirt, "open", libvirt_open, -1);
@@ -773,6 +1001,7 @@ void Init__libvirt() {
773
1001
  init_nwfilter();
774
1002
  init_interface();
775
1003
  init_domain();
1004
+ init_stream();
776
1005
 
777
1006
  virSetErrorFunc(NULL, rubyLibvirtErrorFunc);
778
1007