Actually, the example above was bogus, because i didn't udevadm settle after 
sfdisk would have called rereadpt.  However, this one shows the problem:

sudo sh -c 'dev=/dev/vdb;
  while :; do 
    dd if=/dev/null of=$dev bs=1 count=0 &&
    blockdev --rereadpt $dev || break; 
    udevadm settle; done'

There, we open /dev/vdb for RW via 'dd', close it, and then call blockdev 
--rereadpt.
After calling blockdev --rereadpt we do 'udevadm settle' so that any events 
that blockdev's reread are fully processed.  Then, we do it all again (and 
again).

Eventually you'll see blockdev complain:
 blockdev: ioctl error on BLKRRPART: Device or resource busy




-- 
https://code.launchpad.net/~paul-meyer/cloud-init/+git/cloud-init/+merge/304033
Your team cloud init development team is requested to review the proposed merge 
of ~paul-meyer/cloud-init:fix-raw-ephemeral-disk into cloud-init:master.

_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to