-
Notifications
You must be signed in to change notification settings - Fork 301
fleetd: Detecting the existing machine-id #1288
Conversation
for _, ms := range machines { | ||
if ms.ID == h.mach.State().ID { | ||
if ms.PublicIP != h.mach.State().PublicIP { | ||
err = errors.New("Machine ID already exist, it seems that there are machines with same machine-id in your cluster.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: s/exist/exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, has grammar issue, already updated.
@@ -162,6 +162,7 @@ func (s *Server) Run() { | |||
if err == nil { | |||
break | |||
} | |||
log.Errorf("Error: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some context to this error message. Perhaps "Failed machine heartbeat: %v"
Now support detecting the existing machine-id on startup. Fixes coreos#1241 coreos#615
@bcwaldon ,totally agree with your comments, updated as per your suggestion. Currently the result is like:
|
@bcwaldon , the solution with my latest code has one problem. If the fleetd is killed by sigkill which can not be catched, the fleetd's registration will always be failing. |
Gently ping @jonboulle , I thought over again about the modification. I think the solution is fine. If the fleetd is killed by sigkill which can not be catched, the fleetd's registration will fail until the TTL is timeout. So my code is correct I think. |
This seems pretty reasonable, but since it's quite an important change, can we get a functional test for it? |
A new test TestDetectMachineId checks if a etcd registration fails when a duplicated entry for /etc/machine-id gets registered to different machines. Note that it's expected to fail in this case. Goal of the test is to cover the improvement patch by @wuqixuan ("fleetd: Detecting the existing machine-id"). See also coreos#1288, coreos#1241, coreos#615. Suggested-by: Olaf Buddenhagen <olaf@endocode.com> Cc: wuqixuan <wuqixuan@huawei.com>
A new test TestDetectMachineId checks if a etcd registration fails when a duplicated entry for /etc/machine-id gets registered to different machines. Note that it's expected to fail in this case. Goal of the test is to cover the improvement patch by @wuqixuan ("fleetd: Detecting the existing machine-id"). See also coreos#1288, coreos#1241, coreos#615. Suggested-by: Olaf Buddenhagen <olaf@endocode.com> Cc: wuqixuan <wuqixuan@huawei.com>
A new test TestDetectMachineId checks if a etcd registration fails when a duplicated entry for /etc/machine-id gets registered to different machines. Note that it's expected to fail in this case. Goal of the test is to cover the improvement patch by @wuqixuan ("fleetd: Detecting the existing machine-id"). See also coreos#1288, coreos#1241, coreos#615. Suggested-by: Olaf Buddenhagen <olaf@endocode.com> Cc: wuqixuan <wuqixuan@huawei.com>
A new test TestDetectMachineId checks if a etcd registration fails when a duplicated entry for /etc/machine-id gets registered to different machines. Note that it's expected to fail in this case. Goal of the test is to cover the improvement patch by @wuqixuan ("fleetd: Detecting the existing machine-id"). See also coreos#1288, coreos#1241, coreos#615. Suggested-by: Olaf Buddenhagen <olaf@endocode.com> Cc: wuqixuan <wuqixuan@huawei.com> Cc: Djalal Harouni <djalal@endocode.com>
A new test TestDetectMachineId checks if a etcd registration fails when a duplicated entry for /etc/machine-id gets registered to different machines. Note that it's expected to fail in this case. Goal of the test is to cover the improvement patch by @wuqixuan ("fleetd: Detecting the existing machine-id"). See also coreos#1288, coreos#1241, coreos#615. Suggested-by: Olaf Buddenhagen <olaf@endocode.com> Cc: wuqixuan <wuqixuan@huawei.com> Cc: Djalal Harouni <djalal@endocode.com>
Now support detecting the existing machine-id on startup.
Fixes #1241 #615