rbvppc 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +17 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +302 -0
 - data/Rakefile +8 -0
 - data/documentation/hmc.odt +0 -0
 - data/documentation/lpar.odt +0 -0
 - data/documentation/lun.odt +0 -0
 - data/documentation/network.odt +0 -0
 - data/documentation/nim.odt +0 -0
 - data/documentation/vio.odt +0 -0
 - data/documentation/vnic.odt +0 -0
 - data/documentation/vscsi.odt +0 -0
 - data/examples/add_disk_any_size_to_lpar.rb +46 -0
 - data/examples/add_disk_specifing_size_to_lpar.rb +47 -0
 - data/examples/remove_disks_and_delete_lpar.rb +35 -0
 - data/examples/remove_disks_from_lpar.rb +33 -0
 - data/examples/test_lpar_build.rb +83 -0
 - data/lib/rbvppc/command_failure.rb +18 -0
 - data/lib/rbvppc/connectable_server.rb +95 -0
 - data/lib/rbvppc/hmc.rb +892 -0
 - data/lib/rbvppc/lpar.rb +1140 -0
 - data/lib/rbvppc/lun.rb +23 -0
 - data/lib/rbvppc/network.rb +54 -0
 - data/lib/rbvppc/nim.rb +442 -0
 - data/lib/rbvppc/version.rb +10 -0
 - data/lib/rbvppc/vio.rb +720 -0
 - data/lib/rbvppc/vnic.rb +34 -0
 - data/lib/rbvppc/vscsi.rb +36 -0
 - data/lib/rbvppc.rb +28 -0
 - data/rbvppc.gemspec +26 -0
 - metadata +117 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0b1e3299fd89c66278004c090e31547c2420157e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0da9c2298ad7b8785a872487da96728e7e0a4dec
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 479a776e417a1ceb71a691c01702ab0c8f70fbc95a7c67740f92cee433dde118458cfb8271eb190be0c16c4b4a59a15dbbf1c424ce5c0734972a281c7b224b79
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 6350c6f188b224e8d058ca5bf0936d95bcc5556589d3b4dbff8ecd1539789b2f8ec99f533234b762c53056ec47a317c898c57cfb175ed2e4fea1c42b5d6757bd
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            © Copyright IBM Corporation 2014.
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,302 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # rbvppc
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Virtual Infrastructure management of IBM pSeries/AIX
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                gem 'rbvppc'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ gem install rbvppc
         
     | 
| 
      
 18 
     | 
    
         
            +
            ## Example end to end build in irb
         
     | 
| 
      
 19 
     | 
    
         
            +
            In this example we will take you through the steps needed to create a new lpar on a pSeries hypervisor, and execute a network build of the AIX Operating System.
         
     | 
| 
      
 20 
     | 
    
         
            +
            ### Load required classes in your irb.
         
     | 
| 
      
 21 
     | 
    
         
            +
            You will need to load the following classes to execute this example(not needed if you installed the gem)
         
     | 
| 
      
 22 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 23 
     | 
    
         
            +
            load 'lpar.rb'
         
     | 
| 
      
 24 
     | 
    
         
            +
            load 'hmc.rb'
         
     | 
| 
      
 25 
     | 
    
         
            +
            load 'vio.rb'
         
     | 
| 
      
 26 
     | 
    
         
            +
            load 'nim.rb'
         
     | 
| 
      
 27 
     | 
    
         
            +
            ```
         
     | 
| 
      
 28 
     | 
    
         
            +
            ### Create the needed objects for the build
         
     | 
| 
      
 29 
     | 
    
         
            +
            	- Hmc 
         
     | 
| 
      
 30 
     | 
    
         
            +
            	- Nim
         
     | 
| 
      
 31 
     | 
    
         
            +
            	- Lpar
         
     | 
| 
      
 32 
     | 
    
         
            +
            	- Vio - We used dual node VIOS in development and testing of this gem it is recommend to use at least a dual node setup
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            For the Hmc object you will need the fully qualified domain name or IP address of the HMC Server, as well as, credentials with hscroot level authority
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 36 
     | 
    
         
            +
            hmc = Hmc.new("HMC.Fully.Qualified.Domain.Name","hscroot", {:password => "hscroot's password"})
         
     | 
| 
      
 37 
     | 
    
         
            +
            ```
         
     | 
| 
      
 38 
     | 
    
         
            +
            For the Nim object you will need the fully qualified domain name or IP address of the NIM Server, as well as, credentials with root level authority
         
     | 
