virt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/host_test.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'test/test_helper'
2
+
3
+ class Virt::HostTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ hostname = "h01.sat.lab"
7
+ uri = "qemu+ssh://root@#{hostname}/system"
8
+ @host = Virt.connect(uri).host
9
+ end
10
+
11
+ def test_should_have_a_name
12
+ assert_kind_of String, @host.name
13
+ end
14
+
15
+ def test_should_return_running_guests
16
+ assert_kind_of Virt::Guest, @host.running_guests.first
17
+ end
18
+
19
+ def test_should_return_defined_guests
20
+ assert_kind_of Virt::Guest, @host.defined_guests.first
21
+ end
22
+
23
+ def test_should_return_interfaces
24
+ assert @host.interfaces
25
+ end
26
+
27
+ def test_should_return_networks
28
+ assert @host.networks
29
+ end
30
+
31
+ def test_should_return_a_storage_pool
32
+ assert_kind_of Virt::Pool, @host.storage_pool("default")
33
+ end
34
+
35
+ def test_should_return_storage_pools
36
+ assert @host.storage_pools
37
+ end
38
+
39
+ def test_should_return_volumes
40
+ assert @host.volumes
41
+ end
42
+
43
+ end
@@ -0,0 +1,16 @@
1
+ require 'test/test_helper'
2
+
3
+ class Virt::InterfaceTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ hostname = "h01.sat.lab"
7
+ uri = "qemu+ssh://root@#{hostname}/system"
8
+ Virt.connect(uri)
9
+ @interface = Virt::Interface.new()
10
+ end
11
+
12
+ def test_should_be_new
13
+ assert @interface.new?
14
+ end
15
+
16
+ end
data/test/pool_test.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'test/test_helper'
2
+
3
+ class Virt::PoolTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ hostname = "h01.sat.lab"
7
+ uri = "qemu+ssh://root@#{hostname}/system"
8
+ host = Virt.connect(uri).host
9
+ @pool = Virt::Pool.new({:name => host.storage_pools.first.name})
10
+ end
11
+
12
+ def test_pool_should_not_be_new
13
+ assert !@pool.new?
14
+ end
15
+
16
+ def test_pool_should_have_volumes
17
+ assert @pool.volumes
18
+ end
19
+
20
+ def test_find_vol_by_name
21
+ assert_kind_of Libvirt::StorageVol, @pool.find_volume_by_name(@pool.volumes.first)
22
+ end
23
+
24
+ def test_should_not_find_unknown_volumes
25
+ assert !@pool.find_volume_by_name("no such name")
26
+ end
27
+
28
+ def test_find_vol_by_key
29
+ vol = @pool.find_volume_by_name(@pool.volumes.first)
30
+ new_vol = @pool.find_volume_by_key(vol.key)
31
+ # we cant compare the object themselfs, as libvirt returns a new object each time.
32
+ assert_equal vol.key, new_vol.key
33
+ end
34
+
35
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift *Dir["#{File.dirname(__FILE__)}/../lib"]
2
+ require "test/unit"
3
+ require "virt"
@@ -0,0 +1,28 @@
1
+ require 'test/test_helper'
2
+
3
+ class Virt::VolumeTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ hostname = "h01.sat.lab"
7
+ uri = "qemu+ssh://root@#{hostname}/system"
8
+ Virt.connect(uri)
9
+ @vol = Virt::Volume.new({:name => "mytestvol-#{Time.now}"})
10
+ end
11
+
12
+ def test_should_be_new
13
+ assert @vol.new?
14
+ end
15
+
16
+ def test_should_create_volume
17
+ assert @vol.save
18
+ @vol.destroy
19
+ end
20
+
21
+ def test_should_destroy_volume
22
+ assert @vol.save
23
+ assert @vol.destroy
24
+ end
25
+
26
+
27
+
28
+ end
data/virt.gemspec ADDED
@@ -0,0 +1,83 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{virt}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ohad Levy"]
12
+ s.date = %q{2011-01-31}
13
+ s.description = %q{Simplied interface to use ruby the libvirt ruby library}
14
+ s.email = %q{ohadlevy@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/virt.rb",
28
+ "lib/virt/connection.rb",
29
+ "lib/virt/guest.rb",
30
+ "lib/virt/host.rb",
31
+ "lib/virt/interface.rb",
32
+ "lib/virt/pool.rb",
33
+ "lib/virt/util.rb",
34
+ "lib/virt/volume.rb",
35
+ "templates/guest.xml.erb",
36
+ "templates/volume.xml.erb",
37
+ "test/connection_test.rb",
38
+ "test/guest_test.rb",
39
+ "test/host_test.rb",
40
+ "test/interface_test.rb",
41
+ "test/pool_test.rb",
42
+ "test/test_helper.rb",
43
+ "test/volume_test.rb",
44
+ "virt.gemspec"
45
+ ]
46
+ s.homepage = %q{https://github.com/ohadlevy/virt}
47
+ s.licenses = ["GPLv3"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = %q{1.3.7}
50
+ s.summary = %q{Simple to use ruby interface to libvirt}
51
+ s.test_files = [
52
+ "test/connection_test.rb",
53
+ "test/guest_test.rb",
54
+ "test/host_test.rb",
55
+ "test/interface_test.rb",
56
+ "test/pool_test.rb",
57
+ "test/test_helper.rb",
58
+ "test/volume_test.rb"
59
+ ]
60
+
61
+ if s.respond_to? :specification_version then
62
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
63
+ s.specification_version = 3
64
+
65
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
66
+ s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
67
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
68
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
69
+ s.add_development_dependency(%q<rcov>, [">= 0.9.8"])
70
+ else
71
+ s.add_dependency(%q<shoulda>, [">= 2.11.3"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
73
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
74
+ s.add_dependency(%q<rcov>, [">= 0.9.8"])
75
+ end
76
+ else
77
+ s.add_dependency(%q<shoulda>, [">= 2.11.3"])
78
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
80
+ s.add_dependency(%q<rcov>, [">= 0.9.8"])
81
+ end
82
+ end
83
+
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: virt
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Ohad Levy
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-31 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ name: shoulda
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 37
30
+ segments:
31
+ - 2
32
+ - 11
33
+ - 3
34
+ version: 2.11.3
35
+ requirement: *id001
36
+ type: :development
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ name: bundler
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 23
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 0
50
+ version: 1.0.0
51
+ requirement: *id002
52
+ type: :development
53
+ - !ruby/object:Gem::Dependency
54
+ prerelease: false
55
+ name: jeweler
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 7
62
+ segments:
63
+ - 1
64
+ - 5
65
+ - 2
66
+ version: 1.5.2
67
+ requirement: *id003
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ prerelease: false
71
+ name: rcov
72
+ version_requirements: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 43
78
+ segments:
79
+ - 0
80
+ - 9
81
+ - 8
82
+ version: 0.9.8
83
+ requirement: *id004
84
+ type: :development
85
+ description: Simplied interface to use ruby the libvirt ruby library
86
+ email: ohadlevy@gmail.com
87
+ executables: []
88
+
89
+ extensions: []
90
+
91
+ extra_rdoc_files:
92
+ - LICENSE.txt
93
+ - README.rdoc
94
+ files:
95
+ - .document
96
+ - Gemfile
97
+ - Gemfile.lock
98
+ - LICENSE.txt
99
+ - README.rdoc
100
+ - Rakefile
101
+ - VERSION
102
+ - lib/virt.rb
103
+ - lib/virt/connection.rb
104
+ - lib/virt/guest.rb
105
+ - lib/virt/host.rb
106
+ - lib/virt/interface.rb
107
+ - lib/virt/pool.rb
108
+ - lib/virt/util.rb
109
+ - lib/virt/volume.rb
110
+ - templates/guest.xml.erb
111
+ - templates/volume.xml.erb
112
+ - test/connection_test.rb
113
+ - test/guest_test.rb
114
+ - test/host_test.rb
115
+ - test/interface_test.rb
116
+ - test/pool_test.rb
117
+ - test/test_helper.rb
118
+ - test/volume_test.rb
119
+ - virt.gemspec
120
+ has_rdoc: true
121
+ homepage: https://github.com/ohadlevy/virt
122
+ licenses:
123
+ - GPLv3
124
+ post_install_message:
125
+ rdoc_options: []
126
+
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
146
+ version: "0"
147
+ requirements: []
148
+
149
+ rubyforge_project:
150
+ rubygems_version: 1.3.7
151
+ signing_key:
152
+ specification_version: 3
153
+ summary: Simple to use ruby interface to libvirt
154
+ test_files:
155
+ - test/connection_test.rb
156
+ - test/guest_test.rb
157
+ - test/host_test.rb
158
+ - test/interface_test.rb
159
+ - test/pool_test.rb
160
+ - test/test_helper.rb
161
+ - test/volume_test.rb