+Mon Dec 8 11:17:53 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/qemu_driver.c, src/uml_driver.c: Fix guest autostart
+ to have a virConnect object available to allow query of
+ virtual networks
+
Sun Dec 7 20:44:53 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
* src/test.c: Fix integer long long overflow. Fix NULL defernce
static void
qemudAutostartConfigs(struct qemud_driver *driver) {
unsigned int i;
+ /* XXX: Figure out a better way todo this. The domain
+ * startup code needs a connection handle in order
+ * to lookup the bridge associated with a virtual
+ * network
+ */
+ virConnectPtr conn = virConnectOpen(getuid() ?
+ "qemu:///session" :
+ "qemu:///system");
+ /* Ignoring NULL conn which is mostly harmless here */
for (i = 0 ; i < driver->domains.count ; i++) {
virDomainObjPtr vm = driver->domains.objs[i];
virDomainObjLock(vm);
if (vm->autostart &&
!virDomainIsActive(vm)) {
- int ret = qemudStartVMDaemon(NULL, driver, vm, NULL);
+ int ret = qemudStartVMDaemon(conn, driver, vm, NULL);
if (ret < 0) {
virErrorPtr err = virGetLastError();
qemudLog(QEMUD_ERR, _("Failed to autostart VM '%s': %s\n"),
}
virDomainObjUnlock(vm);
}
+
+ virConnectClose(conn);
}
/**
static void
umlAutostartConfigs(struct uml_driver *driver) {
unsigned int i;
+ /* XXX: Figure out a better way todo this. The domain
+ * startup code needs a connection handle in order
+ * to lookup the bridge associated with a virtual
+ * network
+ */
+ virConnectPtr conn = virConnectOpen(getuid() ?
+ "uml:///session" :
+ "uml:///system");
+ /* Ignoring NULL conn which is mostly harmless here */
for (i = 0 ; i < driver->domains.count ; i++) {
if (driver->domains.objs[i]->autostart &&
!virDomainIsActive(driver->domains.objs[i]) &&
- umlStartVMDaemon(NULL, driver, driver->domains.objs[i]) < 0) {
+ umlStartVMDaemon(conn, driver, driver->domains.objs[i]) < 0) {
virErrorPtr err = virGetLastError();
umlLog(UML_ERR, _("Failed to autostart VM '%s': %s\n"),
driver->domains.objs[i]->def->name, err->message);
}
}
+
+ virConnectClose(conn);
}