| 
      
 39 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 40 
     | 
    
         
            +
            nim = Nim.new("NIM.Fully.Qualified.Domain.Name","root", {:password => "root's password"})
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
      
 42 
     | 
    
         
            +
            For the VIO objects you will pass the hmc object, the name of your frame/hypervisor and the name of each vio as it is listed in your HMC console.
         
     | 
| 
      
 43 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 44 
     | 
    
         
            +
            vio1 = Vio.new(hmc,'frame name','vio1 lpar name')
         
     | 
| 
      
 45 
     | 
    
         
            +
            vio2 = Vio.new(hmc,'frame name','vio2 lpar name')
         
     | 
| 
      
 46 
     | 
    
         
            +
            ```
         
     | 
| 
      
 47 
     | 
    
         
            +
            For the Lpar object we use the minimum amount of data that is needed for this example. Which is the hmc object, the desired processing units, the desired memory, the desired number of vCPU, the frame/hypervisor name, and the lpar name.
         
     | 
| 
      
 48 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 49 
     | 
    
         
            +
            lpar = Lpar.new({:hmc => hmc, :des_proc => '1.0', :des_mem => '4096', :des_vcpu => '1', :frame => '<frame name>', :name => '<lpar name>'})
         
     | 
| 
      
 50 
     | 
    
         
            +
            ```
         
     | 
| 
      
 51 
     | 
    
         
            +
            ### Open connections to the Hmc and Nim servers
         
     | 
| 
      
 52 
     | 
    
         
            +
            By executing the connect methods you are using the Ruby NET::SSH gem to SSH to each server. These connections will stay open until you execute the disconnect method.
         
     | 
| 
      
 53 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 54 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 55 
     | 
    
         
            +
            nim.connect
         
     | 
| 
      
 56 
     | 
    
         
            +
            ```
         
     | 
| 
      
 57 
     | 
    
         
            +
            ### Create the LPAR
         
     | 
| 
      
 58 
     | 
    
         
            +
            Executing the create method against you Lpar object will execute the appropriate commands against the HMC server to make an LPAR.
         
     | 
| 
      
 59 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 60 
     | 
    
         
            +
            lpar.create
         
     | 
| 
      
 61 
     | 
    
         
            +
            ```
         
     | 
| 
      
 62 
     | 
    
         
            +
            ### Add vSCSI adapters
         
     | 
| 
      
 63 
     | 
    
         
            +
            We create two vSCSI adapters on the LPAR itself linking it to each of the VIO servers.
         
     | 
| 
      
 64 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 65 
     | 
    
         
            +
            lpar.add_vscsi(vio1)
         
     | 
| 
      
 66 
     | 
    
         
            +
            lpar.add_vscsi(vio2)
         
     | 
| 
      
 67 
     | 
    
         
            +
            ```
         
     | 
| 
      
 68 
     | 
    
         
            +
            ### Add virtual ethernet adapter
         
     | 
| 
      
 69 
     | 
    
         
            +
            For this you must pass at least the primary vlan id number to method. This will create a vNIC on the LPAR
         
     | 
| 
      
 70 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 71 
     | 
    
         
            +
            lpar.create_vnic('<VLAN ID>')
         
     | 
| 
      
 72 
     | 
    
         
            +
            ```
         
     | 
| 
      
 73 
     | 
    
         
            +
            ### Map any available disk to the LPAR
         
     | 
| 
      
 74 
     | 
    
         
            +
            In this example we execute the map_any_disk method, you may also choose to execute map_by_size to indicate a mimimum amount of space desired.
         
     | 
| 
      
 75 
     | 
    
         
            +
            First we need to collect information on the vSCSI adapters we just created.
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 77 
     | 
    
         
            +
            lpar_vscsi = lpar.get_vscsi_adapters
         
     | 
| 
      
 78 
     | 
    
         
            +
            ```
         
     | 
| 
      
 79 
     | 
    
         
            +
            Then we need to find each vHost, and map a disk to the lpar
         
     | 
| 
      
 80 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 81 
     | 
    
         
            +
            first_vhost = vio1.find_vhost_given_virtual_slot(lpar_vscsi[0].remote_slot_num)
         
     | 
| 
      
 82 
     | 
    
         
            +
            second_vhost = vio2.find_vhost_given_virtual_slot(lpar_vscsi[1].remote_slot_num)
         
     | 
| 
      
 83 
     | 
    
         
            +
            vio1.map_any_disk(first_vhost, vio2, second_vhost)
         
     | 
| 
      
 84 
     | 
    
         
            +
            ```
         
     | 
