[libvirt] [PATCH 05/20] openvz: Cleanup indention

John Ferlan posted 20 patches 7 years, 2 months ago
[libvirt] [PATCH 05/20] openvz: Cleanup indention
Posted by John Ferlan 7 years, 2 months ago
Some of the indents were only 2 spaces, make consistent w/ 4 spaces

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/openvz/openvz_driver.c | 64 +++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index ebdc3890e..a211c370e 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -222,10 +222,10 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
     ret = 0;
 
  cleanup:
-  VIR_FREE(confdir);
-  virCommandFree(cmd);
+    VIR_FREE(confdir);
+    virCommandFree(cmd);
 
-  return ret;
+    return ret;
 }
 
 
@@ -267,9 +267,9 @@ openvzSetDiskQuota(virDomainDefPtr vmdef,
 
     ret = 0;
  cleanup:
-  virCommandFree(cmd);
+    virCommandFree(cmd);
 
-  return ret;
+    return ret;
 }
 
 
@@ -633,40 +633,40 @@ static int openvzDomainSuspend(virDomainPtr dom)
 
 static int openvzDomainResume(virDomainPtr dom)
 {
-  struct openvz_driver *driver = dom->conn->privateData;
-  virDomainObjPtr vm;
-  const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
-  int ret = -1;
+    struct openvz_driver *driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
+    int ret = -1;
 
-  openvzDriverLock(driver);
-  vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
-  openvzDriverUnlock(driver);
+    openvzDriverLock(driver);
+    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
+    openvzDriverUnlock(driver);
 
-  if (!vm) {
-      virReportError(VIR_ERR_NO_DOMAIN, "%s",
-                     _("no domain with matching uuid"));
-      goto cleanup;
-  }
+    if (!vm) {
+        virReportError(VIR_ERR_NO_DOMAIN, "%s",
+                       _("no domain with matching uuid"));
+        goto cleanup;
+    }
 
-  if (!virDomainObjIsActive(vm)) {
-      virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                     _("Domain is not running"));
-      goto cleanup;
-  }
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("Domain is not running"));
+        goto cleanup;
+    }
 
-  if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
-      openvzSetProgramSentinal(prog, vm->def->name);
-      if (virRun(prog, NULL) < 0)
-          goto cleanup;
-      virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
-  }
+    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
+        openvzSetProgramSentinal(prog, vm->def->name);
+        if (virRun(prog, NULL) < 0)
+            goto cleanup;
+        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
+    }
 
-  ret = 0;
+    ret = 0;
 
  cleanup:
-  if (vm)
-      virObjectUnlock(vm);
-  return ret;
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
 }
 
 static int
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/20] openvz: Cleanup indention
Posted by Marc Hartmayer 7 years, 2 months ago
On Fri, Mar 09, 2018 at 05:48 PM +0100, John Ferlan <jferlan@redhat.com> wrote:
> Some of the indents were only 2 spaces, make consistent w/ 4 spaces
>
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/openvz/openvz_driver.c | 64 +++++++++++++++++++++++-----------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
>
> diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
> index ebdc3890e..a211c370e 100644
> --- a/src/openvz/openvz_driver.c
> +++ b/src/openvz/openvz_driver.c
> @@ -222,10 +222,10 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
>      ret = 0;
>
>   cleanup:
> -  VIR_FREE(confdir);
> -  virCommandFree(cmd);
> +    VIR_FREE(confdir);
> +    virCommandFree(cmd);
>
> -  return ret;
> +    return ret;
>  }
>
>
> @@ -267,9 +267,9 @@ openvzSetDiskQuota(virDomainDefPtr vmdef,
>
>      ret = 0;
>   cleanup:
> -  virCommandFree(cmd);
> +    virCommandFree(cmd);
>
> -  return ret;
> +    return ret;
>  }
>
>
> @@ -633,40 +633,40 @@ static int openvzDomainSuspend(virDomainPtr dom)
>
>  static int openvzDomainResume(virDomainPtr dom)
>  {
> -  struct openvz_driver *driver = dom->conn->privateData;
> -  virDomainObjPtr vm;
> -  const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
> -  int ret = -1;
> +    struct openvz_driver *driver = dom->conn->privateData;
> +    virDomainObjPtr vm;
> +    const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
> +    int ret = -1;
>
> -  openvzDriverLock(driver);
> -  vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
> -  openvzDriverUnlock(driver);
> +    openvzDriverLock(driver);
> +    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
> +    openvzDriverUnlock(driver);
>
> -  if (!vm) {
> -      virReportError(VIR_ERR_NO_DOMAIN, "%s",
> -                     _("no domain with matching uuid"));
> -      goto cleanup;
> -  }
> +    if (!vm) {
> +        virReportError(VIR_ERR_NO_DOMAIN, "%s",
> +                       _("no domain with matching uuid"));
> +        goto cleanup;
> +    }
>
> -  if (!virDomainObjIsActive(vm)) {
> -      virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> -                     _("Domain is not running"));
> -      goto cleanup;
> -  }
> +    if (!virDomainObjIsActive(vm)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +                       _("Domain is not running"));
> +        goto cleanup;
> +    }
>
> -  if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
> -      openvzSetProgramSentinal(prog, vm->def->name);
> -      if (virRun(prog, NULL) < 0)
> -          goto cleanup;
> -      virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
> -  }
> +    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
> +        openvzSetProgramSentinal(prog, vm->def->name);
> +        if (virRun(prog, NULL) < 0)
> +            goto cleanup;
> +        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
> +    }
>
> -  ret = 0;
> +    ret = 0;
>
>   cleanup:
> -  if (vm)
> -      virObjectUnlock(vm);
> -  return ret;
> +    if (vm)
> +        virObjectUnlock(vm);
> +    return ret;
>  }
>
>  static int
> --
> 2.13.6
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>

