-
Notifications
You must be signed in to change notification settings - Fork 43
Implement Ceph multiple pools and tests #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,13 +346,13 @@ | |
|
|
||
| volumes.each_with_index do |volume, index| | ||
| target_device = "vd#{('a'..'z').to_a[index]}" | ||
| if ceph_args && volume.pool_name.include?(ceph_args["libvirt_ceph_pool"]) | ||
| if ceph_args && ceph_args["libvirt_ceph_pools"]&.include?(volume.pool_name) | ||
| xml.disk(:type => "network", :device => "disk") do | ||
| xml.driver(:name => "qemu", :type => volume.format_type, :cache => "writeback", :discard => "unmap") | ||
| xml.source(:protocol => "rbd", :name => volume.path) | ||
|
|
||
| ceph_args["monitor"]&.split(",")&.each do |monitor| | ||
| xml.host(:name => monitor, :port => ceph_args["port"]) | ||
| xml.source(:protocol => "rbd", :name => volume.path) do | ||
| ceph_args["monitor"]&.each do |monitor| | ||
| xml.host(:name => monitor, :port => ceph_args["port"]) | ||
| end | ||
| end | ||
|
|
||
| xml.auth(:username => ceph_args["auth_username"]) do | ||
|
|
@@ -458,13 +458,20 @@ | |
|
|
||
| args = {} | ||
|
|
||
| valid_keys = ["monitor", "port", "libvirt_ceph_pools", "auth_username", "auth_uuid", "bus_type"] | ||
|
Check warning on line 461 in lib/fog/libvirt/models/compute/server.rb
|
||
| array_values = ["monitor", "libvirt_ceph_pools"] | ||
|
|
||
| File.readlines(path).each do |line| | ||
| pair = line.strip.split("=") | ||
| key = pair[0] | ||
| value = pair[1] | ||
| args[key] = value | ||
| key = pair[0].strip | ||
| if valid_keys.include?(key) | ||
| value = array_values.include?(key) ? pair[1].split(',').map(&:strip) : pair[1].strip | ||
| args[key] = value | ||
| end | ||
| end | ||
|
|
||
| puts args | ||
|
||
|
|
||
| args | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,10 +1,50 @@ | ||||||||||||||
| RealFile = File | ||||||||||||||
| class FakeFile < RealFile | ||||||||||||||
| def self.file?(path) | ||||||||||||||
| if path == '/etc/foreman/ceph.conf' | ||||||||||||||
|
Check warning on line 4 in tests/libvirt/models/compute/server_tests.rb
|
||||||||||||||
| return true | ||||||||||||||
|
Check warning on line 5 in tests/libvirt/models/compute/server_tests.rb
|
||||||||||||||
| else | ||||||||||||||
| return RealFile.file(path) | ||||||||||||||
|
Check warning on line 7 in tests/libvirt/models/compute/server_tests.rb
|
||||||||||||||
| end | ||||||||||||||
|
||||||||||||||
| if path == '/etc/foreman/ceph.conf' | |
| return true | |
| else | |
| return RealFile.file(path) | |
| end | |
| path == '/etc/foreman/ceph.conf' || RealFile.file(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ! I will change that. I'm more used to developing in Python than in Ruby.
Check warning on line 12 in tests/libvirt/models/compute/server_tests.rb
GitHub Actions / runner / rubocop
[rubocop] reported by reviewdog 🐶
Use a guard clause (`return RealFile.readlines(path) unless path == '/etc/foreman/ceph.conf'`) instead of wrapping the code inside a conditional expression.
Raw Output:
tests/libvirt/models/compute/server_tests.rb:12:5: C: Style/GuardClause: Use a guard clause (`return RealFile.readlines(path) unless path == '/etc/foreman/ceph.conf'`) instead of wrapping the code inside a conditional expression.
Check warning on line 13 in tests/libvirt/models/compute/server_tests.rb
GitHub Actions / runner / rubocop
[rubocop] reported by reviewdog 🐶
Redundant `return` detected.
Raw Output:
tests/libvirt/models/compute/server_tests.rb:13:7: C: Style/RedundantReturn: Redundant `return` detected.
Check warning on line 22 in tests/libvirt/models/compute/server_tests.rb
GitHub Actions / runner / rubocop
[rubocop] reported by reviewdog 🐶
Redundant `return` detected.
Raw Output:
tests/libvirt/models/compute/server_tests.rb:22:7: C: Style/RedundantReturn: Redundant `return` detected.
Check warning on line 141 in tests/libvirt/models/compute/server_tests.rb
GitHub Actions / runner / rubocop
[rubocop] reported by reviewdog 🐶
Trailing whitespace detected.
Raw Output:
tests/libvirt/models/compute/server_tests.rb:141:1: C: Layout/TrailingWhitespace: Trailing whitespace detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to limit this? Wouldn't it be safe to just parse everything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configuration file can contains some comments or extra lines. So I think it's better to only import configuration line respecting a minimal schema.