| 
      
 85 
     | 
    
         
            +
            ### Power Cycle the LPAR
         
     | 
| 
      
 86 
     | 
    
         
            +
            This step is done so the vNIC gets a MAC address
         
     | 
| 
      
 87 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 88 
     | 
    
         
            +
            lpar.activate
         
     | 
| 
      
 89 
     | 
    
         
            +
            lpar.soft_shutdown
         
     | 
| 
      
 90 
     | 
    
         
            +
            ```
         
     | 
| 
      
 91 
     | 
    
         
            +
            ### Define the NIM client and bid
         
     | 
| 
      
 92 
     | 
    
         
            +
            To execute a NIM mksysb deployment you must first define the lpar as a NIM client and define it a bid(BOS Install data)
         
     | 
| 
      
 93 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 94 
     | 
    
         
            +
            nim.define_client(lpar)
         
     | 
| 
      
 95 
     | 
    
         
            +
            nim.create_bid(lpar)
         
     | 
| 
      
 96 
     | 
    
         
            +
            ```
         
     | 
| 
      
 97 
     | 
    
         
            +
            ### Initiate image deployment and LPAR network boot
         
     | 
| 
      
 98 
     | 
    
         
            +
            We then execute the deployment of a mksysb on the NIM server and use the HMC server to network boot the LPAR.
         
     | 
| 
      
 99 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 100 
     | 
    
         
            +
            nim.deploy_image(lpar,"<mksysb>","<First boot script>") do |gw,snm| 
         
     | 
| 
      
 101 
     | 
    
         
            +
               hmc.lpar_net_boot("NIM IP ADDRESS", "LPAR IP ADDRESS",gw,snm,lpar.name,lpar.current_profile,lpar.frame)
         
     | 
| 
      
 102 
     | 
    
         
            +
            end
         
     | 
| 
      
 103 
     | 
    
         
            +
            ```
         
     | 
| 
      
 104 
     | 
    
         
            +
            ### Disconnect
         
     | 
| 
      
 105 
     | 
    
         
            +
            Finally we close our connections to the HMC and NIM servers. Congratulations you now have a basic AIX LPAR installed and running
         
     | 
| 
      
 106 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 107 
     | 
    
         
            +
            nim.disconnect
         
     | 
| 
      
 108 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 109 
     | 
    
         
            +
            ```
         
     | 
| 
      
 110 
     | 
    
         
            +
            ### Complete list of steps 
         
     | 
| 
      
 111 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 112 
     | 
    
         
            +
            load 'lpar.rb'
         
     | 
| 
      
 113 
     | 
    
         
            +
            load 'hmc.rb'
         
     | 
| 
      
 114 
     | 
    
         
            +
            load 'vio.rb'
         
     | 
| 
      
 115 
     | 
    
         
            +
            load 'nim.rb'
         
     | 
| 
      
 116 
     | 
    
         
            +
            hmc = Hmc.new("HMC.Fully.Qualified.Domain.Name","hscroot", {:password => "hscroot's password"})
         
     | 
| 
      
 117 
     | 
    
         
            +
            nim = Nim.new("NIM.Fully.Qualified.Domain.Name","root", {:password => "root's password"})
         
     | 
| 
      
 118 
     | 
    
         
            +
            vio1 = Vio.new(hmc,'frame name','vio1 lpar name')
         
     | 
| 
      
 119 
     | 
    
         
            +
            vio2 = Vio.new(hmc,'frame name','vio2 lpar name')
         
     | 
| 
      
 120 
     | 
    
         
            +
            lpar = Lpar.new({:hmc => hmc, :des_proc => '1.0', :des_mem => '4096', :des_vcpu => '1', :frame => '<frame name>', :name => '<lpar name>'})
         
     | 
| 
      
 121 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 122 
     | 
    
         
            +
            nim.connect
         
     | 
| 
      
 123 
     | 
    
         
            +
            lpar.create
         
     | 
| 
      
 124 
     | 
    
         
            +
            lpar.add_vscsi(vio1)
         
     | 
| 
      
 125 
     | 
    
         
            +
            lpar.add_vscsi(vio2)
         
     | 
| 
      
 126 
     | 
    
         
            +
            lpar.create_vnic('<VLAN ID>')
         
     | 
| 
      
 127 
     | 
    
         
            +
            lpar_vscsi = lpar.get_vscsi_adapters
         
     | 
| 
      
 128 
     | 
    
         
            +
            first_vhost = vio1.find_vhost_given_virtual_slot(lpar_vscsi[0].remote_slot_num)
         
     | 
| 
      
 129 
     | 
    
         
            +
            second_vhost = vio2.find_vhost_given_virtual_slot(lpar_vscsi[1].remote_slot_num)
         
     | 
| 
      
 130 
     | 
    
         
            +
            vio1.map_any_disk(first_vhost, vio2, second_vhost)
         
     | 
| 
      
 131 
     | 
    
         
            +
            lpar.activate
         
     | 
| 
      
 132 
     | 
    
         
            +
            lpar.soft_shutdown
         
     | 
| 
      
 133 
     | 
    
         
            +
            nim.define_client(lpar)
         
     | 
| 
      
 134 
     | 
    
         
            +
            nim.create_bid(lpar)
         
     | 
| 
      
 135 
     | 
    
         
            +
            nim.deploy_image(lpar,"<mksysb>","<First boot script>") do |gw,snm| 
         
     | 
| 
      
 136 
     | 
    
         
            +
               hmc.lpar_net_boot("NIM IP ADDRESS", "LPAR IP ADDRESS",gw,snm,lpar.name,lpar.current_profile,lpar.frame)
         
     | 
| 
      
 137 
     | 
    
         
            +
            end
         
     | 
| 
      
 138 
     | 
    
         
            +
            nim.disconnect
         
     | 
| 
      
 139 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 140 
     | 
    
         
            +
            ```
         
     | 
| 
      
 141 
     | 
    
         
            +
            ## Example Removal of LUNs and deletion of LPAR in irb
         
     | 
| 
      
 142 
     | 
    
         
            +
            This example will show you how to remove all the attached LUNs from an LPAR and delete the LPAR
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
            ### Load required classes in your irb.
         
     | 
| 
      
 145 
     | 
    
         
            +
            You will need to load the following classes to execute this example(not needed if you installed the gem)
         
     | 
| 
      
 146 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 147 
     | 
    
         
            +
            load 'lpar.rb'
         
     | 
| 
      
 148 
     | 
    
         
            +
            load 'hmc.rb'
         
     | 
| 
      
 149 
     | 
    
         
            +
            load 'vio.rb'
         
     | 
| 
      
 150 
     | 
    
         
            +
            ```
         
     | 
| 
      
 151 
     | 
    
         
            +
            ### Create HMC Object
         
     | 
| 
      
 152 
     | 
    
         
            +
            For the Hmc object you will need the fully qualified domain name or IP address of the HMC Server, as well as, credentials with hscroot level authority
         
     | 
| 
      
 153 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 154 
     | 
    
         
            +
            hmc = Hmc.new("HMC.Fully.Qualified.Domain.Name","hscroot", {:password => "hscroot's password"})
         
     | 
| 
      
 155 
     | 
    
         
            +
            ```
         
     | 
| 
      
 156 
     | 
    
         
            +
            ### Open connections to the Hmc server
         
     | 
| 
      
 157 
     | 
    
         
            +
            By executing the connect methods you are using the Ruby NET::SSH gem to SSH to the server. This connection will stay open until you execute the disconnect method.
         
     | 
| 
      
 158 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 159 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 160 
     | 
    
         
            +
            ```
         
     | 
| 
      
 161 
     | 
    
         
            +
            ### Create VIO objects
         
     | 
| 
      
 162 
     | 
    
         
            +
            For the VIO objects you will pass the hmc object, the name of your frame/hypervisor and the name of each vio as it is listed in your HMC console.
         
     | 
| 
      
 163 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 164 
     | 
    
         
            +
            vio1 = Vio.new(hmc,'frame name','vio1 lpar name')
         
     | 
| 
      
 165 
     | 
    
         
            +
            vio2 = Vio.new(hmc,'frame name','vio2 lpar name')
         
     | 
| 
      
 166 
     | 
    
         
            +
            ```
         
     | 
| 
      
 167 
     | 
    
         
            +
            ### Populate a hash of options for the lpar you wish to destroy and use it to make an LPAR object
         
     | 
| 
      
 168 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 169 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 170 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 171 
     | 
    
         
            +
            ```
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            ### Unmap all disks from LPAR (this does not format the disks simply detaches them)
         
     | 
| 
      
 174 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 175 
     | 
    
         
            +
            vio1.unmap_all_disks(vio2,lpar)
         
     | 
