Hide Forgot
Description of problem: In section 1.2.2 of the link[1], uploading dynamic size image does not work as Azure requires fixed size image. The process to convert dynamic VHD to fixed is documented on Mojo[2]. Is it possible to include content in Mojo[2] in official doc? Version-Release number of selected component (if applicable): CF-4.1 Additional info: [1] https://access.redhat.com/documentation/en/red-hat-cloudforms/4.1/paged/installing-red-hat-cloudforms-on-microsoft-azure/ [2] https://mojo.redhat.com/docs/DOC-1089560 Document URL: Section Number and Name: Describe the issue: Suggestions for improvement: Additional information:
The statement regarding using powershell is incorrect. I upload images every other build for a year. Here is the powershell that doesn't require any pre-conversion to a Fixed type: # Video Demo Script - Upload VHD to Azure $myazurename = "MyAccount" $myazurepwd = ConvertTo-SecureString "MyPassword" -AsPlainText -Force $azcreds = New-Object System.Management.Automation.PSCredential ($myazurename, $myazurepwd) Login-AzureRMAccount -Credential $azcreds Get-AzureRmSubscription -SubscriptionId "MySubscriptionID" -TenantId "MyTenantID" | Select-AzureRmSubscription $ResourceGroupName = "Automation" $BlobLocation = "https://cfmeautopay.blob.core.windows.net/" $BlobContainer = "templates" $BlobName = "cfme-azure-5.7.0.9-1.x86_64.vhd" $BlobDestination = $BlobLocation + $BlobContainer + "/" + $BlobName $LocalFilePath = "C:\tmp\" $LocalFileName = "cfme-azure-5.7.0.9-1.x86_64.vhd" $LocalFile = $LocalFilePath + $LocalFileName Add-AzureRmVhd -ResourceGroupName $ResourceGroupName -Destination $BlobDestination -LocalFilePath $LocalFile -NumberOfUploaderThreads 8 There is also a method I used to use which converted the VHD image to Fixed AND and exact multiple of megabytes. It uses PowerShell to Fix the disk and the upload it, but it really isn't necessary (or fast) but is required it you wish to upload using the CLI: $BlobLocation = "https://cfmeqe.blob.core.windows.net/" $BlobContainer = "templates" $BlobName = "cfme-azure-560" $BlobDestination = $BlobLocation + $BlobContainer + "/" + $BlobName $LocalFilePath = "C:\tmp\" $SourceVHD = "cfme560-via-cli.vhd" $LocalFileName = "cfme560-via-cli" $LocalFile = $LocalFilePath + $LocalFileName + ".vhd" Convert-VHD -Path 'c:\tmp\cfme560-via-cli.vhd' -DestinationPath 'c:\tmp\cfme560-fixed' -VHDType Fixed Resize-VHD -Path $LocalFile -SizeByte 44040192000 Add-AzureRmVhd -ResourceGroupName cfmeqe -Destination $BlobDestination -LocalFilePath $LocalFile -NumberOfUploaderThreads 8 And finally, upload by CLI: azure storage blob upload -a cfmeqestore -k "mystoragekey" -t page --file 'C:\tmp\cfme560-fixed.vhd' --container 'templates' --blob 'cfme560-fixed' Please let me know how I can help turn this into more useful documentation so that we can get everybody who is stuck back on track.
I stand corrected. In classic mode there was an exact megabyte restriction. For the last 14 months, resource mode has not enforced that. However, I ran the same script today I've been using for quite some time and it failed with ErrorText : { "Details": [], "InnerError": null, "Code": "InvalidVhd", "Message": "The VHD for disk 'cfme-azure-57013' with blob https://cfmeautopay.blob.core.windows.net/vhds/cfme-azure-57013.vhd has an unsupported virtua The size must be a whole number in (MBs).", "Target": null } So, I'll have to rewrite the conversion/upload script and resubmit the comment. Sorry for the confusion, but Azure does change things from time to time.
So, this is the answer. You can convert with any tool you like. I'm only showing powershell. Then I used the CLI to upload it. #Must have HyperV Enabled #Must have installed Azure Powershell Modules $myazurename = "MyAccount" $myazurepwd = ConvertTo-SecureString "MyPassword" -AsPlainText -Force $azcreds = New-Object System.Management.Automation.PSCredential ($myazurename, $myazurepwd) Login-AzureRMAccount -Credential $azcreds Get-AzureRmSubscription -SubscriptionId "MySubscription" -TenantId "MyTenantId" | Select-AzureRmSubscription $ResourceGroupName = "MyResourceGropu" $LocalFilePath = "C:\tmp\" $LocalFileName = "cfme-azure-5.7.0.13-1.x86_64" $LocalFile = $LocalFilePath + $LocalFileName + '.vhd' $FixedFile = $LocalFilePath + $LocalFileName + '-f.vhd' $BlobLocation = "https://cfmeautopay.blob.core.windows.net/" $BlobContainer = "templates" $BlobName = $LocalFile $BlobDestination = $BlobLocation + $BlobContainer + "/" + $BlobName Convert-VHD -Path $LocalFile -DestinationPath $FixedFile -VHDType Fixed # Resize just needs to be rounded up to the next whole exact megabyte # http://www.whatsabyte.com/P1/byteconverter.htm Resize-VHD -Path $FixedFile -SizeByte 44040192000 # Azure X-Plat CLI azure storage blob upload -a cfmeautopay -k "MyStorageKey" -t page --file "c:\tmp\cfme-azure-5.7.0.13-1.x86_64-f.vhd" --container 'templates' --blob "cfme-azure-5.7.0.13-1.x86_64.vhd"