Instance Volume Size


#1

Hello,

Looking forward to customize provisioning dialogs, I’m trying to allow user specifying the system volume size of the deployed instance.

Is there any way to customize the dialog and the provisioning process to do this kind of thing ?

I’m currently able to expand dialog and retrieve existing options in my method, but I do not succeed at creating a custom option nor finding where to specify the expected volume size.

Thanks in advance for your feedback.


#2

Hello,
we had similar requirement here. We solved it by adding additional disk with a customized size (size in GB given as input field from the service dialog)
We are using some piece of code from Kevin Morey available on github:


And we have developped a sat6 kickstart that mounts the added disk on a specific filesystem.
Hope it helps !


#3

Hi,

Thank you very much for your reply.

Indeed it helps, glad we are not facing this issue alone :smile:

Unfortunately, despite we investigated the same workaround, this doesn’t fit with our requirements…


#4

@pemcg @ramrexx any help you could give here?


#5

It can depend on the provider you’re provisioning into, the operating system being deployed, and whether you’re running an unattended installation such as kickstart, or cloning from ‘fat’ template.

Expanding the volume size before running a kickstart is probably the simplest, but how you do this is provider-specific. Can you give any more details?

Thanks
pemcg


#6

Hi,

Well we are working with AWS for a start and planning to provide an equivalent behavior with Azure (as soon as it’s available) and openstack.

The requested OS are Linux and Windows. Deployment is made from custom AMI. Post configuration will be automated using Chef.

Expanding the volume size is quite complicated on AWS (It require a snapshot / volume detach / volume attach / volume destroy). It would be easier to be able to specify the first volume size in the provisioning request/orchestration.

Unfortunately, it look like this is not handled in the current orchestration as instances are deployed with a volume configured with the default AWS volume size (8GB for Linux).

Thanks for your feedback.


#7

Sorry to dig up the old post. I am too looking into adding disk to the AWS instance so I can use cloud-init to expand the volume when it boot up. How do you specify additional disk when generating provision request for AWS?

Thanks for your help.


#8

Hi @ecchong
I use preprovision stage of Cloud VM provisioning statemachine for this purpose. I use openstack provider and my method is openstack_preprovision.rb. In the service dialog I use custom options such a :dialog_new_volume and :dialog_volume_persistent and then I create :volumes Array for new volumes in this snippet:

# Cinder Volume configuration -------------------
@prov = $evm.root['miq_provision']
new_volume        = @prov.get_option(:dialog_new_volume)
vm_name           = @prov.get_option(:vm_name)
volume_persistent = @prov.get_option(:dialog_volume_persistent)

unless new_volume.nil? or new_volume.to_i.zero?

  persistent = if volume_persistent == 'f'
                 true
               else
                 false
               end

  volume = {
    :name                  => vm_name.to_s,
    :size                  => new_volume.to_i,
    :delete_on_termination => persistent
  }

  volumes = [] if volumes.nil?
  volumes << volume

  @prov.set_option(:volumes, volumes)
end
# -----------------------------------------------

Volumes are created with the same name as VM name. :dialog_new_volume is is just volume size in Gb and if it zero or not specified than I dont create any additional volume.


#9

Hi Igor,

I am trying t use ypur method to attach a volume but getting below error,

[----] E, [2018-01-31T18:29:53.103188 #7210:10db6b8] ERROR – : Q-task_id([miq_provision_1000000000195]) The following error occurred during method evaluation:
[----] E, [2018-01-31T18:29:53.107761 #7210:10db6b8] ERROR – : Q-task_id([miq_provision_1000000000195]) NoMethodError: undefined method `get_option’ for nil:NilClass

Any help would be appreciated


#10

@lalkrishnak

Hi. This method is used during VM provisioning and should be placed during PrePorvision phase - before provision task:


#11

I have added the new method as showed in the picture, but still getting “NoMethodError: undefined method `get_option’ for nil:NilClass” error. Could you provide the names that you have used in the dialogue boxes.


#12

@lalkrishnak

The error about @prov = $evm.root[‘miq_provision’], looks like for some reason this object is nil:

new_volume = @prov.get_option(:dialog_new_volume)

The PreProvision stage have run before Provision stage:

Can you check your provision method ? How the @prov object are named ?