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

Re: [Xen-API] Hello

To: Stefan Berger <stefanb@xxxxxxxxxx>
Subject: Re: [Xen-API] Hello
From: Stefan Berger <stefanb@xxxxxxxxxx>
Date: Sat, 5 May 2007 09:37:10 -0400
Cc: Fabio Sbano <fsbano@xxxxxxxxx>, xen-api@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 05 May 2007 06:35:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <OFEEF83919.4323DBDE-ON852572D2.00489CEA-852572D2.00493CF8@xxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx

xen-api-bounces@xxxxxxxxxxxxxxxxxxx wrote on 05/05/2007 09:20:02 AM:

>
>
> xen-api-bounces@xxxxxxxxxxxxxxxxxxx wrote on 05/05/2007 06:30:52 AM:
>
> > I´m trying get the 'VM.get_record' of all VMs... however I´m not
> > obtaining Status=Success by uuid
>
> I get this error message from the xmlrpc library:
>
> Failed to parse servers response: Unknown type: nil
>
> The problem seems to be related to the 'platform' entry in the
> record that's returned. It's a dictionary by itself and looks like this:
>
> {'rtc_timeoffset' : None }
>
> The parser seems to get upset about the 'None'. So if you comment
> the 'platform' (by putting a '#' in front of the 'platform') in
> tools/python/xen/xend/XendAPI:VM_get_record() where the vm record is
> built then this function call should work. You have to compile and
> restart xend for this:
>
> cd xen-unstable.hg/tools/python
>
> make


make install

   Stefan

>
> xend restart
>
>
>
>    Stefan
>
> >
> > Can help me ?
> >
> > import java.net.MalformedURLException;
> > import java.net.URL;
> > import java.util.HashMap;
> > import org.apache.xmlrpc.XmlRpcException;
> > import org.apache.xmlrpc.client.XmlRpcClient;
> > import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
> >
> > public class xenapi {
> >
> >    private static XmlRpcClientConfigImpl config;
> >     private static XmlRpcClient client;
> >
> >     /**
> >      * @param args
> >      */
> >     public static void main(String[] args) {
> >         URL url = ""> > >         try {
> >             url = "" URL("http://10.1.1.21:9363");
> >         } catch (MalformedURLException e) {
> >             System.out.println("Malformed URL?");
> >             System.exit(-1);
> >         }
> >         config = new XmlRpcClientConfigImpl();
> >         config.setServerURL(url);
> >         client = new XmlRpcClient();
> >         client.setConfig(config);
> >         String username = "any";
> >         String password = "any";
> >         Object[] params = new Object[]{username, password};
> >         HashMap<String, String> result = null;
> >         try {
> >            result = (HashMap)
> > client.execute("session.login_with_password", params);
> >         } catch (XmlRpcException e) {
> >             System.out.println("Could not open session");
> >             System.exit(-1);
> >         }
> >         String status = result.get("Status");
> >         if (status.compareTo("Success") == 0) {
> >            String uuid = result.get("Value");
> >             params = new Object[]{uuid};
> >             try {
> >                 result = (HashMap) client.execute("VM.get_all", params);
> >                 System.out.println(result);
> >                 Object res = result.get("Value");
> >                 if (res.getClass() == Object[].class) {
> >                    Object[] arr = (Object[])res;
> >                    int i;
> >                    for (i = 0; i < arr.length; i++) {
> >                       System.out.println("VM UUID: " +(String)arr[i]);
> >                       String s = (String) arr[i];
> >                       params = new Object[]{s};
> >                       try {
> >                          result = (HashMap) client.execute("VM.
> > get_record", params);
> >                          System.out.println(result);
> >                       } catch (XmlRpcException e) { }
> >                    }
> >                 }
> >             } catch (XmlRpcException e) {
> >                 System.out.println("Could not get VMs' UUIDs");
> >                 System.exit(-1);
> >             }
> >         }
> >     }
> > }
> >
> > _______________________________________________
> > xen-api mailing list
> > xen-api@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
> _______________________________________________
> xen-api mailing list
> xen-api@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>