From 77e3aade03b756762d73c0739653d71a85ad8c2d Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Fri, 1 Feb 2013 16:58:29 +0530 Subject: [PATCH] =?UTF-8?q?CS-CLOUDSTACK-606:=20The=20issue=20happens=20ra?= =?UTF-8?q?ndomly=20when=20hosts=20in=20a=20cluster=20gets=20distributed?= =?UTF-8?q?=20across=20multiple=20MS.=20Host=20can=20get=20split=20in=20fo?= =?UTF-8?q?llowing=20scenarios:=20=20=20=20=20a.=20Add=20host=20=E2=80=93?= =?UTF-8?q?=20MS=20on=20which=20add=20host=20is=20executed=20takes=20owner?= =?UTF-8?q?ship=20of=20the=20host.=20So=20if=202=20hosts=20belonging=20to?= =?UTF-8?q?=20same=20cluster=20are=20added=20from=202=20different=20MS=20t?= =?UTF-8?q?hen=20cluster=20gets=20split=20=20=20=20=20b.=20scanDirectAgent?= =?UTF-8?q?ToLoad=20=E2=80=93=20This=20runs=20every=2090=20secs.=20and=20c?= =?UTF-8?q?heck=20if=20there=20are=20any=20hosts=20that=20needs=20to=20be?= =?UTF-8?q?=20reconnected.=20The=20current=20logic=20of=20host=20scan=20ca?= =?UTF-8?q?n=20also=20lead=20to=20a=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea is to fix (b) to ensure that hosts in a cluster are managed by same MS. For (a) only the entry in the database is going to be created except in case if the host getting added is first in the cluster (in this case agent creation happens at the same time) and then (b) will take care of connection and agent creation part. Since currently addHost only creates an entry in the db there is a small window where the host state will be shown as 'Alert' till the time (b) is scheduled and picks up the host to make a connection. The MS doing add host will immediately schedule a scan task and also send notification to peers to start the scan task. --- .../api/ScheduleHostScanTaskCommand.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java diff --git a/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java new file mode 100755 index 00000000000..e938de73f0b --- /dev/null +++ b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +/* + * This is used to schedule an explicit host scan in MS peers. Currently used during + * add host operation so that correct MS can take host ownership. On receiving the + * command the scan is scheduled immediately. + */ +public class ScheduleHostScanTaskCommand extends Command { + public ScheduleHostScanTaskCommand() { + } + + @Override + public boolean executeInSequence() { + return false; // standalone command and can be executed independent of other commands + } +}