-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to support kubevirt as a secondary manager of the openshift/kubevirt provider, a new mixin is added to represent that capability.
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module HasVirtualizationManagerMixin | ||
extend ActiveSupport::Concern | ||
|
||
def virtualization_endpoint_created(role) | ||
if role == "kubevirt" && virtualization_manager.nil? | ||
virtualization_manager = ensure_virtualization_manager | ||
virtualization_manager.save | ||
end | ||
end | ||
|
||
def virtualization_endpoint_destroyed(role) | ||
if role == "kubevirt" && virtualization_manager.present? | ||
virtualization_manager.destroy_queue | ||
end | ||
end | ||
|
||
private | ||
|
||
def ensure_virtualization_manager | ||
if virtualization_manager.nil? | ||
build_virtualization_manager(:parent_manager => self, | ||
:name => "#{name} Virtualization Manager", | ||
:zone_id => zone_id, | ||
:provider_region => provider_region) | ||
end | ||
|
||
virtualization_manager | ||
end | ||
end |