Small nits:

You’re missing some indentation cleanups for openvzDomainSetNetwork,
openvzDomainDefineXMLFlags, and openvzDomainUpdateDeviceFlags.

--
Beste Grüße / Kind regards
Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/20] openvz: Cleanup indention
Posted by John Ferlan 7 years, 2 months ago

On 03/13/2018 03:58 AM, Marc Hartmayer wrote:
> On Fri, Mar 09, 2018 at 05:48 PM +0100, John Ferlan <jferlan@redhat.com> wrote:
>> Some of the indents were only 2 spaces, make consistent w/ 4 spaces
>>
>> Signed-off-by: John Ferlan <jferlan@redhat.com>
>> ---
>>  src/openvz/openvz_driver.c | 64 +++++++++++++++++++++++-----------------------
>>  1 file changed, 32 insertions(+), 32 deletions(-)
>>
>> diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
>> index ebdc3890e..a211c370e 100644
>> --- a/src/openvz/openvz_driver.c
>> +++ b/src/openvz/openvz_driver.c
>> @@ -222,10 +222,10 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
>>      ret = 0;
>>
>>   cleanup:
>> -  VIR_FREE(confdir);
>> -  virCommandFree(cmd);
>> +    VIR_FREE(confdir);
>> +    virCommandFree(cmd);
>>
>> -  return ret;
>> +    return ret;
>>  }
>>
>>
>> @@ -267,9 +267,9 @@ openvzSetDiskQuota(virDomainDefPtr vmdef,
>>
>>      ret = 0;
>>   cleanup:
>> -  virCommandFree(cmd);
>> +    virCommandFree(cmd);
>>
>> -  return ret;
>> +    return ret;
>>  }
>>
>>
>> @@ -633,40 +633,40 @@ static int openvzDomainSuspend(virDomainPtr dom)
>>
>>  static int openvzDomainResume(virDomainPtr dom)
>>  {
>> -  struct openvz_driver *driver = dom->conn->privateData;
>> -  virDomainObjPtr vm;
>> -  const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
>> -  int ret = -1;
>> +    struct openvz_driver *driver = dom->conn->privateData;
>> +    virDomainObjPtr vm;
>> +    const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
>> +    int ret = -1;
>>
>> -  openvzDriverLock(driver);
>> -  vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
>> -  openvzDriverUnlock(driver);
>> +    openvzDriverLock(driver);
>> +    vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
>> +    openvzDriverUnlock(driver);
>>
>> -  if (!vm) {
>> -      virReportError(VIR_ERR_NO_DOMAIN, "%s",
>> -                     _("no domain with matching uuid"));
>> -      goto cleanup;
>> -  }
>> +    if (!vm) {
>> +        virReportError(VIR_ERR_NO_DOMAIN, "%s",
>> +                       _("no domain with matching uuid"));
>> +        goto cleanup;
>> +    }
>>
>> -  if (!virDomainObjIsActive(vm)) {
>> -      virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> -                     _("Domain is not running"));
>> -      goto cleanup;
>> -  }
>> +    if (!virDomainObjIsActive(vm)) {
>> +        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>> +                       _("Domain is not running"));
>> +        goto cleanup;
>> +    }
>>
>> -  if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
>> -      openvzSetProgramSentinal(prog, vm->def->name);
>> -      if (virRun(prog, NULL) < 0)
>> -          goto cleanup;
>> -      virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
>> -  }
>> +    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
>> +        openvzSetProgramSentinal(prog, vm->def->name);
>> +        if (virRun(prog, NULL) < 0)
>> +            goto cleanup;
>> +        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
>> +    }
>>
>> -  ret = 0;
>> +    ret = 0;
>>
>>   cleanup:
>> -  if (vm)
>> -      virObjectUnlock(vm);
>> -  return ret;
>> +    if (vm)
>> +        virObjectUnlock(vm);
>> +    return ret;
>>  }
>>
>>  static int
>> --
>> 2.13.6
>>
>> --
>> libvir-list mailing list
>> libvir-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list
>>
> 
> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
> 
> Small nits:
> 
> You’re missing some indentation cleanups for openvzDomainSetNetwork,
> openvzDomainDefineXMLFlags, and openvzDomainUpdateDeviceFlags.
> 

No FindByUUID calls there, so I wasn't looking that close ;-)... Fixed
up ones in those functions in my branch.

Tks -

John

> --
> Beste Grüße / Kind regards
> Marc Hartmayer
> 
> IBM Deutschland Research & Development GmbH
> Vorsitzende des Aufsichtsrats: Martina Koederitz
> Geschäftsführung: Dirk Wittkopp
> Sitz der Gesellschaft: Böblingen
> Registergericht: Amtsgericht Stuttgart, HRB 243294
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list