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

Support publish VM #95

Merged
merged 1 commit into from
Oct 2, 2017
Merged

Conversation

masayag
Copy link
Contributor

@masayag masayag commented Sep 14, 2017

Creating a template from a VM is supported by RHV since forever.
The PR introduces a new dialog to allow the creation of a template from
a VM, including the ability to seal a template (for non-windows vms).

https://bugzilla.redhat.com/show_bug.cgi?id=1373076

Screenshots of the new dialog:
Request tab:
publish_vm_request_tab

Purpose tab:
image

Catalog tab:
publish_vm_catalog_tab

Environment tab:
publish_vm_environment_tab

Schedule tab:
publish_vm_schedule_tab

Due to a limitation of RHV, when specifying a storage domain, all of the template's disks will be created on the specified storage domain (while on RHV the user can specify storage domain per disk)

@masayag
Copy link
Contributor Author

masayag commented Sep 14, 2017

source.with_provider_connection(VERSION_HASH) do |connection|
template = template_service_by_href(phase_context[:new_vm_ems_ref], connection).get
status = template.status
logger.info("The Template being cloned is #{status}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be "Cloned template status is #{status}"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The supported values are: ok, illegal, locked, so they fit for the message format, however, I"ll change it to better fit.

@@ -437,6 +490,10 @@ def cluster_from_href(href, connection)
connection.system_service.clusters_service.cluster_service(uuid_from_href(href)).get
end

def storage_from_href(href, connection)
Copy link
Contributor

Choose a reason for hiding this comment

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

We already fetch storage domain in different place. I think that we start to have similar responsibilities in inventory and ovirt_services. In my opinion there is no need to have two distinct object having the same responsibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we'd might access RHV from different places of the provider. We can think of introducing a class that will be responsible for interacting between the provider to RHV via v4, I'm not sure this is the PR to introduce such.

We should first get into agreement if we'd prefer that method over letting each workflow/scenario interact independently using the engine's connection.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not saying that we should fix it in this PR. I am saying that we already have similar code in different place. I think it would be better to define responsibilities of the classes we use to talk to the engine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll track refactoring of ovirt_services and querying of engine's request by issue #100

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks

@@ -476,6 +533,11 @@ def vm_service_by_href(href, connection)
connection.system_service.vms_service.vm_service(vm_uuid)
end

def template_service_by_href(href, connection)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here


def prepare_clone_options
if source.template?
vm_clone_options
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add some comment here. I was puzzled by this code because I see is_templare => true then do vm. I noticed similar code in line 80 where comment helped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. I've start looking into the 'clone vm' workflow and encountered that using the source.template? will have to be replaced by a different method to identify the existing flow.

With the current PR, we're reusing the same workflow entity for add vm and add template. However, in 'clone vm' both source and destination are vms. I'll handle it as part of 'clone vm' PR.

I'll add comment here as well.

_log.info("Destination image locked; re-queuing")
requeue_phase
else
message = "Starting New #{destination_type} Customization"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we use capital letter for "new" and "customization"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

developer excuses #211: "it was like that before"

seems like other providers (vmware and microsoft) have the exact message (with the capitals)

return nil unless seal

if get_source_vm.platform == 'windows'
_("Template Sealing is supported only for non-Windows OS.")
Copy link
Contributor

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 have "sealing" starting with capital letter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Creating a template from a VM is supported by RHV since forever.
The PR introduces a new dialog to allow the creation of a template from
a VM, including the ability to seal a template (for non-windows vms).

https://bugzilla.redhat.com/show_bug.cgi?id=1373076
@miq-bot
Copy link
Member

miq-bot commented Sep 28, 2017

Checked commit masayag@87e61e7 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
7 files checked, 0 offenses detected
Everything looks fine. 🏆

@pkliczewski
Copy link
Contributor

@masayag code climate noticed duplication. It seems not that hard to have one method. What do you think?

@pkliczewski
Copy link
Contributor

Based on my conversation with @masayag we will ignore codeclimate for now.

@oourfali oourfali merged commit 1ce5615 into ManageIQ:master Oct 2, 2017
@agrare agrare added this to the Sprint 70 Ending Oct 2, 2017 milestone Oct 2, 2017
@masayag masayag deleted the support_publish_vm branch June 27, 2018 20:27
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants