Server virtualization with Citrix XenServer

Hot Off the Press

Practical Experience

Low-budget servers have long since gained the ability to run more than one application at any given time. Capabilities restricted to expensive mainframes back in the 1970s have now found their way into classic x86 hardware. Multicore systems with sufficient RAM can easily run a handful of virtual server systems today. This capability not only reduces power and space requirements but also facilitates the handling of individual systems.

Permanent competition between VMware, Citrix, and even Microsoft has added features to the free entry-level versions in recent years. The free XenServer version will be fine for small businesses. But, if you need automatic memory management, high-availability options, and advanced reporting and monitoring, the Advanced version for around EUR 750 per server will take you a long way.

If you intend to virtualize both Windows and Linux systems, the current version of XenServer is a good choice. Check out links [3] through [5] for interesting reading material. The listing for this article are available from the Admin magazine website [6].

Listing 1

XenServer API

01 package de.pm.xenserver.test;
02
03 import java.net.URL;
04 import java.util.Map;
05
06 import com.Xensource.xenapi.Connection;
07 import com.Xensource.xenapi.Host;
08 import com.Xensource.xenapi.Session;
09 import com.Xensource.xenapi.Task;
10
11 import de.pm.xenserver.utils.Server;
12
13 public class TestAPI {
14
15     /**
16     * @param args
17     */
18     public static void main(String[] args) throws Exception {
19
20        if (args.length != 3 && args.length != 5)
21        {
22            System.out.println("Expected arguments: <host> <username> <password> [nfs server] [nfs path]");
23            return;
24        }
25
26        Server server = new Server(args[0], args[1], args[2]);
27        URL url = new URL("http://" + server.getHostname());
28        final Connection con = new Connection(url);
29        Session session = Session.loginWithPassword(con, server.getUsername(), server.getPassword(), "1.3");
30
31        Host host = session.getThisHost(con);
32
33        Map<Host, Host.Record> allhostrecs = host.getAllRecords(con);
34        System.out.println("got: " + allhostrecs.size() + " records");
35        if (allhostrecs.size() > 0)
36        {
37            System.out.println(allhostrecs.values().toArray()[0].toString());
38        }
39
40        Map<Task, Task.Record> allrecords = Task.getAllRecords(con);
41        System.out.println("got: " + allrecords.size() + " records");
42        if (allrecords.size() > 0)
43        {
44  System.out.println(allrecords.values().toArray()[0].toString());
45        }
46
47        Session.logout(con);
48     }
49
50 }

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus