[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-API] VM.create
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |