@@ -1822,10 +1822,10 @@ private String getResizeScriptType(KVMStoragePool pool, KVMPhysicalDisk vol) {
18221822 if (pool .getType () == StoragePoolType .CLVM && volFormat == PhysicalDiskFormat .RAW ) {
18231823 return "CLVM" ;
18241824 } else if ((poolType == StoragePoolType .NetworkFilesystem
1825- || poolType == StoragePoolType .SharedMountPoint
1826- || poolType == StoragePoolType .Filesystem
1827- || poolType == StoragePoolType .Gluster )
1828- && volFormat == PhysicalDiskFormat .QCOW2 ) {
1825+ || poolType == StoragePoolType .SharedMountPoint
1826+ || poolType == StoragePoolType .Filesystem
1827+ || poolType == StoragePoolType .Gluster )
1828+ && volFormat == PhysicalDiskFormat .QCOW2 ) {
18291829 return "QCOW2" ;
18301830 }
18311831 return null ;
@@ -2141,7 +2141,7 @@ private ExecutionResult prepareNetworkElementCommand(SetupGuestNetworkCommand cm
21412141 protected ExecutionResult prepareNetworkElementCommand (SetSourceNatCommand cmd ) {
21422142 Connect conn ;
21432143 String routerName = cmd .getAccessDetail (NetworkElementCommand .ROUTER_NAME );
2144- String routerIP = cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
2144+ cmd .getAccessDetail (NetworkElementCommand .ROUTER_IP );
21452145 IpAddressTO pubIP = cmd .getIpAddress ();
21462146
21472147 try {
@@ -2179,7 +2179,6 @@ protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd)
21792179
21802180 protected ExecutionResult prepareNetworkElementCommand (IpAssocVpcCommand cmd ) {
21812181 Connect conn ;
2182- int i = 0 ;
21832182 String routerName = cmd .getAccessDetail (NetworkElementCommand .ROUTER_NAME );
21842183
21852184 try {
@@ -2295,12 +2294,10 @@ protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) {
22952294 int nicNum = 0 ;
22962295 for (IpAddressTO ip : ips ) {
22972296
2298- boolean newNic = false ;
22992297 if (!broadcastUriAllocatedToVM .containsKey (ip .getBroadcastUri ())) {
23002298 /* plug a vif into router */
23012299 VifHotPlug (conn , routerName , ip .getBroadcastUri (), ip .getVifMacAddress ());
23022300 broadcastUriAllocatedToVM .put (ip .getBroadcastUri (), nicPos ++);
2303- newNic = true ;
23042301 }
23052302 nicNum = broadcastUriAllocatedToVM .get (ip .getBroadcastUri ());
23062303
@@ -3441,12 +3438,11 @@ private Answer execute(RebootCommand cmd) {
34413438
34423439 protected Answer execute (RebootRouterCommand cmd ) {
34433440 RebootAnswer answer = (RebootAnswer )execute ((RebootCommand )cmd );
3444- String result = _virtRouterResource .connect (cmd .getPrivateIpAddress ());
3445- if (result == null ) {
3441+ if (_virtRouterResource .connect (cmd .getPrivateIpAddress ())) {
34463442 networkUsage (cmd .getPrivateIpAddress (), "create" , null );
34473443 return answer ;
34483444 } else {
3449- return new Answer (cmd , false , result );
3445+ return new Answer (cmd , false , "Failed to connect to virtual router " + cmd . getVmName () );
34503446 }
34513447 }
34523448
@@ -4057,9 +4053,8 @@ protected CheckSshAnswer execute(CheckSshCommand cmd) {
40574053 s_logger .debug ("Ping command port, " + privateIp + ":" + cmdPort );
40584054 }
40594055
4060- String result = _virtRouterResource .connect (privateIp , cmdPort );
4061- if (result != null ) {
4062- return new CheckSshAnswer (cmd , "Can not ping System vm " + vmName + "due to:" + result );
4056+ if (!_virtRouterResource .connect (privateIp , cmdPort )) {
4057+ return new CheckSshAnswer (cmd , "Can not ping System vm " + vmName + " because of a connection failure" );
40634058 }
40644059
40654060 if (s_logger .isDebugEnabled ()) {
0 commit comments