Compare commits

...

10 Commits

Author SHA1 Message Date
Michael Marineau
d0a6d6f92f chore(coreos-cloudinit): bump to 0.7.7 2014-06-18 14:55:38 -07:00
Michael Marineau
2be1e52f32 Merge pull request #151 from marineam/mount
fix(configdrive): Use mount units, give virtfs a new mount point.
2014-06-18 13:51:11 -07:00
Michael Marineau
784a71e2bf fix(configdrive): Use mount units, give virtfs a new mount point.
Currently systemd cannot track dependencies on configdrive very well
because it is mounted via a service instead of a mount unit. Also since
the interaction between path and mount units can lead to unexpected
behavior if something goes wrong the cloudinit service is now triggered
explicitly by the mount again. The configdrive path unit remains only as
a fall back for containers where the mount unit doesn't kick in. Better
to have two mechanisms that trigger the cloudinit service than none. :)

Since mounting a virtfs based configdrive requires different mount
options and two different mount units cannot refer to the same path the
virtfs version now mounts to /media/configvirtfs.

There are also two new kernel options:
- `coreos.configdrive=1`: enable config drive on physical hardware.
- `coreos.configdrive=0`: disable config drive on virtual machines.
2014-06-18 13:01:19 -07:00
Michael Marineau
160668284c chore(coreos-cloudinit): bump to 0.7.6+git 2014-06-07 16:04:33 -04:00
Michael Marineau
41b9dfcb1c chore(coreos-cloudinit): bump to 0.7.6 2014-06-07 16:01:31 -04:00
Michael Marineau
ef4c3483b6 Merge pull request #146 from marineam/fix
fix(update): Fix restart of update-engine
2014-06-07 13:04:49 -07:00
Michael Marineau
4bdf633075 fix(update): Fix restart of update-engine
The name was missing .service.
2014-06-07 12:08:22 -07:00
Brian Waldon
c9fc718e18 Merge pull request #145 from bcwaldon/drop-group-req
Relax requirements of update group value
2014-06-06 11:43:22 -07:00
Brian Waldon
4461b3d33d fix(update): Relax requirements of update group value 2014-06-06 11:29:09 -07:00
Jonathan Boulle
c6a1412f6b chore(coreos-cloudinit): bump to 0.7.5+git 2014-06-06 11:14:39 -07:00
10 changed files with 55 additions and 33 deletions

View File

