-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement Ceph multiple pools and tests #167
base: master
Are you sure you want to change the base?
Conversation
@@ -346,13 +346,13 @@ def to_xml | |||
|
|||
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_pool"]&.split(",")&.include?(volume.pool_name) |
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.
I'd prefer to fix this up in read_ceph_args
so you don't do this in a loop. Same below for the monitor. Perhaps also add in .map(&:strip)
so you can also use spaces between the values while you're at it.
Another thing is that libvirt_ceph_pools
suggests it's singular while so perhaps store the result of that as libvirt_ceph_pools
to indicate it's an array?
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.
Ok ! I have updated the branch to move the split and verify keys in the read_ceph_args.
@@ -363,7 +363,7 @@ def to_xml | |||
end | |||
end | |||
|
|||
xml.target(:dev => target_device, :bus => args["bus_type"] == "virtio" ? "virtio" : "scsi") | |||
xml.target(:dev => target_device, :bus => ceph_args["bus_type"] == "virtio" ? "virtio" : "scsi") |
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.
I merged this separate so it properly closed the issue. Doing 2 different things (fixing a bug and adding a new feature) in the same commit is something I prefer to avoid.
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.
Ok, I haven't seen the fix when I have started to work on it. I will rebase the merge on it.
51d0a00
to
cb6c1cb
Compare
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.
I think it would be good to have some fallback code for compatibility. If libvirt_ceph_pools
isn't present, check for libvirt_ceph_pool
and present it as libvirt_ceph_pools
in ceph_args
. I'm not sure if there's a deprecation mechanism, but it would be good to consider that too.
end | ||
|
||
puts args |
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.
This looks like debug code
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.
Oups. I will remove that :)
value = pair[1] | ||
args[key] = value | ||
key = pair[0].strip | ||
if valid_keys.include?(key) |
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.
if path == '/etc/foreman/ceph.conf' | ||
return true | ||
else | ||
return RealFile.file(path) | ||
end |
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.
To remove some RuboCop concerns, perhaps reduce it to
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.
@@ -470,7 +470,10 @@ def read_ceph_args(path = "/etc/foreman/ceph.conf") | |||
end | |||
end | |||
|
|||
puts args | |||
if args.has_key?("libvirt_ceph_pool") |
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.
I'd be tempted to only read libvirt_ceph_pool
if libvirt_ceph_pools
isn't set. The presence of libvirt_ceph_pools
IMHO indicates a user has migrated to the newer format. Then only read libvirt_ceph_pool
as a fallback. Would you agree?
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.
Okay. I think it's more of a transitive way of managing both at the same time. But in the end, you're right.
Hello,
Following the issue #162, I have implemented the capability to handle multiple Ceph RBD Pool by using a comma-separated list on the ceph.conf file.
Regarding the Libvirt documentation, the host tag must be in the source tag and not after. I have fix them also.
I have also implemented the tests to handle the Ceph part by using a mock of the File object.
Feel free if you have questions