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

Create VM failing with existing OS disk #10

Closed
puneet101 opened this issue Oct 23, 2016 · 7 comments
Closed

Create VM failing with existing OS disk #10

puneet101 opened this issue Oct 23, 2016 · 7 comments

Comments

@puneet101
Copy link

Using call : azureInstance.virtualMachines().create(creatableVirtualMachine);
with OS disk as:
String vhdImage = "https://cek4dxxmaklzgpooltestzsa.blob.core.windows.net/system/Microsoft.Compute/Images/template/disk2012-osDisk.bf042413-3dc3-4452-a07a-70990191ce43.vhd";

Getting exception:

com.microsoft.azure.CloudException: The blob name in URL https://cek4dxxmaklzgpooltestzsa.blob.core.windows.net/system/Microsoft.Compute/Images/template/disk2012-osDisk.bf042413-3dc3-4452-a07a-70990191ce43.vhd contains a slash. This is presently not supported for disks.: The blob name in URL https://cek4dxxmaklzgpooltestzsa.blob.core.windows.net/system/Microsoft.Compute/Images/template/disk2012-osDisk.bf042413-3dc3-4452-a07a-70990191ce43.vhd contains a slash. This is presently not supported for disks.
at com.microsoft.azure.AzureClient.createExceptionFromResponse(AzureClient.java:521)
at com.microsoft.azure.AzureClient.access$000(AzureClient.java:34)
at com.microsoft.azure.AzureClient$1.call(AzureClient.java:133)
at com.microsoft.azure.AzureClient$1.call(AzureClient.java:130)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:250)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:147)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138)
at rx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:9861)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:221)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

@anuchandy
Copy link
Contributor

There are three ways you can create a VM

  1. Using platform image -
  2. Using Generalized image - withStoredWindowsImage(imageUrl) withStoredLinuxImage(imageUrl)
  3. Using Specialized VHD - withOSDisk(vhdUrl, osType)

The vhd Url (https://cek4dxxmaklzgpooltestzsa.blob.core.windows.net/system/Microsoft.Compute/Images/template/disk2012-osDisk.bf042413-3dc3-4452-a07a-70990191ce43.vhd) you are trying to use is a Generalized image, which you obtained by following below steps:

  1. Logged into the VM and de-provisioned it (this result in VM to be generalized).Generalizing a VM removes all your personal account information, among other things, and prepares the machine to be used as an image.
  2. Executed 'Generalize` API
  3. Executed Capture API

This result is a Generalized image'.

with such Generalized image the option to use is withStoredWindowsImage(imageUrl) withStoredLinuxImage(imageUrl)

I assume you got the error because you are using withOSDisk(string vhdUrl, osType), with vhdUrl pointing to a Generalized image.

If you are looking for creating and using a specialized VHD (which has password and other info embedded). The way to create that is by simply deleting the VM (without deprovision it) and attach the disk to the new VM you are trying to create. Note that it's a Specialized VHD not Specialized Image, this means you cannot create more than one VM from the Specialized VHD, the VHD will be attached to the VM.

Afaik there is nothing like Specialized Image.

@puneet101
Copy link
Author

Thanks Anuchandy! If we upload a vhd from on-prem Hyper-V, what's the best way to create 10 VMs? Are you saying that we can only create one VM with specialized VHD?

What we need is:

  • on-prem VM uploaded to Azure in a storage account
  • ability to create 10+ VMs using the same disk, without "generalizing" the image. We want same local user account and VM apps/settings

Is there a way to copy the disk 10 times and attaching it to new VMs? Any other suggestions?

@anuchandy
Copy link
Contributor

anuchandy commented Oct 24, 2016

To copy the blob (vhd), you can use azCopy tool https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/, see the section 'Synchronously copy blobs across Storage accounts'

attach is a one to one mapping between vhd and a VM, so once a specialized vhd is attached to a VM it cannot be attached to another VM.

@puneet101
Copy link
Author

Is there a way to create multiple VMs using a specialized vhd? Thanks!

On Sunday, October 23, 2016, Anu Thomas Chandy [email protected]
wrote:

There are three ways you can create a VM

  1. Using platform image -
  2. Using Generalized image - withStoredWindowsImage(imageUrl)
    withStoredLinuxImage(imageUrl)
  3. Using Specialized VHD - withOSDisk(vhdUrl, osType)

The vhd Url (https://cek4dxxmaklzgpooltestzsa.blob.
core.windows.net/system/Microsoft.Compute/Images/template/disk2012-osDisk.
bf042413-3dc3-4452-a07a-70990191ce43.vhd) you are trying to use is a Generalized
image, which you obtained by following below steps:

  1. Logged into the VM and de-provisioned it (this result in VM to be
    generalized).Generalizing a VM removes all your personal account
    information, among other things, and prepares the machine to be used as an
    image.
  2. Executed 'Generalize` API
  3. Executed Capture API

This result is a Generalized image'.

with such Generalized image the option to use is withStoredWindowsImage(
imageUrl) withStoredLinuxImage(imageUrl)

I assume you got the error because you are using withOSDisk(string
vhdUrl, osType), with vhdUrl pointing to a Generalized image.

If you are looking for creating and using a specialized VHD (which has
password and other info embedded). The way to create that is by simply
deleting the VM (without deprovision it) and attach the disk to the new VM
you are trying to create. Note that it's a Specialized VHD not Specialized
Image, this means you cannot create more than one VM from the Specialized
VHD, the VHD will be attached to the VM.

Afaik there is nothing like Specialized Image.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAxf5b5-V1aBKCdnyYmToc_AwlXPRqyHks5q25nEgaJpZM4KeC34
.

@puneet101
Copy link
Author

Is azCopy available in the SDK?

@anuchandy
Copy link
Contributor

azCopy is a tool from Azure storage team, I am not 100% sure but seems underneath azCopy uses Azure blob async copy API.

Which means you have to use Java Storage data API, that is available in azure-storage-java library - see this https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudPageBlob.java#L183

Here is an example usage of this API http://stackoverflow.com/questions/14152087/copying-one-azure-blob-to-another-blob-in-azure-storage-client-2-0, which is in C# but flow should work for Java as well.

For any question specific to this copy API, i would recommend you to ask here https://github.com/Azure/azure-storage-java, storage team is better POC for this.

@puneet101
Copy link
Author

Thanks Anuchandy!

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

No branches or pull requests

2 participants