Skip to content

Commit a0cb58a

Browse files
author
Alex Huang
committed
Harmony amongst gurus
1 parent e27bb55 commit a0cb58a

9 files changed

Lines changed: 659 additions & 1 deletion

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.vm;
19+
20+
import com.cloud.domain.Domain;
21+
import com.cloud.domain.PartOf;
22+
import com.cloud.user.Account;
23+
import com.cloud.user.OwnedBy;
24+
import com.cloud.user.User;
25+
import com.cloud.utils.Journal;
26+
27+
/**
28+
* Specifies the entity that is calling the api.
29+
*/
30+
public interface ReservationContext extends PartOf, OwnedBy {
31+
/**
32+
* @return the user making the call.
33+
*/
34+
User getCaller();
35+
36+
/**
37+
* @return the account
38+
*/
39+
Account getAccount();
40+
41+
/**
42+
* @return the domain.
43+
*/
44+
Domain getDomain();
45+
46+
/**
47+
* @return the journal
48+
*/
49+
Journal getJournal();
50+
51+
/**
52+
* @return the reservation id.
53+
*/
54+
String getReservationId();
55+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.agent.api.check;
19+
20+
import com.cloud.agent.api.Answer;
21+
22+
public class CheckSshAnswer extends Answer {
23+
protected CheckSshAnswer() {
24+
25+
}
26+
27+
public CheckSshAnswer(CheckSshCommand cmd) {
28+
super(cmd, true, null);
29+
}
30+
31+
public CheckSshAnswer(CheckSshCommand cmd, String details) {
32+
super(cmd, false, details);
33+
}
34+
35+
public CheckSshAnswer(CheckSshCommand cmd, Throwable th) {
36+
super(cmd, false, th.getMessage());
37+
}
38+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.agent.api.check;
19+
20+
import com.cloud.agent.api.Command;
21+
22+
public class CheckSshCommand extends Command {
23+
String ip;
24+
int port;
25+
int interval;
26+
int retries;
27+
String name;
28+
29+
protected CheckSshCommand() {
30+
super();
31+
}
32+
33+
public CheckSshCommand(String instanceName, String ip, int port, int interval, int retries) {
34+
super();
35+
this.ip = ip;
36+
this.port = port;
37+
this.interval = interval;
38+
this.retries = retries;
39+
this.name = instanceName;
40+
}
41+
42+
public String getName() {
43+
return name;
44+
}
45+
46+
public String getIp() {
47+
return ip;
48+
}
49+
50+
public int getPort() {
51+
return port;
52+
}
53+
54+
public int getInterval() {
55+
return interval;
56+
}
57+
58+
public int getRetries() {
59+
return retries;
60+
}
61+
62+
@Override
63+
public boolean executeInSequence() {
64+
return false;
65+
}
66+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.vm;
19+
20+
import com.cloud.utils.db.GenericDao;
21+
22+
public interface ItWorkDao extends GenericDao<ItWorkVO, Long> {
23+
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.vm;
19+
20+
import javax.ejb.Local;
21+
22+
import com.cloud.utils.db.GenericDaoBase;
23+
24+
@Local(value=ItWorkDao.class)
25+
public class ItWorkDaoImpl extends GenericDaoBase<ItWorkVO, Long> implements ItWorkDao {
26+
protected ItWorkDaoImpl() {
27+
super();
28+
}
29+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3+
*
4+
* This software is licensed under the GNU General Public License v3 or later.
5+
*
6+
* It is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or any later version.
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
package com.cloud.vm;
19+
20+
import java.util.Date;
21+
22+
import javax.persistence.Column;
23+
import javax.persistence.Entity;
24+
import javax.persistence.Id;
25+
import javax.persistence.Table;
26+
import javax.persistence.Temporal;
27+
import javax.persistence.TemporalType;
28+
29+
import com.cloud.utils.db.GenericDao;
30+
31+
@Entity
32+
@Table(name="op_it_work")
33+
public class ItWorkVO {
34+
enum Type {
35+
Start;
36+
}
37+
38+
enum State {
39+
Working,
40+
Cancelling,
41+
}
42+
43+
@Id
44+
@Column(name="id")
45+
String id;
46+
47+
@Column(name=GenericDao.CREATED_COLUMN)
48+
Date created;
49+
50+
@Column(name="mgmt_server_id")
51+
long managementServerId;
52+
53+
@Column(name="type")
54+
Type type;
55+
56+
@Column(name="thread")
57+
String threadName;
58+
59+
@Column(name="state")
60+
State state;
61+
62+
@Column(name="cancel_taken")
63+
@Temporal(value=TemporalType.TIMESTAMP)
64+
Date taken;
65+
66+
protected ItWorkVO() {
67+
}
68+
69+
protected ItWorkVO(String id, long managementServerId, Type type) {
70+
this.id = id;
71+
this.managementServerId = managementServerId;
72+
this.type = type;
73+
this.threadName = Thread.currentThread().getName();
74+
}
75+
76+
public String getId() {
77+
return id;
78+
}
79+
80+
public Date getCreated() {
81+
return created;
82+
}
83+
84+
public long getManagementServerId() {
85+
return managementServerId;
86+
}
87+
88+
public Type getType() {
89+
return type;
90+
}
91+
92+
public String getThreadName() {
93+
return threadName;
94+
}
95+
96+
public State getState() {
97+
return state;
98+
}
99+
100+
public void setState(State state) {
101+
this.state = state;
102+
}
103+
104+
public Date getTaken() {
105+
return taken;
106+
}
107+
}

‎server/src/com/cloud/vm/MauriceMoss.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class MauriceMoss implements VmManager, ClusterManagerListener {
9898
@Inject private AccountDao _accountDao;
9999
@Inject private DomainDao _domainDao;
100100
@Inject private ClusterManager _clusterMgr;
101-
@Inject private StartWorkDao _workDao;
101+
@Inject private ItWorkDao _workDao;
102102

103103
@Inject(adapter=DeploymentPlanner.class)
104104
private Adapters<DeploymentPlanner> _planners;

0 commit comments

Comments
 (0)