Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: Dogukan Ergun <dogukan.ergun@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] wic: fallback to dd, if sparse_copy does not work
Date: Wed, 22 Nov 2017 10:26:45 +0200	[thread overview]
Message-ID: <20171122082645.qhfyyus754ft6pca@linux.intel.com> (raw)
In-Reply-To: <1510832983-801-1-git-send-email-dogukan.ergun@gmail.com>

On Thu, Nov 16, 2017 at 02:49:43PM +0300, Dogukan Ergun wrote:
> Docker's aufs filesystem doesn't support file ioctl operations like FIGETBSZ
> or FIEMAP.
> Sparse_copy operation will fail if those ioctls are not supported.
> If sparse_copy fails while generating wic images, fallback to dd for copying
> filesystems on final image.
> 

You can make sparse_copy to use SEEK_HOLE / SEEK_DATA instead of FIEMAP.
This can be done by using 'api' parameter. If AUFS supports it this
there is no need to fall back to using dd.

> Signed-off-by: Dogukan Ergun <dogukan.ergun@gmail.com>
> ---
>  scripts/lib/wic/plugins/imager/direct.py | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index da1c061..70f93ee 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -577,8 +577,14 @@ class PartitionedImage():
>          for part in self.partitions:
>              source = part.source_file
>              if source:
> -                # install source_file contents into a partition
> -                sparse_copy(source, self.path, seek=part.start * self.sector_size)
> +                try:
> +                    # install source_file contents into a partition
> +                    sparse_copy(source, self.path, seek=part.start * self.sector_size)
> +                except:

sparse_copy raises ErrorNotSupp if some ioctl is not supported. Please,
catch this particular exception instead of any exception.

> +                    # Sparse_copy failed, fallback to dd method
> +                    dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
> +                        (source, self.path, self.sector_size, part.start, part.size_sec)
> +                    exec_cmd(dd_cmd)
>  
>                  logger.debug("Installed %s in partition %d, sectors %d-%d, "
>                               "size %d sectors", source, part.num, part.start,
> -- 
> 2.7.4
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed


      parent reply	other threads:[~2017-11-22  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 11:49 [PATCH] wic: fallback to dd, if sparse_copy does not work Dogukan Ergun
2017-11-16 13:26 ` Martin Hundebøll
2017-11-16 13:28 ` Burton, Ross
2017-11-22  8:26 ` Ed Bartosh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171122082645.qhfyyus754ft6pca@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=dogukan.ergun@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox