Chapter 09/circuit-oneops-1-master/components/cookbooks/azuredatadisk/libraries/datadisk.rb
# build the storage profile object to add a new datadisk
build the storage profile object to add a new datadisk
build the storage profile object to add a new datadisk
def build_storage_profile(disk_no,component_name,slice_size,dev_id)
      data_disk2 = Azure::ARM::Compute::Models::DataDisk.new
      dev_name = dev_id.split("/").last
      data_disk2.name = "#{component_name}-datadisk-#{dev_name}"
      OOLog.info("data_disk:"+data_disk2.name)
      data_disk2.lun = disk_no-1
      OOLog.info("data_disk lun:"+data_disk2.lun.to_s)
      data_disk2.disk_size_gb = slice_size
      data_disk2.vhd = Azure::ARM::Compute::Models::VirtualHardDisk.new
      data_disk2.vhd.uri = "https://#{@storage_account_name}.blob.core.windows.net/vhds/#{@storage_account_name}-#{component_name}-datadisk-#{dev_name}.vhd"
      OOLog.info("data_disk uri:"+data_disk2.vhd.uri)
      data_disk2.caching = Azure::ARM::Compute::Models::CachingTypes::ReadWrite
      blob_name = "#{@storage_account_name}-#{component_name}-datadisk-#{dev_name}.vhd"
      is_new_disk_or_old = check_blob_exist(blob_name)
      if is_new_disk_or_old == true
        data_disk2.create_option = Azure::ARM::Compute::Models::DiskCreateOptionTypes::Attach
      else
        data_disk2.create_option = Azure::ARM::Compute::Models::DiskCreateOptionTypes::Empty
      end
      data_disk2
    end
def build_storage_profile ( disk_no , component_name , slice_size , dev_id ) data_disk2 = Azure :: ARM :: Compute :: Models :: DataDisk . new dev_name = dev_id . split ( "/" ) . last data_disk2 . name = "#{component_name}-datadisk-#{dev_name}" OOLog . info ( "data_disk:" + data_disk2 . name ) data_disk2 . lun = disk_no - 1 OOLog . info ( "data_disk lun:" + data_disk2 . lun . to_s ) data_disk2 . disk_size_gb = slice_size data_disk2 . vhd = Azure :: ARM :: Compute :: Models :: VirtualHardDisk . new data_disk2 . vhd . uri = "https://#{@storage_account_name}.blob.core.windows.net/vhds/#{@storage_account_name}-#{component_name}-datadisk-#{dev_name}.vhd" OOLog . info ( "data_disk uri:" + data_disk2 . vhd . uri ) data_disk2 . caching = Azure :: ARM :: Compute :: Models :: CachingTypes :: ReadWrite blob_name = "#{@storage_account_name}-#{component_name}-datadisk-#{dev_name}.vhd" is_new_disk_or_old = check_blob_exist ( blob_name ) if is_new_disk_or_old == true data_disk2 . create_option = Azure :: ARM :: Compute :: Models :: DiskCreateOptionTypes :: Attach else data_disk2 . create_option = Azure :: ARM :: Compute :: Models :: DiskCreateOptionTypes :: Empty end data_disk2 end
build the storage profile object to add a new datadisk
build the storage profile object to add a new datadisk
disk_no
<not_specific>
component_name
<not_specific>
slice_size
<not_specific>
dev_id
<not_specific>