Failures in disk.py Filesystem.create()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
VMBuilder |
New
|
Undecided
|
Unassigned |
Bug Description
When building a vm as a xen image (for EC2 deployment), building fails when trying to create the root filesystem:
File "/usr/bin/
cli.main()
File "/usr/lib/
hypervisor.
File "/usr/lib/
self.
File "/usr/lib/
call_
File "/usr/lib/
getattr(
File "/usr/lib/
fs.create()
File "/usr/lib/
if not os.path.
File "/usr/lib/
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found
This seems to occur whenever a Filesystem instance is created with None as the filename (the default).
After fixing this issue with an additional check, the following exception occurs:
File "/usr/bin/
cli.main()
File "/usr/lib/
hypervisor.
File "/usr/lib/
self.
File "/usr/lib/
call_
File "/usr/lib/
getattr(
File "/usr/lib/
fs.create()
File "/usr/lib/
self.filename = '%s/%s' % (self.vm.workdir, self.filename)
AttributeError: 'Xen' object has no attribute 'workdir'
I have investigated further and came to the real cause of the problem. Apparently the CLI class will provide a filename when creating disks and filesystems with util.tmpfile. However, it fails to do so when allocating filesystems when preferred_storage is set to STORAGE_FS_IMAGE and when a partitiions file is provided.
As a result, when using a plugin (such as XEN) which uses STORAGE_FS_IMAGE and filesystems are specified with a partitions file rather than specifying them in the arguments, the result is a failure due to the Filesystem object being unable to create its own filename.
I have fixed this issue by creating temp files for this case in the same manner as is done for all other cases.
I would also suggest changing the Filesystem class to make filename a required parameter similar that of Disk and removing the the logic that attempts to create one if not provided, since such logic relies on a workdir attribute that does not appear to ever be set.