问题描述
我开发用PHP Xen的管理Web应用程序。在VDI(虚拟磁盘映像)重命名API和调整的API的使用都非常一致。我没有设法成功调整大小VDI。你觉得我在做什么错在这里。
重命名功能:
函数xenapi_set_vdi_name($会议,$ REF,$名)
{
康涅狄格州$ = $会议[0];
$ SESS =新xmlrpcval($会议[1]);
$ VDI =新xmlrpcval($ REF);
$ NAME =新xmlrpcval($名);
$味精=新xmlrpcmsg(VDI.set_name_label,阵列($ SESS,$ VDI,$名)); $解析度= $ conn->发($味精); 如果($水库 - >故障code())
返回false;
$ VAL = $水库>值();
$状态= $ val-> structmem(状态);
如果($岗位> scalarval()=成功!)
返回false; $值= $ val-> structmem(值);
返回$值 - > scalarval();
}
重命名工作用法:
...
xenapi_set_vdi_name($会议,$ VDI,NewNameToMyVDI);
...
调整大小功能:
函数xenapi_set_vdi_virtual_size($会议,$ REF,$大小)
{
康涅狄格州$ = $会议[0];
$ SESS =新xmlrpcval($会议[1]);
$ VDI =新xmlrpcval($ REF);
$大小=新xmlrpcval($大小);
$味精=新xmlrpcmsg(VDI.set_virtual_size,阵列($ SESS,$ VDI,$大小)); $解析度= $ conn->发($味精); 如果($水库 - >故障code())
返回false;
$ VAL = $水库>值();
$状态= $ val-> structmem(状态);
如果($岗位> scalarval()=成功!)
返回false; $值= $ val-> structmem(值);
返回$值 - > scalarval();
}
不工作调整用法:
...
$大小='27011707392';
的setType($大小,整数);
xenapi_set_vdi_virtual_size($会议,$ VDI,$大小);
...
新的大小值的物理服务器上可与XEN命令:
XE VDI-调整UUID =91fe671c-93e1-4162-8128-96fedc3c215c磁盘大小=27011707392
从快看看这个:
我认为你应该尝试使用不是调整或调整在线的方法,而不是设置虚拟大小。
I am developing a Xen management webapp with Php. The VDI (virtual disk image) renaming API and resizing APIs usage are very same. I haven't managed to succeed resizing the VDI. Do you think what I am doing wrong here.
Renaming function:
function xenapi_set_vdi_name($session, $ref, $name)
{
$conn = $session[0];
$sess = new xmlrpcval($session[1]);
$vdi = new xmlrpcval($ref);
$name = new xmlrpcval($name);
$msg = new xmlrpcmsg("VDI.set_name_label", array($sess, $vdi, $name));
$res = $conn->send($msg);
if ($res->faultcode())
return false;
$val = $res->value();
$status = $val->structmem("Status");
if ($status->scalarval() != "Success")
return false;
$value = $val->structmem("Value");
return $value->scalarval();
}
Renaming working usage:
...
xenapi_set_vdi_name($session, $vdi, "NewNameToMyVDI");
...
Resizing function:
function xenapi_set_vdi_virtual_size($session, $ref, $size)
{
$conn = $session[0];
$sess = new xmlrpcval($session[1]);
$vdi = new xmlrpcval($ref);
$size = new xmlrpcval($size);
$msg = new xmlrpcmsg("VDI.set_virtual_size", array($sess, $vdi, $size));
$res = $conn->send($msg);
if ($res->faultcode())
return false;
$val = $res->value();
$status = $val->structmem("Status");
if ($status->scalarval() != "Success")
return false;
$value = $val->structmem("Value");
return $value->scalarval();
}
Not working resizing usage:
...
$size = '27011707392';
settype($size, "integer");
xenapi_set_vdi_virtual_size($session, $vdi, $size);
...
New size value works with XEN command on physical server as:
xe vdi-resize uuid="91fe671c-93e1-4162-8128-96fedc3c215c" disk-size="27011707392"
From a quick look at this:http://xen.org/files/XenCloud/ocamldoc/apidoc.html?c=VDI
I think that you should try using either "resize" or "resize online" methods instead of "set virtual size".
这篇关于VDI调整API不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!