Hi I think I detected the origin of the libvirt Java binding crash in the case of domain migration though I do not know how to fix it yet . The fix should be in the src/jni/org_libvirt_Domain.c / migrate function. First: It turns out the that the C libvirt interface for migrate ( libvirt 0.6.1. + kvm-84) has a limitation with specifying the 'dname' parameter . It should be NULL to work ok , meaning the domain is migrated from the old host to the new host under the same domain name . If I try to specify a meaningful 'dname' then if it is the same name as the original host domain 'name' I will get a message saying : invalid domain pointer in no domain with matching id -1. If I am using 'dname' different than the original host domain 'name' it will complain that no such domain is found on the target host. So using NULL for 'dname' is the only one that makes the migrate work Using 'dname' = NULL with the Java binding causes it though to crash as below (see .log file). Fixing the jni code as below (see added 'if') does not help: src/jni/org_libvirt_Domain.c -------------------------------- JNIEXPORT jlong JNICALL Java_org_libvirt_Domain__1migrate (JNIEnv *env, jobject obj, jlong VDP, jobject dconn, jlong flags, jstring j_dname, jstring j_uri, jlong bandwidth){ virConnectPtr destVCP; const char *dname=NULL; const char *uri=NULL; //if String="", we pass NULL to the library if((*env)->GetStringLength(env, j_dname)>0) dname=(*env)->GetStringUTFChars(env, j_dname, NULL); //if String="", we pass NULL to the library if((*env)->GetStringLength(env, j_uri)>0) uri=(*env)->GetStringUTFChars(env, j_uri, NULL); //Extract the destination Conn Ptr destVCP=(virConnectPtr)(*env)->GetLongField(env, dconn, (*env)->GetFieldID(env, (*env)->GetObjectClass(env, dconn), "VCP", "J")); jlong retval = (jlong)virDomainMigrate((virDomainPtr)VDP, destVCP, flags, dname, uri, bandwidth) ; if (dname) (*env)->ReleaseStringUTFChars(env, j_dname, dname); if (uri) (*env)->ReleaseStringUTFChars(env, j_uri, uri); return retval; } Please your advice on how to solve the migrate for the Java binding thanks Zvi Dubitzky Virtualization and System Architecture Email:dubi@xxxxxxxxxx IBM Haifa Research Laboratory Phone: +972-4-8296182 Haifa, 31905, ISRAEL ----- Forwarded by Zvi Dubitzky/Haifa/IBM on 10/05/2009 12:59 ----- Zvi Dubitzky/Haifa/IBM 07/05/2009 13:49 To libvir-list@xxxxxxxxxx cc Subject Java api for libvirt migration I am trying to do a migrate of VM with libvirt 0.6.1 and kvm-84 . I am successful in doing it many times via the C interface . I can do most of the basic libvirt activity via the libvirt JAVA library (libvirt-java-0.2.1). When it comes to a migrate the JVM fails wit a log file attached below . Can someone help. My memory consumption in my JAVA test code is small. The migrate parameters I am sending with the Java are identical to those I use in the C case and is: destDomain = localDomain.migrate (dcon, // destination host Connect object VIR_MIGRATE_LIVE, null, //const char *dname destination domain name target_uri, //"tcp:9.148.28.13:4444" 0 // unsigned long bandwidth) - do not specify ); thanks Zvi Dubitzky Virtualization and System Architecture Email:dubi@xxxxxxxxxx IBM Haifa Research Laboratory Phone: +972-4-8296182 Haifa, 31905, ISRAEL
Attachment:
hs_err_pid6742.log
Description: Binary data
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list