[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

lvm_installpv Subroutine

Purpose

Installs a physical volume into a volume group.

Library

Logical Volume Manager Library (liblvm.a)

Syntax

#include <lvm.h>
int lvm_installpv (InstallPV)
struct installpv *InstallPV; 

Description

Note: You must have root user authority to use this subroutine.

The lvm_installpv subroutine installs a physical volume into a specified volume group. The physical volume must not exist in another volume group.

The installpv structure pointed to by the InstallPV parameter is found in the lvm.h file and is defined as follows:

struct installpv 
{
  char *pvname;
  struct unique_id vg_id;
  short int override;
  struct unique_id out_vg_id;
};
Field Description
pvname Specifies the character special file name, which can be either a full path name or a single file name that resides in the /dev directory (for example, rhdisk0) of the physical volume being installed into the volume group specified by the vg_id field. The pvname field must be a null-terminated string that ranges from 1 to LVM_NAMESIZ bytes, including the null byte, and must be the name of a raw character device. If a raw device is not specified for the pvname field, the Logical Volume Manager (LVM) will add an r to the file name in order to have a raw device name. If there is no raw device entry for this name, the LVM returns an LVM_NOTCHARDEV error code.
override Specifies whether or not the LVM_VGMEMBER error code should be ignored. If the override field is TRUE, the LVM installs the physical volume into the specified volume group even if the physical volume is a member of another volume group. This is done only if the other volume group is not varied on. If it is varied on, an LVM_MEMACTVVG error code is returned. If the override field is FALSE, an LVM_VGMEMBER error code is returned if the physical volume belongs to another volume group, whether that volume group is varied on or varied off. The LVM_ALRDYMEM error code is returned if the physical volume is already a member of the specified volume group. This error is returned regardless of the setting of the override field.
out_vg_id Contains the ID of the volume group that the physical volume is a member of. If either the LVM_MEMACTVVG or LVM_VGMEMBER error code is returned.

Each physical volume installed into a volume group contains a volume group descriptor area in the reserved area at the beginning of the physical volume. The volume group descriptor area contains information about the physical and logical volumes in the volume group. This descriptor area is used by the LVM to manage the logical and physical volumes in the volume group.

Parameters

InstallPV Points to the installpv structure.

Return Values

The lvm_installpv subroutine returns a value of 0 upon successful completion.

Error Codes

If the lvm_installpv subroutine fails, it returns one of the following values:

LVM_ALLOCERR A memory allocation error occurred.
LVM_ALRDYMEM The physical volume is already a member of the specified volume group.
LVM_BADBBDIR The physical volume could not be installed into the volume group because the bad block directory could not be read from or written to.
LVM_DALVOPN The logical volume reserved by the volume group could not be opened.
LVM_INVALID_PARAM An invalid parameter was passed into the routine.
LVM_INV_DEVENT A device entry is invalid and cannot be checked to determine if it is raw.
LVM_LVMRECERR The LVM record, which contains information about the volume group descriptor area, could not be read or written.
LVM_MAPFOPN The mapped file, which contains a copy of the volume group descriptor area used for making changes to the volume group, could not be opened.
LVM_MAPFRDWR An error occurred while trying to write to the mapped file.
LVM_MEMACTVVG The physical volume specified is a member of another volume group that is varied on. This error is returned when the override field is TRUE.
LVM_NOTCHARDEV The device specified is not a raw or character device.
LVM_OFFLINE The volume group specified is offline. It must be varied on to perform this operation.
LVM_PVMAXERR The physical volume cannot be installed into the specified volume group because the maximum allowed number of physical volumes are already installed in the volume group. The maximum number of physical volumes is LVM_MAXPVS.
LVM_PVOPNERR The physical volume device could not be opened.
LVM_RDPVID The record which contains the physical volume ID could not be read.
LVM_VGDASPACE The physical volume cannot be installed into the specified volume group because there is not enough space in the volume group descriptor area to add a description of the physical volume and its partitions.
LVM_VGMEMBER The physical volume cannot be installed into the specified volume group because its LVM record indicates it is already a member of another volume group. If the caller feels that the information in the LVM record is incorrect, the override field can be set to TRUE in order to override this error. This error is only returned when the override field is set to FALSE.
LVM_WRTDAERR An error occurred while trying to initialize either the Volume Group Descriptor Area, the Volume Group Status Area, or the Mirror-Write Consistency Cache Area on the physical volume.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The lvm_varyonvg subroutine.

List of Logical Volume Subroutines and Logical Volume Programming Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]