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] VM.create

To: Michał Krysiński <rozbudowywowywacz@xxxxxxxxx>
Subject: Re: [Xen-API] VM.create
From: Joshua West <jwest@xxxxxxxxxxxx>
Date: Sat, 05 Jul 2008 15:54:37 -0400
Cc: xen-api@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 05 Jul 2008 12:55:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4a8ede090807040638s5370ebb0gbe604344414421e0@xxxxxxxxxxxxxx>
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>
References: <4a8ede090807040638s5370ebb0gbe604344414421e0@xxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (X11/20080421)
Hi Michal,

VDI creation requires that one specifies the Storage Repository used. 
Most likely, what you're concerned with is just the "Local" storage
repository... meaning nothing fancy thats handled by Xen (like iSCSI
connection setup/teardown, as I believe is implemented in Citrix XenServer).

So, how does one get the reference ID of the Local storage repository? 
I'm not sure how it is in Java, but with Python:

sr_uuid = session.xenapi.SR.get_by_name_label('Local')

You'll need to do the same in your Java code and then pass the Local SR
reference ID as an attribute of your vdirec object.  Meaning, vdirec.SR
= sr_uuid;.

Here's some example code used in Python to build a VDI:

def CreateVDI(SR, Name, Location):
        VDI_ref = session.xenapi.VDI.create({   'name_label': Name, 
                                                'name_description': "", 
                                                'SR': SR, 
                                                'virtual_size': 0, 
                                                'type': "system", 
                                                'sharable': True, 
                                                'read_only': False, 
                                                'other_config': { 'location': 
Location }})
        return VDI_ref

Note how the location (aka phy:/dev/xen-disks/debianGuestRoot) is part
of the other_config attribute.  Not sure if this is the case in the Xen
3.2 API, but it is such in Xen 3.1.x's.

Hope this helps.

Michał Krysiński wrote:
> Hello,
> I'm working on a project involving the dynamic management of Xen
> domains. I'm using the open source version of Xen (3.2), LVM for
> storage and Java bindings. I was able to list running VMs by calling
> VM.getAllRecords(connection). The next thing I'm trying to do is to
> create a new VM. It's not a problem with the command line tool xm:.
>
> xm create myConfig -c
>
> here are the contents of the config file:
>
> name="debianGuest"
> memory=256
> kernel="/boot/vmlinuz-2.6.24-18-xen"
> ramdisk="/boot/initrd.img-2.6.24-18-xen"
> vif=['bridge=eth0']
> disk=['phy:/dev/xen-disks/debianGuestRoot,sda1,w','phy:/dev/xen-disks/debianGuestSwap,sda2,w']
> root="/dev/sda1 ro"
>
> How am I supposed to do the same thing with Java calls (the problem is
> with the disk part, other arguments seem rather straighforward)?
>        
>        VDI.Record vdirec = new VDI.Record();
>         vdirec.location = "phy:/dev/xen-disks/debianGuestRoot";
>         vdirec.nameLabel = "debianGuestRoot";
>         try {
>             VDI.create(c,vdirec);
>             //fails: [HANDLE_INVALID, SR, OpaqueRef:NULL]
>         } catch ...
>        
> Should I create an SR or introduce the partition storing LVM images to
> Xen somehow? (SR.introduce fails: MESSAGE_METHOD_UNKNOWN)
>
> Regards, Michał Krysiński
> ------------------------------------------------------------------------
>
> _______________________________________________
> xen-api mailing list
> xen-api@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/mailman/listinfo/xen-api
>   


-- 
Joshua West
Systems Engineer
Brandeis University
http://www.brandeis.edu


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

<Prev in Thread] Current Thread [Next in Thread>