@@ -14,7 +14,7 @@ import (
"github.com/coreos/coreos-cloudinit/system" "github.com/coreos/coreos-cloudinit/system"
) )
const version = "0.7.5" const version = "0.7.7"
func main() { func main() {
var printVersion bool var printVersion bool

View File

@@ -12,7 +12,8 @@ import (
) )
const ( const (
locksmithUnit = "locksmithd.service" locksmithUnit = "locksmithd.service"
updateEngineUnit = "update-engine.service"
) )
// updateOption represents a configurable update option, which, if set, will be // updateOption represents a configurable update option, which, if set, will be
@@ -36,7 +37,6 @@ var updateOptions = []*updateOption{
&updateOption{ &updateOption{
key: "group", key: "group",
prefix: "GROUP=", prefix: "GROUP=",
valid: []string{"master", "beta", "alpha", "stable"},
}, },
&updateOption{ &updateOption{
key: "server", key: "server",
@@ -155,7 +155,7 @@ func (uc UpdateConfig) Units(root string) ([]system.Unit, error) {
} }
if rue { if rue {
ue := system.Unit{ ue := system.Unit{
Name: "update-engine", Name: updateEngineUnit,
Command: "restart", Command: "restart",
} }
units = append(units, ue) units = append(units, ue)

View File

@@ -114,8 +114,8 @@ SERVER=http://foo.com`
t.Errorf("unexpected number of files returned from UpdateConfig: want 1, got %d", len(uu)) t.Errorf("unexpected number of files returned from UpdateConfig: want 1, got %d", len(uu))
} else { } else {
unit := uu[0] unit := uu[0]
if unit.Name != "update-engine" { if unit.Name != "update-engine.service" {
t.Errorf("bad name for generated unit: want update-engine, got %s", unit.Name) t.Errorf("bad name for generated unit: want update-engine.service, got %s", unit.Name)
} }
if unit.Command != "restart" { if unit.Command != "restart" {
t.Errorf("bad command for generated unit: want restart, got %s", unit.Command) t.Errorf("bad command for generated unit: want restart, got %s", unit.Command)

View File

@@ -3,9 +3,9 @@
ACTION!="add|change", GOTO="coreos_configdrive_end" ACTION!="add|change", GOTO="coreos_configdrive_end"
# A normal config drive. Block device formatted with iso9660 or fat # A normal config drive. Block device formatted with iso9660 or fat
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="iso9660|vfat", ENV{ID_FS_LABEL}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="configdrive-block.service" SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="iso9660|vfat", ENV{ID_FS_LABEL}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="media-configdrive.mount"
# Addtionally support virtfs from QEMU # Addtionally support virtfs from QEMU
SUBSYSTEM=="virtio", DRIVER=="9pnet_virtio", ATTR{mount_tag}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="configdrive-virtfs.service" SUBSYSTEM=="virtio", DRIVER=="9pnet_virtio", ATTR{mount_tag}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="media-configvirtfs.mount"
LABEL="coreos_configdrive_end" LABEL="coreos_configdrive_end"

View File

@@ -1,11 +0,0 @@
[Unit]
Description=Mount config drive
Conflicts=configdrive-virtfs.service umount.target
ConditionPathIsMountPoint=!/media/configdrive
# Only mount config drive block devices automatically in virtual machines
ConditionVirtualization=vm
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/mount -t auto -o ro,x-mount.mkdir LABEL=config-2 /media/configdrive

View File

@@ -1,14 +0,0 @@
[Unit]
Description=Mount config drive from virtfs
Conflicts=configdrive-block.service umount.target
ConditionPathIsMountPoint=!/media/configdrive
ConditionVirtualization=vm
# Support old style setup for now
Wants=addon-run@media-configdrive.service addon-config@media-configdrive.service
Before=addon-run@media-configdrive.service addon-config@media-configdrive.service
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/mount -t 9p -o trans=virtio,version=9p2000.L,x-mount.mkdir config-2 /media/configdrive

View File

@@ -0,0 +1,13 @@
[Unit]
Wants=user-configdrive.service
Before=user-configdrive.service
# Only mount config drive block devices automatically in virtual machines
# or any host that has it explicitly enabled and not explicitly disabled.
ConditionVirtualization=|vm
ConditionKernelCommandLine=|coreos.configdrive=1
ConditionKernelCommandLine=!coreos.configdrive=0
[Mount]
What=LABEL=config-2
Where=/media/configdrive
Options=ro

View File

@@ -0,0 +1,18 @@
[Unit]
Wants=user-configvirtfs.service
Before=user-configvirtfs.service
# Only mount config drive block devices automatically in virtual machines
# or any host that has it explicitly enabled and not explicitly disabled.
ConditionVirtualization=|vm
ConditionKernelCommandLine=|coreos.configdrive=1
ConditionKernelCommandLine=!coreos.configdrive=0
# Support old style setup for now
Wants=addon-run@media-configvirtfs.service addon-config@media-configvirtfs.service
Before=addon-run@media-configvirtfs.service addon-config@media-configvirtfs.service
[Mount]
What=config-2
Where=/media/configvirtfs
Options=ro,trans=virtio,version=9p2000.L
Type=9p

View File

@@ -1,5 +1,10 @@
[Unit] [Unit]
Description=Watch for a cloud-config at /media/configdrive Description=Watch for a cloud-config at /media/configdrive
# Note: This unit is essentially just here as a fall-back mechanism to
# trigger cloudinit if it isn't triggered explicitly by other means
# such as by a Wants= in the mount unit. This ensures we handle the
# case where /media/configdrive is provided to a CoreOS container.
[Path] [Path]
DirectoryNotEmpty=/media/configdrive DirectoryNotEmpty=/media/configdrive

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Load cloud-config from /media/configvirtfs
Requires=coreos-setup-environment.service
After=coreos-setup-environment.service
Before=user-config.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/environment
ExecStart=/usr/bin/coreos-cloudinit --from-configdrive=/media/configvirtfs