Skip to content
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

Introduce virtualization manager #16721

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

masayag
Copy link
Contributor

@masayag masayag commented Dec 31, 2017

In order to support kubevirt as a secondary manager of the
openshift/kubevirt provider, a new virtualization manager mixin is added to introduce it.

The corresponding PR of the container providers is ManageIQ/manageiq-providers-kubernetes#197

@masayag
Copy link
Contributor Author

masayag commented Dec 31, 2017

@miq-bot add_labels providers/containers, gaprindashvili/no, wip

@miq-bot miq-bot changed the title Introduce virtualization manager [WIP] Introduce virtualization manager Dec 31, 2017
@cben
Copy link
Contributor

cben commented Dec 31, 2017

cc @moolitayer @zeari

@moolitayer
Copy link

moolitayer commented Jan 1, 2018

@masayag

  • Does a container manager always have a virtualization manager?
  • Can that change during the lifecycle of the container manager? (e.g created without a virtualization manager but then edited to have one)

:foreign_key => :parent_ems_id,
:class_name => "ManageIQ::Providers::Kubevirt::InfraManager",
:autosave => true,
:dependent => :destroy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@masayag
Copy link
Contributor Author

masayag commented Jan 1, 2018

@moolitayer

Does a container manager always have a virtualization manager?

No, only if kubevirt was deployed (or any potential future virtualization manager)

Can that change during the lifecycle of the container manager? (e.g created without a virtualization manager but then edited to have one)

Yes, I don't see a reason not to support that option. Kubevirt can be deployed on top of an existing kubernetes cluster and to expose the virtualization capabilities.

@masayag
Copy link
Contributor Author

masayag commented Jan 2, 2018

@moolitayer
Copy link

Yes, I don't see a reason not to support that option. Kubevirt can be deployed on top of an existing kubernetes cluster and to expose the virtualization capabilities.

OK in that case the implementation would have to change according to #16635

You will see that if you add a kubevirt endpoint through the API the new manager isn't created.

I will come see you later today

@masayag
Copy link
Contributor Author

masayag commented Jan 2, 2018

OK in that case the implementation would have to change according to #16635

You will see that if you add a kubevirt endpoint through the API the new manager isn't created.

I will come see you later today

@moolitayer I'm aware of that - noticed the behavior of kubevirt endpoints and authentication are left behind once the kubevirt provider is removed. That prevents the kubevirt provider from being added again.

Also - added a comment about it to ManageIQ/manageiq-providers-kubernetes#197:

This PR depends on #16721 and should be updated once #16635 is merged.

hence, the wip label on this PR.

@zeari
Copy link

zeari commented Jan 4, 2018

@masayag #16635 was merged

@masayag
Copy link
Contributor Author

masayag commented Jan 4, 2018

@zeari thanks - I was looking at it closely :-)

I'll start adapting this PR and ManageIQ/manageiq-providers-kubernetes#197 based on it.

@moolitayer
Copy link

@masayag how do the virt manager PRs change the dependency between repos?
(manageiq-providers-kubevirt is depending on manageiq-providers-kubernetes? we would want to add the dependency explicitly)

@masayag
Copy link
Contributor Author

masayag commented Jan 11, 2018

@masayag how do the virt manager PRs change the dependency between repos?
(manageiq-providers-kubevirt is depending on manageiq-providers-kubernetes? we would want to add the dependency explicitly)

@moolitayer that dependency should be defined on the manageiq-providers-kubevirt repository only, right ?

@@ -433,7 +433,7 @@ def self.ems_physical_infra_discovery_types

def disable!
_log.info("Disabling EMS [#{name}] id [#{id}].")
update!(:enabled => false)
update_attribute("enabled", false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeari @moolitayer I had to change this since without it, when an endpoint is destroyed, the callback to remove the virtualization provider is triggered. At that point of time there isn't an endpoint for the provider and the validations invoked by update_attribute("enabled", false) i.e. hostname_format_valid? fails since there is no endpoint to fetch the hostname from.

Copy link

@zeari zeari Jan 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this. It doesnt always look like it in the code but the contianers provider is valid if it has a default endpoint. So when actually using UI\API you should never end up with that hostname issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeari thanks for the hint - this change is not required.

@masayag masayag changed the title [WIP] Introduce virtualization manager Introduce virtualization manager Jan 14, 2018
@masayag
Copy link
Contributor Author

masayag commented Jan 14, 2018

@miq-bot remove_label wip

@masayag
Copy link
Contributor Author

masayag commented Jan 15, 2018

@agrare Could you review please ?


def ensure_virtualization_manager
if virtualization_manager.nil?
build_virtualization_manager(:parent_manager => self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this (build_virtualization_manager) defined? I don't see it in any of the three PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare it's rails method, the name was chosen to reflect the nature of that sub-provider, in the same sense as monitoring_manager was chosen for https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/has_monitoring_manager_mixin.rb#L22

The purpose of 'virtualization_manager' is to reflect the ability to serve virtual machines by a container provider, by that secondary provider.

If this doesn't make sense to you, I'll modify it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but in that case there actually is a manager type called MonitoringManager (https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/monitoring_manager.rb). This should match the type of manager that is being added.

@agrare
Copy link
Member

agrare commented Jan 15, 2018

Should be infra_manager everywhere here, not virtualization_manager. It is confusing to see has_virtualization_manager when that doesn't actually exist. I agree that we can do better than infra_manager for a name but this makes it more confusing.

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The association and mixin should all match the name of the manager that is being created

@@ -46,6 +47,11 @@ class ContainerManager < BaseManager
has_many :all_container_images, :foreign_key => :ems_id, :dependent => :destroy, :class_name => "ContainerImage"
has_many :all_container_nodes, :foreign_key => :ems_id, :dependent => :destroy, :class_name => "ContainerNode"

has_one :virtualization_manager,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be has_one :infra_manager

@@ -46,6 +47,11 @@ class ContainerManager < BaseManager
has_many :all_container_images, :foreign_key => :ems_id, :dependent => :destroy, :class_name => "ContainerImage"
has_many :all_container_nodes, :foreign_key => :ems_id, :dependent => :destroy, :class_name => "ContainerNode"

has_one :virtualization_manager,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to have a Provider that has multiple managers / ext_management_systems, rather than a manager that has a manager?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ContainerManager already follows the CloudManager pattern with the monitoring_manager so we would need to move that as well.

The CloudManager really drove this and most providers already use it, might make more sense to deal with this at a higher level across all the providers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭 I thought Openstack was the only one doing this

In order to support kubevirt as a secondary manager of the
openshift/kubevirt provider, a new mixin is added to represent that
capability.
@masayag
Copy link
Contributor Author

masayag commented Jan 16, 2018

@agrare fixed according to your comments.

@miq-bot
Copy link
Member

miq-bot commented Jan 16, 2018

Checked commit masayag@8ffb88c with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 1 offense detected

app/models/manageiq/providers/container_manager.rb

@agrare agrare merged commit 257ae38 into ManageIQ:master Jan 17, 2018
@agrare agrare added this to the Sprint 78 Ending Jan 29, 2018 milestone Jan 17, 2018
@masayag masayag deleted the virtualization_manager branch June 27, 2018 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants