[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

lvm_changepv Subroutine

Purpose

Changes the attributes of a physical volume in a volume group.

Library

Logical Volume Manager Library (liblvm.a)

Syntax

#include <lvm.h>
int lvm_changepv (ChangePV)
struct changepv *ChangePV;

Description

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

The lvm_changepv subroutine changes the state of the specified physical volume.

The changepv structure pointed to by the ChangePV parameter is defined in the lvm.h file and contains the following fields:

struct changepv{
   struct unique_id vg_id;
   struct unique_id pv_id;
   long rem_ret;
   long allocation;}
Field Definition
pv_id Specifies the state of the physical volume to be changed
rem_ret Should be set to either LVM_REMOVEPV or LVM_RETURNPV value. The LVM_REMOVEPV value temporarily removes the physical volume from the volume group. The LVM_RETURNPV returns the physical volume to the volume group.

When a physical volume is temporarily removed from the volume group, there will be no access to that physical volume through the Logical Volume Manager (LVM) while that physical volume is in the removed state. Also, when a physical volume is removed from the volume group, any copies of the volume group descriptor area which are contained on that physical volume are removed from the volume group. Therefore, copies of the volume group descriptor area will not be counted in the quorum count of descriptor area copies which are needed for a volume group to be varied on.

The allocation field should be set to LVM_NOALLOCPV to disallow the allocation of physical partitions to the physical volume, or LVM_ALLOCPV to allow the allocation of physical partitions to the physical volume. It is not necessary to change both state fields; for example, the allocation field could be set to LVM_NOALLOCPV and the rem_ret field could simply be set to 0 to indicate no change is desired. The vg_id field identifies the volume group that contains the physical volume to be changed. The volume group must be online, or an error is returned.

Parameters

ChangePV Specifies a pointer to the changepv structure.

Return Values

Upon successful completion, the lvm_changepv subroutine returns one of the following positive values:

LVM_REMRET_INCOMP The physical volume was removed or returned in the volume group descriptor area but not in the kernel. The change will take effect at the next varyon.
LVM_SUCCESS The physical volume was changed successfully.

Error Codes

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

LVM_ALLOCERR A memory allocation error occurred.
LVM_BELOW_QRMCNT The physical volume cannot be removed because there would not be a quorum of available physical volumes.
LVM_DALVOPN The logical volume reserved by the volume group could not be opened.
LVM_FORCEOFF The volume group has been forcefully varied off due to a loss of quorum.
LVM_INVALID_PARAM A field in the changepv structure is invalid, or the pointer to the changepv structure is invalid.
LVM_INVCONFIG An error occurred while attempting to configure this volume group into the kernel. This error will normally result if the module ID is invalid, if the major number given is already in use, or if the volume group device could not be opened.
LVM_INV_DEVENT The device entry for the physical volume is invalid and cannot be checked to determine if it is raw.
LVM_MAPFBSY The volume group is currently locked because system management on the volume group is being done by another process.
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 read or write the mapped file.
LVM_NOTCHARDEV The device specified is not a raw or character device.
LVM_OFFLINE The volume group containing the physical volume to be changed is offline and should be online.

Implementation Specifics

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

Related Information

The lvm_querypv subroutine.

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


[ Previous | Next | Contents | Glossary | Home | Search ]