~ubuntu-branches/ubuntu/saucy/cloud-init/saucy-proposed

« back to all changes in this revision

Viewing changes to cloudinit/config/cc_resizefs.py

  • Committer: Package Import Robot
  • Author(s): Scott Moser
  • Date: 2013-08-14 21:44:22 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20130814214422-uzrq82t5srz2g4c2
Tags: 0.7.3~bzr858-0ubuntu1
* New upstream snapshot.
  * fix resizing of root partition by preferring the functional 'growpart'
    support over the broken 'parted resizepart' support (LP: #1212444)
  * add options for apt_ftp_proxy, apt_https_proxy and apt_config
    (LP: #1057195)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import errno
22
22
import os
23
23
import stat
24
 
import time
25
24
 
26
25
from cloudinit.settings import PER_ALWAYS
27
26
from cloudinit import util
120
119
    if resize_root == NOBLOCK:
121
120
        # Fork to a child that will run
122
121
        # the resize command
123
 
        util.fork_cb(do_resize, resize_cmd, log)
 
122
        util.fork_cb(
 
123
            util.log_time(logfunc=log.debug, msg="backgrounded Resizing",
 
124
                func=do_resize, args=(resize_cmd, log)))
124
125
    else:
125
 
        do_resize(resize_cmd, log)
 
126
        util.log_time(logfunc=log.debug, msg="Resizing",
 
127
            func=do_resize, args=(resize_cmd, log))
126
128
 
127
129
    action = 'Resized'
128
130
    if resize_root == NOBLOCK:
132
134
 
133
135
 
134
136
def do_resize(resize_cmd, log):
135
 
    start = time.time()
136
137
    try:
137
138
        util.subp(resize_cmd)
138
139
    except util.ProcessExecutionError:
139
140
        util.logexc(log, "Failed to resize filesystem (cmd=%s)", resize_cmd)
140
141
        raise
141
 
    tot_time = time.time() - start
142
 
    log.debug("Resizing took %.3f seconds", tot_time)
143
142
    # TODO(harlowja): Should we add a fsck check after this to make
144
143
    # sure we didn't corrupt anything?