[one-users] Call "one.image.allocate" of xml-rpc API question!

Carlos Martín Sánchez cmartin at opennebula.org
Wed Mar 30 02:53:50 PDT 2011


Hi,

As you pointed out, your client program has to copy or create the file, and
then enable the image.
The command oneimage already does that. You may want to check it (the binary
executable is actually a ruby script) and ImageRepository.rb

Regards
--
Carlos Martín, MSc
Project Major Contributor
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org


2011/3/30 liudewei <liudewei at neusoft.com>

>   Hi,All
>
> When I call “one.image.allocate” of  xml-rpc API
> ,the new image file can't be created .
> but,oneimage register is no problem!
>
>  oneimage list command follows:
>
>  35 oneadmin         0328_mkImg_1   OS   Mar 28, 2011 02:12 Yes  No disa     0
>
>   oneimage show 35 follows
>
> IMAGE  INFORMATION
>
>  ID             : 35
> NAME           : 0328_mkImg_1
> TYPE           : OS
> REGISTER TIME  : 03/28 10:12:57
> PUBLIC         : Yes
> PERSISTENT     : No
>
> SOURCE         : /opt/nebula/images/afa5ebb70546e3786197e607b4092f1e13c5a5e4
> STATE          : disa
> RUNNING_VMS    : 0
>
> IMAGE TEMPLATE
> DESCRIPTION=0328_mkImg_1 desc
> DEV_PREFIX=hd
> NAME=0328_mkImg_1
> PATH=/one_images/8/images/disk.0
> TYPE=OS
>
>
> The file path to SOURCE  Attribute,but the actual file isn't generated!
>
> My java project code the following:
>
> StringBuffer template = new StringBuffer();
>
>
> template.append("NAME=").append("\"").append(name).append("\"").append("\n");
>
> template.append("DESCRIPTION=").append("\"").append(desc).append("\"").append("\n");
> template.append("PUBLIC = ").append("YES").append("\n");
> template.append("TYPE=").append("OS").append("\n");
> template.append("PERSISTENT=").append("NO").append("\n");
> template.append("DEV_PREFIX=").append("\"hd\"").append("\n"); // 可选.
> //template.append("BUS=").append("").append("\n");
>
> template.append("PATH=").append("/one_images/").append(vminfo.getVmId()).append("/images/disk.0").append("\n");
>
>
>
>
>  Vector params = new Vector();
> params.add(template);
> RPCUtil util = new RPCUtil(this.imageDAO.getDataCenterIp(null));//get
> opennebula ip/username/passwd
> Object[] rsObject = util.executeRpcMethod("one.image.allocate", params);
> if (!(Boolean) rsObject[0]){
>     runLog.error((String)rsObject[1]);
>     throw new BaseException("failed to image register!");
> }
>
>
>
> From opennebula.org document said:
>
> When a new image template is allocated, the core will insert the image in
> the system in DISABLED state. The developer has to request the extended
> information for the new image, and copy (or create) the file to the SOURCEattribute (added by the core). After the file is copied (or created), the
> image has to be enabled.
>
>
> When I used the command "oneimage register  xxx.one" ,the new image file
> has generated!
>
> Waiting for your reply!
>
> Thanks and Regars!
> david.
>
> 2011-03-30
> ------------------------------
> liudewei
>
> ---------------------------------------------------------------------------------------------------
> Confidentiality Notice: The information contained in this e-mail and any
> accompanying attachment(s)
> is intended only for the use of the intended recipient and may be
> confidential and/or privileged of
> Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader
> of this communication is
> not the intended recipient, unauthorized use, forwarding, printing,
> storing, disclosure or copying
> is strictly prohibited, and may be unlawful.If you have received this
> communication in error,please
> immediately notify the sender by return e-mail, and delete the original
> message and all copies from
> your system. Thank you.
>
> ---------------------------------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110330/a3824581/attachment-0003.htm>


More information about the Users mailing list