| 
      
 176 
     | 
    
         
            +
            ```
         
     | 
| 
      
 177 
     | 
    
         
            +
            ### Delete the LPAR
         
     | 
| 
      
 178 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 179 
     | 
    
         
            +
            lpar.delete
         
     | 
| 
      
 180 
     | 
    
         
            +
            ```
         
     | 
| 
      
 181 
     | 
    
         
            +
            ### Disconnect from HMC
         
     | 
| 
      
 182 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 183 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 184 
     | 
    
         
            +
            ```
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
            ### Complete script
         
     | 
| 
      
 187 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 188 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 189 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 192 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
            #Create a VIO object for both vios
         
     | 
| 
      
 195 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 196 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
      
 198 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 199 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 202 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
            #Unmapp all the disks from the lpar using VIO1 passing the method the 2nd vio and the lpar
         
     | 
| 
      
 205 
     | 
    
         
            +
            vio1.unmap_all_disks(vio2,lpar)
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
            #Delete the LPAR
         
     | 
| 
      
 208 
     | 
    
         
            +
            lpar.delete
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 211 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 212 
     | 
    
         
            +
            ```
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
            ## Example modifying CPU on an lpar in irb
         
     | 
| 
      
 215 
     | 
    
         
            +
            The following example will show you how to change the processing units and virtual cpu of an LPAR
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
            ### Load required classes in your irb.
         
     | 
| 
      
 218 
     | 
    
         
            +
            You will need to load the following classes to execute this example(not needed if you installed the gem)
         
     | 
| 
      
 219 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 220 
     | 
    
         
            +
            load 'lpar.rb'
         
     | 
| 
      
 221 
     | 
    
         
            +
            load 'hmc.rb'
         
     | 
| 
      
 222 
     | 
    
         
            +
            load 'vio.rb'
         
     | 
| 
      
 223 
     | 
    
         
            +
            ```
         
     | 
| 
      
 224 
     | 
    
         
            +
            ### Create HMC Object
         
     | 
| 
      
 225 
     | 
    
         
            +
            For the Hmc object you will need the fully qualified domain name or IP address of the HMC Server, as well as, credentials with hscroot level authority
         
     | 
| 
      
 226 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 227 
     | 
    
         
            +
            hmc = Hmc.new("HMC.Fully.Qualified.Domain.Name","hscroot", {:password => "hscroot's password"})
         
     | 
| 
      
 228 
     | 
    
         
            +
            ```
         
     | 
| 
      
 229 
     | 
    
         
            +
            ### Open connections to the Hmc server
         
     | 
| 
      
 230 
     | 
    
         
            +
            By executing the connect methods you are using the Ruby NET::SSH gem to SSH to the server. This connection will stay open until you execute the disconnect method.
         
     | 
| 
      
 231 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 232 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 233 
     | 
    
         
            +
            ```
         
     | 
| 
      
 234 
     | 
    
         
            +
            ### Populate a hash of options for the lpar you wish to modify and use it to make an LPAR object
         
     | 
| 
      
 235 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 236 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 237 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 238 
     | 
    
         
            +
            ```
         
     | 
| 
      
 239 
     | 
    
         
            +
            ### Change maximum vCPU
         
     | 
| 
      
 240 
     | 
    
         
            +
            This will change the maximum number of virtual cpus the LPAR has (warning: power cycles the LPAR)
         
     | 
| 
      
 241 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 242 
     | 
    
         
            +
            lpar.max_vcpu=(<non float number>) 
         
     | 
| 
      
 243 
     | 
    
         
            +
            ```
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
            ### Change the maximum number of processing units 
         
     | 
| 
      
 246 
     | 
    
         
            +
            This will change the maximum number of physical CPU, warning: power cycles the LPAR
         
     | 
| 
      
 247 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 248 
     | 
    
         
            +
            lpar.max_proc_units=(<float number>)
         
     | 
| 
      
 249 
     | 
    
         
            +
            ```
         
     | 
| 
      
 250 
     | 
    
         
            +
            example float number 2.0
         
     | 
| 
      
 251 
     | 
    
         
            +
            ### Disconnect from the hmc
         
     | 
| 
      
 252 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 253 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 254 
     | 
    
         
            +
            ```
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
            ### Complete script
         
     | 
| 
      
 257 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 258 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 259 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 262 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 265 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 268 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
            #Change vCPU
         
     | 
| 
      
 271 
     | 
    
         
            +
            lpar.max_vcpu=(<non float number>) 
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
            #Change proc units
         
     | 
| 
      
 274 
     | 
    
         
            +
            lpar.max_proc_units=(<float number>)
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
      
 276 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 277 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
      
 278 
     | 
    
         
            +
            ```
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
      
 283 
     | 
    
         
            +
            ### Coding
         
     | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
      
 285 
     | 
    
         
            +
            * Pick a task:
         
     | 
