[libvirt] [PATCH] Remove qemudDomainSetMaxMemory.

As previously discussed[1], this patch removes the qemudDomainSetMaxMemory() function, since it doesn't work. This means that instead of getting somewhat cryptic errors, you will now get: error: Unable to change MaxMemorySize error: this function is not supported by the hypervisor: virDomainSetMaxMemory Which describes the situation perfectly. [1] https://www.redhat.com/archives/libvir-list/2010-February/msg00928.html Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_driver.c | 42 +----------------------------------------- 1 files changed, 1 insertions(+), 41 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c5490b2..6bfae93 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3816,46 +3816,6 @@ cleanup: return ret; } -static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { - struct qemud_driver *driver = dom->conn->privateData; - virDomainObjPtr vm; - int ret = -1; - - qemuDriverLock(driver); - vm = virDomainFindByUUID(&driver->domains, dom->uuid); - qemuDriverUnlock(driver); - - if (!vm) { - char uuidstr[VIR_UUID_STRING_BUFLEN]; - virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); - goto cleanup; - } - - if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); - goto cleanup; - } - - if (newmax < vm->def->memory) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot set max memory lower than current memory")); - goto cleanup; - } - - /* There isn't any way to change this value for a running qemu guest */ - qemuReportError(VIR_ERR_NO_SUPPORT, - "%s", _("cannot set max memory of an active domain")); - -cleanup: - if (vm) - virDomainObjUnlock(vm); - return ret; -} - - static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { struct qemud_driver *driver = dom->conn->privateData; qemuDomainObjPrivatePtr priv; @@ -9506,7 +9466,7 @@ static virDriver qemuDriver = { qemudDomainDestroy, /* domainDestroy */ qemudDomainGetOSType, /* domainGetOSType */ qemudDomainGetMaxMemory, /* domainGetMaxMemory */ - qemudDomainSetMaxMemory, /* domainSetMaxMemory */ + NULL, /* domainSetMaxMemory */ qemudDomainSetMemory, /* domainSetMemory */ qemudDomainGetInfo, /* domainGetInfo */ qemudDomainSave, /* domainSave */ -- 1.6.6.1

On Wed, Mar 10, 2010 at 02:18:37PM -0500, Chris Lalancette wrote:
As previously discussed[1], this patch removes the qemudDomainSetMaxMemory() function, since it doesn't work. This means that instead of getting somewhat cryptic errors, you will now get:
error: Unable to change MaxMemorySize error: this function is not supported by the hypervisor: virDomainSetMaxMemory
Which describes the situation perfectly.
[1] https://www.redhat.com/archives/libvir-list/2010-February/msg00928.html
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_driver.c | 42 +----------------------------------------- 1 files changed, 1 insertions(+), 41 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c5490b2..6bfae93 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3816,46 +3816,6 @@ cleanup: return ret; }
-static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { - struct qemud_driver *driver = dom->conn->privateData; - virDomainObjPtr vm; - int ret = -1; - - qemuDriverLock(driver); - vm = virDomainFindByUUID(&driver->domains, dom->uuid); - qemuDriverUnlock(driver); - - if (!vm) { - char uuidstr[VIR_UUID_STRING_BUFLEN]; - virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); - goto cleanup; - } - - if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); - goto cleanup; - } - - if (newmax < vm->def->memory) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot set max memory lower than current memory")); - goto cleanup; - } - - /* There isn't any way to change this value for a running qemu guest */ - qemuReportError(VIR_ERR_NO_SUPPORT, - "%s", _("cannot set max memory of an active domain")); - -cleanup: - if (vm) - virDomainObjUnlock(vm); - return ret; -} - - static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { struct qemud_driver *driver = dom->conn->privateData; qemuDomainObjPrivatePtr priv; @@ -9506,7 +9466,7 @@ static virDriver qemuDriver = { qemudDomainDestroy, /* domainDestroy */ qemudDomainGetOSType, /* domainGetOSType */ qemudDomainGetMaxMemory, /* domainGetMaxMemory */ - qemudDomainSetMaxMemory, /* domainSetMaxMemory */ + NULL, /* domainSetMaxMemory */ qemudDomainSetMemory, /* domainSetMemory */ qemudDomainGetInfo, /* domainGetInfo */ qemudDomainSave, /* domainSave */
ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 03/11/2010 10:39 AM, Daniel Veillard wrote:
On Wed, Mar 10, 2010 at 02:18:37PM -0500, Chris Lalancette wrote:
As previously discussed[1], this patch removes the qemudDomainSetMaxMemory() function, since it doesn't work. This means that instead of getting somewhat cryptic errors, you will now get:
error: Unable to change MaxMemorySize error: this function is not supported by the hypervisor: virDomainSetMaxMemory
Which describes the situation perfectly.
[1] https://www.redhat.com/archives/libvir-list/2010-February/msg00928.html
Signed-off-by: Chris Lalancette <clalance@redhat.com> --- src/qemu/qemu_driver.c | 42 +----------------------------------------- 1 files changed, 1 insertions(+), 41 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c5490b2..6bfae93 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3816,46 +3816,6 @@ cleanup: return ret; }
-static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { - struct qemud_driver *driver = dom->conn->privateData; - virDomainObjPtr vm; - int ret = -1; - - qemuDriverLock(driver); - vm = virDomainFindByUUID(&driver->domains, dom->uuid); - qemuDriverUnlock(driver); - - if (!vm) { - char uuidstr[VIR_UUID_STRING_BUFLEN]; - virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); - goto cleanup; - } - - if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); - goto cleanup; - } - - if (newmax < vm->def->memory) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot set max memory lower than current memory")); - goto cleanup; - } - - /* There isn't any way to change this value for a running qemu guest */ - qemuReportError(VIR_ERR_NO_SUPPORT, - "%s", _("cannot set max memory of an active domain")); - -cleanup: - if (vm) - virDomainObjUnlock(vm); - return ret; -} - - static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { struct qemud_driver *driver = dom->conn->privateData; qemuDomainObjPrivatePtr priv; @@ -9506,7 +9466,7 @@ static virDriver qemuDriver = { qemudDomainDestroy, /* domainDestroy */ qemudDomainGetOSType, /* domainGetOSType */ qemudDomainGetMaxMemory, /* domainGetMaxMemory */ - qemudDomainSetMaxMemory, /* domainSetMaxMemory */ + NULL, /* domainSetMaxMemory */ qemudDomainSetMemory, /* domainSetMemory */ qemudDomainGetInfo, /* domainGetInfo */ qemudDomainSave, /* domainSave */
ACK,
Thanks, pushed. -- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Daniel Veillard