[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] any better way to treat device-detach timeout ?



Hi,all:

   I find that we remove devices only after DEVICE_DELETED event.(patch:3fbf78bd).
   And it treats TIMEOUT as success. The detailed codes are shown as below:
        rc = qemuDomainWaitForDeviceRemoval(vm);
        if (rc == 0 || rc == 1)
          ret = qemuDomainRemoveDiskDevice(driver, vm, detach);
        else
          ret = 0;


   Here comes the problem:
   If 
   1. We pass flags=3(VIR_DOMAIN_AFFECT_LIVE|VIR_DOMAIN_AFFECT_CONFIG) to virDomainDetachDeviceFlags,  
   2. It timed out to receive DEVICE_DELETED event, virDomainDetachDeviceFlags api will return 0(succeed).
     Please be aware that:  vm->newdef(persistent) removes the device while vm->def(transient) keeps it untouched.
   3. Then we try to attach the same device with flag 3, because it differs in newDef and def, the API virDomainDetachDeviceFlags() returns ERROR.
     Consequent attach/detach jobs all fail after then.

   So, shall we make it return FAIL when it fails in qemuDomainWaitForDeviceRemoval()? Or just remove the device in def after we get the DEVICE_DELETED event? 
   Any ideas, thanks!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]