提交 af933f6f 编写于 作者: D Daniel Veillard

* src/virsh.c: applied SetMem cleanup patch from Mark Johnson

Daniel
上级 852f4340
Mon Jun 18 10:32:14 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: applied SetMem cleanup patch from Mark Johnson
Fri Jun 15 16:21:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* configure.in: Solaris header file fixes (Mark Johnson).
......
......@@ -1668,6 +1668,7 @@ static int
cmdSetmem(vshControl * ctl, vshCmd * cmd)
{
virDomainPtr dom;
virDomainInfo info;
int kilobytes;
int ret = TRUE;
......@@ -1684,6 +1685,18 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd)
return FALSE;
}
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Unable to verify MaxMemorySize"));
return FALSE;
}
if (kilobytes > info.maxMem) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Invalid value of %d for memory size"), kilobytes);
return FALSE;
}
if (virDomainSetMemory(dom, kilobytes) != 0) {
ret = FALSE;
}
......@@ -1712,6 +1725,7 @@ static int
cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
{
virDomainPtr dom;
virDomainInfo info;
int kilobytes;
int ret = TRUE;
......@@ -1728,7 +1742,22 @@ cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
return FALSE;
}
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Unable to verify current MemorySize"));
return FALSE;
}
if (kilobytes < info.memory) {
if (virDomainSetMemory(dom, kilobytes) != 0) {
virDomainFree(dom);
vshError(ctl, FALSE, _("Unable to shrink current MemorySize"));
return FALSE;
}
}
if (virDomainSetMaxMemory(dom, kilobytes) != 0) {
vshError(ctl, FALSE, _("Unable to change MaxMemorySize"));
ret = FALSE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册