mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
* src/virsh.c: applied SetMem cleanup patch from Mark Johnson
Daniel
This commit is contained in:
parent
852f4340f7
commit
af933f6ff0
@ -1,3 +1,7 @@
|
|||||||
|
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>
|
Fri Jun 15 16:21:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
|
||||||
* configure.in: Solaris header file fixes (Mark Johnson).
|
* configure.in: Solaris header file fixes (Mark Johnson).
|
||||||
|
29
src/virsh.c
29
src/virsh.c
@ -1668,6 +1668,7 @@ static int
|
|||||||
cmdSetmem(vshControl * ctl, vshCmd * cmd)
|
cmdSetmem(vshControl * ctl, vshCmd * cmd)
|
||||||
{
|
{
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
|
virDomainInfo info;
|
||||||
int kilobytes;
|
int kilobytes;
|
||||||
int ret = TRUE;
|
int ret = TRUE;
|
||||||
|
|
||||||
@ -1684,6 +1685,18 @@ cmdSetmem(vshControl * ctl, vshCmd * cmd)
|
|||||||
return FALSE;
|
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) {
|
if (virDomainSetMemory(dom, kilobytes) != 0) {
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
@ -1712,6 +1725,7 @@ static int
|
|||||||
cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
|
cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
|
||||||
{
|
{
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
|
virDomainInfo info;
|
||||||
int kilobytes;
|
int kilobytes;
|
||||||
int ret = TRUE;
|
int ret = TRUE;
|
||||||
|
|
||||||
@ -1728,7 +1742,22 @@ cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
|
|||||||
return FALSE;
|
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) {
|
if (virDomainSetMaxMemory(dom, kilobytes) != 0) {
|
||||||
|
vshError(ctl, FALSE, _("Unable to change MaxMemorySize"));
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user