Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
Domain spec from XML can load features
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Nov 27, 2010
1 parent 0a9c453 commit ba9a165
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/libvirt/spec/domain.rb
Expand Up @@ -74,6 +74,14 @@ def load!(xml)
end
end

try(root.xpath("//domain/features")) do |result|
self.features = []

result.element_children.each do |feature|
self.features << feature.name.to_sym
end
end

raise_if_unparseables(root.xpath("//domain/*"))
end

Expand Down
5 changes: 5 additions & 0 deletions test/libvirt/spec/domain_test.rb
Expand Up @@ -130,5 +130,10 @@
assert_equal 1, @instance.devices.length
assert_equal :file, @instance.devices.first.type
end

should "parse the features" do
@instance = @klass.new("<domain><features><pae/><acpi/></features></domain>")
assert_equal [:pae, :acpi], @instance.features
end
end
end

0 comments on commit ba9a165

Please sign in to comment.