| 
      
 286 
     | 
    
         
            +
              * Offer feedback on open [pull requests](https://github.com/pseries/rbvppc/pulls).
         
     | 
| 
      
 287 
     | 
    
         
            +
              * Review open [issues](https://github.com/pseries/rbvppc/issues) for things to help on.
         
     | 
| 
      
 288 
     | 
    
         
            +
              * [Create an issue](https://github.com/pseries/rbvppc/issues/new) to start a discussion on additions or features.
         
     | 
| 
      
 289 
     | 
    
         
            +
            * Fork the project, add your changes and tests to cover them in a topic branch.
         
     | 
| 
      
 290 
     | 
    
         
            +
            * Commit your changes and rebase against `softlayer/fog` to ensure everything is up to date.
         
     | 
| 
      
 291 
     | 
    
         
            +
            * [Submit a pull request](https://github.com/pseries/rbvppc/compare/).
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
            ### Non-Coding
         
     | 
| 
      
 294 
     | 
    
         
            +
             
     | 
| 
      
 295 
     | 
    
         
            +
            * Offer feedback on open [issues](https://github.com/pseries/rbvppc/issues).
         
     | 
| 
      
 296 
     | 
    
         
            +
            * Organize or volunteer at events.
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
            ## Legal stuff
         
     | 
| 
      
 299 
     | 
    
         
            +
            Use of this software requires runtime dependencies.  Those dependencies and their respective software licenses are listed below.
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
            * [net-ssh](https://github.com/net-ssh/net-ssh/) - LICENSE: [MIT](https://github.com/net-ssh/net-ssh/blob/master/LICENSE.txt)
         
     | 
| 
      
 302 
     | 
    
         
            +
            * [net-scp](https://github.com/net-ssh/net-scp/) - LICENSE: [MIT](https://github.com/net-ssh/net-scp/blob/master/LICENSE.txt)
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../lib/rbvppc/hmc'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../lib/rbvppc/lpar'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../lib/rbvppc/vio'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            frame_name = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
            lpar_name  = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
            vio1_name  = ""
         
     | 
| 
      
 15 
     | 
    
         
            +
            vio2_name  = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
            hmc_fqdn    = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            hmc_pass    = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 20 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 23 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 26 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 29 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            #Create a VIO object for both vios
         
     | 
| 
      
 32 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 33 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            #Get vSCSI Information
         
     | 
| 
      
 36 
     | 
    
         
            +
            lpar_vscsi = lpar.get_vscsi_adapters
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            #Find the vHosts
         
     | 
| 
      
 39 
     | 
    
         
            +
            first_vhost = vio1.find_vhost_given_virtual_slot(lpar_vscsi[0].remote_slot_num)
         
     | 
| 
      
 40 
     | 
    
         
            +
            second_vhost = vio2.find_vhost_given_virtual_slot(lpar_vscsi[1].remote_slot_num)
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            #Attach a Disk
         
     | 
| 
      
 43 
     | 
    
         
            +
            vio1.map_any_disk(first_vhost, vio2, second_vhost)
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 46 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../lib/rbvppc/hmc'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../lib/rbvppc/lpar'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../lib/rbvppc/vio'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            frame_name = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
            lpar_name  = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
            vio1_name  = ""
         
     | 
| 
      
 15 
     | 
    
         
            +
            vio2_name  = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
            hmc_fqdn    = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            hmc_pass    = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
            total_size_in_gb = 30
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 21 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 24 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 27 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 30 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            #Create a VIO object for both vios
         
     | 
| 
      
 33 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 34 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            #Get vSCSI Information
         
     | 
| 
      
 37 
     | 
    
         
            +
            lpar_vscsi = lpar.get_vscsi_adapters
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            #Find the vHosts
         
     | 
| 
      
 40 
     | 
    
         
            +
            first_vhost = vio1.find_vhost_given_virtual_slot(lpar_vscsi[0].remote_slot_num)
         
     | 
| 
      
 41 
     | 
    
         
            +
            second_vhost = vio2.find_vhost_given_virtual_slot(lpar_vscsi[1].remote_slot_num)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            #Attach a Disk
         
     | 
| 
      
 44 
     | 
    
         
            +
            vio1.map_by_size(first_vhost,vio2,second_vhost,total_size_in_gb)
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 47 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../lib/rbvppc/hmc'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../lib/rbvppc/lpar'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../lib/rbvppc/vio'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            frame_name = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
            lpar_name  = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
            vio1_name  = ""
         
     | 
| 
      
 15 
     | 
    
         
            +
            vio2_name  = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
            hmc_fqdn    = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            hmc_pass    = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 20 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 21 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 22 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 23 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 24 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 25 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 26 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 27 
     | 
    
         
            +
            #Create a VIO object for both vios
         
     | 
| 
      
 28 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 29 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 30 
     | 
    
         
            +
            #Unmapp all the disks from the lpar using VIO1 passing the method the 2nd vio and the lpar
         
     | 
| 
      
 31 
     | 
    
         
            +
            vio1.unmap_all_disks(vio2,lpar)
         
     | 
| 
      
 32 
     | 
    
         
            +
            #Delete the LPAR
         
     | 
| 
      
 33 
     | 
    
         
            +
            lpar.delete
         
     | 
| 
      
 34 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 35 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../lib/rbvppc/hmc'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../lib/rbvppc/lpar'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../lib/rbvppc/vio'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            frame_name = ""
         
     | 
| 
      
 13 
     | 
    
         
            +
            lpar_name  = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
            vio1_name  = ""
         
     | 
| 
      
 15 
     | 
    
         
            +
            vio2_name  = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
            hmc_fqdn    = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            hmc_pass    = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            #Create HMC Object
         
     | 
| 
      
 20 
     | 
    
         
            +
            hmc = Hmc.new(hmc_fqdn, "hscroot", {:password => hmc_pass})
         
     | 
| 
      
 21 
     | 
    
         
            +
            #Connect to HMC
         
     | 
| 
      
 22 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 23 
     | 
    
         
            +
            #Populate options hash with lpar information
         
     | 
| 
      
 24 
     | 
    
         
            +
            lpar_hash = hmc.get_lpar_options(frame_name,lpar_name)
         
     | 
| 
      
 25 
     | 
    
         
            +
            #Create LPAR Object based on the hash
         
     | 
| 
      
 26 
     | 
    
         
            +
            lpar = Lpar.new(lpar_hash)
         
     | 
| 
      
 27 
     | 
    
         
            +
            #Create a VIO object for both vios
         
     | 
| 
      
 28 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 29 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 30 
     | 
    
         
            +
            #Unmapp all the disks from the lpar using VIO1 passing the method the 2nd vio and the lpar
         
     | 
| 
      
 31 
     | 
    
         
            +
            vio1.unmap_all_disks(vio2,lpar)
         
     | 
| 
      
 32 
     | 
    
         
            +
            #Disconnect from the hmc
         
     | 
| 
      
 33 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
         @@ -0,0 +1,83 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            require_relative '../lib/rbvppc/hmc'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_relative '../lib/rbvppc/nim'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require_relative '../lib/rbvppc/lpar'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require_relative '../lib/rbvppc/vio'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            #Modify these for your tests
         
     | 
| 
      
 15 
     | 
    
         
            +
            hmc_fqdn    = ""
         
     | 
| 
      
 16 
     | 
    
         
            +
            hmc_pass    = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
            frame_name  = ""
         
     | 
| 
      
 18 
     | 
    
         
            +
            lpar_name   = ""
         
     | 
| 
      
 19 
     | 
    
         
            +
            lpar_ip 	= ""
         
     | 
| 
      
 20 
     | 
    
         
            +
            vio1_name   = ""
         
     | 
| 
      
 21 
     | 
    
         
            +
            vio2_name   = ""
         
     | 
| 
      
 22 
     | 
    
         
            +
            vlan_id     = ""
         
     | 
| 
      
 23 
     | 
    
         
            +
            des_prod    = ""
         
     | 
| 
      
 24 
     | 
    
         
            +
            des_mem     = ""
         
     | 
| 
      
 25 
     | 
    
         
            +
            des_vcpu    = ""
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            nim_fqdn    = ""
         
     | 
| 
      
 28 
     | 
    
         
            +
            nim_ip      = ""
         
     | 
| 
      
 29 
     | 
    
         
            +
            nim_pass    = ""
         
     | 
| 
      
 30 
     | 
    
         
            +
            fb_script   = ""
         
     | 
| 
      
 31 
     | 
    
         
            +
            mksysb      = ""
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            #Create objects        
         
     | 
| 
      
 35 
     | 
    
         
            +
            hmc  = Hmc.new(hmc_fqdn,"hscroot", {:password => hmc_pass})
         
     | 
| 
      
 36 
     | 
    
         
            +
            nim  = Nim.new(nim_fqdn,"root", {:password => nim_pass})
         
     | 
| 
      
 37 
     | 
    
         
            +
            vio1 = Vio.new(hmc,frame_name,vio1_name)
         
     | 
| 
      
 38 
     | 
    
         
            +
            vio2 = Vio.new(hmc,frame_name,vio2_name)
         
     | 
| 
      
 39 
     | 
    
         
            +
            lpar = Lpar.new({:hmc => hmc, :des_proc => des_prod, :des_mem => des_mem , :des_vcpu => des_vcpu, :frame => frame_name, :name => lpar_name})
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            #Debug Flag - will display every command executed
         
     | 
| 
      
 42 
     | 
    
         
            +
            #hmc.toggle_debug
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            #Open connections
         
     | 
| 
      
 45 
     | 
    
         
            +
            hmc.connect
         
     | 
| 
      
 46 
     | 
    
         
            +
            nim.connect
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            #Create LPAR
         
     | 
| 
      
 49 
     | 
    
         
            +
            lpar.create
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            #Add vSCSI Adapters
         
     | 
| 
      
 52 
     | 
    
         
            +
            lpar.add_vscsi(vio1)
         
     | 
| 
      
 53 
     | 
    
         
            +
            lpar.add_vscsi(vio2)
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            #Create vNIC
         
     | 
| 
      
 56 
     | 
    
         
            +
            lpar.create_vnic(vlan_id)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            #Get vSCSI Information
         
     | 
| 
      
 59 
     | 
    
         
            +
            lpar_vscsi = lpar.get_vscsi_adapters
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            #Find the vHosts
         
     | 
| 
      
 62 
     | 
    
         
            +
            first_vhost = vio1.find_vhost_given_virtual_slot(lpar_vscsi[0].remote_slot_num)
         
     | 
| 
      
 63 
     | 
    
         
            +
            second_vhost = vio2.find_vhost_given_virtual_slot(lpar_vscsi[1].remote_slot_num)
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            #Attach a Disk
         
     | 
| 
      
 66 
     | 
    
         
            +
            vio1.map_any_disk(first_vhost, vio2, second_vhost)
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            #Power Cycle the LPAR to assign MAC to vNIC
         
     | 
| 
      
 69 
     | 
    
         
            +
            lpar.activate
         
     | 
| 
      
 70 
     | 
    
         
            +
            lpar.soft_shutdown
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            #Define needed NIM objects
         
     | 
| 
      
 73 
     | 
    
         
            +
            nim.define_client(lpar)
         
     | 
| 
      
 74 
     | 
    
         
            +
            nim.create_bid(lpar)
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            #Deploy Mksysb, booting LPAR
         
     | 
| 
      
 77 
     | 
    
         
            +
            nim.deploy_image(lpar,mksysb,fb_script) do |gw,snm| 
         
     | 
| 
      
 78 
     | 
    
         
            +
               hmc.lpar_net_boot(nim_ip, lpar_ip,gw,snm,lpar)
         
     | 
| 
      
 79 
     | 
    
         
            +
            end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            #Close connections
         
     | 
| 
      
 82 
     | 
    
         
            +
            nim.disconnect
         
     | 
| 
      
 83 
     | 
    
         
            +
            hmc.disconnect
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Authors: Christopher M Wood (<woodc@us.ibm.com>)
         
     | 
| 
      
 3 
     | 
    
         
            +
            #		   John F Hutchinson (<jfhutchi@us.ibm.com)
         
     | 
| 
      
 4 
     | 
    
         
            +
            # © Copyright IBM Corporation 2015.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # LICENSE: MIT (http://opensource.org/licenses/MIT)
         
     | 
| 
      
 7 
     | 
    
         
            +
            # 
         
     | 
| 
      
 8 
     | 
    
         
            +
            class CommandFailure < StandardError
         
     | 
| 
      
 9 
     | 
    
         
            +
                attr_reader :stderr, :exit_code, :exit_signal
         
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
      
 11 
     | 
    
         
            +
                def initialize(stderr, exit_code, exit_signal)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @stderr, @exit_code, @exit_signal = stderr, exit_code, exit_signal
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 16 
     | 
    
         
            +
                    return @stderr
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     |