diff mbox

[13/17] migration-unix: replace qemu_fopen_socket with qemu_fopen_socket_local

Message ID 1382412341-1173-14-git-send-email-lilei@linux.vnet.ibm.com
State New
Headers show

Commit Message

Lei Li Oct. 22, 2013, 3:25 a.m. UTC
Relace qemu_fopen_socket with qemu_fopen_socket_local in Unix
protocol migration.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 migration-unix.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Oct. 24, 2013, 2:10 p.m. UTC | #1
Il 22/10/2013 04:25, Lei Li ha scritto:
> Relace qemu_fopen_socket with qemu_fopen_socket_local in Unix
> protocol migration.
> 
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> ---
>  migration-unix.c |   18 ++++++++++++++----
>  1 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/migration-unix.c b/migration-unix.c
> index 651fc5b..d3a151a 100644
> --- a/migration-unix.c
> +++ b/migration-unix.c
> @@ -37,12 +37,22 @@ static void unix_wait_for_connect(int fd, void *opaque)
>      if (fd < 0) {
>          DPRINTF("migrate connect error\n");
>          s->file = NULL;
> -        migrate_fd_error(s);
> +        goto fails;
>      } else {
>          DPRINTF("migrate connect success\n");
> -        s->file = qemu_fopen_socket(fd, "wb");
> +
> +        s->file = qemu_fopen_socket_local(fd, "wb");
> +        if (s->file == NULL) {
> +            DPRINTF("failed to open local socket\n");

"failed to open Unix socket"

> +            goto fail;
> +        }
> +
>          migrate_fd_connect(s);
> +        return;
>      }
> +
> +fail:
> +    migrate_fd_error(s);
>  }
>  
>  void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)
> @@ -71,9 +81,9 @@ static void unix_accept_incoming_migration(void *opaque)
>          goto out;
>      }
>  
> -    f = qemu_fopen_socket(c, "rb");
> +    f = qemu_fopen_socket_local(c, "rb");
>      if (f == NULL) {
> -        fprintf(stderr, "could not qemu_fopen socket\n");
> +        fprintf(stderr, "could not qemu_fopen socket local\n");

"failed to open Unix socket"

>          goto out;
>      }
>  
> 

Otherwise ok.

Paolo
Lei Li Oct. 25, 2013, 4:18 a.m. UTC | #2
On 10/24/2013 10:10 PM, Paolo Bonzini wrote:
> Il 22/10/2013 04:25, Lei Li ha scritto:
>> Relace qemu_fopen_socket with qemu_fopen_socket_local in Unix
>> protocol migration.
>>
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>> ---
>>   migration-unix.c |   18 ++++++++++++++----
>>   1 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/migration-unix.c b/migration-unix.c
>> index 651fc5b..d3a151a 100644
>> --- a/migration-unix.c
>> +++ b/migration-unix.c
>> @@ -37,12 +37,22 @@ static void unix_wait_for_connect(int fd, void *opaque)
>>       if (fd < 0) {
>>           DPRINTF("migrate connect error\n");
>>           s->file = NULL;
>> -        migrate_fd_error(s);
>> +        goto fails;
>>       } else {
>>           DPRINTF("migrate connect success\n");
>> -        s->file = qemu_fopen_socket(fd, "wb");
>> +
>> +        s->file = qemu_fopen_socket_local(fd, "wb");
>> +        if (s->file == NULL) {
>> +            DPRINTF("failed to open local socket\n");
> "failed to open Unix socket"

OK.

>
>> +            goto fail;
>> +        }
>> +
>>           migrate_fd_connect(s);
>> +        return;
>>       }
>> +
>> +fail:
>> +    migrate_fd_error(s);
>>   }
>>   
>>   void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)
>> @@ -71,9 +81,9 @@ static void unix_accept_incoming_migration(void *opaque)
>>           goto out;
>>       }
>>   
>> -    f = qemu_fopen_socket(c, "rb");
>> +    f = qemu_fopen_socket_local(c, "rb");
>>       if (f == NULL) {
>> -        fprintf(stderr, "could not qemu_fopen socket\n");
>> +        fprintf(stderr, "could not qemu_fopen socket local\n");
> "failed to open Unix socket"

OK, thanks.

>
>>           goto out;
>>       }
>>   
>>
> Otherwise ok.
>
> Paolo
>
diff mbox

Patch

diff --git a/migration-unix.c b/migration-unix.c
index 651fc5b..d3a151a 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -37,12 +37,22 @@  static void unix_wait_for_connect(int fd, void *opaque)
     if (fd < 0) {
         DPRINTF("migrate connect error\n");
         s->file = NULL;
-        migrate_fd_error(s);
+        goto fails;
     } else {
         DPRINTF("migrate connect success\n");
-        s->file = qemu_fopen_socket(fd, "wb");
+
+        s->file = qemu_fopen_socket_local(fd, "wb");
+        if (s->file == NULL) {
+            DPRINTF("failed to open local socket\n");
+            goto fail;
+        }
+
         migrate_fd_connect(s);
+        return;
     }
+
+fail:
+    migrate_fd_error(s);
 }
 
 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)
@@ -71,9 +81,9 @@  static void unix_accept_incoming_migration(void *opaque)
         goto out;
     }
 
-    f = qemu_fopen_socket(c, "rb");
+    f = qemu_fopen_socket_local(c, "rb");
     if (f == NULL) {
-        fprintf(stderr, "could not qemu_fopen socket\n");
+        fprintf(stderr, "could not qemu_fopen socket local\n");
         goto out;
     }