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

lvm_migratepp Subroutine

Purpose

Moves a physical partition to a specified physical volume.

Library

Logical Volume Manager Library (liblvm.a)

Syntax

#include <lvm.h>
int lvm_migratepp (MigratePP)
struct migratepp *MigratePP;

Description

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

The lvm_migratepp subroutine moves the physical partition specified by the oldpp_num field from the physical volume specified by the oldpv_id field to the physical partition, the newpp_num field, located on the physical volume given in the newpv_id field. The vg_id field specifies the volume group that contains both the old physical volume and the new physical volume. This volume group should be varied on, or an error is returned.

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

struct migratepp{
       struct unique_id vg_id;
       long    oldpp_num;
       long    newpp_num;
       struct unique_id oldpv_id;
       struct unique_id newpv_id;
   } 

Migration with Two Physical Copies

If the logical partition to which the old physical partition is allocated has two physical copies, the migration takes place in the following sequence:

  1. Extend the logical partition to add the new physical partition copy.
  2. Resynchronize the logical partition in an attempt to make the new physical partition non-stale.
  3. Reduce the logical partition to delete the old physical partition copy.

For the migration to complete successfully, it is not necessary for the resynchronization phase to complete successfully. However, it is always necessary that each logical partition have at least one good physical copy.

If the phase 1 extension of the new physical partition fails, you will receive the error code from the extension.

In general, if the extension in phase 1 succeeds, the migration will usually be successful. The migration might not be successful even if the phase 1 extension is successful when the old physical partition being migrated from is the only good physical copy of the logical partition. If the phase 2 resynchronization fails, and the phase 3 reduction fails because the old partition is still the only good physical copy of the logical partition, an LVM_MIGRATE_FAIL error code is returned.

It is very unlikely for the phase 3 reduction to fail, but failure is possible if an error occurs, such as being unable to allocate memory in the kernel due to a lack of system resources.

If the phase 2 resynchronization fails, but the phase 3 reduction of the old partition is successful, you will receive the LVM_RESYNC_FAILED return code to indicate the migration was successful, but the resynchronization of the logical partition was not.

If the phase 2 resynchronization completes successfully, the migration is successful. The LVM_SUCCESS return code is returned whether or not the phase 3 reduction of the old physical partition is successful.

Migration with Three Physical Copies

If the logical partition to which the old physical partition is allocated has three physical copies, the migration will take place in the following sequence:

  1. Reduce the logical partition to delete the old physical partition copy.
  2. Extend the logical partition to add the new physical partition copy.
  3. Resynchronize the logical partition.

If the phase 1 reduction of the old physical partition fails, you will receive the error code from the reduction. If the reduction fails because the old partition is the only good physical copy of the logical partition, an LVM_INVLPRED error code is returned. In this case, you should attempt to resynchronize the logical partition in question. If the resynchronization succeeds, you should attempt the migration again.

In order for the migration to be successful, both the phase 1 reduction and the phase 2 extension must be successful. If the phase 2 extension fails, an attempt will be made to extend and add back the old physical partition. If the old physical partition can be added back and the logical partition is back to its original configuration, you will receive the LVM_MIGRATE_FAIL error code to indicate that the migration failed. If the old partition cannot be added back, you will receive an LVM_LOSTPP error code to indicate that a physical partition copy has been lost and the logical partition does not have its original number of copies. It is not very likely for either of the extensions described above to fail, but it is possible to have a failure due to an error such as being unable to allocate memory in the kernel due to a lack of system resources.

If the phase 2 extension completes successfully, the migration is successful. If the phase 3 resynchronization completes successfully, you will receive a return code of LVM_SUCCESS. If the resynchronization is not successful, you will receive the LVM_RESYNC_FAILED error code to indicating that although the migration was successful, the resynchronization of the logical partition was not.

Parameters

MigratePP Points to the migratepp structure.

Return Values

When successful, the lvm_migratepp subroutine returns the following return code:

LVM_RESYNC_FAILED The migrate succeeded, but all physical copies of the logical partition could not be resynchronized.

Error Codes

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

LVM_ALLOCERR A memory allocation error occurred.
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_INRESYNC The physical partition being migrated is allocated to a logical partition that is being resynced. The migration cannot be completed while the resync is in progress.
LVM_INVALID_MIN_NUM A minor number that is not valid was received.
LVM_INVALID_PARAM One of the parameters passed in did not have a valid value.
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 A device has a major number that does not correspond to the volume group being worked in.
LVM_INVLPRED A reduction was requested that would leave a logical partition with no good copies.
LVM_LOSTPP The migration failed and the logical partition could not be restored to its original configuration.
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_MIGRATE_FAIL The migration failed because the requested move would leave the logical partition without a good physical copy.
LVM_NOTCHARDEV A device is not a raw or character device.
LVM_NOTSYNCED The resync involving the physical partitions of the migratepp call was not complete.
LVM_OFFLINE The volume group is offline and should be online.

Implementation Specifics

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

Related Information

The lvm_querypv subroutine, 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.


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