forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement: management server peer states
- Loading branch information
1 parent
019f2c6
commit 861da3b
Showing
21 changed files
with
764 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
api/src/main/java/org/apache/cloudstack/api/response/PeerManagementServerNodeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// 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 org.apache.cloudstack.api.response; | ||
|
||
import com.cloud.serializer.Param; | ||
import com.google.gson.annotations.SerializedName; | ||
import org.apache.cloudstack.api.ApiConstants; | ||
import org.apache.cloudstack.api.BaseResponse; | ||
import org.apache.cloudstack.management.ManagementServerHost.State; | ||
|
||
import java.util.Date; | ||
|
||
public class PeerManagementServerNodeResponse extends BaseResponse { | ||
|
||
@SerializedName(ApiConstants.STATE) | ||
@Param(description = "the state of the management server peer") | ||
private State state; | ||
|
||
@SerializedName(ApiConstants.LAST_UPDATED) | ||
@Param(description = "the last updated time of the management server peer state") | ||
private Date lastUpdated; | ||
|
||
@SerializedName(ApiConstants.PEER_ID) | ||
@Param(description = "the ID of the peer management server") | ||
private String peerId; | ||
|
||
@SerializedName(ApiConstants.PEER_NAME) | ||
@Param(description = "the name of the peer management server") | ||
private String peerName; | ||
|
||
@SerializedName(ApiConstants.PEER_MSID) | ||
@Param(description = "the management ID of the peer management server") | ||
private String peerMsId; | ||
|
||
@SerializedName(ApiConstants.PEER_RUNID) | ||
@Param(description = "the run ID of the peer management server") | ||
private String peerRunId; | ||
|
||
@SerializedName(ApiConstants.PEER_STATE) | ||
@Param(description = "the state of the peer management server") | ||
private String peerState; | ||
|
||
@SerializedName(ApiConstants.PEER_SERVICE_IP) | ||
@Param(description = "the IP Address for the peer Management Server") | ||
private String peerServiceIp; | ||
|
||
@SerializedName(ApiConstants.PEER_SERVICE_PORT) | ||
@Param(description = "the service port for the peer Management Server") | ||
private String peerServicePort; | ||
|
||
public void setState(State state) { | ||
this.state = state; | ||
} | ||
|
||
public void setLastUpdated(Date lastUpdated) { | ||
this.lastUpdated = lastUpdated; | ||
} | ||
|
||
public void setPeerId(String peerId) { | ||
this.peerId = peerId; | ||
} | ||
|
||
public void setPeerName(String peerName) { | ||
this.peerName = peerName; | ||
} | ||
|
||
public void setPeerMsId(String peerMsId) { | ||
this.peerMsId = peerMsId; | ||
} | ||
|
||
public void setPeerRunId(String peerRunId) { | ||
this.peerRunId = peerRunId; | ||
} | ||
|
||
public void setPeerState(String peerState) { | ||
this.peerState = peerState; | ||
} | ||
|
||
public void setPeerServiceIp(String peerServiceIp) { | ||
this.peerServiceIp = peerServiceIp; | ||
} | ||
|
||
public void setPeerServicePort(String peerServicePort) { | ||
this.peerServicePort = peerServicePort; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
engine/schema/src/main/resources/META-INF/db/procedures/cloud.idempotent_add_foreign_key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- 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. | ||
|
||
DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`; | ||
|
||
CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY` ( | ||
IN in_table_name VARCHAR(200) | ||
, IN in_key_name VARCHAR(200) | ||
, IN in_foreign_key VARCHAR(200) | ||
, IN in_references VARCHAR(1000) | ||
) | ||
BEGIN | ||
|
||
DECLARE CONTINUE HANDLER FOR 1061 BEGIN END; SET @ddl = CONCAT_WS(' ', 'ALTER TABLE ', in_table_name, ' ADD CONSTRAINT ', in_key_name, ' FOREIGN KEY ', in_foreign_key, ' REFERENCES ', in_references, ' ON DELETE CASCADE'); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
engine/schema/src/main/resources/META-INF/db/views/cloud.mshost_peer_view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- 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. | ||
|
||
|
||
DROP VIEW IF EXISTS `cloud`.`mshost_peer_view`; | ||
|
||
CREATE VIEW `cloud`.`mshost_peer_view` AS | ||
SELECT | ||
`mshost_peer`.`id` AS `id`, | ||
`mshost_peer`.`peer_state` AS `peer_state`, | ||
`mshost_peer`.`last_update` AS `last_update`, | ||
`owner_mshost`.`id` AS `owner_mshost_id`, | ||
`owner_mshost`.`msid` AS `owner_mshost_msid`, | ||
`owner_mshost`.`runid` AS `owner_mshost_runid`, | ||
`owner_mshost`.`name` AS `owner_mshost_name`, | ||
`owner_mshost`.`uuid` AS `owner_mshost_uuid`, | ||
`owner_mshost`.`state` AS `owner_mshost_state`, | ||
`owner_mshost`.`service_ip` AS `owner_mshost_service_ip`, | ||
`owner_mshost`.`service_port` AS `owner_mshost_service_port`, | ||
`peer_mshost`.`id` AS `peer_mshost_id`, | ||
`peer_mshost`.`msid` AS `peer_mshost_msid`, | ||
`peer_mshost`.`runid` AS `peer_mshost_runid`, | ||
`peer_mshost`.`name` AS `peer_mshost_name`, | ||
`peer_mshost`.`uuid` AS `peer_mshost_uuid`, | ||
`peer_mshost`.`state` AS `peer_mshost_state`, | ||
`peer_mshost`.`service_ip` AS `peer_mshost_service_ip`, | ||
`peer_mshost`.`service_port` AS `peer_mshost_service_port` | ||
FROM `cloud`.`mshost_peer` | ||
LEFT JOIN `cloud`.`mshost` AS owner_mshost on `mshost_peer`.`owner_mshost` = `owner_mshost`.`id` | ||
LEFT JOIN `cloud`.`mshost` AS peer_mshost on `mshost_peer`.`peer_mshost` = `peer_mshost`.`id`; |
Oops, something went wrong.