From 60b38f1c8279db935a45c873fb1a072209f12061 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Sun, 13 Jan 2013 17:36:10 +1100 Subject: Chown doesn't work on mounted vfat. As reported by a user. Resolves bug 1092560. Change-Id: I44c847d5e7f3242ca46a7436bcbc6e519baa88fc --- nova/tests/test_configdrive2.py | 4 +--- nova/virt/configdrive.py | 12 ++++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/nova/tests/test_configdrive2.py b/nova/tests/test_configdrive2.py index 91c2a4e5e..41a10a337 100644 --- a/nova/tests/test_configdrive2.py +++ b/nova/tests/test_configdrive2.py @@ -67,11 +67,9 @@ class ConfigDriveTestCase(test.TestCase): utils.mkfs('vfat', mox.IgnoreArg(), label='config-2').AndReturn(None) - utils.trycmd('mount', '-o', 'loop', mox.IgnoreArg(), + utils.trycmd('mount', '-o', mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(), run_as_root=True).AndReturn((None, None)) - utils.trycmd('chown', mox.IgnoreArg(), mox.IgnoreArg(), - run_as_root=True).AndReturn((None, None)) utils.execute('umount', mox.IgnoreArg(), run_as_root=True).AndReturn(None) diff --git a/nova/virt/configdrive.py b/nova/virt/configdrive.py index 9255ab851..e8162efa7 100644 --- a/nova/virt/configdrive.py +++ b/nova/virt/configdrive.py @@ -129,20 +129,16 @@ class _ConfigDriveBuilder(object): try: mountdir = tempfile.mkdtemp(dir=CONF.config_drive_tempdir, prefix='cd_mnt_') - _out, err = utils.trycmd('mount', '-o', 'loop', path, mountdir, + _out, err = utils.trycmd('mount', '-o', + 'loop,uid=%d,gid=%d' % (os.getuid(), + os.getgid()), + path, mountdir, run_as_root=True) if err: raise exception.ConfigDriveMountFailed(operation='mount', error=err) mounted = True - _out, err = utils.trycmd('chown', - '%s.%s' % (os.getuid(), os.getgid()), - mountdir, run_as_root=True) - if err: - raise exception.ConfigDriveMountFailed(operation='chown', - error=err) - # NOTE(mikal): I can't just use shutils.copytree here, because the # destination directory already exists. This is annoying. for ent in os.listdir(self.tempdir): -- cgit