diff options
author | Jim Rollenhagen <jim@jimrollenhagen.com> | 2014-04-21 10:44:49 -0700 |
---|---|---|
committer | Jim Rollenhagen <jim@jimrollenhagen.com> | 2014-04-25 13:42:47 -0700 |
commit | 2e691d797142984e9c9d6b834465789f8a485443 (patch) | |
tree | 04ee94df9bbfb93bac607135aec05374d1229f94 /ironic_python_agent/errors.py | |
parent | 07f1462bc2a69c248fe763573c80a6c57a31f40a (diff) | |
download | ironic-python-agent-2e691d797142984e9c9d6b834465789f8a485443.tar.gz |
Check configdrive size before writing to partition
Avoids writing a configdrive out to disk that is larger than
the intended partition.
Change-Id: I4e067ccb23ba528d96e4faad39219f67b4178e82
Diffstat (limited to 'ironic_python_agent/errors.py')
-rw-r--r-- | ironic_python_agent/errors.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py index 4223ab9f..151d8cea 100644 --- a/ironic_python_agent/errors.py +++ b/ironic_python_agent/errors.py @@ -151,6 +151,17 @@ class ImageWriteError(RESTError): self.details = self.details.format(device, exit_code) +class ConfigDriveTooLargeError(RESTError): + """Error raised when a configdrive is larger than the partition.""" + message = 'Configdrive is too large for intended partition.' + + def __init__(self, filename, filesize): + details = ('Configdrive at {0} has size {1}, which is larger than ' + 'the intended partition.').format(filename, filesize) + super(ConfigDriveTooLargeError, self).__init__(details) + self.details = details + + class ConfigDriveWriteError(RESTError): """Error raised when a configdrive directory cannot be written to a device. |