WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] Problem starting a Windows Guest with Java bindings

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] Problem starting a Windows Guest with Java bindings
From: Matthew Donovan <matthew@xxxxxxxxxxxxxx>
Date: Thu, 7 Aug 2008 09:50:17 -0400
Delivery-date: Thu, 07 Aug 2008 06:42:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
I got the Java bindings for the enterprise version and have been trying to
start a Windows guest (HVM) with them.  The code compiles and runs and the
output of "xm list" shows the new VM.  However, the VM does not appear to
run.  It shows no time in the "xm list" output and I don't get a window
showing it booting.  To get rid of it, I have to do "xm destroy" and "xm
delete" commands.  I've been trying to put it all together using examples
from different languages starting linux guests and so far I haven't found
the right incantation.

Can someone point out what I'm doing wrong? 
 
Thanks a lot!
-matthew
 
CODE (minus exception handling):
 
Connection c = new Connection ("http://localhost:9363";, null, null);
 
//
//  Set up VM record with fields from config file.
//
VM.Record rec = new VM.Record ();
rec.actionsAfterCrash           = Types.OnCrashBehaviour.destroy;
rec.actionsAfterReboot          = Types.OnNormalExit.restart;
rec.actionsAfterShutdown        = Types.OnNormalExit.destroy;
rec.affinity                    = null;
 
Set <Types.VmOperations> ops = new HashSet <Types.VmOperations> ();
ops.add (Types.VmOperations.DESTROY); 
ops.add (Types.VmOperations.PAUSE); 
ops.add (Types.VmOperations.RESUME); 
ops.add (Types.VmOperations.START); 
ops.add (Types.VmOperations.UNPAUSE); 
rec.allowedOperations           = ops;
 
rec.consoles                    = new HashSet <Console> ();
rec.crashDumps                  = new HashSet <Crashdump> ();
rec.currentOperations           = new HashMap <String, Types.VmOperations>
();
rec.domarch                     = null;
rec.domid                       = new Long (-1);
rec.guestMetrics                = null; 
rec.powerState                  = Types.VmPowerState.RUNNING;
rec.nameLabel                   = "winvista";
rec.HVMBootParams               = new HashMap <String, String> ();
rec.HVMBootParams.put ("order", "c");
rec.HVMBootPolicy               = "BIOS order";
rec.HVMShadowMultiplier         = new Double(1.0);
rec.isATemplate                 = false;
rec.isControlDomain             = false;
rec.lastBootCPUFlags            = new HashMap <String, String> ();
rec.memoryDynamicMax            = new Long (1024*1024*1024);
rec.memoryStaticMax             = new Long (1024*1024*1024);
rec.PVKernel                    = "/usr/lib/xen/boot/hvmloader";
rec.platform                    = new HashMap <String, String> ();
//
//      I haven't found documenation for what should go here so I hope
there's
//      no harm in putting everything in and letting Xend sort it out.  I
haven't
//      seen any errors so far.
//
rec.platform.put ("sdl", "1");
rec.platform.put ("usb", "0");
rec.platform.put ("monitor", "0");
rec.platform.put ("acpi", "1");
rec.platform.put ("pae", "1");
rec.platform.put ("device_model", "/usr/lib/xen/bin/qemu-dm");
rec.platform.put ("stdvga", "0");
rec.platform.put ("vncunused", "1");
rec.platform.put ("usbdevice", "tablet");
rec.platform.put ("localtime", "0");
rec.platform.put ("apic", "1");
rec.platform.put ("rtc_timeoffset", "0");
rec.platform.put ("serial", "pty");
rec.platform.put ("nographic", "0");
rec.platform.put ("vnc", "0");
rec.platform.put ("boot", "cda");
rec.platform.put ("isa", "0");
rec.VCPUsAtStartup              = new Long(1); 
rec.VCPUsMax                    = new Long(1); 
 
VM vm = VM.create (c, rec);
System.out.println ("VM Created : "+vm.toWireString()); 
 
