qemu: Start nested job in qemuDomainCheckEjectableMedia

Originally, qemuDomainCheckEjectableMedia was entering monitor with qemu
driver lock. Commit 2067e31bf9, which I
made to fix that, revealed another issue we had (but didn't notice it
since the driver was locked): we didn't set nested job when
qemuDomainCheckEjectableMedia is called during migration. Thus the
original fix I made was wrong.
This commit is contained in:
Jiri Denemark 2012-04-02 15:55:08 +02:00
parent 11ec6bd891
commit 66cab01ae1
4 changed files with 15 additions and 8 deletions

View File

@ -8816,6 +8816,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
char *xml = NULL;
enum qemuDomainAsyncJob asyncJob;
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
@ -8832,9 +8833,11 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
asyncJob = QEMU_ASYNC_JOB_MIGRATION_OUT;
} else {
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
asyncJob = QEMU_ASYNC_JOB_NONE;
}
if (!virDomainObjIsActive(vm)) {
@ -8847,7 +8850,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
* We don't want to require them on the destination.
*/
if (qemuDomainCheckEjectableMedia(driver, vm) < 0)
if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
goto endjob;
if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,

View File

@ -155,16 +155,18 @@ error:
int
qemuDomainCheckEjectableMedia(struct qemud_driver *driver,
virDomainObjPtr vm)
virDomainObjPtr vm,
enum qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virHashTablePtr table;
virHashTablePtr table = NULL;
int ret = -1;
int i;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
table = qemuMonitorGetBlockInfo(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
table = qemuMonitorGetBlockInfo(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
}
if (!table)
goto cleanup;

View File

@ -25,6 +25,7 @@
# define __QEMU_HOTPLUG_H__
# include "qemu_conf.h"
# include "qemu_domain.h"
# include "domain_conf.h"
int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
@ -32,7 +33,8 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
virDomainDiskDefPtr disk,
bool force);
int qemuDomainCheckEjectableMedia(struct qemud_driver *driver,
virDomainObjPtr vm);
virDomainObjPtr vm,
enum qemuDomainAsyncJob asyncJob);
int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,

View File

@ -3106,7 +3106,7 @@ qemuProcessReconnect(void *opaque)
if (qemuProcessFiltersInstantiate(conn, obj->def))
goto error;
if (qemuDomainCheckEjectableMedia(driver, obj) < 0)
if (qemuDomainCheckEjectableMedia(driver, obj, QEMU_ASYNC_JOB_NONE) < 0)
goto error;
if (qemuProcessRecoverJob(driver, obj, conn, &oldjob) < 0)