Christophe Fergeau <teuf@gnome.org>
Markus Groß <gross@univention.de>
Phil Petty <phpetty@cisco.com>
+ Taku Izumi <izumi.taku@jp.fujitsu.com>
[....send patches to get your name here....]
virMemoryParameterPtr params,
int *nparams, unsigned int flags);
+/* Memory size modification flags. */
+typedef enum {
+ VIR_DOMAIN_MEM_LIVE = (1 << 0), /* affect active domain */
+ VIR_DOMAIN_MEM_CONFIG = (1 << 1), /* affect next boot */
+} virDomainMemoryModFlags;
+
+
/*
* Dynamic control of domains
*/
unsigned long memory);
int virDomainSetMemory (virDomainPtr domain,
unsigned long memory);
+int virDomainSetMemoryFlags (virDomainPtr domain,
+ unsigned long memory,
+ unsigned int flags);
int virDomainGetMaxVcpus (virDomainPtr domain);
int virDomainGetSecurityLabel (virDomainPtr domain,
virSecurityLabelPtr seclabel);
typedef int
(*virDrvDomainSetMemory) (virDomainPtr domain,
unsigned long memory);
+typedef int
+ (*virDrvDomainSetMemoryFlags) (virDomainPtr domain,
+ unsigned long memory,
+ unsigned int flags);
typedef int
(*virDrvDomainSetMemoryParameters)
(virDomainPtr domain,
virDrvDomainGetMaxMemory domainGetMaxMemory;
virDrvDomainSetMaxMemory domainSetMaxMemory;
virDrvDomainSetMemory domainSetMemory;
+ virDrvDomainSetMemoryFlags domainSetMemoryFlags;
virDrvDomainGetInfo domainGetInfo;
virDrvDomainSave domainSave;
virDrvDomainRestore domainRestore;
esxDomainGetMaxMemory, /* domainGetMaxMemory */
esxDomainSetMaxMemory, /* domainSetMaxMemory */
esxDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
esxDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
return -1;
}
+/*
+ * virDomainSetMemoryFlags
+ * @domain: a domain object or NULL
+ * @memory: the memory size in kilobytes
+ * @flags: an OR'ed set of virDomainMemoryModFlags
+ *
+ * Dynamically change the target amount of physical memory allocated to a
+ * domain. If domain is NULL, then this change the amount of memory reserved
+ * to Domain0 i.e. the domain where the application runs.
+ * This funcation may requires privileged access to the hypervisor.
+ *
+ * @flags must include VIR_DOMAIN_MEM_LIVE to affect a running
+ * domain (which may fail if domain is not active), or
+ * VIR_DOMAIN_MEM_CONFIG to affect the next boot via the XML
+ * description of the domain. Both flags may be set.
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+
+int
+virDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+
+ VIR_DOMAIN_DEBUG(domain, "memory=%lu flags=%u", memory, flags);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+ virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
+ }
+
+ if (domain->conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
+ if (memory < 4096 ||
+ (flags & (VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_CONFIG)) == 0) {
+ virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ conn = domain->conn;
+
+ if (conn->driver->domainSetMemoryFlags) {
+ int ret;
+ ret = conn->driver->domainSetMemoryFlags(domain, memory, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+error:
+ virDispatchError(domain->conn);
+ return -1;
+}
+
+
/**
* virDomainSetMemoryParameters:
* @domain: pointer to domain object
LIBVIRT_0.9.0 {
global:
+ virDomainSetMemoryFlags;
virEventRegisterDefaultImpl;
virEventRunDefaultImpl;
} LIBVIRT_0.8.8;
lxcDomainGetMaxMemory, /* domainGetMaxMemory */
lxcDomainSetMaxMemory, /* domainSetMaxMemory */
lxcDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
lxcDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
NULL, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
oneDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
NULL, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
openvzDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
NULL, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
phypDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
qemudDomainGetMaxMemory, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
qemudDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
qemudDomainGetInfo, /* domainGetInfo */
qemudDomainSave, /* domainSave */
qemudDomainRestore, /* domainRestore */
remoteDomainGetMaxMemory, /* domainGetMaxMemory */
remoteDomainSetMaxMemory, /* domainSetMaxMemory */
remoteDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
remoteDomainGetInfo, /* domainGetInfo */
remoteDomainSave, /* domainSave */
remoteDomainRestore, /* domainRestore */
testGetMaxMemory, /* domainGetMaxMemory */
testSetMaxMemory, /* domainSetMaxMemory */
testSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
testGetDomainInfo, /* domainGetInfo */
testDomainSave, /* domainSave */
testDomainRestore, /* domainRestore */
umlDomainGetMaxMemory, /* domainGetMaxMemory */
umlDomainSetMaxMemory, /* domainSetMaxMemory */
umlDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
umlDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
vboxDomainSetMemory, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
vboxDomainGetInfo, /* domainGetInfo */
vboxDomainSave, /* domainSave */
NULL, /* domainRestore */
NULL, /* domainGetMaxMemory */
NULL, /* domainSetMaxMemory */
NULL, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
vmwareDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */
xenUnifiedDomainGetMaxMemory, /* domainGetMaxMemory */
xenUnifiedDomainSetMaxMemory, /* domainSetMaxMemory */
xenUnifiedDomainSetMemory, /* domainSetMemory */
+ NULL, /*domainSetMemoryFlags */
xenUnifiedDomainGetInfo, /* domainGetInfo */
xenUnifiedDomainSave, /* domainSave */
xenUnifiedDomainRestore, /* domainRestore */
xenapiDomainGetMaxMemory, /* domainGetMaxMemory */
xenapiDomainSetMaxMemory, /* domainSetMaxMemory */
NULL, /* domainSetMemory */
+ NULL, /* domainSetMemoryFlags */
xenapiDomainGetInfo, /* domainGetInfo */
NULL, /* domainSave */
NULL, /* domainRestore */