[lxc-devel] [PATCH 3/4] templates: Consistent use of locking

Stéphane Graber stgraber at ubuntu.com
Thu Dec 6 14:41:51 UTC 2012


On 12/06/2012 12:14 AM, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
>> Move to per-template lock (except for oracle that's per-container).
>> Also ensure that the path used for the lock is relative to LOCALSTATEDIR.
>>
>> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> 
> I believe a few conversions to LOCALSTATEDIR were missed in mkdirs,
> namely in lxc-altlinux.in, lxc-debian.in, lxc-fedora.in, lxc-opensuse.in,
> and lxc-ubuntu-cloud.in.

staging looks fine at the moment:
stgraber at castiana:~/data/code/lxc/stgraber-lxc-git$ grep -r mkdir
templates/ | grep var
templates/lxc-archlinux.in:    mkdir -p "${rootfs_path}/var/lib/pacman/sync"
templates/lxc-fedora.in:    mkdir -p $INSTALL_ROOT/var/lib/rpm
templates/lxc-ubuntu.in:    mkdir -p -m0755 /var/run/sshd
templates/lxc-oracle.in:        mkdir -p $container_rootfs/var/lib/rpm
templates/lxc-altlinux.in:    mkdir -p $INSTALL_ROOT/var/lib/rpm


> With those added:
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

Thanks, pushed.

>> ---
>>  templates/lxc-altlinux.in     | 4 ++--
>>  templates/lxc-debian.in       | 4 ++--
>>  templates/lxc-fedora.in       | 4 ++--
>>  templates/lxc-lenny.in        | 4 ++--
>>  templates/lxc-opensuse.in     | 4 ++--
>>  templates/lxc-oracle.in       | 4 ++--
>>  templates/lxc-ubuntu-cloud.in | 2 +-
>>  templates/lxc-ubuntu.in       | 4 ++--
>>  8 files changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
>> index eab473c..fac545c 100644
>> --- a/templates/lxc-altlinux.in
>> +++ b/templates/lxc-altlinux.in
>> @@ -228,7 +228,7 @@ install_altlinux()
> 
> This has a mkdir /var/lock/subsys at line 199
> 
>>              return 1
>>          fi
>>          return 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
>>  
>>      return $?
>>  }
>> @@ -325,7 +325,7 @@ clean()
>>          echo -n "Purging the download cache for ALTLinux-$release..."
>>          rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
>>          exit 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
>> index 6b5f2f9..7bbc46b 100644
>> --- a/templates/lxc-debian.in
>> +++ b/templates/lxc-debian.in
>> @@ -191,7 +191,7 @@ install_debian()
> 
> this has mkdir at line 167
> 
>>  
>>          return 0
>>  
>> -        ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +        ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
>>  
>>      return $?
>>  }
>> @@ -261,7 +261,7 @@ clean()
>>          rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
>>          exit 0
>>  
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
>> index bc4b264..366e776 100644
>> --- a/templates/lxc-fedora.in
>> +++ b/templates/lxc-fedora.in
>> @@ -233,7 +233,7 @@ install_fedora()
> 
> mkdir at line 203
> 
>>          fi
>>  
>>          return 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-fedora
>>  
>>      return $?
>>  }
>> @@ -301,7 +301,7 @@ clean()
>>          echo -n "Purging the download cache for Fedora-$release..."
>>          rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
>>          exit 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-fedora
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-lenny.in b/templates/lxc-lenny.in
>> index afc9321..cb93853 100644
>> --- a/templates/lxc-lenny.in
>> +++ b/templates/lxc-lenny.in
>> @@ -166,7 +166,7 @@ install_debian()
>>              return 1
>>          fi
>>          return 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-lenny
>>  
>>      return $?
>>  }
>> @@ -234,7 +234,7 @@ clean()
>>          echo -n "Purging the download cache..."
>>          rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
>>          exit 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-lenny
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
>> index e0f8e00..65fb7b0 100644
>> --- a/templates/lxc-opensuse.in
>> +++ b/templates/lxc-opensuse.in
>> @@ -242,7 +242,7 @@ install_opensuse()
> 
> mkdir at line 218
> 
>>          fi
>>  
>>          return 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
>>  
>>      return $?
>>  }
>> @@ -314,7 +314,7 @@ clean()
>>          echo -n "Purging the download cache..."
>>          rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
>>          exit 0
>> -    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in
>> index 90b2bad..74880bc 100644
>> --- a/templates/lxc-oracle.in
>> +++ b/templates/lxc-oracle.in
>> @@ -337,7 +337,7 @@ container_rootfs_create()
>>          fi
>>      done
>>  
>> -    mkdir -p /var/lock/subsys/
>> +    mkdir -p @LOCALSTATEDIR@/lock/subsys/lxc
>>      (
>>          flock -x 200
>>          if [ $? -ne 0 ]; then
>> @@ -433,7 +433,7 @@ container_rootfs_create()
>>          echo "Rebuilding rpm database"
>>          rm -f $container_rootfs/var/lib/rpm/__db*
>>          chroot $container_rootfs rpm --rebuilddb >/dev/null 2>&1
>> -    ) 200>/var/lock/subsys/lxc-oracle-$name
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-$name
>>  }
>>  
>>  usage()
>> diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
>> index 4ef5f8d..de9f3c3 100644
>> --- a/templates/lxc-ubuntu-cloud.in
>> +++ b/templates/lxc-ubuntu-cloud.in
> 
> mkdir at line 321
> 
>> @@ -395,7 +395,7 @@ EOF
>>          echo "If you do not have a meta-data service, this container will likely be useless."
>>  
>>      fi
>> -) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubucloud
>> +) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubuntu-cloud
>>  
>>  copy_configuration $path $rootfs $name $arch $release
>>  
>> diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
>> index 19de991..0ed8808 100644
>> --- a/templates/lxc-ubuntu.in
>> +++ b/templates/lxc-ubuntu.in
>> @@ -259,7 +259,7 @@ install_ubuntu()
>>      release=$2
>>      flushcache=$3
>>      cache="@LOCALSTATEDIR@/cache/lxc/$release"
>> -    mkdir -p /var/lock/subsys/
>> +    mkdir -p @LOCALSTATEDIR@/lock/subsys/
>>  
>>      (
>>          flock -x 200
>> @@ -293,7 +293,7 @@ install_ubuntu()
>>  
>>          return 0
>>  
>> -    ) 200>/var/lock/subsys/lxc
>> +    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubuntu
>>  
>>      return $?
>>  }
>> -- 
>> 1.8.0
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> Lxc-devel mailing list
>> Lxc-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121206/6a3c8d15/attachment.pgp>


More information about the lxc-devel mailing list