[libvirt] [PATCH 3/3] vz: make vz driver more responsive

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Fri Jun 17 10:46:10 UTC 2016



On 17.06.2016 12:43, Nikolay Shirokovskiy wrote:
> 
> 
> On 16.06.2016 14:59, Nikolay Shirokovskiy wrote:
>>   Current vz driver implementation is not usable when it comes to
>> long runnig operations. Migration or saving a domain blocks all
>> other operations even query ones which are expecteted to be available.
>> This patch address this problem.
>>
> 
> ...
> 
>> @@ -2436,6 +2504,7 @@ vzDomainMigratePerformStep(virDomainPtr domain,
>>      const char *miguri = NULL;
>>      const char *dname = NULL;
>>      vzMigrationCookiePtr mig = NULL;
>> +    bool job = false;
>>  
>>      virCheckFlags(VZ_MIGRATION_FLAGS, -1);
>>  
>> @@ -2458,9 +2527,13 @@ vzDomainMigratePerformStep(virDomainPtr domain,
>>                              VZ_MIGRATION_COOKIE_SESSION_UUID)))
>>          goto cleanup;
>>  
>> -    if (!(dom = vzDomObjFromDomain(domain)))
>> +    if (!(dom = vzDomObjFromDomainRef(domain)))
>>          goto cleanup;
>>  
>> +    if (vzDomainObjBeginJob(dom) < 0)
>> +        goto cleanup;
>> +    job = true;
>> +
>>      if (!(vzuri = vzParseVzURI(miguri)))
>>          goto cleanup;
>>  
>> @@ -2473,8 +2546,9 @@ vzDomainMigratePerformStep(virDomainPtr domain,
>>      ret = 0;
> 
> a mistake here makes migrating disfuntional, here is tiny fix to squash in:
> 
> 

here is correct fix )), it affects another place where we delete domain object at
the end of operation

Author: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
Date:   Fri Jun 17 13:28:39 2016 +0300

    vz: quickfix: job fix for migration
    
    Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 1569278..6a508b3 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1018,8 +1018,7 @@ vzDomainUndefineFlags(virDomainPtr domain,
 
     if (job)
         vzDomainObjEndJob(dom);
-    if (ret < 0)
-        virObjectUnlock(dom);
+    virDomainObjEndAPI(&dom);
     virObjectUnref(dom);
 
     return ret;
@@ -2540,7 +2539,7 @@ vzDomainMigratePerformStep(virDomainPtr domain,
         goto cleanup;
 
     virDomainObjListRemove(privconn->driver->domains, dom);
-    dom = NULL;
+    virObjectLock(dom);
 
     ret = 0;
 
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 551df10..205189a 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -3943,6 +3943,7 @@ prlsdkUnregisterDomain(vzDriverPtr driver, virDomainObjPtr dom, unsigned int fla
                     VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
 
     virDomainObjListRemove(driver->domains, dom);
+    virObjectLock(dom);
 
     ret = 0;
  cleanup:





More information about the libvir-list mailing list