github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/provider/local/lxc_linux.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package local 5 6 import ( 7 "os" 8 "strconv" 9 10 "launchpad.net/juju-core/instance" 11 "launchpad.net/juju-core/version" 12 ) 13 14 // envKeyTestingForceSlow is an environment variable name to force the slow 15 // lxc path. Setting to any non-empty value will force the slow path. 16 const envKeyTestingForceSlow = "JUJU_TESTING_LXC_FORCE_SLOW" 17 18 // releaseVersion is a function that returns a string representing the 19 // DISTRIB_RELEASE from the /etc/lsb-release file. 20 var releaseVersion = version.ReleaseVersion 21 22 func useFastLXC(containerType instance.ContainerType) bool { 23 if containerType != instance.LXC { 24 return false 25 } 26 if os.Getenv(envKeyTestingForceSlow) != "" { 27 return false 28 } 29 release := releaseVersion() 30 if release == "" { 31 return false 32 } 33 value, err := strconv.ParseFloat(release, 64) 34 if err != nil { 35 return false 36 } 37 return value >= 14.04 38 }