Moves a physical partition to a specified physical volume.
Logical Volume Manager Library (liblvm.a)
#include <lvm.h>
int lvm_migratepp (MigratePP) struct migratepp *MigratePP;
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; }
If the logical partition to which the old physical partition is allocated has two physical copies, the migration takes place in the following sequence:
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.
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:
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.
MigratePP | Points to the migratepp structure. |
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. |
If the lvm_migratepp subroutine fails, it returns one of the following values:
This subroutine is part of Base Operating System (BOS) Runtime.
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.