11/**
22 * Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
3- *
3+ *
44 * This software is licensed under the GNU General Public License v3 or later.
5- *
5+ *
66 * It is free software: you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License as published by
88 * the Free Software Foundation, either version 3 of the License, or any later version.
99 * This program is distributed in the hope that it will be useful,
1010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1111 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212 * GNU General Public License for more details.
13- *
13+ *
1414 * You should have received a copy of the GNU General Public License
1515 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16- *
16+ *
1717 */
1818package com .cloud .agent .resource ;
1919
@@ -55,7 +55,7 @@ public class DummyResource implements ServerResource {
5555 @ Override
5656 public void disconnected () {
5757 }
58-
58+
5959 @ Override
6060 public Answer executeRequest (Command cmd ) {
6161 if (cmd instanceof CheckNetworkCommand ) {
@@ -76,15 +76,15 @@ public PingCommand getCurrentStatus(long id) {
7676 public Type getType () {
7777 return _type ;
7878 }
79-
79+
8080 protected String getConfiguredProperty (String key , String defaultValue ) {
8181 String val = (String )_params .get (key );
8282 return val ==null ?defaultValue :val ;
8383 }
84-
84+
8585 protected Long getConfiguredProperty (String key , Long defaultValue ) {
8686 String val = (String )_params .get (key );
87-
87+
8888 if (val != null ) {
8989 Long result = Long .parseLong (val );
9090 return result ;
@@ -105,55 +105,55 @@ protected List<Object> getHostInfo() {
105105 info .add (speed );
106106 info .add (ram );
107107 info .add (cap );
108- info .add (dom0ram );
108+ info .add (dom0ram );
109109 return info ;
110-
110+
111111 }
112-
112+
113113 protected void fillNetworkInformation (final StartupCommand cmd ) {
114114
115115 cmd .setPrivateIpAddress ((String )getConfiguredProperty ("private.ip.address" , "127.0.0.1" ));
116116 cmd .setPrivateMacAddress ((String )getConfiguredProperty ("private.mac.address" , "8A:D2:54:3F:7C:C3" ));
117117 cmd .setPrivateNetmask ((String )getConfiguredProperty ("private.ip.netmask" , "255.255.255.0" ));
118-
118+
119119 cmd .setStorageIpAddress ((String )getConfiguredProperty ("private.ip.address" , "127.0.0.1" ));
120120 cmd .setStorageMacAddress ((String )getConfiguredProperty ("private.mac.address" , "8A:D2:54:3F:7C:C3" ));
121121 cmd .setStorageNetmask ((String )getConfiguredProperty ("private.ip.netmask" , "255.255.255.0" ));
122122 cmd .setGatewayIpAddress ((String )getConfiguredProperty ("gateway.ip.address" , "127.0.0.1" ));
123123
124124 }
125-
125+
126126 private Map <String , String > getVersionStrings () {
127127 Map <String , String > result = new HashMap <String , String >();
128128 String hostOs = (String ) _params .get ("Host.OS" );
129129 String hostOsVer = (String ) _params .get ("Host.OS.Version" );
130130 String hostOsKernVer = (String ) _params .get ("Host.OS.Kernel.Version" );
131- result .put ("Host.OS" , hostOs ==null ?"Fedora" :hostOs );
132- result .put ("Host.OS.Version" , hostOsVer ==null ?"14" :hostOsVer );
131+ result .put ("Host.OS" , hostOs ==null ?"Fedora" :hostOs );
132+ result .put ("Host.OS.Version" , hostOsVer ==null ?"14" :hostOsVer );
133133 result .put ("Host.OS.Kernel.Version" , hostOsKernVer ==null ?"2.6.35.6-45.fc14.x86_64" :hostOsKernVer );
134134 return result ;
135135 }
136-
136+
137137 protected StoragePoolInfo initializeLocalStorage () {
138138 String hostIp = (String )getConfiguredProperty ("private.ip.address" , "127.0.0.1" );
139139 String localStoragePath = (String )getConfiguredProperty ("local.storage.path" , "/mnt" );
140140 String lh = hostIp + localStoragePath ;
141141 String uuid = UUID .nameUUIDFromBytes (lh .getBytes ()).toString ();
142-
142+
143143 String capacity = (String )getConfiguredProperty ("local.storage.capacity" , "1000000000" );
144144 String available = (String )getConfiguredProperty ("local.storage.avail" , "10000000" );
145145
146- return new StoragePoolInfo (uuid , hostIp , localStoragePath ,
147- localStoragePath , StoragePoolType .Filesystem ,
146+ return new StoragePoolInfo (uuid , hostIp , localStoragePath ,
147+ localStoragePath , StoragePoolType .Filesystem ,
148148 Long .parseLong (capacity ), Long .parseLong (available ));
149149
150150 }
151-
151+
152152 @ Override
153153 public StartupCommand [] initialize () {
154154 Map <String , VmState > changes = null ;
155155
156-
156+
157157 final List <Object > info = getHostInfo ();
158158
159159 final StartupRoutingCommand cmd = new StartupRoutingCommand ((Integer )info .get (0 ), (Long )info .get (1 ), (Long )info .get (2 ), (Long )info .get (4 ), (String )info .get (3 ), HypervisorType .KVM , RouterPrivateIpStrategy .HostLocal , changes );
@@ -173,16 +173,16 @@ public StartupCommand[] initialize() {
173173 @ Override
174174 public boolean configure (String name , Map <String , Object > params ) {
175175 _name = name ;
176-
176+
177177 String value = (String )params .get ("type" );
178178 _type = Host .Type .valueOf (value );
179-
179+
180180 value = (String )params .get ("negative.reply" );
181181 _negative = Boolean .parseBoolean (value );
182182 setParams (params );
183183 return true ;
184184 }
185-
185+
186186 public void setParams (Map <String , Object > _params ) {
187187 this ._params = _params ;
188188 }
@@ -201,12 +201,12 @@ public boolean start() {
201201 public boolean stop () {
202202 return true ;
203203 }
204-
204+
205205 @ Override
206206 public IAgentControl getAgentControl () {
207207 return _agentControl ;
208208 }
209-
209+
210210 @ Override
211211 public void setAgentControl (IAgentControl agentControl ) {
212212 _agentControl = agentControl ;
0 commit comments