[RFC,2/3] block: assign backing relationship in drive-backup
diff mbox

Message ID 1372219161-12209-3-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng June 26, 2013, 3:59 a.m. UTC
Assign source image as the backing hd of target bs, so reading target bs
gets the point-in-time copy of data from source image.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Paolo Bonzini June 26, 2013, 7:15 a.m. UTC | #1
Il 26/06/2013 05:59, Fam Zheng ha scritto:
> Assign source image as the backing hd of target bs, so reading target bs
> gets the point-in-time copy of data from source image.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  blockdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/blockdev.c b/blockdev.c
> index 5e694f3..a1d816e 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1504,6 +1504,10 @@ void qmp_drive_backup(const char *device, const char *target,
>          return;
>      }
>  
> +    target_bs->backing_hd = bs;
> +    pstrcpy(target_bs->backing_file, sizeof(target_bs->backing_file),
> +            bs->filename);

backing_format missing.

Paolo

>      backup_start(bs, target_bs, speed, on_source_error, on_target_error,
>                   block_job_cb, bs, &local_err);
>      if (local_err != NULL) {
>

Patch
diff mbox

diff --git a/blockdev.c b/blockdev.c
index 5e694f3..a1d816e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1504,6 +1504,10 @@  void qmp_drive_backup(const char *device, const char *target,
         return;
     }
 
+    target_bs->backing_hd = bs;
+    pstrcpy(target_bs->backing_file, sizeof(target_bs->backing_file),
+            bs->filename);
+
     backup_start(bs, target_bs, speed, on_source_error, on_target_error,
                  block_job_cb, bs, &local_err);
     if (local_err != NULL) {