//
//  Setup and create VDI
//  
Set <SR> srs = SR.getByNameLabel (con, "Local");
VDI.Record vdiRec = new VDI.Record ();
vdiRec.nameLabel = "disk";
vdiRec.parent = null;
vdiRec.sharable = false;
vdiRec.readOnly = false;
//
//  /dev/vgvms/vista0 is a logical volume
//
vdiRec.location = "phy:/dev/vgvms/vista0"; 
vdiRec.otherConfig = new HashMap <String, String> ();
vdiRec.otherConfig.put ("location", "phy:/dev/vgvms/vista0");
vdiRec.SR = srs.iterator().next();
VDI vdi = VDI.create (c vdiRec);
            
//
//  Set up and create a VDB
//  
VBD.Record vbdRecord = new VBD.Record ();
vbdRecord.device = "hda";
vbdRecord.bootable = true;
vbdRecord.mode = Types.VbdMode.RW;
vbdRecord.type = Types.VbdType.DISK;
vbdRecord.VM  = vm;
vbdRecord.VDI = vdi;
VBD vbd = VBD.create (c, vbdRecord);
 
//
//  Create a console
Console.Record cRec = new Console.Record ();
cRec.protocol = Types.ConsoleProtocol.RFB;
cRec.otherConfig = new HashMap <String, String> ();
//cRec.otherConfig.put ("vnc", "0");
cRec.otherConfig.put ("vncunused", "1");
cRec.otherConfig.put ("vncpassword", "");
cRec.otherConfig.put ("serial", "pty");
//cRec.otherConfig.put ("stdvga", "0");
//cRec.otherConfig.put ("monitor", "1");
cRec.VM = vm;
Console console = Console.create (c, cRec);
//
//  Now start the VM.
//
//  Xend doesn't accept the third argument so the VM class was modified
//  to not send it.  I haven't changed the method signature yet because 
//  I'm still working on it all.
//
vm.start (c, false, false);




________________________________

        From: Michal Krysinski [mailto:rozbudowywowywacz@xxxxxxxxx] 
        Sent: Tuesday, August 05, 2008 5:49 AM
        To: xen-api@xxxxxxxxxxxxxxxxxxx
        Subject: Re: [Xen-API] What happened to the Java bindings?
        
        

        unfortunately i don't.
        

        what i did for sure was changing some constants to lowercase:

        Types.java

        public class Types{

        ...

        public enum OnNormalExit{

        //everyting to lowercase here

        }

                public enum OnCrashBehaviour{

        // lowercase

        }

        ...

        }

        it is likely that other enums have to be modified as well (these
were enough for my purposes)

        cheers, m

        2008/8/5 Jesse Pasichnyk <jesse@xxxxxxxxxxxxx>
        

                Do you have documented the differences you had to make
changes for?
                
                

                Thanks,

                Jesse

                 

                From: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:xen-api-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Michal Krysinski
                Sent: Monday, August 04, 2008 2:19 PM
                To: Matthew Donovan
                Cc: xen-api@xxxxxxxxxxxxxxxxxxx
                Subject: Re: [Xen-API] What happened to the Java bindings?

                 

                
                hey,
                http://community.citrix.com/display/cdn/XenServer+SDK here
are the bindings. they're for enterprise version, but by applying slight
modifications I was able to use them with open source xen. 
                cheers, m
                
                2008/8/4 Matthew Donovan <matthew@xxxxxxxxxxxxxx>

                        I've found numerous references to some XenAPI Java
Bindings but the link
        
(http://www.cl.cam.ac.uk/~tw275/java-binding-source.tar.gz
<http://www.cl.cam.ac.uk/%7Etw275/java-binding-source.tar.gz> ) seems to be
                        dead.
                        
                        Is there an updated link?  Is the code just gone?
                        
                        Thanks
                        -matthew
                        
                        _______________________________________________
                        xen-api mailing list
                        xen-api@xxxxxxxxxxxxxxxxxxx
                        http://lists.xensource.com/mailman/listinfo/xen-api

                 



_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] Problem starting a Windows Guest with Java bindings, Matthew Donovan <=