Christopher White > HPUX-LVM_0.06 > HPUX::LVM

Download:
HPUX-LVM_0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.06   Source  

NAME ^

HPUX::LVM - Perl function to handle HPUX LVM structure

SYNOPSIS ^

  my $lvminfo_data = new HPUX::LVMInfo(
                                target_type     =>"local",
                                persistance     =>"new",
                                access_prog     =>"ssh",
                                access_system   =>"localhost",
                                access_user     =>"root"
                                );

        $arref2 = $lvminfo_data->get_all_volumegroups();

        foreach $vg (@$arref2)  {
                print "Volume Group: $vg\n";
                push @save_vgs, $vg;
                $vg_save = $vg;
                                 }
        $arref2a = $lvminfo_data->get_vg_physicalvols(
                         volume_group    => $vg_save
                                        );

        print "Physical vols in vg: $vg_save\n";
        foreach $pvinvg (@$arref2a)     {
                print "$pvinvg\n";
                push @save_pvs, $pvinvg;
                $pvinvg_save = $pvinvg;
                                         }

DESCRIPTION ^

This module takes the output from the LVM Commands vgdisplay and lvdisplay and pvdisplay and puts them in a hash of hashes in the following manner as an example:

   '/dev/vg08' => HASH(0x404214c8)
      'Act_PV' => 4
      'Alloc_PE' => 4092
      'Cur_LV' => 2
      'Cur_PV' => 4
      'Free_PE' => 0
      'Max_LV' => 255
      'Max_PE_per_PV' => 1023
      'Max_PV' => 16
      'Open_LV' => 2
      'PE_Size_Mbytes' => 4
      'Physical_Vols' => HASH(0x40421510)
         '/dev/dsk/c3t12d0' => HASH(0x404215a0)
            'Free_PE' => 0
            'PV_Status' => 'available'
            'Total_PE' => 1023
         '/dev/dsk/c3t13d0' => HASH(0x40421528)
            'Free_PE' => 0
            'PV_Status' => 'available'
            'Total_PE' => 1023
         '/dev/dsk/c3t14d0' => HASH(0x40421564)
            'Free_PE' => 0
            'PV_Status' => 'available'
            'Total_PE' => 1023
         '/dev/dsk/c3t15d0' => HASH(0x404215dc)
            'Free_PE' => 0
            'PV_Status' => 'available'
            'Total_PE' => 1023
      'Total_PE' => 4092
      'Total_PVG' => 0
      'VGDA' => 8
      'VG_Status' => 'available'
      'VG_Write_Access' => 'read/write'
      'lvols' => HASH(0x4042166c)
         'lvol1' => HASH(0x40421684)
            'Allocated_PE' => 2046
            'Current_LE' => 2046
            'LV_Size' => 8184
            'LV_Status' => 'available/syncd'
            'PV_Data' => HASH(0x4042178c)
               '/dev/dsk/c3t14d0' => HASH(0x404217a4)
                  'le_on_pv' => 1023
                  'pe_on_pv' => 1023
               '/dev/dsk/c3t15d0' => HASH(0x404217d4)
                  'le_on_pv' => 1023
                  'pe_on_pv' => 1023
            'Used_PV' => 2
            'lvdata' => HASH(0x404216b4)
               'Allocated_PE' => 2046
               'Allocation' => 'strict'
               'Bad_block' => 'on'
               'Consistency_Recovery' => 'MWC'
               'Current_LE' => 2046
               'IO_Timeout_Seconds' => 'default'
               'LV_Permission' => 'read/write'
               'LV_Size_Mbytes' => 8184
               'LV_Status' => 'available/syncd'
               'Mirror_copies' => 0
               'Schedule' => 'parallel'
               'Stripe_Size_Kbytes' => 0
               'Stripes' => 0
               'VG_Name' => '/dev/vg08'
         'lvol2' => HASH(0x40422834)
            'Allocated_PE' => 2046
            'Current_LE' => 2046
            'LV_Size' => 8184
            'LV_Status' => 'available/syncd'
            'PV_Data' => HASH(0x4042293c)
               '/dev/dsk/c3t12d0' => HASH(0x40422984)
                  'le_on_pv' => 1023
                  'pe_on_pv' => 1023
               '/dev/dsk/c3t13d0' => HASH(0x40422954)
                  'le_on_pv' => 1023
                  'pe_on_pv' => 1023
            'Used_PV' => 2
            'lvdata' => HASH(0x40422864)
               'Allocated_PE' => 2046
               'Allocation' => 'strict'
               'Bad_block' => 'on'
               'Consistency_Recovery' => 'MWC'
               'Current_LE' => 2046
               'IO_Timeout_Seconds' => 'default'
               'LV_Permission' => 'read/write'
               'LV_Size_Mbytes' => 8184
               'LV_Status' => 'available/syncd'
               'Mirror_copies' => 0
               'Schedule' => 'parallel'
               'Stripe_Size_Kbytes' => 0
               'Stripes' => 0
               'VG_Name' => '/dev/vg08'

each attribute is the same as output in the command but with underscores instead of spaces so "Allocated PE" is "Allocated_PE". I also had to add attributes "Physical_Vols","lvols","lvdata" and "PV_Data". (for logical volume data)

"Physical_Vols" is a hash refrence to all the Physical Volumes in the VG

"Alternate_Links" is an array refrence under each physical vol that contains all the links to that device (if any). First array element is "None" if there are no links. (Not listed above but its under "Physical_Vols"

"lvols" is a hash refrence to all the volume groups in the VG

"lv_data" is a hash refrence to lvdisplays output of the logical volume.

"PV_Data" is a hash refrence to all the physical volumes that make up the volume group and how much space they use on each.

The data can then be access through the provided methods (Subroutines).

FUNCTION ^

new()

The main object constructor that returns the hash refrence. The keys of the hash are all the volume groups on your system. It accepts the following paramters:

        target_type     values: local(default) or remote
        persistance     values: new(default) or old
        datafile        values: Path and name of datafile to store object
                                if persistance is selected.  Default is 
                                "/tmp/vginfo.dat"
        access_prog     values: ssh(default) or remsh
        access_system   values: localhost(default) or remote system name
        access_user     values: root(default) or remote username

The list of keys and attributes is illustrated in full in the example above.

traverse()

  example method that just traverses the object and prints it out.

get_all_lvols_on_disk( device_name => "/dev/dsk/c#t#d#" )

 returns refrence to hash of hashes
 hash key: /dev/dsk/c#t#d# is a refrence to another hash
       key:lvol is a refrence to yet another hash
          key: le_on_pv value: "###"
          key: pe_on_pv value: "###"

 not sure if I still need this method around but it works so I'll
 keep it in.

get_vg_physicalvols( volume_group => "/dev/vg##" )

  returns an array refrence to an array that contains all the physical
  volumes that make up the volume group

get_vg_physicalvol_attr( volume_group => "/dev/vg##", device_name => "/dev/dsk/c#t#d#", attribute => "PV_Status" )

  returns the scalar value of the attribute requested.

get_vg_lvols( volume_group => "/dev/vg##" )

  returns an array refrence to an array that contains all the logical
  volumes that make up the volume group

get_vg_lvol_attr_vgdisplay( volume_group => "/dev/vg##", logical_vol => "lvol#", attribute => "LV_Size" )

  returns the scalar value of the attribute requested.  these are
  the attributes gathered about the logical volume from the
  vgdisplay command

get_vg_lvol_attr_lvdisplay( volume_group => "/dev/vg##", logical_vol => "lvol#", attribute => "Stripes" )

  returns the scalar value of the attribute requested. These are
  the attributes gathered about the logical volume from the
  lvdisplay command.  There are several more than in the vgdisplay
  command.

get_vg_lvol_physicalvols( volume_group => "/dev/vg##", logical_vol => "/dev/lvol#" )

  returns an array refrence to an array that contains all the physical
  volumes that make up the logical volume.

get_vg_lvol_physicalvol_attr( volume_group => "/dev/vg##", logical_vol => "/dev/lvol#", device_name => "/dev/dsk/c#t#d#", attribute => "le_on_pv" ) =head2 get_vg_alternate_links( volume_group => "/dev/vg##", device_name => "/dev/dsk/c#t#d#", )

  returns the scalar value of the attribute requested.

CAVEATS ^

I beleive that you have to be root to run this.

AUTHOR ^

Christopher White, <chrwhite@seanet.com>

Copyright (C) 2001 Christopher White. All rights reserved. this program is fre e software; you can redistribute it and/or modify it under the same terms as pe rl itself.

SEE ALSO ^

vgdisplay(1M) lvdisplay(1M) pvdisplay(1M)

syntax highlighting: