Bug 1937960 - Cannot provision VM from image in Azure that has plan info
Summary: Cannot provision VM from image in Azure that has plan info
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Documentation
Version: 6.8.0
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: Unspecified
Assignee: Marie Hornickova
QA Contact:
URL: https://projects.theforeman.org/issue...
Whiteboard:
: 1992092 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-11 19:29 UTC by Chris Roberts
Modified: 2024-04-04 17:19 UTC (History)
22 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-08 19:19:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32076 0 Normal New Cannot provision VM from image in Azure that has plan info 2022-06-02 14:44:24 UTC
Red Hat Bugzilla 1826340 1 unspecified CLOSED [RFE] Ability to provision a VM using Red Hat Gold BYOS images 2023-12-15 17:44:12 UTC
Red Hat Knowledge Base (Solution) 6961347 0 None None None 2022-05-31 15:38:19 UTC

Description Chris Roberts 2021-03-11 19:29:00 UTC
Description of problem:


Version-Release number of selected component (if applicable):
Satellite 6.8
tfm-rubygem-ms_rest_azure-0.11.1-2.el7sat.noarch
tfm-rubygem-foreman_azure_rm-2.1.2-1.fm2_1.el7sat.noarch
tfm-rubygem-azure_mgmt_compute-0.18.7-1.el7sat.noarch
tfm-rubygem-azure_mgmt_network-0.19.0-1.el7sat.noarch
tfm-rubygem-azure_mgmt_storage-0.17.10-1.el7sat.noarch
tfm-rubygem-azure_mgmt_subscriptions-0.18.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_azure_rm-0.2.0-1.el7sat.noarch
tfm-rubygem-azure_mgmt_resources-0.17.6-1.el7sat.noarch

How reproducible:


Steps to Reproduce:
1. Create Azure Compute Resource and create Image that is mapped to an image in Azure with plan info
2. Try to build a host
3. Error

Actual results:

Failed to create a compute VMAZURE (Azure Resource Manager) instance vm.example.com: { "message": "Long running operation failed with status Failed", "request": { "base_uri": "https://management.azure.com", "path_template": "https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxx/providers/Microsoft.Compute/locations/eastus2/operations/f762f41a-6a64-49ff-ae31-71ee6d23e8ac?api-version=2019-03-01", "method": "get", "path_params": null, "skip_encoding_path_params": null, "query_params": null, "skip_encoding_query_params": null, "headers": { "Content-Type": "application/json; charset=utf-8", "Accept": "application/json", "accept-language": "en-US", "x-ms-client-request-id": "9423959a-e8df-4754-a42e-f25b00a31a1e" }, "body": null, "middlewares": [ [ "MsRest::RetryPolicyMiddleware", { "times": 3, "retry": 0.02 } ], [ "cookie_jar" ] ], "log": null }, "response": { "body": "{\r\n \"startTime\": \"2021-03-02T19:25:01.9399099+00:00\",\r\n \"endTime\": \"2021-03-02T19:25:05.9869235+00:00\",\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"VMMarketplaceInvalidInput\",\r\n \"message\": \"Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/xxxxxxxxxxxxxxxxx/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm'.\"\r\n },\r\n \"name\": \"f762f41a-6a64-49ff-ae31-71ee6d23e8ac\"\r\n}", "headers": { "Cache-Control": "no-cache", "Pragma": "no-cache", "Content-Length": "557", "Content-Type": "application/json; charset=utf-8", "Expires": "-1", "x-ms-ratelimit-remaining-resource": "Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29994", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "x-ms-request-id": "4f9821c6-0ccc-4873-865d-e2db38525911", "Server": "Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0", "x-ms-ratelimit-remaining-subscription-reads": "11999", "x-ms-correlation-request-id": "72c8d906-6624-4c9d-9059-fa816591d3e5", "x-ms-routing-request-id": "CENTRALUS:20210302T192532Z:72c8d906-6624-4c9d-9059-fa816591d3e5", "X-Content-Type-Options": "nosniff", "Date": "Tue, 02 Mar 2021 19:25:32 GMT" }, "status": 200 } }

Expected results:

VM to build without errors

Additional info:

Screenshots are in case of VM params with plan info and shared image gallery info. 

We do have support in the Azure Ruby SDK for plans, it looks like we just need to add it in the plugin.

ttps://github.com/Azure/azure-sdk-for-ruby/blob/master/management/azure_mgmt_compute/lib/2019-12-01/generated/azure_mgmt_compute.rb
---
autoload :ImagePurchasePlan,                                  '2019-12-01/generated/azure_mgmt_compute/models/image_purchase_plan.rb'
autoload :PurchasePlan,                                       '2019-12-01/generated/azure_mgmt_compute/models/purchase_plan.rb'

Comment 1 Chris Roberts 2021-03-11 19:33:35 UTC
Forgot to add Description of problem:

If you create an image of a marketplace VM in a shared image gallery that contains plan info from the marketplace, Satellite cannot build the VM because we do not send off the plan info. If you create the VM in the Azure portal it works fine. 

Comment from customer in the case:

I just wanted to check to see if there was any update yet?  This is getting critical for us to be able to provision in Azure via Satellite.

Comment 5 Jitendra Yejare 2021-08-11 10:31:04 UTC
*** Bug 1992092 has been marked as a duplicate of this bug. ***

Comment 10 Bryan Kearney 2021-11-04 13:50:14 UTC
Upstream bug assigned to chrobert

Comment 11 Jitendra Yejare 2021-11-08 14:30:41 UTC
qe_test_coverage+ as this bug is covered in https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/cli/test_computeresource_azurerm.py#L616 .

Comment 15 Chris Roberts 2021-12-07 17:33:21 UTC
So it does look like we have plan info in the Azure plugin:

app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:      def marketplace_image_plan(image)
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        image_plan = ComputeModels::PurchasePlan.new
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        image_plan.publisher = publisher.downcase
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        image_plan.name = sku.downcase
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        image_plan.product = offer.downcase
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        image_plan
app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb:        vm_params.plan = marketplace_image_plan(vm_hash[:image_id])

I wonder if we just are not using it correctly, it looks like the MSFT SDK also has support for it:

azure_sdk/lib/latest/modules/compute_profile_module.rb:        ImagePurchasePlan = Azure::Compute::Mgmt::V2019_12_01::Models::ImagePurchasePlan
azure_sdk/lib/latest/modules/compute_profile_module.rb:        Plan = Azure::Compute::Mgmt::V2020_06_01::Models::Plan
azure_sdk/lib/latest/modules/compute_profile_module.rb:        PurchasePlan = Azure::Compute::Mgmt::V2020_06_01::Models::PurchasePlan

https://samcogan.com/creating-vms-from-a-marketplace-image-that-needs-a-plan

Comment 17 Chris Roberts 2022-03-04 14:28:25 UTC
Hi Team,

We are making progress on this, I got past the error saying vm needs plan info to a new one saying you need to accept the terms and subscriptions before you can use the vm, so I got it to send the plan info over. I am working on this error and syncing up with another engineer who will be helping Monday as he will be helping as well.

I will keep you posted as we make more progress, but so far we got past the initial error so we should have a soultion soon.

- Chris Roberts

Comment 31 Chris Roberts 2022-06-08 19:19:38 UTC
Hi Everyone,

This issue is resolved with this KCS:

https://access.redhat.com/solutions/6961347

If you need further help, please open a support ticket.

- Chris Roberts


Note You need to log in before you can comment on or make changes to this bug.