class Chef::Knife::HmcDiskRemove

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/hmc_disk_remove.rb, line 44
def run
            Chef::Log.debug("Removing disk...")

  validate!([:frame_name,:lpar_name,:vio2_name,:vio1_name,:pvid])
  #Create HMC Object and connect to the HMC
  hmc = Hmc.new(get_config(:hmc_host), get_config(:hmc_username) , {:password => get_config(:hmc_password)}) 
  hmc.connect
  #Populate hash to make LPAR object
  lpar_hash = hmc.get_lpar_options(get_config(:frame_name),get_config(:lpar_name))
  #Create LPAR object based on hash, and VIO objects
  lpar = Lpar.new(lpar_hash)
  vio1 = Vio.new(hmc, get_config(:frame_name), get_config(:vio1_name))
  vio2 = Vio.new(hmc, get_config(:frame_name), get_config(:vio2_name))
  #Remove disk by pvid
  vio1.unmap_by_pvid(vio2,get_config(:pvid))
  puts "Successfully removed LUN with PVID #{get_config(:pvid)}"
  #Disconnect from HMC
  hmc.disconnect
  
end