~ubuntu-branches/debian/stretch/fuel-agent/stretch

« back to all changes in this revision

Viewing changes to fuel_agent/utils/utils.py

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2016-03-16 17:12:17 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20160316171217-p5b360dfuxm5yidy
Tags: 9.0~0+2016.03.09.git.b1ba4b7747+dfsg1-1
* New upstream release based on commit b1ba4b7747.
* Uploading to unstable.
* Lots of tweaks to make Debian provisionning works.
* Standards-Version: 3.9.7 (no change).

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
    so we should increase processing speed for those events,
310
310
    otherwise partitioning is doomed.
311
311
    """
 
312
    LOG.debug("Enabling udev's rules blacklisting")
312
313
    empty_rule_path = os.path.join(udev_rules_dir,
313
314
                                   os.path.basename(udev_empty_rule))
314
315
    with open(empty_rule_path, 'w') as f:
335
336
 
336
337
def unblacklist_udev_rules(udev_rules_dir, udev_rename_substr):
337
338
    """disable udev's rules blacklisting"""
 
339
    LOG.debug("Disabling udev's rules blacklisting")
338
340
    for rule in os.listdir(udev_rules_dir):
339
341
        src = os.path.join(udev_rules_dir, rule)
340
342
        if os.path.isdir(src):
363
365
    udevadm_settle()
364
366
 
365
367
 
 
368
def wait_for_udev_settle(attempts):
 
369
    """Wait for emptiness of udev queue within attempts*0.1 seconds"""
 
370
    for attempt in six.moves.range(attempts):
 
371
        try:
 
372
            udevadm_settle()
 
373
        except errors.ProcessExecutionError:
 
374
            LOG.warning("udevadm settle did return non-zero exit code. "
 
375
                        "Partitioning continues.")
 
376
        time.sleep(0.1)
 
377
 
 
378
 
366
379
def udevadm_settle():
367
 
    execute('udevadm', 'settle', '--quiet', check_exit_code=[0])
 
380
    execute('udevadm', 'settle', check_exit_code=[0])
368
381
 
369
382
 
370
383
def parse_kernel_cmdline():