+Wed Dec 17 21:10:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
+
+ Mutex / crash fixes to openvz driver (Anton Protopopov)
+ * src/openvz_driver.c: Fix crash with setting CPU value
+ during define
+ * src/openvz_conf.c: Initialize the domain mutex when
+ loading config files
+
Wed Dec 17 20:53:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
- * domain_conf.c, node_device_conf.c, node_device_conf.h,
- storage_conf.c, storage_conf.h: Remove trailing semi-colon
+ * src/domain_conf.c, src/node_device_conf.c, src/node_device_conf.h,
+ src/storage_conf.c, src/storage_conf.h: Remove trailing semi-colon
causing empty statement compile warnings on solaris (John
Levon).
Wed Dec 17 18:10:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
Anonymous union fixes for non-GCC compilers (John Levon)
- * domain_conf.c, qemu_conf.c, qemu_driver.c: Remove use
+ * src/domain_conf.c, src/qemu_conf.c, src/qemu_driver.c: Remove use
of anonymous union
- * domain_conf.h: Give a name to the anonymous union for
+ * src/domain_conf.h: Give a name to the anonymous union for
host devices. Add 'dummy' field to avoid empty struct
- * remote_internal.c: Remove gcc-ism in empty "x ? : y"
+ * src/remote_internal.c: Remove gcc-ism in empty "x ? : y"
Wed Dec 17 19:06:53 +0100 2008 Jim Meyering <meyering@redhat.com>
static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
static int openvzDomainGetMaxVcpus(virDomainPtr dom);
static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
+static int openvzDomainSetVcpusInternal(virConnectPtr conn, virDomainObjPtr vm, unsigned int nvcpus);
static void openvzDriverLock(struct openvz_driver *driver)
{
goto cleanup;
if (vm->def->vcpus > 0) {
- if (openvzDomainSetVcpus(dom, vm->def->vcpus) < 0) {
+ if (openvzDomainSetVcpusInternal(conn, vm, vm->def->vcpus) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Could not set number of virtual cpu"));
goto cleanup;
vm->state = VIR_DOMAIN_RUNNING;
if (vm->def->vcpus > 0) {
- if (openvzDomainSetVcpus(dom, vm->def->vcpus) < 0) {
+ if (openvzDomainSetVcpusInternal(conn, vm, vm->def->vcpus) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Could not set number of virtual cpu"));
+ "%s", _("Could not set number of virtual cpu"));
goto cleanup;
}
}
return openvzGetMaxVCPUs(dom->conn, "openvz");
}
-static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
- struct openvz_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- char str_vcpus[32];
+static int openvzDomainSetVcpusInternal(virConnectPtr conn, virDomainObjPtr vm,
+ unsigned int nvcpus)
+{
+ char str_vcpus[32];
const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINAL,
"--cpus", str_vcpus, "--save", NULL };
unsigned int pcpus;
- int ret = -1;
+ pcpus = openvzGetNodeCPUs();
+ if (pcpus > 0 && pcpus < nvcpus)
+ nvcpus = pcpus;
+
+ snprintf(str_vcpus, 31, "%d", nvcpus);
+ str_vcpus[31] = '\0';
+
+ openvzSetProgramSentinal(prog, vm->def->name);
+ if (virRun(conn, prog, NULL) < 0) {
+ openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Could not exec %s"), VZCTL);
+ return -1;
+ }
+
+ vm->def->vcpus = nvcpus;
+ return 0;
+}
+
+static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
+{
+ virDomainObjPtr vm;
+ struct openvz_driver *driver = dom->conn->privateData;
+ int ret = -1;
openvzDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
goto cleanup;
}
- pcpus = openvzGetNodeCPUs();
- if (pcpus > 0 && pcpus < nvcpus)
- nvcpus = pcpus;
-
- snprintf(str_vcpus, 31, "%d", nvcpus);
- str_vcpus[31] = '\0';
-
- openvzSetProgramSentinal(prog, vm->def->name);
- if (virRun(dom->conn, prog, NULL) < 0) {
- openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
- _("Could not exec %s"), VZCTL);
- goto cleanup;
- }
-
- vm->def->vcpus = nvcpus;
+ openvzDomainSetVcpusInternal(dom->conn, vm, nvcpus);
ret = 0;
cleanup: