diff options
author | Richard Jones <rjones@redhat.com> | 2009-05-18 17:16:24 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-05-18 17:16:24 +0100 |
commit | 85ed8cef99c19b4143844991d14e0b848fecc5da (patch) | |
tree | 61e34886d4ec4b59a37c8e4ab6779e7ef7834f34 /java | |
parent | adf0974245af914c46b48766d0efdd5ee8608dda (diff) | |
download | libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.tar.gz libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.tar.xz libguestfs-85ed8cef99c19b4143844991d14e0b848fecc5da.zip |
Add vg-activate{,-all} commands, and resize recipe.
Diffstat (limited to 'java')
-rw-r--r-- | java/com/redhat/et/libguestfs/GuestFS.java | 50 | ||||
-rw-r--r-- | java/com_redhat_et_libguestfs_GuestFS.c | 47 |
2 files changed, 97 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index 7eafce0f..a6d6f6db 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -2864,4 +2864,54 @@ public class GuestFS { private native String _sfdisk_disk_geometry (long g, String device) throws LibGuestFSException; + /** + * activate or deactivate all volume groups + * + * This command activates or (if "activate" is false) + * deactivates all logical volumes in all volume groups. If + * activated, then they are made known to the kernel, ie. + * they appear as "/dev/mapper" devices. If deactivated, + * then those devices disappear. + * + * This command is the same as running "vgchange -a y|n" + * + * @throws LibGuestFSException + */ + public void vg_activate_all (boolean activate) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("vg_activate_all: handle is closed"); + _vg_activate_all (g, activate); + } + private native void _vg_activate_all (long g, boolean activate) + throws LibGuestFSException; + + /** + * activate or deactivate some volume groups + * + * This command activates or (if "activate" is false) + * deactivates all logical volumes in the listed volume + * groups "volgroups". If activated, then they are made + * known to the kernel, ie. they appear as "/dev/mapper" + * devices. If deactivated, then those devices disappear. + * + * This command is the same as running "vgchange -a y|n + * volgroups..." + * + * Note that if "volgroups" is an empty list then all + * volume groups are activated or deactivated. + * + * @throws LibGuestFSException + */ + public void vg_activate (boolean activate, String[] volgroups) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("vg_activate: handle is closed"); + _vg_activate (g, activate, volgroups); + } + private native void _vg_activate (long g, boolean activate, String[] volgroups) + throws LibGuestFSException; + } diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c index be7ea9f2..3bf5c7e5 100644 --- a/java/com_redhat_et_libguestfs_GuestFS.c +++ b/java/com_redhat_et_libguestfs_GuestFS.c @@ -2847,3 +2847,50 @@ Java_com_redhat_et_libguestfs_GuestFS__1sfdisk_1disk_1geometry return jr; } +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1vg_1activate_1all + (JNIEnv *env, jobject obj, jlong jg, jboolean jactivate) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int activate; + + activate = jactivate; + r = guestfs_vg_activate_all (g, activate); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1vg_1activate + (JNIEnv *env, jobject obj, jlong jg, jboolean jactivate, jobjectArray jvolgroups) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int activate; + int volgroups_len; + const char **volgroups; + int i; + + activate = jactivate; + volgroups_len = (*env)->GetArrayLength (env, jvolgroups); + volgroups = guestfs_safe_malloc (g, sizeof (char *) * (volgroups_len+1)); + for (i = 0; i < volgroups_len; ++i) { + jobject o = (*env)->GetObjectArrayElement (env, jvolgroups, i); + volgroups[i] = (*env)->GetStringUTFChars (env, o, NULL); + } + volgroups[volgroups_len] = NULL; + r = guestfs_vg_activate (g, activate, volgroups); + for (i = 0; i < volgroups_len; ++i) { + jobject o = (*env)->GetObjectArrayElement (env, jvolgroups, i); + (*env)->ReleaseStringUTFChars (env, o, volgroups[i]); + } + free (volgroups); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + |