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

liudewei liudewei at neusoft.com
Tue Mar 29 21:29:47 PDT 2011


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 SOURCE attribute (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. 
---------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110330/e69e618b/attachment-0002.htm>


More information about the Users mailing list